|
@@ -38,16 +38,16 @@ int main()
|
|
|
|
|
|
// Load model and PBR material
|
|
// Load model and PBR material
|
|
Model model = LoadModel("resources/pbr/trooper.obj");
|
|
Model model = LoadModel("resources/pbr/trooper.obj");
|
|
- MeshTangents(&model.mesh);
|
|
|
|
- model.material = LoadMaterialPBR((Color){ 255, 255, 255, 255 }, 1.0f, 1.0f);
|
|
|
|
|
|
+ MeshTangents(&model.meshes[0]);
|
|
|
|
+ model.materials[0] = LoadMaterialPBR((Color){ 255, 255, 255, 255 }, 1.0f, 1.0f);
|
|
|
|
|
|
// Define lights attributes
|
|
// Define lights attributes
|
|
// NOTE: Shader is passed to every light on creation to define shader bindings internally
|
|
// NOTE: Shader is passed to every light on creation to define shader bindings internally
|
|
Light lights[MAX_LIGHTS] = {
|
|
Light lights[MAX_LIGHTS] = {
|
|
- CreateLight(LIGHT_POINT, (Vector3){ LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 255, 0, 0, 255 }, model.material.shader),
|
|
|
|
- CreateLight(LIGHT_POINT, (Vector3){ 0.0f, LIGHT_HEIGHT, LIGHT_DISTANCE }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 255, 0, 255 }, model.material.shader),
|
|
|
|
- CreateLight(LIGHT_POINT, (Vector3){ -LIGHT_DISTANCE, LIGHT_HEIGHT, 0.0f }, (Vector3){ 0.0f, 0.0f, 0.0f }, (Color){ 0, 0, 255, 255 }, model.material.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.material.shader)
|
|
|
|
|
|
+ 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)
|
|
};
|
|
};
|
|
|
|
|
|
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
|
|
SetCameraMode(camera, CAMERA_ORBITAL); // Set an orbital camera mode
|
|
@@ -64,7 +64,7 @@ int main()
|
|
|
|
|
|
// Send to material PBR shader camera view position
|
|
// Send to material PBR shader camera view position
|
|
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
|
|
float cameraPos[3] = { camera.position.x, camera.position.y, camera.position.z };
|
|
- SetShaderValue(model.material.shader, model.material.shader.locs[LOC_VECTOR_VIEW], cameraPos, UNIFORM_VEC3);
|
|
|
|
|
|
+ SetShaderValue(model.materials[0].shader, model.materials[0].shader.locs[LOC_VECTOR_VIEW], cameraPos, UNIFORM_VEC3);
|
|
//----------------------------------------------------------------------------------
|
|
//----------------------------------------------------------------------------------
|
|
|
|
|
|
// Draw
|
|
// Draw
|