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