11/* *
2- * @file ParticleAPI.h
2+ * @file ParticlePTAPI_h
33 * @author OEOTYAN (https://github.com/OEOTYAN)
44 * @brief Spawn Particles for Client User Interface
55 *
88 */
99#pragma once
1010#include " mc/deps/core/mce/Color.h"
11+ #include " mc/math/Vec3.h"
12+ #include " mc/world/level/BlockPos.h"
13+ #include " mc/world/level/levelgen/structure/BoundingBox.h"
14+ #include " mc/world/phys/AABB.h"
15+
16+
17+ #ifdef PARTICLEAPI_EXPORTS
18+ #define PARTICLE_API __declspec (dllexport)
19+ #else
20+ #define PARTICLE_API __declspec (dllimport)
21+ #endif
1122
1223class ParticleCUI {
1324public:
25+ unsigned int displayRadius;
26+ bool highDetial;
27+ bool doubleSide;
28+ ParticleCUI () : displayRadius(UINT_MAX), highDetial(true ), doubleSide(true ) {}
29+ explicit ParticleCUI (unsigned int dr, bool hd = true , bool ds = true )
30+ : displayRadius(dr),
31+ highDetial(hd),
32+ doubleSide(ds) {}
1433 enum Direction : char {
1534 NEG_Y = 0 ,
1635 POS_Y = 1 ,
@@ -71,26 +90,114 @@ class ParticleCUI {
7190 PINK,
7291 FAWN,
7392 };
93+ PARTICLE_API void spawnParticle (Vec3 const & pos, std::string const & particleName, int dimId);
94+
95+ PARTICLE_API void drawPoint (
96+ Vec3 const & pos,
97+ int dimId,
98+ enum PointSize lineWidth = PointSize::PX4,
99+ enum class ParticleCUI ::ColorPalette color = ParticleCUI::ColorPalette::WHITE
100+ );
101+ PARTICLE_API void drawNumber (
102+ Vec3 const & pos,
103+ int dimId,
104+ enum NumType num = NumType::NUM0,
105+ enum class ParticleCUI ::ColorPalette color = ParticleCUI::ColorPalette::WHITE
106+ );
107+ PARTICLE_API void drawAxialLine (
108+ const Vec3& originPoint,
109+ enum Direction direction,
110+ double length,
111+ int dimId,
112+ enum class ParticleCUI ::ColorPalette color = ParticleCUI::ColorPalette::WHITE
113+ );
114+ PARTICLE_API void drawOrientedLine (
115+ const Vec3& start,
116+ const Vec3& end,
117+ int dimId,
118+ enum PointSize lineWidth = PointSize::PX4,
119+ double minSpacing = 1 ,
120+ int maxParticlesNum = 64 ,
121+ enum class ParticleCUI ::ColorPalette color = ParticleCUI::ColorPalette::WHITE
122+ );
123+ PARTICLE_API void drawCuboid (
124+ const AABB& aabb,
125+ int dimId,
126+ enum class ParticleCUI ::ColorPalette color = ParticleCUI::ColorPalette::WHITE
127+ );
128+ PARTICLE_API void drawCircle (
129+ const Vec3& originPoint,
130+ enum Direction facing,
131+ double radius,
132+ int dimId,
133+ enum PointSize lineWidth = PointSize::PX4,
134+ double minSpacing = 1 ,
135+ int maxParticlesNum = 64 ,
136+ enum class ParticleCUI ::ColorPalette color = ParticleCUI::ColorPalette::WHITE
137+ );
138+ void inline spawnParticle (BlockPos const & pos, std::string const & particleName, int dimId) {
139+ spawnParticle (pos + 0 .5f , particleName, dimId);
140+ }
141+ void inline drawPoint (
142+ BlockPos const & pos,
143+ int dimId,
144+ PointSize lineWidth,
145+ enum class ParticleCUI ::ColorPalette color
146+ ) {
147+ drawPoint (pos + 0 .5f , dimId, lineWidth, color);
148+ }
149+ void inline drawNumber (BlockPos const & pos, int dimId, NumType num, enum class ParticleCUI ::ColorPalette color) {
150+ drawNumber (pos + 0 .5f , dimId, num, color);
151+ }
152+ void inline drawOrientedLine (
153+ const BlockPos& start,
154+ const BlockPos& end,
155+ int dimId,
156+ PointSize lineWidth,
157+ double minSpacing,
158+ int maxParticlesNum,
159+ enum class ParticleCUI ::ColorPalette color
160+ ) {
161+ drawOrientedLine (start + 0 .5f , end + 0 .5f , dimId, lineWidth, minSpacing, maxParticlesNum, color);
162+ }
163+ void inline drawCuboid (const BoundingBox& box, int dimId, enum class ParticleCUI ::ColorPalette color) {
164+ drawCuboid (box, dimId, color);
165+ }
166+ void inline drawCuboid (const BlockPos& pos, int dimId, enum class ParticleCUI ::ColorPalette color) {
167+ drawCuboid (pos, dimId, color);
168+ }
169+ void inline drawCircle (
170+ const BlockPos& originPoint,
171+ Direction facing,
172+ double radius,
173+ int dimId,
174+ PointSize lineWidth,
175+ double minSpacing,
176+ int maxParticlesNum,
177+ enum class ParticleCUI ::ColorPalette color
178+ ) {
179+ drawCircle (originPoint + 0 .5f , facing, radius, dimId, lineWidth, minSpacing, maxParticlesNum, color);
180+ }
74181};
75182
76183extern " C" {
77- __declspec (dllexport
78- ) void PTAPI_spawnParticle(int displayRadius, class Vec3 const & pos, std::string const & particleName, int dimId);
79- __declspec (dllexport) void PTAPI_drawPoint(
184+ PARTICLE_API void
185+ PTAPI_spawnParticle (int displayRadius, class Vec3 const & pos, std::string const & particleName, int dimId);
186+ PARTICLE_API void PTAPI_drawPoint (
80187 int displayRadius,
81188 class Vec3 const & pos,
82189 int dimId,
83190 char lineWidth = ParticleCUI::PointSize::PX4,
84191 enum class ParticleCUI ::ColorPalette color = ParticleCUI::ColorPalette::WHITE
85192);
86- __declspec (dllexport) void PTAPI_drawNumber(
193+ PARTICLE_API void PTAPI_drawNumber (
87194 int displayRadius,
88195 class Vec3 const & pos,
89196 int dimId,
90197 char num = ParticleCUI::NumType::NUM0,
91198 enum class ParticleCUI ::ColorPalette color = ParticleCUI::ColorPalette::WHITE
92199);
93- __declspec (dllexport) void PTAPI_drawAxialLine(
200+ PARTICLE_API void PTAPI_drawAxialLine (
94201 int displayRadius,
95202 bool highDetial,
96203 bool doubleSide,
@@ -100,7 +207,7 @@ __declspec(dllexport) void PTAPI_drawAxialLine(
100207 int dimId,
101208 enum class ParticleCUI ::ColorPalette color = ParticleCUI::ColorPalette::WHITE
102209);
103- __declspec (dllexport) void PTAPI_drawOrientedLine(
210+ PARTICLE_API void PTAPI_drawOrientedLine (
104211 int displayRadius,
105212 const class Vec3 & start,
106213 const class Vec3 & end,
@@ -110,15 +217,15 @@ __declspec(dllexport) void PTAPI_drawOrientedLine(
110217 int maxParticlesNum = 64 ,
111218 enum class ParticleCUI ::ColorPalette color = ParticleCUI::ColorPalette::WHITE
112219);
113- __declspec (dllexport) void PTAPI_drawCuboid(
220+ PARTICLE_API void PTAPI_drawCuboid (
114221 int displayRadius,
115222 bool highDetial,
116223 bool doubleSide,
117224 const class AABB & aabb,
118225 int dimId,
119226 enum class ParticleCUI ::ColorPalette color = ParticleCUI::ColorPalette::WHITE
120227);
121- __declspec (dllexport) void PTAPI_drawCircle(
228+ PARTICLE_API void PTAPI_drawCircle (
122229 int displayRadius,
123230 const class Vec3 & originPoint,
124231 char facing,
0 commit comments