Added zombie for testing
30
main.c
@@ -157,20 +157,18 @@ int main(void)
|
|||||||
|
|
||||||
UpdateCameraAngle(&g);
|
UpdateCameraAngle(&g);
|
||||||
|
|
||||||
/*
|
|
||||||
// Load GLTF model (no animations)
|
// Load GLTF model (no animations)
|
||||||
//Model model = LoadModel("resources/3d_models/bad_sphere.glb");
|
//Model model = LoadModel("resources/3d_models/bad_sphere.glb");
|
||||||
//Vector3 position = { 0.0f, 0.0f, 0.0f };
|
//Vector3 position = { 0.0f, 0.0f, 0.0f };
|
||||||
|
|
||||||
// Load a 2D image as texture for the billboard
|
// Load a 2D image as texture for the billboard
|
||||||
//Billboards always point toward the active camera.
|
//Billboards always point toward the active camera.
|
||||||
|
Texture2D sign = LoadTexture("resources/sprites/husk/ZOMBC1.png");
|
||||||
Texture2D sign = LoadTexture("resources/sprites/diard-charles.jpg");
|
|
||||||
GenTextureMipmaps(&sign);
|
GenTextureMipmaps(&sign);
|
||||||
SetTextureFilter(sign, TEXTURE_FILTER_BILINEAR); // optional but looks nicer
|
SetTextureFilter(sign, TEXTURE_FILTER_BILINEAR); // optional but looks nicer
|
||||||
Vector3 bbPos = (Vector3){ 1.0f, 2.5f, 1.0f }; // where in 3D world to place it
|
Vector3 bbPos = (Vector3){ -1.0f, 2.0f, -1.0f }; // where in 3D world to place it
|
||||||
float bbSize = 5.0f; // billboard height in world units
|
float bbSize = 4.0f; // billboard height in world units
|
||||||
*/
|
|
||||||
|
|
||||||
// Load a 2D image as texture for the billboard
|
// Load a 2D image as texture for the billboard
|
||||||
//Billboards always point toward the active camera.
|
//Billboards always point toward the active camera.
|
||||||
@@ -261,18 +259,18 @@ int main(void)
|
|||||||
// Fog/vignette tuning
|
// Fog/vignette tuning
|
||||||
float inner = 0.0f; // start radius (center under player)
|
float inner = 0.0f; // start radius (center under player)
|
||||||
float outer = 20.0f; // how far until full fog
|
float outer = 20.0f; // how far until full fog
|
||||||
float minShadow = 0.9f; // baseline darkness at the center (0 = none, 1 = pitch black)
|
float minShadow = 0.85f; // baseline darkness at the center (0 = none, 1 = pitch black)
|
||||||
float sharpness = 2.0f; // steeper edge (optional if shader uses it)
|
float sharpness = 2.0f; // steeper edge (optional if shader uses it)
|
||||||
Vector4 fogColor = {0.0f, 0.0f, 0.0f, 1.0f};
|
Vector4 fogColor = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||||
|
|
||||||
// Flashligh tuning
|
// Flashligh tuning
|
||||||
float spotAngleDeg = 35.0f; //cone angle
|
float spotAngleDeg = 35.0f; //cone angle
|
||||||
float spotCos = cosf(DEG2RAD * (spotAngleDeg * 0.5f));
|
float spotCos = cosf(DEG2RAD * (spotAngleDeg * 0.5f));
|
||||||
float spotSoft = 0.05f;
|
float spotSoft = 0.10f;
|
||||||
float lightRange = 150.0f;
|
float lightRange = 100.0f;
|
||||||
float lightFade = 10.0f;
|
float lightFade = 1.0f;
|
||||||
float intensity = 0.25f; // try 0.7–1.5 to taste
|
float intensity = 0.25f; // try 0.7–1.5 to taste
|
||||||
float beamSpread = 0.00f; // try 0.15–0.35; higher = less “laser” at distance
|
float beamSpread = 0.05f; // try 0.15–0.35; higher = less “laser” at distance
|
||||||
|
|
||||||
SetShaderValue(fog, locIntensity, &intensity, SHADER_UNIFORM_FLOAT);
|
SetShaderValue(fog, locIntensity, &intensity, SHADER_UNIFORM_FLOAT);
|
||||||
SetShaderValue(fog, locBeamSpread, &beamSpread, SHADER_UNIFORM_FLOAT);
|
SetShaderValue(fog, locBeamSpread, &beamSpread, SHADER_UNIFORM_FLOAT);
|
||||||
@@ -370,6 +368,11 @@ int main(void)
|
|||||||
g.player.lean.x = Lerp(g.player.lean.x, sideway*0.02f, 10.0f*delta);
|
g.player.lean.x = Lerp(g.player.lean.x, sideway*0.02f, 10.0f*delta);
|
||||||
g.player.lean.y = Lerp(g.player.lean.y, forward*0.015f, 10.0f*delta);
|
g.player.lean.y = Lerp(g.player.lean.y, forward*0.015f, 10.0f*delta);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bbPos.x += (g.player.position.x - bbPos.x)*.005;
|
||||||
|
bbPos.z += (g.player.position.z - bbPos.z)*.005;
|
||||||
|
|
||||||
UpdateCameraAngle(&g);
|
UpdateCameraAngle(&g);
|
||||||
break;
|
break;
|
||||||
};
|
};
|
||||||
@@ -430,6 +433,8 @@ int main(void)
|
|||||||
|
|
||||||
RenderTrees(&g, tree, treepos, treeSize);
|
RenderTrees(&g, tree, treepos, treeSize);
|
||||||
|
|
||||||
|
DrawBillboard(g.player.camera, sign, bbPos, bbSize, WHITE);
|
||||||
|
|
||||||
EndShaderMode();
|
EndShaderMode();
|
||||||
|
|
||||||
// Restore opaque cutoff for anything else you draw with that material later
|
// Restore opaque cutoff for anything else you draw with that material later
|
||||||
@@ -463,6 +468,7 @@ int main(void)
|
|||||||
UnloadModel(mdlTile); // frees the model and its mesh/VBOs
|
UnloadModel(mdlTile); // frees the model and its mesh/VBOs
|
||||||
UnloadTexture(texGrass); // frees the grass texture you loaded
|
UnloadTexture(texGrass); // frees the grass texture you loaded
|
||||||
UnloadTexture(tree); // frees tree texture
|
UnloadTexture(tree); // frees tree texture
|
||||||
|
UnloadTexture(sign);
|
||||||
|
|
||||||
CloseWindow(); // Close window and OpenGL context
|
CloseWindow(); // Close window and OpenGL context
|
||||||
//--------------------------------------------------------------------------------------
|
//--------------------------------------------------------------------------------------
|
||||||
@@ -724,7 +730,7 @@ static void RenderTrees(Master* g, Texture2D tree, Vector3 baseTreePos, float tr
|
|||||||
|
|
||||||
// Placement knobs
|
// Placement knobs
|
||||||
const int densityA = 10; // 1-in-10 on (odd,odd)
|
const int densityA = 10; // 1-in-10 on (odd,odd)
|
||||||
const int densityB = 20; // 1-in-14 on (even,even)
|
const int densityB = 13; // 1-in-14 on (even,even)
|
||||||
const float jitter = tileSize * 0.35f; // random in-tile offset
|
const float jitter = tileSize * 0.35f; // random in-tile offset
|
||||||
|
|
||||||
const float groundY = baseTreePos.y; // <-- use this as terrain height
|
const float groundY = baseTreePos.y; // <-- use this as terrain height
|
||||||
|
|||||||
BIN
resources/sprites/husk/ZOMBA1.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBA2A8.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBA3A7.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/sprites/husk/ZOMBA4A6.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBA5.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBB1.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBB2B8.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/sprites/husk/ZOMBB3B7.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
resources/sprites/husk/ZOMBB4B6.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/sprites/husk/ZOMBB5.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBC1.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBC2C8.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/sprites/husk/ZOMBC3C7.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/sprites/husk/ZOMBC4C6.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/sprites/husk/ZOMBC5.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBD1.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBD2D8.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBD3D7.png
Normal file
|
After Width: | Height: | Size: 1.7 KiB |
BIN
resources/sprites/husk/ZOMBD4D6.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBD5.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBE1.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
resources/sprites/husk/ZOMBE2E8.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/sprites/husk/ZOMBE3E7.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBE4E6.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
resources/sprites/husk/ZOMBE5.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
resources/sprites/husk/ZOMBF1.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBF2F8.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/sprites/husk/ZOMBF3F7.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/sprites/husk/ZOMBF4F6.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/sprites/husk/ZOMBF5.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/sprites/husk/ZOMBG1.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/sprites/husk/ZOMBG2G8.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/sprites/husk/ZOMBG3G7.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBG4G6.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBG5.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
BIN
resources/sprites/husk/ZOMBH1.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/sprites/husk/ZOMBH2H8.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBH3H7.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBH4H6.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/sprites/husk/ZOMBH5.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
resources/sprites/husk/ZOMBI0.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
resources/sprites/husk/ZOMBJ0.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
resources/sprites/husk/ZOMBK0.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
resources/sprites/husk/ZOMBL0.png
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
resources/sprites/husk/ZOMBM0.png
Normal file
|
After Width: | Height: | Size: 1.6 KiB |