3#include <glm/mat4x4.hpp>
4#include <glm/ext/quaternion_float.hpp>
53 const uint32_t HeaderMagic = 0xC065C065;
54 const uint32_t Version = 5;
55 const size_t CogsSectionAlignment = 16;
62 uint32_t sectionCount;
65 static_assert(
sizeof(
Header) == 4 * 8);
67 enum struct Compression : uint32_t
73 enum struct SectionType : uint16_t
78 ENABLE_ENUM_FLAGS(SectionType);
84 uint64_t uncompressedSize;
85 Compression compression;
87 uint16_t subSectionCount;
91 enum struct SubSectionType: uint32_t
125 enum struct Format : uint16_t {
211 enum struct DataFormatV4 : uint16_t
292 R10G10B10A2_TYPELESS,
303 static_assert(
static_cast<int>(DataFormatV4::Format_Size) == 88);
305 enum struct DataFormatV5 : uint16_t
384 BC6H_SIGNED_FLOAT_RGB,
385 BC6H_UNSIGNED_FLOAT_RGB,
388 PVRTC1_2BPP_UNORM_RGB,
389 PVRTC1_4BPP_UNORM_RGB,
390 PVRTC1_2BPP_UNORM_RGBA,
391 PVRTC1_4BPP_UNORM_RGBA,
392 EAC_BLOCK8_UNSIGNED_FLOAT_R,
393 EAC_BLOCK8_SIGNED_FLOAT_R,
394 EAC_BLOCK16_UNSIGNED_FLOAT_RG,
395 EAC_BLOCK16_SIGNED_FLOAT_RG,
396 ETC2_BLOCK8_UNORM_RGB,
397 ETC2_BLOCK8_UNORM_SRGB,
398 ETC2_BLOCK16_UNORM_RGBA,
399 ETC2_BLOCK16_UNORM_SRGBA,
408 ASTC_10x5_UNORM_RGBA,
409 ASTC_10x6_UNORM_RGBA,
410 ASTC_10x8_UNORM_RGBA,
411 ASTC_10x10_UNORM_RGBA,
412 ASTC_12x10_UNORM_RGBA,
413 ASTC_12x12_UNORM_RGBA,
414 ASTC_4x4_UNORM_SRGBA,
415 ASTC_5x4_UNORM_SRGBA,
416 ASTC_5x5_UNORM_SRGBA,
417 ASTC_6x5_UNORM_SRGBA,
418 ASTC_6x6_UNORM_SRGBA,
419 ASTC_8x5_UNORM_SRGBA,
420 ASTC_8x6_UNORM_SRGBA,
421 ASTC_8x8_UNORM_SRGBA,
422 ASTC_10x5_UNORM_SRGBA,
423 ASTC_10x6_UNORM_SRGBA,
424 ASTC_10x8_UNORM_SRGBA,
425 ASTC_10x10_UNORM_SRGBA,
426 ASTC_12x10_UNORM_SRGBA,
427 ASTC_12x12_UNORM_SRGBA,
430 R10G10B10A2_TYPELESS,
441 static_assert(
static_cast<int>(DataFormatV5::Format_Size) == 132);
443 enum struct MeshFlags : uint8_t
449 ENABLE_ENUM_FLAGS(MeshFlags);
451 enum struct PrimitiveType : uint8_t
459 TriangleListAdjacency = 5,
460 TriangleStripAdjacency = 6,
461 LineListAdjacency = 7,
462 LineStripAdjacency = 8,
463 ControlPoint1PatchList = 9,
464 ControlPoint2PatchList = 10,
465 ControlPoint3PatchList = 11,
466 ControlPoint4PatchList = 12,
470 enum struct Semantic : uint8_t
482 enum struct InputType : uint8_t
502 enum struct BufferContentFlags : uint32_t
511 ENABLE_ENUM_FLAGS(BufferContentFlags);
520 static_assert(
sizeof(
Buffer) == 2 * 8);
527 uint8_t semanticIndex;
528 uint16_t instanceStepRate;
537 uint32_t firstAttribute;
538 uint32_t attributeCount;
540 uint8_t vertexDataType;
552 PrimitiveType primitiveType;
554 static_assert(
sizeof(
Mesh) == 4 * 4);
563 uint32_t depthStride;
565 static_assert(
sizeof(
Level) == 4 * 4);
567 enum struct TextureAddressMode : uint8_t
576 enum struct TextureFilterMode : uint8_t
580 ComparisonMinMagMipPoint,
581 ComparisonMinMagMipLinear,
585 enum struct TextureComparisonFunction : uint8_t
613 enum struct TextureEncoding : uint8_t
625 enum struct TextureDimensions : uint8_t
653 uint32_t samplerState;
655 TextureEncoding encoding;
657 TextureDimensions dimension;
664 uint32_t samplerState;
668 enum struct PropertyKeyType : uint16_t
675 enum struct PropertyValueType : uint16_t
692 PropertyKeyType keyType;
693 PropertyValueType valueType;
697 static_assert(
alignof(
Property) == 4);
712 for (
const float& f : m) {
718 static_assert(
sizeof(
Transform) == 6 * 8);
721 enum struct BoneFlags : uint16_t
728 ENABLE_ENUM_FLAGS(BoneFlags);
732 glm::mat4 inverseBindPose;
741 static_assert(
sizeof(
Bone) == 44 * 4);
754 uint32_t translationOffset;
755 uint32_t translationCount;
756 uint32_t rotationOffset;
757 uint32_t rotationCount;
758 uint32_t scaleOffset;
761 static_assert(
sizeof(
AnimTrack) == 8 * 4);
788 uint32_t animClipFirst;
789 uint32_t animClipCount;
Contains the Engine, Renderer, resource managers and other systems needed to run Cogs....
@ Normal
Regular shaded rendering.
constexpr size_t hash() noexcept
Simple getter function that returns the initial value for fnv1a hashing.
uint32_t name
Offset into strings subsection of current section.
uint32_t boneIndex
Which bone to animate.
uint32_t buffer
Offset into bones array.
uint32_t name
Offset into strings subsection of current section.
uint16_t parentBone
Offset of within range of bones of this skeleton.
BufferContentFlags flags
Specifies what kind of data present in the buffer.
uint32_t size
Size of buffer, in bytes.
uint64_t sectionOffset
Raw section pointer: Upper 16 bits is section id, lower 48 is offset inside that section.
uint32_t size
Byte size of image data.
uint32_t offset
Byte offset within buffer for start of imagte data.
uint32_t buffer
Buffer that holds image data, index into buffers.
uint32_t bufferView
Index of buffer view with data.
uint32_t material
Name of material. Offset into strings subsection of current section.
uint32_t propertyCount
Number of properties set in material instance.
uint32_t permutation
String with permuation name. Offset into strings subsection of current section.
uint32_t propertyFirst
Offset into Properties subsection of current section.
uint32_t name
Index of string with name.
uint32_t boundingBox
Index of bounding box.
uint32_t firstStream
Index of first stream of mesh.
uint32_t nodeCount
Number of nodes in model.
uint32_t skeleton
Offset into the Skeleton subsection of current section.
uint32_t firstNode
Offset of first node into Nodes subsection of current section.
PrimitiveType primitiveType
Primitive type to use for this node.
uint32_t name
Name of node, offset into Strings subsection.
uint32_t vertexFirst
First vertex of mesh to draw.
uint32_t boundingBox
Bounding box of node, offset into BoundingBoxes subsection.
uint32_t materialInstance
Material instance of node, offset into MaterialInstances subsection.
uint32_t mesh
Mesh of node, offset into Meshes subsection.
uint32_t vertexCount
Number of vertices to draw.
uint32_t parent
Parent node, offset into Nodes subsection.
uint32_t transform
Transform of node, offset into Transforms subsection.
TextureAddressMode addressModeW
Specifies the addressing mode along the W axis in texture coordinate space.
TextureFilterMode filter
Specifies the filter to use for texture sampling.
float borderColor[4]
Specifies the border color to apply if the addressing mode is Border and texture coordinates are outs...
TextureAddressMode addressModeS
Specifies the addressing mode along the S axis in texture coordinate space.
uint32_t maxAnisotropy
Specifies the maximum number of anisotropic samples to use when sampling a texture.
TextureComparisonFunction comparisonFunction
Specifies the comparison function to use when applying a comparison sampler.
TextureAddressMode addressModeT
Specifies the addressing mode along the T axis in texture coordinate space.
uint32_t firstBone
Offset into Bones subsection of current section.
uint32_t boneCount
Number of bones in skeleton.
Texture flags describing valid usage for a texture object.