-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplement most of the immediate mode operations in Draw, move it to
luajit_ffi_gen.
- Loading branch information
1 parent
8ebc864
commit 337dd10
Showing
12 changed files
with
793 additions
and
532 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
-- Draw ------------------------------------------------------------------------ | ||
local Loader = {} | ||
|
||
function Loader.declareType() | ||
return 0, 'Draw' | ||
end | ||
|
||
function Loader.defineType() | ||
local ffi = require('ffi') | ||
local libphx = require('libphx').lib | ||
local Draw | ||
|
||
do -- C Definitions | ||
ffi.cdef [[ | ||
void Draw_PushAlpha (float a); | ||
void Draw_PopAlpha (); | ||
void Draw_Axes (Vec3f const* pos, Vec3f const* x, Vec3f const* y, Vec3f const* z, float scale, float alpha); | ||
void Draw_Border (float s, float x, float y, float w, float h); | ||
void Draw_Box3 (Box3f const* b); | ||
void Draw_Clear (float r, float g, float b, float a); | ||
void Draw_ClearDepth (float d); | ||
void Draw_Color (float r, float g, float b, float a); | ||
void Draw_Flush (); | ||
void Draw_Line (float x1, float y1, float x2, float y2); | ||
void Draw_Line3 (Vec3f const* p1, Vec3f const* p2); | ||
void Draw_LineWidth (float width); | ||
void Draw_Plane (Vec3f const* p, Vec3f const* n, float scale); | ||
void Draw_Point (float x, float y); | ||
void Draw_Point3 (float x, float y, float z); | ||
void Draw_PointSize (float size); | ||
void Draw_Quad (Vec2f const* p1, Vec2f const* p2, Vec2f const* p3, Vec2f const* p4); | ||
void Draw_Quad3 (Vec3f const* p1, Vec3f const* p2, Vec3f const* p3, Vec3f const* p4); | ||
void Draw_Rect (float x1, float y1, float xs, float ys); | ||
void Draw_SmoothLines (bool enabled); | ||
void Draw_SmoothPoints (bool enabled); | ||
void Draw_Sphere (Vec3f const* p, float r); | ||
void Draw_Tri (Vec2f const* v1, Vec2f const* v2, Vec2f const* v3); | ||
void Draw_Tri3 (Vec3f const* v1, Vec3f const* v2, Vec3f const* v3); | ||
]] | ||
end | ||
|
||
do -- Global Symbol Table | ||
Draw = { | ||
PushAlpha = libphx.Draw_PushAlpha, | ||
PopAlpha = libphx.Draw_PopAlpha, | ||
Axes = libphx.Draw_Axes, | ||
Border = libphx.Draw_Border, | ||
Box3 = libphx.Draw_Box3, | ||
Clear = libphx.Draw_Clear, | ||
ClearDepth = libphx.Draw_ClearDepth, | ||
Color = libphx.Draw_Color, | ||
Flush = libphx.Draw_Flush, | ||
Line = libphx.Draw_Line, | ||
Line3 = libphx.Draw_Line3, | ||
LineWidth = libphx.Draw_LineWidth, | ||
Plane = libphx.Draw_Plane, | ||
Point = libphx.Draw_Point, | ||
Point3 = libphx.Draw_Point3, | ||
PointSize = libphx.Draw_PointSize, | ||
Quad = libphx.Draw_Quad, | ||
Quad3 = libphx.Draw_Quad3, | ||
Rect = libphx.Draw_Rect, | ||
SmoothLines = libphx.Draw_SmoothLines, | ||
SmoothPoints = libphx.Draw_SmoothPoints, | ||
Sphere = libphx.Draw_Sphere, | ||
Tri = libphx.Draw_Tri, | ||
Tri3 = libphx.Draw_Tri3, | ||
} | ||
|
||
if onDef_Draw then onDef_Draw(Draw, mt) end | ||
Draw = setmetatable(Draw, mt) | ||
end | ||
|
||
return Draw | ||
end | ||
|
||
return Loader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.