aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorRay <raysan5@gmail.com>2016-08-10 12:20:46 +0200
committerRay <raysan5@gmail.com>2016-08-10 12:20:46 +0200
commiteb9072a2f133cdad9fb4fed4c8b80aca04770d55 (patch)
treee2e56429ecd47f35294571365baa2ec83e3c9dac /src
parentcc2b3228d18f3bc4cd58ee4298cde78846cfde9e (diff)
downloadraylib-eb9072a2f133cdad9fb4fed4c8b80aca04770d55.tar.gz
raylib-eb9072a2f133cdad9fb4fed4c8b80aca04770d55.zip
Renamed functions for consistency
Diffstat (limited to 'src')
-rw-r--r--src/models.c14
-rw-r--r--src/raylib.h4
-rw-r--r--src/rlua.h56
3 files changed, 39 insertions, 35 deletions
diff --git a/src/models.c b/src/models.c
index b194a0db..7f248aa2 100644
--- a/src/models.c
+++ b/src/models.c
@@ -66,7 +66,7 @@ static Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize);
//----------------------------------------------------------------------------------
// Draw a line in 3D world space
-void Draw3DLine(Vector3 startPos, Vector3 endPos, Color color)
+void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color)
{
rlBegin(RL_LINES);
rlColor4ub(color.r, color.g, color.b, color.a);
@@ -76,7 +76,7 @@ void Draw3DLine(Vector3 startPos, Vector3 endPos, Color color)
}
// Draw a circle in 3D world space
-void Draw3DCircle(Vector3 center, float radius, float rotationAngle, Vector3 rotation, Color color)
+void DrawCircle3D(Vector3 center, float radius, float rotationAngle, Vector3 rotation, Color color)
{
rlPushMatrix();
rlTranslatef(center.x, center.y, center.z);
@@ -578,19 +578,19 @@ void DrawLight(Light light)
case LIGHT_POINT:
{
DrawSphereWires(light->position, 0.3f*light->intensity, 4, 8, (light->enabled ? light->diffuse : BLACK));
- Draw3DCircle(light->position, light->radius, 0.0f, (Vector3){ 0, 0, 0 }, (light->enabled ? light->diffuse : BLACK));
- Draw3DCircle(light->position, light->radius, 90.0f, (Vector3){ 1, 0, 0 }, (light->enabled ? light->diffuse : BLACK));
- Draw3DCircle(light->position, light->radius, 90.0f, (Vector3){ 0, 1, 0 }, (light->enabled ? light->diffuse : BLACK));
+ DrawCircle3D(light->position, light->radius, 0.0f, (Vector3){ 0, 0, 0 }, (light->enabled ? light->diffuse : BLACK));
+ DrawCircle3D(light->position, light->radius, 90.0f, (Vector3){ 1, 0, 0 }, (light->enabled ? light->diffuse : BLACK));
+ DrawCircle3D(light->position, light->radius, 90.0f, (Vector3){ 0, 1, 0 }, (light->enabled ? light->diffuse : BLACK));
} break;
case LIGHT_DIRECTIONAL:
{
- Draw3DLine(light->position, light->target, (light->enabled ? light->diffuse : BLACK));
+ DrawLine3D(light->position, light->target, (light->enabled ? light->diffuse : BLACK));
DrawSphereWires(light->position, 0.3f*light->intensity, 4, 8, (light->enabled ? light->diffuse : BLACK));
DrawCubeWires(light->target, 0.3f, 0.3f, 0.3f, (light->enabled ? light->diffuse : BLACK));
} break;
case LIGHT_SPOT:
{
- Draw3DLine(light->position, light->target, (light->enabled ? light->diffuse : BLACK));
+ DrawLine3D(light->position, light->target, (light->enabled ? light->diffuse : BLACK));
DrawCylinderWires(light->position, 0.0f, 0.3f*light->coneAngle/50, 0.6f, 5, (light->enabled ? light->diffuse : BLACK));
DrawCubeWires(light->target, 0.3f, 0.3f, 0.3f, (light->enabled ? light->diffuse : BLACK));
} break;
diff --git a/src/raylib.h b/src/raylib.h
index 41c32476..1673578d 100644
--- a/src/raylib.h
+++ b/src/raylib.h
@@ -800,6 +800,8 @@ const char *SubText(const char *text, int position, int length);
//------------------------------------------------------------------------------------
// Basic 3d Shapes Drawing Functions (Module: models)
//------------------------------------------------------------------------------------
+void DrawLine3D(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
+void DrawCircle3D(Vector3 center, float radius, float rotationAngle, Vector3 rotation, Color color); // Draw a circle in 3D world space
void DrawCube(Vector3 position, float width, float height, float lenght, Color color); // Draw cube
void DrawCubeV(Vector3 position, Vector3 size, Color color); // Draw cube (Vector version)
void DrawCubeWires(Vector3 position, float width, float height, float lenght, Color color); // Draw cube wires
@@ -814,8 +816,6 @@ void DrawRay(Ray ray, Color color);
void DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
void DrawGizmo(Vector3 position); // Draw simple gizmo
void DrawLight(Light light); // Draw light in 3D world
-void Draw3DLine(Vector3 startPos, Vector3 endPos, Color color); // Draw a line in 3D world space
-void Draw3DCircle(Vector3 center, float radius, float rotationAngle, Vector3 rotation, Color color); // Draw a circle in 3D world space
//DrawTorus(), DrawTeapot() are useless...
//------------------------------------------------------------------------------------
diff --git a/src/rlua.h b/src/rlua.h
index 849c1c64..b100b06d 100644
--- a/src/rlua.h
+++ b/src/rlua.h
@@ -2239,6 +2239,29 @@ int lua_DrawFPS(lua_State* L)
// NOTE: FormatText() can be replaced by Lua function: string.format()
// NOTE: SubText() can be replaced by Lua function: string.sub()
+//------------------------------------------------------------------------------------
+// raylib [models] module functions - Basic 3d Shapes Drawing Functions
+//------------------------------------------------------------------------------------
+int lua_DrawLine3D(lua_State* L)
+{
+ Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
+ Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
+ Color arg3 = LuaGetArgument_Color(L, 3);
+ DrawLine3D(arg1, arg2, arg3);
+ return 0;
+}
+
+int lua_DrawCircle3D(lua_State* L)
+{
+ Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
+ float arg2 = LuaGetArgument_float(L, 2);
+ float arg3 = LuaGetArgument_float(L, 3);
+ Vector3 arg4 = LuaGetArgument_Vector3(L, 4);
+ Color arg5 = LuaGetArgument_Color(L, 5);
+ DrawCircle3D(arg1, arg2, arg3, arg4, arg5);
+ return 0;
+}
+
int lua_DrawCube(lua_State* L)
{
Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
@@ -2376,26 +2399,6 @@ int lua_DrawLight(lua_State* L)
return 0;
}
-int lua_Draw3DLine(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- Vector3 arg2 = LuaGetArgument_Vector3(L, 2);
- Color arg3 = LuaGetArgument_Color(L, 3);
- Draw3DLine(arg1, arg2, arg3);
- return 0;
-}
-
-int lua_Draw3DCircle(lua_State* L)
-{
- Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
- float arg2 = LuaGetArgument_float(L, 2);
- float arg3 = LuaGetArgument_float(L, 3);
- Vector3 arg4 = LuaGetArgument_Vector3(L, 4);
- Color arg5 = LuaGetArgument_Color(L, 5);
- Draw3DCircle(arg1, arg2, arg3, arg4, arg5);
- return 0;
-}
-
//------------------------------------------------------------------------------------
// raylib [models] module functions
//------------------------------------------------------------------------------------
@@ -3725,6 +3728,8 @@ static luaL_Reg raylib_functions[] = {
REG(MeasureTextEx)
REG(DrawFPS)
+ REG(DrawLine3D)
+ REG(DrawCircle3D)
REG(DrawCube)
REG(DrawCubeV)
REG(DrawCubeWires)
@@ -3738,8 +3743,7 @@ static luaL_Reg raylib_functions[] = {
REG(DrawRay)
REG(DrawGrid)
REG(DrawGizmo)
-
- REG(DrawLight)
+ REG(DrawLight)
REG(LoadModel)
REG(LoadModelEx)
@@ -3747,10 +3751,10 @@ static luaL_Reg raylib_functions[] = {
REG(LoadHeightmap)
REG(LoadCubicmap)
REG(UnloadModel)
- REG(LoadMaterial)
- REG(LoadDefaultMaterial)
- REG(LoadStandardMaterial)
- REG(UnloadMaterial)
+ REG(LoadMaterial)
+ REG(LoadDefaultMaterial)
+ REG(LoadStandardMaterial)
+ REG(UnloadMaterial)
//REG(GenMesh*) // Not ready yet...
REG(DrawModel)