AVA2 cross-platform client parity baseline

This commit is contained in:
shen
2026-10-06 00:53:42 -07:00
commit 9f748eb05a
3271 changed files with 1275528 additions and 0 deletions
+70
View File
@@ -0,0 +1,70 @@
#pragma once
#include <cstdint>
#include <string>
#include <vector>
#include <cmath>
namespace ava2 {
inline void MakeTransformMatrix(float yawDegrees, float tx, float ty, float tz, float scale, float* out) {
float rad = yawDegrees * 3.14159265358979323846f / 180.0f;
float c = std::cos(rad) * scale;
float s = std::sin(rad) * scale;
out[0] = c; out[1] = 0.0f; out[2] = -s; out[3] = 0.0f;
out[4] = 0.0f; out[5] = scale;out[6] = 0.0f; out[7] = 0.0f;
out[8] = s; out[9] = 0.0f; out[10] = c; out[11] = 0.0f;
out[12] = tx; out[13] = ty; out[14] = tz; out[15] = 1.0f;
}
// Intermediate 3D draw command structure, modeled after 40250 cross-platform architecture.
// Decouples game logic/animation (GR2) from the underlying GPU/software renderer.
struct Render3DDraw {
std::uint64_t geometry_key = 0;
std::uint64_t geometry_revision = 0;
// D3D row-vector matrices (translation in elements 12..14)
float world[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1};
float view[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1};
float proj[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1};
float viewport[4] = {0, 0, 1024, 768}; // x, y, width, height
float viewport_z[2] = {0.0f, 1.0f}; // MinZ, MaxZ
// Textures: file path (e.g. "season1/pc/warrior/warrior_4-1.dds") or memory texture
std::string texture0;
std::string texture1;
// Vertex data
std::vector<float> positions; // 3 floats (x, y, z) per vertex
std::vector<float> normals; // 3 floats (nx, ny, nz) per vertex
std::vector<float> uv0; // 2 floats (u, v) per vertex
std::vector<float> uv1; // 2 floats (u, v) per vertex
std::vector<std::uint32_t> diffuse; // 0xAARRGGBB per vertex
std::vector<std::uint32_t> indices; // Triangle list indices (3 per triangle)
// Skeletal skinning streams
std::vector<std::uint8_t> bone_indices; // 4 uint8 per vertex
std::vector<float> bone_weights; // 4 floats per vertex
std::vector<float> bone_matrices; // 16 floats per bone (palette)
// Render states
bool z_enable = true;
bool z_write = true;
std::uint32_t cull_mode = 2; // 1: None, 2: CW, 3: CCW
bool alpha_blend = false;
std::uint32_t blend_mode = 0; // 0: Alpha (D3DBLEND_INVSRCALPHA), 1: Additive (D3DBLEND_ONE)
bool alpha_test = false;
std::uint32_t alpha_ref = 0;
bool fog = true;
// Lighting & Material
bool lighting = true;
float material_diffuse[4] = {1.0f, 1.0f, 1.0f, 1.0f};
float material_ambient[4] = {0.4f, 0.4f, 0.4f, 1.0f};
float material_emissive[4] = {0.0f, 0.0f, 0.0f, 0.0f};
float light_direction[3] = {0.577f, 0.577f, -0.577f}; // Normalized key light
float light_diffuse[4] = {1.0f, 1.0f, 1.0f, 1.0f};
float light_ambient[4] = {0.3f, 0.3f, 0.3f, 1.0f};
};
} // namespace ava2