aboutsummaryrefslogtreecommitdiff
path: root/samples/SampleBase
diff options
context:
space:
mode:
authorBryan Galdrikian <[email protected]>2017-08-28 13:55:34 -0700
committerBryan Galdrikian <[email protected]>2017-08-28 13:55:34 -0700
commit1e887d827e65a084a0ad0ba933c61a8330aeee07 (patch)
tree1e2aab418dadd37f5dc0aae4d8b00e81d909fd24 /samples/SampleBase
parentRemoving ArtistTools and CurveEditor projects (diff)
downloadblast-1e887d827e65a084a0ad0ba933c61a8330aeee07.tar.xz
blast-1e887d827e65a084a0ad0ba933c61a8330aeee07.zip
Candidate 1.1 release.
* SampleAssetViewer now unconditionally loads the commandline-defined asset. * Better error handling in AuthoringTool (stderr and user error handler). * More consistent commandline switches in AuthoringTool and ApexImporter (--ll, --tx, --px flags). * NvBlastExtAuthoring ** Mesh cleaner, tries to remove self intersections and open edges in the interior of a mesh. ** Ability to set interior material to existing (external) material, or a new material id. ** Material ID remapping API. ** Rotation of voronoi cells used for fracturing. * Fixed smoothing groups in FBX exporter code. * Impulse passing from parent to child chunks fixed. * Reading unskinned fbx meshes correctly. * Collision hull generation from fbx meshes fixed. * Win32/64 PerfTest crash fix.
Diffstat (limited to 'samples/SampleBase')
-rw-r--r--samples/SampleBase/blast/BlastAssetModel.cpp11
-rw-r--r--samples/SampleBase/blast/BlastController.cpp8
-rw-r--r--samples/SampleBase/blast/BlastFamilyModelSimple.cpp4
-rw-r--r--samples/SampleBase/blast/BlastModel.cpp48
-rw-r--r--samples/SampleBase/renderer/Mesh.h2
-rw-r--r--samples/SampleBase/scene/SceneController.cpp2
6 files changed, 42 insertions, 33 deletions
diff --git a/samples/SampleBase/blast/BlastAssetModel.cpp b/samples/SampleBase/blast/BlastAssetModel.cpp
index 28ef44d..f0ca302 100644
--- a/samples/SampleBase/blast/BlastAssetModel.cpp
+++ b/samples/SampleBase/blast/BlastAssetModel.cpp
@@ -208,13 +208,14 @@ BlastAssetModel::BlastAssetModel(TkFramework& framework, PxPhysics& physics, PxC
physicsChunks[i].subchunkCount = (uint32_t)physicsSubchunks[i].size();
physicsChunks[i].subchunks = physicsSubchunks[i].data();
}
- if (hullsOffsets)
- {
- NVBLAST_FREE(hullsOffsets);
- }
- if (hulls)
+ if (hulls && hullsOffsets)
{
+ for (uint32_t h = 0; h < hullsOffsets[meshCount]; h++)
+ {
+ hulls[h]->release();
+ }
NVBLAST_FREE(hulls);
+ NVBLAST_FREE(hullsOffsets);
}
}
m_pxAsset = ExtPxAsset::create(tkAsset, physicsChunks.data(), (uint32_t)physicsChunks.size());
diff --git a/samples/SampleBase/blast/BlastController.cpp b/samples/SampleBase/blast/BlastController.cpp
index cc3d5af..b74593d 100644
--- a/samples/SampleBase/blast/BlastController.cpp
+++ b/samples/SampleBase/blast/BlastController.cpp
@@ -368,11 +368,11 @@ void BlastController::drawUI()
{
bool refresh = false;
refresh |= ImGui::Checkbox("Use Shear Damage", &m_extImpactDamageManagerSettings.shearDamage);
- refresh |= ImGui::DragFloat("Impulse Threshold (Min)", &m_extImpactDamageManagerSettings.impulseMinThreshold);
- refresh |= ImGui::DragFloat("Impulse Threshold (Max)", &m_extImpactDamageManagerSettings.impulseMaxThreshold);
- refresh |= ImGui::DragFloat("Damage (Max)", &m_extImpactDamageManagerSettings.damageMax);
+ refresh |= ImGui::DragFloat("Material Hardness", &m_extImpactDamageManagerSettings.hardness);
refresh |= ImGui::DragFloat("Damage Radius (Max)", &m_extImpactDamageManagerSettings.damageRadiusMax);
- refresh |= ImGui::DragFloat("Damage Attenuation", &m_extImpactDamageManagerSettings.damageAttenuation, 1.0f, 0.0f, 1.0f);
+ refresh |= ImGui::DragFloat("Damage Threshold (Min)", &m_extImpactDamageManagerSettings.damageThresholdMin, 1.0f, 0.0f, 1.0f);
+ refresh |= ImGui::DragFloat("Damage Threshold (Max)", &m_extImpactDamageManagerSettings.damageThresholdMax, 1.0f, 0.0f, 1.0f);
+ refresh |= ImGui::DragFloat("Damage Falloff Radius Factor", &m_extImpactDamageManagerSettings.damageFalloffRadiusFactor, 1.0f, 0.0f, 32.0f);
refresh |= ImGui::Checkbox("Impact Damage To Stress Solver", &m_impactDamageToStressEnabled);
if (refresh)
diff --git a/samples/SampleBase/blast/BlastFamilyModelSimple.cpp b/samples/SampleBase/blast/BlastFamilyModelSimple.cpp
index d8a1e33..3576b59 100644
--- a/samples/SampleBase/blast/BlastFamilyModelSimple.cpp
+++ b/samples/SampleBase/blast/BlastFamilyModelSimple.cpp
@@ -107,7 +107,7 @@ public:
memset(&bufferDesc, 0, sizeof(D3D11_BUFFER_DESC));
bufferDesc.BindFlags = D3D11_BIND_INDEX_BUFFER;
- bufferDesc.ByteWidth = sizeof(uint16_t) * m_numFaces;
+ bufferDesc.ByteWidth = sizeof(uint32_t) * m_numFaces;
bufferDesc.CPUAccessFlags = 0;
bufferDesc.MiscFlags = 0;
bufferDesc.Usage = D3D11_USAGE_IMMUTABLE;
@@ -134,7 +134,7 @@ public:
context.IASetVertexBuffers(0, 2, buffers, strides, offsets);
- context.IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R16_UINT, 0);
+ context.IASetIndexBuffer(m_indexBuffer, DXGI_FORMAT_R32_UINT, 0);
if (m_indexBuffer)
context.DrawIndexed(m_numFaces, 0, 0);
diff --git a/samples/SampleBase/blast/BlastModel.cpp b/samples/SampleBase/blast/BlastModel.cpp
index 8e503d3..3477cda 100644
--- a/samples/SampleBase/blast/BlastModel.cpp
+++ b/samples/SampleBase/blast/BlastModel.cpp
@@ -57,41 +57,49 @@ BlastModelPtr BlastModel::loadFromFbxFile(const char* path)
*/
uint32_t* infl;
rdr->getBoneInfluences(infl);
+
+ std::vector<int32_t> indRemap(rdr->getVerticesCount(), -1);
for (uint32_t i = 0; i < rdr->getBoneCount(); ++i)
{
- std::vector<int32_t> indRemap(rdr->getVerticesCount(), -1);
- std::vector<uint32_t> indices;
+ std::fill(indRemap.begin(), indRemap.end(), -1);
SimpleMesh cmesh;
- for (uint32_t j = 0; j < rdr->getVerticesCount(); ++j)
+ const uint32_t vertexCount = rdr->getVerticesCount();
+ const auto normalsArray = rdr->getNormalsArray();
+ const auto positionArray = rdr->getPositionArray();
+ const auto uvArray = rdr->getUvArray();
+
+ for (uint32_t j = 0; j < vertexCount; ++j)
{
if (i == infl[j])
{
indRemap[j] = (int32_t)cmesh.vertices.size();
cmesh.vertices.push_back(SimpleMesh::Vertex());
- cmesh.vertices.back().normal = rdr->getNormalsArray()[j];
- cmesh.vertices.back().position = rdr->getPositionArray()[j];
- cmesh.vertices.back().uv = rdr->getUvArray()[j];
+ cmesh.vertices.back().normal = normalsArray[j];
+ cmesh.vertices.back().position = positionArray[j];
+ cmesh.vertices.back().uv = uvArray[j];
}
}
- for (uint32_t j = 0; j < rdr->getIdicesCount(); j += 3)
+ const uint32_t indicesCount = rdr->getIndicesCount();
+ const auto indexArray = rdr->getIndexArray();
+ for (uint32_t j = 0; j < indicesCount; j += 3)
{
- if (i == infl[rdr->getIndexArray()[j]])
+ //Reverse the winding order
+ for (int tv : { 2, 1, 0})
{
- int32_t lind = rdr->getIndexArray()[j + 2];
- cmesh.indices.push_back(indRemap[lind]);
- lind = rdr->getIndexArray()[j + 1];
- cmesh.indices.push_back(indRemap[lind]);
- lind = rdr->getIndexArray()[j];
- cmesh.indices.push_back(indRemap[lind]);
+ uint32_t oldIndex = indexArray[j + tv];
+ int32_t newIndex = indRemap[oldIndex];
+ if (newIndex >= 0)
+ {
+ cmesh.indices.push_back(newIndex);
+ }
}
}
model->chunks[i].meshes.push_back(Chunk::Mesh());
model->chunks[i].meshes.back().materialIndex = 0;
- model->chunks[i].meshes.back().mesh = cmesh;
-
- NVBLAST_FREE(infl);
+ model->chunks[i].meshes.back().mesh = std::move(cmesh);
}
+ NVBLAST_FREE(infl);
return model;
}
@@ -181,9 +189,9 @@ BlastModelPtr BlastModel::loadFromFileTinyLoader(const char* path)
{
for (uint32_t i = 0; i < pMesh.mesh.indices.size(); i += 3)
{
- chunkMesh.indices[i] = (uint16_t)pMesh.mesh.indices[i + 2];
- chunkMesh.indices[i + 1] = (uint16_t)pMesh.mesh.indices[i + 1];
- chunkMesh.indices[i + 2] = (uint16_t)pMesh.mesh.indices[i];
+ chunkMesh.indices[i] = (uint32_t)pMesh.mesh.indices[i + 2];
+ chunkMesh.indices[i + 1] = (uint32_t)pMesh.mesh.indices[i + 1];
+ chunkMesh.indices[i + 2] = (uint32_t)pMesh.mesh.indices[i];
}
}
// create vertex buffer
diff --git a/samples/SampleBase/renderer/Mesh.h b/samples/SampleBase/renderer/Mesh.h
index 8423af8..0619696 100644
--- a/samples/SampleBase/renderer/Mesh.h
+++ b/samples/SampleBase/renderer/Mesh.h
@@ -59,7 +59,7 @@ public:
virtual uint32_t getVertexStride() { return sizeof(Vertex); }
std::vector<Vertex> vertices;
- std::vector<uint16_t> indices;
+ std::vector<uint32_t> indices;
physx::PxVec3 extents;
physx::PxVec3 center;
diff --git a/samples/SampleBase/scene/SceneController.cpp b/samples/SampleBase/scene/SceneController.cpp
index 390682c..2bcfca9 100644
--- a/samples/SampleBase/scene/SceneController.cpp
+++ b/samples/SampleBase/scene/SceneController.cpp
@@ -1189,7 +1189,7 @@ void SceneController::onSampleStart()
}
// add both asset file and asset list from config
- addAssets(config.additionalAssetList, packmanResourcesAdded);
+ addAssets(config.additionalAssetList, true); // only used for command line assets
addAssets(assetList, packmanResourcesAdded);
// prepare scene