Changed addArrowMesh parameter order. Changed OBJ loader to use stringc instead of dynamically allocated char array.
git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@766 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
1406fa59b8
commit
ef4443353b
|
@ -1,5 +1,10 @@
|
||||||
Changes in version 1.4 (... 2007)
|
Changes in version 1.4 (... 2007)
|
||||||
|
|
||||||
|
- Changed parameter order of addArrowMesh and added default parameters such
|
||||||
|
that it's enough to set the color (or even just the name).
|
||||||
|
|
||||||
|
- Fixed bugs in MY3D and OBJ loader.
|
||||||
|
|
||||||
- Added IMeshCache::clearUnusedMeshes(). This allows the user to remove
|
- Added IMeshCache::clearUnusedMeshes(). This allows the user to remove
|
||||||
meshes that are sitting in the mesh cache but aren't used by any scene nodes.
|
meshes that are sitting in the mesh cache but aren't used by any scene nodes.
|
||||||
This is useful for example when changing levels.
|
This is useful for example when changing levels.
|
||||||
|
|
|
@ -497,7 +497,7 @@ namespace scene
|
||||||
camera = sceneManager->addCameraSceneNodeFPS(0, 100, 500, -1, keyMap, 8);
|
camera = sceneManager->addCameraSceneNodeFPS(0, 100, 500, -1, keyMap, 8);
|
||||||
\endcode
|
\endcode
|
||||||
\param parent: Parent scene node of the camera. Can be null.
|
\param parent: Parent scene node of the camera. Can be null.
|
||||||
\param rotateSpeed: Speed with wich the camera is rotated. This can be done
|
\param rotateSpeed: Speed with which the camera is rotated. This can be done
|
||||||
only with the mouse.
|
only with the mouse.
|
||||||
\param moveSpeed: Speed with which the camera is moved. Movement is done with
|
\param moveSpeed: Speed with which the camera is moved. Movement is done with
|
||||||
the cursor keys.
|
the cursor keys.
|
||||||
|
@ -753,7 +753,7 @@ namespace scene
|
||||||
good value to start, for example.
|
good value to start, for example.
|
||||||
\param tileCount: Specifies how much tiles there will be. If you specifiy
|
\param tileCount: Specifies how much tiles there will be. If you specifiy
|
||||||
for example that a tile has the size (10.0f, 10.0f) and the tileCount is
|
for example that a tile has the size (10.0f, 10.0f) and the tileCount is
|
||||||
(10,10), than you get a field of 100 tiles wich has the dimension 100.0fx100.0f.
|
(10,10), than you get a field of 100 tiles which has the dimension 100.0fx100.0f.
|
||||||
\param material: Material of the hill mesh.
|
\param material: Material of the hill mesh.
|
||||||
\param hillHeight: Height of the hills. If you specify a negative value
|
\param hillHeight: Height of the hills. If you specify a negative value
|
||||||
you will get holes instead of hills. If the height is 0, no hills will be
|
you will get holes instead of hills. If the height is 0, no hills will be
|
||||||
|
@ -803,14 +803,15 @@ namespace scene
|
||||||
const core::dimension2d<s32>& defaultVertexBlockSize = core::dimension2d<s32>(64,64)) = 0;
|
const core::dimension2d<s32>& defaultVertexBlockSize = core::dimension2d<s32>(64,64)) = 0;
|
||||||
|
|
||||||
//! add a static arrow mesh to the meshpool
|
//! add a static arrow mesh to the meshpool
|
||||||
/** it quite usefull for debuggin purposes. ( showing directions eq )
|
virtual IAnimatedMesh* addArrowMesh(const c8* name,
|
||||||
*/
|
video::SColor vtxColor0=0xFFFFFFFF,
|
||||||
virtual IAnimatedMesh* addArrowMesh(const c8* name, u32 tesselationCylinder, u32 tesselationCone, f32 height,
|
video::SColor vtxColor1=0xFFFFFFFF,
|
||||||
f32 cylinderHeight, f32 width0,f32 width1,
|
u32 tesselationCylinder=4, u32 tesselationCone=8,
|
||||||
video::SColor vtxColor0, video::SColor vtxColor1) = 0;
|
f32 height=1.f, f32 cylinderHeight=0.6f,
|
||||||
|
f32 width0=0.05f, f32 width1=0.3f) = 0;
|
||||||
|
|
||||||
//! Returns the root scene node.
|
//! Returns the root scene node.
|
||||||
/** This is the scene node wich is parent
|
/** This is the scene node which is parent
|
||||||
of all scene nodes. The root scene node is a special scene node which
|
of all scene nodes. The root scene node is a special scene node which
|
||||||
only exists to manage all scene nodes. It will not be rendered and cannot
|
only exists to manage all scene nodes. It will not be rendered and cannot
|
||||||
be removed from the scene.
|
be removed from the scene.
|
||||||
|
|
|
@ -303,9 +303,12 @@ void CAnimatedMeshSceneNode::render()
|
||||||
// show tag for quake3 models
|
// show tag for quake3 models
|
||||||
if (Mesh->getMeshType() == EAMT_MD3 )
|
if (Mesh->getMeshType() == EAMT_MD3 )
|
||||||
{
|
{
|
||||||
IAnimatedMesh * arrow = SceneManager->addArrowMesh ( "__tag_show",
|
IAnimatedMesh * arrow =
|
||||||
4, 8, 5.f, 4.f, 0.5f, 1.f, 0xFF0000FF, 0xFF000088
|
SceneManager->addArrowMesh (
|
||||||
);
|
"__tag_show",
|
||||||
|
0xFF0000FF, 0xFF000088,
|
||||||
|
4, 8, 5.f, 4.f, 0.5f,
|
||||||
|
1.f);
|
||||||
if ( 0 == arrow )
|
if ( 0 == arrow )
|
||||||
{
|
{
|
||||||
arrow = SceneManager->getMesh ( "__tag_show" );
|
arrow = SceneManager->getMesh ( "__tag_show" );
|
||||||
|
@ -341,9 +344,10 @@ void CAnimatedMeshSceneNode::render()
|
||||||
// show normals
|
// show normals
|
||||||
if ( DebugDataVisible & scene::EDS_NORMALS )
|
if ( DebugDataVisible & scene::EDS_NORMALS )
|
||||||
{
|
{
|
||||||
IAnimatedMesh * arrow = SceneManager->addArrowMesh ( "__debugnormal",
|
IAnimatedMesh * arrow = SceneManager->addArrowMesh (
|
||||||
4, 8, 1.f, 0.6f, 0.05f, 0.3f, 0xFFECEC00, 0xFF999900
|
"__debugnormal", 0xFFECEC00,
|
||||||
);
|
0xFF999900, 4, 8, 1.f, 0.6f, 0.05f,
|
||||||
|
0.3f);
|
||||||
if ( 0 == arrow )
|
if ( 0 == arrow )
|
||||||
{
|
{
|
||||||
arrow = SceneManager->getMesh ( "__debugnormal" );
|
arrow = SceneManager->getMesh ( "__debugnormal" );
|
||||||
|
|
|
@ -32,21 +32,16 @@ public:
|
||||||
const core::dimension2d<f32>& textureRepeatCount);
|
const core::dimension2d<f32>& textureRepeatCount);
|
||||||
|
|
||||||
static IAnimatedMesh* createTerrainMesh(video::IImage* texture,
|
static IAnimatedMesh* createTerrainMesh(video::IImage* texture,
|
||||||
video::IImage* heightmap, const core::dimension2d<f32>& stretchSize, f32 maxHeight,
|
video::IImage* heightmap, const core::dimension2d<f32>& stretchSize,
|
||||||
video::IVideoDriver* driver,
|
f32 maxHeight, video::IVideoDriver* driver,
|
||||||
const core::dimension2d<s32> defaultVertexBlockSize,
|
const core::dimension2d<s32> defaultVertexBlockSize,
|
||||||
bool debugBorders=false);
|
bool debugBorders=false);
|
||||||
|
|
||||||
static IAnimatedMesh* createArrowMesh ( const u32 tesselationCylinder,
|
static IAnimatedMesh* createArrowMesh(const u32 tesselationCylinder,
|
||||||
const u32 tesselationCone,
|
const u32 tesselationCone, const f32 height,
|
||||||
const f32 height,
|
const f32 cylinderHeight, const f32 width0,
|
||||||
const f32 cylinderHeight,
|
const f32 width1, const video::SColor vtxColor0,
|
||||||
const f32 width0,
|
const video::SColor vtxColor1);
|
||||||
const f32 width1,
|
|
||||||
const video::SColor vtxColor0,
|
|
||||||
const video::SColor vtxColor1
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -339,7 +339,7 @@ IAnimatedMesh* CMY3DMeshFileLoader::createMesh(io::IReadFile* file)
|
||||||
me.Texture2FileName.append("Lightmaps/");
|
me.Texture2FileName.append("Lightmaps/");
|
||||||
me.Texture2FileName.append(Name);
|
me.Texture2FileName.append(Name);
|
||||||
|
|
||||||
if (Name.size()>0)
|
if (Name.size())
|
||||||
me.Texture2 = Driver->getTexture(me.Texture2FileName.c_str());
|
me.Texture2 = Driver->getTexture(me.Texture2FileName.c_str());
|
||||||
|
|
||||||
me.MaterialType = video::EMT_LIGHTMAP_M2;
|
me.MaterialType = video::EMT_LIGHTMAP_M2;
|
||||||
|
@ -431,7 +431,7 @@ IAnimatedMesh* CMY3DMeshFileLoader::createMesh(io::IReadFile* file)
|
||||||
s32 vertsNum=0;
|
s32 vertsNum=0;
|
||||||
s32 facesNum=0;
|
s32 facesNum=0;
|
||||||
|
|
||||||
// verticies
|
// vertices
|
||||||
file->read(&id, sizeof(id));
|
file->read(&id, sizeof(id));
|
||||||
if (id!=MY_VERTS_ID)
|
if (id!=MY_VERTS_ID)
|
||||||
{
|
{
|
||||||
|
|
|
@ -174,8 +174,6 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
|
||||||
|
|
||||||
case 'f': // face
|
case 'f': // face
|
||||||
{
|
{
|
||||||
const u32 FACE_BUFFER_LENGTH = 1024;
|
|
||||||
c8* wordBuffer = new c8[FACE_BUFFER_LENGTH];
|
|
||||||
c8 vertexWord[WORD_BUFFER_LENGTH]; // for retrieving vertex data
|
c8 vertexWord[WORD_BUFFER_LENGTH]; // for retrieving vertex data
|
||||||
video::S3DVertex v;
|
video::S3DVertex v;
|
||||||
u32 currentVertexCount = pCurrMtl->pMeshbuffer->Vertices.size();
|
u32 currentVertexCount = pCurrMtl->pMeshbuffer->Vertices.size();
|
||||||
|
@ -186,9 +184,9 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
|
||||||
v.Color = pCurrMtl->pMeshbuffer->Material.DiffuseColor;
|
v.Color = pCurrMtl->pMeshbuffer->Material.DiffuseColor;
|
||||||
|
|
||||||
// get all vertices data in this face (current line of obj file)
|
// get all vertices data in this face (current line of obj file)
|
||||||
u32 length = copyLine(&wordBuffer, pBufPtr, FACE_BUFFER_LENGTH, pBufEnd);
|
const core::stringc wordBuffer = copyLine(pBufPtr, pBufEnd);
|
||||||
const c8* pLinePtr = wordBuffer;
|
const c8* pLinePtr = wordBuffer.c_str();
|
||||||
const c8* const pEndPtr = wordBuffer+length;
|
const c8* const pEndPtr = pLinePtr+wordBuffer.size();
|
||||||
|
|
||||||
// read in all vertices
|
// read in all vertices
|
||||||
pLinePtr = goNextWord(pLinePtr, pEndPtr);
|
pLinePtr = goNextWord(pLinePtr, pEndPtr);
|
||||||
|
@ -234,7 +232,6 @@ IAnimatedMesh* COBJMeshFileLoader::createMesh(io::IReadFile* file)
|
||||||
pCurrMtl->pMeshbuffer->Indices.push_back( ( facePointCount - 2 - i ) + currentVertexCount );
|
pCurrMtl->pMeshbuffer->Indices.push_back( ( facePointCount - 2 - i ) + currentVertexCount );
|
||||||
pCurrMtl->pMeshbuffer->Indices.push_back( ( facePointCount - 3 - i ) + currentVertexCount );
|
pCurrMtl->pMeshbuffer->Indices.push_back( ( facePointCount - 3 - i ) + currentVertexCount );
|
||||||
}
|
}
|
||||||
delete wordBuffer;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -699,33 +696,19 @@ u32 COBJMeshFileLoader::copyWord(c8* outBuf, const c8* const inBuf, u32 outBufLe
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
u32 COBJMeshFileLoader::copyLine(c8** outBuf, const c8* inBuf, u32 outBufLength, const c8* pBufEnd)
|
core::stringc COBJMeshFileLoader::copyLine(const c8* inBuf, const c8* pBufEnd)
|
||||||
{
|
{
|
||||||
if (!outBufLength)
|
|
||||||
return 0;
|
|
||||||
if (!inBuf)
|
if (!inBuf)
|
||||||
{
|
return core::stringc();
|
||||||
*outBuf = 0;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
u32 i = 0;
|
const c8* ptr = inBuf;
|
||||||
while(inBuf[i])
|
while (ptr<pBufEnd)
|
||||||
{
|
{
|
||||||
if (inBuf[i]=='\n' || inBuf[i]=='\r' || &(inBuf[i]) == pBufEnd)
|
if (*ptr=='\n' || *ptr=='\r')
|
||||||
break;
|
break;
|
||||||
++i;
|
++ptr;
|
||||||
}
|
}
|
||||||
|
return core::stringc(inBuf, ptr-inBuf+1);
|
||||||
if (i>outBufLength-1)
|
|
||||||
{
|
|
||||||
delete [] *outBuf;
|
|
||||||
*outBuf = new c8[i+1];
|
|
||||||
}
|
|
||||||
memcpy(outBuf, inBuf, i);
|
|
||||||
outBuf[i] = 0;
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ private:
|
||||||
// copies the current word from the inBuf to the outBuf
|
// copies the current word from the inBuf to the outBuf
|
||||||
u32 copyWord(c8* outBuf, const c8* inBuf, u32 outBufLength, const c8* const pBufEnd);
|
u32 copyWord(c8* outBuf, const c8* inBuf, u32 outBufLength, const c8* const pBufEnd);
|
||||||
// copies the current line from the inBuf to the outBuf
|
// copies the current line from the inBuf to the outBuf
|
||||||
u32 copyLine(c8** outBuf, const c8* inBuf, u32 outBufLength, const c8* const pBufEnd);
|
core::stringc copyLine(const c8* inBuf, const c8* const pBufEnd);
|
||||||
// combination of goNextWord followed by copyWord
|
// combination of goNextWord followed by copyWord
|
||||||
const c8* goAndCopyNextWord(c8* outBuf, const c8* inBuf, u32 outBufLength, const c8* const pBufEnd);
|
const c8* goAndCopyNextWord(c8* outBuf, const c8* inBuf, u32 outBufLength, const c8* const pBufEnd);
|
||||||
|
|
||||||
|
|
|
@ -723,7 +723,10 @@ IAnimatedMesh* CSceneManager::addTerrainMesh(const c8* name,
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Adds an arrow mesh to the mesh pool.
|
//! Adds an arrow mesh to the mesh pool.
|
||||||
IAnimatedMesh* CSceneManager::addArrowMesh(const c8* name,u32 tesselationCylinder, u32 tesselationCone, f32 height, f32 cylinderHeight, f32 width0,f32 width1, video::SColor vtxColor0, video::SColor vtxColor1)
|
IAnimatedMesh* CSceneManager::addArrowMesh(const c8* name,
|
||||||
|
video::SColor vtxColor0, video::SColor vtxColor1,
|
||||||
|
u32 tesselationCylinder, u32 tesselationCone, f32 height,
|
||||||
|
f32 cylinderHeight, f32 width0,f32 width1)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!name || MeshCache->isMeshLoaded(name))
|
if (!name || MeshCache->isMeshLoaded(name))
|
||||||
|
|
|
@ -193,9 +193,11 @@ namespace scene
|
||||||
f32 maxHeight, const core::dimension2d<s32>& defaultVertexBlockSize);
|
f32 maxHeight, const core::dimension2d<s32>& defaultVertexBlockSize);
|
||||||
|
|
||||||
//! Add a arrow mesh to the mesh pool
|
//! Add a arrow mesh to the mesh pool
|
||||||
virtual IAnimatedMesh* addArrowMesh(const c8* name, u32 tesselationCylinder, u32 tesselationCone, f32 height,
|
virtual IAnimatedMesh* addArrowMesh(const c8* name,
|
||||||
f32 cylinderHeight, f32 width0,f32 width1,
|
video::SColor vtxColor0, video::SColor vtxColor1,
|
||||||
video::SColor vtxColor0, video::SColor vtxColor1);
|
u32 tesselationCylinder, u32 tesselationCone,
|
||||||
|
f32 height, f32 cylinderHeight, f32 width0,
|
||||||
|
f32 width1);
|
||||||
|
|
||||||
//! Adds a particle system scene node.
|
//! Adds a particle system scene node.
|
||||||
virtual IParticleSystemSceneNode* addParticleSystemSceneNode(
|
virtual IParticleSystemSceneNode* addParticleSystemSceneNode(
|
||||||
|
|
Loading…
Reference in New Issue