Commit 8165f844 authored by hybrid's avatar hybrid

Slight cleanup, bringing some things towards Irrlicht.

git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/trunk@3696 dfc29bdd-3216-0410-991c-e03cc46cb475
parent 2463db9b
...@@ -21,19 +21,19 @@ namespace scene ...@@ -21,19 +21,19 @@ namespace scene
using namespace video; using namespace video;
void AngleQuaternion( const vec3_hl angles, vec4_hl quaternion ) void AngleQuaternion(const core::vector3df& angles, vec4_hl quaternion)
{ {
f32 angle; f32 angle;
f32 sr, sp, sy, cr, cp, cy; f32 sr, sp, sy, cr, cp, cy;
// FIXME: rescale the inputs to 1/2 angle // FIXME: rescale the inputs to 1/2 angle
angle = angles[2] * 0.5f; angle = angles.Z * 0.5f;
sy = sin(angle); sy = sin(angle);
cy = cos(angle); cy = cos(angle);
angle = angles[1] * 0.5f; angle = angles.Y * 0.5f;
sp = sin(angle); sp = sin(angle);
cp = cos(angle); cp = cos(angle);
angle = angles[0] * 0.5f; angle = angles.X * 0.5f;
sr = sin(angle); sr = sin(angle);
cr = cos(angle); cr = cos(angle);
...@@ -122,40 +122,17 @@ namespace scene ...@@ -122,40 +122,17 @@ namespace scene
out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3]; out[2][3] = in1[2][0] * in2[0][3] + in1[2][1] * in2[1][3] + in1[2][2] * in2[2][3] + in1[2][3];
} }
#define EQUAL_EPSILON 0.001
s32 VectorCompare (vec3_hl v1, vec3_hl v2)
{
s32 i;
for (i=0 ; i<3 ; i++)
if (fabs(v1[i]-v2[i]) > EQUAL_EPSILON)
return false;
return true;
}
#define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2]) #define DotProduct(x,y) ((x)[0]*(y)[0]+(x)[1]*(y)[1]+(x)[2]*(y)[2])
inline void VectorTransform(const vec3_hl in1, const f32 in2[3][4], core::vector3df& out)
inline void VectorTransform (const vec3_hl in1, const f32 in2[3][4], vec3_hl out)
{
out[0] = DotProduct(in1, in2[0]) + in2[0][3];
out[1] = DotProduct(in1, in2[1]) + in2[1][3];
out[2] = DotProduct(in1, in2[2]) + in2[2][3];
}
inline void VectorTransform2 (core::vector3df &out, const vec3_hl in1, const f32 in2[3][4])
{ {
out.X = DotProduct(in1, in2[0]) + in2[0][3]; out.X = DotProduct(in1, in2[0]) + in2[0][3];
out.Z = DotProduct(in1, in2[1]) + in2[1][3]; out.Y = DotProduct(in1, in2[1]) + in2[1][3];
out.Y = DotProduct(in1, in2[2]) + in2[2][3]; out.Z = DotProduct(in1, in2[2]) + in2[2][3];
} }
static f32 BoneTransform[MAXSTUDIOBONES][3][4]; // bone transformation matrix static f32 BoneTransform[MAXSTUDIOBONES][3][4]; // bone transformation matrix
void getBoneVector ( core::vector3df &out, u32 index ) void getBoneVector ( core::vector3df &out, u32 index )
{ {
out.X = BoneTransform[index][0][3]; out.X = BoneTransform[index][0][3];
...@@ -185,12 +162,12 @@ namespace scene ...@@ -185,12 +162,12 @@ namespace scene
//! Constructor //! Constructor
CHalflifeMDLMeshFileLoader::CHalflifeMDLMeshFileLoader( scene::ISceneManager* smgr ) CHalflifeMDLMeshFileLoader::CHalflifeMDLMeshFileLoader(
scene::ISceneManager* smgr) : SceneManager(smgr)
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CHalflifeMDLMeshFileLoader"); setDebugName("CHalflifeMDLMeshFileLoader");
#endif #endif
SceneManager = smgr;
} }
...@@ -198,7 +175,7 @@ CHalflifeMDLMeshFileLoader::CHalflifeMDLMeshFileLoader( scene::ISceneManager* sm ...@@ -198,7 +175,7 @@ CHalflifeMDLMeshFileLoader::CHalflifeMDLMeshFileLoader( scene::ISceneManager* sm
//! based on the file extension (e.g. ".bsp") //! based on the file extension (e.g. ".bsp")
bool CHalflifeMDLMeshFileLoader::isALoadableFileExtension(const io::path& filename) const bool CHalflifeMDLMeshFileLoader::isALoadableFileExtension(const io::path& filename) const
{ {
return core::hasFileExtension ( filename, "mdl" ); return core::hasFileExtension(filename, "mdl");
} }
...@@ -211,55 +188,57 @@ IAnimatedMesh* CHalflifeMDLMeshFileLoader::createMesh(io::IReadFile* file) ...@@ -211,55 +188,57 @@ IAnimatedMesh* CHalflifeMDLMeshFileLoader::createMesh(io::IReadFile* file)
CAnimatedMeshHalfLife* msh = new CAnimatedMeshHalfLife(); CAnimatedMeshHalfLife* msh = new CAnimatedMeshHalfLife();
if (msh) if (msh)
{ {
if ( msh->loadModelFile ( file, SceneManager ) ) if (msh->loadModelFile(file, SceneManager))
return msh; return msh;
msh->drop(); msh->drop();
} }
return 0; return 0;
} }
//! Constructor //! Constructor
CAnimatedMeshHalfLife::CAnimatedMeshHalfLife() CAnimatedMeshHalfLife::CAnimatedMeshHalfLife()
{ {
#ifdef _DEBUG #ifdef _DEBUG
setDebugName("CAnimatedMeshHalfLife"); setDebugName("CAnimatedMeshHalfLife");
#endif #endif
initData();
initData ();
} }
/*! /*!
loads a complete model loads a complete model
*/ */
bool CAnimatedMeshHalfLife::loadModelFile( io::IReadFile* file,ISceneManager * smgr ) bool CAnimatedMeshHalfLife::loadModelFile(io::IReadFile* file,
ISceneManager* smgr)
{ {
if (!file) if (!file)
return false; return false;
bool r = false;
SceneManager = smgr; SceneManager = smgr;
if ( loadModel ( file, file->getFileName() ) ) if ( loadModel(file, file->getFileName()) )
{ {
if ( postLoadModel ( file->getFileName() ) ) if ( postLoadModel ( file->getFileName() ) )
{ {
initModel (); initModel ();
//dumpModelInfo ( 1 ); //dumpModelInfo ( 1 );
r = true; return true;
} }
} }
return r; return false;
} }
//! Destructor //! Destructor
CAnimatedMeshHalfLife::~CAnimatedMeshHalfLife() CAnimatedMeshHalfLife::~CAnimatedMeshHalfLife()
{ {
freeModel (); delete [] (u8*) Header;
if (OwnTexModel)
delete [] (u8*) TextureHeader;
for (u32 i = 0; i < 32; ++i)
delete [] (u8*) AnimationHeader[i];
} }
...@@ -282,15 +261,13 @@ void CAnimatedMeshHalfLife::setDirty(E_BUFFER_TYPE buffer) ...@@ -282,15 +261,13 @@ void CAnimatedMeshHalfLife::setDirty(E_BUFFER_TYPE buffer)
} }
static core::vector3df TransformedVerts[MAXSTUDIOVERTS]; // transformed vertices
//static core::vector3df TransformedNormals[MAXSTUDIOVERTS]; // light surface normals
static vec3_hl TransformedVerts[MAXSTUDIOVERTS]; // transformed vertices
//static vec3_hl TransformedNormals[MAXSTUDIOVERTS]; // light surface normals
/*! /*!
*/ */
void CAnimatedMeshHalfLife::initModel () void CAnimatedMeshHalfLife::initModel()
{ {
// init Sequences to Animation // init Sequences to Animation
KeyFrameInterpolation ipol; KeyFrameInterpolation ipol;
...@@ -337,7 +314,7 @@ void CAnimatedMeshHalfLife::initModel () ...@@ -337,7 +314,7 @@ void CAnimatedMeshHalfLife::initModel ()
u32 meshBuffer = 0; u32 meshBuffer = 0;
BodyList.clear(); BodyList.clear();
SHalflifeBody *body = (SHalflifeBody *) ((u8*) Header + Header->bodypartindex); SHalflifeBody *body = (SHalflifeBody *) ((u8*) Header + Header->bodypartindex);
for ( i = 0; i < Header->numbodyparts; ++i) for (i=0; i < Header->numbodyparts; ++i)
{ {
BodyPart part; BodyPart part;
part.name = body[i].name; part.name = body[i].name;
...@@ -360,38 +337,32 @@ void CAnimatedMeshHalfLife::initModel () ...@@ -360,38 +337,32 @@ void CAnimatedMeshHalfLife::initModel ()
SequenceIndex = 0; SequenceIndex = 0;
CurrentFrame = 0.f; CurrentFrame = 0.f;
SetController (0, 0.f); SetController(0, 0.f);
SetController (1, 0.f); SetController(1, 0.f);
SetController (2, 0.f); SetController(2, 0.f);
SetController (3, 0.f); SetController(3, 0.f);
SetController (MOUTH_CONTROLLER, 0.f); SetController(MOUTH_CONTROLLER, 0.f);
SetSkin (0); SetSkin (0);
// init Meshbuffers // init Meshbuffers
io::path store;
const SHalflifeTexture *tex = (SHalflifeTexture *) ((u8*) TextureHeader + TextureHeader->textureindex); const SHalflifeTexture *tex = (SHalflifeTexture *) ((u8*) TextureHeader + TextureHeader->textureindex);
const u16 *skinref = (u16 *)((u8*)TextureHeader + TextureHeader->skinindex); const u16 *skinref = (u16 *)((u8*)TextureHeader + TextureHeader->skinindex);
if (SkinGroupSelection != 0 && SkinGroupSelection < TextureHeader->numskinfamilies) if ((SkinGroupSelection != 0) && (SkinGroupSelection < TextureHeader->numskinfamilies))
skinref += (SkinGroupSelection * TextureHeader->numskinref); skinref += (SkinGroupSelection * TextureHeader->numskinref);
io::path fname;
io::path ext;
core::vector2df tex_scale; core::vector2df tex_scale;
core::vector2di tex_trans ( 0, 0 ); core::vector2di tex_trans ( 0, 0 );
#ifdef HL_TEXTURE_ATLAS #ifdef HL_TEXTURE_ATLAS
TextureAtlas.getScale ( tex_scale ); TextureAtlas.getScale(tex_scale);
#endif #endif
for ( u32 bodypart=0 ; bodypart < Header->numbodyparts ; ++bodypart) for (u32 bodypart=0 ; bodypart < Header->numbodyparts ; ++bodypart)
{ {
const SHalflifeBody *body = (SHalflifeBody *)((u8*) Header + Header->bodypartindex) + bodypart; const SHalflifeBody *body = (SHalflifeBody *)((u8*) Header + Header->bodypartindex) + bodypart;
for ( u32 modelnr = 0; modelnr < body->nummodels; ++modelnr ) for (u32 modelnr = 0; modelnr < body->nummodels; ++modelnr)
{ {
const SHalflifeModel *model = (SHalflifeModel *)((u8*) Header + body->modelindex) + modelnr; const SHalflifeModel *model = (SHalflifeModel *)((u8*) Header + body->modelindex) + modelnr;
#if 0 #if 0
...@@ -522,10 +493,12 @@ void CAnimatedMeshHalfLife::initModel () ...@@ -522,10 +493,12 @@ void CAnimatedMeshHalfLife::initModel ()
} }
#ifdef HL_TEXTURE_ATLAS #ifdef HL_TEXTURE_ATLAS
store = TextureBaseName + "atlas"; io::path store = TextureBaseName + "atlas";
#else #else
io::path fname;
io::path ext;
core::splitFilename ( currentex->name, 0, &fname, &ext ); core::splitFilename ( currentex->name, 0, &fname, &ext );
store = TextureBaseName + fname; io::path store = TextureBaseName + fname;
#endif #endif
m.TextureLayer[0].Texture = SceneManager->getVideoDriver()->getTexture ( store ); m.TextureLayer[0].Texture = SceneManager->getVideoDriver()->getTexture ( store );
m.Lighting = false; m.Lighting = false;
...@@ -535,7 +508,6 @@ void CAnimatedMeshHalfLife::initModel () ...@@ -535,7 +508,6 @@ void CAnimatedMeshHalfLife::initModel ()
} // mesh } // mesh
} // model } // model
} // body part } // body part
} }
...@@ -593,15 +565,11 @@ void CAnimatedMeshHalfLife::buildVertices () ...@@ -593,15 +565,11 @@ void CAnimatedMeshHalfLife::buildVertices ()
for ( g = 0; g < c; ++g, v += 1, tricmd += 4 ) for ( g = 0; g < c; ++g, v += 1, tricmd += 4 )
{ {
// fill vertex // fill vertex
const f32 *av = TransformedVerts[tricmd[0]]; const core::vector3df& av = TransformedVerts[tricmd[0]];
v->Pos.X = av[0]; v->Pos = av;
v->Pos.Z = av[1];
v->Pos.Y = av[2];
/* /*
av = TransformedNormals[tricmd[1]]; const core::vector3df& an = TransformedNormals[tricmd[1]];
v->Normal.X = av[0]; v->Normal = an;
v->Normal.Z = av[1];
v->Normal.Y = av[2];
//v->Normal.normalize(); //v->Normal.normalize();
*/ */
} }
...@@ -612,18 +580,17 @@ void CAnimatedMeshHalfLife::buildVertices () ...@@ -612,18 +580,17 @@ void CAnimatedMeshHalfLife::buildVertices ()
} }
/*! /*!
render Bones render Bones
*/ */
void CAnimatedMeshHalfLife::renderModel ( u32 param, IVideoDriver * driver, const core::matrix4 &absoluteTransformation) void CAnimatedMeshHalfLife::renderModel(u32 param, IVideoDriver * driver, const core::matrix4 &absoluteTransformation)
{ {
SHalflifeBone *bone = (SHalflifeBone *) ((u8 *) Header + Header->boneindex); SHalflifeBone *bone = (SHalflifeBone *) ((u8 *) Header + Header->boneindex);
video::SColor blue ( 0xFF000080 ); video::SColor blue(0xFF000080);
video::SColor red ( 0xFF800000 ); video::SColor red(0xFF800000);
video::SColor yellow ( 0xFF808000 ); video::SColor yellow(0xFF808000);
video::SColor cyan ( 0xFF008080 ); video::SColor cyan(0xFF008080);
core::aabbox3df box; core::aabbox3df box;
...@@ -654,7 +621,7 @@ void CAnimatedMeshHalfLife::renderModel ( u32 param, IVideoDriver * driver, con ...@@ -654,7 +621,7 @@ void CAnimatedMeshHalfLife::renderModel ( u32 param, IVideoDriver * driver, con
} }
// attachements // attachements
SHalfelifeAttachment *attach = (SHalfelifeAttachment *) ((u8*) Header + Header->attachmentindex); SHalflifeAttachment *attach = (SHalflifeAttachment *) ((u8*) Header + Header->attachmentindex);
core::vector3df v[8]; core::vector3df v[8];
for ( i = 0; i < Header->numattachments; i++) for ( i = 0; i < Header->numattachments; i++)
{ {
...@@ -729,6 +696,7 @@ void CAnimatedMeshHalfLife::renderModel ( u32 param, IVideoDriver * driver, con ...@@ -729,6 +696,7 @@ void CAnimatedMeshHalfLife::renderModel ( u32 param, IVideoDriver * driver, con
} }
} }
//! Returns the animated mesh based on a detail level. 0 is the lowest, 255 the highest detail. //! Returns the animated mesh based on a detail level. 0 is the lowest, 255 the highest detail.
IMesh* CAnimatedMeshHalfLife::getMesh(s32 frameInt, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop) IMesh* CAnimatedMeshHalfLife::getMesh(s32 frameInt, s32 detailLevel, s32 startFrameLoop, s32 endFrameLoop)
{ {
...@@ -736,13 +704,11 @@ IMesh* CAnimatedMeshHalfLife::getMesh(s32 frameInt, s32 detailLevel, s32 startFr ...@@ -736,13 +704,11 @@ IMesh* CAnimatedMeshHalfLife::getMesh(s32 frameInt, s32 detailLevel, s32 startFr
u32 frameA = core::floor32 ( frame ); u32 frameA = core::floor32 ( frame );
// f32 blend = core::fract ( frame ); // f32 blend = core::fract ( frame );
u32 i;
SHalflifeSequence *seq = (SHalflifeSequence*) ((u8*) Header + Header->seqindex); SHalflifeSequence *seq = (SHalflifeSequence*) ((u8*) Header + Header->seqindex);
// find SequenceIndex from summed list // find SequenceIndex from summed list
u32 frameCount = 0; u32 frameCount = 0;
for ( i = 0; i < Header->numseq; i++) for (u32 i = 0; i < Header->numseq; ++i)
{ {
u32 val = core::max_ ( 1, seq[i].numframes - 1 ); u32 val = core::max_ ( 1, seq[i].numframes - 1 );
if ( frameCount + val > frameA ) if ( frameCount + val > frameA )
...@@ -771,6 +737,7 @@ IMesh* CAnimatedMeshHalfLife::getMesh(s32 frameInt, s32 detailLevel, s32 startFr ...@@ -771,6 +737,7 @@ IMesh* CAnimatedMeshHalfLife::getMesh(s32 frameInt, s32 detailLevel, s32 startFr
return &MeshIPol; return &MeshIPol;
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::initData () void CAnimatedMeshHalfLife::initData ()
...@@ -805,19 +772,6 @@ void CAnimatedMeshHalfLife::initData () ...@@ -805,19 +772,6 @@ void CAnimatedMeshHalfLife::initData ()
#endif #endif
} }
/*!
*/
void CAnimatedMeshHalfLife::freeModel ()
{
delete [] (u8*) Header;
if (OwnTexModel )
delete [] (u8*) TextureHeader;
for ( u32 i = 0; i < 32; ++i )
delete [] (u8*) AnimationHeader[i];
}
/*! /*!
*/ */
...@@ -834,6 +788,7 @@ void STextureAtlas::release () ...@@ -834,6 +788,7 @@ void STextureAtlas::release ()
Master = 0; Master = 0;
} }
/*! /*!
*/ */
void STextureAtlas::addSource ( const c8 * name, video::IImage * image ) void STextureAtlas::addSource ( const c8 * name, video::IImage * image )
...@@ -848,6 +803,7 @@ void STextureAtlas::addSource ( const c8 * name, video::IImage * image ) ...@@ -848,6 +803,7 @@ void STextureAtlas::addSource ( const c8 * name, video::IImage * image )
atlas.push_back ( entry ); atlas.push_back ( entry );
} }
/*! /*!
*/ */
void STextureAtlas::getScale(core::vector2df& scale) void STextureAtlas::getScale(core::vector2df& scale)
...@@ -865,6 +821,7 @@ void STextureAtlas::getScale(core::vector2df& scale) ...@@ -865,6 +821,7 @@ void STextureAtlas::getScale(core::vector2df& scale)
scale.Y = 1.f; scale.Y = 1.f;
} }
/*! /*!
*/ */
void STextureAtlas::getTranslation(const c8* name, core::vector2di& pos) void STextureAtlas::getTranslation(const c8* name, core::vector2di& pos)
...@@ -879,6 +836,7 @@ void STextureAtlas::getTranslation(const c8* name, core::vector2di& pos) ...@@ -879,6 +836,7 @@ void STextureAtlas::getTranslation(const c8* name, core::vector2di& pos)
} }
} }
/*! /*!
*/ */
void STextureAtlas::create(u32 border, E_TEXTURE_CLAMP texmode) void STextureAtlas::create(u32 border, E_TEXTURE_CLAMP texmode)
...@@ -1005,22 +963,24 @@ SHalflifeHeader* CAnimatedMeshHalfLife::loadModel(io::IReadFile* file, const io: ...@@ -1005,22 +963,24 @@ SHalflifeHeader* CAnimatedMeshHalfLife::loadModel(io::IReadFile* file, const io:
{ {
bool closefile = false; bool closefile = false;
// if secondary files are needed, open here and mark for closing
if ( 0 == file ) if ( 0 == file )
{ {
file = SceneManager->getFileSystem()->createAndOpenFile ( filename ); file = SceneManager->getFileSystem()->createAndOpenFile(filename);
closefile = true; closefile = true;
} }
if ( 0 == file ) if ( 0 == file )
return 0; return 0;
u8 * pin = new u8 [ file->getSize() ]; // read into memory
file->read ( pin, file->getSize() ); u8* pin = new u8[file->getSize()];
file->read(pin, file->getSize());
SHalflifeHeader * header = (SHalflifeHeader*) pin; SHalflifeHeader* header = (SHalflifeHeader*) pin;
const bool idst = 0 == strncmp ( header->id, "IDST", 4); const bool idst = (0 == strncmp(header->id, "IDST", 4));
const bool idsq = 0 == strncmp ( header->id, "IDSQ", 4); const bool idsq = (0 == strncmp(header->id, "IDSQ", 4));
if ( (!idst && !idsq) || (idsq && !Header) ) if ( (!idst && !idsq) || (idsq && !Header) )
{ {
...@@ -1031,25 +991,22 @@ SHalflifeHeader* CAnimatedMeshHalfLife::loadModel(io::IReadFile* file, const io: ...@@ -1031,25 +991,22 @@ SHalflifeHeader* CAnimatedMeshHalfLife::loadModel(io::IReadFile* file, const io:
file = 0; file = 0;
} }
delete [] pin; delete [] pin;
return false; return 0;
} }
// don't know the real header.. idsg might be different // don't know the real header.. idsg might be different
if (header->textureindex && idst ) if (header->textureindex && idst )
{ {
io::path path;
io::path fname; io::path fname;
io::path ext; io::path ext;
io::path path;
io::path store;
core::splitFilename ( file->getFileName(), &path, &fname, &ext ); core::splitFilename(file->getFileName(), &path, &fname, &ext);
TextureBaseName = path + fname + "_"; TextureBaseName = path + fname + "_";
SHalflifeTexture *tex = (SHalflifeTexture *)(pin + header->textureindex); SHalflifeTexture *tex = (SHalflifeTexture *)(pin + header->textureindex);
u32 i;
u32 *palette = new u32[256]; u32 *palette = new u32[256];
for (i = 0; i < header->numtextures; i++) for (u32 i = 0; i < header->numtextures; ++i)
{ {
const u8 *src = pin + tex[i].index; const u8 *src = pin + tex[i].index;
...@@ -1063,25 +1020,16 @@ SHalflifeHeader* CAnimatedMeshHalfLife::loadModel(io::IReadFile* file, const io: ...@@ -1063,25 +1020,16 @@ SHalflifeHeader* CAnimatedMeshHalfLife::loadModel(io::IReadFile* file, const io:
} }
} }
IImage* image = new CImage( ECF_R8G8B8, core::dimension2d<u32> ( tex[i].width, tex[i].height ) ); IImage* image = new CImage( ECF_R8G8B8, core::dimension2d<u32>(tex[i].width, tex[i].height) );
CColorConverter::convert8BitTo24Bit(src, (u8*)image->lock(), tex[i].width, tex[i].height, (u8*) palette, 0, false); CColorConverter::convert8BitTo24Bit(src, (u8*)image->lock(), tex[i].width, tex[i].height, (u8*) palette, 0, false);
image->unlock(); image->unlock();
#if 0
core::splitFilename ( tex[i].name, 0, &fname, 0 );
io::path store = io::path ( "c:/h2/convert/" ) + fname + ".bmp";
SceneManager->getVideoDriver()->writeImageToFile ( image, store );
#endif
#ifdef HL_TEXTURE_ATLAS #ifdef HL_TEXTURE_ATLAS
TextureAtlas.addSource ( tex[i].name, image ); TextureAtlas.addSource ( tex[i].name, image );
#else #else
core::splitFilename ( tex[i].name, 0, &fname, &ext ); core::splitFilename ( tex[i].name, 0, &fname, &ext );
store = TextureBaseName + fname; SceneManager->getVideoDriver()->addTexture ( TextureBaseName + fname, image );
SceneManager->getVideoDriver()->addTexture ( store, image );
image->drop(); image->drop();
#endif #endif
} }
...@@ -1089,15 +1037,7 @@ SHalflifeHeader* CAnimatedMeshHalfLife::loadModel(io::IReadFile* file, const io: ...@@ -1089,15 +1037,7 @@ SHalflifeHeader* CAnimatedMeshHalfLife::loadModel(io::IReadFile* file, const io:
#ifdef HL_TEXTURE_ATLAS #ifdef HL_TEXTURE_ATLAS
TextureAtlas.create ( 2 * 2 + 1, ETC_CLAMP ); TextureAtlas.create ( 2 * 2 + 1, ETC_CLAMP );
SceneManager->getVideoDriver()->addTexture ( TextureBaseName + "atlas", TextureAtlas.Master );
store = TextureBaseName + "atlas";
SceneManager->getVideoDriver()->addTexture ( store, TextureAtlas.Master );
#if 0
core::splitFilename ( store, 0, &fname, 0 );
store = io::path ( "c:/h2/convert/" ) + fname + ".bmp";
SceneManager->getVideoDriver()->writeImageToFile ( TextureAtlas.Master, store );
#endif
TextureAtlas.release(); TextureAtlas.release();
#endif #endif
} }
...@@ -1181,6 +1121,7 @@ u32 CAnimatedMeshHalfLife::SetSkin( u32 value ) ...@@ -1181,6 +1121,7 @@ u32 CAnimatedMeshHalfLife::SetSkin( u32 value )
return SkinGroupSelection; return SkinGroupSelection;
} }
/*! /*!
*/ */
bool CAnimatedMeshHalfLife::postLoadModel( const io::path &filename ) bool CAnimatedMeshHalfLife::postLoadModel( const io::path &filename )
...@@ -1192,10 +1133,11 @@ bool CAnimatedMeshHalfLife::postLoadModel( const io::path &filename ) ...@@ -1192,10 +1133,11 @@ bool CAnimatedMeshHalfLife::postLoadModel( const io::path &filename )
core::splitFilename ( filename ,&path, &texname, 0 ); core::splitFilename ( filename ,&path, &texname, 0 );
// preload textures // preload textures
// if no textures are stored in main file, use texfile
if (Header->numtextures == 0) if (Header->numtextures == 0)
{ {
submodel = path + texname + "T.mdl"; submodel = path + texname + "T.mdl";
TextureHeader = loadModel( 0, submodel ); TextureHeader = loadModel(0, submodel);
if (!TextureHeader) if (!TextureHeader)
return false; return false;
OwnTexModel = true; OwnTexModel = true;
...@@ -1215,7 +1157,7 @@ bool CAnimatedMeshHalfLife::postLoadModel( const io::path &filename ) ...@@ -1215,7 +1157,7 @@ bool CAnimatedMeshHalfLife::postLoadModel( const io::path &filename )
snprintf( seq, 8, "%02d.mdl", i ); snprintf( seq, 8, "%02d.mdl", i );
submodel = path + texname + seq; submodel = path + texname + seq;
AnimationHeader[i] = loadModel( 0, submodel ); AnimationHeader[i] = loadModel(0, submodel);
if (!AnimationHeader[i]) if (!AnimationHeader[i])
return false; return false;
} }
...@@ -1343,7 +1285,7 @@ void CAnimatedMeshHalfLife::dumpModelInfo ( u32 level ) ...@@ -1343,7 +1285,7 @@ void CAnimatedMeshHalfLife::dumpModelInfo ( u32 level )
printf("\nnumattachments: %d\n", hdr->numattachments); printf("\nnumattachments: %d\n", hdr->numattachments);
for (i = 0; i < hdr->numattachments; i++) for (i = 0; i < hdr->numattachments; i++)
{ {
SHalfelifeAttachment *attach = (SHalfelifeAttachment *) ((u8*) hdr + hdr->attachmentindex); SHalflifeAttachment *attach = (SHalflifeAttachment *) ((u8*) hdr + hdr->attachmentindex);
printf("attachment %d.name: \"%s\"\n", i + 1, attach[i].name); printf("attachment %d.name: \"%s\"\n", i + 1, attach[i].name);
} }
...@@ -1362,6 +1304,7 @@ void CAnimatedMeshHalfLife::dumpModelInfo ( u32 level ) ...@@ -1362,6 +1304,7 @@ void CAnimatedMeshHalfLife::dumpModelInfo ( u32 level )
} }
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::ExtractBbox( s32 sequence, core::aabbox3df &box ) void CAnimatedMeshHalfLife::ExtractBbox( s32 sequence, core::aabbox3df &box )
...@@ -1378,7 +1321,6 @@ void CAnimatedMeshHalfLife::ExtractBbox( s32 sequence, core::aabbox3df &box ) ...@@ -1378,7 +1321,6 @@ void CAnimatedMeshHalfLife::ExtractBbox( s32 sequence, core::aabbox3df &box )
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::calcBoneAdj() void CAnimatedMeshHalfLife::calcBoneAdj()
...@@ -1420,98 +1362,80 @@ void CAnimatedMeshHalfLife::calcBoneAdj() ...@@ -1420,98 +1362,80 @@ void CAnimatedMeshHalfLife::calcBoneAdj()
} }
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::calcBoneQuaternion( s32 frame, f32 s, SHalflifeBone *bone, SHalflifeAnimOffset *anim, f32 *q ) const void CAnimatedMeshHalfLife::calcBoneQuaternion(const s32 frame, const SHalflifeBone * const bone,
SHalflifeAnimOffset *anim, const u32 j, f32& angle1, f32& angle2) const
{ {
s32 j, k; // three vector components
vec4_hl q1, q2; if (anim->offset[j+3] == 0)
vec3_hl angle1, angle2;
SHalfelifeAnimationFrame *animvalue;
for (j = 0; j < 3; j++)
{ {
if (anim->offset[j+3] == 0) angle2 = angle1 = bone->value[j+3]; // default
}
else
{
SHalflifeAnimationFrame *animvalue = (SHalflifeAnimationFrame *)((u8*)anim + anim->offset[j+3]);
s32 k = frame;
while (animvalue->num.total <= k)
{ {
angle2[j] = angle1[j] = bone->value[j+3]; // default; k -= animvalue->num.total;
animvalue += animvalue->num.valid + 1;
} }
else // Bah, missing blend!
if (animvalue->num.valid > k)
{ {
animvalue = (SHalfelifeAnimationFrame *)((u8*)anim + anim->offset[j+3]); angle1 = animvalue[k+1].value;
k = frame;
while (animvalue->num.total <= k)
{
k -= animvalue->num.total;
animvalue += animvalue->num.valid + 1;
}
// Bah, missing blend!
if (animvalue->num.valid > k)
{
angle1[j] = animvalue[k+1].value;
if (animvalue->num.valid > k + 1) if (animvalue->num.valid > k + 1)
{ {
angle2[j] = animvalue[k+2].value; angle2 = animvalue[k+2].value;
}
else
{
if (animvalue->num.total > k + 1)
angle2[j] = angle1[j];
else
angle2[j] = animvalue[animvalue->num.valid+2].value;
}
} }
else else
{ {
angle1[j] = animvalue[animvalue->num.valid].value;
if (animvalue->num.total > k + 1) if (animvalue->num.total > k + 1)
{ angle2 = angle1;
angle2[j] = angle1[j];
}
else else
{ angle2 = animvalue[animvalue->num.valid+2].value;
angle2[j] = animvalue[animvalue->num.valid + 2].value;
}
} }
angle1[j] = bone->value[j+3] + angle1[j] * bone->scale[j+3];
angle2[j] = bone->value[j+3] + angle2[j] * bone->scale[j+3];
} }
else
if (bone->bonecontroller[j+3] != -1)
{ {
angle1[j] += BoneAdj[bone->bonecontroller[j+3]]; angle1 = animvalue[animvalue->num.valid].value;
angle2[j] += BoneAdj[bone->bonecontroller[j+3]]; if (animvalue->num.total > k + 1)
{
angle2 = angle1;
}
else
{
angle2 = animvalue[animvalue->num.valid + 2].value;
}
} }
angle1 = bone->value[j+3] + angle1 * bone->scale[j+3];
angle2 = bone->value[j+3] + angle2 * bone->scale[j+3];
} }
if (!VectorCompare( angle1, angle2 )) if (bone->bonecontroller[j+3] != -1)
{
AngleQuaternion( angle1, q1 );
AngleQuaternion( angle2, q2 );
QuaternionSlerp( q1, q2, s, q );
}
else
{ {
AngleQuaternion( angle1, q ); angle1 += BoneAdj[bone->bonecontroller[j+3]];
angle2 += BoneAdj[bone->bonecontroller[j+3]];
} }
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::calcBonePosition( s32 frame, f32 s, SHalflifeBone *bone, SHalflifeAnimOffset *anim, f32 *pos ) const void CAnimatedMeshHalfLife::calcBonePosition(const s32 frame, f32 s,
const SHalflifeBone * const bone, SHalflifeAnimOffset *anim, f32 *pos) const
{ {
s32 j, k; for (s32 j = 0; j < 3; ++j)
SHalfelifeAnimationFrame *animvalue;
for (j = 0; j < 3; j++)
{ {
pos[j] = bone->value[j]; // default; pos[j] = bone->value[j]; // default;
if (anim->offset[j] != 0) if (anim->offset[j] != 0)
{ {
animvalue = (SHalfelifeAnimationFrame *)((u8*)anim + anim->offset[j]); SHalflifeAnimationFrame *animvalue = (SHalflifeAnimationFrame *)((u8*)anim + anim->offset[j]);
k = frame; s32 k = frame;
// find span of values that includes the frame we want // find span of values that includes the frame we want
while (animvalue->num.total <= k) while (animvalue->num.total <= k)
{ {
...@@ -1551,25 +1475,39 @@ void CAnimatedMeshHalfLife::calcBonePosition( s32 frame, f32 s, SHalflifeBone *b ...@@ -1551,25 +1475,39 @@ void CAnimatedMeshHalfLife::calcBonePosition( s32 frame, f32 s, SHalflifeBone *b
} }
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::calcRotations ( vec3_hl *pos, vec4_hl *q, SHalflifeSequence *seq, SHalflifeAnimOffset *anim, f32 f ) void CAnimatedMeshHalfLife::calcRotations(vec3_hl *pos, vec4_hl *q,
SHalflifeSequence *seq, SHalflifeAnimOffset *anim, f32 f)
{ {
s32 frame; s32 frame = (s32)f;
SHalflifeBone *bone; f32 s = (f - frame);
f32 s;
frame = (s32)f;
s = (f - frame);
// add in programatic controllers // add in programatic controllers
calcBoneAdj( ); calcBoneAdj();
bone = (SHalflifeBone *)((u8 *)Header + Header->boneindex); SHalflifeBone *bone = (SHalflifeBone *)((u8 *)Header + Header->boneindex);
for ( u32 i = 0; i < Header->numbones; i++, bone++, anim++) for ( u32 i = 0; i < Header->numbones; i++, bone++, anim++)
{ {
calcBoneQuaternion( frame, s, bone, anim, q[i] ); core::vector3df angle1, angle2;
calcBonePosition( frame, s, bone, anim, pos[i] ); calcBoneQuaternion(frame, bone, anim, 0, angle1.X, angle2.X);
calcBoneQuaternion(frame, bone, anim, 1, angle1.Y, angle2.Y);
calcBoneQuaternion(frame, bone, anim, 2, angle1.Z, angle2.Z);
if (!angle1.equals(angle2))
{
vec4_hl q1, q2;
AngleQuaternion( angle1, q1 );
AngleQuaternion( angle2, q2 );
QuaternionSlerp( q1, q2, s, q[i] );
}
else
{
AngleQuaternion( angle1, q[i] );
}
calcBonePosition(frame, s, bone, anim, pos[i]);
} }
if (seq->motiontype & STUDIO_X) if (seq->motiontype & STUDIO_X)
...@@ -1580,12 +1518,12 @@ void CAnimatedMeshHalfLife::calcRotations ( vec3_hl *pos, vec4_hl *q, SHalflifeS ...@@ -1580,12 +1518,12 @@ void CAnimatedMeshHalfLife::calcRotations ( vec3_hl *pos, vec4_hl *q, SHalflifeS
pos[seq->motionbone][2] = 0.f; pos[seq->motionbone][2] = 0.f;
} }
/*! /*!
*/ */
SHalflifeAnimOffset * CAnimatedMeshHalfLife::getAnim( SHalflifeSequence *seq ) SHalflifeAnimOffset * CAnimatedMeshHalfLife::getAnim( SHalflifeSequence *seq )
{ {
SHalflifeSequenceGroup *seqgroup; SHalflifeSequenceGroup *seqgroup = (SHalflifeSequenceGroup *)((u8*)Header + Header->seqgroupindex) + seq->seqgroup;
seqgroup = (SHalflifeSequenceGroup *)((u8*)Header + Header->seqgroupindex) + seq->seqgroup;
if (seq->seqgroup == 0) if (seq->seqgroup == 0)
{ {
...@@ -1598,18 +1536,18 @@ SHalflifeAnimOffset * CAnimatedMeshHalfLife::getAnim( SHalflifeSequence *seq ) ...@@ -1598,18 +1536,18 @@ SHalflifeAnimOffset * CAnimatedMeshHalfLife::getAnim( SHalflifeSequence *seq )
/*! /*!
*/ */
void CAnimatedMeshHalfLife::slerpBones( vec4_hl q1[], vec3_hl pos1[], vec4_hl q2[], vec3_hl pos2[], f32 s ) void CAnimatedMeshHalfLife::slerpBones(vec4_hl q1[], vec3_hl pos1[], vec4_hl q2[], vec3_hl pos2[], f32 s)
{ {
vec4_hl q3; if (s < 0)
f32 s1; s = 0;
else if (s > 1.f)
s = 1.f;
if (s < 0) s = 0; f32 s1 = 1.f - s;
else if (s > 1.f) s = 1.f;
s1 = 1.f - s;
for ( u32 i = 0; i < Header->numbones; i++) for ( u32 i = 0; i < Header->numbones; i++)
{ {
vec4_hl q3;
QuaternionSlerp( q1[i], q2[i], s, q3 ); QuaternionSlerp( q1[i], q2[i], s, q3 );
q1[i][0] = q3[0]; q1[i][0] = q3[0];
q1[i][1] = q3[1]; q1[i][1] = q3[1];
...@@ -1621,14 +1559,11 @@ void CAnimatedMeshHalfLife::slerpBones( vec4_hl q1[], vec3_hl pos1[], vec4_hl q2 ...@@ -1621,14 +1559,11 @@ void CAnimatedMeshHalfLife::slerpBones( vec4_hl q1[], vec3_hl pos1[], vec4_hl q2
} }
} }
/*! /*!
*/ */
void CAnimatedMeshHalfLife::setUpBones () void CAnimatedMeshHalfLife::setUpBones()
{ {
SHalflifeBone *bone;
SHalflifeSequence *seq;
SHalflifeAnimOffset *anim;
static vec3_hl pos[MAXSTUDIOBONES]; static vec3_hl pos[MAXSTUDIOBONES];
f32 bonematrix[3][4]; f32 bonematrix[3][4];
static vec4_hl q[MAXSTUDIOBONES]; static vec4_hl q[MAXSTUDIOBONES];
...@@ -1643,18 +1578,16 @@ void CAnimatedMeshHalfLife::setUpBones () ...@@ -1643,18 +1578,16 @@ void CAnimatedMeshHalfLife::setUpBones ()
if (SequenceIndex >= Header->numseq) if (SequenceIndex >= Header->numseq)
SequenceIndex = 0; SequenceIndex = 0;
seq = (SHalflifeSequence *)((u8*) Header + Header->seqindex) + SequenceIndex; SHalflifeSequence *seq = (SHalflifeSequence *)((u8*) Header + Header->seqindex) + SequenceIndex;
anim = getAnim( seq ); SHalflifeAnimOffset *anim = getAnim(seq);
calcRotations( pos, q, seq, anim, CurrentFrame ); calcRotations(pos, q, seq, anim, CurrentFrame);
if (seq->numblends > 1) if (seq->numblends > 1)
{ {
f32 s;
anim += Header->numbones; anim += Header->numbones;
calcRotations( pos2, q2, seq, anim, CurrentFrame ); calcRotations( pos2, q2, seq, anim, CurrentFrame );
s = Blending[0] / 255.f; f32 s = Blending[0] / 255.f;
slerpBones( q, pos, q2, pos2, s ); slerpBones( q, pos, q2, pos2, s );
...@@ -1674,7 +1607,7 @@ void CAnimatedMeshHalfLife::setUpBones () ...@@ -1674,7 +1607,7 @@ void CAnimatedMeshHalfLife::setUpBones ()
} }
} }
bone = (SHalflifeBone *)((u8*) Header + Header->boneindex); SHalflifeBone *bone = (SHalflifeBone *)((u8*) Header + Header->boneindex);
for (u32 i = 0; i < Header->numbones; i++) for (u32 i = 0; i < Header->numbones; i++)
{ {
...@@ -1694,7 +1627,6 @@ void CAnimatedMeshHalfLife::setUpBones () ...@@ -1694,7 +1627,6 @@ void CAnimatedMeshHalfLife::setUpBones ()
} }
//! Returns an axis aligned bounding box //! Returns an axis aligned bounding box
const core::aabbox3d<f32>& CAnimatedMeshHalfLife::getBoundingBox() const const core::aabbox3d<f32>& CAnimatedMeshHalfLife::getBoundingBox() const
{ {
...@@ -1715,10 +1647,11 @@ u32 CAnimatedMeshHalfLife::getMeshBufferCount() const ...@@ -1715,10 +1647,11 @@ u32 CAnimatedMeshHalfLife::getMeshBufferCount() const
return MeshIPol.getMeshBufferCount(); return MeshIPol.getMeshBufferCount();
} }
//! returns pointer to a mesh buffer //! returns pointer to a mesh buffer
IMeshBuffer* CAnimatedMeshHalfLife::getMeshBuffer(u32 nr) const IMeshBuffer* CAnimatedMeshHalfLife::getMeshBuffer(u32 nr) const
{ {
return MeshIPol.getMeshBuffer ( nr ); return MeshIPol.getMeshBuffer(nr);
} }
...@@ -1726,16 +1659,18 @@ IMeshBuffer* CAnimatedMeshHalfLife::getMeshBuffer(u32 nr) const ...@@ -1726,16 +1659,18 @@ IMeshBuffer* CAnimatedMeshHalfLife::getMeshBuffer(u32 nr) const
/** \param material: material to search for /** \param material: material to search for
\return Returns the pointer to the mesh buffer or \return Returns the pointer to the mesh buffer or
NULL if there is no such mesh buffer. */ NULL if there is no such mesh buffer. */
IMeshBuffer* CAnimatedMeshHalfLife::getMeshBuffer( const video::SMaterial &material) const IMeshBuffer* CAnimatedMeshHalfLife::getMeshBuffer(const video::SMaterial &material) const
{ {
return MeshIPol.getMeshBuffer ( material ); return MeshIPol.getMeshBuffer(material);
} }
void CAnimatedMeshHalfLife::setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue) void CAnimatedMeshHalfLife::setMaterialFlag(video::E_MATERIAL_FLAG flag, bool newvalue)
{ {
MeshIPol.setMaterialFlag ( flag, newvalue ); MeshIPol.setMaterialFlag ( flag, newvalue );
} }
//! set user axis aligned bounding box //! set user axis aligned bounding box
void CAnimatedMeshHalfLife::setBoundingBox(const core::aabbox3df& box) void CAnimatedMeshHalfLife::setBoundingBox(const core::aabbox3df& box)
{ {
......
...@@ -223,7 +223,7 @@ namespace scene ...@@ -223,7 +223,7 @@ namespace scene
} PACK_STRUCT mstudiopivot_t; } PACK_STRUCT mstudiopivot_t;
// attachment // attachment
struct SHalfelifeAttachment struct SHalflifeAttachment
{ {
c8 name[32]; c8 name[32];
s32 type; s32 type;
...@@ -238,7 +238,7 @@ namespace scene ...@@ -238,7 +238,7 @@ namespace scene
} PACK_STRUCT; } PACK_STRUCT;
// animation frames // animation frames
union SHalfelifeAnimationFrame union SHalflifeAnimationFrame
{ {
struct { struct {
u8 valid; u8 valid;
...@@ -487,7 +487,7 @@ namespace scene ...@@ -487,7 +487,7 @@ namespace scene
public: public:
//! constructor //! constructor
CAnimatedMeshHalfLife( ); CAnimatedMeshHalfLife();
//! destructor //! destructor
virtual ~CAnimatedMeshHalfLife(); virtual ~CAnimatedMeshHalfLife();
...@@ -539,7 +539,6 @@ namespace scene ...@@ -539,7 +539,6 @@ namespace scene
//! return a Mesh per frame //! return a Mesh per frame
SMesh MeshIPol; SMesh MeshIPol;
ISceneManager *SceneManager; ISceneManager *SceneManager;
SHalflifeHeader *Header; SHalflifeHeader *Header;
...@@ -548,7 +547,6 @@ namespace scene ...@@ -548,7 +547,6 @@ namespace scene
SHalflifeHeader *AnimationHeader[32]; // sequences named model01.mdl, model02.mdl SHalflifeHeader *AnimationHeader[32]; // sequences named model01.mdl, model02.mdl
void initData (); void initData ();
void freeModel ();
SHalflifeHeader * loadModel( io::IReadFile* file, const io::path &filename ); SHalflifeHeader * loadModel( io::IReadFile* file, const io::path &filename );
bool postLoadModel( const io::path &filename ); bool postLoadModel( const io::path &filename );
...@@ -556,13 +554,12 @@ namespace scene ...@@ -556,13 +554,12 @@ namespace scene
f32 CurrentFrame; // Current Frame f32 CurrentFrame; // Current Frame
#define MOUTH_CONTROLLER 4 #define MOUTH_CONTROLLER 4
u8 BoneController[4 + 1 ]; // bone controllers + mouth position u8 BoneController[4 + 1 ]; // bone controllers + mouth position
u8 Blending[2]; // animation blending u8 Blending[2]; // animation blending
f32 SetController( s32 controllerIndex, f32 value ); f32 SetController( s32 controllerIndex, f32 value );
u32 SkinGroupSelection; // skin group selection
u32 SkinGroupSelection; // skin group selection
u32 SetSkin( u32 value ); u32 SetSkin( u32 value );
void initModel (); void initModel ();
...@@ -570,7 +567,6 @@ namespace scene ...@@ -570,7 +567,6 @@ namespace scene
void ExtractBbox( s32 sequence, core::aabbox3df &box ); void ExtractBbox( s32 sequence, core::aabbox3df &box );
void setUpBones (); void setUpBones ();
SHalflifeAnimOffset * getAnim( SHalflifeSequence *seq ); SHalflifeAnimOffset * getAnim( SHalflifeSequence *seq );
void slerpBones( vec4_hl q1[], vec3_hl pos1[], vec4_hl q2[], vec3_hl pos2[], f32 s ); void slerpBones( vec4_hl q1[], vec3_hl pos1[], vec4_hl q2[], vec3_hl pos2[], f32 s );
...@@ -578,8 +574,8 @@ namespace scene ...@@ -578,8 +574,8 @@ namespace scene
vec4_hl BoneAdj; vec4_hl BoneAdj;
void calcBoneAdj(); void calcBoneAdj();
void calcBoneQuaternion( s32 frame, f32 s, SHalflifeBone *bone, SHalflifeAnimOffset *anim, f32 *q ) const; void calcBoneQuaternion(const s32 frame, const SHalflifeBone *bone, SHalflifeAnimOffset *anim, const u32 j, f32& angle1, f32& angle2) const;
void calcBonePosition( s32 frame, f32 s, SHalflifeBone *bone, SHalflifeAnimOffset *anim, f32 *pos ) const; void calcBonePosition(const s32 frame, f32 s, const SHalflifeBone *bone, SHalflifeAnimOffset *anim, f32 *pos ) const;
void buildVertices (); void buildVertices ();
...@@ -587,7 +583,6 @@ namespace scene ...@@ -587,7 +583,6 @@ namespace scene
#define HL_TEXTURE_ATLAS #define HL_TEXTURE_ATLAS
#ifdef HL_TEXTURE_ATLAS #ifdef HL_TEXTURE_ATLAS
STextureAtlas TextureAtlas; STextureAtlas TextureAtlas;
video::ITexture *TextureMaster; video::ITexture *TextureMaster;
...@@ -605,13 +600,14 @@ namespace scene ...@@ -605,13 +600,14 @@ namespace scene
CHalflifeMDLMeshFileLoader( scene::ISceneManager* smgr ); CHalflifeMDLMeshFileLoader( scene::ISceneManager* smgr );
//! returns true if the file maybe is able to be loaded by this class //! returns true if the file maybe is able to be loaded by this class
//! based on the file extension (e.g. ".bsp") /** based on the file extension (e.g. ".bsp") */
virtual bool isALoadableFileExtension(const io::path& filename) const; virtual bool isALoadableFileExtension(const io::path& filename) const;
//! creates/loads an animated mesh from the file. //! creates/loads an animated mesh from the file.
//! \return Pointer to the created mesh. Returns 0 if loading failed. /** \return Pointer to the created mesh. Returns 0 if loading failed.
//! If you no longer need the mesh, you should call IAnimatedMesh::drop(). If you no longer need the mesh, you should call IAnimatedMesh::drop().
//! See IReferenceCounted::drop() for more information. See IReferenceCounted::drop() for more information.
*/
virtual IAnimatedMesh* createMesh(io::IReadFile* file); virtual IAnimatedMesh* createMesh(io::IReadFile* file);
private: private:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment