xoreos  0.0.5
Classes | Public Member Functions | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
Graphics::Aurora::Model_Sonic Class Reference

A 3D model in Nintendo's NSBMD format. More...

#include <model_sonic.h>

Inheritance diagram for Graphics::Aurora::Model_Sonic:
Inheritance graph
[legend]
Collaboration diagram for Graphics::Aurora::Model_Sonic:
Collaboration graph
[legend]

Classes

struct  Bone
 
struct  BoneCommand
 
struct  Geometry
 
struct  Info
 Info structure, specifies names and offsets of all kinds of lists in Nintendo files. More...
 
struct  Material
 
struct  ParserContext
 
struct  Polygon
 
struct  PolygonCommand
 
struct  Primitive
 
struct  PrimitiveNode
 Structure to represent a StackMix at run-time. More...
 
struct  PrimitiveVertex
 Intermediate structure to (re)create the VBO/IBO from. More...
 
struct  StackMix
 Structure we use to represent the parameters of a LoadStack bone command. More...
 

Public Member Functions

 Model_Sonic (const Common::UString &name, ModelType type=kModelTypeObject)
 
 ~Model_Sonic ()
 
void render (RenderPass pass)
 Render the object. More...
 
- Public Member Functions inherited from Graphics::Aurora::Model
 Model (ModelType type=kModelTypeObject)
 
 ~Model ()
 
void show ()
 Show the object. More...
 
void hide ()
 Hide the object. More...
 
ModelType getType () const
 Return the model's type. More...
 
const Common::UStringgetName () const
 Get the model's name. More...
 
float getWidth () const
 Get the width of the model's bounding box. More...
 
float getHeight () const
 Get the height of the model's bounding box. More...
 
float getDepth () const
 Get the depth of the model's bounding box. More...
 
void drawBound (bool enabled)
 Should a bounding box be drawn around this model? More...
 
void drawSkeleton (bool enabled, bool showInvisible)
 Should a skeleton showing the nodes and their relation be drawn inside the model? More...
 
void setEnvironmentMap (const Common::UString &environmentMap="")
 Change the environment map on this model. More...
 
void setSkinned (bool skinned)
 Set the flag if the model has skinned animations. More...
 
bool isIn (float x, float y) const
 Is that point within the model's bounding box? More...
 
bool isIn (float x, float y, float z) const
 Is that point within the model's bounding box? More...
 
bool isIn (float x1, float y1, float z1, float x2, float y2, float z2) const
 Does the line from x1.y1.z1 to x2.y2.z2 intersect with model's bounding box? More...
 
void getScale (float &x, float &y, float &z) const
 Get the current scale of the model. More...
 
void getOrientation (float &x, float &y, float &z, float &angle) const
 Get the current orientation of the model. More...
 
void getPosition (float &x, float &y, float &z) const
 Get the current position of the model. More...
 
void getAbsolutePosition (float &x, float &y, float &z) const
 Get the position of the node after translate/rotate. More...
 
void setScale (float x, float y, float z)
 Set the current scale of the model. More...
 
void setOrientation (float x, float y, float z, float angle)
 Set the current orientation of the model. More...
 
void setPosition (float x, float y, float z)
 Set the current position of the model. More...
 
void scale (float x, float y, float z)
 Scale the model, relative to its current scale. More...
 
void rotate (float x, float y, float z, float angle)
 Rotate the model, relative to its current orientation. More...
 
void move (float x, float y, float z)
 Move the model, relative to its current position. More...
 
void getTooltipAnchor (float &x, float &y, float &z) const
 Get the point where the feedback tooltip is anchored. More...
 
const std::list< Common::UString > & getStates () const
 Return a list of all animation state names. More...
 
void setState (const Common::UString &name="")
 Set the current animation state. More...
 
const Common::UStringgetState () const
 Return the name of the current state. More...
 
bool hasNode (const Common::UString &node) const
 Does the specified node exist in the current state? More...
 
ModelNodegetNode (const Common::UString &node)
 Get the specified node, from the current state. More...
 
const ModelNodegetNode (const Common::UString &node) const
 Get the specified node, from the current state. More...
 
ModelNodegetNode (const Common::UString &stateName, const Common::UString &node)
 Get the specified node, from the named state, if it exists. More...
 
const ModelNodegetNode (const Common::UString &stateName, const Common::UString &node) const
 Get the specified node, from the named state, if it exists. More...
 
ModelNodegetNode (uint16 nodeNumber)
 Get node by node number. More...
 
const ModelNodegetNode (uint16 nodeNumber) const
 Get node by node number. More...
 
const std::list< ModelNode * > & getNodes ()
 Get all nodes in the current state. More...
 
void attachModel (const Common::UString &nodeName, Model *model)
 Add another model as a child to the named node. More...
 
bool hasAnimation (const Common::UString &anim) const
 Does this model have this named animation? More...
 
float getAnimationScale (const Common::UString &anim)
 Determine what animation scaling applies. More...
 
void addAnimationChannel (AnimationChannelName name)
 
AnimationChannelgetAnimationChannel (AnimationChannelName name)
 
void clearDefaultAnimations ()
 
void addDefaultAnimation (const Common::UString &anim, uint8 probability)
 
void playDefaultAnimation ()
 
void playAnimation (const Common::UString &anim, bool restart=true, float length=0.0f, float speed=1.0f)
 
void calculateDistance ()
 Calculate the object's distance. More...
 
void renderImmediate (const glm::mat4 &parentTransform)
 For shader based systems, don't sort anything, render this right_now. More...
 
void queueRender (const glm::mat4 &parentTransform)
 Queue the object for later rendering. More...
 
void advanceTime (float dt)
 Advance time (used by renderables with animations). More...
 
void flushNodeBuffers ()
 Apply buffered changes to model nodes position and geometry. More...
 
ModelgetAttachedModel (const Common::UString &node)
 
- Public Member Functions inherited from Graphics::GLContainer
 GLContainer ()
 
 ~GLContainer ()
 
void rebuild ()
 
void destroy ()
 
- Public Member Functions inherited from Graphics::Queueable
 Queueable ()
 
virtual ~Queueable ()
 
- Public Member Functions inherited from Graphics::Renderable
 Renderable (RenderableType type)
 
 ~Renderable ()
 
bool operator< (const Queueable &q) const
 
double getDistance () const
 Get the distance of the object from the viewer. More...
 
uint32 getID () const
 Get the object's unique ID. More...
 
bool isClickable () const
 Is the object clickable? More...
 
void setClickable (bool clickable)
 Set the object's clickable state. More...
 
const Common::UStringgetTag () const
 Get the object's tag. More...
 
void setTag (const Common::UString &tag)
 Set the object's tag. More...
 
bool isVisible () const
 Is the object visible? More...
 

Private Types

enum  BoneCommandID {
  kBoneNOP = 0x00, kBoneEnd = 0x01, kBoneSetInvisible = 0x02, kBoneSetPolygonStack = 0x03,
  kBoneSetMaterial1 = 0x04, kBoneSetPolygon = 0x05, kBoneConnect1 = 0x06, kBoneUnknown1 = 0x08,
  kBoneLoadStack = 0x09, kBoneBeginPair = 0x0B, kBoneUnknown2 = 0x0C, kBoneSetMaterial2 = 0x24,
  kBoneConnect2 = 0x26, kBoneEndPair = 0x2B, kBoneUnknown3 = 0x2C, kBoneSetMaterial3 = 0x44,
  kBoneConnect3 = 0x46, kBoneConnect4 = 0x66
}
 
enum  PolygonCommandID {
  kPolygonNOP = 0x00, kPolygonMatrixMode = 0x10, kPolygonMatrixPush = 0x11, kPolygonMatrixPop = 0x12,
  kPolygonMatrixStore = 0x13, kPolygonMatrixRestore = 0x14, kPolygonMatrixIdentity = 0x15, kPolygonMatrixLoad4x4 = 0x16,
  kPolygonMatrixLoad4x3 = 0x17, kPolygonMatrixMult4x4 = 0x18, kPolygonMatrixMult4x3 = 0x19, kPolygonMatrixMult3x3 = 0x1A,
  kPolygonMatrixScale = 0x1B, kPolygonMatrixTranslate = 0x1C, kPolygonColor = 0x20, kPolygonNormal = 0x21,
  kPolygonTexCoord = 0x22, kPolygonVertex16 = 0x23, kPolygonVertex10 = 0x24, kPolygonVertexXY = 0x25,
  kPolygonVertexXZ = 0x26, kPolygonVertexYZ = 0x27, kPolygonVertexDiff = 0x28, kPolygonPolygonAttrib = 0x29,
  kPolygonTexImageParam = 0x2A, kPolygonPaletteBase = 0x2B, kPolygonDiffuseAmbient = 0x30, kPolygonSpecularEmit = 0x31,
  kPolygonLightVector = 0x32, kPolygonLightColor = 0x33, kPolygonShininess = 0x34, kPolygonBeginVertices = 0x40,
  kPolygonEndVertices = 0x41, kPolygonSwapBuffers = 0x50, kPolygonViewport = 0x60, kPolygonBoxTest = 0x70,
  kPolygonPosTest = 0x71, kPolygonVecTest = 0x72
}
 
enum  PrimitiveType { kPrimitiveTypeTriangles = 0, kPrimitiveTypeQuads = 1, kPrimitiveTypeTriangleStrip = 2, kPrimitiveTypeQuadStrip = 3 }
 
typedef std::vector< InfoInfos
 
typedef std::list< BoneCommandBoneCommands
 
typedef std::vector< PolygonCommandPolygonCommands
 
typedef std::vector< BoneBones
 
typedef std::vector< MaterialMaterials
 
typedef std::vector< PolygonPolygons
 
typedef std::vector< StackMixStackMixes
 
typedef std::map< uint32, StackMixesStackMixMap
 
typedef std::list< Bone * > BoneList
 
typedef std::map< uint8, Bone * > StackBoneMap
 
typedef std::map< uint8, bool > BoneInvisible
 
typedef std::vector< PrimitiveNodePrimitiveNodes
 
typedef std::vector< PrimitiveVertexPrimitiveVertices
 
typedef std::vector< uint16PrimitiveIndices
 
typedef std::vector< PrimitivePrimitives
 
typedef std::vector< GeometryGeometries
 

Private Member Functions

void newState (ParserContext &ctx)
 
void addState (ParserContext &ctx)
 
void load (ParserContext &ctx)
 
void readModel (ParserContext &ctx)
 
void readHeader (ParserContext &ctx)
 
void readModelHeader (ParserContext &ctx)
 
void readBones (ParserContext &ctx)
 
void readBone (ParserContext &ctx, Bone &bone, Info &info)
 
void readBoneCommands (ParserContext &ctx)
 
void readMaterials (ParserContext &ctx)
 
void readMaterialDefinitions (ParserContext &ctx)
 
void readMaterialDefinition (ParserContext &ctx, Material &material, Info &info)
 
void readMaterialResource (ParserContext &ctx, uint textureOrPalette)
 
void readPolygons (ParserContext &ctx)
 
void readPolygon (ParserContext &ctx, Polygon &polygon, Info &info)
 
void readPolygonCommands (ParserContext &ctx, Polygon &polygon, uint32 listSize)
 
void parseBoneCommands (ParserContext &ctx)
 
void findRootBones (ParserContext &ctx)
 
void findStackBones (ParserContext &ctx)
 
void createModelNodes (ParserContext &ctx)
 
void findStackMixes (ParserContext &ctx)
 
void createGeometry (ParserContext &ctx)
 
void createPrimitives (ParserContext &ctx, Geometry &geometry, Polygon &polygon)
 
void createIndices (Primitive &primitive)
 
void createIndicesTriangles (Primitive &primitive)
 
void createIndicesTriangleStrip (Primitive &primitive)
 
void createIndicesQuads (Primitive &primitive)
 
void createIndicesQuadStrip (Primitive &primitive)
 
void createBound ()
 
uint8 readInfoOffset (ParserContext &ctx, Infos &infos, uint32 offset)
 
uint8 readInfoOffsetCount (ParserContext &ctx, Infos &infos, uint32 offset)
 
void evaluateGeometry ()
 
void evaluatePrimitive (Primitive &primitive)
 

Static Private Member Functions

static double getFixedPoint (uint32 value, bool sign, uint8 iBits, uint8 fBits)
 Convert the Nintendo DS fixed-point values into floating point doubles. More...
 
static uint8 getPolygonParameterCount (PolygonCommandID cmd)
 Return the number of parameters required for this geometry command. More...
 
static uint8 getBoneParameterCount (BoneCommandID cmd, uint8 count)
 Return the number of parameters required for this bone command. More...
 
static glm::mat4 createPivot (double a, double b, uint8 select, uint8 negate)
 Create a specific pivot matrix. More...
 

Private Attributes

Geometries _geometries
 

Friends

class ModelNode_Sonic
 

Additional Inherited Members

- Static Public Member Functions inherited from Graphics::Aurora::Model
static void readValue (Common::SeekableReadStream &stream, uint32 &value)
 
static void readValue (Common::SeekableReadStream &stream, float &value)
 
static void readArrayDef (Common::SeekableReadStream &stream, uint32 &offset, uint32 &count)
 
template<typename T >
static void readArray (Common::SeekableReadStream &stream, uint32 offset, uint32 count, std::vector< T > &values)
 
- Protected Types inherited from Graphics::Aurora::Model
typedef std::list< ModelNode * > NodeList
 
typedef std::map< Common::UString, ModelNode *, Common::UString::ilessNodeMap
 
typedef std::map< Common::UString, Animation *, Common::UString::ilessAnimationMap
 
typedef std::map< AnimationChannelName, AnimationChannel * > AnimationChannelMap
 
