-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: PrimitiveCreationOption abstract class added
- Loading branch information
1 parent
36c2078
commit 5c3fd21
Showing
6 changed files
with
76 additions
and
131 deletions.
There are no files selected for viewing
This file contains 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
27 changes: 3 additions & 24 deletions
27
src/Stride.CommunityToolkit/Engine/Primitive2DCreationOptions.cs
This file contains 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 |
---|---|---|
@@ -1,40 +1,19 @@ | ||
using Stride.Engine; | ||
using Stride.Engine; | ||
using Stride.Physics; | ||
using Stride.Rendering; | ||
|
||
namespace Stride.CommunityToolkit.Engine; | ||
|
||
public class Primitive2DCreationOptions | ||
public class Primitive2DCreationOptions : PrimitiveCreationOptions | ||
{ | ||
/// <summary> | ||
/// Gets or sets the name of the entity. | ||
/// </summary> | ||
public string? EntityName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the material to be applied to the primitive model. | ||
/// </summary> | ||
public Material? Material { get; set; } | ||
|
||
/// <summary> | ||
/// Determines whether to include a collider component in the entity. Defaults to true. | ||
/// </summary> | ||
public bool IncludeCollider { get; set; } = true; | ||
|
||
/// <summary> | ||
/// Gets or sets the size of the primitive model. If null, default dimensions are used. | ||
/// </summary> | ||
public Vector2? Size { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the render group for the entity. Defaults to RenderGroup.Group0. | ||
/// </summary> | ||
public RenderGroup RenderGroup { get; set; } = RenderGroup.Group0; | ||
public float Depth { get; set; } = 0.04f; | ||
|
||
/// <summary> | ||
/// Gets or sets the physics component to be added to the entity. Defaults to a new instance of RigidbodyComponent. | ||
/// </summary> | ||
public PhysicsComponent? PhysicsComponent { get; set; } = new RigidbodyComponent(); | ||
|
||
public float Depth { get; set; } = 0.04f; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/Stride.CommunityToolkit/Engine/Primitive2DCreationOptionsWithBepu.cs
This file contains 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,20 @@ | ||
using Stride.BepuPhysics; | ||
using Stride.BepuPhysics.Definitions.Colliders; | ||
using Stride.CommunityToolkit.Bepu; | ||
|
||
namespace Stride.CommunityToolkit.Engine; | ||
|
||
public class Primitive2DCreationOptionsWithBepu : PrimitiveCreationOptions | ||
{ | ||
/// <summary> | ||
/// Gets or sets the size of the primitive model. If null, default dimensions are used. | ||
/// </summary> | ||
public Vector2? Size { get; set; } | ||
|
||
public float Depth { get; set; } = 1; | ||
|
||
/// <summary> | ||
/// Gets or sets the physics component to be added to the entity. | ||
/// </summary> | ||
public ContainerComponent Component { get; set; } = new Body2DComponent() { Collider = new CompoundCollider() }; | ||
} |
103 changes: 1 addition & 102 deletions
103
src/Stride.CommunityToolkit/Engine/Primitive3DCreationOptions.cs
This file contains 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 |
---|---|---|
@@ -1,121 +1,20 @@ | ||
using Stride.BepuPhysics; | ||
using Stride.BepuPhysics.Definitions.Colliders; | ||
using Stride.Engine; | ||
using Stride.Physics; | ||
using Stride.Rendering; | ||
|
||
namespace Stride.CommunityToolkit.Engine; | ||
|
||
/// <summary> | ||
/// Provides options for creating a primitive entity in a 3D scene. | ||
/// </summary> | ||
public class Primitive3DCreationOptions | ||
public class Primitive3DCreationOptions : PrimitiveCreationOptions | ||
{ | ||
/// <summary> | ||
/// Gets or sets the name of the entity. | ||
/// </summary> | ||
public string? EntityName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the material to be applied to the primitive model. | ||
/// </summary> | ||
public Material? Material { get; set; } | ||
|
||
/// <summary> | ||
/// Determines whether to include a collider component in the entity. Defaults to true. | ||
/// </summary> | ||
public bool IncludeCollider { get; set; } = true; | ||
|
||
/// <summary> | ||
/// Gets or sets the size of the primitive model. If null, default dimensions are used. | ||
/// </summary> | ||
public Vector3? Size { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the render group for the entity. Defaults to RenderGroup.Group0. | ||
/// </summary> | ||
public RenderGroup RenderGroup { get; set; } = RenderGroup.Group0; | ||
|
||
/// <summary> | ||
/// Indicates whether the primitive is 2D. Defaults to false. | ||
/// </summary> | ||
public bool Is2D { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the physics component to be added to the entity. Defaults to a new instance of RigidbodyComponent. | ||
/// </summary> | ||
public PhysicsComponent? PhysicsComponent { get; set; } = new RigidbodyComponent(); | ||
} | ||
|
||
/// <summary> | ||
/// Provides options for creating a primitive entity in a 3D scene. | ||
/// </summary> | ||
public class Primitive3DCreationOptionsWithBepu | ||
{ | ||
/// <summary> | ||
/// Gets or sets the name of the entity. | ||
/// </summary> | ||
public string? EntityName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the material to be applied to the primitive model. | ||
/// </summary> | ||
public Material? Material { get; set; } | ||
|
||
/// <summary> | ||
/// Determines whether to include a collider component in the entity. Defaults to true. | ||
/// </summary> | ||
public bool IncludeCollider { get; set; } = true; | ||
|
||
/// <summary> | ||
/// Gets or sets the size of the primitive model. If null, default dimensions are used. | ||
/// </summary> | ||
public Vector3? Size { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the render group for the entity. Defaults to RenderGroup.Group0. | ||
/// </summary> | ||
public RenderGroup RenderGroup { get; set; } = RenderGroup.Group0; | ||
|
||
/// <summary> | ||
/// Gets or sets the physics component to be added to the entity. | ||
/// </summary> | ||
public ContainerComponent Component { get; set; } = new BodyComponent() { Collider = new CompoundCollider() }; | ||
|
||
public float Depth { get; set; } = 0.04f; | ||
} | ||
|
||
public class Primitive2DCreationOptionsWithBepu | ||
{ | ||
/// <summary> | ||
/// Gets or sets the name of the entity. | ||
/// </summary> | ||
public string? EntityName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the material to be applied to the primitive model. | ||
/// </summary> | ||
public Material? Material { get; set; } | ||
|
||
/// <summary> | ||
/// Determines whether to include a collider component in the entity. Defaults to true. | ||
/// </summary> | ||
public bool IncludeCollider { get; set; } = true; | ||
|
||
/// <summary> | ||
/// Gets or sets the size of the primitive model. If null, default dimensions are used. | ||
/// </summary> | ||
public Vector2? Size { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the render group for the entity. Defaults to RenderGroup.Group0. | ||
/// </summary> | ||
public RenderGroup RenderGroup { get; set; } = RenderGroup.Group0; | ||
|
||
/// <summary> | ||
/// Gets or sets the physics component to be added to the entity. | ||
/// </summary> | ||
public ContainerComponent Component { get; set; } = new Body2DComponent() { Collider = new CompoundCollider() }; | ||
|
||
public float Depth { get; set; } = 1; | ||
} |
20 changes: 20 additions & 0 deletions
20
src/Stride.CommunityToolkit/Engine/Primitive3DCreationOptionsWithBepu.cs
This file contains 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,20 @@ | ||
using Stride.BepuPhysics; | ||
using Stride.BepuPhysics.Definitions.Colliders; | ||
|
||
namespace Stride.CommunityToolkit.Engine; | ||
|
||
/// <summary> | ||
/// Provides options for creating a primitive entity in a 3D scene. | ||
/// </summary> | ||
public class Primitive3DCreationOptionsWithBepu : PrimitiveCreationOptions | ||
{ | ||
/// <summary> | ||
/// Gets or sets the size of the primitive model. If null, default dimensions are used. | ||
/// </summary> | ||
public Vector3? Size { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the physics component to be added to the entity. | ||
/// </summary> | ||
public ContainerComponent Component { get; set; } = new BodyComponent() { Collider = new CompoundCollider() }; | ||
} |
26 changes: 26 additions & 0 deletions
26
src/Stride.CommunityToolkit/Engine/PrimitiveCreationOptions.cs
This file contains 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,26 @@ | ||
using Stride.Rendering; | ||
|
||
namespace Stride.CommunityToolkit.Engine; | ||
|
||
public abstract class PrimitiveCreationOptions | ||
{ | ||
/// <summary> | ||
/// Gets or sets the name of the entity. | ||
/// </summary> | ||
public string? EntityName { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the material to be applied to the primitive model. | ||
/// </summary> | ||
public Material? Material { get; set; } | ||
|
||
/// <summary> | ||
/// Determines whether to include a collider component in the entity. Defaults to true. | ||
/// </summary> | ||
public bool IncludeCollider { get; set; } = true; | ||
|
||
/// <summary> | ||
/// Gets or sets the render group for the entity. Defaults to RenderGroup.Group0. | ||
/// </summary> | ||
public RenderGroup RenderGroup { get; set; } = RenderGroup.Group0; | ||
} |