Compare commits

...

3 Commits

Author SHA1 Message Date
Martin Felis
ed7c7902ec Minor tweaks 2025-11-11 09:29:16 +01:00
Martin Felis
79c878a8e5 Scaled up the UI. 2025-11-11 09:14:33 +01:00
Martin Felis
791bf36b90 Reviving old code. 2025-11-11 09:03:24 +01:00
7 changed files with 10478 additions and 17 deletions

View File

@ -1,4 +1,4 @@
cmake_minimum_required (VERSION 3.3) cmake_minimum_required (VERSION 3.20)
# Defines the project's name # Defines the project's name
project(ozz) project(ozz)

View File

@ -49,7 +49,7 @@ class StdAllocator {
StdAllocator(const StdAllocator&) noexcept {} StdAllocator(const StdAllocator&) noexcept {}
template <class _Other> template <class _Other>
StdAllocator<value_type>(const StdAllocator<_Other>&) noexcept {} StdAllocator(const StdAllocator<_Other>&) noexcept {}
template <class _Other> template <class _Other>
struct rebind { struct rebind {

View File

@ -14,7 +14,11 @@ void SpeedScaleNode::DrawDebugUi() {
// ensure m_time_scale is positive // ensure m_time_scale is positive
m_time_scale = m_time_scale * (is_negative ? -1.f : 1.f); m_time_scale = m_time_scale * (is_negative ? -1.f : 1.f);
ImGui::SliderFloat("Time Scale", &m_time_scale, 0.01f, 5.f); if (ImGui::SliderFloat("Time Scale", &m_time_scale, 0.01f, 2.f)) {
if (fabs(m_time_scale - 1.0) < 0.2) {
m_time_scale = 1.0;
}
}
// and back to the original negative or positive sign // and back to the original negative or positive sign
m_time_scale = m_time_scale * (is_negative ? -1.f : 1.f); m_time_scale = m_time_scale * (is_negative ? -1.f : 1.f);
} }

View File

@ -35,14 +35,14 @@ AnimationController::AnimationController(SkinnedMesh* skinned_mesh)
sampler_node1->SetAnimation(skinned_mesh->m_animations[2], skinned_mesh->m_animation_sync_track[2]); sampler_node1->SetAnimation(skinned_mesh->m_animations[2], skinned_mesh->m_animation_sync_track[2]);
m_anim_nodes.push_back(sampler_node1); m_anim_nodes.push_back(sampler_node1);
// SpeedScaleNode* speed_node = new SpeedScaleNode(this); SpeedScaleNode* speed_node = new SpeedScaleNode(this);
// speed_node->m_name = "SpeedNode0"; speed_node->m_name = "SpeedNode0";
// speed_node->m_input_node = sampler_node0; speed_node->m_input_node = sampler_node0;
// m_anim_nodes.push_back(speed_node); m_anim_nodes.push_back(speed_node);
BlendNode* blend_node = new BlendNode(this); BlendNode* blend_node = new BlendNode(this);
blend_node->m_name = "Blend0"; blend_node->m_name = "Blend0";
blend_node->m_input_A = sampler_node0; blend_node->m_input_A = speed_node;
blend_node->m_input_B = sampler_node1; blend_node->m_input_B = sampler_node1;
blend_node->m_sync_inputs = true; blend_node->m_sync_inputs = true;
m_anim_nodes.push_back(blend_node); m_anim_nodes.push_back(blend_node);

View File

@ -42,8 +42,8 @@ inline void Camera_Init(Camera* camera) {
camera->pitch = 10 * M_PI / 180.0f; camera->pitch = 10 * M_PI / 180.0f;
memcpy(&camera->mtxView, &mtx_identity, sizeof(camera->mtxView)); memcpy(&camera->mtxView, &mtx_identity, sizeof(camera->mtxView));
Camera_CalcToMatrix(camera, &camera->mtxView); Camera_CalcToMatrix(camera, &camera->mtxView[0]);
Camera_CalcFromMatrix(camera, &camera->mtxView); Camera_CalcFromMatrix(camera, &camera->mtxView[0]);
} }
void Camera_CalcFromMatrix(Camera* camera, float* mat) { void Camera_CalcFromMatrix(Camera* camera, float* mat) {
@ -153,6 +153,6 @@ inline void Camera_Update(
camera->vel[i] = camera->vel[i] * 0.1; camera->vel[i] = camera->vel[i] * 0.1;
} }
Camera_CalcToMatrix(camera, &camera->mtxView); Camera_CalcToMatrix(camera, &camera->mtxView[0]);
} }
} }

10441
src/embedded_fonts.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -17,9 +17,10 @@
#include "Camera.h" #include "Camera.h"
#include "SkinnedMesh.h" #include "SkinnedMesh.h"
#include "GLFW/glfw3.h" #include "GLFW/glfw3.h"
#include "embedded_fonts.h"
const int Width = 1024; const int Width = 2420;
const int Height = 768; const int Height = 1480;
const int MaxVertices = (1 << 16); const int MaxVertices = (1 << 16);
const int MaxIndices = MaxVertices * 3; const int MaxIndices = MaxVertices * 3;
@ -233,7 +234,6 @@ int main() {
AnimationController animation_controller (&skinned_mesh); AnimationController animation_controller (&skinned_mesh);
// state.ozz = std::make_unique<ozz_t>();
state.time.factor = 1.0f; state.time.factor = 1.0f;
Camera_Init(&state.camera); Camera_Init(&state.camera);
@ -242,8 +242,24 @@ int main() {
ImGui::CreateContext(); ImGui::CreateContext();
ImGui::StyleColorsDark(); ImGui::StyleColorsDark();
ImGuiIO& io = ImGui::GetIO(); ImGuiIO& io = ImGui::GetIO();
io.IniFilename = nullptr; io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
io.Fonts->AddFontDefault(); io.IniFilename = "ATPImgui.ini";
ImGui::GetStyle().ScaleAllSizes(2.0);
//io.Fonts->AddFontDefault();
ImFontConfig font_config;
font_config.OversampleH = 4;
font_config.OversampleV = 4;
font_config.GlyphExtraSpacing.x = 1.0f;
io.Fonts->AddFontFromMemoryCompressedTTF(
// roboto_medium_ttf_compressed_data,
// roboto_medium_ttf_compressed_size,
droid_sans_ttf_compressed_data,
droid_sans_ttf_compressed_size,
28,
&font_config);
io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB; io.KeyMap[ImGuiKey_Tab] = GLFW_KEY_TAB;
io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT; io.KeyMap[ImGuiKey_LeftArrow] = GLFW_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT; io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT;