Renamed functions for consistency

This commit is contained in:
Ray 2016-08-10 12:20:46 +02:00
parent cc2b3228d1
commit eb9072a2f1
3 changed files with 39 additions and 35 deletions

View File

@ -66,7 +66,7 @@ static Mesh GenMeshCubicmap(Image cubicmap, Vector3 cubeSize);
//---------------------------------------------------------------------------------- //----------------------------------------------------------------------------------
// Draw a line in 3D world space // 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); rlBegin(RL_LINES);
rlColor4ub(color.r, color.g, color.b, color.a); 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 // 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(); rlPushMatrix();
rlTranslatef(center.x, center.y, center.z); rlTranslatef(center.x, center.y, center.z);
@ -578,19 +578,19 @@ void DrawLight(Light light)
case LIGHT_POINT: case LIGHT_POINT:
{ {
DrawSphereWires(light->position, 0.3f*light->intensity, 4, 8, (light->enabled ? light->diffuse : BLACK)); 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)); DrawCircle3D(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)); DrawCircle3D(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, 90.0f, (Vector3){ 0, 1, 0 }, (light->enabled ? light->diffuse : BLACK));
} break; } break;
case LIGHT_DIRECTIONAL: 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)); 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)); DrawCubeWires(light->target, 0.3f, 0.3f, 0.3f, (light->enabled ? light->diffuse : BLACK));
} break; } break;
case LIGHT_SPOT: 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)); 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)); DrawCubeWires(light->target, 0.3f, 0.3f, 0.3f, (light->enabled ? light->diffuse : BLACK));
} break; } break;

View File

@ -800,6 +800,8 @@ const char *SubText(const char *text, int position, int length);
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
// Basic 3d Shapes Drawing Functions (Module: models) // 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 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 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 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 DrawGrid(int slices, float spacing); // Draw a grid (centered at (0, 0, 0))
void DrawGizmo(Vector3 position); // Draw simple gizmo void DrawGizmo(Vector3 position); // Draw simple gizmo
void DrawLight(Light light); // Draw light in 3D world 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... //DrawTorus(), DrawTeapot() are useless...
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------

View File

@ -2239,6 +2239,29 @@ int lua_DrawFPS(lua_State* L)
// NOTE: FormatText() can be replaced by Lua function: string.format() // NOTE: FormatText() can be replaced by Lua function: string.format()
// NOTE: SubText() can be replaced by Lua function: string.sub() // 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) int lua_DrawCube(lua_State* L)
{ {
Vector3 arg1 = LuaGetArgument_Vector3(L, 1); Vector3 arg1 = LuaGetArgument_Vector3(L, 1);
@ -2376,26 +2399,6 @@ int lua_DrawLight(lua_State* L)
return 0; 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 // raylib [models] module functions
//------------------------------------------------------------------------------------ //------------------------------------------------------------------------------------
@ -3725,6 +3728,8 @@ static luaL_Reg raylib_functions[] = {
REG(MeasureTextEx) REG(MeasureTextEx)
REG(DrawFPS) REG(DrawFPS)
REG(DrawLine3D)
REG(DrawCircle3D)
REG(DrawCube) REG(DrawCube)
REG(DrawCubeV) REG(DrawCubeV)
REG(DrawCubeWires) REG(DrawCubeWires)
@ -3738,8 +3743,7 @@ static luaL_Reg raylib_functions[] = {
REG(DrawRay) REG(DrawRay)
REG(DrawGrid) REG(DrawGrid)
REG(DrawGizmo) REG(DrawGizmo)
REG(DrawLight)
REG(DrawLight)
REG(LoadModel) REG(LoadModel)
REG(LoadModelEx) REG(LoadModelEx)
@ -3747,10 +3751,10 @@ static luaL_Reg raylib_functions[] = {
REG(LoadHeightmap) REG(LoadHeightmap)
REG(LoadCubicmap) REG(LoadCubicmap)
REG(UnloadModel) REG(UnloadModel)
REG(LoadMaterial) REG(LoadMaterial)
REG(LoadDefaultMaterial) REG(LoadDefaultMaterial)
REG(LoadStandardMaterial) REG(LoadStandardMaterial)
REG(UnloadMaterial) REG(UnloadMaterial)
//REG(GenMesh*) // Not ready yet... //REG(GenMesh*) // Not ready yet...
REG(DrawModel) REG(DrawModel)