feat: create transparent overlay for gizmo for easier picking

This commit is contained in:
Nick Fisher
2024-08-27 21:45:19 +08:00
parent 2fc54ae343
commit 727ac7d9df
8 changed files with 1419 additions and 1265 deletions

View File

@@ -35,7 +35,6 @@ class Gizmo {
Gizmo(Engine& engine, View *view, Scene *scene);
~Gizmo();
void updateTransform();
void destroy();
Entity x() {
return _entities[0];
@@ -57,18 +56,21 @@ class Gizmo {
return _isActive;
}
void highlight(Entity entity);
void unhighlight();
void pick(uint32_t x, uint32_t y, void (*callback)(EntityId entityId, int x, int y));
bool isGizmoEntity(Entity entity);
void setVisibility(bool visible);
private:
void createTransparentRectangles();
void highlight(Entity entity);
void unhighlight();
Engine &_engine;
View *_view;
Scene *_scene;
Camera *_camera;
utils::Entity _entities[4] = { utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity() };
utils::Entity _entities[7] = { utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity(), utils::Entity() };
Material* _material;
MaterialInstance* _materialInstances[4];
MaterialInstance* _materialInstances[7];
math::float4 inactiveColors[3] {
math::float4 { 0.75f, 0.0f, 0.0f, 1.0f },
math::float4 { 0.0f, 0.75f, 0.0f, 1.0f },
@@ -80,6 +82,7 @@ class Gizmo {
math::float4 { 0.0f, 0.0f, 1.0f, 1.0f },
};
bool _isActive = true;
};
}

View File

@@ -8,5 +8,5 @@ GIZMO_PACKAGE:
GIZMO_GIZMO_OFFSET:
.int 0
GIZMO_GIZMO_SIZE:
.int 26876
.int 28800

View File

@@ -8,5 +8,5 @@ _GIZMO_PACKAGE:
_GIZMO_GIZMO_OFFSET:
.int 0
_GIZMO_GIZMO_SIZE:
.int 26876
.int 28800

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +1,6 @@
#include <stdint.h>
#include "image.h"
#include <stdint.h>
const uint8_t IMAGE_PACKAGE[] = {
// IMAGE
0x53, 0x52, 0x45, 0x56, 0x5f, 0x54, 0x41, 0x4d, 0x04, 0x00, 0x00, 0x00, 0x33, 0x00, 0x00, 0x00, 0x54, 0x41, 0x45, 0x46,