textures almost work?

This commit is contained in:
Asuro
2025-02-15 04:13:03 +01:00
parent ab326d3624
commit f93c40f3b6
19 changed files with 643 additions and 456 deletions

View File

@@ -27,7 +27,8 @@ namespace Game
bgfx::setState(currentMaterial.State);
float TimeValues[4]{0.0f};
TimeValues[0] = GetInstance().Now;
TimeValues[0] = GetInstance().Time.Now;
bgfx::setTexture(0, currentMaterial.Textures[0].SamplerHandle, currentMaterial.Textures[0].Handle);
bgfx::setUniform(currentMaterial.Uniforms[Material::UTime], TimeValues);
bgfx::setUniform(currentMaterial.Uniforms[Material::UDotColor], TestColor);
@@ -66,13 +67,40 @@ namespace Game
void Level::Update()
{
if (GetKey(ScanCode::R))
PlayerData& player = GetInstance().Player;
if (GetKeyPressedNow(ScanCode::R))
{
Cubes.Count = 0;
Tests.Count = 0;
Setup(GetShared().Game);
}
float delta = GetInstance().Time.Delta;
constexpr float moveSpeed = 10.0f;
constexpr float rotSpeed = 0.6f;
float forwardInput = (GetKey(ScanCode::W) ? 1.0f : 0.0f) + (GetKey(ScanCode::S) ? -1.0f : 0.0f);
float rightInput = (GetKey(ScanCode::D) ? 1.0f : 0.0f) + (GetKey(ScanCode::A) ? -1.0f : 0.0f);
bx::Vec3 moveInput = bx::Vec3{rightInput, forwardInput, 0.0f};
moveInput = bx::normalize(moveInput);
bx::Vec3 inputVec = {moveInput.x * delta * moveSpeed, 0.0f, moveInput.y * delta * moveSpeed};
bx::Vec3 camForward = player.FreeflyCamTransform.Forward();
bx::Vec3 camRight = player.FreeflyCamTransform.Right();
if (GetMouseButton(MouseButton::Left))
{
Vec2 mouseMovement = GetMouseMovement();
bx::Vec3 rotInput = {mouseMovement.y * delta * rotSpeed, mouseMovement.x * delta * rotSpeed, 0.0f};
player.FreeflyXRot += rotInput.x;
player.FreeflyYRot += rotInput.y;
bx::mtxRotateY(player.FreeflyCamTransform.Rotation.M, player.FreeflyYRot);
player.FreeflyCamTransform.RotateLocal({player.FreeflyXRot, 0.0f, 0.0f});
}
player.FreeflyCamTransform.TranslateLocal({0.0f, 0.0f, -inputVec.z});
player.FreeflyCamTransform.TranslateLocal({-inputVec.x, 0.0f, 0.0f});
Cubes.Update();
Tests.Update();
}
@@ -87,7 +115,7 @@ namespace Game
{
if (TestX >= 0 && TestY >= 0)
{
double globalTime = GetInstance().Now;
double globalTime = GetInstance().Time.Now;
double time = TestY <= 5 ? globalTime * 1.0f : 0.0f;
float scale = 1.0f + TestX * 0.4f;
EData.Transform.Position = bx::Vec3{TestX * 2.0f, TestY * 2.0f, 0.0f};