diff options
Diffstat (limited to 'src/modelinfo')
-rw-r--r-- | src/modelinfo/BaseModelInfo.h | 8 | ||||
-rw-r--r-- | src/modelinfo/ClumpModelInfo.cpp | 17 | ||||
-rw-r--r-- | src/modelinfo/PedModelInfo.cpp | 46 |
3 files changed, 34 insertions, 37 deletions
diff --git a/src/modelinfo/BaseModelInfo.h b/src/modelinfo/BaseModelInfo.h index 783f871f..2505967b 100644 --- a/src/modelinfo/BaseModelInfo.h +++ b/src/modelinfo/BaseModelInfo.h @@ -31,6 +31,14 @@ protected: ModelInfoType m_type; uint8 m_num2dEffects; bool m_bOwnsColModel; +#ifdef EXTRA_MODEL_FLAGS +public: + // from mobile + bool m_bIsDoubleSided; + bool m_bIsTree; + bool m_bCanBeIgnored; // for low-end devices + bool RenderDoubleSided(void) { return m_bIsDoubleSided || m_bIsTree; } +#endif public: CBaseModelInfo(ModelInfoType type); diff --git a/src/modelinfo/ClumpModelInfo.cpp b/src/modelinfo/ClumpModelInfo.cpp index 49198437..1ae936a7 100644 --- a/src/modelinfo/ClumpModelInfo.cpp +++ b/src/modelinfo/ClumpModelInfo.cpp @@ -5,6 +5,7 @@ #include "NodeName.h" #include "VisibilityPlugins.h" #include "ModelInfo.h" +#include "ModelIndices.h" void CClumpModelInfo::DeleteRwObject(void) @@ -110,12 +111,18 @@ CClumpModelInfo::SetClump(RpClump *clump) weights->w3 /= sum; } RpHAnimHierarchySetFlags(hier, (RpHAnimHierarchyFlag)(rpHANIMHIERARCHYUPDATEMODELLINGMATRICES|rpHANIMHIERARCHYUPDATELTMS)); - }else -#endif - // do not set on skinned clip because cutscene head is not compatible with player head - if(strncmp(GetName(), "playerh", 8) == 0) + } + if(strncmp(GetName(), "playerh", 8) == 0){ + // playerh is incompatible with the xbox player skin + // so check if player model is skinned and only apply skin to head if it isn't + CPedModelInfo *body = (CPedModelInfo*)CModelInfo::GetModelInfo(MI_PLAYER); + if(!(body->m_clump && IsClumpSkinned(body->m_clump))) RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB); - + } +#else + if(strncmp(GetName(), "playerh", 8) == 0){ + RpClumpForAllAtomics(clump, SetAtomicRendererCB, (void*)CVisibilityPlugins::RenderPlayerCB); +#endif } void diff --git a/src/modelinfo/PedModelInfo.cpp b/src/modelinfo/PedModelInfo.cpp index 117fd378..b77cccda 100644 --- a/src/modelinfo/PedModelInfo.cpp +++ b/src/modelinfo/PedModelInfo.cpp @@ -218,7 +218,6 @@ CPedModelInfo::CreateHitColModel(void) { RwObjectNameAssociation nameAssoc; RwObjectIdAssociation idAssoc; - CVector center; RwFrame *nodeFrame; CColModel *colmodel = new CColModel; CColSphere *spheres = (CColSphere*)RwMalloc(NUMPEDINFONODES*sizeof(CColSphere)); @@ -251,23 +250,17 @@ CPedModelInfo::CreateHitColModel(void) if(RwFrameGetParent(nodeFrame) == root) break; } - center.x = mat->pos.x + m_pColNodeInfos[i].x; - center.y = mat->pos.y + 0.0f; - center.z = mat->pos.z + m_pColNodeInfos[i].z; - spheres[i].Set(radius, center, SURFACE_PED, m_pColNodeInfos[i].pieceType); + spheres[i].center = mat->pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z); + spheres[i].radius = radius; + spheres[i].surface = SURFACE_PED; + spheres[i].piece = m_pColNodeInfos[i].pieceType; } } RwMatrixDestroy(mat); colmodel->spheres = spheres; colmodel->numSpheres = NUMPEDINFONODES; - center.x = center.y = center.z = 0.0f; - colmodel->boundingSphere.Set(2.0f, center, 0, 0); - CVector min, max; - min.x = min.y = -0.5f; - min.z = -1.2f; - max.x = max.y = 0.5f; - max.z = 1.2f; - colmodel->boundingBox.Set(min, max, 0, 0); + colmodel->boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0); + colmodel->boundingBox.Set(CVector(-0.5f, -0.5f, -1.2f), CVector(0.5f, 0.5f, 1.2f), SURFACE_DEFAULT, 0); colmodel->level = LEVEL_GENERIC; m_hitColModel = colmodel; } @@ -303,9 +296,7 @@ CPedModelInfo::AnimatePedColModel(CColModel* colmodel, RwFrame* frame) break; } - spheres[i].center.x = mat->pos.x + m_pColNodeInfos[i].x; - spheres[i].center.y = mat->pos.y + 0.0f; - spheres[i].center.z = mat->pos.z + m_pColNodeInfos[i].z; + spheres[i].center = mat->pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z); } } @@ -316,7 +307,6 @@ CPedModelInfo::AnimatePedColModel(CColModel* colmodel, RwFrame* frame) void CPedModelInfo::CreateHitColModelSkinned(RpClump *clump) { - CVector center; RpHAnimHierarchy *hier = GetAnimHierarchyFromSkinClump(clump); CColModel *colmodel = new CColModel; CColSphere *spheres = (CColSphere*)RwMalloc(NUMPEDINFONODES*sizeof(CColSphere)); @@ -335,23 +325,17 @@ CPedModelInfo::CreateHitColModelSkinned(RpClump *clump) RwV3d pos = { 0.0f, 0.0f, 0.0f }; RwV3dTransformPoints(&pos, &pos, 1, mat); - center.x = pos.x + m_pColNodeInfos[i].x; - center.y = pos.y + 0.0f; - center.z = pos.z + m_pColNodeInfos[i].z; - spheres[i].Set(m_pColNodeInfos[i].radius, center, SURFACE_PED, m_pColNodeInfos[i].pieceType); + spheres[i].center = pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z); + spheres[i].radius = m_pColNodeInfos[i].radius; + spheres[i].surface = SURFACE_PED; + spheres[i].piece = m_pColNodeInfos[i].pieceType; } RwMatrixDestroy(invmat); RwMatrixDestroy(mat); colmodel->spheres = spheres; colmodel->numSpheres = NUMPEDINFONODES; - center.x = center.y = center.z = 0.0f; - colmodel->boundingSphere.Set(2.0f, center, 0, 0); - CVector min, max; - min.x = min.y = -0.5f; - min.z = -1.2f; - max.x = max.y = 0.5f; - max.z = 1.2f; - colmodel->boundingBox.Set(min, max, 0, 0); + colmodel->boundingSphere.Set(2.0f, CVector(0.0f, 0.0f, 0.0f), SURFACE_DEFAULT, 0); + colmodel->boundingBox.Set(CVector(-0.5f, -0.5f, -1.2f), CVector(0.5f, 0.5f, 1.2f), SURFACE_DEFAULT, 0); colmodel->level = LEVEL_GENERIC; m_hitColModel = colmodel; } @@ -379,9 +363,7 @@ CPedModelInfo::AnimatePedColModelSkinned(RpClump *clump) RwV3d pos = { 0.0f, 0.0f, 0.0f }; RwV3dTransformPoints(&pos, &pos, 1, mat); - spheres[i].center.x = pos.x + m_pColNodeInfos[i].x; - spheres[i].center.y = pos.y + 0.0f; - spheres[i].center.z = pos.z + m_pColNodeInfos[i].z; + spheres[i].center = pos + CVector(m_pColNodeInfos[i].x, 0.0f, m_pColNodeInfos[i].z); } RwMatrixDestroy(invmat); RwMatrixDestroy(mat); |