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
488f829c
There was an error fetching the commit references. Please try again later.
Commit
488f829c
authored
1 year ago
by
Martin Štourač
Browse files
Options
Downloads
Patches
Plain Diff
objects add into active depth
parent
ce608edd
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/edit/include/edit/editor.hpp
+20
-0
20 additions, 0 deletions
src/edit/include/edit/editor.hpp
src/edit/src/editor.cpp
+8
-1
8 additions, 1 deletion
src/edit/src/editor.cpp
with
28 additions
and
1 deletion
src/edit/include/edit/editor.hpp
+
20
−
0
View file @
488f829c
...
...
@@ -9,6 +9,7 @@
#include
<osi/window.hpp>
#include
<utils/math.hpp>
#include
<array>
#include
<memory>
using
ctrlhub_ptr
=
std
::
shared_ptr
<
ControlHub
>
;
...
...
@@ -19,10 +20,29 @@ namespace edit
enum
class
state
{
select
,
move
,
rotate
,
plus
};
class
Level
{
std
::
array
<
float
,
3
>
axes
=
{
0.0
f
,
0.0
f
,
0.0
f
};
std
::
uint8_t
active
=
2
;
public
:
std
::
uint8_t
getActiveIndex
()
const
{
return
active
;
}
float
getActive
()
const
{
return
axes
[
active
];
}
void
setActiveX
()
{
active
=
0
;
}
void
setActiveY
()
{
active
=
1
;
}
void
setActiveZ
()
{
active
=
2
;
}
Level
&
operator
++
()
{
++
axes
[
active
];
return
*
this
;
}
Level
&
operator
--
()
{
--
axes
[
active
];
return
*
this
;
}
};
class
Editor
{
bool
editor_running
=
false
;
state
control_state
=
state
::
select
;
Level
build_level
;
bool
object_moving
=
false
;
glm
::
vec3
prev_plane_intersect
;
...
...
This diff is collapsed.
Click to expand it.
src/edit/src/editor.cpp
+
8
−
1
View file @
488f829c
...
...
@@ -90,9 +90,16 @@ void Editor::addObject(scene_ptr scene, ctrlhub_ptr controls)
auto
[
ray_position
,
ray_direction
]
=
get_pick_ray
(
scene
,
mouse
,
window
);
float
distance
=
glm
::
length
(
ray_position
-
position
);
bool
cam_is_perspective
=
scene
->
getActiveCameras
()[
0
].
lock
()
->
isPerspective
();
float
distance
=
cam_is_perspective
?
glm
::
length
(
ray_position
-
position
)
:
1.0
f
;
auto
new_item_pos
=
ray_position
+
distance
*
ray_direction
;
if
(
!
cam_is_perspective
)
new_item_pos
[
build_level
.
getActiveIndex
()]
=
build_level
.
getActive
();
Frame
new_item_frame
(
new_item_pos
,
rotation
,
scale
);
Node
selection_copy
(
std
::
make_shared
<
Frame
>
(
new_item_frame
));
...
...
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