typedef std::list< State * > StateList
 
typedef std::map< Common::UString, State * > StateMap
 
- Protected Member Functions inherited from Graphics::Aurora::Model
void queueDrawBound ()
 
void doDrawBound ()
 
void doDrawSkeleton ()
 
AnimationgetAnimation (const Common::UString &anim)
 Get the animation from its name. More...
 
void finalize ()
 Finalize the loading procedure. More...
 
void doRebuild ()
 
void doDestroy ()
 
- Protected Member Functions inherited from Graphics::Queueable
bool isInQueue (QueueType queue) const
 
void addToQueue (QueueType queue)
 
void removeFromQueue (QueueType queue)
 
void lockQueue (QueueType queue)
 
void unlockQueue (QueueType queue)
 
void sortQueue (QueueType queue)
 
- Protected Member Functions inherited from Graphics::Renderable
void resort ()
 
void lockFrame ()
 
void unlockFrame ()
 
void lockFrameIfVisible ()
 
void unlockFrameIfVisible ()
 
- Static Protected Member Functions inherited from Aurora::NitroFile
static Common::SeekableSubReadStreamEndianopen (Common::SeekableReadStream &stream)
 Treat this stream as a Nitro file and return an endian'd stream according to its BOM. More...
 
static Common::SeekableSubReadStreamEndianopen (Common::SeekableReadStream *stream)
 Treat this stream as a Nitro file, take it over and return an endian'd stream according to its BOM. More...
 
- Protected Attributes inherited from Graphics::Aurora::Model
ModelType _type
 The model's type. More...
 
Common::UString _fileName
 The model's file name. More...
 
Common::UString _name
 The model's name. More...
 
Common::UString _superModelName
 Name of the super model. More...
 
Model_superModel
 The actual super model. More...
 
StateList _stateList
 All states within this model. More...
 
StateMap _stateMap
 All states within this model, index by name. More...
 
State_currentState
 The current state. More...
 
std::list< Common::UString_stateNames
 All state names. More...
 
AnimationMap _animationMap
 Map of all animations in this model. More...
 
AnimationChannelMap _animationChannels
 
float _animationScale
 The scale of the animation. More...
 
float _scale [3]
 Model's scale. More...
 
float _orientation [4]
 Model's orientation. More...
 
float _position [3]
 Model's position. More...
 
float _center [3]
 Model's center. More...
 
glm::mat4 _absolutePosition
 
Common::BoundingBox _boundBox
 The model's bounding box. More...
 
Common::BoundingBox _absoluteBoundBox
 The model's box after translate/rotate. More...
 
bool _skinned
 
bool _positionRelative
 
Shader::ShaderRenderable _boundRenderable
 
glm::mat4 _boundTransform
 
- Protected Attributes inherited from Graphics::Renderable
QueueType _queueExists
 
QueueType _queueVisible
 
uint32 _id
 
bool _clickable
 
Common::UString _tag
 
double _distance
 The distance of the object from the viewer. More...
 

Detailed Description

A 3D model in Nintendo's NSBMD format.

Conceptually, an NSBMD file consists of these parts:

A bone consists of a name and a transformation that displaces it from its (at that point unknown) parent bone. They are stored as a flat list.

The bone commands specify how the bones connect together, and in which position of the Nintendo's matrix stack the absolute transformation of the bone resides in. The bone commands also pair polygons with materials.

A material has a texture and a palette name, which are references to said names in the NSBTX file with the same name as the model itself. Since we already pair textures with palettes when handling NSBTX files, we don't care about the palette name here. The material also comes with a few properties that are already given in the corresponding NSBTX file. The duplication can probably be ignored; they're hopefully the same. In fact, we don't currently handle these properties at all.

Each polygon references one material, and comes with a list of polygon commands.

The polygon commands produce the actual geometry. They set color, normal and texture coordinates, and generate vertices. They also manipulate the matrix stack, specifically replacing the working matrix with the matrix from the stack position of certain bones. In essence, this bases the vertices on the position of the bone.

(This is only part of the story, though. The bone commands can also set a stack position to the weighted average of several other matrix stack position. We don't (yet) support this and just don't show the affected geometry. Luckily, this is only needed for two models: gup_aa (a robot) and gwr_hf (some kind of giant beetle thing).)

While the Nintendo DS interprets the polygon commands on-the-fly while rendering, and while they can be nearly directly converted to OpenGL-1.2-era glBegin()/glEnd() blocks, this is not really want we want to do. So instead, we, while loading, interpret the polygon commands into an intermediate structure we can use to (re)create IBO/VBO when necessary.

