Fixup for rl 3.7
This commit is contained in:
parent
a8d8d4b9bc
commit
004388133b
7 changed files with 23 additions and 24 deletions
|
|
@ -104,16 +104,16 @@ pub fn CreateLight(typ: LightType, position: Vector3, target: Vector3, color: Co
|
|||
// NOTE: Light shader locations should be available
|
||||
pub fn UpdateLightValues(shader: Shader, light: Light) void {
|
||||
// Send to shader light enabled state and type
|
||||
SetShaderValue(shader, light.enabledLoc, &light.enabled, @enumToInt(ShaderUniformDataType.UNIFORM_INT));
|
||||
SetShaderValue(shader, light.typeLoc, &light.type, @enumToInt(ShaderUniformDataType.UNIFORM_INT));
|
||||
SetShaderValue(shader, light.enabledLoc, &light.enabled, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_INT));
|
||||
SetShaderValue(shader, light.typeLoc, &light.type, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_INT));
|
||||
|
||||
// Send to shader light position values
|
||||
const position = [3]f32{ light.position.x, light.position.y, light.position.z };
|
||||
SetShaderValue(shader, light.posLoc, &position, @enumToInt(ShaderUniformDataType.UNIFORM_VEC3));
|
||||
SetShaderValue(shader, light.posLoc, &position, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_VEC3));
|
||||
|
||||
// Send to shader light target position values
|
||||
const target = [3]f32{ light.target.x, light.target.y, light.target.z };
|
||||
SetShaderValue(shader, light.targetLoc, &target, @enumToInt(ShaderUniformDataType.UNIFORM_VEC3));
|
||||
SetShaderValue(shader, light.targetLoc, &target, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_VEC3));
|
||||
|
||||
// Send to shader light color values
|
||||
const color = [4]f32{
|
||||
|
|
@ -122,5 +122,5 @@ pub fn UpdateLightValues(shader: Shader, light: Light) void {
|
|||
@intToFloat(f32, light.color.b) / 255.0,
|
||||
@intToFloat(f32, light.color.a) / 255.0,
|
||||
};
|
||||
SetShaderValue(shader, light.colorLoc, &color, @enumToInt(ShaderUniformDataType.UNIFORM_VEC4));
|
||||
SetShaderValue(shader, light.colorLoc, &color, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_VEC4));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ pub fn main() !void {
|
|||
.target = .{ .x = 0.0, .y = 0.5, .z = 0.0 }, // Camera looking at point
|
||||
.up = .{ .x = 0.0, .y = 1.0, .z = 0.0 }, // Camera up vector (rotation towards target)
|
||||
.fovy = 45.0, // Camera field-of-view Y
|
||||
.type = CameraType.CAMERA_PERSPECTIVE, // Camera mode type
|
||||
.projection = CameraProjection.CAMERA_PERSPECTIVE, // Camera mode type
|
||||
};
|
||||
|
||||
// Load models
|
||||
|
|
@ -54,13 +54,13 @@ pub fn main() !void {
|
|||
);
|
||||
|
||||
// Get some shader loactions
|
||||
shader.locs[@enumToInt(ShaderLocationIndex.LOC_MATRIX_MODEL)] = GetShaderLocation(shader, "matModel");
|
||||
shader.locs[@enumToInt(ShaderLocationIndex.LOC_VECTOR_VIEW)] = GetShaderLocation(shader, "viewPos");
|
||||
shader.locs[@enumToInt(ShaderLocationIndex.SHADER_LOC_MATRIX_MODEL)] = GetShaderLocation(shader, "matModel");
|
||||
shader.locs[@enumToInt(ShaderLocationIndex.SHADER_LOC_VECTOR_VIEW)] = GetShaderLocation(shader, "viewPos");
|
||||
|
||||
// ambient light level
|
||||
const ambientLoc = GetShaderLocation(shader, "ambient");
|
||||
const ambientVals = [4]f32{ 0.2, 0.2, 0.2, 1.0 };
|
||||
SetShaderValue(shader, ambientLoc, &ambientVals, @enumToInt(ShaderUniformDataType.UNIFORM_VEC4));
|
||||
SetShaderValue(shader, ambientLoc, &ambientVals, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_VEC4));
|
||||
|
||||
var angle: f32 = 6.282;
|
||||
|
||||
|
|
@ -126,7 +126,7 @@ pub fn main() !void {
|
|||
|
||||
// Update the light shader with the camera view position
|
||||
const cameraPos = [3]f32{ camera.position.x, camera.position.y, camera.position.z };
|
||||
SetShaderValue(shader, shader.locs[@enumToInt(ShaderLocationIndex.LOC_VECTOR_VIEW)], &cameraPos, @enumToInt(ShaderUniformDataType.UNIFORM_VEC3));
|
||||
SetShaderValue(shader, shader.locs[@enumToInt(ShaderLocationIndex.SHADER_LOC_VECTOR_VIEW)], &cameraPos, @enumToInt(ShaderUniformDataType.SHADER_UNIFORM_VEC3));
|
||||
//----------------------------------------------------------------------------------
|
||||
|
||||
// Draw
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue