-
Notifications
You must be signed in to change notification settings - Fork 27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Simple-Objects Plugin #297
base: main
Are you sure you want to change the base?
Changes from all commits
9060f73
c37c20f
5d5977e
0887b4a
9812e2d
f8c038f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.drawio | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# ------------------------------------------------------------------------------------------------ # | ||
# This file is part of CosmoScout VR # | ||
# and may be used under the terms of the MIT license. See the LICENSE file for details. # | ||
# Copyright: (c) 2022 German Aerospace Center (DLR) # | ||
# ------------------------------------------------------------------------------------------------ # | ||
|
||
option(CSP_SIMPLE_OBJECTS "Enable compilation of this plugin" ON) | ||
|
||
if (NOT CSP_SIMPLE_OBJECTS) | ||
return() | ||
endif() | ||
|
||
# build plugin ------------------------------------------------------------------------------------- | ||
|
||
file(GLOB SOURCE_FILES src/*.cpp) | ||
|
||
# Resoucre files and header files are only added in order to make them available in your IDE. | ||
file(GLOB HEADER_FILES src/*.hpp) | ||
file(GLOB_RECURSE RESOUCRE_FILES gui/*) | ||
|
||
add_library(csp-simple-objects SHARED | ||
${SOURCE_FILES} | ||
${HEADER_FILES} | ||
${RESOUCRE_FILES} | ||
) | ||
|
||
target_link_libraries(csp-simple-objects | ||
PUBLIC | ||
cs-core | ||
) | ||
|
||
# Add this Plugin to a "plugins" folder in your IDE. | ||
set_property(TARGET csp-simple-objects PROPERTY FOLDER "plugins") | ||
|
||
# We mark all resource files as "header" in order to make sure that no one tries to compile them. | ||
set_source_files_properties(${RESOUCRE_FILES} PROPERTIES HEADER_FILE_ONLY TRUE) | ||
|
||
# Make directory structure available in your IDE. | ||
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}" FILES | ||
${SOURCE_FILES} ${HEADER_FILES} ${RESOUCRE_FILES} | ||
) | ||
|
||
# install plugin ----------------------------------------------------------------------------------- | ||
|
||
install(TARGETS csp-simple-objects DESTINATION "share/plugins") | ||
install(DIRECTORY "gui" DESTINATION "share/resources") |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file could be dropped as well :) |
||
|
||
Copyright (c) 2022 German Aerospace Center (DLR) | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Simple Objects for CosmoScout VR | ||
|
||
A CosmoScout VR plugin to import glTF Models, place them and edit their configuration. | ||
|
||
|
||
![](demo_image.png) | ||
|
||
|
||
|
||
|
||
|
||
|
||
Comment on lines
+4
to
+12
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here plenty of empty lines. |
||
## Configuration | ||
|
||
Import all `.gltf` model files to /resources/models and your environment cube maps to /resources/textures. | ||
The files will automatically be copied to the installation path, as you build and install CosmoScout VR. | ||
|
||
|
||
Add a `csp-simple-objects` entry to the plugins in your `settings.json`. | ||
There you can specify all objects and their attributes. | ||
Here is a short example describing possible attributes: | ||
|
||
``` | ||
{ | ||
"plugins": { | ||
... [other plugins] | ||
"csp-simple-objects": { | ||
"objects": { | ||
"<unique name>": { | ||
"modelFile": "<relative path>", | ||
"environmentMap": "<relative path>", | ||
"anchor": "<SPICE center name>", | ||
"lngLat": [ <longitude>, <latitude> ], | ||
|
||
Optional parameters: | ||
"elevation": <float>, | ||
"scale": <float>, | ||
"diagonalLength": <float>, | ||
"rotation": [<x>, <y>, <z>, <w>], | ||
"alignToSurface": <boolean> | ||
}, | ||
... [more objects] | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
|
||
|
||
|
||
## Example | ||
|
||
To achieve the same result as in the demo image above, add this section to your plugins in the scene configuration. | ||
|
||
Here you can find the glTF models of the [Rover](https://mars.nasa.gov/resources/24584/curiosity-rover-3d-model/) and [Avocado](https://github.com/KhronosGroup/glTF-Sample-Models/blob/master/2.0/Avocado/glTF-Binary/Avocado.glb). | ||
The Mars environment map is available in the [textures folder of csp-satellites](../csp-satellites/textures/marsEnvMap.dds). | ||
|
||
|
||
```json | ||
"csp-simple-objects": { | ||
"objects": { | ||
"Avocado": { | ||
"modelFile": "../share/resources/models/Avocado.glb", | ||
"environmentMap": "../share/resources/textures/marsEnvMap.dds", | ||
"anchor": "Mars", | ||
"lngLat": [ | ||
137.39096509050674, | ||
-4.7309278444763345 | ||
], | ||
"elevation": 0.5, | ||
"scale": 40, | ||
"rotation": [ | ||
0.5, 0.5, 0.5, -0.5 | ||
], | ||
"alignToSurface": true | ||
}, | ||
"Curiosity Rover": { | ||
"modelFile": "../share/resources/models/Curiosity_static.glb", | ||
"environmentMap": "../share/resources/textures/marsEnvMap.dds", | ||
"anchor":"Mars", | ||
"lngLat": [ | ||
137.39091093946817, | ||
-4.730935596266577 | ||
], | ||
"elevation": 0.1, | ||
"rotation": [ | ||
0, 0.531, 0, 0.847 | ||
], | ||
"alignToSurface": true | ||
} | ||
} | ||
} | ||
``` |
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
@@ -0,0 +1,50 @@ | ||||||||||
#simple-objects-editor .window-wrapper { | ||||||||||
width: 520px; | ||||||||||
} | ||||||||||
|
||||||||||
#simple-objects-editor .form-control.is-invalid { | ||||||||||
padding-right: 7px; | ||||||||||
background: none; | ||||||||||
} | ||||||||||
|
||||||||||
#simple-objects-editor .disabled:hover { | ||||||||||
/*background-color: rgba(230, 230, 255, 0.1); | ||||||||||
border-bottom: 2px solid var(--cs-color-primary); | ||||||||||
box-shadow: none; | ||||||||||
color: var(--cs-color-text);*/ | ||||||||||
Comment on lines
+11
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can this be removed?
Suggested change
|
||||||||||
pointer-events: none; | ||||||||||
} | ||||||||||
|
||||||||||
#simple-objects-editor .btn.fix-rounded-right { | ||||||||||
height: calc(1.5em + .75rem + 2px); | ||||||||||
} | ||||||||||
|
||||||||||
#simple-objects-editor .filter-option { | ||||||||||
height: auto; | ||||||||||
padding: .375rem .75rem; | ||||||||||
} | ||||||||||
|
||||||||||
#simple-objects-editor label { | ||||||||||
padding: .375rem .75rem; | ||||||||||
} | ||||||||||
|
||||||||||
#simple-objects-editor-pick-location { | ||||||||||
height: calc(1.5em + .75rem + 2px); | ||||||||||
} | ||||||||||
|
||||||||||
#simple-objects-editor-pick-location > i { | ||||||||||
top: -2px; | ||||||||||
} | ||||||||||
|
||||||||||
#simple-objects-editor-pick-location.active { | ||||||||||
color: var(--cs-color-text-highlight); | ||||||||||
text-shadow: var(--cs-text-glow); | ||||||||||
border: 1px dashed var(--cs-color-primary-transparent); | ||||||||||
border-bottom: 2px solid var(--cs-color-text-highlight); | ||||||||||
background-color: var(--cs-color-background-lightest); | ||||||||||
} | ||||||||||
|
||||||||||
#simple-objects-editor-pick-location.disabled { | ||||||||||
top: 0px; | ||||||||||
pointer-events: none; | ||||||||||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file could be dropped.