changed Color struct to 4 floats
GetRandomValue returns floats added GetRandomInt added Color4ub rgba 0-255 edited examples to work colour palette values could bare a double check!
This commit is contained in:
parent
ea70c47a1a
commit
b4d8f0b5d1
5 changed files with 475 additions and 359 deletions
|
|
@ -35,7 +35,7 @@ int main(void)
|
|||
model.materials[0].maps[MAP_DIFFUSE].texture = texture; // Set map diffuse texture
|
||||
|
||||
// Get map image data to be used for collision detection
|
||||
Color *mapPixels = GetImageData(imMap);
|
||||
Color4ub *mapPixels = GetImageData(imMap);
|
||||
UnloadImage(imMap); // Unload image from RAM
|
||||
|
||||
Vector3 mapPosition = { -16.0f, 0.0f, -8.0f }; // Set model position
|
||||
|
|
|
|||
|
|
@ -51,14 +51,14 @@ int main(void)
|
|||
MeshTangents(&model.meshes[0]);
|
||||
|
||||
UnloadMaterial(model.materials[0]); // get rid of default material
|
||||
model.materials[0] = LoadMaterialPBR((Color){ 255, 255, 255, 255 }, 1.0f, 1.0f);
|
||||
model.materials[0] = LoadMaterialPBR((Color){ 1, 1, 1, 1 }, 1.0f, 1.0f);
|
||||
|
||||
// Create lights
|
||||
// NOTE: Lights are added to an internal lights pool automatically
|
||||
CreateLight(LIGHT_POINT, (Vector3){ LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 0, 255 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_POINT, (Vector3){ 0.0f, LIGHT_HEIGHT, LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 255, 0, 255 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_POINT, (Vector3){ -LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 0, 255, 255 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_DIRECTIONAL, (Vector3){ 0.0f, LIGHT_HEIGHT*2.0f, -LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 255, 255 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_POINT, (Vector3){ LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 1, 0, 0, 1 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_POINT, (Vector3){ 0.0f, LIGHT_HEIGHT, LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 1, 0, 1 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_POINT, (Vector3){ -LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 0, 1, 1 }, model.materials[0].shader);
|
||||
CreateLight(LIGHT_DIRECTIONAL, (Vector3){ 0.0f, LIGHT_HEIGHT*2.0f, -LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 1, 0, 1, 1 }, model.materials[0].shader);
|
||||
|
||||
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
|
||||
|
||||
|
|
@ -223,7 +223,7 @@ static Material LoadMaterialPBR(Color albedo, float metalness, float roughness)
|
|||
|
||||
// Set up material properties color
|
||||
mat.maps[MAP_ALBEDO].color = albedo;
|
||||
mat.maps[MAP_NORMAL].color = (Color){ 128, 128, 255, 255 };
|
||||
mat.maps[MAP_NORMAL].color = (Color){ 0.5, 0.5, 1, 1 };
|
||||
mat.maps[MAP_METALNESS].value = metalness;
|
||||
mat.maps[MAP_ROUGHNESS].value = roughness;
|
||||
mat.maps[MAP_OCCLUSION].value = 1.0f;
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ void DrawSphereBasic(Color color)
|
|||
int slices = 16;
|
||||
|
||||
rlBegin(RL_TRIANGLES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
rlColor4f(color.r, color.g, color.b, color.a);
|
||||
|
||||
for (int i = 0; i < (rings + 2); i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ void DrawSphereBasic(Color color)
|
|||
int slices = 16;
|
||||
|
||||
rlBegin(RL_TRIANGLES);
|
||||
rlColor4ub(color.r, color.g, color.b, color.a);
|
||||
rlColor4f(color.r, color.g, color.b, color.a);
|
||||
|
||||
for (int i = 0; i < (rings + 2); i++)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -168,8 +168,8 @@ void UpdateLightValues(Shader shader, Light light)
|
|||
SetShaderValue(shader, light.targetLoc, target, UNIFORM_VEC3);
|
||||
|
||||
// Send to shader light color values
|
||||
float diff[4] = { (float)light.color.r/(float)255, (float)light.color.g/(float)255, (float)light.color.b/(float)255, (float)light.color.a/(float)255 };
|
||||
float diff[4] = { light.color.r, light.color.g, light.color.b, light.color.a };
|
||||
SetShaderValue(shader, light.colorLoc, diff, UNIFORM_VEC4);
|
||||
}
|
||||
|
||||
#endif // RLIGHTS_IMPLEMENTATION
|
||||
#endif // RLIGHTS_IMPLEMENTATION
|
||||
|
|
|
|||
Loading…
Reference in a new issue