diff options
| author | Ray <raysan5@gmail.com> | 2016-05-31 00:51:55 +0200 |
|---|---|---|
| committer | Ray <raysan5@gmail.com> | 2016-05-31 00:51:55 +0200 |
| commit | caa7bc366b949310fbb9c7eafbb9fa7050e1514a (patch) | |
| tree | a39e43fafe81335266f3d6ee1ff13454a55db25e /src/models.c | |
| parent | 8a4e28f81db16c034274e5d78dddfe33824e59fe (diff) | |
| download | raylib-caa7bc366b949310fbb9c7eafbb9fa7050e1514a.tar.gz raylib-caa7bc366b949310fbb9c7eafbb9fa7050e1514a.zip | |
Reviewed DrawLight() function and some tweaks
Diffstat (limited to 'src/models.c')
| -rw-r--r-- | src/models.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/models.c b/src/models.c index 092a43fc..8c5ed914 100644 --- a/src/models.c +++ b/src/models.c @@ -569,6 +569,35 @@ void DrawGizmo(Vector3 position) rlPopMatrix(); } + +// Draw light in 3D world +void DrawLight(Light light) +{ + switch (light->type) + { + 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)); + } break; + case LIGHT_DIRECTIONAL: + { + Draw3DLine(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)); + 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; + default: break; + } +} + // Load a 3d model (from file) Model LoadModel(const char *fileName) { |
