|
|
@ -180,7 +180,7 @@ void CMeshMRMGeom::CLod::optimizeTriangleOrder()
|
|
|
|
static NLMISC::CAABBoxExt makeBBox(const std::vector<CVector> &Vertices)
|
|
|
|
static NLMISC::CAABBoxExt makeBBox(const std::vector<CVector> &Vertices)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
NLMISC::CAABBox ret;
|
|
|
|
NLMISC::CAABBox ret;
|
|
|
|
nlassert(Vertices.size());
|
|
|
|
nlassert(!Vertices.empty());
|
|
|
|
ret.setCenter(Vertices[0]);
|
|
|
|
ret.setCenter(Vertices[0]);
|
|
|
|
for(sint i=0;i<(sint)Vertices.size();i++)
|
|
|
|
for(sint i=0;i<(sint)Vertices.size();i++)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -236,7 +236,7 @@ void CMeshMRMGeom::build(CMesh::CMeshBuild &m, std::vector<CMesh::CMeshBuild*>
|
|
|
|
uint numMaxMaterial, const CMRMParameters ¶ms)
|
|
|
|
uint numMaxMaterial, const CMRMParameters ¶ms)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Empty geometry?
|
|
|
|
// Empty geometry?
|
|
|
|
if(m.Vertices.size()==0 || m.Faces.size()==0)
|
|
|
|
if(m.Vertices.empty() || m.Faces.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_VBufferFinal.setNumVertices(0);
|
|
|
|
_VBufferFinal.setNumVertices(0);
|
|
|
|
_VBufferFinal.reserve(0);
|
|
|
|
_VBufferFinal.reserve(0);
|
|
|
@ -308,7 +308,7 @@ void CMeshMRMGeom::build(CMesh::CMeshBuild &m, std::vector<CMesh::CMeshBuild*>
|
|
|
|
_LevelDetail.MaxFaceUsed= 0;
|
|
|
|
_LevelDetail.MaxFaceUsed= 0;
|
|
|
|
_LevelDetail.MinFaceUsed= 0;
|
|
|
|
_LevelDetail.MinFaceUsed= 0;
|
|
|
|
// Count of primitive block
|
|
|
|
// Count of primitive block
|
|
|
|
if(_Lods.size()>0)
|
|
|
|
if (!_Lods.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
uint pb;
|
|
|
|
uint pb;
|
|
|
|
// Compute MinFaces.
|
|
|
|
// Compute MinFaces.
|
|
|
@ -469,7 +469,7 @@ void CMeshMRMGeom::applyGeomorph(std::vector<CMRMWedgeGeom> &geoms, float alpha
|
|
|
|
void CMeshMRMGeom::applyGeomorphWithVBHardPtr(std::vector<CMRMWedgeGeom> &geoms, float alphaLod, uint8 *vertexDestPtr)
|
|
|
|
void CMeshMRMGeom::applyGeomorphWithVBHardPtr(std::vector<CMRMWedgeGeom> &geoms, float alphaLod, uint8 *vertexDestPtr)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// no geomorphs? quit.
|
|
|
|
// no geomorphs? quit.
|
|
|
|
if(geoms.size()==0)
|
|
|
|
if(geoms.empty())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
clamp(alphaLod, 0.f, 1.f);
|
|
|
|
clamp(alphaLod, 0.f, 1.f);
|
|
|
@ -900,7 +900,7 @@ inline sint CMeshMRMGeom::chooseLod(float alphaMRM, float &alphaLod)
|
|
|
|
void CMeshMRMGeom::render(IDriver *drv, CTransformShape *trans, float polygonCount, uint32 rdrFlags, float globalAlpha)
|
|
|
|
void CMeshMRMGeom::render(IDriver *drv, CTransformShape *trans, float polygonCount, uint32 rdrFlags, float globalAlpha)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
nlassert(drv);
|
|
|
|
nlassert(drv);
|
|
|
|
if(_Lods.size()==0)
|
|
|
|
if(_Lods.empty())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -922,7 +922,7 @@ void CMeshMRMGeom::render(IDriver *drv, CTransformShape *trans, float polygonCou
|
|
|
|
|
|
|
|
|
|
|
|
// Render the choosen Lod.
|
|
|
|
// Render the choosen Lod.
|
|
|
|
CLod &lod= _Lods[numLod];
|
|
|
|
CLod &lod= _Lods[numLod];
|
|
|
|
if(lod.RdrPass.size()==0)
|
|
|
|
if(lod.RdrPass.empty())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1104,7 +1104,7 @@ void CMeshMRMGeom::renderSkin(CTransformShape *trans, float alphaMRM)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
H_AUTO( NL3D_MeshMRMGeom_renderSkin );
|
|
|
|
H_AUTO( NL3D_MeshMRMGeom_renderSkin );
|
|
|
|
|
|
|
|
|
|
|
|
if(_Lods.size()==0)
|
|
|
|
if(_Lods.empty())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1126,7 +1126,7 @@ void CMeshMRMGeom::renderSkin(CTransformShape *trans, float alphaMRM)
|
|
|
|
|
|
|
|
|
|
|
|
// Render the choosen Lod.
|
|
|
|
// Render the choosen Lod.
|
|
|
|
CLod &lod= _Lods[numLod];
|
|
|
|
CLod &lod= _Lods[numLod];
|
|
|
|
if(lod.RdrPass.size()==0)
|
|
|
|
if(lod.RdrPass.empty())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1295,7 +1295,7 @@ sint CMeshMRMGeom::renderSkinGroupGeom(CMeshMRMInstance *mi, float alphaMRM, uin
|
|
|
|
|
|
|
|
|
|
|
|
// Render the choosen Lod.
|
|
|
|
// Render the choosen Lod.
|
|
|
|
CLod &lod= _Lods[numLod];
|
|
|
|
CLod &lod= _Lods[numLod];
|
|
|
|
if(lod.RdrPass.size()==0)
|
|
|
|
if(lod.RdrPass.empty())
|
|
|
|
// return no vertices added
|
|
|
|
// return no vertices added
|
|
|
|
return 0;
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
|
|
|
@ -1942,7 +1942,7 @@ void CMeshMRMGeom::loadFirstLod(NLMISC::IStream &f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// If empty MRM, quit.
|
|
|
|
// If empty MRM, quit.
|
|
|
|
if(_LodInfos.size()==0)
|
|
|
|
if(_LodInfos.empty())
|
|
|
|
return;
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
/* If the version is <4, then SkinWeights are serialised per Lod.
|
|
|
|
/* If the version is <4, then SkinWeights are serialised per Lod.
|
|
|
@ -2431,7 +2431,7 @@ void CMeshMRMGeom::compileRunTime()
|
|
|
|
_PreciseClipping= _BBox.getRadius() >= NL3D_MESH_PRECISE_CLIP_THRESHOLD;
|
|
|
|
_PreciseClipping= _BBox.getRadius() >= NL3D_MESH_PRECISE_CLIP_THRESHOLD;
|
|
|
|
|
|
|
|
|
|
|
|
// Compute if can support SkinGrouping rendering
|
|
|
|
// Compute if can support SkinGrouping rendering
|
|
|
|
if(_Lods.size()==0 || !_Skinned)
|
|
|
|
if(_Lods.empty() || !_Skinned)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_SupportSkinGrouping= false;
|
|
|
|
_SupportSkinGrouping= false;
|
|
|
|
_SupportShadowSkinGrouping= false;
|
|
|
|
_SupportShadowSkinGrouping= false;
|
|
|
@ -2451,7 +2451,7 @@ void CMeshMRMGeom::compileRunTime()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Support MeshBlockRendering only if not skinned/meshMorphed.
|
|
|
|
// Support MeshBlockRendering only if not skinned/meshMorphed.
|
|
|
|
_SupportMeshBlockRendering= !_Skinned && _MeshMorpher.BlendShapes.size()==0;
|
|
|
|
_SupportMeshBlockRendering= !_Skinned && _MeshMorpher.BlendShapes.empty();
|
|
|
|
|
|
|
|
|
|
|
|
// \todo yoyo: support later MeshVertexProgram
|
|
|
|
// \todo yoyo: support later MeshVertexProgram
|
|
|
|
_SupportMeshBlockRendering= _SupportMeshBlockRendering && _MeshVertexProgram==NULL;
|
|
|
|
_SupportMeshBlockRendering= _SupportMeshBlockRendering && _MeshVertexProgram==NULL;
|
|
|
@ -3367,7 +3367,7 @@ void CMeshMRMGeom::updateRawSkinNormal(bool enabled, CMeshMRMInstance *mi, sint
|
|
|
|
|
|
|
|
|
|
|
|
// Case of MeshMorpher
|
|
|
|
// Case of MeshMorpher
|
|
|
|
//========
|
|
|
|
//========
|
|
|
|
if(_MeshMorpher.BlendShapes.size()>0)
|
|
|
|
if(!_MeshMorpher.BlendShapes.empty())
|
|
|
|
{
|
|
|
|
{
|
|
|
|
skinLod.VertexRemap.resize((uint32)vertexFinalRemap.size());
|
|
|
|
skinLod.VertexRemap.resize((uint32)vertexFinalRemap.size());
|
|
|
|
|
|
|
|
|
|
|
|