blackballs23's picture
// FlockComputeShader.hlsl — Boids + Steering + Territory Aggression
9a6bd61 verified
Raw History Blame Contribute Delete
5.89 kB
<!DOCTYPE html>
<html lang="en" class="dark">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AetherEngine Physics Documentation</title>
<link rel="stylesheet" href="style.css">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
</head>
<body class="bg-gray-900 text-gray-100 min-h-screen">
<custom-navbar></custom-navbar>
<main class="container mx-auto px-4 py-8 max-w-4xl">
<section class="mb-12">
<h1 class="text-4xl font-bold mb-4 bg-gradient-to-r from-primary-500 to-secondary-500 bg-clip-text text-transparent">
Physics System Documentation
</h1>
<p class="text-lg text-gray-300">
Detailed technical documentation for AetherEngine's advanced physics simulation.
</p>
</section>
<section class="mb-16 bg-gray-800 rounded-xl p-6">
<h2 class="text-2xl font-bold mb-6">Aerodynamic Force Calculation</h2>
<pre class="bg-gray-900 p-4 rounded-lg overflow-x-auto text-sm mb-6">
<code class="text-green-400">
AeroForces Aerodynamics::ComputeForces(
const Vec3& v,
const Vec3& n,
float area,
float density,
float flex)
{
float speed = v.Length();
float angle = acos(Clamp(Dot(Normalize(v), n), -1.0f, 1.0f));
// Classic aerodynamic lift model
float liftCoeff = sin(angle * 2.0f) * (1.0f + flex);
float dragCoeff = 0.02f + 0.3f * pow(sin(angle), 2.0f);
Vec3 lift = Cross(Cross(v, n), v).Normalized() * liftCoeff * speed * speed * area * density;
Vec3 drag = -Normalize(v) * dragCoeff * speed * speed * area * density;
// Turbulence: procedural noise + thermal updrafts
Vec3 turbulence = Vec3(
PerlinNoise3D(v * 0.1f),
PerlinNoise3D(v * 0.1f + 10),
PerlinNoise3D(v * 0.1f + 20)
) * flex * 0.5f;
return { lift, drag, turbulence };
}</code>
</pre>
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<div class="bg-gray-700 p-4 rounded-lg">
<h3 class="text-xl font-semibold mb-3 text-primary-500">Parameters</h3>
<ul class="space-y-2">
<li><span class="font-mono text-yellow-300">v</span>: Velocity vector (m/s)</li>
<li><span class="font-mono text-yellow-300">n</span>: Surface normal vector</li>
<li><span class="font-mono text-yellow-300">area</span>: Wing area (m²)</li>
<li><span class="font-mono text-yellow-300">density</span>: Air density (kg/m³)</li>
<li><span class="font-mono text-yellow-300">flex</span>: Wing flexibility coefficient</li>
</ul>
</div>
<div class="bg-gray-700 p-4 rounded-lg">
<h3 class="text-xl font-semibold mb-3 text-primary-500">Returns</h3>
<ul class="space-y-2">
<li><span class="font-mono text-yellow-300">lift</span>: Lift force vector (N)</li>
<li><span class="font-mono text-yellow-300">drag</span>: Drag force vector (N)</li>
<li><span class="font-mono text-yellow-300">turbulence</span>: Turbulence vector (N)</li>
</ul>
</div>
</div>
</section>
<section class="mb-16">
<h2 class="text-2xl font-bold mb-6">Key Concepts</h2>
<div class="space-y-6">
<div class="bg-gray-800 p-6 rounded-xl">
<h3 class="text-xl font-semibold mb-3 text-primary-500">Lift Calculation</h3>
<p class="text-gray-300">
Lift is calculated using the cross product of velocity and surface normal vectors,
scaled by the sine of the angle of attack and wing flexibility. The classic
aerodynamic equation (L = ½ρv²ACₗ) is implemented with real-world coefficients.
</p>
</div>
<div class="bg-gray-800 p-6 rounded-xl">
<h3 class="text-xl font-semibold mb-3 text-primary-500">Drag Modeling</h3>
<p class="text-gray-300">
The drag model combines parasitic and induced drag components, with coefficients
that vary based on angle of attack. The equation (D = ½ρv²ACₔ) includes both
form drag and skin friction components.
</p>
</div>
<div class="bg-gray-800 p-6 rounded-xl">
<h3 class="text-xl font-semibold mb-3 text-primary-500">Turbulence Simulation</h3>
<p class="text-gray-300">
Procedural Perlin noise generates realistic turbulence patterns that affect flight
stability. The intensity scales with wing flexibility and includes simulated
thermal updrafts for dynamic soaring behavior.
</p>
</div>
</div>
</section>
<section>
<h2 class="text-2xl font-bold mb-6">Live Demos</h2>
<div class="space-y-12">
<aero-demo></aero-demo>
<flock-demo></flock-demo>
</div>
</section>
</main>
<custom-footer></custom-footer>
<script src="components/navbar.js"></script>
<script src="components/footer.js"></script>
<script src="components/aero-demo.js"></script>
<script src="components/flock-demo.js"></script>
<script src="script.js"></script>
<script>feather.replace();</script>
</body>
</html>