2 Copyright (c) 2012 Advanced Micro Devices, Inc.
4 This software is provided 'as-is', without any express or implied warranty.
5 In no event will the authors be held liable for any damages arising from the use of this software.
6 Permission is granted to anyone to use this software for any purpose,
7 including commercial applications, and to alter it and redistribute it freely,
8 subject to the following restrictions:
10 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
11 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
12 3. This notice may not be removed or altered from any source distribution.
14 //Originally written by Takahiro Harada
17 #ifndef ADL_CONTACT4_H
18 #define ADL_CONTACT4_H
20 #ifdef CL_PLATFORM_AMD
21 #include "AdlConstraint4.h"
24 typedef adl::Buffer<Constraint4>* SolverData;
26 typedef void* SolverData;
29 typedef void* ShapeDataType;
34 _MEM_ALIGNED_ALLOCATOR16;
38 // float m_restituitionCoeff;
39 // float m_frictionCoeff;
40 u16 m_restituitionCoeffCmp;
41 u16 m_frictionCoeffCmp;
47 // todo. make it safer
48 int& getBatchIdx() { return m_batchIdx; }
49 float getRestituitionCoeff() const { return ((float)m_restituitionCoeffCmp/(float)0xffff); }
50 void setRestituitionCoeff( float c ) { ADLASSERT( c >= 0.f && c <= 1.f ); m_restituitionCoeffCmp = (u16)(c*0xffff); }
51 float getFrictionCoeff() const { return ((float)m_frictionCoeffCmp/(float)0xffff); }
52 void setFrictionCoeff( float c ) { ADLASSERT( c >= 0.f && c <= 1.f ); m_frictionCoeffCmp = (u16)(c*0xffff); }
54 float& getNPoints() { return m_worldNormal.w; }
55 float getNPoints() const { return m_worldNormal.w; }
57 float getPenetration(int idx) const { return m_worldPos[idx].w; }
59 bool isInvalid() const { return ((u32)m_bodyAPtr+(u32)m_bodyBPtr) == 0; }
72 float m_nPoints; // for cl
76 float m_restituitionCoeff;
77 float m_frictionCoeff;
86 float& getNPoints() { return m_data.m_nPoints; }
87 float getNPoints() const { return m_data.m_nPoints; }
89 float getPenetration(int idx) const { return m_worldPos[idx].w; }
92 // void load(int idx, const ContactPoint& src);
94 // void store(int idx, ContactPoint& dst) const;
96 bool isInvalid() const { return ((u32)m_bodyAPtr+(u32)m_bodyBPtr) == 0; }
101 #endif //ADL_CONTACT4_H