Update examples

This commit is contained in:
jakub-swiniarski 2024-02-07 11:03:56 +01:00
commit 8b3959d974
19 changed files with 6413 additions and 662 deletions

View file

@ -39,6 +39,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Model model = LoadModel("resources/models/iqm/guy.iqm"); // Load the animated model mesh and basic data

View file

@ -32,6 +32,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Texture2D bill = LoadTexture("resources/billboard.png"); // Our billboard texture
@ -108,4 +109,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View file

@ -26,7 +26,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [models] example - box collisions");
// Define the camera to look into our 3d world
Camera camera = { { 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 };
Camera camera = { { 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0.003f, 0 };
Vector3 playerPosition = { 0.0f, 1.0f, 2.0f };
Vector3 playerSize = { 1.0f, 2.0f, 1.0f };
@ -123,4 +123,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View file

@ -31,6 +31,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Image image = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)

View file

@ -39,6 +39,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.fovy = 45.0f;
camera.sensitivity = 0.003f;
camera.projection = CAMERA_PERSPECTIVE;
// Load texture to be applied to the cubes sides
@ -242,4 +243,4 @@ void DrawCubeTextureRec(Texture2D texture, Rectangle source, Vector3 position, f
rlEnd();
rlSetTexture(0);
}
}

View file

@ -34,6 +34,7 @@ int main(void)
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
camera.sensitivity = 0.003f; // Camera sensitivity
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position
Image imMap = LoadImage("resources/cubicmap.png"); // Load cubicmap image (RAM)

View file

@ -31,6 +31,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f };
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f };
camera.fovy = 45.0f;
camera.sensitivity = 0.003f;
camera.projection = CAMERA_PERSPECTIVE;
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
@ -85,4 +86,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View file

@ -31,6 +31,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Image image = LoadImage("resources/heightmap.png"); // Load heightmap image (RAM)
@ -87,4 +88,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View file

@ -44,6 +44,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 10.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera mode type
Model model = LoadModel("resources/models/obj/castle.obj"); // Load model
@ -150,4 +151,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View file

@ -38,6 +38,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 2.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
// Load gltf model

View file

@ -37,6 +37,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.4f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Vector3 position = { 0.0f, 0.0f, 0.0f }; // Set model position

View file

@ -43,6 +43,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
// Load MagicaVoxel files

View file

@ -61,7 +61,7 @@ int main(void)
for (int i = 0; i < NUM_MODELS; i++) models[i].materials[0].maps[MATERIAL_MAP_DIFFUSE].texture = texture;
// Define the camera to look into our 3d world
Camera camera = { { 5.0f, 5.0f, 5.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0 };
Camera camera = { { 5.0f, 5.0f, 5.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, 45.0f, 0.003f, 0 };
// Model drawing position
Vector3 position = { 0.0f, 0.0f, 0.0f };

View file

@ -36,6 +36,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 8.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.6f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
Ray ray = { 0 }; // Picking ray
@ -243,4 +244,4 @@ int main(void)
//--------------------------------------------------------------------------------------
return 0;
}
}

View file

@ -31,7 +31,7 @@ int main(void)
InitWindow(screenWidth, screenHeight, "raylib [models] example - geometric shapes");
// Define the camera to look into our 3d world
Camera camera = { { 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, FOVY_PERSPECTIVE, CAMERA_PERSPECTIVE };
Camera camera = { { 0.0f, 10.0f, 10.0f }, { 0.0f, 0.0f, 0.0f }, { 0.0f, 1.0f, 0.0f }, FOVY_PERSPECTIVE, 0.003f, CAMERA_PERSPECTIVE };
SetTargetFPS(60); // Set our game to run at 60 frames-per-second
//--------------------------------------------------------------------------------------

View file

@ -47,6 +47,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
float rotationSpeed = 0.2f; // General system rotation speed

View file

@ -43,6 +43,7 @@ int main(void)
camera.target = (Vector3){ 4.0f, 1.0f, 4.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 45.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
// Load skybox model

View file

@ -35,6 +35,7 @@ int main()
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 70.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera projection type
// Specify the amount of blocks in each direction

View file

@ -35,6 +35,7 @@ int main(void)
camera.target = (Vector3){ 0.0f, 0.0f, 0.0f }; // Camera looking at point
camera.up = (Vector3){ 0.0f, 1.0f, 0.0f }; // Camera up vector (rotation towards target)
camera.fovy = 30.0f; // Camera field-of-view Y
camera.sensitivity = 0.003f; // Camera sensitivity
camera.projection = CAMERA_PERSPECTIVE; // Camera type
Model model = LoadModel("resources/models/obj/plane.obj"); // Load model