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; }
19// clang-format on
20
21class Tessellator {
22public:
23 // Tessellator inner types declare
24 // clang-format off
26 // clang-format on
27
28 // Tessellator inner types define
29 enum class UploadMode : int {
30 Buffered = 0,
31 Manual = 1,
32 Never = 2,
33 };
34
35 enum class SupplementaryFieldAutoGenerationMode : int {
36 None = 0,
37 NormalsAndTangents = 1,
38 };
39
40 struct DebugContextCallback {};
41
42 using Index = uint;
43
44public:
45 // member variables
46 // NOLINTBEGIN
47 ::ll::TypedStorage<1, 1, bool> mIsFormatFixed;
48 ::ll::TypedStorage<8, 288, ::mce::MeshData> mMeshData;
49 ::ll::TypedStorage<1, 1, bool> mHasNormals;
50 ::ll::TypedStorage<8, 8, uint64> mNextReserve;
51 ::ll::TypedStorage<4, 20, ::std::optional<::glm::vec4>> mNextNormal;
52 ::ll::TypedStorage<4, 36, ::std::optional<::glm::vec2>[3]> mNextUV;
53 ::ll::TypedStorage<4, 8, ::std::optional<uint>> mNextColor;
54 ::ll::TypedStorage<2, 4, ::std::optional<ushort>> mNextBoneId;
55 ::ll::TypedStorage<2, 4, ::std::optional<ushort>> mNextPBRTextureIdx;
56 ::ll::TypedStorage<4, 8, ::std::optional<uint>> mNextMERS;
57 ::ll::TypedStorage<1, 1, bool> mIndexPhase;
58 ::ll::TypedStorage<4, 12, ::Vec3> mPostTransformOffset;
59 ::ll::TypedStorage<4, 12, ::Vec3> mPostTransformScale;
60 ::ll::TypedStorage<1, 1, uchar> mQuadFacing;
61 ::ll::TypedStorage<1, 1, bool> mQuadTwoSided;
62 ::ll::TypedStorage<8, 24, ::std::vector<::TessellatorQuadInfo>> mQuadInfoList;
63 ::ll::TypedStorage<4, 12, ::Vec3> mFaceCenterAccumulator;
64 ::ll::TypedStorage<4, 4, int> mCurQuadVertex;
65 ::ll::TypedStorage<1, 1, bool> mApplyTransform;
66 ::ll::TypedStorage<4, 64, ::glm::mat4x4> mTransformMatrix;
67 ::ll::TypedStorage<1, 1, bool> mNoColor;
68 ::ll::TypedStorage<1, 1, bool> mVoidBeginEnd;
69 ::ll::TypedStorage<1, 1, bool> mForceTessellateIntercept;
70 ::ll::TypedStorage<
71 8,
72 64,
73 ::std::function<void(::Tessellator const&, ::mce::MaterialPtr const&, ::mce::TexturePtr const&)>>
74 mInterceptTessellator;
75 ::ll::TypedStorage<4, 4, uint> mCount;
76 ::ll::TypedStorage<4, 4, uint> mMaxVertexCount;
77 ::ll::TypedStorage<1, 1, bool> mTessellating;
78 ::ll::TypedStorage<1, 1, bool> mBuildFaceData;
79 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::mce::Mesh>> mPreGeneratedMesh;
80 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::mce::BufferResourceService>> mBufferResourceService;
81 // NOLINTEND
82
83public:
84 // prevent constructor by default
85 Tessellator();
86
87public:
88 // member functions
89 // NOLINTBEGIN
90 MCAPI explicit Tessellator(::std::weak_ptr<::mce::BufferResourceService> bufferResourceService);
91
92 MCAPI void _tex(::Vec2 const& coord, int unit);
93
94 MCAPI void addPostTransformOffset(float x, float y, float z);
95
96 MCAPI void
97 begin(::Tessellator::DebugContextCallback debugContextCallback, int reservedVertices, bool buildFaceData);
98
99 MCAPI void begin(
100 ::Tessellator::DebugContextCallback debugContextCallback,
101 ::mce::PrimitiveMode mode,
102 int reservedVertices,
103 bool buildFaceData
104 );
105
106 MCAPI void clear();
107
108 MCAPI void color(::mce::Color const& c);
109
110 MCAPI void color(float r, float g, float b, float a);
111
112 MCAPI ::mce::Mesh
113 end(::Tessellator::UploadMode uploadMode,
114 ::std::string_view debugName,
115 ::Tessellator::SupplementaryFieldAutoGenerationMode supplementaryFieldGenerationMode);
116
117 MCAPI void normal(float x, float y, float z, float w);
118
119 MCAPI void postTransformScale(::Vec3 const& scale);
120
121 MCAPI void quad(uint i1, uint i2, uint i3, uint i4);
122
123 MCAPI void resetTransform(bool setToIdentity);
124
125 MCAPI void rotateAroundPivot(::Vec3 const& pivotOffset, float angle, ::Vec3 const& rotationAxis, bool preTransform);
126
127 MCAPI void simpleQuad(
128 ::Vec3 const& pos0,
129 ::Vec2 const& uv0,
130 ::Vec3 const& pos1,
131 ::Vec2 const& uv1,
132 ::Vec3 const& pos2,
133 ::Vec2 const& uv2,
134 ::Vec3 const& pos3,
135 ::Vec2 const& uv3
136 );
137
138 MCAPI void tex1(::Vec2 const& v);
139
140 MCAPI void triggerIntercept(::mce::MaterialPtr const& material, ::mce::TexturePtr const& texture);
141
142 MCAPI void trim();
143
144 MCAPI void vertex(float x, float y, float z);
145
146 MCAPI void vertexUV(float x, float y, float z, float u, float v);
147
148 MCAPI ~Tessellator();
149 // NOLINTEND
150
151public:
152 // constructor thunks
153 // NOLINTBEGIN
154 MCAPI void* $ctor(::std::weak_ptr<::mce::BufferResourceService> bufferResourceService);
155 // NOLINTEND
156
157public:
158 // destructor thunk
159 // NOLINTBEGIN
160 MCAPI void $dtor();
161 // NOLINTEND
162};
Definition Tessellator.h:5
Definition Vec2.h:5
Definition Color.h:13
Definition MaterialPtr.h:15
Definition Mesh.h:7
Definition TexturePtr.h:19
Definition TessellatorQuadInfo.h:5
Definition Tessellator.h:17
Definition BufferResourceService.h:7