However, the generated geometry is not neatly divisible into model node chunks. Therefore, we generate the node structure only as a semi-fake layer, and the IBO/VBO reside within the Model object, to be regenerated whenever the model nodes change. This also means that operations that would only manipulate a single node, like hiding it, are only possible if the polygon command list takes the possibility into account.

NOTE: Moving/Rotating the model nodes is not actually implemented yet. We probably need a virtual Model::update() method that is called when necessary. Model_Sonic::update() would then reparse the intermediate structure and recreate the IBO/VBO. Better yet, it would only update the vector positions that actually changed.

Definition at line 116 of file model_sonic.h.

Member Typedef Documentation

◆ BoneCommands

Definition at line 218 of file model_sonic.h.

◆ BoneInvisible

typedef std::map<uint8, bool> Graphics::Aurora::Model_Sonic::BoneInvisible
private

Definition at line 302 of file model_sonic.h.

◆ BoneList

typedef std::list<Bone *> Graphics::Aurora::Model_Sonic::BoneList
private

Definition at line 300 of file model_sonic.h.

◆ Bones

typedef std::vector<Bone> Graphics::Aurora::Model_Sonic::Bones
private

Definition at line 250 of file model_sonic.h.

◆ Geometries

Definition at line 469 of file model_sonic.h.

◆ Infos

typedef std::vector<Info> Graphics::Aurora::Model_Sonic::Infos
private

Definition at line 209 of file model_sonic.h.

◆ Materials

typedef std::vector<Material> Graphics::Aurora::Model_Sonic::Materials
private

Definition at line 268 of file model_sonic.h.

◆ PolygonCommands

Definition at line 227 of file model_sonic.h.

◆ Polygons

typedef std::vector<Polygon> Graphics::Aurora::Model_Sonic::Polygons
private

Definition at line 283 of file model_sonic.h.

◆ PrimitiveIndices

Definition at line 447 of file model_sonic.h.

◆ PrimitiveNodes

Definition at line 432 of file model_sonic.h.

◆ Primitives

Definition at line 462 of file model_sonic.h.

◆ PrimitiveVertices

Definition at line 446 of file model_sonic.h.

◆ StackBoneMap

Definition at line 301 of file model_sonic.h.

◆ StackMixes

Definition at line 297 of file model_sonic.h.

◆ StackMixMap

Definition at line 298 of file model_sonic.h.

Member Enumeration Documentation

◆ BoneCommandID

Enumerator
kBoneNOP 

No operation, padding.

kBoneEnd 

End marker for bone command list.

kBoneSetInvisible 

Set bone to invisible.

kBoneSetPolygonStack 

Set default stack position for a polygon.

kBoneSetMaterial1 

Set material to use.

kBoneSetPolygon 

Set polygon to operate on.

kBoneConnect1 

Connect bones, inherit child and parent stack.

kBoneUnknown1 
kBoneLoadStack 
kBoneBeginPair 
kBoneUnknown2 
kBoneSetMaterial2 

Set material to use.

kBoneConnect2 

Connect bones, set child stack, inherit parent stack.

kBoneEndPair 
kBoneUnknown3 
kBoneSetMaterial3 

Set material to use.

kBoneConnect3 

Connect bones, set parent stack, inherit child stack.

kBoneConnect4 

Connect bones, set child and parent stack.

Definition at line 126 of file model_sonic.h.

◆ PolygonCommandID

Enumerator
kPolygonNOP 

No operation, padding.

kPolygonMatrixMode 

Set matrix mode.

kPolygonMatrixPush 

Push current matrix onto stack.

kPolygonMatrixPop 

Pop current matrix from stack.

kPolygonMatrixStore 

Store current matrix onto stack.

kPolygonMatrixRestore 

Restore current matrix from stack.

kPolygonMatrixIdentity 

Set current matrix to identity.

kPolygonMatrixLoad4x4 

Load 4x4 values into current matrix.

kPolygonMatrixLoad4x3 

Load 4x3 values into current matrix.

kPolygonMatrixMult4x4 

Multiply current matrix by 4x4 values.

kPolygonMatrixMult4x3 

Multiply current matrix by 4x3 values.

kPolygonMatrixMult3x3 

Multiply current matrix by 3x3 values.

kPolygonMatrixScale 

Multiply current matrix by scale matrix.

kPolygonMatrixTranslate 

Multiply current matrix by translation matrix.

kPolygonColor 

Set vertex color.

kPolygonNormal 

Set vertex normal.

kPolygonTexCoord 

Set texture coordinates.

kPolygonVertex16 

Vertex XYZ, 16bit fixed-point.

kPolygonVertex10 

Vertex XYZ, 10bit fixed-point.

kPolygonVertexXY 

Vertex XY, 16bit fixed-point, re-use Z.

kPolygonVertexXZ 

Vertex XZ, 16bit fixed-point, re-use Y.

kPolygonVertexYZ 

Vertex YZ, 16bit fixed-point, re-use X.

kPolygonVertexDiff 

Vertex XYZ delta, 10bit fixed-point.

kPolygonPolygonAttrib 

Set polygon attributes.

kPolygonTexImageParam 

Set texture parameters.

kPolygonPaletteBase 

Set the palette base address.

kPolygonDiffuseAmbient 

Set diffuse and ambient reflection colors.

kPolygonSpecularEmit 

Set specular reflection and emission colors.

kPolygonLightVector 

Set light direction.

kPolygonLightColor 

Set light color.

kPolygonShininess 

Set specular reflection shininess.

kPolygonBeginVertices 

Start of vertex list.

kPolygonEndVertices 

End of vertex list.

kPolygonSwapBuffers 

Swap render engine buffers.

kPolygonViewport 

Set viewport.

kPolygonBoxTest 

Test if box is inside view volume.

kPolygonPosTest 

Multiply a line vector by the clip matrix.

kPolygonVecTest 

Multiply a line vector by the directional vector.

Definition at line 147 of file model_sonic.h.

◆ PrimitiveType

Enumerator
kPrimitiveTypeTriangles 
kPrimitiveTypeQuads 
kPrimitiveTypeTriangleStrip 
kPrimitiveTypeQuadStrip 

Definition at line 415 of file model_sonic.h.

Constructor & Destructor Documentation

◆ Model_Sonic()

Graphics::Aurora::Model_Sonic::Model_Sonic ( const Common::UString name,
ModelType  type = kModelTypeObject 
)

Definition at line 107 of file model_sonic.cpp.

References Graphics::Aurora::Model::_fileName, createBound(), Graphics::Aurora::Model::finalize(), and load().

Here is the call graph for this function:

◆ ~Model_Sonic()

Graphics::Aurora::Model_Sonic::~Model_Sonic ( )

Definition at line 120 of file model_sonic.cpp.

Member Function Documentation

◆ addState()

void Graphics::Aurora::Model_Sonic::addState ( ParserContext ctx)
private

◆ createBound()

void Graphics::Aurora::Model_Sonic::createBound ( )
private

◆ createGeometry()

void Graphics::Aurora::Model_Sonic::createGeometry ( ParserContext ctx)
private

◆ createIndices()

void Graphics::Aurora::Model_Sonic::createIndices ( Primitive primitive)
private

◆ createIndicesQuads()

void Graphics::Aurora::Model_Sonic::createIndicesQuads ( Primitive primitive)
private

Definition at line 1023 of file model_sonic.cpp.

References Graphics::Aurora::Model_Sonic::Primitive::indices, and Graphics::Aurora::Model_Sonic::Primitive::vertices.

Referenced by createIndices().

Here is the caller graph for this function:

◆ createIndicesQuadStrip()

void Graphics::Aurora::Model_Sonic::createIndicesQuadStrip ( Primitive primitive)
private

Definition at line 1042 of file model_sonic.cpp.

References Graphics::Aurora::Model_Sonic::Primitive::indices, and Graphics::Aurora::Model_Sonic::Primitive::vertices.

Referenced by createIndices().

Here is the caller graph for this function:

◆ createIndicesTriangles()

void Graphics::Aurora::Model_Sonic::createIndicesTriangles ( Primitive primitive)
private

Definition at line 993 of file model_sonic.cpp.

References Graphics::Aurora::Model_Sonic::Primitive::indices, and Graphics::Aurora::Model_Sonic::Primitive::vertices.

Referenced by createIndices().

Here is the caller graph for this function:

◆ createIndicesTriangleStrip()

void Graphics::Aurora::Model_Sonic::createIndicesTriangleStrip ( Primitive primitive)
private

Definition at line 1002 of file model_sonic.cpp.

References Graphics::Aurora::Model_Sonic::Primitive::indices, and Graphics::Aurora::Model_Sonic::Primitive::vertices.

Referenced by createIndices().

Here is the caller graph for this function:

◆ createModelNodes()

void Graphics::Aurora::Model_Sonic::createModelNodes ( ParserContext ctx)
private

◆ createPivot()

glm::mat4 Graphics::Aurora::Model_Sonic::createPivot ( double  a,
double  b,
uint8  select,
uint8  negate 
)
staticprivate

Create a specific pivot matrix.

Definition at line 1283 of file model_sonic.cpp.

Referenced by readBone().

Here is the caller graph for this function:

◆ createPrimitives()

void Graphics::Aurora::Model_Sonic::createPrimitives ( ParserContext ctx,
Geometry geometry,
Polygon polygon 
)
private

Definition at line 775 of file model_sonic.cpp.

References Graphics::Aurora::Model_Sonic::PrimitiveVertex::color, Graphics::Aurora::Model_Sonic::Polygon::commands, Graphics::Aurora::Model_Sonic::ParserContext::defaultScale, Graphics::Aurora::Model_Sonic::Polygon::defaultStack, Graphics::Aurora::TextureHandle::empty(), Graphics::Aurora::Texture::getHeight(), Graphics::Aurora::TextureHandle::getTexture(), Graphics::Aurora::Texture::getWidth(), Graphics::Aurora::Model_Sonic::Primitive::invalid, kPolygonBeginVertices, kPolygonBoxTest, kPolygonColor, kPolygonDiffuseAmbient, kPolygonEndVertices, kPolygonLightColor, kPolygonLightVector, kPolygonMatrixIdentity, kPolygonMatrixLoad4x3, kPolygonMatrixLoad4x4, kPolygonMatrixMode, kPolygonMatrixMult3x3, kPolygonMatrixMult4x3, kPolygonMatrixMult4x4, kPolygonMatrixPop, kPolygonMatrixPush, kPolygonMatrixRestore, kPolygonMatrixScale, kPolygonMatrixStore, kPolygonMatrixTranslate, kPolygonNOP, kPolygonNormal, kPolygonPaletteBase, kPolygonPolygonAttrib, kPolygonPosTest, kPolygonShininess, kPolygonSpecularEmit, kPolygonSwapBuffers, kPolygonTexCoord, kPolygonTexImageParam, kPolygonVecTest, kPolygonVertex10, kPolygonVertex16, kPolygonVertexDiff, kPolygonVertexXY, kPolygonVertexXZ, kPolygonVertexYZ, kPolygonViewport, Graphics::Aurora::Model_Sonic::PrimitiveVertex::nodes, Graphics::Aurora::Model_Sonic::PrimitiveVertex::normal, Graphics::Aurora::Model_Sonic::Polygon::primitiveCount, Graphics::Aurora::Model_Sonic::Geometry::primitives, Graphics::Aurora::Model_Sonic::Polygon::primitiveSize, readNintendoFixedPoint(), Graphics::Aurora::Model_Sonic::ParserContext::stackBones, Graphics::Aurora::Model_Sonic::ParserContext::stackMix, Graphics::Aurora::Model_Sonic::PrimitiveVertex::texCoord, Graphics::Aurora::Model_Sonic::Geometry::texture, Graphics::Aurora::Model_Sonic::PrimitiveVertex::vertex, and Graphics::Aurora::Model_Sonic::Primitive::vertices.

Referenced by createGeometry().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluateGeometry()

void Graphics::Aurora::Model_Sonic::evaluateGeometry ( )
private

Definition at line 1134 of file model_sonic.cpp.

References _geometries, and evaluatePrimitive().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ evaluatePrimitive()

void Graphics::Aurora::Model_Sonic::evaluatePrimitive ( Primitive primitive)
private

◆ findRootBones()

void Graphics::Aurora::Model_Sonic::findRootBones ( ParserContext ctx)
private

Definition at line 687 of file model_sonic.cpp.

References Graphics::Aurora::Model_Sonic::ParserContext::bones, and Graphics::Aurora::Model_Sonic::ParserContext::rootBones.

Referenced by load().

Here is the caller graph for this function:

◆ findStackBones()

void Graphics::Aurora::Model_Sonic::findStackBones ( ParserContext ctx)
private

Definition at line 699 of file model_sonic.cpp.

References Graphics::Aurora::Model::_name, Graphics::Aurora::Model_Sonic::ParserContext::bones, Common::UString::c_str(), Graphics::Aurora::Model_Sonic::ParserContext::stackBones, and warning().

Referenced by load().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findStackMixes()

void Graphics::Aurora::Model_Sonic::findStackMixes ( ParserContext ctx)
private

Definition at line 738 of file model_sonic.cpp.

References Graphics::Aurora::Model_Sonic::ParserContext::stackBones, and Graphics::Aurora::Model_Sonic::ParserContext::stackMix.

Referenced by load().

Here is the caller graph for this function:

◆ getBoneParameterCount()

uint8 Graphics::Aurora::Model_Sonic::getBoneParameterCount ( BoneCommandID  cmd,
uint8  count 
)
staticprivate

Return the number of parameters required for this bone command.

Definition at line 1197 of file model_sonic.cpp.

References kBoneBeginPair, kBoneConnect1, kBoneConnect2, kBoneConnect3, kBoneConnect4, kBoneEnd, kBoneEndPair, kBoneLoadStack, kBoneNOP, kBoneSetInvisible, kBoneSetMaterial1, kBoneSetMaterial2, kBoneSetMaterial3, kBoneSetPolygon, kBoneSetPolygonStack, kBoneUnknown1, kBoneUnknown2, and kBoneUnknown3.

Referenced by readBoneCommands().

Here is the caller graph for this function:

◆ getFixedPoint()

static double Graphics::Aurora::Model_Sonic::getFixedPoint ( uint32  value,
bool  sign,
uint8  iBits,
uint8  fBits 
)
staticprivate

Convert the Nintendo DS fixed-point values into floating point doubles.

◆ getPolygonParameterCount()

uint8 Graphics::Aurora::Model_Sonic::getPolygonParameterCount ( PolygonCommandID  cmd)
staticprivate

◆ load()

void Graphics::Aurora::Model_Sonic::load ( ParserContext ctx)
private

Definition at line 125 of file model_sonic.cpp.

References createGeometry(), createModelNodes(), evaluateGeometry(), findRootBones(), findStackBones(), findStackMixes(), parseBoneCommands(), readHeader(), and readModel().

Referenced by Model_Sonic().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ newState()

void Graphics::Aurora::Model_Sonic::newState ( ParserContext ctx)
private

Definition at line 1101 of file model_sonic.cpp.

References Graphics::Aurora::Model_Sonic::ParserContext::clear(), and Graphics::Aurora::Model_Sonic::ParserContext::state.

Referenced by createModelNodes().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ parseBoneCommands()

void Graphics::Aurora::Model_Sonic::parseBoneCommands ( ParserContext ctx)
private

◆ readBone()

void Graphics::Aurora::Model_Sonic::readBone ( ParserContext ctx,
Bone bone,
Info info 
)
private

◆ readBoneCommands()

void Graphics::Aurora::Model_Sonic::readBoneCommands ( ParserContext ctx)
private

◆ readBones()

void Graphics::Aurora::Model_Sonic::readBones ( ParserContext ctx)
private

◆ readHeader()

void Graphics::Aurora::Model_Sonic::readHeader ( ParserContext ctx)
private

◆ readInfoOffset()

uint8 Graphics::Aurora::Model_Sonic::readInfoOffset ( ParserContext ctx,
Infos infos,
uint32  offset 
)
private

◆ readInfoOffsetCount()

uint8 Graphics::Aurora::Model_Sonic::readInfoOffsetCount ( ParserContext ctx,
Infos infos,
uint32  offset 
)
private

◆ readMaterialDefinition()

void Graphics::Aurora::Model_Sonic::readMaterialDefinition ( ParserContext ctx,
Material material,
Info info 
)
private

◆ readMaterialDefinitions()

void Graphics::Aurora::Model_Sonic::readMaterialDefinitions ( ParserContext ctx)
private

Definition at line 415 of file model_sonic.cpp.

References Graphics::Aurora::Model_Sonic::ParserContext::materials, Graphics::Aurora::Model_Sonic::ParserContext::offsetMaterials, readInfoOffset(), and readMaterialDefinition().

Referenced by readMaterials().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readMaterialResource()

void Graphics::Aurora::Model_Sonic::readMaterialResource ( ParserContext ctx,
uint  textureOrPalette 
)
private

◆ readMaterials()

void Graphics::Aurora::Model_Sonic::readMaterials ( ParserContext ctx)
private

◆ readModel()

void Graphics::Aurora::Model_Sonic::readModel ( ParserContext ctx)
private

◆ readModelHeader()

void Graphics::Aurora::Model_Sonic::readModelHeader ( ParserContext ctx)
private

◆ readPolygon()

void Graphics::Aurora::Model_Sonic::readPolygon ( ParserContext ctx,
Polygon polygon,
Info info 
)
private

◆ readPolygonCommands()

void Graphics::Aurora::Model_Sonic::readPolygonCommands ( ParserContext ctx,
Polygon polygon,
uint32  listSize 
)
private

◆ readPolygons()

void Graphics::Aurora::Model_Sonic::readPolygons ( ParserContext ctx)
private

◆ render()

void Graphics::Aurora::Model_Sonic::render ( RenderPass  pass)
virtual

Friends And Related Function Documentation

◆ ModelNode_Sonic

friend class ModelNode_Sonic
friend

Definition at line 476 of file model_sonic.h.

Referenced by createModelNodes().

Member Data Documentation

◆ _geometries

Geometries Graphics::Aurora::Model_Sonic::_geometries
private

Definition at line 471 of file model_sonic.h.

Referenced by createBound(), createGeometry(), evaluateGeometry(), and render().


The documentation for this class was generated from the following files: