forked from EXOK/Celeste64
-
Notifications
You must be signed in to change notification settings - Fork 13
Add an in-game editor #62
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
Draft
psyGamer
wants to merge
101
commits into
FujiAPI:dev
Choose a base branch
from
psyGamer:editor
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
101 commits
Select commit
Hold shift + click to select a range
153af07
Setup initial editor scene
psyGamer 2d1214b
Use Renogare font
psyGamer 27abb15
Only show debug menu when inside a World
psyGamer af38d56
Add test window
psyGamer bc4be55
Render basic cube
psyGamer 08db58c
Add camera movement
psyGamer 174e6e9
Use mouse for rotation
psyGamer c8f5117
Add selection support
psyGamer 6b29d78
Add position, rotation and scale definition properties
psyGamer 7e5dee3
Add example color property
psyGamer cc132d3
Add reload support for the editor
psyGamer cbc6265
Rename Map to SledgeMap
psyGamer 04d83b9
Abstract away sledge map loading to common Map type
psyGamer cd8865d
Setup initial Fuji map format loading
psyGamer cb7bd9c
Load basic metadata in Fuji format
psyGamer c1afe06
Add editor definition (de)serialization
psyGamer 8666632
Separate the data and editor definition
psyGamer 5220192
Load solid quad for test definition
psyGamer 8f37772
Load the map in the editor
psyGamer a2a830f
Make editor camera "smaller"
psyGamer 2911562
Use view-normal based shading, like Blender
psyGamer b0246b9
Highlight selected object with an outline
psyGamer 64ce2a8
Fix highlight line wrapping around the screen edges
psyGamer e8e5998
Clean-up some accidental changes
psyGamer f93b484
Revert more accidental changes
psyGamer 409eb26
Inherit World for editor
psyGamer 31617ab
Re-add camera controls to the editor
psyGamer 1d84b96
Tweak world rendering for editor
psyGamer 557948f
Properly call Entered/Exited
psyGamer 8a4a668
Setup ray casting for selecting actors
psyGamer b4feb3e
Determine ray cast direction based on mouse position
psyGamer adcef60
Port over Batcher3D from Celeste64-TAS
psyGamer 73026bd
Fix object selection sometimes not working
psyGamer 614da0a
Add OBB intersection method for the future
psyGamer 067fa49
Highlight currently selected actor
psyGamer b48c889
Render selected outline in front of everything else
psyGamer 5180474
Scale line thickness based on distance
psyGamer daedf3a
Attach ActorDefinition to Actor
psyGamer 31c0d63
Mark ActorDefinition as dirty when value is changed
psyGamer a400b8e
Use oriented bounding boxes
psyGamer 23e54cb
Merge remote-tracking branch 'upstream/dev' into editor
psyGamer 57fc8fb
Merge remote-tracking branch 'upstream/dev' into editor
psyGamer 5725fe3
Remove unused code from editor
psyGamer 1a110fb
Recreate actors of definition every time its changed
psyGamer 01fac4e
Re-enable map serialization
psyGamer 13ae81c
Merge FujiMapWriter with FujiMap
psyGamer 4e9c974
Draw world bounds of selected actors
psyGamer a8d7ffa
Merge remote-tracking branch 'upstream/dev' into editor
psyGamer a2d8454
Run format pass over editor
psyGamer 8b21388
Code cleanup
psyGamer 521eb7a
Fix ImGui not receiving keyboard inputs
psyGamer b0ecb9d
Add settings window for environment
psyGamer 49d1289
Add main menu bar for changing view settings
psyGamer f3d874f
Properly handle toggling music/ambience
psyGamer 30dcb8b
Add render distance and resolution options
psyGamer b9f2ed7
Fix "Audio Event doesn't exist" warnings
psyGamer 27e1e69
Improve actor editor window
psyGamer 29dbb61
Properly reload editor scene
psyGamer fc5e2f5
Add support for removing actors
psyGamer d17f925
Prevent snow from being selected
psyGamer e718b95
Add 720p resolution option
psyGamer 2633876
Clean-up Batcher3D a bit
psyGamer c2842f6
Add cone shape to Batcher3D
psyGamer b87e1ba
Draw movement gizmos
psyGamer 6b25fcc
Draw XYZ move cube
psyGamer bab4c11
Draw XZ/YZ/XY move planes
psyGamer f0f279e
Use better ray/OBB intersection method
psyGamer bd492fa
Add selection support for the position gizmo
psyGamer 1fc6d68
Add dragging support to position gizmo
psyGamer 16071bf
Refactor out gizmo logic into the gizmo itself
psyGamer 3f9c305
Improve gizmo dragging experience
psyGamer 9a3672d
Improve position gizmo colors
psyGamer 65c0794
Choose much better colors for the axis
psyGamer 7a33aa2
Code formatting
psyGamer 8885c57
Apply outline to gizmos
psyGamer c105b76
Fix definitions not being added sometimes
psyGamer 32d158a
Generalize PositionGizmo to any property
psyGamer 502835c
Tweak names of attributes for definition properties
psyGamer 0519ffb
Remove requirement of SpikeBlock.Definition for dragging
psyGamer 8a89d5d
Fix RenderGui of custom properties
psyGamer f7449e6
Add basic ActorDefinition for solids
psyGamer 5cf5292
Fix CVE Severity 9.8 critical in map parser
psyGamer 0e746f7
Add custom SelectionTypes for definitions
psyGamer a8277fb
Blacklist SelectionTypes in (de)serialization
psyGamer ecfe0bf
Add hover and drag support to SelectionTargets
psyGamer 1fae743
Refactor gizmos to use SelectionTargets
psyGamer 936119b
Fully refactor gizmos for SelectionTargets
psyGamer 33dc92d
Add vertex position editing
psyGamer 0dd00a1
Allow editing vertices of adjacent faces
psyGamer 357b6c7
Improve selection logic
psyGamer 37c5b2a
Use smaller gizmos for vertex editing
psyGamer a4a9cdf
Merge remote-tracking branch 'upstream/dev' into editor
psyGamer 6098895
Generalize GeometryDefinition
psyGamer faeba70
Setup window for actor selection
psyGamer 105624d
Add debug key to enable ImGui demo window
psyGamer baaac0d
Setup an initial tool system
psyGamer f7b68aa
Add a tool selection window
psyGamer adbcd65
Only enable selection for certain tools
psyGamer 4aebe50
Implement basic actor placement
psyGamer 4bf43a9
Add toggle for playing animations
psyGamer df4043c
Access top-scene in crash handler more safely
psyGamer File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| VERTEX: | ||
| #version 330 | ||
|
|
||
| layout(location=0) in vec2 a_pos; | ||
| layout(location=1) in vec2 a_tex; | ||
|
|
||
|
|
||
| out vec2 v_tex; | ||
|
|
||
| void main(void) | ||
| { | ||
| gl_Position = vec4(a_pos, 0, 1); | ||
| v_tex = a_tex; | ||
|
|
||
| } | ||
|
|
||
| FRAGMENT: | ||
| #version 330 | ||
| #include Partials/Methods.gl | ||
|
|
||
| uniform sampler2D u_objectID; | ||
| uniform float u_selectedID; | ||
|
|
||
| uniform vec2 u_pixel; | ||
| uniform vec4 u_edge; | ||
|
|
||
| in vec2 v_tex; | ||
| out vec4 o_color; | ||
|
|
||
| float objectID(vec2 uv) | ||
| { | ||
| const float Eps = 0.0001; | ||
| return texture(u_objectID, clamp(uv, vec2(Eps), vec2(1.0 - Eps))).r; | ||
| } | ||
|
|
||
| void main(void) | ||
| { | ||
| float a = objectID(v_tex + vec2(u_pixel.x, 0)); | ||
| float b = objectID(v_tex + vec2(-u_pixel.x, 0)); | ||
| float c = objectID(v_tex + vec2(0, u_pixel.y)); | ||
| float d = objectID(v_tex + vec2(0, -u_pixel.y)); | ||
|
|
||
| float it = objectID(v_tex); | ||
| float other = | ||
| a * 0.25 + | ||
| b * 0.25 + | ||
| c * 0.25 + | ||
| d * 0.25; | ||
|
|
||
| float edge = step(0.0001, other - it); | ||
|
|
||
| if (u_selectedID == 0 || edge == 0 || !(a == u_selectedID || b == u_selectedID || c == u_selectedID || d == u_selectedID || it == u_selectedID)) | ||
| discard; | ||
|
|
||
| o_color = vec4(vec3(u_edge), 1); | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| VERTEX: | ||
| #version 330 | ||
| #include Partials/Methods.gl | ||
|
|
||
| uniform mat4 u_mvp; | ||
| uniform mat4 u_model; | ||
| uniform mat4 u_view; | ||
|
|
||
| layout(location=0) in vec3 a_position; | ||
| layout(location=1) in vec2 a_tex; | ||
| layout(location=2) in vec3 a_color; | ||
| layout(location=3) in vec3 a_normal; | ||
|
|
||
| out vec2 v_tex; | ||
| out vec3 v_color; | ||
| out vec3 v_normal; | ||
| out vec3 v_world; | ||
|
|
||
| void main(void) | ||
| { | ||
| gl_Position = u_mvp * vec4(a_position, 1.0); | ||
|
|
||
| v_tex = a_tex; | ||
| v_color = a_color; | ||
| v_normal = TransformNormal(a_normal, u_view * u_model); | ||
| v_world = vec3(u_model * vec4(a_position, 1.0)); | ||
| } | ||
|
|
||
| FRAGMENT: | ||
| #version 330 | ||
| #include Partials/Methods.gl | ||
|
|
||
| uniform sampler2D u_texture; | ||
| uniform vec4 u_color; | ||
| uniform float u_near; | ||
| uniform float u_far; | ||
| uniform vec3 u_sun; | ||
| //uniform float u_cutout; | ||
| uniform float u_objectID; | ||
|
|
||
| in vec2 v_tex; | ||
| in vec3 v_normal; | ||
| in vec3 v_color; | ||
| in vec3 v_world; | ||
|
|
||
| layout(location = 0) out vec4 o_color; | ||
| layout(location = 1) out vec4 o_objectID; | ||
|
|
||
| void main(void) | ||
| { | ||
| // Get texture color | ||
| vec4 src = texture(u_texture, v_tex) * u_color * vec4(v_color, 1); | ||
|
|
||
| // TODO: only enable if you want ModelFlags.Cutout types to work, didn't end up using | ||
| // if (src.a < u_cutout) | ||
| // discard; | ||
|
|
||
| // Apply depth values | ||
| float depth = LinearizeDepth(gl_FragCoord.z, u_near, u_far); | ||
| gl_FragDepth = depth; | ||
|
|
||
| // Apply shading based on normal relative to the camera | ||
| float shade = clamp(dot(v_normal, vec3(0, 0, 1)), 0.2, 1.0); | ||
| src.rgb *= vec3(shade); | ||
|
|
||
| o_color = vec4(src.rgb, 1); | ||
| // TODO: Support object IDs above 255, since its just 8bits | ||
| // NOTE: This is still only a float output, however we need to set alpha to avoid weird blending. | ||
| o_objectID = vec4(u_objectID / 255.0, 0, 0, 1); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I feel like "bin" might be a pretty common file extension in general. If this is a custom format, we may want to come up with a custom extension, just to avoid confusion.