Clang Vector Extension support

This commit is contained in:
Jon Daniel 2024-11-10 09:18:58 +01:00
commit 51f336d2ec
4 changed files with 148 additions and 44 deletions

View file

@ -155,9 +155,9 @@ int main(void)
for (int i = 0; i < MAX_CUBES; i++)
{
cubePositions[i] = (Vector3){
.x = (float)(rand()%10) - 5,
.y = (float)(rand()%5),
.z = (float)(rand()%10) - 5,
(float)(rand()%10) - 5,
(float)(rand()%5),
(float)(rand()%10) - 5,
};
cubeRotations[i] = (float)(rand()%360);

View file

@ -114,7 +114,7 @@ int main(void)
modelA.transform = MatrixMultiply(modelA.transform, MatrixRotateZ(0.012f));
// Update the light shader with the camera view position
SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], &camera.position.x, SHADER_UNIFORM_VEC3);
SetShaderValue(shader, shader.locs[SHADER_LOC_VECTOR_VIEW], &camera.position, SHADER_UNIFORM_VEC3);
//----------------------------------------------------------------------------------
// Draw

View file

@ -68,7 +68,7 @@ int main(void)
marchLocs.screenCenter = GetShaderLocation(shdrRaymarch, "screenCenter");
// Transfer screenCenter position to shader. Which is used to calculate ray direction.
Vector2 screenCenter = {.x = screenWidth/2.0f, .y = screenHeight/2.0f};
Vector2 screenCenter = { screenWidth/2.0f, screenHeight/2.0f};
SetShaderValue(shdrRaymarch, marchLocs.screenCenter , &screenCenter , SHADER_UNIFORM_VEC2);
// Use Customized function to create writable depth texture buffer

View file

@ -135,7 +135,7 @@ int main(void)
spots[i].inner = 28.0f * (i + 1);
spots[i].radius = 48.0f * (i + 1);
SetShaderValue(shdrSpot, spots[i].positionLoc, &spots[i].position.x, SHADER_UNIFORM_VEC2);
SetShaderValue(shdrSpot, spots[i].positionLoc, &spots[i].position, SHADER_UNIFORM_VEC2);
SetShaderValue(shdrSpot, spots[i].innerLoc, &spots[i].inner, SHADER_UNIFORM_FLOAT);
SetShaderValue(shdrSpot, spots[i].radiusLoc, &spots[i].radius, SHADER_UNIFORM_FLOAT);
}
@ -173,7 +173,7 @@ int main(void)
if (spots[i].position.y > (screenHeight - 64)) spots[i].speed.y = -spots[i].speed.y;
}
SetShaderValue(shdrSpot, spots[i].positionLoc, &spots[i].position.x, SHADER_UNIFORM_VEC2);
SetShaderValue(shdrSpot, spots[i].positionLoc, &spots[i].position, SHADER_UNIFORM_VEC2);
}
// Draw