LeviLamina
Loading...
Searching...
No Matches
Tessellator.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/math/Vec3.h"
7#include "mc/deps/core_graphics/enums/PrimitiveMode.h"
8#include "mc/deps/minecraft_renderer/renderer/MeshData.h"
9
10// auto generated forward declare list
11// clang-format off
12class Vec2;
14namespace mce { class Color; }
15namespace mce { class MaterialPtr; }
16namespace mce { class Mesh; }
17namespace mce { class TexturePtr; }
18namespace mce { struct BufferResourceService; }
19namespace mce { struct MeshDataVertexFieldCounts; }
20namespace mce::framebuilder { struct FrameLightingModelCapabilities; }
21// clang-format on
22
23class Tessellator {
24public:
25 // Tessellator inner types declare
26 // clang-format off
28 // clang-format on
29
30 // Tessellator inner types define
31 enum class UploadMode : int {
32 Buffered = 0,
33 Manual = 1,
34 Never = 2,
35 };
36
37 enum class SupplementaryFieldAutoGenerationMode : int {
38 None = 0,
39 NormalsAndTangents = 1,
40 };
41
42 struct DebugContextCallback {};
43
44 using Index = uint;
45
46public:
47 // member variables
48 // NOLINTBEGIN
49 ::ll::TypedStorage<1, 1, bool> mIsFormatFixed;
50 ::ll::TypedStorage<8, 312, ::mce::MeshData> mMeshData;
51 ::ll::TypedStorage<1, 1, bool> mHasNormals;
52 ::ll::TypedStorage<8, 8, uint64> mNextReserve;
53 ::ll::TypedStorage<4, 20, ::std::optional<::glm::vec4>> mNextNormal;
54 ::ll::TypedStorage<4, 36, ::std::optional<::glm::vec2>[3]> mNextUV;
55 ::ll::TypedStorage<4, 8, ::std::optional<uint>> mNextColor;
56 ::ll::TypedStorage<2, 4, ::std::optional<ushort>> mNextBoneId;
57 ::ll::TypedStorage<2, 4, ::std::optional<ushort>> mNextPBRTextureIdx;
58 ::ll::TypedStorage<4, 8, ::std::optional<uint>> mNextMERS;
59 ::ll::TypedStorage<1, 2, ::std::optional<uchar>> mNextGeoType;
60 ::ll::TypedStorage<1, 1, bool> mIndexPhase;
61 ::ll::TypedStorage<4, 12, ::Vec3> mPostTransformOffset;
62 ::ll::TypedStorage<4, 12, ::Vec3> mPostTransformScale;
63 ::ll::TypedStorage<1, 1, uchar> mQuadFacing;
64 ::ll::TypedStorage<1, 1, bool> mQuadTwoSided;
65 ::ll::TypedStorage<8, 24, ::std::vector<::TessellatorQuadInfo>> mQuadInfoList;
66 ::ll::TypedStorage<4, 12, ::Vec3> mFaceCenterAccumulator;
67 ::ll::TypedStorage<4, 4, int> mCurQuadVertex;
68 ::ll::TypedStorage<1, 1, bool> mApplyTransform;
69 ::ll::TypedStorage<4, 64, ::glm::mat4x4> mTransformMatrix;
70 ::ll::TypedStorage<1, 1, bool> mNoColor;
71 ::ll::TypedStorage<1, 1, bool> mVoidBeginEnd;
72 ::ll::TypedStorage<1, 1, bool> mForceTessellateIntercept;
73 ::ll::TypedStorage<
74 8,
75 64,
76 ::std::function<void(::Tessellator const&, ::mce::MaterialPtr const&, ::mce::TexturePtr const&)>>
77 mInterceptTessellator;
78 ::ll::TypedStorage<4, 4, uint> mCount;
79 ::ll::TypedStorage<4, 4, uint> mMaxVertexCount;
80 ::ll::TypedStorage<1, 1, bool> mTessellating;
81 ::ll::TypedStorage<1, 1, bool> mBuildFaceData;
82 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::mce::Mesh>> mPreGeneratedMesh;
83 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::mce::BufferResourceService>> mBufferResourceService;
84 // NOLINTEND
85
86public:
87 // prevent constructor by default
88 Tessellator();
89
90public:
91 // member functions
92 // NOLINTBEGIN
93 MCAPI explicit Tessellator(::std::weak_ptr<::mce::BufferResourceService> bufferResourceService);
94
95 MCAPI void addPostTransformOffset(::Vec3 const& v);
96
97 MCAPI void addPostTransformOffset(float x, float y, float z);
98
99 MCAPI void addRotation(float angle, ::Vec3 const& axis);
100
101 MCAPI void addTranslation(::Vec3 const& offset);
102
103 MCAPI void applyDefaultTransform();
104
105 MCAPI void
106 begin(::Tessellator::DebugContextCallback debugContextCallback, int reservedVertices, bool buildFaceData);
107
108 MCAPI void
109 begin(::Tessellator::DebugContextCallback mode, ::mce::PrimitiveMode reservedVertices, int buildFaceData, bool);
110
111 MCAPI void beginIndices(uint64 estimateCount);
112
113 MCAPI void beginOverride(::Tessellator::DebugContextCallback debugContextCallback);
114
115 MCAPI void bone0(ushort index);
116
117 MCAPI void cancel();
118
119 MCAPI void clear();
120
121 MCAPI void color(::mce::Color const& c);
122
123 MCAPI void color(int c);
124
125 MCAPI void color(float r, float g, float b, float a);
126
127 MCAPI void colorABGR(int c);
128
129 MCAPI ::mce::Mesh
130 end(::std::string_view debugName,
131 ::Tessellator::SupplementaryFieldAutoGenerationMode supplementaryFieldGenerationMode);
132
133 MCAPI ::mce::Mesh
134 end(::Tessellator::UploadMode uploadMode,
135 ::std::string_view debugName,
136 ::Tessellator::SupplementaryFieldAutoGenerationMode supplementaryFieldGenerationMode);
137
138 MCAPI ::mce::Mesh endOverride(
139 ::std::string_view debugName,
140 ::Tessellator::SupplementaryFieldAutoGenerationMode supplementaryFieldGenerationMode
141 );
142
143 MCAPI bool forceTessellateIntercept() const;
144
145 MCFOLD bool getHasNormals();
146
147 MCAPI ::Vec3 const& getPostTransformOffset() const;
148
149 MCAPI ::glm::mat4x4 const& getTransformMatrix() const;
150
151 MCAPI ::mce::MeshDataVertexFieldCounts getVertexFieldCount() const;
152
153 MCAPI bool isOverridden();
154
155 MCAPI bool isTessellating() const;
156
157 MCAPI void mers(float metallic, float emissive, float roughness, float subsurface);
158
159 MCAPI void noColor();
160
161 MCAPI void normal(::Vec3 const& n, float w);
162
163 MCAPI void normal(float x, float y, float z, float w);
164
165 MCAPI void pbrTextureIdx(ushort const& pbrTextureDataHandle);
166
167 MCAPI void postTransformScale(::Vec3 const& scale);
168
169 MCAPI void quad(uint i1, uint i2, uint i3, uint i4);
170
171 MCAPI void reserveDeferredVertices(uint64 count);
172
173 MCAPI void resetPostTransformScale();
174
175 MCAPI void resetTessellateIntercept();
176
177 MCAPI void resetTransform(bool setToIdentity);
178
179 MCAPI void rotateAroundPivot(::Vec3 const& pivotOffset, float angle, ::Vec3 const& rotationAxis, bool preTransform);
180
181 MCAPI void setHasNormals(bool hasNormal);
182
183 MCAPI void setPostTransformOffset(::Vec3 const& v);
184
185 MCAPI void setPostTransformOffset(float xo, float yo, float zo);
186
187 MCAPI void setQuadFacingID(uchar facing);
188
189 MCAPI void setQuadTwoSided(bool twoSided);
190
191 MCAPI void setScaleTransform(::Vec3 const& scale);
192
193 MCAPI void setTessellateIntercept(
194 ::std::function<void(::Tessellator const&, ::mce::MaterialPtr const&, ::mce::TexturePtr const&)> callback
195 );
196
197 MCAPI bool shouldApplyTransform() const;
198
199 MCAPI void simpleQuad(
200 ::Vec3 const& pos0,
201 ::Vec2 const& uv0,
202 ::Vec3 const& pos1,
203 ::Vec2 const& uv1,
204 ::Vec3 const& pos2,
205 ::Vec2 const& uv2,
206 ::Vec3 const& pos3,
207 ::Vec2 const& uv3
208 );
209
210 MCAPI void tex(::Vec2 const& v);
211
212 MCAPI void tex(float u, float v);
213
214 MCAPI void tex1(::Vec2 const& v);
215
216 MCAPI void tex2(::Vec2 const& v);
217
218 MCAPI void triangle(uint i1, uint i2, uint i3);
219
220 MCAPI void triggerIntercept(::mce::MaterialPtr const& material, ::mce::TexturePtr const& texture);
221
222 MCAPI void trim();
223
224 MCAPI void vertex(::Vec3 const& pos);
225
226 MCAPI void vertex(float x, float y, float z);
227
228 MCAPI void vertexUV(::Vec3 const& pos, ::Vec2 const& uv);
229
230 MCAPI void vertexUV(::Vec3 const& pos, float u, float v);
231
232 MCAPI void vertexUV(float x, float y, float z, float u, float v);
233
234 MCAPI ~Tessellator();
235 // NOLINTEND
236
237public:
238 // static functions
239 // NOLINTBEGIN
240 MCFOLD static ::Tessellator::SupplementaryFieldAutoGenerationMode
241 selectFieldAutoGenerationMode(::mce::framebuilder::FrameLightingModelCapabilities const& lightingModelCaps);
242 // NOLINTEND
243
244public:
245 // constructor thunks
246 // NOLINTBEGIN
247 MCAPI void* $ctor(::std::weak_ptr<::mce::BufferResourceService> bufferResourceService);
248 // NOLINTEND
249
250public:
251 // destructor thunk
252 // NOLINTBEGIN
253 MCAPI void $dtor();
254 // NOLINTEND
255};
Definition Tessellator.h:5
Definition Vec2.h:5
Definition Color.h:13
Definition MaterialPtr.h:15
Definition Mesh.h:7
Definition TexturePtr.h:7
Definition TessellatorQuadInfo.h:5
Definition Tessellator.h:17
Definition BufferResourceService.h:7
Definition MeshDataVertexFieldCounts.h:7
Definition FrameLightingModelCapabilities.h:7