Skip to content

Commit 7e8ffbb

Browse files
authored
Merge pull request #61 from ovalnine/master
Add draw-point-3d function
2 parents 0d66827 + 8479675 commit 7e8ffbb

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

api.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@
295295

296296
// Basic geometric 3D shapes drawing functions
297297
[x] void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color)
298+
[x] void DrawPoint3D(Vector3 position, Color color)
298299
[x] void DrawCircle3D(Vector3 center, float radius, Vector3 rotationAxis, float rotationAngle, Color color)
299300
[x] void DrawTriangle3D(Vector3 v1, Vector3 v2, Vector3 v3, Color color)
300301
[x] void DrawTriangleStrip3D(Vector3 *points, int pointCount, Color color)

src/3d.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ static Janet cfun_DrawLine3D(int32_t argc, Janet *argv) {
77
return janet_wrap_nil();
88
}
99

10+
static Janet cfun_DrawPoint3D(int32_t argc, Janet *argv) {
11+
janet_fixarity(argc, 2);
12+
Vector3 pos = jaylib_getvec3(argv, 0);
13+
Color color = jaylib_getcolor(argv, 1);
14+
DrawPoint3D(pos, color);
15+
return janet_wrap_nil();
16+
}
17+
1018
static Janet cfun_DrawCircle3D(int32_t argc, Janet *argv) {
1119
janet_fixarity(argc, 5);
1220
Vector3 center = jaylib_getvec3(argv, 0);
@@ -701,6 +709,10 @@ static JanetReg threed_cfuns[] = {
701709
"(draw-line-3d [start-x start-y start-z] [end-x end-y end-z] color)\n\n"
702710
"Draw a line in 3D world space"
703711
},
712+
{"draw-point-3d", cfun_DrawPoint3D,
713+
"(draw-point-3d [center-x center-y center-z] color)\n\n"
714+
"Draw a point in 3D space, actually a small line"
715+
},
704716
{"draw-circle-3d", cfun_DrawCircle3D,
705717
"(draw-circle-3d [center-x center-y center-z] radius [rot-x rot-y rot-z] rotation-angle color)\n\n"
706718
"Draw a circle in 3D world space"

0 commit comments

Comments
 (0)