Added zombie for testing
This commit is contained in:
34
main.c
34
main.c
@@ -157,21 +157,19 @@ int main(void)
|
||||
|
||||
UpdateCameraAngle(&g);
|
||||
|
||||
/*
|
||||
|
||||
// Load GLTF model (no animations)
|
||||
//Model model = LoadModel("resources/3d_models/bad_sphere.glb");
|
||||
//Vector3 position = { 0.0f, 0.0f, 0.0f };
|
||||
|
||||
// Load a 2D image as texture for the billboard
|
||||
//Billboards always point toward the active camera.
|
||||
|
||||
Texture2D sign = LoadTexture("resources/sprites/diard-charles.jpg");
|
||||
Texture2D sign = LoadTexture("resources/sprites/husk/ZOMBC1.png");
|
||||
GenTextureMipmaps(&sign);
|
||||
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
|
||||
float bbSize = 5.0f; // billboard height in world units
|
||||
*/
|
||||
|
||||
Vector3 bbPos = (Vector3){ -1.0f, 2.0f, -1.0f }; // where in 3D world to place it
|
||||
float bbSize = 4.0f; // billboard height in world units
|
||||
|
||||
// Load a 2D image as texture for the billboard
|
||||
//Billboards always point toward the active camera.
|
||||
Texture2D tree = LoadTexture("resources/sprites/tree.png");
|
||||
@@ -261,18 +259,18 @@ int main(void)
|
||||
// Fog/vignette tuning
|
||||
float inner = 0.0f; // start radius (center under player)
|
||||
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)
|
||||
Vector4 fogColor = {0.0f, 0.0f, 0.0f, 1.0f};
|
||||
|
||||
// Flashligh tuning
|
||||
float spotAngleDeg = 35.0f; //cone angle
|
||||
float spotCos = cosf(DEG2RAD * (spotAngleDeg * 0.5f));
|
||||
float spotSoft = 0.05f;
|
||||
float lightRange = 150.0f;
|
||||
float lightFade = 10.0f;
|
||||
float spotSoft = 0.10f;
|
||||
float lightRange = 100.0f;
|
||||
float lightFade = 1.0f;
|
||||
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, locBeamSpread, &beamSpread, SHADER_UNIFORM_FLOAT);
|
||||
@@ -370,8 +368,13 @@ int main(void)
|
||||
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);
|
||||
|
||||
|
||||
|
||||
bbPos.x += (g.player.position.x - bbPos.x)*.005;
|
||||
bbPos.z += (g.player.position.z - bbPos.z)*.005;
|
||||
|
||||
UpdateCameraAngle(&g);
|
||||
break;
|
||||
break;
|
||||
};
|
||||
}
|
||||
//----------------------------------------------------------------------------------
|
||||
@@ -430,6 +433,8 @@ int main(void)
|
||||
|
||||
RenderTrees(&g, tree, treepos, treeSize);
|
||||
|
||||
DrawBillboard(g.player.camera, sign, bbPos, bbSize, WHITE);
|
||||
|
||||
EndShaderMode();
|
||||
|
||||
// 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
|
||||
UnloadTexture(texGrass); // frees the grass texture you loaded
|
||||
UnloadTexture(tree); // frees tree texture
|
||||
UnloadTexture(sign);
|
||||
|
||||
CloseWindow(); // Close window and OpenGL context
|
||||
//--------------------------------------------------------------------------------------
|
||||
@@ -724,7 +730,7 @@ static void RenderTrees(Master* g, Texture2D tree, Vector3 baseTreePos, float tr
|
||||
|
||||
// Placement knobs
|
||||
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 groundY = baseTreePos.y; // <-- use this as terrain height
|
||||
|
||||
Reference in New Issue
Block a user