24 #define MSTRINGIFY(A) #A
26 #include "HLSL/PrepareLinks.hlsl"
28 #include "HLSL/UpdatePositionsFromVelocities.hlsl"
29 static char* SolvePositionsHLSLString =
30 #include "HLSL/SolvePositions.hlsl"
31 static char* UpdateNodesHLSLString =
32 #include "HLSL/UpdateNodes.hlsl"
33 static char* UpdatePositionsHLSLString =
34 #include "HLSL/UpdatePositions.hlsl"
35 static char* UpdateConstantsHLSLString =
36 #include "HLSL/UpdateConstants.hlsl"
37 static char* IntegrateHLSLString =
38 #include "HLSL/Integrate.hlsl"
39 static char* ApplyForcesHLSLString =
40 #include "HLSL/ApplyForces.hlsl"
41 static char* UpdateNormalsHLSLString =
42 #include "HLSL/UpdateNormals.hlsl"
43 static char* OutputToVertexArrayHLSLString =
44 #include "HLSL/OutputToVertexArray.hlsl"
45 static char* VSolveLinksHLSLString =
46 #include "HLSL/VSolveLinks.hlsl"
47 static char* ComputeBoundsHLSLString =
48 #include "HLSL/ComputeBounds.hlsl"
49 static char* SolveCollisionsAndUpdateVelocitiesHLSLString =
50 #include "HLSL/SolveCollisionsAndUpdateVelocities.hlsl"
54 m_dx11Links( d3dDevice, d3dDeviceContext, &m_links, false ),
63 m_d3dDevice = d3dDevice;
80 int newSize = previousSize + numLinks;
143 batchValues.
resize( numLinks, 0 );
147 for(
int linkIndex = 0; linkIndex < numLinks; ++linkIndex )
151 if( vertex0 > maxVertex )
153 if( vertex1 > maxVertex )
156 int numVertices = maxVertex + 1;
162 vertexConnectedColourLists.
resize(numVertices);
169 for(
int linkIndex = 0; linkIndex < numLinks; ++linkIndex )
190 batchValues[linkIndex] = colour;
195 for(
int i = 0; i < numLinks; ++i )
197 int batch = batchValues[i];
198 if( batch >= batchCounts.
size() )
201 ++(batchCounts[batch]);
210 for(
int batchIndex = 0; batchIndex < batchCounts.
size(); ++batchIndex )
214 sum += batchCounts[batchIndex];
232 for(
int batch = 0; batch < batchCounts.
size(); ++batch )
233 batchCounts[batch] = 0;
236 for(
int linkIndex = 0; linkIndex < numLinks; ++linkIndex )
247 int batch = batchValues[linkIndex];
250 batchCounts[batch] = batchCounts[batch] + 1;
251 m_links[newLocation] = m_links_Backup[linkLocation];
253 m_linkStrength[newLocation] = m_linkStrength_Backup[linkLocation];
254 m_linksMassLSC[newLocation] = m_linksMassLSC_Backup[linkLocation];
268 m_dx11ClothIdentifier( d3dDevice, d3dDeviceContext, &m_clothIdentifier, false ),
269 m_dx11VertexPosition( d3dDevice, d3dDeviceContext, &m_vertexPosition, false ),
270 m_dx11VertexPreviousPosition( d3dDevice, d3dDeviceContext, &m_vertexPreviousPosition, false ),
271 m_dx11VertexVelocity( d3dDevice, d3dDeviceContext, &m_vertexVelocity, false ),
272 m_dx11VertexForceAccumulator( d3dDevice, d3dDeviceContext, &m_vertexForceAccumulator, false ),
273 m_dx11VertexNormal( d3dDevice, d3dDeviceContext, &m_vertexNormal, false ),
274 m_dx11VertexInverseMass( d3dDevice, d3dDeviceContext, &m_vertexInverseMass, false ),
275 m_dx11VertexArea( d3dDevice, d3dDeviceContext, &m_vertexArea, false ),
276 m_dx11VertexTriangleCount( d3dDevice, d3dDeviceContext, &m_vertexTriangleCount, false )
356 m_dx11VertexIndices( d3dDevice, d3dDeviceContext, &m_vertexIndices, false ),
357 m_dx11Area( d3dDevice, d3dDeviceContext, &m_area, false ),
358 m_dx11Normal( d3dDevice, d3dDeviceContext, &m_normal, false )
374 int newSize = previousSize + numTriangles;
430 if( numTriangles == 0 )
435 batchValues.
resize( numTriangles );
439 for(
int triangleIndex = 0; triangleIndex < numTriangles; ++triangleIndex )
445 if( vertex0 > maxVertex )
447 if( vertex1 > maxVertex )
449 if( vertex2 > maxVertex )
452 int numVertices = maxVertex + 1;
458 vertexConnectedColourLists.
resize(numVertices);
465 for(
int triangleIndex = 0; triangleIndex < numTriangles; ++triangleIndex )
498 batchValues[triangleIndex] = colour;
504 for(
int i = 0; i < numTriangles; ++i )
506 int batch = batchValues[i];
507 if( batch >= batchCounts.
size() )
510 ++(batchCounts[batch]);
519 for(
int batchIndex = 0; batchIndex < batchCounts.
size(); ++batchIndex )
523 sum += batchCounts[batchIndex];
535 for(
int batch = 0; batch < batchCounts.
size(); ++batch )
536 batchCounts[batch] = 0;
539 for(
int triangleIndex = 0; triangleIndex < numTriangles; ++triangleIndex )
550 int batch = batchValues[triangleIndex];
553 batchCounts[batch] = batchCounts[batch] + 1;
554 m_vertexIndices[newLocation] = m_vertexIndices_Backup[triangleLocation];
555 m_area[newLocation] = m_area_Backup[triangleLocation];
556 m_normal[newLocation] = m_normal_Backup[triangleLocation];
575 m_dx11Device( dx11Device ),
576 m_dx11Context( dx11Context ),
577 dxFunctions( m_dx11Device, m_dx11Context, dx11CompileFromMemory ),
578 m_linkData(m_dx11Device, m_dx11Context),
579 m_vertexData(m_dx11Device, m_dx11Context),
580 m_triangleData(m_dx11Device, m_dx11Context),
581 m_dx11PerClothAcceleration( m_dx11Device, m_dx11Context, &m_perClothAcceleration, true ),
582 m_dx11PerClothWindVelocity( m_dx11Device, m_dx11Context, &m_perClothWindVelocity, true ),
583 m_dx11PerClothDampingFactor( m_dx11Device, m_dx11Context, &m_perClothDampingFactor, true ),
584 m_dx11PerClothVelocityCorrectionCoefficient( m_dx11Device, m_dx11Context, &m_perClothVelocityCorrectionCoefficient, true ),
585 m_dx11PerClothLiftFactor( m_dx11Device, m_dx11Context, &m_perClothLiftFactor, true ),
586 m_dx11PerClothDragFactor( m_dx11Device, m_dx11Context, &m_perClothDragFactor, true ),
587 m_dx11PerClothMediumDensity( m_dx11Device, m_dx11Context, &m_perClothMediumDensity, true ),
588 m_dx11PerClothCollisionObjects( m_dx11Device, m_dx11Context, &m_perClothCollisionObjects, true ),
589 m_dx11CollisionObjectDetails( m_dx11Device, m_dx11Context, &m_collisionObjectDetails, true ),
590 m_dx11PerClothMinBounds( m_dx11Device, m_dx11Context, &m_perClothMinBounds, false ),
591 m_dx11PerClothMaxBounds( m_dx11Device, m_dx11Context, &m_perClothMaxBounds, false ),
592 m_dx11PerClothFriction( m_dx11Device, m_dx11Context, &m_perClothFriction, false ),
593 m_enableUpdateBounds(false)
652 for(
int softBodyIndex = 0; softBodyIndex <
m_softBodySet.size(); ++softBodyIndex )
661 for(
int vertex = 0; vertex < numVertices; ++vertex )
664 Point3 vertexPosition(
getVertexData().getVertexPositions()[firstVertex + vertex] );
666 softBody->
m_nodes[vertex].m_x.setX( vertexPosition.getX() );
667 softBody->
m_nodes[vertex].m_x.setY( vertexPosition.getY() );
668 softBody->
m_nodes[vertex].m_x.setZ( vertexPosition.getZ() );
670 softBody->
m_nodes[vertex].m_n.setX( vertexPosition.getX() );
671 softBody->
m_nodes[vertex].m_n.setY( vertexPosition.getY() );
672 softBody->
m_nodes[vertex].m_n.setZ( vertexPosition.getZ() );
689 for(
int softBodyIndex = 0; softBodyIndex < softBodies.
size(); ++softBodyIndex )
691 btSoftBody *softBody = softBodies[ softBodyIndex ];
715 int maxVertices = numVertices;
721 int maxTriangles = numTriangles;
725 for(
int vertex = 0; vertex < numVertices; ++vertex )
727 Point3 multPoint(softBody->
m_nodes[vertex].m_x.getX(), softBody->
m_nodes[vertex].m_x.getY(), softBody->
m_nodes[vertex].m_x.getZ());
735 float vertexInverseMass = softBody->
m_nodes[vertex].m_im;
736 desc.setInverseMass(vertexInverseMass);
742 for(
int triangle = 0; triangle < numTriangles; ++triangle )
746 int vertexIndex0 = (softBody->
m_faces[triangle].m_n[0] - &(softBody->
m_nodes[0]));
747 int vertexIndex1 = (softBody->
m_faces[triangle].m_n[1] - &(softBody->
m_nodes[0]));
748 int vertexIndex2 = (softBody->
m_faces[triangle].m_n[2] - &(softBody->
m_nodes[0]));
760 int maxLinks = numLinks;
766 for(
int link = 0; link < numLinks; ++link )
768 int vertexIndex0 = softBody->
m_links[link].m_n[0] - &(softBody->
m_nodes[0]);
769 int vertexIndex1 = softBody->
m_links[link].m_n[1] - &(softBody->
m_nodes[0]);
831 constBuffer.
epsilon = FLT_EPSILON;
834 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
847 int numBlocks = (constBuffer.
numNodes + (128-1)) / 128;
852 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
853 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
854 m_dx11Context->CSSetUnorderedAccessViews( 1, 1, &pUAViewNULL, NULL );
856 ID3D11Buffer *pBufferNull = NULL;
868 constBuffer.
epsilon = FLT_EPSILON;
871 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
886 int numBlocks = (constBuffer.
numNodes + (128-1)) / 128;
891 ID3D11ShaderResourceView* pViewNULL = NULL;
894 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
895 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
896 m_dx11Context->CSSetUnorderedAccessViews( 1, 1, &pUAViewNULL, NULL );
898 ID3D11Buffer *pBufferNull = NULL;
910 constBuffer.
numFaces = numTriangles;
913 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
931 int numBlocks = (numTriangles + (128-1)) / 128;
936 ID3D11ShaderResourceView* pViewNULL = NULL;
939 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
940 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
941 m_dx11Context->CSSetUnorderedAccessViews( 1, 1, &pUAViewNULL, NULL );
943 ID3D11Buffer *pBufferNull = NULL;
950 using namespace Vectormath::Aos;
987 float dtInverseMass = solverdt*inverseMass;
992 vertexForce += force;
998 using namespace Vectormath::Aos;
1014 constBuffer.solverdt = solverdt;
1015 constBuffer.epsilon = FLT_EPSILON;
1018 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
1020 memcpy( MappedResource.pData, &constBuffer,
sizeof(
ApplyForcesCB) );
1041 int numBlocks = (constBuffer.numNodes + (128-1)) / 128;
1046 ID3D11ShaderResourceView* pViewNULL = NULL;
1057 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
1058 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
1059 m_dx11Context->CSSetUnorderedAccessViews( 1, 1, &pUAViewNULL, NULL );
1061 ID3D11Buffer *pBufferNull = NULL;
1082 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
1084 memcpy( MappedResource.pData, &constBuffer,
sizeof(
IntegrateCB) );
1099 int numBlocks = (constBuffer.
numNodes + (128-1)) / 128;
1104 ID3D11ShaderResourceView* pViewNULL = NULL;
1107 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
1108 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
1109 m_dx11Context->CSSetUnorderedAccessViews( 1, 1, &pUAViewNULL, NULL );
1110 m_dx11Context->CSSetUnorderedAccessViews( 2, 1, &pUAViewNULL, NULL );
1111 m_dx11Context->CSSetUnorderedAccessViews( 3, 1, &pUAViewNULL, NULL );
1113 ID3D11Buffer *pBufferNull = NULL;
1126 float area =
length( crossProduct );
1137 unsigned int mantissa : 23;
1138 unsigned int exponent : 8;
1139 unsigned int sign : 1;
1145 unsigned int uintValue;
1151 for(
int softBodyIndex = 0; softBodyIndex <
m_softBodySet.size(); ++softBodyIndex )
1169 for(
int softBodyIndex = 0; softBodyIndex <
m_softBodySet.size(); ++softBodyIndex )
1178 fai.uintValue = minBoundUInt.
x;
1179 fai.uintValue ^= (((fai.uintValue >> 31) - 1) | 0x80000000);
1180 minBound.
setX( fai.floatValue );
1181 fai.uintValue = minBoundUInt.
y;
1182 fai.uintValue ^= (((fai.uintValue >> 31) - 1) | 0x80000000);
1183 minBound.
setY( fai.floatValue );
1184 fai.uintValue = minBoundUInt.
z;
1185 fai.uintValue ^= (((fai.uintValue >> 31) - 1) | 0x80000000);
1186 minBound.
setZ( fai.floatValue );
1189 fai.uintValue = maxBoundUInt.
x;
1190 fai.uintValue ^= (((fai.uintValue >> 31) - 1) | 0x80000000);
1191 maxBound.
setX( fai.floatValue );
1192 fai.uintValue = maxBoundUInt.
y;
1193 fai.uintValue ^= (((fai.uintValue >> 31) - 1) | 0x80000000);
1194 maxBound.
setY( fai.floatValue );
1195 fai.uintValue = maxBoundUInt.
z;
1196 fai.uintValue ^= (((fai.uintValue >> 31) - 1) | 0x80000000);
1197 maxBound.
setZ( fai.floatValue );
1200 m_softBodySet[softBodyIndex]->updateBounds( minBound, maxBound );
1206 using namespace Vectormath::Aos;
1216 for(
int linkIndex = 0; linkIndex < numLinks; ++linkIndex )
1223 float massLSC = (invMass0 + invMass1)/linearStiffness;
1226 float restLengthSquared = restLength*restLength;
1264 int currentCloth = 0;
1269 if( nextCloth != currentCloth )
1275 currentCloth = nextCloth;
1276 startIndex = collisionObject;
1332 if( m_numberOfVelocityIterations > 0 )
1370 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
1372 memcpy( MappedResource.pData, &constBuffer,
sizeof(
PrepareLinksCB) );
1387 int numBlocks = (constBuffer.
numLinks + (128-1)) / 128;
1392 ID3D11ShaderResourceView* pViewNULL = NULL;
1397 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
1398 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
1399 m_dx11Context->CSSetUnorderedAccessViews( 1, 1, &pUAViewNULL, NULL );
1401 ID3D11Buffer *pBufferNull = NULL;
1417 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
1432 int numBlocks = (constBuffer.
numNodes + (128-1)) / 128;
1437 ID3D11ShaderResourceView* pViewNULL = NULL;
1440 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
1441 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
1442 m_dx11Context->CSSetUnorderedAccessViews( 1, 1, &pUAViewNULL, NULL );
1444 ID3D11Buffer *pBufferNull = NULL;
1459 constBuffer.
kst = kst;
1460 constBuffer.
ti = ti;
1462 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
1479 int numBlocks = (constBuffer.
numLinks + (128-1)) / 128;
1484 ID3D11ShaderResourceView* pViewNULL = NULL;
1490 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
1491 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
1493 ID3D11Buffer *pBufferNull = NULL;
1509 constBuffer.
kst = kst;
1511 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
1513 memcpy( MappedResource.pData, &constBuffer,
sizeof(
VSolveLinksCB) );
1528 int numBlocks = (constBuffer.
numLinks + (128-1)) / 128;
1533 ID3D11ShaderResourceView* pViewNULL = NULL;
1539 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
1540 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
1542 ID3D11Buffer *pBufferNull = NULL;
1558 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
1578 int numBlocks = (constBuffer.
numNodes + (128-1)) / 128;
1583 ID3D11ShaderResourceView* pViewNULL = NULL;
1590 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
1591 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
1592 m_dx11Context->CSSetUnorderedAccessViews( 1, 1, &pUAViewNULL, NULL );
1594 ID3D11Buffer *pBufferNull = NULL;
1610 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
1629 int numBlocks = (constBuffer.
numNodes + (128-1)) / 128;
1634 ID3D11ShaderResourceView* pViewNULL = NULL;
1640 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
1641 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
1642 m_dx11Context->CSSetUnorderedAccessViews( 1, 1, &pUAViewNULL, NULL );
1644 ID3D11Buffer *pBufferNull = NULL;
1661 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
1663 memcpy( MappedResource.pData, &constBuffer,
sizeof(
ComputeBoundsCB) );
1677 int numBlocks = (constBuffer.
numNodes + (128-1)) / 128;
1682 ID3D11ShaderResourceView* pViewNULL = NULL;
1686 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
1687 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
1688 m_dx11Context->CSSetUnorderedAccessViews( 1, 1, &pUAViewNULL, NULL );
1690 ID3D11Buffer *pBufferNull = NULL;
1713 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
1734 int numBlocks = (constBuffer.
numNodes + (128-1)) / 128;
1739 ID3D11ShaderResourceView* pViewNULL = NULL;
1747 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
1748 m_dx11Context->CSSetUnorderedAccessViews( 0, 1, &pUAViewNULL, NULL );
1749 m_dx11Context->CSSetUnorderedAccessViews( 1, 1, &pUAViewNULL, NULL );
1750 m_dx11Context->CSSetUnorderedAccessViews( 2, 1, &pUAViewNULL, NULL );
1752 ID3D11Buffer *pBufferNull = NULL;
1776 for(
int softBodyIndex = 0; softBodyIndex <
m_softBodySet.size(); ++softBodyIndex )
1779 if( softBodyInterface->
getSoftBody() == softBody )
1780 return softBodyInterface;
1787 for(
int softBodyIndex = 0; softBodyIndex <
m_softBodySet.size(); ++softBodyIndex )
1790 if( softBodyInterface->
getSoftBody() == softBody )
1791 return softBodyInterface;
1798 for(
int softBodyIndex = 0; softBodyIndex <
m_softBodySet.size(); ++softBodyIndex )
1801 if( softBodyInterface->
getSoftBody() == softBody )
1802 return softBodyIndex;
1821 const int lastVertex = firstVertex + currentCloth->
getNumVertices();
1830 const int lastVertex = firstVertex + currentCloth->
getNumVertices();
1838 float *vertexPointer = basePointer + vertexOffset;
1840 for(
int vertexIndex = firstVertex; vertexIndex < lastVertex; ++vertexIndex )
1843 *(vertexPointer + 0) = position.
getX();
1844 *(vertexPointer + 1) = position.
getY();
1845 *(vertexPointer + 2) = position.
getZ();
1846 vertexPointer += vertexStride;
1853 float *normalPointer = basePointer + normalOffset;
1855 for(
int vertexIndex = firstVertex; vertexIndex < lastVertex; ++vertexIndex )
1858 *(normalPointer + 0) = normal.
getX();
1859 *(normalPointer + 1) = normal.
getY();
1860 *(normalPointer + 2) = normal.
getZ();
1861 normalPointer += normalStride;
1880 SAFE_RELEASE( outputToVertexArrayWithNormalsKernel.constBuffer );
1881 SAFE_RELEASE( outputToVertexArrayWithNormalsKernel.kernel );
1882 SAFE_RELEASE( outputToVertexArrayWithoutNormalsKernel.constBuffer );
1883 SAFE_RELEASE( outputToVertexArrayWithoutNormalsKernel.kernel );
1894 bool returnVal =
true;
1901 if( !outputToVertexArrayWithNormalsKernel.constBuffer)
1904 if( !outputToVertexArrayWithoutNormalsKernel.constBuffer )
1928 const int lastVertex = firstVertex + currentCloth->
getNumVertices();
1942 ID3D11ComputeShader* outputToVertexArrayShader = outputToVertexArrayWithoutNormalsKernel.kernel;
1943 ID3D11Buffer* outputToVertexArrayConstBuffer = outputToVertexArrayWithoutNormalsKernel.constBuffer;
1953 outputToVertexArrayShader = outputToVertexArrayWithNormalsKernel.kernel;
1954 outputToVertexArrayConstBuffer = outputToVertexArrayWithNormalsKernel.constBuffer;
1958 D3D11_MAPPED_SUBRESOURCE MappedResource = {0};
1968 ID3D11UnorderedAccessView* dx11UAV = dx11VertexBuffer->
getDX11UAV();
1974 int numBlocks = (constBuffer.
numNodes + (128-1)) / 128;
1979 ID3D11ShaderResourceView* pViewNULL = NULL;
1983 ID3D11UnorderedAccessView* pUAViewNULL = NULL;
1986 ID3D11Buffer *pBufferNull = NULL;
1997 const char *cs5String =
"cs_5_0";
2000 ID3DBlob* pErrorBlob = NULL;
2001 ID3DBlob* pBlob = NULL;
2002 ID3D11ComputeShader* kernelPointer = 0;
2004 hr = m_dx11CompileFromMemory(
2006 strlen(shaderString),
2012 D3D10_SHADER_ENABLE_STRICTNESS,
2023 btAssert(
"Compilation of compute shader failed\n" );
2024 char *debugString = (
char*)pErrorBlob->GetBufferPointer();
2025 OutputDebugStringA( debugString );
2038 hr =
m_dx11Device->CreateComputeShader( pBlob->GetBufferPointer(), pBlob->GetBufferSize(), NULL, &kernelPointer );
2047 ID3D11Buffer* constBuffer = 0;
2048 if( constBufferSize > 0 )
2051 D3D11_BUFFER_DESC constant_buffer_desc;
2052 ZeroMemory(&constant_buffer_desc,
sizeof(constant_buffer_desc));
2053 constant_buffer_desc.ByteWidth = constBufferSize;
2054 constant_buffer_desc.Usage = D3D11_USAGE_DYNAMIC;
2055 constant_buffer_desc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
2056 constant_buffer_desc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
2057 m_dx11Device->CreateBuffer(&constant_buffer_desc, NULL, &constBuffer);
2071 descriptor.
kernel = kernelPointer;
2083 bool returnVal =
true;
2147 return outTransform;
2153 float scalarMargin = this->getSoftBody()->getCollisionShape()->getMargin();
2154 btVector3 vectorMargin( scalarMargin, scalarMargin, scalarMargin );
2155 m_softBody->m_bounds[0] = lowerBound - vectorMargin;
2156 m_softBody->m_bounds[1] = upperBound + vectorMargin;
2169 if( softBodyIndex >= 0 )
2183 newCollisionShapeDescription.
radius = capsule->getRadius();
2184 newCollisionShapeDescription.
halfHeight = capsule->getHalfHeight();
2185 newCollisionShapeDescription.
margin = capsule->getMargin();
2186 newCollisionShapeDescription.
friction = friction;
2194 printf(
"Unsupported collision shape type\n");
2214 for(
int softBodyIndex = 0; softBodyIndex <
m_softBodySet.size(); ++softBodyIndex )