[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Nel] dynamic_cast pbs...
From: |
Alain Dutech |
Subject: |
[Nel] dynamic_cast pbs... |
Date: |
Thu, 14 Mar 2002 19:33:01 +0100 |
Hello,
I've finally compiled and run snowballs2... with 0.13 fps !!!!!!!!!!! :-)
(ok, everything is software rendered).
Still, I've got some asserts with dynamic_cast that pollute my screen.
I've tracked them down and it seems that dynamic_cast wont be bluffed
by pre-casting when using "Shape" objects.
02/03/14 18:02:13 AST16732 debug.h 384 : "dynamic_cast<T>(o)"
[...]
To illustrate this, this is a list of all the calls to safe_cast
(which nlassert(dynamic_cast)) that trigger the assertion... My basic solution
was to transform safe_cast into static_cast each time!
(in mesh_instance.cpp)
void CMeshInstance::setApplySkin(bool state)
{
// Call parents method
CMeshBaseInstance::setApplySkin (state);
// Recompute the id
if (state)
{
// Get a pointer on the shape
CMesh *pMesh = NLMISC::safe_cast<CMesh *>((IShape*)Shape);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pMesh->computeBonesId (_FatherSkeletonModel);
}
}
------------------------------------------------------------------
(in mesh_base_instance.cpp)
bool CMeshBaseInstance::isLightable() const
{
// if shape is NULL, or if !getUserLightable(), then the model is not lightable
if(Shape==NULL || !getUserLightable())
return false;
else
{
CMeshBase *mesh=safe_cast<CMeshBase*>((IShape*)Shape);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
// lightable if the mesh is (ie have a material with no lightmap)
return mesh->isLightable();
}
}
------------------------------------------------------------------
(in particle_system_model.cpp)
void CParticleSystemModel::getAABBox(NLMISC::CAABBox &bbox) const
{
if (_ParticleSystem)
{
_ParticleSystem->computeBBox(bbox);
}
else
{
NLMISC::safe_cast<CParticleSystemShape *>((IShape *) Shape)->getAABBox(bbox);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
}
}
-------------------------------------------------------------------
(in particle_system_model.cpp)
void CParticleSystemClipObs::traverse(IObs *caller)
{
<<<< snip >>>>>
if(!ps) ///====================== system resource not allocated, test if
it entered the scope
{
CParticleSystemShape *pss= NLMISC::safe_cast<CParticleSystemShape
*>((IShape *)m->Shape);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<<<< snip >>>>
-------------------------------------------------------------------
(in particle_system_model.cpp)
void CParticleSystemModel::reallocRsc()
{
nlassert(_ParticleSystem == NULL);
_ParticleSystem = NLMISC::safe_cast<CParticleSystemShape *>((IShape *)
Shape)->instanciatePS(*_Scene);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<<<< snip >>>>
-------------------------------------------------------------------
(in mesh_multi_lod_instance.cpp)
void CMeshMultiLodBalancingObs::traverse(IObs *caller)
{
// Call previous
CTransformShapeLoadBalancingObs::traverse (caller);
// Get a pointer on the model
nlinfo("CMeshMultiLodBalancingObs::traverse model");
CMeshMultiLodInstance *model=safe_cast<CMeshMultiLodInstance*> (Model);
// Get a pointer on the shape
CMeshMultiLod *shape=safe_cast<CMeshMultiLod*> ((IShape*)model->Shape);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<<<< snip >>>>
-------------------------------------------------------------------
(in particle_system_model.cpp)
bool CParticleSystemModel::refreshRscDeletion(const std::vector<CPlane>
&worldFrustumPyramid, const NLMISC::CVector
&viewerPos)
{
if (_EditionMode) return false;
<<<< snip >>>>
nlassert(_ParticleSystem);
CParticleSystemShape *shape = NLMISC::safe_cast<CParticleSystemShape
*>((IShape *) Shape);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
<<<< snip >>>>
Hope that helps...
Alain
My config :
Red Hat 7.1 GNU/Linux
gcc version 2.96
STLport version 4.5.1
GL_VERSION: 1.2 Mesa 3.4
GL_RENDERER: Mesa GLX Indirect
GL_VENDOR: VA Linux Systems, Inc.
CVS tree of the 12th of mars
- [Nel] dynamic_cast pbs...,
Alain Dutech <=