/* * All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or * its licensors. * * For complete copyright and license terms please see the LICENSE at the root of this * distribution (the "License"). All use of this software is governed by the License, * or, if provided, by the license below or the license accompanying this file. Do not * remove or modify any license notices. This file is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * */ // Original file Copyright Crytek GMBH or its affiliates, used under license. #ifndef CRYINCLUDE_CRYSCRIPTSYSTEM_SCRIPTBINDINGS_SCRIPTBIND_PARTICLE_H #define CRYINCLUDE_CRYSCRIPTSYSTEM_SCRIPTBINDINGS_SCRIPTBIND_PARTICLE_H #pragma once #include struct ISystem; struct I3DEngine; struct ParticleParams; struct IParticleEffect; struct CryEngineDecalInfo; /* This class implements script-functions for particles and decals. After initialization of the script-object it will be globally accessable through scripts using the namespace "Particle". Particle.CreateDecal(pos, normal, scale, lifetime, decal.texture, decal.object, rotation) */ class CScriptBind_Particle : public CScriptableBase { public: CScriptBind_Particle(IScriptSystem* pScriptSystem, ISystem* pSystem); virtual ~CScriptBind_Particle(); virtual void GetMemoryUsage(ICrySizer* pSizer) const { pSizer->AddObject(this, sizeof(*this)); } //! Particle.CreateEffect( name, params ) //! Particle effect name. //! Effect parameters. //! Creates a new particle effect. int CreateEffect(IFunctionHandler* pH, const char* name, SmartScriptTable params); //! Particle.DeleteEffect( name ) //! Particle effect name. //! Deletes the specified particle effect. int DeleteEffect(IFunctionHandler* pH, const char* name); //! Particle.IsEffectAvailable( name ) //! Particle effect name. //! Checks if the specified particle effect is available. int IsEffectAvailable(IFunctionHandler* pH, const char* name); //! Particle.SpawnEffect( effectName, pos, dir ) //! Effect name. //! Position vector. //! Direction vector. //! Spawns an effect. int SpawnEffect(IFunctionHandler* pH, const char* effectName, Vec3 pos, Vec3 dir); //! Particle.SpawnEffectLine( effectName, startPos, endPos, dir, scale, slices ) //! Effect name. //! Start position. //! End position. //! Direction of the effect. //! Scale value for the effect. //! Number of slices. //! Spawns an effect line. int SpawnEffectLine(IFunctionHandler* pH, const char* effectName, Vec3 startPos, Vec3 endPos, Vec3 dir, float scale, int slices); //! Particle.SpawnParticles( params, pos, dir ) //! Effect parameters. //! Effect position. //! Effect direction. //! Spawns a particle effect. int SpawnParticles(IFunctionHandler* pH, SmartScriptTable params, Vec3 pos, Vec3 dir); //! Particle.CreateDecal( pos, normal, size, lifeTime, textureName ) //! Decal position. //! Decal normal vector. //! Decal size. //! Decal life time. //! Decal position. //! Decal normal vector. //! Decal size. //! Decal life time. //! Name of the Material. //! Creates a material decal. int CreateMatDecal(IFunctionHandler* pH, Vec3 pos, Vec3 normal, float size, float lifeTime, const char* materialName); //! Particle.Attach() //! Attaches an effect. int Attach(IFunctionHandler* pH); //! Particle.Detach() //! Detaches an effect. int Detach(IFunctionHandler* pH); private: void ReadParams(SmartScriptTable& table, ParticleParams* params, IParticleEffect* pEffect); void CreateDecalInternal(IFunctionHandler* pH, const Vec3& pos, const Vec3& normal, float size, float lifeTime, const char* name, bool nameIsMaterial); ISystem* m_pSystem; I3DEngine* m_p3DEngine; }; #endif // CRYINCLUDE_CRYSCRIPTSYSTEM_SCRIPTBINDINGS_SCRIPTBIND_PARTICLE_H