Merge branch 'particle-emitter-refactor'
This commit is contained in:
Коммит
3bbc756aeb
|
@ -892,6 +892,7 @@ void InitResourcePicker()
|
|||
resourcePickers.Push(ResourcePicker("LuaFile", luaFileFilters));
|
||||
resourcePickers.Push(ResourcePicker("Material", materialFilters, ACTION_PICK | ACTION_OPEN | ACTION_EDIT));
|
||||
resourcePickers.Push(ResourcePicker("Model", "*.mdl", ACTION_PICK));
|
||||
resourcePickers.Push(ResourcePicker("ParticleEffect", "*.xml", ACTION_PICK | ACTION_OPEN));
|
||||
resourcePickers.Push(ResourcePicker("ScriptFile", scriptFilters));
|
||||
resourcePickers.Push(ResourcePicker("Sound", soundFilters));
|
||||
resourcePickers.Push(ResourcePicker("Technique", "*.xml"));
|
||||
|
@ -1211,20 +1212,6 @@ void InitVectorStructs()
|
|||
};
|
||||
vectorStructs.Push(VectorStruct("AnimatedModel", "Animation States", animationStateVariables, 1));
|
||||
|
||||
Array<String> particleColorVariables = {
|
||||
"Color Animation Frames",
|
||||
" Color",
|
||||
" Time"
|
||||
};
|
||||
vectorStructs.Push(VectorStruct("ParticleEmitter", "Particle Colors", particleColorVariables, 1));
|
||||
|
||||
Array<String> particleUVAnimVariables = {
|
||||
"UV Animation Frames",
|
||||
" UV Coords",
|
||||
" Time"
|
||||
};
|
||||
vectorStructs.Push(VectorStruct("ParticleEmitter", "UV Animation", particleUVAnimVariables, 1));
|
||||
|
||||
Array<String> staticModelGroupInstanceVariables = {
|
||||
"Instance Count",
|
||||
" NodeID"
|
||||
|
|
|
@ -858,16 +858,16 @@ void HandleDragDropFinish(StringHash eventType, VariantMap& eventData)
|
|||
CreateModelWithStaticModel(browserFile.resourceKey, targetNode);
|
||||
return;
|
||||
}
|
||||
else if (type == RESOURCE_TYPE_PARTICLEEMITTER)
|
||||
else if (type == RESOURCE_TYPE_PARTICLEEFFECT)
|
||||
{
|
||||
if (browserFile.extension == "xml")
|
||||
{
|
||||
XMLFile@ file = cache.GetResource("XMLFile", browserFile.resourceKey);
|
||||
if (file is null)
|
||||
ParticleEffect@ effect = cache.GetResource("ParticleEffect", browserFile.resourceKey);
|
||||
if (effect is null)
|
||||
return;
|
||||
|
||||
ParticleEmitter@ emitter = targetNode.CreateComponent("ParticleEmitter");
|
||||
emitter.Load(file);
|
||||
emitter.effect = effect;
|
||||
createdComponent = emitter;
|
||||
}
|
||||
}
|
||||
|
@ -1104,7 +1104,7 @@ bool TestDragDrop(UIElement@ source, UIElement@ target, int& itemType)
|
|||
return type == RESOURCE_TYPE_PREFAB ||
|
||||
type == RESOURCE_TYPE_SCRIPTFILE ||
|
||||
type == RESOURCE_TYPE_MODEL ||
|
||||
type == RESOURCE_TYPE_PARTICLEEMITTER ||
|
||||
type == RESOURCE_TYPE_PARTICLEEFFECT ||
|
||||
type == RESOURCE_TYPE_2D_PARTICLE_EFFECT;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ const int RESOURCE_TYPE_TEXTURE = 8;
|
|||
const int RESOURCE_TYPE_FONT = 9;
|
||||
const int RESOURCE_TYPE_PREFAB = 10;
|
||||
const int RESOURCE_TYPE_TECHNIQUE = 11;
|
||||
const int RESOURCE_TYPE_PARTICLEEMITTER = 12;
|
||||
const int RESOURCE_TYPE_PARTICLEEFFECT = 12;
|
||||
const int RESOURCE_TYPE_UIELEMENT = 13;
|
||||
const int RESOURCE_TYPE_UIELEMENTS = 14;
|
||||
const int RESOURCE_TYPE_ANIMATION_SETTINGS = 15;
|
||||
|
@ -54,7 +54,7 @@ const ShortStringHash XML_TYPE_SCENE("scene");
|
|||
const ShortStringHash XML_TYPE_NODE("node");
|
||||
const ShortStringHash XML_TYPE_MATERIAL("material");
|
||||
const ShortStringHash XML_TYPE_TECHNIQUE("technique");
|
||||
const ShortStringHash XML_TYPE_PARTICLEEMITTER("particleemitter");
|
||||
const ShortStringHash XML_TYPE_PARTICLEEFFECT("particleeffect");
|
||||
const ShortStringHash XML_TYPE_TEXTURE("texture");
|
||||
const ShortStringHash XML_TYPE_ELEMENT("element");
|
||||
const ShortStringHash XML_TYPE_ELEMENTS("elements");
|
||||
|
@ -247,7 +247,8 @@ void CreateResourceFilterUI()
|
|||
checkbox.SetStyleAuto();
|
||||
checkbox.vars[TEXT_VAR_RESOURCE_TYPE] = i;
|
||||
checkbox.checked = true;
|
||||
SubscribeToEvent(checkbox, "Toggled", "HandleResourceTypeFilterToggled");
|
||||
SubscribeToEvent(checkbox, "Toggled", "HandleResourceTypeFilterToggled");
|
||||
|
||||
|
||||
resourceTypeHolder.AddChild(checkbox);
|
||||
resourceTypeHolder.AddChild(label);
|
||||
|
@ -307,7 +308,7 @@ void InitializeBrowserFileListRow(Text@ fileText, BrowserFile@ file)
|
|||
|
||||
if (file.resourceType == RESOURCE_TYPE_MATERIAL ||
|
||||
file.resourceType == RESOURCE_TYPE_MODEL ||
|
||||
file.resourceType == RESOURCE_TYPE_PARTICLEEMITTER ||
|
||||
file.resourceType == RESOURCE_TYPE_PARTICLEEFFECT ||
|
||||
file.resourceType == RESOURCE_TYPE_PREFAB
|
||||
)
|
||||
{
|
||||
|
@ -542,7 +543,8 @@ void PopulateResourceDirFilters()
|
|||
checkbox.SetStyleAuto();
|
||||
checkbox.vars[TEXT_VAR_RESOURCE_DIR_ID] = i;
|
||||
checkbox.checked = true;
|
||||
SubscribeToEvent(checkbox, "Toggled", "HandleResourceDirFilterToggled");
|
||||
SubscribeToEvent(checkbox, "Toggled", "HandleResourceDirFilterToggled");
|
||||
|
||||
|
||||
resourceDirHolder.AddChild(checkbox);
|
||||
resourceDirHolder.AddChild(label);
|
||||
|
@ -1020,8 +1022,8 @@ int GetResourceType(ShortStringHash fileType)
|
|||
return RESOURCE_TYPE_MATERIAL;
|
||||
else if(fileType == XML_TYPE_TECHNIQUE)
|
||||
return RESOURCE_TYPE_TECHNIQUE;
|
||||
else if(fileType == XML_TYPE_PARTICLEEMITTER)
|
||||
return RESOURCE_TYPE_PARTICLEEMITTER;
|
||||
else if(fileType == XML_TYPE_PARTICLEEFFECT)
|
||||
return RESOURCE_TYPE_PARTICLEEFFECT;
|
||||
else if(fileType == XML_TYPE_TEXTURE)
|
||||
return RESOURCE_TYPE_TEXTURE;
|
||||
else if(fileType == XML_TYPE_ELEMENT)
|
||||
|
@ -1217,8 +1219,8 @@ bool GetXmlType(String path, ShortStringHash &out fileType, bool useCache = fals
|
|||
fileType = XML_TYPE_MATERIAL;
|
||||
else if(type == XML_TYPE_TECHNIQUE)
|
||||
fileType = XML_TYPE_TECHNIQUE;
|
||||
else if(type == XML_TYPE_PARTICLEEMITTER)
|
||||
fileType = XML_TYPE_PARTICLEEMITTER;
|
||||
else if(type == XML_TYPE_PARTICLEEFFECT)
|
||||
fileType = XML_TYPE_PARTICLEEFFECT;
|
||||
else if(type == XML_TYPE_TEXTURE)
|
||||
fileType = XML_TYPE_TEXTURE;
|
||||
else if(type == XML_TYPE_ELEMENT)
|
||||
|
@ -1273,8 +1275,8 @@ String ResourceTypeName(int resourceType)
|
|||
return "Prefab";
|
||||
else if (resourceType == RESOURCE_TYPE_TECHNIQUE)
|
||||
return "Render Technique";
|
||||
else if (resourceType == RESOURCE_TYPE_PARTICLEEMITTER)
|
||||
return "Particle Emitter";
|
||||
else if (resourceType == RESOURCE_TYPE_PARTICLEEFFECT)
|
||||
return "Particle Effect";
|
||||
else if (resourceType == RESOURCE_TYPE_UIELEMENT)
|
||||
return "UI Element";
|
||||
else if (resourceType == RESOURCE_TYPE_UIELEMENTS)
|
||||
|
|
|
@ -945,49 +945,6 @@ bool SceneRebuildNavigation()
|
|||
return success;
|
||||
}
|
||||
|
||||
bool LoadParticleData(const String&in fileName)
|
||||
{
|
||||
if (fileName.empty)
|
||||
return false;
|
||||
|
||||
XMLFile xmlFile;
|
||||
if (!xmlFile.Load(File(fileName, FILE_READ)))
|
||||
return false;
|
||||
|
||||
bool needRefresh = false;
|
||||
|
||||
for (uint i = 0; i < editComponents.length; ++i)
|
||||
{
|
||||
ParticleEmitter@ emitter = cast<ParticleEmitter>(editComponents[i]);
|
||||
if (emitter !is null)
|
||||
{
|
||||
emitter.Load(xmlFile);
|
||||
needRefresh = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (needRefresh)
|
||||
UpdateAttributeInspector();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SaveParticleData(const String&in fileName)
|
||||
{
|
||||
if (fileName.empty || editComponents.length != 1)
|
||||
return false;
|
||||
|
||||
ParticleEmitter@ emitter = cast<ParticleEmitter>(editComponents[0]);
|
||||
if (emitter !is null)
|
||||
{
|
||||
XMLFile xmlFile;
|
||||
emitter.Save(xmlFile);
|
||||
return xmlFile.Save(File(fileName, FILE_WRITE));
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void AssignMaterial(StaticModel@ model, String materialPath)
|
||||
{
|
||||
Material@ material = cache.GetResource("Material", materialPath);
|
||||
|
|
|
@ -334,8 +334,6 @@ void CreateMenuBar()
|
|||
popup.AddChild(CreateMenuItem("Stop test animation", @StopTestAnimation));
|
||||
CreateChildDivider(popup);
|
||||
popup.AddChild(CreateMenuItem("Rebuild navigation data", @SceneRebuildNavigation));
|
||||
popup.AddChild(CreateMenuItem("Load particle data", @PickFile));
|
||||
popup.AddChild(CreateMenuItem("Save particle data", @PickFile));
|
||||
FinalizedPopupMenu(popup);
|
||||
uiMenuBar.AddChild(menu);
|
||||
}
|
||||
|
@ -547,35 +545,6 @@ bool PickFile()
|
|||
uiFileSelector.directoryMode = true;
|
||||
SubscribeToEvent(uiFileSelector, "FileSelected", "HandleResourcePath");
|
||||
}
|
||||
else if (action == "Load particle data")
|
||||
{
|
||||
bool hasParticleEmitter = false;
|
||||
for (uint i = 0; i < editComponents.length; ++i)
|
||||
{
|
||||
if (editComponents[i].typeName == "ParticleEmitter")
|
||||
{
|
||||
hasParticleEmitter = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (hasParticleEmitter)
|
||||
{
|
||||
CreateFileSelector("Load particle data", "Load", "Cancel", uiParticlePath, uiParticleFilters, uiParticleFilter);
|
||||
SubscribeToEvent(uiFileSelector, "FileSelected", "HandleLoadParticleData");
|
||||
}
|
||||
else
|
||||
MessageBox("Need to have a selected ParticleEmitter component to load particle data.");
|
||||
}
|
||||
else if (action == "Save particle data")
|
||||
{
|
||||
if (editComponents.length == 1 && editComponents[0].typeName == "ParticleEmitter")
|
||||
{
|
||||
CreateFileSelector("Save particle data", "Save", "Cancel", uiParticlePath, uiParticleFilters, uiParticleFilter);
|
||||
SubscribeToEvent(uiFileSelector, "FileSelected", "HandleSaveParticleData");
|
||||
}
|
||||
else
|
||||
MessageBox("Need to have a selected ParticleEmitter component to save particle data.");
|
||||
}
|
||||
// UI-element
|
||||
else if (action == "Open UI-layout...")
|
||||
{
|
||||
|
@ -1046,17 +1015,6 @@ void HandleImportScene(StringHash eventType, VariantMap& eventData)
|
|||
ImportScene(ExtractFileName(eventData));
|
||||
}
|
||||
|
||||
void HandleLoadParticleData(StringHash eventType, VariantMap& eventData)
|
||||
{
|
||||
CloseFileSelector(uiParticleFilter, uiParticlePath);
|
||||
LoadParticleData(ExtractFileName(eventData));
|
||||
}
|
||||
|
||||
void HandleSaveParticleData(StringHash eventType, VariantMap& eventData)
|
||||
{
|
||||
CloseFileSelector(uiParticleFilter, uiParticlePath);
|
||||
SaveParticleData(ExtractFileName(eventData, true));
|
||||
}
|
||||
|
||||
void ExecuteScript(const String&in fileName)
|
||||
{
|
||||
|
|
|
@ -197,7 +197,6 @@ void InitNetworking()
|
|||
SubscribeToEvent("UpdateScore", "HandleUpdateScore");
|
||||
SubscribeToEvent("UpdateHiscores", "HandleUpdateHiscores");
|
||||
SubscribeToEvent("NetworkUpdateSent", "HandleNetworkUpdateSent");
|
||||
SubscribeToEvent("ParticleEffect", "HandleParticleEffect");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -644,14 +643,6 @@ void HandleNetworkUpdateSent()
|
|||
network.serverConnection.controls.Set(CTRL_ALL, false);
|
||||
}
|
||||
|
||||
void HandleParticleEffect(StringHash eventType, VariantMap& eventData)
|
||||
{
|
||||
Vector3 position = eventData["Position"].GetVector3();
|
||||
String effectName = eventData["EffectName"].GetString();
|
||||
float duration = eventData["Duration"].GetFloat();
|
||||
SpawnParticleEffect(position, effectName, duration, LOCAL);
|
||||
}
|
||||
|
||||
int FindPlayerIndex(uint nodeID)
|
||||
{
|
||||
for (uint i = 0; i < players.length; ++i)
|
||||
|
@ -759,23 +750,15 @@ Node@ SpawnObject(const Vector3&in position, const Quaternion&in rotation, const
|
|||
|
||||
Node@ SpawnParticleEffect(const Vector3&in position, const String&in effectName, float duration, CreateMode mode = REPLICATED)
|
||||
{
|
||||
if (runServer && mode == REPLICATED)
|
||||
{
|
||||
VariantMap eventData;
|
||||
eventData["Position"] = position;
|
||||
eventData["EffectName"] = effectName;
|
||||
eventData["Duration"] = duration;
|
||||
network.BroadcastRemoteEvent(gameScene, "ParticleEffect", false, eventData);
|
||||
}
|
||||
|
||||
Node@ newNode = scene.CreateChild("Effect", LOCAL);
|
||||
Node@ newNode = scene.CreateChild("Effect", mode);
|
||||
newNode.position = position;
|
||||
|
||||
// Create the particle emitter
|
||||
ParticleEmitter@ emitter = newNode.CreateComponent("ParticleEmitter");
|
||||
emitter.Load(cache.GetResource("XMLFile", effectName));
|
||||
emitter.effect = cache.GetResource("ParticleEffect", effectName);
|
||||
|
||||
// Create a GameObject for managing the effect lifetime
|
||||
// Create a GameObject for managing the effect lifetime. This is always local, so for server-controlled effects it
|
||||
// exists only on the server
|
||||
GameObject@ object = cast<GameObject>(newNode.CreateScriptObject(scriptFile, "GameObject", LOCAL));
|
||||
object.duration = duration;
|
||||
|
||||
|
|
|
@ -1289,11 +1289,9 @@ Like with skeletal animations, there are two ways to play back node animations:
|
|||
|
||||
\page Particles %Particle systems
|
||||
|
||||
The ParticleEmitter class derives from BillboardSet to implement a particle system that updates automatically.
|
||||
The ParticleEmitter class derives from BillboardSet to implement a particle system that updates automatically.
|
||||
|
||||
The particle system's properties can also be set through a XML description file, see \ref ParticleEmitter::Load "Load()".
|
||||
|
||||
Most of the parameters can take either a single value, or minimum and maximum values to allow for random variation. See below for all supported parameters:
|
||||
The parameters of the particle system are stored in a ParticleEffect resource class, which uses XML format. Call \ref ParticleEmitter::SetEffect "SetEffect()" to assign the effect resource to the emitter. Most of the parameters can take either a single value, or minimum and maximum values to allow for random variation. See below for all supported parameters:
|
||||
|
||||
\code
|
||||
<particleemitter>
|
||||
|
|
|
@ -37,6 +37,7 @@
|
|||
#include "Log.h"
|
||||
#include "Material.h"
|
||||
#include "Octree.h"
|
||||
#include "ParticleEffect.h"
|
||||
#include "ParticleEmitter.h"
|
||||
#include "ProcessUtils.h"
|
||||
#include "Profiler.h"
|
||||
|
@ -2786,6 +2787,7 @@ void RegisterGraphicsLibrary(Context* context)
|
|||
AnimatedModel::RegisterObject(context);
|
||||
AnimationController::RegisterObject(context);
|
||||
BillboardSet::RegisterObject(context);
|
||||
ParticleEffect::RegisterObject(context);
|
||||
ParticleEmitter::RegisterObject(context);
|
||||
CustomGeometry::RegisterObject(context);
|
||||
DecalSet::RegisterObject(context);
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include "Material.h"
|
||||
#include "Mutex.h"
|
||||
#include "Octree.h"
|
||||
#include "ParticleEffect.h"
|
||||
#include "ParticleEmitter.h"
|
||||
#include "ProcessUtils.h"
|
||||
#include "Profiler.h"
|
||||
|
@ -2974,6 +2975,7 @@ void RegisterGraphicsLibrary(Context* context)
|
|||
AnimatedModel::RegisterObject(context);
|
||||
AnimationController::RegisterObject(context);
|
||||
BillboardSet::RegisterObject(context);
|
||||
ParticleEffect::RegisterObject(context);
|
||||
ParticleEmitter::RegisterObject(context);
|
||||
CustomGeometry::RegisterObject(context);
|
||||
DecalSet::RegisterObject(context);
|
||||
|
|
|
@ -0,0 +1,638 @@
|
|||
//
|
||||
// Copyright (c) 2008-2014 the Urho3D project.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#include "Precompiled.h"
|
||||
#include "Context.h"
|
||||
#include "Log.h"
|
||||
#include "Material.h"
|
||||
#include "ParticleEffect.h"
|
||||
#include "ResourceCache.h"
|
||||
#include "XMLFile.h"
|
||||
|
||||
#include "DebugNew.h"
|
||||
|
||||
namespace Urho3D
|
||||
{
|
||||
|
||||
static const char* emitterTypeNames[] =
|
||||
{
|
||||
"Sphere",
|
||||
"Box",
|
||||
0
|
||||
};
|
||||
|
||||
static const Vector2 DEFAULT_PARTICLE_SIZE(0.1f, 0.1f);
|
||||
static const float DEFAULT_EMISSION_RATE = 10.0f;
|
||||
static const float MIN_EMISSION_RATE = 0.01f;
|
||||
static const float DEFAULT_TIME_TO_LIVE = 1.0f;
|
||||
static const float DEFAULT_VELOCITY = 1.0f;
|
||||
static const Vector3 DEFAULT_DIRECTION_MIN(-1.0f, -1.0f, -1.0f);
|
||||
static const Vector3 DEFAULT_DIRECTION_MAX(1.0f, 1.0f, 1.0f);
|
||||
|
||||
ParticleEffect::ParticleEffect(Context* context) :
|
||||
Resource(context),
|
||||
numParticles_(DEFAULT_NUM_PARTICLES),
|
||||
updateInvisible_(false),
|
||||
relative_(true),
|
||||
scaled_(true),
|
||||
sorted_(false),
|
||||
animationLodBias_(0.0f),
|
||||
emitterType_(EMITTER_SPHERE),
|
||||
emitterSize_(Vector3::ZERO),
|
||||
directionMin_(DEFAULT_DIRECTION_MIN),
|
||||
directionMax_(DEFAULT_DIRECTION_MAX),
|
||||
constantForce_(Vector3::ZERO),
|
||||
dampingForce_(0.0f),
|
||||
activeTime_(0.0f),
|
||||
inactiveTime_(0.0f),
|
||||
emissionRateMin_(DEFAULT_EMISSION_RATE),
|
||||
emissionRateMax_(DEFAULT_EMISSION_RATE),
|
||||
sizeMin_(DEFAULT_PARTICLE_SIZE),
|
||||
sizeMax_(DEFAULT_PARTICLE_SIZE),
|
||||
timeToLiveMin_(DEFAULT_TIME_TO_LIVE),
|
||||
timeToLiveMax_(DEFAULT_TIME_TO_LIVE),
|
||||
velocityMin_(DEFAULT_VELOCITY),
|
||||
velocityMax_(DEFAULT_VELOCITY),
|
||||
rotationMin_(0.0f),
|
||||
rotationMax_(0.0f),
|
||||
rotationSpeedMin_(0.0f),
|
||||
rotationSpeedMax_(0.0f),
|
||||
sizeAdd_(0.0f),
|
||||
sizeMul_(1.0f)
|
||||
{
|
||||
}
|
||||
|
||||
ParticleEffect::~ParticleEffect()
|
||||
{
|
||||
}
|
||||
|
||||
void ParticleEffect::RegisterObject(Context* context)
|
||||
{
|
||||
context->RegisterFactory<ParticleEffect>();
|
||||
}
|
||||
|
||||
bool ParticleEffect::Load(Deserializer& source)
|
||||
{
|
||||
XMLFile file(context_);
|
||||
if (!file.Load(source))
|
||||
{
|
||||
LOGERROR("Load particle effect file failed");
|
||||
return false;
|
||||
}
|
||||
|
||||
XMLElement rootElem = file.GetRoot();
|
||||
if (!rootElem)
|
||||
{
|
||||
LOGERROR("Particle emitter parameter file does not have a valid root element");
|
||||
return false;
|
||||
}
|
||||
|
||||
// Reset to defaults first so that missing parameters in case of a live reload behave as expected
|
||||
material_.Reset();
|
||||
numParticles_ = DEFAULT_NUM_PARTICLES;
|
||||
updateInvisible_ = false;
|
||||
relative_ = true;
|
||||
scaled_ = true;
|
||||
sorted_ = false;
|
||||
animationLodBias_ = 0.0f;
|
||||
emitterType_ = EMITTER_SPHERE;
|
||||
emitterSize_ = Vector3::ZERO;
|
||||
directionMin_ = DEFAULT_DIRECTION_MIN;
|
||||
directionMax_ = DEFAULT_DIRECTION_MAX;
|
||||
constantForce_ = Vector3::ZERO;
|
||||
dampingForce_ = 0.0f;
|
||||
activeTime_ = 0.0f;
|
||||
inactiveTime_ = 0.0;
|
||||
emissionRateMin_ = DEFAULT_EMISSION_RATE;
|
||||
emissionRateMax_ = DEFAULT_EMISSION_RATE;
|
||||
sizeMin_ = DEFAULT_PARTICLE_SIZE;
|
||||
sizeMax_ = DEFAULT_PARTICLE_SIZE;
|
||||
timeToLiveMin_ = DEFAULT_TIME_TO_LIVE;
|
||||
timeToLiveMax_ = DEFAULT_TIME_TO_LIVE;
|
||||
velocityMin_ = DEFAULT_VELOCITY;
|
||||
velocityMax_ = DEFAULT_VELOCITY;
|
||||
rotationMin_ = 0.0f;
|
||||
rotationMax_ = 0.0f;
|
||||
rotationSpeedMin_ = 0.0f;
|
||||
rotationSpeedMax_ = 0.0f;
|
||||
sizeAdd_ = 0.0f;
|
||||
sizeMul_ = 1.0f;
|
||||
colorFrames_.Clear();
|
||||
textureFrames_.Clear();
|
||||
|
||||
if (rootElem.HasChild("material"))
|
||||
SetMaterial(GetSubsystem<ResourceCache>()->GetResource<Material>(rootElem.GetChild("material").GetAttribute("name")));
|
||||
|
||||
if (rootElem.HasChild("numparticles"))
|
||||
SetNumParticles(rootElem.GetChild("numparticles").GetInt("value"));
|
||||
|
||||
if (rootElem.HasChild("updateinvisible"))
|
||||
updateInvisible_ = rootElem.GetChild("updateinvisible").GetBool("enable");
|
||||
|
||||
if (rootElem.HasChild("relative"))
|
||||
relative_ = rootElem.GetChild("relative").GetBool("enable");
|
||||
|
||||
if (rootElem.HasChild("scaled"))
|
||||
scaled_ = rootElem.GetChild("scaled").GetBool("enable");
|
||||
|
||||
if (rootElem.HasChild("sorted"))
|
||||
sorted_ = rootElem.GetChild("sorted").GetBool("enable");
|
||||
|
||||
if (rootElem.HasChild("animlodbias"))
|
||||
SetAnimationLodBias(rootElem.GetChild("animlodbias").GetFloat("value"));
|
||||
|
||||
if (rootElem.HasChild("emittertype"))
|
||||
{
|
||||
String type = rootElem.GetChild("emittertype").GetAttributeLower("value");
|
||||
if (type == "point")
|
||||
{
|
||||
// Point emitter type is deprecated, handled as zero sized sphere
|
||||
emitterType_ = EMITTER_SPHERE;
|
||||
emitterSize_ = Vector3::ZERO;
|
||||
}
|
||||
else if (type == "box")
|
||||
emitterType_ = EMITTER_BOX;
|
||||
else if (type == "sphere")
|
||||
emitterType_ = EMITTER_SPHERE;
|
||||
else
|
||||
LOGERROR("Unknown particle emitter type " + type);
|
||||
}
|
||||
|
||||
if (rootElem.HasChild("emittersize"))
|
||||
emitterSize_ = rootElem.GetChild("emittersize").GetVector3("value");
|
||||
|
||||
if (rootElem.HasChild("emitterradius"))
|
||||
emitterSize_.x_ = emitterSize_.y_ = emitterSize_.z_ = rootElem.GetChild("emitterradius").GetFloat("value");
|
||||
|
||||
if (rootElem.HasChild("direction"))
|
||||
GetVector3MinMax(rootElem.GetChild("direction"), directionMin_, directionMax_);
|
||||
|
||||
if (rootElem.HasChild("constantforce"))
|
||||
constantForce_ = rootElem.GetChild("constantforce").GetVector3("value");
|
||||
|
||||
if (rootElem.HasChild("dampingforce"))
|
||||
dampingForce_ = rootElem.GetChild("dampingforce").GetFloat("value");
|
||||
|
||||
if (rootElem.HasChild("activetime"))
|
||||
activeTime_ = rootElem.GetChild("activetime").GetFloat("value");
|
||||
if (activeTime_ < 0.0f)
|
||||
activeTime_ = M_INFINITY;
|
||||
|
||||
if (rootElem.HasChild("inactivetime"))
|
||||
inactiveTime_ = rootElem.GetChild("inactivetime").GetFloat("value");
|
||||
if (inactiveTime_ < 0.0f)
|
||||
inactiveTime_ = M_INFINITY;
|
||||
|
||||
if (rootElem.HasChild("emissionrate"))
|
||||
GetFloatMinMax(rootElem.GetChild("emissionrate"), emissionRateMin_, emissionRateMax_);
|
||||
|
||||
if (rootElem.HasChild("interval"))
|
||||
{
|
||||
float intervalMin = 0.0f;
|
||||
float intervalMax = 0.0f;
|
||||
GetFloatMinMax(rootElem.GetChild("interval"), intervalMin, intervalMax);
|
||||
emissionRateMax_ = 1.0f / intervalMin;
|
||||
emissionRateMin_ = 1.0f / intervalMax;
|
||||
}
|
||||
|
||||
if (rootElem.HasChild("particlesize"))
|
||||
GetVector2MinMax(rootElem.GetChild("particlesize"), sizeMin_, sizeMax_);
|
||||
|
||||
if (rootElem.HasChild("timetolive"))
|
||||
GetFloatMinMax(rootElem.GetChild("timetolive"), timeToLiveMin_, timeToLiveMax_);
|
||||
|
||||
if (rootElem.HasChild("velocity"))
|
||||
GetFloatMinMax(rootElem.GetChild("velocity"), velocityMin_, velocityMax_);
|
||||
|
||||
if (rootElem.HasChild("rotation"))
|
||||
GetFloatMinMax(rootElem.GetChild("rotation"), rotationMin_, rotationMax_);
|
||||
|
||||
if (rootElem.HasChild("rotationspeed"))
|
||||
GetFloatMinMax(rootElem.GetChild("rotationspeed"), rotationSpeedMin_, rotationSpeedMax_);
|
||||
|
||||
if (rootElem.HasChild("sizedelta"))
|
||||
{
|
||||
XMLElement deltaElem = rootElem.GetChild("sizedelta");
|
||||
if (deltaElem.HasAttribute("add"))
|
||||
sizeAdd_ = deltaElem.GetFloat("add");
|
||||
if (deltaElem.HasAttribute("mul"))
|
||||
sizeMul_ = deltaElem.GetFloat("mul");
|
||||
}
|
||||
|
||||
if (rootElem.HasChild("color"))
|
||||
{
|
||||
ColorFrame colorFrame(rootElem.GetChild("color").GetColor("value"));
|
||||
SetColorFrame(0, colorFrame);
|
||||
}
|
||||
|
||||
if (rootElem.HasChild("colorfade"))
|
||||
{
|
||||
Vector<ColorFrame> fades;
|
||||
for (XMLElement colorFadeElem = rootElem.GetChild("colorfade"); colorFadeElem; colorFadeElem = colorFadeElem.GetNext("colorfade"))
|
||||
fades.Push(ColorFrame(colorFadeElem.GetColor("color"), colorFadeElem.GetFloat("time")));
|
||||
|
||||
SetColorFrames(fades);
|
||||
}
|
||||
|
||||
if (colorFrames_.Empty())
|
||||
colorFrames_.Push(ColorFrame(Color::WHITE));
|
||||
|
||||
if (rootElem.HasChild("texanim"))
|
||||
{
|
||||
Vector<TextureFrame> animations;
|
||||
for (XMLElement animElem = rootElem.GetChild("texanim"); animElem; animElem = animElem.GetNext("texanim"))
|
||||
{
|
||||
TextureFrame animation;
|
||||
animation.uv_ = animElem.GetRect("uv");
|
||||
animation.time_ = animElem.GetFloat("time");
|
||||
animations.Push(animation);
|
||||
}
|
||||
|
||||
SetTextureFrames(animations);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ParticleEffect::Save(Serializer& dest) const
|
||||
{
|
||||
XMLFile file(context_);
|
||||
XMLElement rootElem = file.CreateRoot("particleeffect");
|
||||
|
||||
XMLElement childElem = rootElem.CreateChild("material");
|
||||
childElem.SetAttribute("name", GetResourceName(material_));
|
||||
|
||||
childElem = rootElem.CreateChild("numparticles");
|
||||
childElem.SetInt("value", numParticles_);
|
||||
|
||||
childElem = rootElem.CreateChild("updateinvisible");
|
||||
childElem.SetBool("enable", updateInvisible_);
|
||||
|
||||
childElem = rootElem.CreateChild("relative");
|
||||
childElem.SetBool("enable", relative_);
|
||||
|
||||
childElem = rootElem.CreateChild("scaled");
|
||||
childElem.SetBool("enable", scaled_);
|
||||
|
||||
childElem = rootElem.CreateChild("sorted");
|
||||
childElem.SetBool("enable", sorted_);
|
||||
|
||||
childElem = rootElem.CreateChild("animlodbias");
|
||||
childElem.SetFloat("value", animationLodBias_);
|
||||
|
||||
childElem = rootElem.CreateChild("emittertype");
|
||||
childElem.SetAttribute("value", emitterTypeNames[emitterType_]);
|
||||
|
||||
childElem = rootElem.CreateChild("emittersize");
|
||||
childElem.SetVector3("value", emitterSize_);
|
||||
|
||||
childElem = rootElem.CreateChild("direction");
|
||||
childElem.SetVector3("min", directionMin_);
|
||||
childElem.SetVector3("max", directionMax_);
|
||||
|
||||
childElem = rootElem.CreateChild("constantforce");
|
||||
childElem.SetVector3("value", constantForce_);
|
||||
|
||||
childElem = rootElem.CreateChild("dampingforce");
|
||||
childElem.SetFloat("value", dampingForce_);
|
||||
|
||||
childElem = rootElem.CreateChild("activetime");
|
||||
childElem.SetFloat("value", activeTime_);
|
||||
|
||||
childElem = rootElem.CreateChild("inactivetime");
|
||||
childElem.SetFloat("value", inactiveTime_);
|
||||
|
||||
childElem = rootElem.CreateChild("emissionrate");
|
||||
childElem.SetFloat("min", emissionRateMin_);
|
||||
childElem.SetFloat("max", emissionRateMax_);
|
||||
|
||||
childElem = rootElem.CreateChild("particlesize");
|
||||
childElem.SetVector2("min", sizeMin_);
|
||||
childElem.SetVector2("max", sizeMax_);
|
||||
|
||||
childElem = rootElem.CreateChild("timetolive");
|
||||
childElem.SetFloat("min", timeToLiveMin_);
|
||||
childElem.SetFloat("max", timeToLiveMax_);
|
||||
|
||||
childElem = rootElem.CreateChild("velocity");
|
||||
childElem.SetFloat("min", velocityMin_);
|
||||
childElem.SetFloat("max", velocityMax_);
|
||||
|
||||
childElem = rootElem.CreateChild("rotation");
|
||||
childElem.SetFloat("min", rotationMin_);
|
||||
childElem.SetFloat("max", rotationMax_);
|
||||
|
||||
childElem = rootElem.CreateChild("rotationspeed");
|
||||
childElem.SetFloat("min", rotationSpeedMin_);
|
||||
childElem.SetFloat("max", rotationSpeedMax_);
|
||||
|
||||
childElem = rootElem.CreateChild("sizedelta");
|
||||
childElem.SetFloat("add", sizeAdd_);
|
||||
childElem.SetFloat("mul", sizeMul_);
|
||||
|
||||
if (colorFrames_.Size() == 1)
|
||||
{
|
||||
childElem = rootElem.CreateChild("color");
|
||||
childElem.SetColor("value", colorFrames_[0].color_);
|
||||
}
|
||||
|
||||
if (colorFrames_.Size() > 1)
|
||||
{
|
||||
for (unsigned i = 0; i < colorFrames_.Size(); ++i)
|
||||
{
|
||||
childElem = rootElem.CreateChild("colorfade");
|
||||
childElem.SetColor("color", colorFrames_[i].color_);
|
||||
childElem.SetFloat("time", colorFrames_[i].time_);
|
||||
}
|
||||
}
|
||||
|
||||
for (unsigned i = 0; i < textureFrames_.Size(); ++i)
|
||||
{
|
||||
childElem = rootElem.CreateChild("texanim");
|
||||
childElem.SetRect("uv", textureFrames_[i].uv_);
|
||||
childElem.SetFloat("time", textureFrames_[i].time_);
|
||||
}
|
||||
|
||||
return file.Save(dest);
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMaterial(Material* material)
|
||||
{
|
||||
material_ = material;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetNumParticles(unsigned num)
|
||||
{
|
||||
numParticles_ = Max(0, num);
|
||||
}
|
||||
|
||||
void ParticleEffect::SetUpdateInvisible(bool enable)
|
||||
{
|
||||
updateInvisible_ = enable;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetRelative(bool enable)
|
||||
{
|
||||
relative_ = enable;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetScaled(bool enable)
|
||||
{
|
||||
scaled_ = enable;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetSorted(bool enable)
|
||||
{
|
||||
sorted_ = enable;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetAnimationLodBias(float lodBias)
|
||||
{
|
||||
animationLodBias_ = lodBias;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetEmitterType(EmitterType type)
|
||||
{
|
||||
emitterType_ = type;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetEmitterSize(const Vector3& size)
|
||||
{
|
||||
emitterSize_ = size;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMinDirection(const Vector3& direction)
|
||||
{
|
||||
directionMin_ = direction;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMaxDirection(const Vector3& direction)
|
||||
{
|
||||
directionMax_ = direction;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetConstantForce(const Vector3& force)
|
||||
{
|
||||
constantForce_ = force;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetDampingForce(float force)
|
||||
{
|
||||
dampingForce_ = force;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetActiveTime(float time)
|
||||
{
|
||||
activeTime_ = time;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetInactiveTime(float time)
|
||||
{
|
||||
inactiveTime_ = time;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMinEmissionRate(float rate)
|
||||
{
|
||||
emissionRateMin_ = Max(rate, MIN_EMISSION_RATE);
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMaxEmissionRate(float rate)
|
||||
{
|
||||
emissionRateMax_ = Max(rate, MIN_EMISSION_RATE);
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMinParticleSize(const Vector2& size)
|
||||
{
|
||||
sizeMin_ = size;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMaxParticleSize(const Vector2& size)
|
||||
{
|
||||
sizeMax_ = size;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMinTimeToLive(float time)
|
||||
{
|
||||
timeToLiveMin_ = Max(time, 0.0f);
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMaxTimeToLive(float time)
|
||||
{
|
||||
timeToLiveMax_ = Max(time, 0.0f);
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMinVelocity(float velocity)
|
||||
{
|
||||
velocityMin_ = velocity;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMaxVelocity(float velocity)
|
||||
{
|
||||
velocityMax_ = velocity;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMinRotation(float rotation)
|
||||
{
|
||||
rotationMin_ = rotation;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMaxRotation(float rotation)
|
||||
{
|
||||
rotationMax_ = rotation;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMinRotationSpeed(float speed)
|
||||
{
|
||||
rotationSpeedMin_ = speed;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetMaxRotationSpeed(float speed)
|
||||
{
|
||||
rotationSpeedMax_ = speed;
|
||||
}
|
||||
|
||||
|
||||
void ParticleEffect::SetSizeAdd(float sizeAdd)
|
||||
{
|
||||
sizeAdd_ = sizeAdd;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetSizeMul(float sizeMul)
|
||||
{
|
||||
sizeMul_ = sizeMul;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetColorFrames(const Vector<ColorFrame>& colorFrames)
|
||||
{
|
||||
colorFrames_ = colorFrames;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetColorFrame(unsigned index, const ColorFrame& colorFrame)
|
||||
{
|
||||
if (colorFrames_.Size() < index + 1)
|
||||
colorFrames_.Resize(index + 1);
|
||||
colorFrames_[index] = colorFrame;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetTextureFrames(const Vector<TextureFrame>& textureFrames)
|
||||
{
|
||||
textureFrames_ = textureFrames;
|
||||
}
|
||||
|
||||
void ParticleEffect::SetTextureFrame(unsigned index, const TextureFrame& textureFrame)
|
||||
{
|
||||
if (textureFrames_.Size() < index + 1)
|
||||
textureFrames_.Resize(index + 1);
|
||||
textureFrames_[index] = textureFrame;
|
||||
}
|
||||
|
||||
const ColorFrame* ParticleEffect::GetColorFrame(unsigned index) const
|
||||
{
|
||||
return index < colorFrames_.Size() ? &colorFrames_[index] : (ColorFrame*)0;
|
||||
}
|
||||
|
||||
const TextureFrame* ParticleEffect::GetTextureFrame(unsigned index) const
|
||||
{
|
||||
return index < colorFrames_.Size() ? &textureFrames_[index] : (TextureFrame*)0;
|
||||
}
|
||||
|
||||
Vector3 ParticleEffect::GetRandomDirection() const
|
||||
{
|
||||
return Vector3(
|
||||
Lerp(directionMin_.x_, directionMax_.x_, Random(1.0f)),
|
||||
Lerp(directionMin_.y_, directionMax_.y_, Random(1.0f)),
|
||||
Lerp(directionMin_.z_, directionMax_.z_, Random(1.0f))
|
||||
);
|
||||
}
|
||||
|
||||
Vector2 ParticleEffect::GetRandomSize() const
|
||||
{
|
||||
return sizeMin_.Lerp(sizeMax_, Random(1.0f));
|
||||
}
|
||||
|
||||
float ParticleEffect::GetRandomVelocity() const
|
||||
{
|
||||
return Lerp(velocityMin_, velocityMax_, Random(1.0f));
|
||||
}
|
||||
|
||||
float ParticleEffect::GetRandomTimeToLive() const
|
||||
{
|
||||
return Lerp(timeToLiveMin_, timeToLiveMax_, Random(1.0f));
|
||||
}
|
||||
|
||||
float ParticleEffect::GetRandomRotationSpeed() const
|
||||
{
|
||||
return Lerp(rotationSpeedMin_, rotationSpeedMax_, Random(1.0f));
|
||||
}
|
||||
|
||||
float ParticleEffect::GetRandomRotation() const
|
||||
{
|
||||
return Lerp(rotationMin_, rotationMax_, Random(1.0f));
|
||||
}
|
||||
|
||||
void ParticleEffect::GetFloatMinMax(const XMLElement& element, float& minValue, float& maxValue)
|
||||
{
|
||||
if (element.IsNull())
|
||||
return;
|
||||
|
||||
if (element.HasAttribute("value"))
|
||||
minValue = maxValue = element.GetFloat("value");
|
||||
|
||||
if (element.HasAttribute("min") && element.HasAttribute("max"))
|
||||
{
|
||||
minValue = element.GetFloat("min");
|
||||
maxValue = element.GetFloat("max");
|
||||
}
|
||||
}
|
||||
|
||||
void ParticleEffect::GetVector2MinMax(const XMLElement& element, Vector2& minValue, Vector2& maxValue)
|
||||
{
|
||||
if (element.IsNull())
|
||||
return;
|
||||
|
||||
if (element.HasAttribute("value"))
|
||||
minValue = maxValue = element.GetVector2("value");
|
||||
|
||||
if (element.HasAttribute("min") && element.HasAttribute("max"))
|
||||
{
|
||||
minValue = element.GetVector2("min");
|
||||
maxValue = element.GetVector2("max");
|
||||
}
|
||||
}
|
||||
|
||||
void ParticleEffect::GetVector3MinMax(const XMLElement& element, Vector3& minValue, Vector3& maxValue)
|
||||
{
|
||||
if (element.IsNull())
|
||||
return;
|
||||
|
||||
if (element.HasAttribute("value"))
|
||||
minValue = maxValue = element.GetVector3("value");
|
||||
|
||||
if (element.HasAttribute("min") && element.HasAttribute("max"))
|
||||
{
|
||||
minValue = element.GetVector3("min");
|
||||
maxValue = element.GetVector3("max");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,342 @@
|
|||
//
|
||||
// Copyright (c) 2008-2014 the Urho3D project.
|
||||
//
|
||||
// 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.
|
||||
//
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "Resource.h"
|
||||
|
||||
namespace Urho3D
|
||||
{
|
||||
|
||||
/// Particle emitter shapes.
|
||||
enum EmitterType
|
||||
{
|
||||
EMITTER_SPHERE,
|
||||
EMITTER_BOX
|
||||
};
|
||||
|
||||
/// %Color animation frame definition.
|
||||
struct ColorFrame
|
||||
{
|
||||
/// Construct with default values.
|
||||
ColorFrame() :
|
||||
time_(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
/// Construct with a color and zero time.
|
||||
ColorFrame(const Color& color) :
|
||||
color_(color),
|
||||
time_(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
/// Construct from a color and time.
|
||||
ColorFrame(const Color& color, float time) :
|
||||
color_(color),
|
||||
time_(time)
|
||||
{
|
||||
}
|
||||
|
||||
/// Return interpolated value with another color-time pair at the time specified.
|
||||
Color Interpolate(const ColorFrame& next, float time) const
|
||||
{
|
||||
float timeInterval = next.time_ - time_;
|
||||
if (timeInterval > 0.0f)
|
||||
{
|
||||
float t = (time - time_) / timeInterval;
|
||||
return color_.Lerp(next.color_, t);
|
||||
}
|
||||
else
|
||||
return next.color_;
|
||||
}
|
||||
|
||||
/// Color.
|
||||
Color color_;
|
||||
/// Time.
|
||||
float time_;
|
||||
};
|
||||
|
||||
/// %Texture animation frame definition.
|
||||
struct TextureFrame
|
||||
{
|
||||
/// Construct with default values.
|
||||
TextureFrame() :
|
||||
uv_(0.0f, 0.0f, 1.0f, 1.0f),
|
||||
time_(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
/// UV coordinates.
|
||||
Rect uv_;
|
||||
/// Time.
|
||||
float time_;
|
||||
};
|
||||
|
||||
static const unsigned DEFAULT_NUM_PARTICLES = 10;
|
||||
|
||||
class Material;
|
||||
class XMLFile;
|
||||
class XMLElement;
|
||||
|
||||
/// %Particle effect definition.
|
||||
class URHO3D_API ParticleEffect : public Resource
|
||||
{
|
||||
OBJECT(ParticleEffect);
|
||||
|
||||
public:
|
||||
/// Construct.
|
||||
ParticleEffect(Context* context);
|
||||
/// Destruct.
|
||||
virtual ~ParticleEffect();
|
||||
/// Register object factory.
|
||||
static void RegisterObject(Context* context);
|
||||
|
||||
/// Load resource. Return true if successful.
|
||||
virtual bool Load(Deserializer& source);
|
||||
/// Save resource. Return true if successful.
|
||||
virtual bool Save(Serializer& dest) const;
|
||||
|
||||
/// Set material.
|
||||
void SetMaterial(Material* material);
|
||||
/// Set maximum number of particles.
|
||||
void SetNumParticles(unsigned num);
|
||||
/// Set whether to update when particles are not visible.
|
||||
void SetUpdateInvisible(bool enable);
|
||||
/// Set whether billboards are relative to the scene node. Default true.
|
||||
void SetRelative(bool enable);
|
||||
/// Set scaled.
|
||||
void SetScaled(bool enable);
|
||||
/// Set sorted.
|
||||
void SetSorted(bool enable);
|
||||
/// Set animation LOD bias.
|
||||
void SetAnimationLodBias(float lodBias);
|
||||
/// Set emitter type.
|
||||
void SetEmitterType(EmitterType type);
|
||||
/// Set emitter size.
|
||||
void SetEmitterSize(const Vector3& size);
|
||||
/// Set negative direction limit.
|
||||
void SetMinDirection(const Vector3& direction);
|
||||
/// Set positive direction limit.
|
||||
void SetMaxDirection(const Vector3& direction);
|
||||
/// Set constant force acting on particles.
|
||||
void SetConstantForce(const Vector3& force);
|
||||
/// Set particle velocity damping force.
|
||||
void SetDampingForce(float force);
|
||||
/// Set emission active period length (0 = infinite.)
|
||||
void SetActiveTime(float time);
|
||||
/// Set emission inactive period length (0 = infinite.)
|
||||
void SetInactiveTime(float time);
|
||||
/// Set minimum emission rate.
|
||||
void SetMinEmissionRate(float rate);
|
||||
/// Set maximum emission rate.
|
||||
void SetMaxEmissionRate(float rate);
|
||||
/// Set particle minimum size.
|
||||
void SetMinParticleSize(const Vector2& size);
|
||||
/// Set particle maximum size.
|
||||
void SetMaxParticleSize(const Vector2& size);
|
||||
/// Set particle minimum time to live.
|
||||
void SetMinTimeToLive(float time);
|
||||
/// Set particle maximum time to live.
|
||||
void SetMaxTimeToLive(float time);
|
||||
/// Set particle minimum velocity.
|
||||
void SetMinVelocity(float velocity);
|
||||
/// Set particle maximum velocity.
|
||||
void SetMaxVelocity(float velocity);
|
||||
/// Set particle minimum rotation.
|
||||
void SetMinRotation(float rotation);
|
||||
/// Set particle maximum rotation.
|
||||
void SetMaxRotation(float rotation);
|
||||
/// Set particle minimum rotation speed.
|
||||
void SetMinRotationSpeed(float speed);
|
||||
/// Set particle maximum rotation speed.
|
||||
void SetMaxRotationSpeed(float speed);
|
||||
/// Set particle size additive modifier.
|
||||
void SetSizeAdd(float sizeAdd);
|
||||
/// Set particle size multiplicative modifier.
|
||||
void SetSizeMul(float sizeMul);
|
||||
/// Set color animation of particles.
|
||||
void SetColorFrames(const Vector<ColorFrame>& colorFrames);
|
||||
/// Set number of color animation frames.
|
||||
void SetColorFrame(unsigned index, const ColorFrame& colorFrame);
|
||||
/// Set particle texture animation.
|
||||
void SetTextureFrames(const Vector<TextureFrame>& animation);
|
||||
/// Set number of texture animation frames.
|
||||
void SetTextureFrame(unsigned index, const TextureFrame& textureFrame);
|
||||
|
||||
/// Return material.
|
||||
Material* GetMaterial() const { return material_; }
|
||||
/// Return maximum number of particles.
|
||||
unsigned GetNumParticles() const { return numParticles_; }
|
||||
/// Return whether to update when particles are not visible.
|
||||
bool GetUpdateInvisible() const { return updateInvisible_; }
|
||||
/// Return whether billboards are relative to the scene node.
|
||||
bool IsRelative() const { return relative_; }
|
||||
/// Return whether scene node scale affects billboards' size.
|
||||
bool IsScaled() const { return scaled_; }
|
||||
/// Return whether billboards are sorted.
|
||||
bool IsSorted() const { return sorted_; }
|
||||
/// Return animation Lod bias.
|
||||
float GetAnimationLodBias() const { return animationLodBias_; }
|
||||
/// Return emitter type.
|
||||
EmitterType GetEmitterType() const { return emitterType_; }
|
||||
/// Return emitter size.
|
||||
const Vector3& GetEmitterSize() const { return emitterSize_; }
|
||||
/// Return negative direction limit.
|
||||
const Vector3& GetMinDirection() const { return directionMin_; }
|
||||
/// Return positive direction limit.
|
||||
const Vector3& GetMaxDirection() const { return directionMax_; }
|
||||
/// Return constant force acting on particles.
|
||||
const Vector3& GetConstantForce() const { return constantForce_; }
|
||||
/// Return particle velocity damping force.
|
||||
float GetDampingForce() const { return dampingForce_; }
|
||||
/// Return emission active period length (0 = infinite.)
|
||||
float GetActiveTime() const { return activeTime_; }
|
||||
/// Return emission inactive period length (0 = infinite.)
|
||||
float GetInactiveTime() const { return inactiveTime_; }
|
||||
/// Return minimum emission rate.
|
||||
float GetMinEmissionRate() const { return emissionRateMin_; }
|
||||
/// Return maximum emission rate.
|
||||
float GetMaxEmissionRate() const { return emissionRateMax_; }
|
||||
/// Return particle minimum size.
|
||||
const Vector2& GetMinParticleSize() const { return sizeMin_; }
|
||||
/// Return particle maximum size.
|
||||
const Vector2& GetMaxParticleSize() const { return sizeMax_; }
|
||||
/// Return particle minimum time to live.
|
||||
float GetMinTimeToLive() const { return timeToLiveMin_; }
|
||||
/// Return particle maximum time to live.
|
||||
float GetMaxTimeToLive() const { return timeToLiveMax_; }
|
||||
/// Return particle minimum velocity.
|
||||
float GetMinVelocity() const { return velocityMin_; }
|
||||
/// Return particle maximum velocity.
|
||||
float GetMaxVelocity() const { return velocityMax_; }
|
||||
/// Return particle minimum rotation.
|
||||
float GetMinRotation() const { return rotationMin_; }
|
||||
/// Return particle maximum rotation.
|
||||
float GetMaxRotation() const { return rotationMax_; }
|
||||
/// Return particle minimum rotation speed.
|
||||
float GetMinRotationSpeed() const { return rotationSpeedMin_; }
|
||||
/// Return particle maximum rotation speed.
|
||||
float GetMaxRotationSpeed() const { return rotationSpeedMax_; }
|
||||
/// Return particle size additive modifier.
|
||||
float GetSizeAdd() const { return sizeAdd_; }
|
||||
/// Return particle size multiplicative modifier.
|
||||
float GetSizeMul() const { return sizeMul_; }
|
||||
/// Return all color animation frames.
|
||||
const Vector<ColorFrame>& GetColorFrames() const { return colorFrames_; }
|
||||
/// Return number of color animation frames.
|
||||
unsigned GetNumColorFrames() const { return colorFrames_.Size(); }
|
||||
/// Return a color animation frame, or null if outside range.
|
||||
const ColorFrame* GetColorFrame(unsigned index) const;
|
||||
/// Return all texture animation frames.
|
||||
const Vector<TextureFrame>& GetTextureFrames() const { return textureFrames_; }
|
||||
/// Return number of texture animation frames.
|
||||
unsigned GetNumTextureFrames() const { return textureFrames_.Size(); }
|
||||
/// Return a texture animation frame, or null if outside range.
|
||||
const TextureFrame* GetTextureFrame(unsigned index) const;
|
||||
|
||||
/// Return random direction.
|
||||
Vector3 GetRandomDirection() const;
|
||||
/// Return random size.
|
||||
Vector2 GetRandomSize() const;
|
||||
/// Return random velocity.
|
||||
float GetRandomVelocity() const;
|
||||
/// Return random timetolive.
|
||||
float GetRandomTimeToLive() const;
|
||||
/// Return random rotationspeed.
|
||||
float GetRandomRotationSpeed() const;
|
||||
/// Return random rotation.
|
||||
float GetRandomRotation() const;
|
||||
|
||||
private:
|
||||
/// Read a float range from an XML element.
|
||||
void GetFloatMinMax(const XMLElement& element, float& minValue, float& maxValue);
|
||||
/// Read a Vector2 range from an XML element.
|
||||
void GetVector2MinMax(const XMLElement& element, Vector2& minValue, Vector2& maxValue);
|
||||
/// Read a Vector3 from an XML element.
|
||||
void GetVector3MinMax(const XMLElement& element, Vector3& minValue, Vector3& maxValue);
|
||||
|
||||
/// Material.
|
||||
SharedPtr<Material> material_;
|
||||
/// Number of particles.
|
||||
unsigned numParticles_;
|
||||
/// Update when invisible flag.
|
||||
bool updateInvisible_;
|
||||
/// Billboards relative flag.
|
||||
bool relative_;
|
||||
/// Scale affects billboard scale flag.
|
||||
bool scaled_;
|
||||
/// Billboards sorted flag.
|
||||
bool sorted_;
|
||||
/// Animation LOD bias.
|
||||
float animationLodBias_;
|
||||
/// Emitter shape.
|
||||
EmitterType emitterType_;
|
||||
/// Emitter size.
|
||||
Vector3 emitterSize_;
|
||||
/// Particle direction minimum.
|
||||
Vector3 directionMin_;
|
||||
/// Particle direction maximum.
|
||||
Vector3 directionMax_;
|
||||
/// Particle constant force.
|
||||
Vector3 constantForce_;
|
||||
/// Particle velocity damping force.
|
||||
float dampingForce_;
|
||||
/// Active period.
|
||||
float activeTime_;
|
||||
/// Inactive period.
|
||||
float inactiveTime_;
|
||||
/// Particles per second minimum.
|
||||
float emissionRateMin_;
|
||||
/// Particles per second maximum.
|
||||
float emissionRateMax_;
|
||||
/// Particle size minimum.
|
||||
Vector2 sizeMin_;
|
||||
/// Particle size maximum.
|
||||
Vector2 sizeMax_;
|
||||
/// Particle time to live minimum.
|
||||
float timeToLiveMin_;
|
||||
/// Particle time to live maximum.
|
||||
float timeToLiveMax_;
|
||||
/// Particle velocity minimum.
|
||||
float velocityMin_;
|
||||
/// Particle velocity maximum.
|
||||
float velocityMax_;
|
||||
/// Particle rotation angle minimum.
|
||||
float rotationMin_;
|
||||
/// Particle rotation angle maximum.
|
||||
float rotationMax_;
|
||||
/// Particle rotation speed minimum.
|
||||
float rotationSpeedMin_;
|
||||
/// Particle rotation speed maximum.
|
||||
float rotationSpeedMax_;
|
||||
/// Particle size additive parameter.
|
||||
float sizeAdd_;
|
||||
/// Particle size multiplicative parameter.
|
||||
float sizeMul_;
|
||||
/// Particle color animation frames.
|
||||
Vector<ColorFrame> colorFrames_;
|
||||
/// Texture animation frames.
|
||||
Vector<TextureFrame> textureFrames_;
|
||||
};
|
||||
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -27,12 +27,7 @@
|
|||
namespace Urho3D
|
||||
{
|
||||
|
||||
/// Particle emitter shapes.
|
||||
enum EmitterType
|
||||
{
|
||||
EMITTER_SPHERE,
|
||||
EMITTER_BOX
|
||||
};
|
||||
class ParticleEffect;
|
||||
|
||||
/// One particle in the particle system.
|
||||
struct Particle
|
||||
|
@ -55,72 +50,11 @@ struct Particle
|
|||
unsigned texIndex_;
|
||||
};
|
||||
|
||||
/// %Color animation frame definition.
|
||||
struct ColorFrame
|
||||
{
|
||||
/// Construct with default values.
|
||||
ColorFrame() :
|
||||
time_(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
/// Construct with a color and zero time.
|
||||
ColorFrame(const Color& color) :
|
||||
color_(color),
|
||||
time_(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
/// Construct from a color and time.
|
||||
ColorFrame(const Color& color, float time) :
|
||||
color_(color),
|
||||
time_(time)
|
||||
{
|
||||
}
|
||||
|
||||
/// Return interpolated value with another color-time pair at the time specified.
|
||||
Color Interpolate(const ColorFrame& next, float time)
|
||||
{
|
||||
float timeInterval = next.time_ - time_;
|
||||
if (timeInterval > 0.0f)
|
||||
{
|
||||
float t = (time - time_) / timeInterval;
|
||||
return color_.Lerp(next.color_, t);
|
||||
}
|
||||
else
|
||||
return next.color_;
|
||||
}
|
||||
|
||||
/// Color.
|
||||
Color color_;
|
||||
/// Time.
|
||||
float time_;
|
||||
};
|
||||
|
||||
/// %Texture animation frame definition.
|
||||
struct TextureFrame
|
||||
{
|
||||
/// Construct with default values.
|
||||
TextureFrame() :
|
||||
uv_(0.0f, 0.0f, 1.0f, 1.0f),
|
||||
time_(0.0f)
|
||||
{
|
||||
}
|
||||
|
||||
/// UV coordinates.
|
||||
Rect uv_;
|
||||
/// Time.
|
||||
float time_;
|
||||
};
|
||||
|
||||
class XMLFile;
|
||||
class XMLElement;
|
||||
|
||||
/// %Particle emitter component.
|
||||
class URHO3D_API ParticleEmitter : public BillboardSet
|
||||
{
|
||||
OBJECT(ParticleEmitter);
|
||||
|
||||
|
||||
public:
|
||||
/// Construct.
|
||||
ParticleEmitter(Context* context);
|
||||
|
@ -128,252 +62,72 @@ public:
|
|||
virtual ~ParticleEmitter();
|
||||
/// Register object factory.
|
||||
static void RegisterObject(Context* context);
|
||||
|
||||
|
||||
/// Handle enabled/disabled state change.
|
||||
virtual void OnSetEnabled();
|
||||
/// Update before octree reinsertion. Is called from a worker thread.
|
||||
virtual void Update(const FrameInfo& frame);
|
||||
|
||||
/// Load emitter parameters from an XML file.
|
||||
bool Load(XMLFile* file);
|
||||
/// Save particle emitter parameters to an XML file. Return true if successful.
|
||||
bool Save(XMLFile* file) const;
|
||||
|
||||
/// Set particle effect.
|
||||
void SetEffect(ParticleEffect* effect);
|
||||
/// Set maximum number of particles.
|
||||
void SetNumParticles(unsigned num);
|
||||
/// Set emission rate (both minimum and maximum.)
|
||||
void SetEmissionRate(float rate);
|
||||
/// Set minimum emission rate.
|
||||
void SetMinEmissionRate(float rate);
|
||||
/// Set maximum emission rate.
|
||||
void SetMaxEmissionRate(float rate);
|
||||
/// Set emitter type.
|
||||
void SetEmitterType(EmitterType type);
|
||||
/// Set emitter size.
|
||||
void SetEmitterSize(const Vector3& size);
|
||||
/// Set emission active period length (0 = infinite.)
|
||||
void SetActiveTime(float time);
|
||||
/// Set emission inactive period length (0 = infinite.)
|
||||
void SetInactiveTime(float time);
|
||||
/// Set whether should be emitting. If the state was changed, also resets the emission period timer.
|
||||
void SetEmitting(bool enable);
|
||||
/// Set whether to update when particles are not visible.
|
||||
void SetUpdateInvisible(bool enable);
|
||||
/// Set particle time to live (both minimum and maximum.)
|
||||
void SetTimeToLive(float time);
|
||||
/// Set particle minimum time to live.
|
||||
void SetMinTimeToLive(float time);
|
||||
/// Set particle maximum time to live.
|
||||
void SetMaxTimeToLive(float time);
|
||||
/// Set particle size (both minimum and maximum.)
|
||||
void SetParticleSize(const Vector2& size);
|
||||
/// Set particle minimum size.
|
||||
void SetMinParticleSize(const Vector2& size);
|
||||
/// Set particle maximum size.
|
||||
void SetMaxParticleSize(const Vector2& size);
|
||||
/// Set negative direction limit.
|
||||
void SetMinDirection(const Vector3& direction);
|
||||
/// Set positive direction limit.
|
||||
void SetMaxDirection(const Vector3& direction);
|
||||
/// Set particle velocity (both minimum and maximum.)
|
||||
void SetVelocity(float velocity);
|
||||
/// Set particle minimum velocity.
|
||||
void SetMinVelocity(float velocity);
|
||||
/// Set particle maximum velocity.
|
||||
void SetMaxVelocity(float velocity);
|
||||
/// Set particle rotation (both minimum and maximum.)
|
||||
void SetRotation(float rotation);
|
||||
/// Set particle minimum rotation.
|
||||
void SetMinRotation(float rotation);
|
||||
/// Set particle maximum rotation.
|
||||
void SetMaxRotation(float rotation);
|
||||
/// Set particle rotation speed (both minimum and maximum.)
|
||||
void SetRotationSpeed(float speed);
|
||||
/// Set particle minimum rotation speed.
|
||||
void SetMinRotationSpeed(float speed);
|
||||
/// Set particle maximum rotation speed.
|
||||
void SetMaxRotationSpeed(float speed);
|
||||
/// Set constant force acting on particles.
|
||||
void SetConstantForce(const Vector3& force);
|
||||
/// Set particle velocity damping force.
|
||||
void SetDampingForce(float force);
|
||||
/// Set particle size additive modifier.
|
||||
void SetSizeAdd(float sizeAdd);
|
||||
/// Set particle size multiplicative modifier.
|
||||
void SetSizeMul(float sizeMul);
|
||||
/// Set color of particles.
|
||||
void SetColor(const Color& color);
|
||||
/// Set color animation of particles.
|
||||
void SetColors(const Vector<ColorFrame>& colors);
|
||||
/// Set number of color animation frames.
|
||||
void SetNumColors(unsigned num);
|
||||
/// Set particle texture animation.
|
||||
void SetTextureFrames(const Vector<TextureFrame>& animation);
|
||||
/// Set number of texture animation frames.
|
||||
void SetNumTextureFrames(unsigned num);
|
||||
/// Reset the emission period timer.
|
||||
void ResetEmissionTimer();
|
||||
/// Remove all current particles.
|
||||
void RemoveAllParticles();
|
||||
/// Reset the particle emitter completely. Removes current particles, sets emitting state on, and resets the emission timer.
|
||||
void Reset();
|
||||
|
||||
/// Apply not continuously updated values such as the material, the number of particles and sorting mode from the particle effect. Call this if you change the effect programmatically.
|
||||
void ApplyEffect();
|
||||
|
||||
/// Return particle effect.
|
||||
ParticleEffect* GetEffect() const { return effect_; }
|
||||
/// Return maximum number of particles.
|
||||
unsigned GetNumParticles() const { return particles_.Size(); }
|
||||
/// Return whether is currently emitting.
|
||||
bool IsEmitting() const { return emitting_; }
|
||||
/// Return whether to update when particles are not visible.
|
||||
bool GetUpdateInvisible() const { return updateInvisible_; }
|
||||
/// Return minimum emission rate.
|
||||
float GetMinEmissionRate() const { return emissionRateMin_; }
|
||||
/// Return maximum emission rate.
|
||||
float GetMaxEmissionRate() const { return emissionRateMax_; }
|
||||
/// Return emitter type.
|
||||
EmitterType GetEmitterType() const { return emitterType_; }
|
||||
/// Return emitter size.
|
||||
const Vector3& GetEmitterSize() const { return emitterSize_; }
|
||||
/// Return emission active period length (0 = infinite.)
|
||||
float GetActiveTime() const { return activeTime_; }
|
||||
/// Return emission inactive period length (0 = infinite.)
|
||||
float GetInactiveTime() const { return inactiveTime_; }
|
||||
/// Return particle minimum time to live.
|
||||
float GetMinTimeToLive() const { return timeToLiveMin_; }
|
||||
/// Return particle maximum time to live.
|
||||
float GetMaxTimeToLive() const { return timeToLiveMax_; }
|
||||
/// Return particle minimum size.
|
||||
const Vector2& GetMinParticleSize() const { return sizeMin_; }
|
||||
/// Return particle maximum size.
|
||||
const Vector2& GetMaxParticleSize() const { return sizeMax_; }
|
||||
/// Return negative direction limit.
|
||||
const Vector3& GetMinDirection() const { return directionMin_; }
|
||||
/// Return positive direction limit.
|
||||
const Vector3& GetMaxDirection() const { return directionMax_; }
|
||||
/// Return particle minimum velocity.
|
||||
float GetMinVelocity() const { return velocityMin_; }
|
||||
/// Return particle maximum velocity.
|
||||
float GetMaxVelocity() const { return velocityMax_; }
|
||||
/// Return particle minimum rotation.
|
||||
float GetMinRotation() const { return rotationMin_; }
|
||||
/// Return particle maximum rotation.
|
||||
float GetMaxRotation() const { return rotationMax_; }
|
||||
/// Return particle minimum rotation speed.
|
||||
float GetMinRotationSpeed() const { return rotationSpeedMin_; }
|
||||
/// Return particle maximum rotation speed.
|
||||
float GetMaxRotationSpeed() const { return rotationSpeedMax_; }
|
||||
/// Return constant force acting on particles.
|
||||
const Vector3& GetConstantForce() const { return constantForce_; }
|
||||
/// Return particle velocity damping force.
|
||||
float GetDampingForce() const { return dampingForce_; }
|
||||
/// Return particle size additive modifier.
|
||||
float GetSizeAdd() const { return sizeAdd_; }
|
||||
/// Return particle size multiplicative modifier.
|
||||
float GetSizeMul() const { return sizeMul_; }
|
||||
/// Return all color animation frames.
|
||||
Vector<ColorFrame>& GetColors() { return colorFrames_; }
|
||||
/// Return number of color animation frames.
|
||||
unsigned GetNumColors() const { return colorFrames_.Size(); }
|
||||
/// Return a color animation frame, or null if outside range.
|
||||
ColorFrame* GetColor(unsigned index) { return index < colorFrames_.Size() ? &colorFrames_[index] : (ColorFrame*)0; }
|
||||
/// Return all texture animation frames.
|
||||
Vector<TextureFrame>& GetTextureFrame() { return textureFrames_; }
|
||||
/// Return number of texture animation frames.
|
||||
unsigned GetNumTextureFrames() const { return textureFrames_.Size(); }
|
||||
/// Return a texture animation frame, or null if outside range.
|
||||
TextureFrame* GetTextureFrame(unsigned index) { return index < colorFrames_.Size() ? &textureFrames_[index] : (TextureFrame*)0; }
|
||||
|
||||
|
||||
/// Set particles effect attribute.
|
||||
void SetEffectAttr(ResourceRef value);
|
||||
/// Set particles effect attribute.
|
||||
ResourceRef GetEffectAttr() const;
|
||||
/// Set particles attribute.
|
||||
void SetParticlesAttr(VariantVector value);
|
||||
/// Return particles attribute.
|
||||
VariantVector GetParticlesAttr() const;
|
||||
/// Set particle colors attribute.
|
||||
void SetColorsAttr(VariantVector value);
|
||||
/// Return particle colors attribute.
|
||||
VariantVector GetColorsAttr() const;
|
||||
/// Set texture animation attribute.
|
||||
void SetTextureFramesAttr(VariantVector value);
|
||||
/// Return texture animation attribute.
|
||||
VariantVector GetTextureFramesAttr() const;
|
||||
|
||||
|
||||
protected:
|
||||
/// Handle node being assigned.
|
||||
virtual void OnNodeSet(Node* node);
|
||||
|
||||
|
||||
/// Create a new particle. Return true if there was room.
|
||||
bool EmitNewParticle();
|
||||
/// Return a free particle index.
|
||||
unsigned GetFreeParticle() const;
|
||||
/// Read a float range from an XML element.
|
||||
void GetFloatMinMax(const XMLElement& element, float& minValue, float& maxValue);
|
||||
/// Read a Vector2 range from an XML element.
|
||||
void GetVector2MinMax(const XMLElement& element, Vector2& minValue, Vector2& maxValue);
|
||||
/// Read a Vector3 from an XML element.
|
||||
void GetVector3MinMax(const XMLElement& element, Vector3& minValue, Vector3& maxValue);
|
||||
|
||||
|
||||
private:
|
||||
/// Handle scene post-update event.
|
||||
void HandleScenePostUpdate(StringHash eventType, VariantMap& eventData);
|
||||
|
||||
/// Handle live reload of the particle effect.
|
||||
void HandleEffectReloadFinished(StringHash eventType, VariantMap& eventData);
|
||||
|
||||
/// Particle effect.
|
||||
SharedPtr<ParticleEffect> effect_;
|
||||
/// Particles.
|
||||
PODVector<Particle> particles_;
|
||||
/// Particle color animation frames.
|
||||
Vector<ColorFrame> colorFrames_;
|
||||
/// Texture animation frames.
|
||||
Vector<TextureFrame> textureFrames_;
|
||||
/// Emitter shape.
|
||||
EmitterType emitterType_;
|
||||
/// Emitter size.
|
||||
Vector3 emitterSize_;
|
||||
/// Particle direction minimum.
|
||||
Vector3 directionMin_;
|
||||
/// Particle direction maximum.
|
||||
Vector3 directionMax_;
|
||||
/// Particle constant force.
|
||||
Vector3 constantForce_;
|
||||
/// Particle size minimum.
|
||||
Vector2 sizeMin_;
|
||||
/// Particle size maximum.
|
||||
Vector2 sizeMax_;
|
||||
/// Particle velocity damping force.
|
||||
float dampingForce_;
|
||||
/// Active/inactive period timer.
|
||||
float periodTimer_;
|
||||
/// New particle emission timer.
|
||||
float emissionTimer_;
|
||||
/// Active period.
|
||||
float activeTime_;
|
||||
/// Inactive period.
|
||||
float inactiveTime_;
|
||||
/// Particles per second minimum.
|
||||
float emissionRateMin_;
|
||||
/// Particles per second maximum.
|
||||
float emissionRateMax_;
|
||||
/// Particle time to live minimum.
|
||||
float timeToLiveMin_;
|
||||
/// Particle time to live maximum.
|
||||
float timeToLiveMax_;
|
||||
/// Particle velocity minimum.
|
||||
float velocityMin_;
|
||||
/// Particle velocity maximum.
|
||||
float velocityMax_;
|
||||
/// Particle rotation angle minimum.
|
||||
float rotationMin_;
|
||||
/// Particle rotation angle maximum.
|
||||
float rotationMax_;
|
||||
/// Particle rotation speed minimum.
|
||||
float rotationSpeedMin_;
|
||||
/// Particle rotation speed maximum.
|
||||
float rotationSpeedMax_;
|
||||
/// Particle size additive parameter.
|
||||
float sizeAdd_;
|
||||
/// Particle size multiplicative parameter.
|
||||
float sizeMul_;
|
||||
/// Last scene timestep.
|
||||
float lastTimeStep_;
|
||||
/// Rendering framenumber on which was last updated.
|
||||
unsigned lastUpdateFrameNumber_;
|
||||
/// Currently emitting flag.
|
||||
bool emitting_;
|
||||
/// Update when invisible flag.
|
||||
bool updateInvisible_;
|
||||
/// Need update flag.
|
||||
bool needUpdate_;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,129 @@
|
|||
$#include "ParticleEffect.h"
|
||||
|
||||
enum EmitterType
|
||||
{
|
||||
EMITTER_SPHERE,
|
||||
EMITTER_BOX
|
||||
};
|
||||
|
||||
struct ColorFrame
|
||||
{
|
||||
ColorFrame();
|
||||
ColorFrame(const Color& color);
|
||||
ColorFrame(const Color& color, float time);
|
||||
~ColorFrame();
|
||||
|
||||
Color Interpolate(const ColorFrame& next, float time);
|
||||
Color color_ @ color;
|
||||
float time_ @ time;
|
||||
};
|
||||
|
||||
struct TextureFrame
|
||||
{
|
||||
TextureFrame();
|
||||
~TextureFrame();
|
||||
|
||||
Rect uv_ @ uv;
|
||||
float time_ @ time;
|
||||
};
|
||||
|
||||
class ParticleEffect : public Resource
|
||||
{
|
||||
void SetMaterial(Material* material);
|
||||
void SetNumParticles(unsigned num);
|
||||
void SetUpdateInvisible(bool enable);
|
||||
void SetRelative(bool enable);
|
||||
void SetScaled(bool enable);
|
||||
void SetSorted(bool enable);
|
||||
void SetAnimationLodBias(float lodBias);
|
||||
void SetEmitterType(EmitterType type);
|
||||
void SetEmitterSize(const Vector3& size);
|
||||
void SetMinDirection(const Vector3& direction);
|
||||
void SetMaxDirection(const Vector3& direction);
|
||||
void SetConstantForce(const Vector3& force);
|
||||
void SetDampingForce(float force);
|
||||
void SetActiveTime(float time);
|
||||
void SetInactiveTime(float time);
|
||||
void SetMinEmissionRate(float rate);
|
||||
void SetMaxEmissionRate(float rate);
|
||||
void SetMinParticleSize(const Vector2& size);
|
||||
void SetMaxParticleSize(const Vector2& size);
|
||||
void SetMinTimeToLive(float time);
|
||||
void SetMaxTimeToLive(float time);
|
||||
void SetMinVelocity(float velocity);
|
||||
void SetMaxVelocity(float velocity);
|
||||
void SetMinRotation(float rotation);
|
||||
void SetMaxRotation(float rotation);
|
||||
void SetMinRotationSpeed(float speed);
|
||||
void SetMaxRotationSpeed(float speed);
|
||||
void SetSizeAdd(float sizeAdd);
|
||||
void SetSizeMul(float sizeMul);
|
||||
void SetColorFrame(unsigned index, const ColorFrame& colorFrame);
|
||||
void SetTextureFrame(unsigned index, const TextureFrame& textureFrame);
|
||||
|
||||
Material* GetMaterial() const;
|
||||
unsigned GetNumParticles() const;
|
||||
bool GetUpdateInvisible() const;
|
||||
bool IsRelative() const;
|
||||
bool IsScaled() const;
|
||||
bool IsSorted() const;
|
||||
float GetAnimationLodBias() const;
|
||||
EmitterType GetEmitterType() const;
|
||||
const Vector3& GetEmitterSize() const;
|
||||
const Vector3& GetMinDirection() const;
|
||||
const Vector3& GetMaxDirection() const;
|
||||
const Vector3& GetConstantForce() const;
|
||||
float GetDampingForce() const;
|
||||
float GetActiveTime() const;
|
||||
float GetInactiveTime() const;
|
||||
float GetMinEmissionRate() const;
|
||||
float GetMaxEmissionRate() const;
|
||||
const Vector2& GetMinParticleSize() const;
|
||||
const Vector2& GetMaxParticleSize() const;
|
||||
float GetMinTimeToLive() const;
|
||||
float GetMaxTimeToLive() const;
|
||||
float GetMinVelocity() const;
|
||||
float GetMaxVelocity() const;
|
||||
float GetMinRotation() const;
|
||||
float GetMaxRotation() const;
|
||||
float GetMinRotationSpeed() const;
|
||||
float GetMaxRotationSpeed() const;
|
||||
float GetSizeAdd() const;
|
||||
float GetSizeMul() const;
|
||||
unsigned GetNumColorFrames() const;
|
||||
const ColorFrame* GetColorFrame(unsigned index) const;
|
||||
unsigned GetNumTextureFrames() const;
|
||||
const TextureFrame* GetTextureFrame(unsigned index) const;
|
||||
|
||||
tolua_property__get_set Material* material;
|
||||
tolua_property__get_set unsigned numParticles;
|
||||
tolua_property__get_set bool updateInvisible;
|
||||
tolua_property__is_set bool relative;
|
||||
tolua_property__is_set bool scaled;
|
||||
tolua_property__is_set bool sorted;
|
||||
tolua_property__get_set float animationLodBias;
|
||||
tolua_property__get_set EmitterType emitterType;
|
||||
tolua_property__get_set const Vector3& emitterSize;
|
||||
tolua_property__get_set const Vector3& minDirection;
|
||||
tolua_property__get_set const Vector3& maxDirection;
|
||||
tolua_property__get_set const Vector3& constantForce;
|
||||
tolua_property__get_set float dampingForce;
|
||||
tolua_property__get_set float activeTime;
|
||||
tolua_property__get_set float inactiveTime;
|
||||
tolua_property__get_set float minEmissionRate;
|
||||
tolua_property__get_set float maxEmissionRate;
|
||||
tolua_property__get_set const Vector2& minParticleSize;
|
||||
tolua_property__get_set const Vector2& maxParticleSize;
|
||||
tolua_property__get_set float minTimeToLive;
|
||||
tolua_property__get_set float maxTimeToLive;
|
||||
tolua_property__get_set float minVelocity;
|
||||
tolua_property__get_set float maxVelocity;
|
||||
tolua_property__get_set float minRotation;
|
||||
tolua_property__get_set float maxRotation;
|
||||
tolua_property__get_set float minRotationSpeed;
|
||||
tolua_property__get_set float maxRotationSpeed;
|
||||
tolua_property__get_set float sizeAdd;
|
||||
tolua_property__get_set float sizeMul;
|
||||
tolua_property__get_set unsigned numColorFrames;
|
||||
tolua_property__get_set unsigned numTextureFrames;
|
||||
};
|
|
@ -1,169 +1,28 @@
|
|||
$#include "ParticleEmitter.h"
|
||||
|
||||
enum EmitterType
|
||||
{
|
||||
EMITTER_SPHERE,
|
||||
EMITTER_BOX
|
||||
};
|
||||
|
||||
/*
|
||||
struct Particle
|
||||
{
|
||||
Vector3 velocity_;
|
||||
Vector2 size_;
|
||||
float timer_;
|
||||
float timeToLive_;
|
||||
float scale_;
|
||||
float rotationSpeed_;
|
||||
unsigned colorIndex_;
|
||||
unsigned texIndex_;
|
||||
};
|
||||
*/
|
||||
|
||||
struct ColorFrame
|
||||
{
|
||||
ColorFrame();
|
||||
ColorFrame(const Color& color);
|
||||
ColorFrame(const Color& color, float time);
|
||||
~ColorFrame();
|
||||
|
||||
Color Interpolate(const ColorFrame& next, float time);
|
||||
Color color_ @ color;
|
||||
float time_ @ time;
|
||||
};
|
||||
|
||||
struct TextureFrame
|
||||
{
|
||||
TextureFrame();
|
||||
~TextureFrame();
|
||||
|
||||
Rect uv_ @ uv;
|
||||
float time_ @ time;
|
||||
};
|
||||
|
||||
class ParticleEmitter : public BillboardSet
|
||||
{
|
||||
bool Load(XMLFile* file);
|
||||
bool Save(XMLFile* file);
|
||||
void SetEffect(ParticleEffect* effect);
|
||||
void SetNumParticles(unsigned num);
|
||||
void SetEmissionRate(float rate);
|
||||
void SetMinEmissionRate(float rate);
|
||||
void SetMaxEmissionRate(float rate);
|
||||
void SetEmitterType(EmitterType type);
|
||||
void SetEmitterSize(const Vector3& size);
|
||||
void SetActiveTime(float time);
|
||||
void SetInactiveTime(float time);
|
||||
void SetEmitting(bool enable);
|
||||
void SetUpdateInvisible(bool enable);
|
||||
void SetTimeToLive(float time);
|
||||
void SetMinTimeToLive(float time);
|
||||
void SetMaxTimeToLive(float time);
|
||||
void SetParticleSize(const Vector2& size);
|
||||
void SetMinParticleSize(const Vector2& size);
|
||||
void SetMaxParticleSize(const Vector2& size);
|
||||
void SetMinDirection(const Vector3& direction);
|
||||
void SetMaxDirection(const Vector3& direction);
|
||||
void SetVelocity(float velocity);
|
||||
void SetMinVelocity(float velocity);
|
||||
void SetMaxVelocity(float velocity);
|
||||
void SetRotation(float rotation);
|
||||
void SetMinRotation(float rotation);
|
||||
void SetMaxRotation(float rotation);
|
||||
void SetRotationSpeed(float speed);
|
||||
void SetMinRotationSpeed(float speed);
|
||||
void SetMaxRotationSpeed(float speed);
|
||||
void SetConstantForce(const Vector3& force);
|
||||
void SetDampingForce(float force);
|
||||
void SetSizeAdd(float sizeAdd);
|
||||
void SetSizeMul(float sizeMul);
|
||||
void SetColor(const Color& color);
|
||||
void SetNumColors(unsigned num);
|
||||
void SetNumTextureFrames(unsigned num);
|
||||
void ResetEmissionTimer();
|
||||
void RemoveAllParticles();
|
||||
void Reset();
|
||||
|
||||
unsigned GetNumParticles() const;
|
||||
bool IsEmitting() const;
|
||||
bool GetUpdateInvisible() const;
|
||||
float GetMinEmissionRate() const;
|
||||
float GetMaxEmissionRate() const;
|
||||
EmitterType GetEmitterType() const;
|
||||
const Vector3& GetEmitterSize() const;
|
||||
float GetActiveTime() const;
|
||||
float GetInactiveTime() const;
|
||||
float GetMinTimeToLive() const;
|
||||
float GetMaxTimeToLive() const;
|
||||
const Vector2& GetMinParticleSize() const;
|
||||
const Vector2& GetMaxParticleSize() const;
|
||||
const Vector3& GetMinDirection() const;
|
||||
const Vector3& GetMaxDirection() const;
|
||||
float GetMinVelocity() const;
|
||||
float GetMaxVelocity() const;
|
||||
float GetMinRotation() const;
|
||||
float GetMaxRotation() const;
|
||||
float GetMinRotationSpeed() const;
|
||||
float GetMaxRotationSpeed() const;
|
||||
const Vector3& GetConstantForce() const;
|
||||
float GetDampingForce() const;
|
||||
float GetSizeAdd() const;
|
||||
float GetSizeMul() const;
|
||||
unsigned GetNumColors() const;
|
||||
ColorFrame* GetColor(unsigned index);
|
||||
unsigned GetNumTextureFrames() const;
|
||||
TextureFrame* GetTextureFrame(unsigned index);
|
||||
|
||||
void ApplyEffect();
|
||||
|
||||
ParticleEffect* GetEffect() const { return effect_; }
|
||||
unsigned GetNumParticles() const { return particles_.Size(); }
|
||||
bool IsEmitting() const { return emitting_; }
|
||||
|
||||
tolua_property__get_set ParticleEffect* effect;
|
||||
tolua_property__get_set unsigned numParticles;
|
||||
tolua_property__get_set float emissionRate; // Write only property.
|
||||
tolua_property__is_set bool emitting;
|
||||
tolua_property__get_set bool updateInvisible;
|
||||
tolua_property__get_set float minEmissionRate;
|
||||
tolua_property__get_set float maxEmissionRate;
|
||||
tolua_property__get_set EmitterType emitterType;
|
||||
tolua_property__get_set Vector3& emitterSize;
|
||||
tolua_property__get_set float activeTime;
|
||||
tolua_property__get_set float inactiveTime;
|
||||
tolua_property__get_set float timeToLive; // Write only property.
|
||||
tolua_property__get_set float minTimeToLive;
|
||||
tolua_property__get_set float maxTimeToLive;
|
||||
tolua_property__get_set Vector2& particleSize; // Write only property.
|
||||
tolua_property__get_set Vector2& minParticleSize;
|
||||
tolua_property__get_set Vector2& maxParticleSize;
|
||||
tolua_property__get_set Vector3& minDirection;
|
||||
tolua_property__get_set Vector3& maxDirection;
|
||||
tolua_property__get_set float velocity; // Write only property.
|
||||
tolua_property__get_set float minVelocity;
|
||||
tolua_property__get_set float maxVelocity;
|
||||
tolua_property__get_set float rotation; // Write only property.
|
||||
tolua_property__get_set float minRotation;
|
||||
tolua_property__get_set float maxRotation;
|
||||
tolua_property__get_set float rotationSpeed; // Write only property.
|
||||
tolua_property__get_set float minRotationSpeed;
|
||||
tolua_property__get_set float maxRotationSpeed;
|
||||
tolua_property__get_set Vector3& constantForce;
|
||||
tolua_property__get_set float dampingForce;
|
||||
tolua_property__get_set float sizeAdd;
|
||||
tolua_property__get_set float sizeMul;
|
||||
tolua_property__get_set unsigned numColors;
|
||||
tolua_property__get_set unsigned numTextureFrames;
|
||||
};
|
||||
|
||||
${
|
||||
#define TOLUA_DISABLE_tolua_get_ParticleEmitter_emissionRate
|
||||
#define tolua_get_ParticleEmitter_emissionRate NULL
|
||||
#define TOLUA_DISABLE_tolua_set_ParticleEffect_numColorFrames
|
||||
#define tolua_set_ParticleEffect_numColorFrames NULL
|
||||
|
||||
#define TOLUA_DISABLE_tolua_get_ParticleEmitter_timeToLive
|
||||
#define tolua_get_ParticleEmitter_timeToLive NULL
|
||||
|
||||
#define TOLUA_DISABLE_tolua_get_ParticleEmitter_particleSize_ref
|
||||
#define tolua_get_ParticleEmitter_particleSize_ref NULL
|
||||
|
||||
#define TOLUA_DISABLE_tolua_get_ParticleEmitter_velocity
|
||||
#define tolua_get_ParticleEmitter_velocity NULL
|
||||
|
||||
#define TOLUA_DISABLE_tolua_get_ParticleEmitter_rotation
|
||||
#define tolua_get_ParticleEmitter_rotation NULL
|
||||
|
||||
#define TOLUA_DISABLE_tolua_get_ParticleEmitter_rotationSpeed
|
||||
#define tolua_get_ParticleEmitter_rotationSpeed NULL
|
||||
$}
|
||||
#define TOLUA_DISABLE_tolua_set_ParticleEffect_numTextureFrames
|
||||
#define tolua_set_ParticleEffect_numTextureFrames NULL
|
||||
$}
|
|
@ -15,6 +15,7 @@ $pfile "Graphics/Material.pkg"
|
|||
$pfile "Graphics/Model.pkg"
|
||||
$pfile "Graphics/Octree.pkg"
|
||||
$pfile "Graphics/OctreeQuery.pkg"
|
||||
$pfile "Graphics/ParticleEffect.pkg"
|
||||
$pfile "Graphics/ParticleEmitter.pkg"
|
||||
$pfile "Graphics/Renderer.pkg"
|
||||
$pfile "Graphics/RenderPath.pkg"
|
||||
|
|
|
@ -34,6 +34,7 @@
|
|||
#include "Light.h"
|
||||
#include "Material.h"
|
||||
#include "Octree.h"
|
||||
#include "ParticleEffect.h"
|
||||
#include "ParticleEmitter.h"
|
||||
#include "Renderer.h"
|
||||
#include "RenderPath.h"
|
||||
|
@ -1026,33 +1027,102 @@ static void RegisterBillboardSet(asIScriptEngine* engine)
|
|||
engine->RegisterObjectMethod("BillboardSet", "Zone@+ get_zone() const", asMETHOD(BillboardSet, GetZone), asCALL_THISCALL);
|
||||
}
|
||||
|
||||
static void RegisterParticleEmitter(asIScriptEngine* engine)
|
||||
static void RegisterParticleEffect(asIScriptEngine* engine)
|
||||
{
|
||||
engine->RegisterEnum("EmitterType");
|
||||
engine->RegisterEnumValue("EmitterType", "EMITTER_SPHERE", EMITTER_SPHERE);
|
||||
engine->RegisterEnumValue("EmitterType", "EMITTER_BOX", EMITTER_BOX);
|
||||
|
||||
|
||||
engine->RegisterObjectType("ColorFrame", 0, asOBJ_REF);
|
||||
engine->RegisterObjectBehaviour("ColorFrame", asBEHAVE_ADDREF, "void f()", asFUNCTION(FakeAddRef), asCALL_CDECL_OBJLAST);
|
||||
engine->RegisterObjectBehaviour("ColorFrame", asBEHAVE_RELEASE, "void f()", asFUNCTION(FakeReleaseRef), asCALL_CDECL_OBJLAST);
|
||||
engine->RegisterObjectProperty("ColorFrame", "Color color", offsetof(ColorFrame, color_));
|
||||
engine->RegisterObjectProperty("ColorFrame", "float time", offsetof(ColorFrame, time_));
|
||||
|
||||
|
||||
engine->RegisterObjectType("TextureFrame", 0, asOBJ_REF);
|
||||
engine->RegisterObjectBehaviour("TextureFrame", asBEHAVE_ADDREF, "void f()", asFUNCTION(FakeAddRef), asCALL_CDECL_OBJLAST);
|
||||
engine->RegisterObjectBehaviour("TextureFrame", asBEHAVE_RELEASE, "void f()", asFUNCTION(FakeReleaseRef), asCALL_CDECL_OBJLAST);
|
||||
engine->RegisterObjectProperty("TextureFrame", "Rect uv", offsetof(TextureFrame, uv_));
|
||||
engine->RegisterObjectProperty("TextureFrame", "float time", offsetof(TextureFrame, time_));
|
||||
|
||||
RegisterResource<ParticleEffect>(engine, "ParticleEffect");
|
||||
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_material(Material@+)", asMETHOD(ParticleEffect, SetMaterial), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "Material@+ get_material() const", asMETHOD(ParticleEffect, GetMaterial), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_numParticles(uint) const", asMETHOD(ParticleEffect, SetNumParticles), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "uint get_numParticles() const", asMETHOD(ParticleEffect, GetNumParticles), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_updateInvisible(bool)", asMETHOD(ParticleEffect, SetUpdateInvisible), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "bool get_updateInvisible() const", asMETHOD(ParticleEffect, GetUpdateInvisible), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_relative(bool)", asMETHOD(ParticleEffect, SetRelative), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "bool get_relative() const", asMETHOD(ParticleEffect, IsRelative), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_sorted(bool)", asMETHOD(ParticleEffect, SetSorted), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "bool get_sorted() const", asMETHOD(ParticleEffect, IsSorted), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_scaled(bool)", asMETHOD(ParticleEffect, SetScaled), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "bool get_scaled() const", asMETHOD(ParticleEffect, IsScaled), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_animationLodBias(float)", asMETHOD(ParticleEffect, SetAnimationLodBias), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_animationLodBias() const", asMETHOD(ParticleEffect, GetAnimationLodBias), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_emitterType(EmitterType)", asMETHOD(ParticleEffect, SetEmitterType), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "EmitterType get_emitterType() const", asMETHOD(ParticleEffect, GetEmitterType), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_emitterSize(const Vector3&in)", asMETHOD(ParticleEffect, SetEmitterSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "const Vector3& get_emitterSize() const", asMETHOD(ParticleEffect, GetEmitterSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_minDirection(const Vector3&in)", asMETHOD(ParticleEffect, SetMinDirection), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "const Vector3& get_minDirection() const", asMETHOD(ParticleEffect, GetMinDirection), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_maxDirection(const Vector3&in)", asMETHOD(ParticleEffect, SetMaxDirection), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "const Vector3& get_maxDirection() const", asMETHOD(ParticleEffect, GetMaxDirection), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_constantForce(const Vector3&in)", asMETHOD(ParticleEffect, SetConstantForce), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "const Vector3& get_constantForce() const", asMETHOD(ParticleEffect, GetConstantForce), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_dampingForce(float)", asMETHOD(ParticleEffect, SetDampingForce), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_dampingForce() const", asMETHOD(ParticleEffect, GetDampingForce), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_activeTime(float) const", asMETHOD(ParticleEffect, SetActiveTime), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_activeTime() const", asMETHOD(ParticleEffect, GetActiveTime), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_inactiveTime(float) const", asMETHOD(ParticleEffect, SetInactiveTime), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_inactiveTime() const", asMETHOD(ParticleEffect, GetInactiveTime), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_minEmissionRate(float)", asMETHOD(ParticleEffect, SetMinEmissionRate), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_maxEmissionRate(float)", asMETHOD(ParticleEffect, SetMaxEmissionRate), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_minEmissionRate() const", asMETHOD(ParticleEffect, GetMinEmissionRate), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_maxEmissionRate() const", asMETHOD(ParticleEffect, GetMaxEmissionRate), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_minParticleSize(const Vector2&in)", asMETHOD(ParticleEffect, SetMinParticleSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_maxParticleSize(const Vector2&in)", asMETHOD(ParticleEffect, SetMaxParticleSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "const Vector2& get_minParticleSize() const", asMETHOD(ParticleEffect, GetMinParticleSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "const Vector3& get_maxParticleSize() const", asMETHOD(ParticleEffect, GetMaxParticleSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_minTimeToLive(float)", asMETHOD(ParticleEffect, SetMinTimeToLive), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_maxTimeToLive(float)", asMETHOD(ParticleEffect, SetMaxTimeToLive), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_minTimeToLive() const", asMETHOD(ParticleEffect, GetMinTimeToLive), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_maxTimeToLive() const", asMETHOD(ParticleEffect, GetMaxTimeToLive), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_minVelocity(float)", asMETHOD(ParticleEffect, SetMinVelocity), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_maxVelocity(float)", asMETHOD(ParticleEffect, SetMaxVelocity), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_minVelocity() const", asMETHOD(ParticleEffect, GetMinVelocity), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_maxVelocity() const", asMETHOD(ParticleEffect, GetMaxVelocity), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_minRotation(float)", asMETHOD(ParticleEffect, SetMinRotation), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_maxRotation(float)", asMETHOD(ParticleEffect, SetMaxRotation), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_minRotation() const", asMETHOD(ParticleEffect, GetMinRotation), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_maxRotation() const", asMETHOD(ParticleEffect, GetMaxRotation), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_minRotationSpeed(float)", asMETHOD(ParticleEffect, SetMinRotationSpeed), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_maxRotationSpeed(float)", asMETHOD(ParticleEffect, SetMaxRotationSpeed), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_minRotationSpeed() const", asMETHOD(ParticleEffect, GetMinRotationSpeed), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_maxRotationSpeed() const", asMETHOD(ParticleEffect, GetMaxRotationSpeed), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_sizeAdd(float)", asMETHOD(ParticleEffect, SetSizeAdd), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_sizeAdd() const", asMETHOD(ParticleEffect, GetSizeAdd), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void set_sizeMul(float)", asMETHOD(ParticleEffect, SetSizeMul), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "float get_sizeMul() const", asMETHOD(ParticleEffect, GetSizeMul), asCALL_THISCALL);
|
||||
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void SetColorFrame(uint, ColorFrame@+) const", asMETHOD(ParticleEffect, SetColorFrame), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "uint get_numColorFrames() const", asMETHOD(ParticleEffect, GetNumColorFrames), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "ColorFrame@+ GetColorFrame(uint) const", asMETHOD(ParticleEffect, GetColorFrame), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "void SetTextureFrame(uint, TextureFrame@+) const", asMETHOD(ParticleEffect, SetTextureFrame), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "uint get_numTextureFrames() const", asMETHOD(ParticleEffect, GetNumTextureFrames), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEffect", "TextureFrame@+ GetTextureFrame(uint) const", asMETHOD(ParticleEffect, GetTextureFrame), asCALL_THISCALL);
|
||||
}
|
||||
|
||||
static void RegisterParticleEmitter(asIScriptEngine* engine)
|
||||
{
|
||||
RegisterDrawable<ParticleEmitter>(engine, "ParticleEmitter");
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "bool Load(XMLFile@+)", asMETHODPR(ParticleEmitter, Load, (XMLFile*), bool), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "bool Save(XMLFile@+)", asMETHODPR(ParticleEmitter, Save, (XMLFile*) const, bool), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void SetColor(const Color&in)", asMETHOD(ParticleEmitter, SetColor), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void ResetEmissionTimer()", asMETHOD(ParticleEmitter, ResetEmissionTimer), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void RemoveAllParticles()", asMETHOD(ParticleEmitter, RemoveAllParticles), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void Reset()", asMETHOD(ParticleEmitter, Reset), asCALL_THISCALL);
|
||||
// Copy from BillboardSet
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void Commit()", asMETHOD(ParticleEmitter, Commit), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_material(Material@+)", asMETHOD(ParticleEmitter, SetMaterial), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "Material@+ get_material() const", asMETHOD(ParticleEmitter, GetMaterial), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_numBillboards(uint)", asMETHOD(ParticleEmitter, SetNumBillboards), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "uint get_numBillboards() const", asMETHOD(ParticleEmitter, GetNumBillboards), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_relative(bool)", asMETHOD(ParticleEmitter, SetRelative), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "bool get_relative() const", asMETHOD(ParticleEmitter, IsRelative), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_sorted(bool)", asMETHOD(ParticleEmitter, SetSorted), asCALL_THISCALL);
|
||||
|
@ -1061,71 +1131,21 @@ static void RegisterParticleEmitter(asIScriptEngine* engine)
|
|||
engine->RegisterObjectMethod("ParticleEmitter", "bool get_scaled() const", asMETHOD(ParticleEmitter, IsScaled), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_faceCameraMode(FaceCameraMode)", asMETHOD(ParticleEmitter, SetFaceCameraMode), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "FaceCameraMode get_faceCameraMode() const", asMETHOD(ParticleEmitter, GetFaceCameraMode), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_updateInvisible(bool)", asMETHOD(ParticleEmitter, SetUpdateInvisible), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "bool get_updateInvisible() const", asMETHOD(ParticleEmitter, GetUpdateInvisible), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_animationLodBias(float)", asMETHOD(ParticleEmitter, SetAnimationLodBias), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_animationLodBias() const", asMETHOD(ParticleEmitter, GetAnimationLodBias), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_emitting() const", asMETHOD(ParticleEmitter, SetEmitting), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "bool get_emitting() const", asMETHOD(ParticleEmitter, IsEmitting), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "Billboard@+ get_billboards(uint)", asMETHOD(ParticleEmitter, GetBillboard), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "Zone@+ get_zone() const", asMETHOD(ParticleEmitter, GetZone), asCALL_THISCALL);
|
||||
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_effect(ParticleEffect@+)", asMETHOD(ParticleEmitter, SetEffect), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "ParticleEffect@+ get_effect() const", asMETHOD(ParticleEmitter, GetEffect), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_numParticles(uint) const", asMETHOD(ParticleEmitter, SetNumParticles), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "uint get_numParticles() const", asMETHOD(ParticleEmitter, GetNumParticles), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_emissionRate(float)", asMETHOD(ParticleEmitter, SetEmissionRate), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_minEmissionRate(float)", asMETHOD(ParticleEmitter, SetMinEmissionRate), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_maxEmissionRate(float)", asMETHOD(ParticleEmitter, SetMaxEmissionRate), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_minEmissionRate() const", asMETHOD(ParticleEmitter, GetMinEmissionRate), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_maxEmissionRate() const", asMETHOD(ParticleEmitter, GetMaxEmissionRate), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_emitterType(EmitterType)", asMETHOD(ParticleEmitter, SetEmitterType), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "EmitterType get_emitterType() const", asMETHOD(ParticleEmitter, GetEmitterType), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_emitterSize(const Vector3&in)", asMETHOD(ParticleEmitter, SetEmitterSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "const Vector3& get_emitterSize() const", asMETHOD(ParticleEmitter, GetEmitterSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_activeTime(float) const", asMETHOD(ParticleEmitter, SetActiveTime), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_activeTime() const", asMETHOD(ParticleEmitter, GetActiveTime), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_inactiveTime(float) const", asMETHOD(ParticleEmitter, SetInactiveTime), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_inactiveTime() const", asMETHOD(ParticleEmitter, GetInactiveTime), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_timeToLive(float)", asMETHOD(ParticleEmitter, SetTimeToLive), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_minTimeToLive(float)", asMETHOD(ParticleEmitter, SetMinTimeToLive), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_maxTimeToLive(float)", asMETHOD(ParticleEmitter, SetMaxTimeToLive), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_minTimeToLive() const", asMETHOD(ParticleEmitter, GetMinTimeToLive), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_maxTimeToLive() const", asMETHOD(ParticleEmitter, GetMaxTimeToLive), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_particleSize(const Vector2&in)", asMETHOD(ParticleEmitter, SetParticleSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_minParticleSize(const Vector2&in)", asMETHOD(ParticleEmitter, SetMinParticleSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_maxParticleSize(const Vector2&in)", asMETHOD(ParticleEmitter, SetMaxParticleSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "const Vector2& get_minParticleSize() const", asMETHOD(ParticleEmitter, GetMinParticleSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "const Vector3& get_maxParticleSize() const", asMETHOD(ParticleEmitter, GetMaxParticleSize), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_minDirection(const Vector3&in)", asMETHOD(ParticleEmitter, SetMinDirection), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "const Vector3& get_minDirection() const", asMETHOD(ParticleEmitter, GetMinDirection), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_maxDirection(const Vector3&in)", asMETHOD(ParticleEmitter, SetMaxDirection), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "const Vector3& get_maxDirection() const", asMETHOD(ParticleEmitter, GetMaxDirection), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_velocity(float)", asMETHOD(ParticleEmitter, SetVelocity), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_minVelocity(float)", asMETHOD(ParticleEmitter, SetMinVelocity), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_maxVelocity(float)", asMETHOD(ParticleEmitter, SetMaxVelocity), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_minVelocity() const", asMETHOD(ParticleEmitter, GetMinVelocity), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_maxVelocity() const", asMETHOD(ParticleEmitter, GetMaxVelocity), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_rotation(float)", asMETHOD(ParticleEmitter, SetRotation), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_minRotation(float)", asMETHOD(ParticleEmitter, SetMinRotation), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_maxRotation(float)", asMETHOD(ParticleEmitter, SetMaxRotation), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_minRotation() const", asMETHOD(ParticleEmitter, GetMinRotation), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_maxRotation() const", asMETHOD(ParticleEmitter, GetMaxRotation), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_rotationSpeed(float)", asMETHOD(ParticleEmitter, SetRotationSpeed), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_minRotationSpeed(float)", asMETHOD(ParticleEmitter, SetMinRotationSpeed), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_maxRotationSpeed(float)", asMETHOD(ParticleEmitter, SetMaxRotationSpeed), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_minRotationSpeed() const", asMETHOD(ParticleEmitter, GetMinRotationSpeed), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_maxRotationSpeed() const", asMETHOD(ParticleEmitter, GetMaxRotationSpeed), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_constantForce(const Vector3&in)", asMETHOD(ParticleEmitter, SetConstantForce), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "const Vector3& get_constantForce() const", asMETHOD(ParticleEmitter, GetConstantForce), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_dampingForce(float)", asMETHOD(ParticleEmitter, SetDampingForce), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_dampingForce() const", asMETHOD(ParticleEmitter, GetDampingForce), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_sizeAdd(float)", asMETHOD(ParticleEmitter, SetSizeAdd), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_sizeAdd() const", asMETHOD(ParticleEmitter, GetSizeAdd), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_sizeMul(float)", asMETHOD(ParticleEmitter, SetSizeMul), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "float get_sizeMul() const", asMETHOD(ParticleEmitter, GetSizeMul), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "ColorFrame@+ get_colors(uint)", asMETHODPR(ParticleEmitter, GetColor, (unsigned), ColorFrame*), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_numColors(uint)", asMETHOD(ParticleEmitter, SetNumColors), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "uint get_numColors() const", asMETHOD(ParticleEmitter, GetNumColors), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "TextureFrame@+ get_textureFrames(uint)", asMETHODPR(ParticleEmitter, GetTextureFrame, (unsigned), TextureFrame*), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_numTextureFrames(uint)", asMETHOD(ParticleEmitter, SetNumTextureFrames), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "uint get_numTextureFrames() const", asMETHOD(ParticleEmitter, GetNumTextureFrames), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "Zone@+ get_zone() const", asMETHOD(ParticleEmitter, GetZone), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void set_emitting() const", asMETHOD(ParticleEmitter, SetEmitting), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "bool get_emitting() const", asMETHOD(ParticleEmitter, IsEmitting), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void ResetEmissionTimer()", asMETHOD(ParticleEmitter, ResetEmissionTimer), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void RemoveAllParticles()", asMETHOD(ParticleEmitter, RemoveAllParticles), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void Reset()", asMETHOD(ParticleEmitter, Reset), asCALL_THISCALL);
|
||||
engine->RegisterObjectMethod("ParticleEmitter", "void ApplyEffect()", asMETHOD(ParticleEmitter, ApplyEffect), asCALL_THISCALL);
|
||||
}
|
||||
|
||||
static void RegisterCustomGeometry(asIScriptEngine* engine)
|
||||
|
@ -1542,6 +1562,7 @@ void RegisterGraphicsAPI(asIScriptEngine* engine)
|
|||
RegisterAnimatedModel(engine);
|
||||
RegisterAnimationController(engine);
|
||||
RegisterBillboardSet(engine);
|
||||
RegisterParticleEffect(engine);
|
||||
RegisterParticleEmitter(engine);
|
||||
RegisterCustomGeometry(engine);
|
||||
RegisterDecalSet(engine);
|
||||
|
|
Загрузка…
Ссылка в новой задаче