25 #ifndef GRAPHICS_AURORA_MODEL_SONIC_H 26 #define GRAPHICS_AURORA_MODEL_SONIC_H 32 #include "glm/vec3.hpp" 33 #include "glm/vec4.hpp" 34 #include "glm/mat4x4.hpp" 49 class ModelNode_Sonic;
444 color(1.0f, 1.0f, 1.0f, 1.0f),
texCoord(0.0f, 0.0f, 0.0f) { }
497 #endif // GRAPHICS_AURORA_MODEL_SONIC_H
Connect bones, set child stack, inherit parent stack.
void createIndicesQuadStrip(Primitive &primitive)
void findStackBones(ParserContext &ctx)
Set the palette base address.
void readBones(ParserContext &ctx)
std::vector< Geometry > Geometries
Vertex XYZ, 16bit fixed-point.
void findStackMixes(ParserContext &ctx)
This is a wrapper around SeekableSubReadStream, but it adds non-endian read methods whose endianness ...
Structure we use to represent the parameters of a LoadStack bone command.
void createIndices(Primitive &primitive)
void readBone(ParserContext &ctx, Bone &bone, Info &info)
void evaluatePrimitive(Primitive &primitive)
Vertex XY, 16bit fixed-point, re-use Z.
uint8 scaleY
Scale (1 or 2) the texture in Y direction.
PolygonCommand(PolygonCommandID cmd=kPolygonNOP)
Common::SeekableSubReadStreamEndian * nsbmd
A class holding an UTF-8 string.
Structure to represent a StackMix at run-time.
static double getFixedPoint(uint32 value, bool sign, uint8 iBits, uint8 fBits)
Convert the Nintendo DS fixed-point values into floating point doubles.
Connect bones, set parent stack, inherit child stack.
uint8 scaleX
Scale (1 or 2) the texture in X direction.
uint16 parentStack
Matrix stack position the parent uses.
Pop current matrix from stack.
A 3D model in Nintendo's NSBMD format.
void readMaterialDefinitions(ParserContext &ctx)
std::vector< Bone > Bones
A real object in the game world.
Vertex XZ, 16bit fixed-point, re-use Y.
VertexBuffer vertexBuffer
BoneCommand(BoneCommandID cmd=kBoneNOP)
std::vector< Polygon > Polygons
Swap render engine buffers.
Multiply a line vector by the directional vector.
PrimitiveVertices vertices
Set polygon to operate on.
void createGeometry(ParserContext &ctx)
Set default stack position for a polygon.
End marker for bone command list.
std::vector< PolygonCommand > PolygonCommands
Push current matrix onto stack.
Multiply a line vector by the clip matrix.
uint16 nodeStack
Matrix stack position this bone uses.
void load(Model_Sonic::ParserContext &ctx, Model_Sonic::Bone &bone)
std::map< uint8, bool > BoneInvisible
Bone * parent
Pointer to the parent bones.
A handle to an Aurora texture.
uint8 readInfoOffsetCount(ParserContext &ctx, Infos &infos, uint32 offset)
uint32 primitiveSize
Maximum length of a primitive from this polygon.
Connect bones, inherit child and parent stack.
bool wrapY
true: wrap, false: clamp.
Multiply current matrix by 3x3 values.
void readBoneCommands(ParserContext &ctx)
std::vector< uint32 > parameters
BoneCommands boneCommands
void readMaterials(ParserContext &ctx)
uint32 primitiveCount
Number of primitive this polygon produces.
ModelNode_Sonic(Model &model)
std::list< ModelNode_Sonic * > nodes
void render(RenderPass pass)
Render the object.
Info structure, specifies names and offsets of all kinds of lists in Nintendo files.
void readMaterialDefinition(ParserContext &ctx, Material &material, Info &info)
Load 4x4 values into current matrix.
Store current matrix onto stack.
Connect bones, set child and parent stack.
std::vector< Primitive > Primitives
ModelType
The display type of a model.
std::vector< PrimitiveVertex > PrimitiveVertices
Set specular reflection and emission colors.
uint8 readInfoOffset(ParserContext &ctx, Infos &infos, uint32 offset)
Test if box is inside view volume.
bool flipY
true: flip on every 2nd texture wrap.
void info(const char *s,...)
std::list< Bone * > BoneList
void readPolygonCommands(ParserContext &ctx, Polygon &polygon, uint32 listSize)
A node within a 3D model.
uint16 nodeID
ID of this bone.
BoneInvisible boneInvisible
Multiply current matrix by scale matrix.
Buffer containing vertex data.
Restore current matrix from stack.
Vertex XYZ, 10bit fixed-point.
void newState(ParserContext &ctx)
std::vector< uint16 > PrimitiveIndices
std::list< Bone * > children
Pointers to the child bones.
Load 4x3 values into current matrix.
std::vector< Material > Materials
Set current matrix to identity.
Vertex YZ, 16bit fixed-point, re-use X.
Multiply current matrix by 4x4 values.
bool flipX
true: flip on every 2nd texture wrap.
void addState(ParserContext &ctx)
StackMix(uint16 i=0xFFFF, uint16 s=0xFFFF, float r=0.0f)
Set diffuse and ambient reflection colors.
ParserContext(const Common::UString &name)
void readMaterialResource(ParserContext &ctx, uint textureOrPalette)
glm::mat4 transform
Complete local transformation this bone specifies.
void createPrimitives(ParserContext &ctx, Geometry &geometry, Polygon &polygon)
uint16 parentID
ID of parent bone.
ModelNode_Sonic * modelNode
Model node this bone represents.
std::vector< PrimitiveNode > PrimitiveNodes
void readModelHeader(ParserContext &ctx)
Set specular reflection shininess.
void createIndicesTriangleStrip(Primitive &primitive)
Intermediate structure to (re)create the VBO/IBO from.
Multiply current matrix by 4x3 values.
PrimitiveNode(const StackMix &mix)
static uint8 getBoneParameterCount(BoneCommandID cmd, uint8 count)
Return the number of parameters required for this bone command.
PrimitiveNode & operator=(const StackMix &mix)
Base class for Nitro (Nintendo DS) files.
void parseBoneCommands(ParserContext &ctx)
void load(ParserContext &ctx)
bool wrapX
true: wrap, false: clamp.
std::vector< StackMix > StackMixes
uint32 offsetBoneCommands
void createIndicesTriangles(Primitive &primitive)
void readPolygon(ParserContext &ctx, Polygon &polygon, Info &info)
std::list< BoneCommand > BoneCommands
Buffer containing indices data.
std::map< uint8, Bone * > StackBoneMap
void createAbsoluteBound()
Forward to ModelNode::createAbsoluteBound(), because we need this during the loading.
void createIndicesQuads(Primitive &primitive)
Common::UString texture
Name of texture within NSBTX.
void readPolygons(ParserContext &ctx)
void createModelNodes(ParserContext &ctx)
void findRootBones(ParserContext &ctx)
std::vector< Info > Infos
void readHeader(ParserContext &ctx)
std::vector< uint8 > parameters
std::map< uint32, StackMixes > StackMixMap
Common::UString palette
Name of palette within NSBTX.
Primitive(PrimitiveType t=kPrimitiveTypeTriangles)
PrimitiveNode(ModelNode_Sonic *n=0, float r=0.0f)
Multiply current matrix by translation matrix.
Model_Sonic(const Common::UString &name, ModelType type=kModelTypeObject)
void readModel(ParserContext &ctx)
static glm::mat4 createPivot(double a, double b, uint8 select, uint8 negate)
Create a specific pivot matrix.
static uint8 getPolygonParameterCount(PolygonCommandID cmd)
Return the number of parameters required for this geometry command.
Vertex XYZ delta, 10bit fixed-point.
const Material * material