Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RoFIbots
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Marek Trtík
RoFIbots
Commits
c23b0484
There was an error fetching the commit references. Please try again later.
Commit
c23b0484
authored
10 months ago
by
Martin Štourač
Browse files
Options
Downloads
Patches
Plain Diff
add debug camera axes
parent
bf49d308
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/edit/include/edit/scene.hpp
+5
-0
5 additions, 0 deletions
src/edit/include/edit/scene.hpp
src/edit/src/scene.cpp
+70
-1
70 additions, 1 deletion
src/edit/src/scene.cpp
src/gfx/include/gfx/shapes.hpp
+8
-0
8 additions, 0 deletions
src/gfx/include/gfx/shapes.hpp
with
83 additions
and
1 deletion
src/edit/include/edit/scene.hpp
+
5
−
0
View file @
c23b0484
...
...
@@ -39,6 +39,8 @@ private:
bool
camera_axes_enabled
=
false
;
node_ptr
camera_axes
;
node_ptr
camera_axes_debug
;
node_ptr
grid
;
std
::
vector
<
light_ptr
>
lights
;
...
...
@@ -123,6 +125,7 @@ public:
void
addRotationAxis
(
glm
::
vec3
axis_direction
,
node_ptr
selected_node
);
void
addObjectAxes
(
node_ptr
node
);
void
createCameraAxes
();
void
createCameraAxesDebug
();
bool
containsMesh
(
node_ptr
node
,
mesh_ptr
mesh
);
void
findLights
(
const
std
::
vector
<
node_ptr
>
&
nodes
);
...
...
@@ -139,7 +142,9 @@ public:
void
manageSecondaryHighlights
(
std
::
vector
<
std
::
pair
<
glm
::
vec3
,
node_ptr
>>
hit_node_pairs
);
void
manageCameraAxes
(
bool
enabled
);
void
manageCameraAxesDebug
(
bool
enabled
);
void
updateCameraAxesPosition
();
void
updateCameraAxesDebugPosition
();
void
toggleVisibility
(
node_ptr
node
,
bool
visible
);
};
...
...
This diff is collapsed.
Click to expand it.
src/edit/src/scene.cpp
+
70
−
1
View file @
c23b0484
...
...
@@ -423,14 +423,44 @@ void Scene::createCameraAxes()
rofi_y_axis
->
setDrawMode
(
GL_LINES
);
rofi_z_axis
->
setDrawMode
(
GL_LINES
);
// ordered due to disabled depth test
camera_axes
->
addObject
(
rofi_z_axis
);
camera_axes
->
addObject
(
rofi_x_axis
);
camera_axes
->
addObject
(
rofi_y_axis
);
camera_axes
->
addObject
(
rofi_z_axis
);
ASSUMPTION
(
!
active_cameras
.
empty
());
active_cameras
.
front
().
lock
()
->
getNode
()
->
addChild
(
camera_axes
);
}
void
Scene
::
createCameraAxesDebug
()
{
camera_axes_debug
=
Node
::
create
();
mesh_ptr
debug_x_axis
=
std
::
make_shared
<
Mesh
>
(
shapes
::
debug_axis_x_vertices
,
std
::
vector
<
float
>
{},
shapes
::
debug_axis_indices
);
mesh_ptr
debug_y_axis
=
std
::
make_shared
<
Mesh
>
(
shapes
::
debug_axis_y_vertices
,
std
::
vector
<
float
>
{},
shapes
::
debug_axis_indices
);
mesh_ptr
debug_z_axis
=
std
::
make_shared
<
Mesh
>
(
shapes
::
debug_axis_z_vertices
,
std
::
vector
<
float
>
{},
shapes
::
debug_axis_indices
);
debug_x_axis
->
setMaterial
(
Material
(
color
::
red
));
debug_y_axis
->
setMaterial
(
Material
(
color
::
green
));
debug_z_axis
->
setMaterial
(
Material
(
color
::
blue
));
debug_x_axis
->
setShaderType
(
"interface"
);
debug_y_axis
->
setShaderType
(
"interface"
);
debug_z_axis
->
setShaderType
(
"interface"
);
debug_x_axis
->
setDrawMode
(
GL_LINES
);
debug_y_axis
->
setDrawMode
(
GL_LINES
);
debug_z_axis
->
setDrawMode
(
GL_LINES
);
// ordered due to disabled depth test
camera_axes_debug
->
addObject
(
debug_y_axis
);
camera_axes_debug
->
addObject
(
debug_z_axis
);
camera_axes_debug
->
addObject
(
debug_x_axis
);
ASSUMPTION
(
!
active_cameras
.
empty
());
active_cameras
.
front
().
lock
()
->
getNode
()
->
addChild
(
camera_axes_debug
);
}
bool
Scene
::
containsMesh
(
node_ptr
node
,
mesh_ptr
mesh
)
{
auto
node_mesh
=
getNodeMesh
(
node
);
...
...
@@ -601,6 +631,24 @@ void Scene::manageCameraAxes(bool enabled)
addNode
(
camera_axes
);
}
camera_axes_enabled
=
enabled
;
// TO DO: remove
manageCameraAxesDebug
(
enabled
);
}
void
Scene
::
manageCameraAxesDebug
(
bool
enabled
)
{
if
(
!
enabled
)
{
removeNode
(
camera_axes_debug
);
}
else
{
if
(
!
camera_axes_debug
)
createCameraAxesDebug
();
addNode
(
camera_axes_debug
);
}
}
void
Scene
::
updateCameraAxesPosition
()
...
...
@@ -619,6 +667,27 @@ void Scene::updateCameraAxesPosition()
const
auto
camera_rotation
=
active_cameras
.
front
().
lock
()
->
getNode
()
->
getRotationMatWorld
();
camera_axes
->
setRotationQuat
(
glm
::
inverse
(
camera_rotation
));
// TO DO: remove
updateCameraAxesDebugPosition
();
}
void
Scene
::
updateCameraAxesDebugPosition
()
{
if
(
!
camera_axes_enabled
)
return
;
ASSUMPTION
(
!
active_cameras
.
empty
());
const
auto
active_cam
=
active_cameras
.
front
().
lock
();
const
auto
window_size
=
active_cam
->
getWindowSize
();
const
auto
ratio
=
window_size
.
x
/
window_size
.
y
;
const
auto
screen_offset
=
0.06
f
;
const
auto
x_compensation
=
-
0.01
f
;
camera_axes_debug
->
setPosVec
(
glm
::
vec3
(
screen_offset
*
ratio
+
(
x_compensation
*
ratio
),
screen_offset
,
-
0.15
f
));
const
auto
camera_rotation
=
active_cameras
.
front
().
lock
()
->
getNode
()
->
getRotationMatWorld
();
camera_axes_debug
->
setRotationQuat
(
glm
::
inverse
(
camera_rotation
));
}
void
Scene
::
toggleVisibility
(
node_ptr
node
,
bool
visible
)
...
...
This diff is collapsed.
Click to expand it.
src/gfx/include/gfx/shapes.hpp
+
8
−
0
View file @
c23b0484
...
...
@@ -138,6 +138,14 @@ static std::vector<float> rofi_axis_z_vertices = { 0.0f, 0.0f, 0.0f,
static
std
::
vector
<
float
>
rofi_axis_x_vertices
=
{
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0.01
f
,
};
static
std
::
vector
<
unsigned
int
>
rofi_axis_indices
=
{
0
,
1
,
2
};
static
std
::
vector
<
float
>
debug_axis_x_vertices
=
{
0.0
f
,
0.0
f
,
0.0
f
,
0.01
f
,
0.0
f
,
0.0
f
,
};
static
std
::
vector
<
float
>
debug_axis_y_vertices
=
{
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0.01
f
,
0.0
f
,
};
static
std
::
vector
<
float
>
debug_axis_z_vertices
=
{
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0.0
f
,
0.01
f
,
};
static
std
::
vector
<
unsigned
int
>
debug_axis_indices
=
{
0
,
1
,
2
};
}
#endif
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment