Skip to content
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

[WIP] Base spline support #1287

Draft
wants to merge 121 commits into
base: master
Choose a base branch
from
Draft

[WIP] Base spline support #1287

wants to merge 121 commits into from

Conversation

Aggror
Copy link
Member

@Aggror Aggror commented Jan 19, 2022

PR Details

This PR contains basic support for creating splines and visualizing those splines.

  • 3 new components: SplineComponent, SplineNodeComponent and SplineTraverserComponent
  • Visualisation is supported in the editor by viewing
  • Curves
  • Boundingboxes
  • Nodes
  • Other spline components are in the works as well, but purposely left out to focus on getting the core for Splines better in shape. That is also the reason there is no documentation written yet.
  • SplineMeshComponent
  • SplineDecoratorComponent

Motivation and Context

Splines are useful for camera paths, or any other object that requires bezier curve for movement, generating geometry and for distributing geometry (see prototype video). This first PR should cover the creation and editing of the spline.

Description

(outdate, should make a new one)
For a full overview see this video which is specifically recorded for this PR:
https://youtu.be/auLS9RObIXY
Demo project: https://github.com/Aggror/SplineTools/tree/Spline-PR-1-demo

A spline entity exists out of SplineNodes (also entities) which are its children. These can be created entirely by code if so desired. To make them slightly more user friendly, these objects are utilised in components so that an editor user can view them inside the editor.

Some details

  • A spline exists out out nodes. 1 node that connects to another is called a (cubic bezier) curve
  • An entity contains the SplineComponent
  • The children of this entity should contain the SplineNodeComponent
  • The SplineComponent holds a reference to the children SplineNodeComponents
  • There need to be at least 2 SplineNodeComponents (only 1 per entity allowed) before a spline is calculated
  • The SplineComponent holds an internal SplineRenderer which generates spline visualisation geometry when the spline is updated. Previously generated meshes are discarded upon updating spline.

Spline traverser
An entity with a reference to the spline, can traverse the spline. A basic Spline traverser component has been added that support moving forward and backwards along the spline.

Types of changes

  • Docs change / refactoring / dependency upgrade
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • My change requires a change to the documentation.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Aggror added 30 commits July 19, 2021 22:55
# Conflicts:
#	sources/engine/Stride.Engine/Engine/Splines/Components/SplineComponent.cs
#	sources/engine/Stride.Engine/Engine/Splines/Components/SplineNodeComponent.cs
#	sources/engine/Stride.Engine/Engine/Splines/Components/SplineTravellerComponent.cs
DestroySplineRenderer(null, entity);
component.Spline.OnSplineDirty -= data.OnSplineDirtyAction;
entity.Transform.PostOperations.Remove(data.TransformOperation);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably better to add splineComponentsToUpdate.Remove(component) in case it gets added and removed without a frame running in between (it can happen if components are manually removed after a load, etc.)

{
component.SplineComponent.Spline.OnSplineDirty -= data.OnSplineDirtyAction;
entity.Transform.PostOperations.Remove(data.TransformOperation);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing splineTraverserComponents.Remove()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants