Inherits G3D::ReferenceCountedObject.
|
virtual | ~Part () |
|
void | debugRenderWireframe (RenderDevice *renderDevice, const Pose &pose, bool negateNormals=false) |
|
Render the wireframe mesh. More...
|
|
const Array< MeshAlg::Edge > & | edges () const |
|
const Array< MeshAlg::Face > & | faces () const |
|
virtual size_t | mainMemorySize () const |
|
Returns the approximate amount of main memory, not counting the texture, occupied by this data structure. More...
|
|
shared_ptr< UniversalMaterial > | material () const |
|
String | name () const |
|
const AABox & | objectSpaceBoundingBox () const |
|
An oriented bounding box on the model. More...
|
|
const Sphere & | objectSpaceBoundingSphere () const |
|
A bounding sphere on the model. More...
|
|
void | pose (Array< shared_ptr< Surface > > &surfaceArray, const CoordinateFrame &cframe, const CFrame &prevFrame, const Pose &pose, bool negateNormals=false, const shared_ptr< class Entity > &entity=nullptr, const Surface::ExpressiveLightScatteringProperties &expressiveLightScatteringProperties=Surface::ExpressiveLightScatteringProperties()) |
|
virtual void | setName (const String &n) |
|
const Array< Vector2 > & | texCoordArray () const |
|
const Array< String > & | textureFilenames () const |
| Filenames of textures this model can use. More...
|
|
const Array< MeshAlg::Vertex > & | vertices () const |
| You must get the geometry for the vertex positions– this only specifies adjacency. More...
|
|
const Array< MeshAlg::Edge > & | weldedEdges () const |
|
const Array< MeshAlg::Face > & | weldedFaces () const |
|
const Array< MeshAlg::Vertex > & | weldedVertices () const |
|
|
template<class T , class ... ArgTypes> |
static shared_ptr< T > | createShared (ArgTypes &&... args) |
| Like std::make_shared, but works for protected constructors. More...
|
|
◆ anonymous enum
Enumerator |
---|
NUM_VAR_AREAS | |
NONE_ALLOCATED | |
◆ Part()
G3D::MD2Model::Part::Part |
( |
| ) |
|
|
inlineprotected |
◆ ~Part()
virtual G3D::MD2Model::Part::~Part |
( |
| ) |
|
|
inlinevirtual |
◆ allocateVertexArrays()
void G3D::MD2Model::Part::allocateVertexArrays |
( |
RenderDevice * |
renderDevice | ) |
|
|
protected |
Called from render() to create the vertex arrays.
Assumes AttributeArray is available and the arrays are not initialized.
◆ computeTexCoords()
MD2 Models are stored with separate indices into texture coordinate and vertex arrays.
This means that some vertices must be duplicated in order to render with a single OpenGL-style vertex array.
Creates a texCoordArray to parallel the vertex and normal arrays, duplicating vertices in the keyframes as needed. Called from load().
- Parameters
-
inCoords | Texture coords corresponding to the index array |
◆ create()
static shared_ptr<class Part> G3D::MD2Model::Part::create |
( |
const Specification & |
specification | ) |
|
|
static |
◆ createShared()
template<class T , class ... ArgTypes>
static shared_ptr<T> G3D::ReferenceCountedObject::createShared |
( |
ArgTypes &&... |
args | ) |
|
|
inlinestaticprotectedinherited |
Like std::make_shared, but works for protected constructors.
Call as createShared<myclass>.
◆ debugRenderWireframe()
void G3D::MD2Model::Part::debugRenderWireframe |
( |
RenderDevice * |
renderDevice, |
|
|
const Pose & |
pose, |
|
|
bool |
negateNormals = false |
|
) |
| |
Render the wireframe mesh.
◆ edges()
◆ faces()
◆ fromFile()
static shared_ptr<class Part> G3D::MD2Model::Part::fromFile |
( |
const String & |
filename, |
|
|
const String & |
diffuseFilename, |
|
|
float |
scale = 1.0f |
|
) |
| |
|
static |
- Parameters
-
filename | The tris.md2 file. Note that most MD2 files are stored in two files, tris.md2 and weapon.md2.
You will have to load both as separate models. |
scale | Optional scale factor to apply while loading. The scale of 1.0 is chosen so that a typical character is 2 meters tall (1/2 the default quake unit scaling) |
◆ getGeometry()
void G3D::MD2Model::Part::getGeometry |
( |
const Pose & |
pose, |
|
|
MeshAlg::Geometry & |
geometry, |
|
|
bool |
negateNormals = false |
|
) |
| const |
|
protected |
Fills the geometry out from the pose.
Called from PosedMD2Model::getGeometry
◆ load()
void G3D::MD2Model::Part::load |
( |
const String & |
filename, |
|
|
float |
scale |
|
) |
| |
|
protected |
◆ loadTextureFilenames()
void G3D::MD2Model::Part::loadTextureFilenames |
( |
BinaryInput & |
b, |
|
|
int |
num, |
|
|
int |
offset |
|
) |
| |
|
protected |
◆ mainMemorySize()
virtual size_t G3D::MD2Model::Part::mainMemorySize |
( |
| ) |
const |
|
virtual |
Returns the approximate amount of main memory, not counting the texture, occupied by this data structure.
◆ material()
◆ name()
String G3D::MD2Model::Part::name |
( |
| ) |
const |
|
inline |
◆ objectSpaceBoundingBox()
const AABox& G3D::MD2Model::Part::objectSpaceBoundingBox |
( |
| ) |
const |
|
inline |
An oriented bounding box on the model.
Covers all vertices in all animations.
◆ objectSpaceBoundingSphere()
const Sphere& G3D::MD2Model::Part::objectSpaceBoundingSphere |
( |
| ) |
const |
|
inline |
A bounding sphere on the model.
Covers all vertices in all animations.
◆ pose()
◆ render()
void G3D::MD2Model::Part::render |
( |
RenderDevice * |
renderDevice, |
|
|
const Pose & |
pose |
|
) |
| |
|
protected |
Called from PosedMD2Model::render.
◆ reset()
virtual void G3D::MD2Model::Part::reset |
( |
| ) |
|
|
protectedvirtual |
Wipe all data structures.
Called from load.
◆ setBoundsFromPose()
void G3D::MD2Model::Part::setBoundsFromPose |
( |
const Pose & |
pose, |
|
|
AABox & |
boxBounds, |
|
|
Sphere & |
sphereBounds |
|
) |
| |
|
protected |
Sets.
- Parameters
-
boxBounds | and |
sphereBounds | to conservative bounds for the pose, which includes combining bounds for two animations if the pose is during an animation blend |
◆ setName()
virtual void G3D::MD2Model::Part::setName |
( |
const String & |
n | ) |
|
|
inlinevirtual |
◆ texCoordArray()
const Array<Vector2>& G3D::MD2Model::Part::texCoordArray |
( |
| ) |
const |
|
inline |
◆ textureFilenames()
const Array<String>& G3D::MD2Model::Part::textureFilenames |
( |
| ) |
const |
|
inline |
Filenames of textures this model can use.
◆ textureFromFile()
static shared_ptr<Texture> G3D::MD2Model::Part::textureFromFile |
( |
const String & |
filename | ) |
|
|
static |
Loads a Quake2 character texture.
Note that you may want to apply gamma correction as well if you are using tone mapping.
Same as:
Texture::Settings settings;
settings.wrapMode = WrapMode::CLAMP;
Texture::Preprocess preprocess;
preprocess.brighten = 2.0f;
Texture::fromFile(filename, ImageFormat::AUTO, Texture::DIM_2D, settings, preprocess)
◆ vertices()
You must get the geometry for the vertex positions– this only specifies adjacency.
◆ weldedEdges()
◆ weldedFaces()
◆ weldedVertices()
◆ MD2Model
◆ _name
String G3D::MD2Model::Part::_name |
|
protected |
◆ _texCoordArray
◆ _textureFilenames
◆ animationBoundingBox
◆ animationBoundingSphere
◆ boundingBox
AABox G3D::MD2Model::Part::boundingBox |
|
protected |
◆ boundingSphere
Sphere G3D::MD2Model::Part::boundingSphere |
|
protected |
◆ edgeArray
◆ faceArray
◆ faceNormalArray
◆ indexArray
Array<int> G3D::MD2Model::Part::indexArray |
|
protected |
Triangle list array useful for generating all of the triangles, e.g.
for collision detection. Not used for rendering.
◆ indexVAR
◆ interpolatedFrame
◆ interpolatedModel
The pose currently stored in interpolatedFrame.
When the animation is MAX_ANIMATIONS interpolatedFrame is not yet initialized.
◆ interpolatedPose
Pose G3D::MD2Model::Part::interpolatedPose |
|
staticprotected |
◆ keyFrame
◆ m_material
◆ nextVarArea
int G3D::MD2Model::Part::nextVarArea |
|
staticprotected |
When NONE_ALLOCATED, the vertex arrays have not been allocated.
◆ numBoundaryEdges
int G3D::MD2Model::Part::numBoundaryEdges |
|
protected |
◆ numWeldedBoundaryEdges
int G3D::MD2Model::Part::numWeldedBoundaryEdges |
|
protected |
◆ primitiveArray
◆ texCoordScale
Vector2 G3D::MD2Model::Part::texCoordScale |
|
protected |
1/header.skinWidth, 1/header.skinHeight, used by computeTextureCoords
◆ varArea
Shared dynamic vertex arrays.
Allocated by allocateVertexArrays. We cycle through multiple VertexBuffers because the models are so small that we can send data to the card faster than it can be rendered and we end up spending all of our time waiting on the GPU.
◆ vertexArray
◆ weldedEdgeArray
◆ weldedFaceArray
◆ weldedVertexArray