Skip to content

Instantly share code, notes, and snippets.

@twist84
Created November 16, 2017 19:43
Show Gist options
  • Save twist84/292ef5d40f1d94e14175bb221f14afc4 to your computer and use it in GitHub Desktop.
Save twist84/292ef5d40f1d94e14175bb221f14afc4 to your computer and use it in GitHub Desktop.
RenderModel `mode` definition for ElDewrito
#pragma once
#include "../Tags.hpp"
#include "../../Text/StringID.hpp"
#include "../../Math/Bounds.hpp"
#include "../../Math/RealPlane3D.hpp"
#include "../../Math/RealPoint3D.hpp"
#include "../../Math/RealQuaternion.hpp"
#include "../../Math/RealVector3D.hpp"
namespace Blam::Tags::Models
{
struct RenderModel : TagGroup<'mode'>
{
enum class FlagsValues : uint16_t;
struct RegionsBlock;
struct InstancesBlock;
struct NodesBlock;
struct MarkerGroupsBlock;
struct MaterialsBlock;
struct MeshesBlock;
struct CompressionInfoBlock;
struct BoundingSpheresBlock;
struct UnknownBlock;
struct UnknownMeshesBlock;
struct NodeMapsBlock;
struct UnknownBlock2;
struct UnknownYoBlock;
struct UnknownBlock3;
struct UnknownBlock4;
struct NewNodesBlock;
Text::StringID Name;
RenderModel::FlagsValues FlagsValue : 16;
int16_t Unknown;
int32_t ModelChecksum;
Tags::TagBlock<RenderModel::RegionsBlock> Regions;
int32_t Unknown2;
int32_t InstanceStartingMeshIndex;
Tags::TagBlock<RenderModel::InstancesBlock> Instances;
int32_t NodesChecksum;
Tags::TagBlock<RenderModel::NodesBlock> Nodes;
Tags::TagBlock<RenderModel::MarkerGroupsBlock> MarkerGroups;
Tags::TagBlock<RenderModel::MaterialsBlock> Materials;
int32_t Unknown4;
int32_t Unknown5;
int32_t Unknown6;
int32_t Unknown7;
int32_t Unknown8;
Tags::TagBlock<RenderModel::MeshesBlock> Meshes;
Tags::TagBlock<RenderModel::CompressionInfoBlock> CompressionInfo;
Tags::TagBlock<RenderModel::BoundingSpheresBlock> UnknownNodey;
Tags::TagBlock<RenderModel::UnknownBlock> Unknown9;
int32_t Unknown10;
int32_t Unknown11;
int32_t Unknown12;
Tags::TagBlock<RenderModel::UnknownMeshesBlock> UnknownMeshes;
Tags::TagBlock<RenderModel::NodeMapsBlock> NodeMaps;
Tags::TagBlock<RenderModel::UnknownBlock2> Unknown13;
int32_t Unknown14;
int32_t Unknown15;
int32_t Unknown16;
Tags::TagBlock<RenderModel::UnknownYoBlock> UnknownYo;
uint32_t ResourceReferenceAddress;
int32_t UselessPadding;
Tags::TagBlock<RenderModel::UnknownBlock3> Unknown17;
int32_t UnknownA;
int32_t UnknownA2;
int32_t UnknownA3;
int32_t UnknownA4;
int32_t UnknownA5;
int32_t UnknownA6;
int32_t UnknownA7;
int32_t UnknownA8;
int32_t UnknownA9;
int32_t UnknownA10;
int32_t UnknownA11;
int32_t UnknownA12;
int32_t UnknownA13;
int32_t UnknownA14;
int32_t UnknownA15;
int32_t UnknownA16;
int32_t UnknownB;
int32_t UnknownB2;
int32_t UnknownB3;
int32_t UnknownB4;
int32_t UnknownB5;
int32_t UnknownB6;
int32_t UnknownB7;
int32_t UnknownB8;
int32_t UnknownB9;
int32_t UnknownB10;
int32_t UnknownB11;
int32_t UnknownB12;
int32_t UnknownB13;
int32_t UnknownB14;
int32_t UnknownB15;
int32_t UnknownB16;
int32_t UnknownC;
int32_t UnknownC2;
int32_t UnknownC3;
int32_t UnknownC4;
int32_t UnknownC5;
int32_t UnknownC6;
int32_t UnknownC7;
int32_t UnknownC8;
int32_t UnknownC9;
int32_t UnknownC10;
int32_t UnknownC11;
int32_t UnknownC12;
int32_t UnknownC13;
int32_t UnknownC14;
int32_t UnknownC15;
int32_t UnknownC16;
Tags::TagBlock<RenderModel::UnknownBlock4> Unknown18;
Tags::TagBlock<RenderModel::NewNodesBlock> NewNodes;
int32_t Unknown19;
enum class RenderModel::FlagsValues : uint16_t
{
None,
Bit0 = 1 << 0,
Bit1 = 1 << 1,
ForceNodeMaps = 1 << 2,
Bit3 = 1 << 3,
Bit4 = 1 << 4,
Bit5 = 1 << 5,
Bit6 = 1 << 6,
Bit7 = 1 << 7,
Bit8 = 1 << 8,
Bit9 = 1 << 9,
Bit10 = 1 << 10,
Bit11 = 1 << 11,
Bit12 = 1 << 12,
Bit13 = 1 << 13,
Bit14 = 1 << 14,
Bit15 = 1 << 15
};
struct RenderModel::RegionsBlock
{
struct PermutationsBlock;
Text::StringID Name;
Tags::TagBlock<RenderModel::RegionsBlock::PermutationsBlock> Permutations;
struct RenderModel::RegionsBlock::PermutationsBlock
{
Text::StringID Name;
int16_t MeshIndex;
int16_t MeshCount;
int32_t Unknown;
int32_t Unknown2;
int32_t Unknown3;
int32_t Unknown4;
};
static_assert(sizeof(RenderModel::RegionsBlock::PermutationsBlock) == 0x18,
"RenderModel::RegionsBlock::PermutationsBlock");
};
static_assert(sizeof(RenderModel::RegionsBlock) == 0x10,
"RenderModel::RegionsBlock");
struct RenderModel::InstancesBlock
{
Text::StringID Name;
int32_t NodeIndex;
float DefaultScale;
Math::RealVector3D InverseForward;
Math::RealVector3D InverseLeft;
Math::RealVector3D InverseUp;
Math::RealPoint3D InversePosition;
};
static_assert(sizeof(RenderModel::InstancesBlock) == 0x3C,
"RenderModel::InstancesBlock");
struct RenderModel::NodesBlock
{
Text::StringID Name;
int16_t ParentNode;
int16_t FirstChildNode;
int16_t NextSiblingNode;
int16_t ImportNodeIndex;
Math::RealPoint3D DefaultTranslation;
Math::RealQuaternion DefaultRotation;
float DefaultScale;
Math::RealVector3D InverseForward;
Math::RealVector3D InverseLeft;
Math::RealVector3D InverseUp;
Math::RealPoint3D InversePosition;
float DistanceFromParent;
};
static_assert(sizeof(RenderModel::NodesBlock) == 0x60,
"RenderModel::NodesBlock");
struct RenderModel::MarkerGroupsBlock
{
struct Markers;
Text::StringID Name;
Tags::TagBlock<RenderModel::MarkerGroupsBlock::Markers> Unknown4;
struct RenderModel::MarkerGroupsBlock::Markers
{
int8_t Unknown;
int8_t Unknown1;
int8_t Unknown2;
int8_t Unknown3;
Math::RealPoint3D Translation;
Math::RealQuaternion Rotation;
float Scale;
};
static_assert(sizeof(RenderModel::MarkerGroupsBlock::Markers) == 0x24,
"RenderModel::MarkerGroupsBlock::Markers");
};
static_assert(sizeof(RenderModel::MarkerGroupsBlock) == 0x10,
"RenderModel::MarkerGroupsBlock");
struct RenderModel::MaterialsBlock
{
struct PropertiesBlock;
Tags::TagReference Shader;
Tags::TagBlock<RenderModel::MaterialsBlock::PropertiesBlock> Properties;
int32_t BreakableSurfaceIndex;
int8_t Unknown2;
int8_t Unknown3;
int8_t Unknown4;
int8_t RealValue;
struct RenderModel::MaterialsBlock::PropertiesBlock
{
int16_t Type;
int16_t IntValue;
int8_t Unknown;
int8_t Unknown2;
int8_t Unknown3;
int8_t Unknown4;
float RealValue;
};
static_assert(sizeof(RenderModel::MaterialsBlock::PropertiesBlock) == 0xC,
"RenderModel::MaterialsBlock::PropertiesBlock");
};
static_assert(sizeof(RenderModel::MaterialsBlock) == 0x24,
"RenderModel::MaterialsBlock");
struct RenderModel::MeshesBlock
{
struct PartsBlock;
struct SubpartsBlock;
enum class FlagsValues : uint8_t;
enum class VertexTypes : int8_t;
enum class PRTTypes : int8_t;
enum class IndexBufferTypes : int8_t;
struct InstancedGeometryIndicesBlock;
struct UnknownWaterBlock;
Tags::TagBlock<RenderModel::MeshesBlock::PartsBlock> Parts;
Tags::TagBlock<RenderModel::MeshesBlock::SubpartsBlock> Subparts;
int16_t VertexBufferIndex;
int16_t VertexBufferIndex2;
int16_t VertexBufferIndex3;
int16_t VertexBufferIndex4;
int16_t VertexBufferIndex5;
int16_t VertexBufferIndex6;
int16_t VertexBufferIndex7;
int16_t VertexBufferIndex8;
int16_t IndexBufferIndex;
int16_t IndexBufferIndex2;
RenderModel::MeshesBlock::FlagsValues FlagsValue;
int8_t RigidNode;
RenderModel::MeshesBlock::VertexTypes VertexType;
RenderModel::MeshesBlock::PRTTypes PRTType;
RenderModel::MeshesBlock::IndexBufferTypes IndexBufferType;
int8_t Unknown;
int8_t Unknown2;
int8_t Unknown3;
Tags::TagBlock<RenderModel::MeshesBlock::InstancedGeometryIndicesBlock> InstancedGeometryIndices;
Tags::TagBlock<RenderModel::MeshesBlock::UnknownWaterBlock> UnknownWater;
struct RenderModel::MeshesBlock::PartsBlock
{
enum class FlagsValues : uint8_t;
int16_t MaterialIndex;
int16_t UnknownNodeyIndex;
int16_t IndexBufferStart;
int16_t IndexBufferCount;
int16_t SubpartBufferStart;
int16_t SubpartBufferCount;
int8_t UnknownEnum;
RenderModel::MeshesBlock::PartsBlock::FlagsValues FlagsValue : 8;
int16_t VertexCount;
enum class RenderModel::MeshesBlock::PartsBlock::FlagsValues : uint8_t
{
None,
Bit0 = 1 << 0,
Bit1 = 1 << 1,
Bit2 = 1 << 2,
Water = 1 << 3,
Bit4 = 1 << 4,
Bit5 = 1 << 5,
Bit6 = 1 << 6,
Bit7 = 1 << 7
};
};
static_assert(sizeof(RenderModel::MeshesBlock::PartsBlock) == 0x10,
"RenderModel::MeshesBlock::PartsBlock");
struct RenderModel::MeshesBlock::SubpartsBlock
{
int16_t Unknown;
int16_t Unknown2;
int16_t Unknown3;
int16_t Unknown4;
};
static_assert(sizeof(RenderModel::MeshesBlock::SubpartsBlock) == 0x8,
"RenderModel::MeshesBlock::SubpartsBlock");
enum class RenderModel::MeshesBlock::FlagsValues : uint8_t
{
HasVertexColors,
Bit0 = 1 << 0,
Bit1 = 1 << 1,
Bit2 = 1 << 2,
Water = 1 << 3,
Bit4 = 1 << 4,
Bit5 = 1 << 5,
Bit6 = 1 << 6,
Bit7 = 1 << 7
};
enum class RenderModel::MeshesBlock::VertexTypes : int8_t
{
World,
Rigid,
Skinned,
ParticleModel,
FlatWorld,
FlatRigid,
FlatSkinned,
Screen,
Debug,
Transparent,
Particle,
Contrail,
LightVolume,
ChudSimple,
ChudFancy,
Decorator,
TinyPosition,
PatchyFog,
Water,
Ripple,
Implicit,
Beam
};
enum class RenderModel::MeshesBlock::PRTTypes : int8_t
{
None,
Ambient,
Linear,
Quadratic
};
enum class RenderModel::MeshesBlock::IndexBufferTypes : int8_t
{
PointList,
LineList,
LineStrip,
TriangeList,
TriangeFan,
TriangeStrip
};
struct RenderModel::MeshesBlock::InstancedGeometryIndicesBlock
{
struct MeshContentsBlock;
int16_t InstancedGeometryIndex;
int16_t InstancedGeometryIndex2;
Tags::TagBlock<RenderModel::MeshesBlock::InstancedGeometryIndicesBlock::MeshContentsBlock> InstancedGeometryIndices;
struct RenderModel::MeshesBlock::InstancedGeometryIndicesBlock::MeshContentsBlock
{
int16_t InstancedGeometryIndex;
};
static_assert(sizeof(RenderModel::MeshesBlock::InstancedGeometryIndicesBlock::MeshContentsBlock) == 0x2,
"RenderModel::MeshesBlock::InstancedGeometryIndicesBlock::MeshContentsBlock");
};
static_assert(sizeof(RenderModel::MeshesBlock::InstancedGeometryIndicesBlock) == 0x10,
"RenderModel::MeshesBlock::InstancedGeometryIndicesBlock");
struct RenderModel::MeshesBlock::UnknownWaterBlock
{
int16_t Unknown;
};
static_assert(sizeof(RenderModel::MeshesBlock::UnknownWaterBlock) == 0x2,
"RenderModel::MeshesBlock::UnknownWaterBlock");
};
static_assert(sizeof(RenderModel::MeshesBlock) == 0x4C,
"RenderModel::MeshesBlock");
struct RenderModel::CompressionInfoBlock
{
enum class GeometryCompressionFlags : uint16_t;
RenderModel::CompressionInfoBlock::GeometryCompressionFlags Flags;
int16_t Unknown2;
Math::Bounds<float> X;
Math::Bounds<float> Y;
Math::Bounds<float> Z;
Math::Bounds<float> U;
Math::Bounds<float> V;
enum class RenderModel::CompressionInfoBlock::GeometryCompressionFlags : uint16_t
{
None,
CompressedPosition = 1 << 0,
CompressedTexcoord = 1 << 1,
CompressionOptimized = 1 << 2
};
};
static_assert(sizeof(RenderModel::CompressionInfoBlock) == 0x2C,
"RenderModel::CompressionInfoBlock");
struct RenderModel::BoundingSpheresBlock
{
Math::RealPlane3D Plane;
Math::RealPoint3D Position;
float Radius;
int8_t NodeIndices[4];
float NodeWeights[3];
};
static_assert(sizeof(RenderModel::BoundingSpheresBlock) == 0x30,
"RenderModel::BoundingSpheresBlock");
struct RenderModel::UnknownBlock
{
int8_t UnknownByte;
int8_t UnknownByte2;
int16_t Unknown2;
Tags::TagData<byte> Unknown3;
};
static_assert(sizeof(RenderModel::UnknownBlock) == 0x18,
"RenderModel::UnknownBlock");
struct RenderModel::UnknownMeshesBlock
{
struct UnknownBlock;
Tags::TagData<byte> Unknown;
Tags::TagBlock<RenderModel::UnknownMeshesBlock::UnknownBlock> Unknown2;
struct RenderModel::UnknownMeshesBlock::UnknownBlock
{
int16_t Unknown;
};
static_assert(sizeof(RenderModel::UnknownMeshesBlock::UnknownBlock) == 0x2,
"RenderModel::UnknownMeshesBlock::UnknownBlock");
};
static_assert(sizeof(RenderModel::UnknownMeshesBlock) == 0x20,
"RenderModel::UnknownMeshesBlock");
struct RenderModel::NodeMapsBlock
{
struct NodeIndicesBlock;
Tags::TagBlock<RenderModel::NodeMapsBlock::NodeIndicesBlock> NodeIndices;
struct RenderModel::NodeMapsBlock::NodeIndicesBlock
{
uint8_t NodeIndex;
};
static_assert(sizeof(RenderModel::NodeMapsBlock::NodeIndicesBlock) == 0x1,
"RenderModel::NodeMapsBlock::NodeIndicesBlock");
};
static_assert(sizeof(RenderModel::NodeMapsBlock) == 0xC,
"RenderModel::NodeMapsBlock");
struct RenderModel::UnknownBlock2
{
int32_t Unknown;
int32_t Unknown2;
int32_t Unknown3;
int32_t Unknown4;
int32_t Unknown5;
int32_t Unknown6;
int32_t Unknown7;
int32_t Unknown8;
int32_t Unknown9;
int32_t Unknown10;
int32_t Unknown11;
int32_t Unknown12;
};
static_assert(sizeof(RenderModel::UnknownBlock2) == 0x30,
"RenderModel::UnknownBlock2");
struct RenderModel::UnknownYoBlock
{
int32_t Unknown;
int32_t Unknown2;
int32_t Unknown3;
int16_t Unknown4;
int16_t Unknown5;
};
static_assert(sizeof(RenderModel::UnknownYoBlock) == 0x10,
"RenderModel::UnknownYoBlock");
struct RenderModel::UnknownBlock3
{
int32_t Unknown;
int32_t Unknown2;
int32_t Unknown3;
int32_t Unknown4;
int32_t Unknown5;
int32_t Unknown6;
int32_t Unknown7;
};
static_assert(sizeof(RenderModel::UnknownBlock3) == 0x1C,
"RenderModel::UnknownBlock3");
struct RenderModel::UnknownBlock4
{
int32_t Unknown;
int32_t Unknown2;
int32_t Unknown3;
int32_t Unknown4;
int32_t Unknown5;
int32_t Unknown6;
int32_t Unknown7;
int32_t Unknown8;
int32_t Unknown9;
int32_t Unknown10;
int32_t Unknown11;
int32_t Unknown12;
int32_t Unknown13;
int32_t Unknown14;
int32_t Unknown15;
int32_t Unknown16;
int32_t Unknown17;
int32_t Unknown18;
int32_t Unknown19;
int32_t Unknown20;
int32_t Unknown21;
int32_t Unknown22;
int32_t Unknown23;
int32_t Unknown24;
int32_t Unknown25;
int32_t Unknown26;
int32_t Unknown27;
int32_t Unknown28;
int32_t Unknown29;
int32_t Unknown30;
int32_t Unknown31;
int32_t Unknown32;
int32_t Unknown33;
int32_t Unknown34;
int32_t Unknown35;
int32_t Unknown36;
int32_t Unknown37;
int32_t Unknown38;
int32_t Unknown39;
int32_t Unknown40;
int32_t Unknown41;
int32_t Unknown42;
int32_t Unknown43;
int32_t Unknown44;
int32_t Unknown45;
int32_t Unknown46;
int32_t Unknown47;
int32_t Unknown48;
int32_t Unknown49;
int32_t Unknown50;
int32_t Unknown51;
int32_t Unknown52;
int32_t Unknown53;
int32_t Unknown54;
int32_t Unknown55;
int32_t Unknown56;
int32_t Unknown57;
int32_t Unknown58;
int32_t Unknown59;
int32_t Unknown60;
int32_t Unknown61;
int32_t Unknown62;
int32_t Unknown63;
int32_t Unknown64;
int32_t Unknown65;
int32_t Unknown66;
int32_t Unknown67;
int32_t Unknown68;
int32_t Unknown69;
int32_t Unknown70;
int32_t Unknown71;
int32_t Unknown72;
int32_t Unknown73;
int32_t Unknown74;
int32_t Unknown75;
int32_t Unknown76;
int32_t Unknown77;
int32_t Unknown78;
int32_t Unknown79;
int32_t Unknown80;
int32_t Unknown81;
int32_t Unknown82;
int32_t Unknown83;
int32_t Unknown84;
int8_t Unknown85;
};
static_assert(sizeof(RenderModel::UnknownBlock4) == 0x154,
"RenderModel::UnknownBlock4");
struct RenderModel::NewNodesBlock
{
Math::RealQuaternion DefaultRotation;
Math::RealPoint3D DefaultTranslation;
float DefaultScale;
};
static_assert(sizeof(RenderModel::NewNodesBlock) == 0x20,
"RenderModel::NewNodesBlock");
};
static_assert(sizeof(RenderModel) == 0x1D0,
"RenderModel");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment