Compare commits

...

4 Commits

Author SHA1 Message Date
Martin Felis
2848909981 Added graph design ramblings. 2025-11-21 13:16:32 +01:00
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
8 changed files with 10513 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
project(ozz)

View File

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

35
doc/design.md Normal file
View File

@ -0,0 +1,35 @@
## Graph
### 1. Support of math nodes (or non-AnimNodes in general)
* Enables animators to add custom math for blend inputs or to adjust other inputs (e.g. LookAt or IK
targets).
**Open Issues**
1. When to do the evaluation? Two types of subgraphs:
a) Instant inputs (needed for blend node inputs) that have to be evaluated before
UpdateConnections
b) Processing nodes, e.g. for extracted bones.
### 2. Support of multiple output sockets
* E.g. extract Bone transform
* Increases Node complexity:
* AnimOutput
* AnimOutput + Data
* Data
(Data = bool, float, vec3, quat, ...)
**Open Issues**
1. Unclear when this is actually needed. Using more specific nodes that perform the desired logic
may be better (
c.f. https://dev.epicgames.com/documentation/en-us/unreal-engine/animation-blueprint-bone-driven-controller-in-unreal-engine).
Likely this is not crucial so should be avoided for now.
### 3. Multi-skeleton evaluation
Use case: riding on a horse, interaction between two characters.

View File

@ -14,7 +14,11 @@ void SpeedScaleNode::DrawDebugUi() {
// ensure m_time_scale is positive
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
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]);
m_anim_nodes.push_back(sampler_node1);
// SpeedScaleNode* speed_node = new SpeedScaleNode(this);
// speed_node->m_name = "SpeedNode0";
// speed_node->m_input_node = sampler_node0;
// m_anim_nodes.push_back(speed_node);
SpeedScaleNode* speed_node = new SpeedScaleNode(this);
speed_node->m_name = "SpeedNode0";
speed_node->m_input_node = sampler_node0;
m_anim_nodes.push_back(speed_node);
BlendNode* blend_node = new BlendNode(this);
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_sync_inputs = true;
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;
memcpy(&camera->mtxView, &mtx_identity, sizeof(camera->mtxView));
Camera_CalcToMatrix(camera, &camera->mtxView);
Camera_CalcFromMatrix(camera, &camera->mtxView);
Camera_CalcToMatrix(camera, &camera->mtxView[0]);
Camera_CalcFromMatrix(camera, &camera->mtxView[0]);
}
void Camera_CalcFromMatrix(Camera* camera, float* mat) {
@ -153,6 +153,6 @@ inline void Camera_Update(
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 "SkinnedMesh.h"
#include "GLFW/glfw3.h"
#include "embedded_fonts.h"
const int Width = 1024;
const int Height = 768;
const int Width = 2420;
const int Height = 1480;
const int MaxVertices = (1 << 16);
const int MaxIndices = MaxVertices * 3;
@ -233,7 +234,6 @@ int main() {
AnimationController animation_controller (&skinned_mesh);
// state.ozz = std::make_unique<ozz_t>();
state.time.factor = 1.0f;
Camera_Init(&state.camera);
@ -242,8 +242,24 @@ int main() {
ImGui::CreateContext();
ImGui::StyleColorsDark();
ImGuiIO& io = ImGui::GetIO();
io.IniFilename = nullptr;
io.Fonts->AddFontDefault();
io.ConfigFlags |= ImGuiConfigFlags_DockingEnable;
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_LeftArrow] = GLFW_KEY_LEFT;
io.KeyMap[ImGuiKey_RightArrow] = GLFW_KEY_RIGHT;