Improved particles and tested on some objects #434

Merged
Xenosas1337 merged 3 commits from SP3-1-Rendering into main 2023-03-21 15:30:13 +08:00
19 changed files with 691 additions and 7 deletions

View File

@ -7124,7 +7124,7 @@
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -2.50000072, y: 0.799999893, z: -4.28408909}
Translate: {x: -2.51287055, y: 0.799999893, z: -4.28408909}
Rotate: {x: -5.83341553e-08, y: 7.48974247e-14, z: 1.10461471e-08}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
@ -8179,3 +8179,74 @@
Clicked: false
IsActive: true
Scripts: ~
- EID: 523
Name: Mesh_Apple
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -7.29431438, y: 1.17736602, z: -4.53253984}
Rotate: {x: -5.83341553e-08, y: 7.48974247e-14, z: 1.10461471e-08}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Renderable Component:
Mesh: 144128170
Material: 122370915
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true
Interpolate: false
Sleeping Enabled: true
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 2
Type: Box
Half Extents: {x: 0.200000003, y: 0.200000003, z: 0.200000003}
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
classSHADE::SHParticleEmitterComponent:
Emission Count: 4
Is Passive: false
Emission Interval: 0
Min Life: 1
Max Life: 2
Minimum Speed: 1
Maximum Speed: 1.5
Minimum Size: 0
Maximum Size: 0.075000003
Size Decay: 0.907999992
Angular Ranges And Offset: {x: 6.19999981, y: 3.1400001, z: 0, w: 1.70000005}
Rotation Speed: 0.805999994
Rotation Decay: 0
Texture Asset ID: 0
Custom Update Shader Asset ID: 0
Color Tint: {x: 0.470701218, y: 0.559471369, z: 0.283432603, w: 1}
Acceleration: {x: 0, y: -0.0390000008, z: 0}
IsActive: true
Scripts:
- Type: Item
Enabled: true
Score: 10
currCategory: 0
density: 1
dontReturn: false
soundDistance: 10
highlightSpeed: 200
highlightThickness: 60
highlightLowerClamp: 0.25

177
Assets/Scenes/Scene2.shade Normal file
View File

@ -0,0 +1,177 @@
- EID: 0
Name: Default
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0.304069757, z: 1.73034382}
Rotate: {x: 0, y: 0, z: 0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Camera Component:
Position: {x: 0, y: 0.304069757, z: 1.73034382}
Pitch: 0
Yaw: 0
Roll: 0
Width: 1200
Near: 0.00999999978
Far: 10000
Perspective: true
FOV: 90
IsActive: true
Scripts: ~
- EID: 1
Name: Raccoon
IsActive: false
NumberOfChildren: 1
Components:
Transform Component:
Translate: {x: 0, y: 0.201105013, z: 0}
Rotate: {x: 0.00523597933, y: -2.96353412, z: -6.40293041e-10}
Scale: {x: 1.00000191, y: 1, z: 1.00000191}
IsActive: false
Renderable Component:
Mesh: 149697411
Material: 126974645
IsActive: false
Scripts: ~
- EID: 3
Name: Bag
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0.00623797067, y: -0.000395311916, z: -2.03726813e-08}
Rotate: {x: 1.35041773e-08, y: 2.79945588, z: -9.6043955e-09}
Scale: {x: 1.00008798, y: 1, z: 1.0000881}
IsActive: true
Renderable Component:
Mesh: 144838771
Material: 123745521
IsActive: true
Scripts: ~
- EID: 2
Name: DirectionalLight
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 1.82978272, z: -3.28967047}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
Light Component:
Position: {x: 3, y: 4.5, z: 7}
Type: Directional
Direction: {x: 0, y: 0, z: 1}
Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295
Strength: 0
Casting Shadows: false
IsActive: true
Scripts: ~
- EID: 4
Name: AmbientLight
IsActive: true
NumberOfChildren: 0
Components:
Light Component:
Position: {x: 0, y: 0, z: 0}
Type: Ambient
Direction: {x: 0, y: 0, z: 1}
Color: {x: 1, y: 1, z: 1, w: 1}
Layer: 4294967295
Strength: 0.600000024
Casting Shadows: false
IsActive: true
Scripts: ~
- EID: 5
Name: Floor
IsActive: false
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0.0810000002, z: 0}
Rotate: {x: -1.57079625, y: 0, z: -0}
Scale: {x: 50, y: 49.9999924, z: 49.9999924}
IsActive: false
Renderable Component:
Mesh: 141771688
Material: 124370424
IsActive: false
Scripts: ~
- EID: 6
Name: TrajectoryTest
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: -3.39616156, y: 3.66783714, z: -0.722039163}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
RigidBody Component:
Type: Dynamic
Drag: 0.00999999978
Angular Drag: 0.100000001
Gravity Scale: 1
Use Gravity: true
Interpolate: true
Sleeping Enabled: false
Freeze Position X: false
Freeze Position Y: false
Freeze Position Z: false
Freeze Rotation X: false
Freeze Rotation Y: false
Freeze Rotation Z: false
IsActive: true
Collider Component:
Colliders:
- Is Trigger: false
Collision Tag: 0
Type: Sphere
Radius: 1
Friction: 0.400000006
Bounciness: 0
Density: 1
Position Offset: {x: 0, y: 0, z: 0}
Rotation Offset: {x: 0, y: 0, z: 0}
IsActive: true
Trajectory Renderer Component:
Mesh: 134305891
Start Color: {x: 1, y: 0.951541781, z: 0}
Start Alpha: 1
End Color: {x: 0, y: 1, z: 0.748898745}
End Alpha: 1
"Color Eval Rate ": 0.192000002
IsActive: true
Scripts: ~
- EID: 7
Name: ParticleTest
IsActive: true
NumberOfChildren: 0
Components:
Transform Component:
Translate: {x: 0, y: 0.823412895, z: -4.31447983}
Rotate: {x: -0, y: 0, z: -0}
Scale: {x: 1, y: 1, z: 1}
IsActive: true
classSHADE::SHParticleEmitterComponent:
Emission Count: 15
Is Passive: true
Emission Interval: 0.0939999968
Min Life: 2
Max Life: 3
Minimum Speed: 3
Maximum Speed: 6
Minimum Size: 0
Maximum Size: 0.5
Size Decay: 0.990999997
Angular Ranges And Offset: {x: 6.19999981, y: 1.10000002, z: 0, w: 0.100000001}
Rotation Speed: 0.0309999995
Rotation Decay: 0.0199999996
Texture Asset ID: 63456868
Custom Update Shader Asset ID: 0
Color Tint: {x: 1, y: 0, z: 0, w: 1}
IsActive: true
Scripts: ~

View File

@ -0,0 +1,3 @@
Name: Scene2
ID: 89281126
Type: 5

View File

@ -33,6 +33,8 @@ public class Item : Script
public float highlightThickness = 600.0f;
public float highlightLowerClamp = 0.25f;
private ParticleEmitter emitter;
protected override void awake()
{
@ -50,6 +52,8 @@ public class Item : Script
AudioHandler.audioClipHandlers["SFXImpactElastic"] = Audio.CreateAudioClip("event:/Props/impact_elastic");
AudioHandler.audioClipHandlers["SFXImpactHard"] = Audio.CreateAudioClip("event:/Props/impact_hard");
emitter = GetComponent<ParticleEmitter>();
}
protected override void start()
@ -135,6 +139,11 @@ public class Item : Script
playSound = false;
Audio.DetachAudioClipFromObject(AudioHandler.audioClipHandlers["SFXImpactElastic"]);
Audio.DetachAudioClipFromObject(AudioHandler.audioClipHandlers["SFXImpactHard"]);
if(emitter)
emitter.Emit();
Debug.Log("EMIT");
}
if (info.GameObject.GetScript<Homeowner1>() && !returnBack)

View File

@ -7,11 +7,13 @@ layout(local_size_x = 128) in;
struct EmitterParameters
{
vec4 angularRangesAndOffsets;
vec4 acceleration;
float minSpeed;
float maxSpeed;
float rotationSpeed;
float rotationDecay;
vec4 lifeAndSizeRange; // min life, max life, min size, max size
vec4 colorTint;
float sizeDecay;
uint textureIndex;
float padding[2];
@ -24,6 +26,7 @@ struct ParticleData
vec4 velocity;
vec4 acceleration;
vec4 scaleAndDecay;
vec4 colorTint;
float life;
uint textureIndex;
};
@ -166,12 +169,15 @@ void main()
float particleSize = map (rand(seed), 0.0f, 1.0f, emitterParams.data.lifeAndSizeRange.z, emitterParams.data.lifeAndSizeRange.w);
// Set size of particle
// Set size of and size decay of particle
particle.scaleAndDecay.x = particleSize;
particle.scaleAndDecay.y = particleSize;
particle.scaleAndDecay.z = emitterParams.data.sizeDecay;
particle.scaleAndDecay.w = emitterParams.data.sizeDecay;
// Set particle color tint
particle.colorTint = emitterParams.data.colorTint;
// Set the texture for the particle
particle.textureIndex = emitterParams.data.textureIndex;
@ -182,7 +188,7 @@ void main()
particle.orientationSpeedDecay = vec4 (0.0f);
particle.acceleration = vec4 (0.0f, -0.058f, 0.0f, 0.0f);
particle.acceleration = emitterParams.data.acceleration;
inputParticles.data[index] = particle;

View File

@ -17,6 +17,7 @@ struct ParticleData
vec4 velocity;
vec4 acceleration;
vec4 scaleAndDecay;
vec4 colorTint;
float life;
uint textureIndex;
};

View File

@ -15,12 +15,13 @@ layout(location = 0) in struct
layout(location = 1) flat in struct
{
uint textureIndex;
vec4 color;
} InFlat;
void main ()
{
fragColor = vec4 (texture(textures [nonuniformEXT(InFlat.textureIndex)], In.uv));
fragColor = vec4 (texture(textures [nonuniformEXT(InFlat.textureIndex)], In.uv)) * InFlat.color;
if (fragColor.a < 0.01f)
discard;
}

Binary file not shown.

View File

@ -23,6 +23,7 @@ struct ParticleData
vec4 velocity;
vec4 acceleration;
vec4 scaleAndDecay;
vec4 colorTint;
float life;
uint textureIndex;
};
@ -62,6 +63,7 @@ layout(location = 0) out struct
layout(location = 1) out struct
{
uint textureIndex; // location = 1
vec4 color; // location = 2
} OutFlat;
vec2 CreateQuad (in uint vertexID)
@ -96,6 +98,7 @@ void main()
particlePos = particle.position.xyz + (viewRight * particlePos.x * particleScaleData.x) + (viewUp * particlePos.y * particleScaleData.y);
OutFlat.textureIndex = particle.textureIndex;
OutFlat.color = particle.colorTint;
gl_Position = cameraData.vpMat * vec4(particlePos, 1.0f);
}

Binary file not shown.

View File

@ -883,6 +883,27 @@ namespace SHADE
comp->SetRotationDecay(val);
});
SHEditorWidgets::DragVec3("Acceleration", {"x", "y", "z"},
[comp = component]()
{
return comp->GetAcceleration();
},
[comp = component](SHVec3 const& val)
{
comp->SetAcceleration(val);
});
SHEditorWidgets::ColorPicker("Color Tint",
[comp = component]()
{
return comp->GetColorTint();
},
[comp = component](SHVec4 const& val)
{
comp->SetColorTint(val);
});
SHEditorWidgets::DragInt("Texture Index",
[comp = component]()
{
@ -892,6 +913,13 @@ namespace SHADE
{
comp->SetTextureAssetID(val);
});
ImGui::SameLine();
if (ImGui::Button("Reset"))
{
component->SetTextureAssetID(0);
component->SetTextureIndex(0);
}
if (SHDragDrop::BeginTarget())
{
if (AssetID* payload = SHDragDrop::AcceptPayload<AssetID>(SHDragDrop::DRAG_RESOURCE))

View File

@ -52,6 +52,25 @@ namespace SHADE
}
void SHParticleEmitterComponent::SetAcceleration(SHVec3 const& accel) noexcept
{
cpuEmitterData.accleration.x = accel.x;
cpuEmitterData.accleration.y = accel.y;
cpuEmitterData.accleration.z = accel.z;
}
void SHParticleEmitterComponent::SetAngularRanges(SHVec2 const& ranges) noexcept
{
cpuEmitterData.angularRangesAndOffsets.x = ranges.x;
cpuEmitterData.angularRangesAndOffsets.y = ranges.y;
}
void SHParticleEmitterComponent::SetAngularOffsets(SHVec2 const& offsets) noexcept
{
cpuEmitterData.angularRangesAndOffsets.z = offsets.x;
cpuEmitterData.angularRangesAndOffsets.w = offsets.y;
}
void SHParticleEmitterComponent::SetMinSpeed(float speed) noexcept
{
cpuEmitterData.minSpeed = speed;
@ -107,6 +126,23 @@ namespace SHADE
customUpdateShader = shaderModule;
}
void SHParticleEmitterComponent::SetColorTint(SHVec4 tint) noexcept
{
cpuEmitterData.colorTint = tint;
}
void SHParticleEmitterComponent::SetColorTintRGB(SHVec3 tint) noexcept
{
cpuEmitterData.colorTint.x = tint.x;
cpuEmitterData.colorTint.y = tint.y;
cpuEmitterData.colorTint.z = tint.z;
}
void SHParticleEmitterComponent::SetColorTintAlpha(float alpha) noexcept
{
cpuEmitterData.colorTint.w = alpha;
}
uint32_t SHParticleEmitterComponent::GetEmissionCount(void) const noexcept
{
return emissionCount;
@ -138,6 +174,21 @@ namespace SHADE
return cpuEmitterData.angularRangesAndOffsets;
}
SHVec2 SHParticleEmitterComponent::GetAngularRanges(void) const noexcept
{
return SHVec2{cpuEmitterData.angularRangesAndOffsets.x, cpuEmitterData.angularRangesAndOffsets.y};
}
SHVec2 SHParticleEmitterComponent::GetAngularOffsets(void) const noexcept
{
return {cpuEmitterData.angularRangesAndOffsets.z, cpuEmitterData.angularRangesAndOffsets.w };
}
SHVec3 SHParticleEmitterComponent::GetAcceleration(void) const noexcept
{
return SHVec3{cpuEmitterData.accleration.x, cpuEmitterData.accleration.y, cpuEmitterData.accleration.z };
}
float SHParticleEmitterComponent::GetMinSpeed(void) const noexcept
{
return cpuEmitterData.minSpeed;
@ -194,4 +245,19 @@ namespace SHADE
return customUpdateShader;
}
SHVec4 const& SHParticleEmitterComponent::GetColorTint(void) const noexcept
{
return cpuEmitterData.colorTint;
}
SHVec3 SHParticleEmitterComponent::GetColorTintRGB(void) const noexcept
{
return SHVec3 (cpuEmitterData.colorTint.x, cpuEmitterData.colorTint.y, cpuEmitterData.colorTint.z);
}
float SHParticleEmitterComponent::GetColorTintAlpha(void) const noexcept
{
return cpuEmitterData.colorTint.w;
}
}

View File

@ -1,5 +1,6 @@
#pragma once
#include "SH_API.h"
#include "Resource/SHHandle.h"
#include "Math/Vector/SHVec2.h"
#include "Math/Vector/SHVec4.h"
@ -15,7 +16,7 @@ namespace SHADE
class SHVkShaderModule;
class SHVkPipeline;
class SHParticleEmitterComponent : public SHComponent
class SH_API SHParticleEmitterComponent : public SHComponent
{
private:
@ -24,6 +25,9 @@ namespace SHADE
//! Angular ranges of emission
SHVec4 angularRangesAndOffsets;
//! Acceleration
SHVec4 accleration;
//! minimum starting velocity
float minSpeed;
@ -39,6 +43,9 @@ namespace SHADE
//! Spawn lifetime and size range (min and max)
SHVec4 lifeAndSizeRange;
//! Color tint to assign to particles
SHVec4 colorTint;
//! Size decay for particles
float sizeDecayMult;
@ -67,6 +74,9 @@ namespace SHADE
//! x scale, x scale decay, y scale and y scale decay
SHVec4 scaleAndDecay;
//! Color tinting for particle
SHVec4 colorTint;
//! Life of the particle
float life;
@ -147,6 +157,9 @@ namespace SHADE
void SetMinLife (float val) noexcept;
void SetMaxLife (float val) noexcept;
void SetAngularRangesAndOffsets (SHVec4 const& ranges) noexcept;
void SetAcceleration (SHVec3 const& accel) noexcept;
void SetAngularRanges (SHVec2 const& ranges) noexcept;
void SetAngularOffsets (SHVec2 const& offsets) noexcept;
void SetMinSpeed (float speed) noexcept;
void SetMaxSpeed (float speed) noexcept;
void SetRotationSpeed (float speed) noexcept;
@ -156,6 +169,9 @@ namespace SHADE
void SetMaxSize (float size) noexcept;
void SetSizeDecayMult (float decay) noexcept;
void SetCustomUpdateShader (Handle<SHVkShaderModule> shaderModule) noexcept;
void SetColorTint (SHVec4 tint) noexcept;
void SetColorTintRGB (SHVec3 tint) noexcept;
void SetColorTintAlpha (float alpha) noexcept;
uint32_t GetEmissionCount (void) const noexcept;
bool GetPassive (void) const noexcept;
@ -163,6 +179,9 @@ namespace SHADE
float GetMinLife (void) const noexcept;
float GetMaxLife (void) const noexcept;
SHVec4 const& GetAngularRangesAndOffsets (void) const noexcept;
SHVec2 GetAngularRanges (void) const noexcept;
SHVec2 GetAngularOffsets (void) const noexcept;
SHVec3 GetAcceleration (void) const noexcept;
float GetMinSpeed (void) const noexcept;
float GetMaxSpeed (void) const noexcept;
float GetRotationSpeed (void) const noexcept;
@ -172,6 +191,9 @@ namespace SHADE
float GetMaxSize (void) const noexcept;
float GetSizeDecayMult (void) const noexcept;
Handle<SHVkShaderModule> GetCustomUpdateShader (void) const noexcept;
SHVec4 const& GetColorTint (void) const noexcept;
SHVec3 GetColorTintRGB (void) const noexcept;
float GetColorTintAlpha (void) const noexcept;
/*-----------------------------------------------------------------------*/
/* NON-INTERFACE FUNCTIONS */

View File

@ -519,6 +519,8 @@ namespace YAML
static constexpr std::string_view ROTATION_DECAY_TAG = "Rotation Decay";
static constexpr std::string_view TEXTURE_ASSET_ID_TAG = "Texture Asset ID";
static constexpr std::string_view CUSTOM_UPDATE_SHADER_ASSET_ID_TAG = "Custom Update Shader Asset ID";
static constexpr std::string_view COLOR_TINT_TAG = "Color Tint";
static constexpr std::string_view ACCELERATION_TAG = "Acceleration";
static YAML::Node encode(SHParticleEmitterComponent const& rhs)
{
@ -538,6 +540,8 @@ namespace YAML
node[ROTATION_DECAY_TAG.data()] = rhs.GetRotationDecay();
node[TEXTURE_ASSET_ID_TAG.data()] = rhs.GetTextureAssetID();
node[CUSTOM_UPDATE_SHADER_ASSET_ID_TAG.data()] = rhs.GetCustomUpdateShaderAssetID();
node[COLOR_TINT_TAG.data()] = rhs.GetColorTint();
node[ACCELERATION_TAG.data()] = rhs.GetAcceleration();
return node;
}
@ -581,6 +585,11 @@ namespace YAML
if (node[ROTATION_DECAY_TAG.data()].IsDefined())
rhs.SetRotationDecay(node[ROTATION_DECAY_TAG.data()].as<float>());
if (node[COLOR_TINT_TAG.data()].IsDefined())
rhs.SetColorTint(node[COLOR_TINT_TAG.data()].as<SHVec4>());
if (node[ACCELERATION_TAG.data()].IsDefined())
rhs.SetAcceleration(node[ACCELERATION_TAG.data()].as<SHVec3>());
if (node[TEXTURE_ASSET_ID_TAG.data()].IsDefined())
{

View File

@ -0,0 +1,170 @@
#include "SHpch.h"
#include "ParticleEmitter.hxx"
namespace SHADE
{
ParticleEmitter::ParticleEmitter(Entity entity)
:Component(entity)
{
}
void ParticleEmitter::Emit()
{
GetNativeComponent()->Emit();
}
float ParticleEmitter::EmissionInterval::get()
{
return (GetNativeComponent()->GetEmissionInterval());
}
void ParticleEmitter::EmissionInterval::set(float val)
{
GetNativeComponent()->SetEmissionInterval(val);
}
bool ParticleEmitter::IsPassive::get()
{
return (GetNativeComponent()->GetPassive());
}
void ParticleEmitter::IsPassive::set(bool val)
{
GetNativeComponent()->SetPassive(val);
}
float ParticleEmitter::MinLife::get()
{
return (GetNativeComponent()->GetMinLife());
}
void ParticleEmitter::MinLife::set(float val)
{
GetNativeComponent()->SetMinLife(val);
}
float ParticleEmitter::MaxLife::get()
{
return (GetNativeComponent()->GetMaxLife());
}
void ParticleEmitter::MaxLife::set(float val)
{
GetNativeComponent()->SetMaxLife(val);
}
Vector2 ParticleEmitter::AngularRanges::get()
{
return Convert::ToCLI(GetNativeComponent()->GetAngularRanges());
}
void ParticleEmitter::AngularRanges::set(Vector2 val)
{
GetNativeComponent()->SetAngularRanges(Convert::ToNative(val));
}
Vector2 ParticleEmitter::AngularOffsets::get()
{
return Convert::ToCLI(GetNativeComponent()->GetAngularOffsets());
}
void ParticleEmitter::AngularOffsets::set(Vector2 val)
{
GetNativeComponent()->SetAngularOffsets(Convert::ToNative(val));
}
float ParticleEmitter::MinSpeed::get()
{
return GetNativeComponent()->GetMinSpeed();
}
void ParticleEmitter::MinSpeed::set(float val)
{
GetNativeComponent()->SetMinSpeed(val);
}
float ParticleEmitter::MaxSpeed::get()
{
return GetNativeComponent()->GetMinSpeed();
}
void ParticleEmitter::MaxSpeed::set(float val)
{
GetNativeComponent()->SetMaxSpeed(val);
}
float ParticleEmitter::RotationSpeed::get()
{
return GetNativeComponent()->GetRotationSpeed();
}
void ParticleEmitter::RotationSpeed::set(float val)
{
GetNativeComponent()->SetRotationSpeed(val);
}
float ParticleEmitter::RotationDecay::get()
{
return GetNativeComponent()->GetRotationDecay();
}
void ParticleEmitter::RotationDecay::set(float val)
{
GetNativeComponent()->SetRotationDecay(val);
}
float ParticleEmitter::MinSize::get()
{
return GetNativeComponent()->GetMinSize();
}
void ParticleEmitter::MinSize::set(float val)
{
GetNativeComponent()->SetMinSize(val);
}
float ParticleEmitter::MaxSize::get()
{
return GetNativeComponent()->GetMaxSize();
}
void ParticleEmitter::MaxSize::set(float val)
{
GetNativeComponent()->SetMaxSize(val);
}
float ParticleEmitter::SizeDecayMult::get()
{
return GetNativeComponent()->GetSizeDecayMult();
}
void ParticleEmitter::SizeDecayMult::set(float val)
{
GetNativeComponent()->SetSizeDecayMult(val);
}
Vector3 ParticleEmitter::ColorTintRGB::get()
{
return Convert::ToCLI(GetNativeComponent()->GetColorTintRGB());
}
void ParticleEmitter::ColorTintRGB::set(Vector3 val)
{
GetNativeComponent()->SetColorTintRGB (Convert::ToNative (val));
}
float ParticleEmitter::ColorTintAlpha::get()
{
return GetNativeComponent()->GetColorTintAlpha();
}
void ParticleEmitter::ColorTintAlpha::set(float val)
{
GetNativeComponent()->SetColorTintAlpha(val);
}
}

View File

@ -0,0 +1,115 @@
#pragma once
// Project Includes
#include "Components/Component.hxx"
#include "Math/Vector2.hxx"
#include "Math/Vector3.hxx"
#include "Math/Quaternion.hxx"
// External Dependencies
#include "Camera/SHCameraComponent.h"
#include "Graphics/MiddleEnd/Particles/SHParticleEmitterComponent.h"
namespace SHADE
{
public ref class ParticleEmitter : public Component<SHParticleEmitterComponent>
{
internal:
ParticleEmitter(Entity entity);
public:
property bool IsPassive
{
bool get();
void set(bool val);
}
property float EmissionInterval
{
float get();
void set(float val);
}
property float MinLife
{
float get();
void set(float val);
}
property float MaxLife
{
float get();
void set(float val);
}
property Vector2 AngularRanges
{
Vector2 get();
void set(Vector2 val);
}
property Vector2 AngularOffsets
{
Vector2 get();
void set(Vector2 val);
}
property float MinSpeed
{
float get();
void set(float val);
}
property float MaxSpeed
{
float get();
void set(float val);
}
property float RotationSpeed
{
float get();
void set(float val);
}
property float RotationDecay
{
float get();
void set(float val);
}
property float MinSize
{
float get();
void set(float val);
}
property float MaxSize
{
float get();
void set(float val);
}
property float SizeDecayMult
{
float get();
void set(float val);
}
property Vector3 ColorTintRGB
{
Vector3 get();
void set(Vector3 val);
}
property float ColorTintAlpha
{
float get();
void set (float val);
}
void Emit();
};
}

View File

@ -34,6 +34,7 @@ of DigiPen Institute of Technology is prohibited.
#include "UI\SHCanvasComponent.h"
#include "Animation\SHAnimatorComponent.h"
#include "Graphics\MiddleEnd\TrajectoryRendering\SHTrajectoryRenderableComponent.h"
#include "Graphics\MiddleEnd/Particles/SHParticleEmitterComponent.h"
// Project Headers
#include "Utility/Convert.hxx"
#include "Utility/Debug.hxx"
@ -50,6 +51,7 @@ of DigiPen Institute of Technology is prohibited.
#include "Components\Slider.hxx"
#include "Components\TrajectoryRenderable.hxx"
#include "Components\Animator.hxx"
#include "Components\ParticleEmitter.hxx"
@ -341,6 +343,7 @@ namespace SHADE
componentMap.Add(createComponentSet<SHSliderComponent, Slider>());
componentMap.Add(createComponentSet<SHTrajectoryRenderableComponent, TrajectoryRenderable>());
componentMap.Add(createComponentSet<SHAnimatorComponent, Animator>());
componentMap.Add(createComponentSet<SHParticleEmitterComponent, ParticleEmitter>());
}
/*---------------------------------------------------------------------------------*/