public bool Lookup(string modelfilename, string skinfilename, out cMD2Info pmd2info) { bool success; int modelfileKey = _modelFilenamePool.lookupKey(modelfilename); if (Contains(modelfileKey)) { pmd2info = (cMD2Info)this[modelfileKey]; return(true); //We've already read in and saved the _pdata before. } //Otherwise create and register a new cMD2Info* object that's loaded with the modelfile. pmd2info = new cMD2Info(); success = pmd2info.Load(modelfilename, skinfilename); if (success) //Save the ptextureinfo { this[modelfileKey] = pmd2info; } return(success); }
} //Used by cSpriteQuake constructor and setRadius. /* Used by cGraphicsOpenGL::selectSkinTexture in * the cGraphicsOpenGL::interpolateAndRender method. */ /* Used by cGraphicsOpenGL::selectSkinTexture. */ //Individual Instance Methods public int Animate(cGraphics pgraphics, int startFrame, int endFrame, float percent) { if ((startFrame > _currentFrame)) { _currentFrame = startFrame; } if ((startFrame < 0) || (endFrame < 0)) { return(-1); } if ((startFrame >= NumFrames) || (endFrame >= NumFrames)) { return(-1); } if (_interpol >= 1.0f) { _interpol = 0.0f; _currentFrame++; if (_currentFrame >= endFrame) { _currentFrame = startFrame; } _nextFrame = _currentFrame + 1; if (_nextFrame >= endFrame) { _nextFrame = startFrame; } } cMD2Info pinfo = MD2Info; int numvertsperframe = pinfo.numVertices; int startframe, endframe; startframe = numvertsperframe * _currentFrame; endframe = numvertsperframe * _nextFrame; pgraphics.interpolateAndRender(this, pinfo.vertexList, startframe, endframe, _interpol); _interpol += percent; // increase percentage of interpolation between frames return(0); }