Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
f8005cb6
Unverified
Commit
f8005cb6
authored
May 26, 2020
by
Rémi Verschelde
Committed by
GitHub
May 26, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #28289 from aaronfranke/grid
Dynamic infinite 3D grid
parents
da73cd57
88796258
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
9 deletions
+31
-9
editor_settings.cpp
editor/editor_settings.cpp
+29
-8
node_3d_editor_plugin.cpp
editor/plugins/node_3d_editor_plugin.cpp
+0
-0
node_3d_editor_plugin.h
editor/plugins/node_3d_editor_plugin.h
+1
-0
test_math.cpp
main/tests/test_math.cpp
+1
-1
No files found.
editor/editor_settings.cpp
View file @
f8005cb6
...
...
@@ -503,17 +503,38 @@ void EditorSettings::_load_defaults(Ref<ConfigFile> p_extra_config) {
_initial_set
(
"editors/grid_map/pick_distance"
,
5000.0
);
// 3D
_initial_set
(
"editors/3d/primary_grid_color"
,
Color
(
0.56
,
0.56
,
0.56
));
hints
[
"editors/3d/primary_grid_color"
]
=
PropertyInfo
(
Variant
::
COLOR
,
"editors/3d/primary_grid_color"
,
PROPERTY_HINT_
COLOR_NO_ALPHA
,
""
,
PROPERTY_USAGE_DEFAULT
|
PROPERTY_USAGE_RESTART_IF_CHANGED
);
_initial_set
(
"editors/3d/primary_grid_color"
,
Color
(
0.56
,
0.56
,
0.56
,
0.5
));
hints
[
"editors/3d/primary_grid_color"
]
=
PropertyInfo
(
Variant
::
COLOR
,
"editors/3d/primary_grid_color"
,
PROPERTY_HINT_
NONE
,
""
,
PROPERTY_USAGE_DEFAULT
);
_initial_set
(
"editors/3d/secondary_grid_color"
,
Color
(
0.38
,
0.38
,
0.38
));
hints
[
"editors/3d/secondary_grid_color"
]
=
PropertyInfo
(
Variant
::
COLOR
,
"editors/3d/secondary_grid_color"
,
PROPERTY_HINT_COLOR_NO_ALPHA
,
""
,
PROPERTY_USAGE_DEFAULT
|
PROPERTY_USAGE_RESTART_IF_CHANGED
);
_initial_set
(
"editors/3d/grid_size"
,
50
);
hints
[
"editors/3d/grid_size"
]
=
PropertyInfo
(
Variant
::
INT
,
"editors/3d/grid_size"
,
PROPERTY_HINT_RANGE
,
"1,500,1"
,
PROPERTY_USAGE_DEFAULT
|
PROPERTY_USAGE_RESTART_IF_CHANGED
);
_initial_set
(
"editors/3d/secondary_grid_color"
,
Color
(
0.38
,
0.38
,
0.38
,
0.5
));
hints
[
"editors/3d/secondary_grid_color"
]
=
PropertyInfo
(
Variant
::
COLOR
,
"editors/3d/secondary_grid_color"
,
PROPERTY_HINT_NONE
,
""
,
PROPERTY_USAGE_DEFAULT
);
// If a line is a multiple of this, it uses the primary grid color.
_initial_set
(
"editors/3d/primary_grid_steps"
,
10
);
hints
[
"editors/3d/primary_grid_steps"
]
=
PropertyInfo
(
Variant
::
INT
,
"editors/3d/primary_grid_steps"
,
PROPERTY_HINT_RANGE
,
"1,100,1"
,
PROPERTY_USAGE_DEFAULT
|
PROPERTY_USAGE_RESTART_IF_CHANGED
);
hints
[
"editors/3d/primary_grid_steps"
]
=
PropertyInfo
(
Variant
::
INT
,
"editors/3d/primary_grid_steps"
,
PROPERTY_HINT_RANGE
,
"1,100,1"
,
PROPERTY_USAGE_DEFAULT
);
// At 1000, the grid mostly looks like it has no edge.
_initial_set
(
"editors/3d/grid_size"
,
200
);
hints
[
"editors/3d/grid_size"
]
=
PropertyInfo
(
Variant
::
INT
,
"editors/3d/grid_size"
,
PROPERTY_HINT_RANGE
,
"1,2000,1"
,
PROPERTY_USAGE_DEFAULT
);
// Default largest grid size is 100m, 10^2 (primary grid lines are 1km apart when primary_grid_steps is 10).
_initial_set
(
"editors/3d/grid_division_level_max"
,
2
);
// Higher values produce graphical artifacts when far away unless View Z-Far
// is increased significantly more than it really should need to be.
hints
[
"editors/3d/grid_division_level_max"
]
=
PropertyInfo
(
Variant
::
INT
,
"editors/3d/grid_division_level_max"
,
PROPERTY_HINT_RANGE
,
"-1,3,1"
,
PROPERTY_USAGE_DEFAULT
);
// Default smallest grid size is 1cm, 10^-2.
_initial_set
(
"editors/3d/grid_division_level_min"
,
-
2
);
// Lower values produce graphical artifacts regardless of view clipping planes, so limit to -2 as a lower bound.
hints
[
"editors/3d/grid_division_level_min"
]
=
PropertyInfo
(
Variant
::
INT
,
"editors/3d/grid_division_level_min"
,
PROPERTY_HINT_RANGE
,
"-2,2,1"
,
PROPERTY_USAGE_DEFAULT
);
// -0.2 seems like a sensible default. -1.0 gives Blender-like behavior, 0.5 gives huge grids.
_initial_set
(
"editors/3d/grid_division_level_bias"
,
-
0.2
);
hints
[
"editors/3d/grid_division_level_bias"
]
=
PropertyInfo
(
Variant
::
FLOAT
,
"editors/3d/grid_division_level_bias"
,
PROPERTY_HINT_RANGE
,
"-1.0,0.5,0.1"
,
PROPERTY_USAGE_DEFAULT
);
_initial_set
(
"editors/3d/grid_xz_plane"
,
true
);
_initial_set
(
"editors/3d/grid_xy_plane"
,
false
);
_initial_set
(
"editors/3d/grid_yz_plane"
,
false
);
_initial_set
(
"editors/3d/default_fov"
,
70.0
);
_initial_set
(
"editors/3d/default_z_near"
,
0.05
);
...
...
editor/plugins/node_3d_editor_plugin.cpp
View file @
f8005cb6
This diff is collapsed.
Click to expand it.
editor/plugins/node_3d_editor_plugin.h
View file @
f8005cb6
...
...
@@ -766,6 +766,7 @@ public:
Ref
<
ArrayMesh
>
get_scale_gizmo
(
int
idx
)
const
{
return
scale_gizmo
[
idx
];
}
Ref
<
ArrayMesh
>
get_scale_plane_gizmo
(
int
idx
)
const
{
return
scale_plane_gizmo
[
idx
];
}
void
update_grid
();
void
update_transform_gizmo
();
void
update_all_gizmos
(
Node
*
p_node
=
nullptr
);
void
snap_selected_nodes_to_floor
();
...
...
main/tests/test_math.cpp
View file @
f8005cb6
...
...
@@ -482,7 +482,7 @@ MainLoop *test() {
float
gb
=
(
rgbe
>>
9
)
&
0x1ff
;
float
bb
=
(
rgbe
>>
18
)
&
0x1ff
;
float
eb
=
(
rgbe
>>
27
);
float
mb
=
Math
::
pow
(
2
,
eb
-
15.0
-
9.0
);
float
mb
=
Math
::
pow
(
2
.0
,
eb
-
15.0
-
9.0
);
float
rd
=
rb
*
mb
;
float
gd
=
gb
*
mb
;
float
bd
=
bb
*
mb
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment