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