Cogs.Core
MaterialTypes.h
1#pragma once
2
3#include <string>
4
5#include "Base.h"
6
7namespace Cogs
8{
9 namespace Core
10 {
11 // Layout of this enum should be changed with care.
12 // Dependent on this layout:
13 // size_t DataTypeSizes[],
14 // const char * DataTypeNames[],
15 // Language APIs (JS++) to check validity when set/get Property.
16 // Inspectors for Material / MaterialProperty
17
20 {
21 Unknown = 0,
22 Float,
23 Float2,
24 Float3,
25 Float4,
26 Float4x4,
27 Float4Array,
28 Float4x4Array,
29 Int,
30 Int2,
31 Int3,
32 Int4,
33 UInt,
34 UInt2,
35 UInt3,
36 UInt4,
37 Bool,
38 Texture,
39 VFACE,
40 ClipDistance,
41 SV_IsFrontFace,
42 SV_InstanceID,
43 Position
44 };
45
46 static const size_t DataTypeSizes[] = {
47 0, // Unknown
48 4, // Float
49 8, // Float2
50 12, // Float3
51 16, // Float4
52 64, // Float4x4
53 16, // Float4Array
54 64, // float4x4Array
55 4, // Int
56 8, // Int2
57 12, // Int3
58 16, // Int4
59 4, // UInt
60 8, // Uint2
61 12, // Uint3
62 16, // Uint4
63 1, // Bool
64 0, // Texture
65 0, // VFACE
66 0, // ClipDistance
67 0, // SV_IsFrontFace
68 0, // SV_InstanceID
69 0 // Position
70 };
71 static_assert(std::size(DataTypeSizes) == (size_t(MaterialDataType::Position) + 1));
72
73 static const char * DataTypeNames[] = {
74 "Unknown",
75 "float",
76 "float2",
77 "float3",
78 "float4",
79 "float4x4",
80 "float4",
81 "float4x4",
82 "int",
83 "int2",
84 "int3",
85 "int4",
86 "uint",
87 "uint2",
88 "uint3",
89 "uint4",
90 "bool",
91 "texture",
92 "VFACE",
93 "SV_ClipDistance",
94 "SV_IsFrontFace",
95 "SV_InstanceID",
96 "Position"
97 };
98 static_assert(std::size(DataTypeNames) == (size_t(MaterialDataType::Position) + 1));
99
101 {
102 std::string name;
103 MaterialDataType type = MaterialDataType::Unknown;
104 size_t dimension = 0;
105 std::string dimensionString;
106 };
107 }
108}
MaterialDataType
Defines available data types for material properties.
Definition: MaterialTypes.h:20
Contains all Cogs related functionality.
Definition: FieldSetter.h:23
Texture resources contain raster bitmap data to use for texturing.
Definition: Texture.h:91