Changeset View
Changeset View
Standalone View
Standalone View
source/graphics/ModelDef.h
/* Copyright (C) 2021 Wildfire Games. | /* Copyright (C) 2022 Wildfire Games. | ||||
* This file is part of 0 A.D. | * This file is part of 0 A.D. | ||||
* | * | ||||
* 0 A.D. is free software: you can redistribute it and/or modify | * 0 A.D. is free software: you can redistribute it and/or modify | ||||
* it under the terms of the GNU General Public License as published by | * it under the terms of the GNU General Public License as published by | ||||
* the Free Software Foundation, either version 2 of the License, or | * the Free Software Foundation, either version 2 of the License, or | ||||
* (at your option) any later version. | * (at your option) any later version. | ||||
* | * | ||||
* 0 A.D. is distributed in the hope that it will be useful, | * 0 A.D. is distributed in the hope that it will be useful, | ||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||||
* GNU General Public License for more details. | * GNU General Public License for more details. | ||||
* | * | ||||
* You should have received a copy of the GNU General Public License | * You should have received a copy of the GNU General Public License | ||||
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>. | ||||
*/ | */ | ||||
/* | /* | ||||
* Defines a raw 3d model. | * Defines a raw 3d model. | ||||
*/ | */ | ||||
#ifndef INCLUDED_MODELDEF | #ifndef INCLUDED_MODELDEF | ||||
#define INCLUDED_MODELDEF | #define INCLUDED_MODELDEF | ||||
#include "graphics/PropPoint.h" | |||||
#include "maths/BoundingBoxAligned.h" | #include "maths/BoundingBoxAligned.h" | ||||
#include "maths/Matrix3D.h" | #include "maths/Matrix3D.h" | ||||
#include "maths/Quaternion.h" | #include "maths/Quaternion.h" | ||||
#include "maths/Vector2D.h" | #include "maths/Vector2D.h" | ||||
#include "maths/Vector3D.h" | #include "maths/Vector3D.h" | ||||
#include "lib/file/vfs/vfs_path.h" | #include "lib/file/vfs/vfs_path.h" | ||||
#include "ps/CStr.h" | #include "ps/CStr.h" | ||||
#include "renderer/VertexArray.h" | #include "renderer/VertexArray.h" | ||||
#include <cstring> | #include <cstring> | ||||
#include <map> | #include <map> | ||||
#include <unordered_map> | #include <unordered_map> | ||||
#include <vector> | #include <vector> | ||||
class CBoneState; | class CBoneState; | ||||
class CSkeletonAnimDef; | class CSkeletonAnimDef; | ||||
/** | |||||
* Describes the position of a prop point within its parent model. A prop point is the location within a parent model | |||||
* where the prop's origin will be attached. | |||||
* | |||||
* A prop point is specified by its transformation matrix (or separately by its position and rotation), which | |||||
* can be relative to either the parent model's origin, or one of the parent's bones. If the parent model is boned, | |||||
* then the @ref m_BoneIndex field may specify a bone to which the transformation matrix is relative (see | |||||
* @ref CModel::m_BoneMatrices). Otherwise, the transformation matrix is assumed to be relative to the parent model's | |||||
* origin. | |||||
* | |||||
* @see CModel::m_BoneMatrices | |||||
*/ | |||||
struct SPropPoint | |||||
{ | |||||
/// Name of the prop point | |||||
CStr m_Name; | |||||
/** | |||||
* Position of the point within the parent model, relative to either the parent model's origin or one of the parent | |||||
* model's bones if applicable. Also specified as part of @ref m_Transform. | |||||
* @see m_Transform | |||||
*/ | |||||
CVector3D m_Position; | |||||
/** | |||||
* Rotation of the prop model that will be attached at this point. Also specified as part of @ref m_Transform. | |||||
* @see m_Transform | |||||
*/ | |||||
CQuaternion m_Rotation; | |||||
/** | |||||
* Object to parent space transformation. Combines both @ref m_Position and @ref m_Rotation in a single | |||||
* transformation matrix. This transformation is relative to either the parent model's origin, or one of its | |||||
* bones, depending on whether it is skeletal. If relative to a bone, then the bone in the parent model to | |||||
* which this transformation is relative may be found by m_BoneIndex. | |||||
* @see m_Position, m_Rotation | |||||
*/ | |||||
CMatrix3D m_Transform; | |||||
/** | |||||
* Index of parent bone to which this prop point is relative, if any. The value 0xFF specifies that either the parent | |||||
* model is unboned, or that this prop point is relative to the parent model's origin rather than one if its bones. | |||||
*/ | |||||
u8 m_BoneIndex; | |||||
}; | |||||
/////////////////////////////////////////////////////////////////////////////// | /////////////////////////////////////////////////////////////////////////////// | ||||
// SVertexBlend: structure containing the necessary data for blending vertices | // SVertexBlend: structure containing the necessary data for blending vertices | ||||
// with multiple bones | // with multiple bones | ||||
struct SVertexBlend | struct SVertexBlend | ||||
{ | { | ||||
enum { SIZE = 4 }; | enum { SIZE = 4 }; | ||||
// index of the influencing bone, or 0xff if none | // index of the influencing bone, or 0xff if none | ||||
u8 m_Bone[SIZE]; | u8 m_Bone[SIZE]; | ||||
▲ Show 20 Lines • Show All 200 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator