From 2e26ce235d00fdc633559f9404ddd8ec70c96df7 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Mon, 30 May 2016 19:18:11 +0200 Subject: Add Draw3DCircle function and update raylib and rlgl header Draw3DCircle is useful to draw point lights radius. --- src/models.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/models.c') diff --git a/src/models.c b/src/models.c index 07dee720..6ffb561e 100644 --- a/src/models.c +++ b/src/models.c @@ -75,6 +75,25 @@ void Draw3DLine(Vector3 startPos, Vector3 endPos, Color color) rlEnd(); } +// Draw a circle in 3D world space +void Draw3DCircle(Vector3 center, float radius, float rotationAngle, Vector3 rotation, Color color) +{ + rlPushMatrix(); + rlTranslatef(center.x, center.y, center.z); + rlRotatef(rotationAngle, rotation.x, rotation.y, rotation.z); + + rlBegin(RL_LINES); + for (int i = 0; i < 360; i += 10) + { + rlColor4ub(color.r, color.g, color.b, color.a); + + rlVertex3f(sin(DEG2RAD*i)*radius, cos(DEG2RAD*i)*radius, 0.0f); + rlVertex3f(sin(DEG2RAD*(i + 10)) * radius, cos(DEG2RAD*(i + 10)) * radius, 0.0f); + } + rlEnd(); + rlPopMatrix(); +} + // Draw cube // NOTE: Cube position is the center position void DrawCube(Vector3 position, float width, float height, float length, Color color) -- cgit v1.2.3 From f2d61d4043850e89b2d2cb7bacffe628aef0b981 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Mon, 30 May 2016 19:43:35 +0200 Subject: Remove normal depth Scaling normal depth (y axis) makes disappear the specular of fragments... So I think it can be removed, it is not a very useful/important attribute. --- src/models.c | 1 - 1 file changed, 1 deletion(-) (limited to 'src/models.c') diff --git a/src/models.c b/src/models.c index 6ffb561e..90b752fd 100644 --- a/src/models.c +++ b/src/models.c @@ -756,7 +756,6 @@ Material LoadDefaultMaterial(void) material.colSpecular = WHITE; // Specular color material.glossiness = 100.0f; // Glossiness level - material.normalDepth = 1.0f; // Normal map depth return material; } -- cgit v1.2.3 From b0a0c5d4312d05d460cdd12f6af12321b0a55e66 Mon Sep 17 00:00:00 2001 From: victorfisac Date: Mon, 30 May 2016 19:55:13 +0200 Subject: Added tint color attribute to material data type It tints all fragments, ignores lighting. Useful for some features like feedback (damage color, ...). --- src/models.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/models.c') diff --git a/src/models.c b/src/models.c index 90b752fd..092a43fc 100644 --- a/src/models.c +++ b/src/models.c @@ -751,6 +751,7 @@ Material LoadDefaultMaterial(void) //material.texNormal; // NOTE: By default, not set //material.texSpecular; // NOTE: By default, not set + material.colTint = WHITE; // Tint color material.colDiffuse = WHITE; // Diffuse color material.colAmbient = WHITE; // Ambient color material.colSpecular = WHITE; // Specular color @@ -1268,7 +1269,7 @@ void DrawModelEx(Model model, Vector3 position, Vector3 rotationAxis, float rota //Matrix matModel = MatrixMultiply(model.transform, matTransform); // Transform to world-space coordinates model.transform = MatrixMultiply(MatrixMultiply(matScale, matRotation), matTranslation); - // model.material.colDiffuse = tint; + model.material.colTint = tint; rlglDrawMesh(model.mesh, model.material, model.transform); } -- cgit v1.2.3