2 #ifndef __EFFEKSEER_BASE_PRE_H__
3 #define __EFFEKSEER_BASE_PRE_H__
17 #define EFK_STDCALL __stdcall
28 #elif defined(_PSVITA)
29 #include "Effekseer.PSVita.h"
31 #include "Effekseer.PS4.h"
32 #elif defined(_SWITCH)
33 #include "Effekseer.Switch.h"
34 #elif defined(_XBOXONE)
35 #include "Effekseer.XBoxOne.h"
45 typedef uint16_t EFK_CHAR;
65 class ParticleRenderer;
88 typedef void* ( EFK_STDCALL *MallocFunc ) (
unsigned int size );
93 typedef void ( EFK_STDCALL *FreeFunc ) (
void* p,
unsigned int size );
98 typedef int ( EFK_STDCALL *RandFunc ) (void);
106 typedef void ( EFK_STDCALL *EffectInstanceRemovingCallback ) ( Manager* manager, Handle handle,
bool isRemovingManager );
108 #define ES_SAFE_ADDREF(val) if ( (val) != NULL ) { (val)->AddRef(); }
109 #define ES_SAFE_RELEASE(val) if ( (val) != NULL ) { (val)->Release(); (val) = NULL; }
110 #define ES_SAFE_DELETE(val) if ( (val) != NULL ) { delete (val); (val) = NULL; }
111 #define ES_SAFE_DELETE_ARRAY(val) if ( (val) != NULL ) { delete [] (val); (val) = NULL; }
119 enum class AlphaBlendType : int32_t
143 enum class TextureFilterType : int32_t
149 enum class TextureWrapType : int32_t
155 enum class CullingType : int32_t
165 enum class BillboardType : int32_t
170 RotatedBillboard = 3,
173 enum class CoordinateSystem : int32_t
179 enum class CullingShape : int32_t
185 enum class TextureType : int32_t
192 enum class TextureFormatType : int32_t
206 template <
typename T,
typename U>
219 template <
typename T,
typename U>
232 template <
typename T,
typename U,
typename V>
233 T Clamp( T t, U max_, V min_ )
251 inline float NormalizeAngle(
float angle)
253 int32_t ofs = (*(int32_t*)&angle & 0x80000000) | 0x3F000000;
254 return (angle - ((
int)(angle * 0.159154943f + *(
float*)&ofs) * 6.283185307f));
260 inline void SinCos(
float x,
float& s,
float& c)
262 x = NormalizeAngle(x);
264 float x4 = x * x * x * x;
265 float x6 = x * x * x * x * x * x;
266 float x8 = x * x * x * x * x * x * x * x;
267 float x10 = x * x * x * x * x * x * x * x * x * x;
268 s = x * (1.0f - x2 / 6.0f + x4 / 120.0f - x6 / 5040.0f + x8 / 362880.0f - x10 / 39916800.0f);
269 c = 1.0f - x2 / 2.0f + x4 / 24.0f - x6 / 720.0f + x8 / 40320.0f - x10 / 3628800.0f;
282 inline int32_t ConvertUtf16ToUtf8( int8_t* dst, int32_t dst_size,
const int16_t* src )
285 const int16_t* wp = src;
288 if (dst_size == 0)
return 0;
292 for (cnt = 0; cnt < dst_size; )
299 if ((wc & ~0x7f) == 0)
303 }
else if ((wc & ~0x7ff) == 0)
305 *cp++ = ((wc >> 6) & 0x1f) | 0xc0;
306 *cp++ = ((wc) & 0x3f) | 0x80;
309 *cp++ = ((wc >> 12) & 0xf) | 0xe0;
310 *cp++ = ((wc >> 6) & 0x3f) | 0x80;
311 *cp++ = ((wc) & 0x3f) | 0x80;
326 inline int32_t ConvertUtf8ToUtf16( int16_t* dst, int32_t dst_size,
const int8_t* src )
331 if (dst_size == 0)
return 0;
335 for (i = 0; i < dst_size; i++)
345 code = (uint8_t)c0 >> 4;
351 else if (code >= 12 && code <= 13)
355 wc = ((c0 & 0x1F) << 6) | (c1 & 0x3F);
362 wc = ((c0 & 0x0F) << 12) | ((c1 & 0x3F) << 6) | (c2 & 0x3F);
413 mutable std::atomic<int32_t> m_reference;
426 std::atomic_fetch_add_explicit(&m_reference, 1, std::memory_order_consume);
438 bool destroy = std::atomic_fetch_sub_explicit(&m_reference, 1, std::memory_order_consume) == 1;
459 TextureFormatType TextureFormat;
471 #endif // __EFFEKSEER_BASE_PRE_H__
472 #ifndef __EFFEKSEER_VECTOR2D_H__
473 #define __EFFEKSEER_VECTOR2D_H__
482 namespace Effekseer {
522 #endif // __EFFEKSEER_VECTOR3D_H__
524 #ifndef __EFFEKSEER_VECTOR3D_H__
525 #define __EFFEKSEER_VECTOR3D_H__
534 namespace Effekseer {
567 Vector3D(
float x,
float y,
float z );
573 Vector3D operator * (
const float& o )
const;
575 Vector3D operator / (
const float& o )
const;
581 Vector3D& operator *= (
const float& o );
583 Vector3D& operator /= (
const float& o );
635 #endif // __EFFEKSEER_VECTOR3D_H__
637 #ifndef __EFFEKSEER_COLOR_H__
638 #define __EFFEKSEER_COLOR_H__
656 COLOR_MODE_DWORD = 0x7FFFFFFF
693 Color( uint8_t r, uint8_t g, uint8_t b, uint8_t a = 255 );
708 #endif // __EFFEKSEER_COLOR_H__
710 #ifndef __EFFEKSEER_RECTF_H__
711 #define __EFFEKSEER_RECTF_H__
720 namespace Effekseer {
742 RectF(
float x,
float y,
float width,
float height );
756 #endif // __EFFEKSEER_RECTF_H__
758 #ifndef __EFFEKSEER_MATRIX43_H__
759 #define __EFFEKSEER_MATRIX43_H__
768 namespace Effekseer {
805 void Scaling(
float x,
float y,
float z );
915 #endif // __EFFEKSEER_MATRIX43_H__
917 #ifndef __EFFEKSEER_MATRIX44_H__
918 #define __EFFEKSEER_MATRIX44_H__
927 namespace Effekseer {
1013 void Scaling(
float x,
float y,
float z );
1043 void Quaternion(
float x,
float y,
float z,
float w );
1064 #endif // __EFFEKSEER_MATRIX44_H__
1066 #ifndef __EFFEKSEER_FILE_H__
1067 #define __EFFEKSEER_FILE_H__
1076 namespace Effekseer {
1092 virtual size_t Read(
void* buffer,
size_t size ) = 0;
1094 virtual void Seek(
int position) = 0;
1096 virtual int GetPosition() = 0;
1098 virtual size_t GetLength() = 0;
1113 virtual size_t Write(
const void* buffer,
size_t size ) = 0;
1115 virtual void Flush() = 0;
1117 virtual void Seek(
int position) = 0;
1119 virtual int GetPosition() = 0;
1121 virtual size_t GetLength() = 0;
1132 virtual FileReader* OpenRead(
const EFK_CHAR* path ) = 0;
1134 virtual FileWriter* OpenWrite(
const EFK_CHAR* path ) = 0;
1144 #endif // __EFFEKSEER_FILE_H__
1146 #ifndef __EFFEKSEER_DEFAULT_FILE_H__
1147 #define __EFFEKSEER_DEFAULT_FILE_H__
1156 namespace Effekseer {
1174 size_t Read(
void* buffer,
size_t size );
1176 void Seek(
int position );
1193 size_t Write(
const void* buffer,
size_t size );
1197 void Seek(
int position );
1209 FileReader* OpenRead(
const EFK_CHAR* path );
1211 FileWriter* OpenWrite(
const EFK_CHAR* path );
1222 #endif // __EFFEKSEER_DEFAULT_FILE_H__
1224 #ifndef __EFFEKSEER_EFFECT_H__
1225 #define __EFFEKSEER_EFFECT_H__
1263 static Effect*
Create(
Manager* manager,
void* data, int32_t size,
float magnification = 1.0f,
const EFK_CHAR* materialPath = NULL );
1273 static Effect*
Create(
Manager* manager,
const EFK_CHAR* path,
float magnification = 1.0f,
const EFK_CHAR* materialPath = NULL );
1284 static Effect*
Create(
Setting* setting,
void* data, int32_t size,
float magnification = 1.0f,
const EFK_CHAR* materialPath = NULL );
1294 static Effect*
Create(
Setting* setting,
const EFK_CHAR* path,
float magnification = 1.0f,
const EFK_CHAR* materialPath = NULL );
1308 virtual float GetMaginification()
const = 0;
1354 virtual void*
GetWave(
int n )
const = 0;
1364 virtual void*
GetModel(
int n )
const = 0;
1374 virtual bool Reload(
void* data, int32_t size,
const EFK_CHAR* materialPath = NULL ) = 0;
1379 virtual bool Reload(
const EFK_CHAR* path,
const EFK_CHAR* materialPath = NULL ) = 0;
1392 virtual bool Reload(
Manager* managers, int32_t managersCount,
void* data, int32_t size,
const EFK_CHAR* materialPath = NULL ) = 0;
1404 virtual bool Reload(
Manager* managers, int32_t managersCount,
const EFK_CHAR* path,
const EFK_CHAR* materialPath = NULL ) = 0;
1409 virtual void ReloadResources(
const EFK_CHAR* materialPath = NULL ) = 0;
1429 int32_t ColorTextureIndex;
1430 AlphaBlendType AlphaBlend;
1431 TextureFilterType FilterType;
1432 TextureWrapType WrapType;
1436 float DistortionIntensity;
1484 #endif // __EFFEKSEER_EFFECT_H__
1486 #ifndef __EFFEKSEER_MANAGER_H__
1487 #define __EFFEKSEER_MANAGER_H__
1519 static Manager*
Create(
int instance_max,
bool autoFlip =
true );
1698 virtual void StopEffect( Handle handle ) = 0;
1709 virtual void StopRoot( Handle handle ) = 0;
1722 virtual bool Exists( Handle handle ) = 0;
1762 virtual void SetLocation( Handle handle,
float x,
float y,
float z ) = 0;
1779 virtual void SetRotation( Handle handle,
float x,
float y,
float z ) = 0;
1796 virtual void SetScale( Handle handle,
float x,
float y,
float z ) = 0;
1833 virtual void SetRemovingCallback( Handle handle, EffectInstanceRemovingCallback callback ) = 0;
1840 virtual void SetShown( Handle handle,
bool shown ) = 0;
1847 virtual void SetPaused( Handle handle,
bool paused ) = 0;
1854 virtual void SetSpeed( Handle handle,
float speed ) = 0;
1866 virtual void Flip() = 0;
1872 virtual void Update(
float deltaFrame = 1.0f ) = 0;
1895 virtual void UpdateHandle( Handle handle,
float deltaFrame = 1.0f ) = 0;
1900 virtual void Draw() = 0;
1905 virtual void DrawHandle( Handle handle ) = 0;
1915 virtual Handle
Play(
Effect* effect,
float x,
float y,
float z ) = 0;
1939 virtual void CreateCullingWorld(
float xsize,
float ysize,
float zsize, int32_t layerCount) = 0;
1960 #endif // __EFFEKSEER_MANAGER_H__
1962 #ifndef __EFFEKSEER_SPRITE_RENDERER_H__
1963 #define __EFFEKSEER_SPRITE_RENDERER_H__
1985 int32_t ColorTextureIndex;
1986 AlphaBlendType AlphaBlend;
1987 TextureFilterType TextureFilter;
1988 TextureWrapType TextureWrap;
1991 BillboardType Billboard;
1994 float DistortionIntensity;
2015 virtual void BeginRendering(
const NodeParameter& parameter, int32_t count,
void* userData ) {}
2017 virtual void Rendering(
const NodeParameter& parameter,
const InstanceParameter& instanceParameter,
void* userData ) {}
2019 virtual void EndRendering(
const NodeParameter& parameter,
void* userData ) {}
2029 #endif // __EFFEKSEER_SPRITE_RENDERER_H__
2031 #ifndef __EFFEKSEER_RIBBON_RENDERER_H__
2032 #define __EFFEKSEER_RIBBON_RENDERER_H__
2054 int32_t ColorTextureIndex;
2055 AlphaBlendType AlphaBlend;
2056 TextureFilterType TextureFilter;
2057 TextureWrapType TextureWrap;
2060 bool ViewpointDependent;
2063 float DistortionIntensity;
2068 int32_t InstanceCount;
2069 int32_t InstanceIndex;
2086 virtual void BeginRendering(
const NodeParameter& parameter, int32_t count,
void* userData ) {}
2088 virtual void Rendering(
const NodeParameter& parameter,
const InstanceParameter& instanceParameter,
void* userData ) {}
2090 virtual void EndRendering(
const NodeParameter& parameter,
void* userData ) {}
2100 #endif // __EFFEKSEER_RIBBON_RENDERER_H__
2102 #ifndef __EFFEKSEER_RING_RENDERER_H__
2103 #define __EFFEKSEER_RING_RENDERER_H__
2125 int32_t ColorTextureIndex;
2126 AlphaBlendType AlphaBlend;
2127 TextureFilterType TextureFilter;
2128 TextureWrapType TextureWrap;
2131 BillboardType Billboard;
2132 int32_t VertexCount;
2135 float DistortionIntensity;
2157 virtual void BeginRendering(
const NodeParameter& parameter, int32_t count,
void* userData ) {}
2159 virtual void Rendering(
const NodeParameter& parameter,
const InstanceParameter& instanceParameter,
void* userData ) {}
2161 virtual void EndRendering(
const NodeParameter& parameter,
void* userData ) {}
2171 #endif // __EFFEKSEER_RING_RENDERER_H__
2173 #ifndef __EFFEKSEER_MODEL_RENDERER_H__
2174 #define __EFFEKSEER_MODEL_RENDERER_H__
2196 AlphaBlendType AlphaBlend;
2197 TextureFilterType TextureFilter;
2198 TextureWrapType TextureWrap;
2202 CullingType Culling;
2204 int32_t ColorTextureIndex;
2205 int32_t NormalTextureIndex;
2206 float Magnification;
2210 float DistortionIntensity;
2225 virtual void BeginRendering(
const NodeParameter& parameter, int32_t count,
void* userData ) {}
2227 virtual void Rendering(
const NodeParameter& parameter,
const InstanceParameter& instanceParameter,
void* userData ) {}
2229 virtual void EndRendering(
const NodeParameter& parameter,
void* userData ) {}
2239 #endif // __EFFEKSEER_MODEL_RENDERER_H__
2241 #ifndef __EFFEKSEER_TRACK_RENDERER_H__
2242 #define __EFFEKSEER_TRACK_RENDERER_H__
2264 int32_t ColorTextureIndex;
2265 AlphaBlendType AlphaBlend;
2266 TextureFilterType TextureFilter;
2267 TextureWrapType TextureWrap;
2272 float DistortionIntensity;
2282 int32_t InstanceCount;
2283 int32_t InstanceIndex;
2290 Color ColorLeftMiddle;
2291 Color ColorCenterMiddle;
2292 Color ColorRightMiddle;
2306 virtual void BeginRendering(
const NodeParameter& parameter, int32_t count,
void* userData ) {}
2308 virtual void Rendering(
const NodeParameter& parameter,
const InstanceParameter& instanceParameter,
void* userData ) {}
2310 virtual void EndRendering(
const NodeParameter& parameter,
void* userData ) {}
2320 #endif // __EFFEKSEER_TRACK_RENDERER_H__
2322 #ifndef __EFFEKSEER_EFFECTLOADER_H__
2323 #define __EFFEKSEER_EFFECTLOADER_H__
2332 namespace Effekseer {
2362 virtual bool Load(
const EFK_CHAR* path,
void*& data, int32_t& size ) = 0;
2372 virtual void Unload(
void* data, int32_t size ) = 0;
2382 #endif // __EFFEKSEER_EFFECTLOADER_H__
2384 #ifndef __EFFEKSEER_TEXTURELOADER_H__
2385 #define __EFFEKSEER_TEXTURELOADER_H__
2394 namespace Effekseer {
2423 virtual TextureData*
Load(
const EFK_CHAR* path, TextureType textureType ) {
return nullptr; }
2442 #endif // __EFFEKSEER_TEXTURELOADER_H__
2444 #ifndef __EFFEKSEER_MODELLOADER_H__
2445 #define __EFFEKSEER_MODELLOADER_H__
2454 namespace Effekseer {
2482 virtual void*
Load(
const EFK_CHAR* path ) {
return NULL; }
2501 #endif // __EFFEKSEER_MODELLOADER_H__
2503 #ifndef __EFFEKSEER_MODEL_H__
2504 #define __EFFEKSEER_MODEL_H__
2513 namespace Effekseer {
2523 static const int32_t Version = 1;
2565 int32_t m_vertexCount;
2568 int32_t m_faceCount;
2571 int32_t m_modelCount;
2581 , m_vertexCount ( 0 )
2582 , m_vertexes ( NULL )
2586 m_data =
new uint8_t[m_size];
2587 memcpy( m_data, data, m_size );
2589 uint8_t* p = (uint8_t*)m_data;
2591 memcpy( &m_version, p,
sizeof(int32_t) );
2592 p +=
sizeof(int32_t);
2597 p +=
sizeof(int32_t);
2600 memcpy( &m_modelCount, p,
sizeof(int32_t) );
2601 p +=
sizeof(int32_t);
2603 memcpy( &m_vertexCount, p,
sizeof(int32_t) );
2604 p +=
sizeof(int32_t);
2608 m_vertexes = (
Vertex*) p;
2609 p += (
sizeof(
Vertex) * m_vertexCount);
2614 m_vertexes =
new Vertex[m_vertexCount];
2616 for (int32_t i = 0; i < m_vertexCount; i++)
2618 memcpy(&m_vertexes[i], p,
sizeof(
Vertex) -
sizeof(
Color));
2619 m_vertexes[i].VColor =
Color(255, 255, 255, 255);
2625 memcpy( &m_faceCount, p,
sizeof(int32_t) );
2626 p +=
sizeof(int32_t);
2629 p += (
sizeof(
Face) * m_faceCount );
2632 Vertex* GetVertexes()
const {
return m_vertexes; }
2633 int32_t GetVertexCount() {
return m_vertexCount; }
2635 Face* GetFaces()
const {
return m_faces; }
2636 int32_t GetFaceCount() {
return m_faceCount; }
2638 int32_t GetModelCount() {
return m_modelCount; }
2647 ES_SAFE_DELETE_ARRAY(m_vertexes);
2650 ES_SAFE_DELETE_ARRAY( m_data );
2653 Emitter GetEmitter(
Manager* manager, CoordinateSystem coordinate,
float magnification )
2658 int32_t faceInd = (int32_t)( (GetFaceCount() - 1) * ( (float)randFunc() / (float)randMax ) );
2659 faceInd = Clamp( faceInd, GetFaceCount() - 1, 0 );
2660 Face& face = GetFaces()[faceInd];
2661 Vertex& v0 = GetVertexes()[face.Indexes[0]];
2662 Vertex& v1 = GetVertexes()[face.Indexes[1]];
2663 Vertex& v2 = GetVertexes()[face.Indexes[2]];
2665 float p1 = ( (float)randFunc() / (float)randMax );
2666 float p2 = ( (float)randFunc() / (float)randMax );
2669 if( p1 + p2 > 1.0f )
2675 float p0 = 1.0f - p1 - p2;
2678 emitter.Position = (v0.Position * p0 + v1.Position * p1 + v2.Position * p2) * magnification;
2679 emitter.
Normal = v0.Normal * p0 + v1.Normal * p1 + v2.Normal * p2;
2680 emitter.Binormal = v0.Binormal * p0 + v1.Binormal * p1 + v2.Binormal * p2;
2681 emitter.Tangent = v0.Tangent * p0 + v1.Tangent * p1 + v2.Tangent * p2;
2683 if( coordinate == CoordinateSystem::LH )
2685 emitter.Position.Z = - emitter.Position.Z;
2686 emitter.Normal.Z = - emitter.Normal.Z;
2687 emitter.Binormal.Z = - emitter.Binormal.Z;
2688 emitter.Tangent.Z = - emitter.Tangent.Z;
2694 Emitter GetEmitterFromVertex( Manager* manager, CoordinateSystem coordinate,
float magnification )
2696 RandFunc randFunc = manager->GetRandFunc();
2697 int32_t randMax = manager->GetRandMax();
2699 int32_t vertexInd = (int32_t)( (GetVertexCount() - 1) * ( (float)randFunc() / (float)randMax ) );
2700 vertexInd = Clamp( vertexInd, GetVertexCount() - 1, 0 );
2701 Vertex& v = GetVertexes()[vertexInd];
2704 emitter.Position = v.Position * magnification;
2705 emitter.
Normal = v.Normal;
2706 emitter.Binormal = v.Binormal;
2707 emitter.Tangent = v.Tangent;
2709 if( coordinate == CoordinateSystem::LH )
2711 emitter.Position.Z = - emitter.Position.Z;
2712 emitter.Normal.Z = - emitter.Normal.Z;
2713 emitter.Binormal.Z = - emitter.Binormal.Z;
2714 emitter.Tangent.Z = - emitter.Tangent.Z;
2720 Emitter GetEmitterFromVertex( int32_t index, CoordinateSystem coordinate,
float magnification )
2722 int32_t vertexInd = index % GetVertexCount();
2723 Vertex& v = GetVertexes()[vertexInd];
2726 emitter.Position = v.Position * magnification;
2727 emitter.
Normal = v.Normal;
2728 emitter.Binormal = v.Binormal;
2729 emitter.Tangent = v.Tangent;
2731 if( coordinate == CoordinateSystem::LH )
2733 emitter.Position.Z = - emitter.Position.Z;
2734 emitter.Normal.Z = - emitter.Normal.Z;
2735 emitter.Binormal.Z = - emitter.Binormal.Z;
2736 emitter.Tangent.Z = - emitter.Tangent.Z;
2742 Emitter GetEmitterFromFace( Manager* manager, CoordinateSystem coordinate,
float magnification )
2744 RandFunc randFunc = manager->GetRandFunc();
2745 int32_t randMax = manager->GetRandMax();
2747 int32_t faceInd = (int32_t)( (GetFaceCount() - 1) * ( (float)randFunc() / (float)randMax ) );
2748 faceInd = Clamp( faceInd, GetFaceCount() - 1, 0 );
2749 Face& face = GetFaces()[faceInd];
2750 Vertex& v0 = GetVertexes()[face.Indexes[0]];
2751 Vertex& v1 = GetVertexes()[face.Indexes[1]];
2752 Vertex& v2 = GetVertexes()[face.Indexes[2]];
2754 float p0 = 1.0f / 3.0f;
2755 float p1 = 1.0f / 3.0f;
2756 float p2 = 1.0f / 3.0f;
2759 emitter.Position = (v0.Position * p0 + v1.Position * p1 + v2.Position * p2) * magnification;
2760 emitter.
Normal = v0.Normal * p0 + v1.Normal * p1 + v2.Normal * p2;
2761 emitter.Binormal = v0.Binormal * p0 + v1.Binormal * p1 + v2.Binormal * p2;
2762 emitter.Tangent = v0.Tangent * p0 + v1.Tangent * p1 + v2.Tangent * p2;
2764 if( coordinate == CoordinateSystem::LH )
2766 emitter.Position.Z = - emitter.Position.Z;
2767 emitter.Normal.Z = - emitter.Normal.Z;
2768 emitter.Binormal.Z = - emitter.Binormal.Z;
2769 emitter.Tangent.Z = - emitter.Tangent.Z;
2775 Emitter GetEmitterFromFace( int32_t index, CoordinateSystem coordinate,
float magnification )
2777 int32_t faceInd = index % (GetFaceCount() - 1);
2778 Face& face = GetFaces()[faceInd];
2779 Vertex& v0 = GetVertexes()[face.Indexes[0]];
2780 Vertex& v1 = GetVertexes()[face.Indexes[1]];
2781 Vertex& v2 = GetVertexes()[face.Indexes[2]];
2783 float p0 = 1.0f / 3.0f;
2784 float p1 = 1.0f / 3.0f;
2785 float p2 = 1.0f / 3.0f;
2788 emitter.Position = (v0.Position * p0 + v1.Position * p1 + v2.Position * p2) * magnification;
2789 emitter.
Normal = v0.Normal * p0 + v1.Normal * p1 + v2.Normal * p2;
2790 emitter.Binormal = v0.Binormal * p0 + v1.Binormal * p1 + v2.Binormal * p2;
2791 emitter.Tangent = v0.Tangent * p0 + v1.Tangent * p1 + v2.Tangent * p2;
2793 if( coordinate == CoordinateSystem::LH )
2795 emitter.Position.Z = - emitter.Position.Z;
2796 emitter.Normal.Z = - emitter.Normal.Z;
2797 emitter.Binormal.Z = - emitter.Binormal.Z;
2798 emitter.Tangent.Z = - emitter.Tangent.Z;
2812 #endif // __EFFEKSEER_MODEL_H__
2814 #ifndef __EFFEKSEER_SOUND_PLAYER_H__
2815 #define __EFFEKSEER_SOUND_PLAYER_H__
2830 typedef void* SoundHandle;
2831 typedef void* SoundTag;
2852 virtual SoundHandle Play( SoundTag tag,
const InstanceParameter& parameter ) = 0;
2854 virtual void Stop( SoundHandle handle, SoundTag tag ) = 0;
2856 virtual void Pause( SoundHandle handle, SoundTag tag,
bool pause ) = 0;
2858 virtual bool CheckPlaying( SoundHandle handle, SoundTag tag ) = 0;
2860 virtual void StopTag( SoundTag tag ) = 0;
2862 virtual void PauseTag( SoundTag tag,
bool pause ) = 0;
2864 virtual bool CheckPlayingTag( SoundTag tag ) = 0;
2866 virtual void StopAll() = 0;
2876 #endif // __EFFEKSEER_SOUND_PLAYER_H__
2878 #ifndef __EFFEKSEER_SOUNDLOADER_H__
2879 #define __EFFEKSEER_SOUNDLOADER_H__
2888 namespace Effekseer {
2916 virtual void*
Load(
const EFK_CHAR* path ) {
return NULL; }
2935 #endif // __EFFEKSEER_SOUNDLOADER_H__
2937 #ifndef __EFFEKSEER_LOADER_H__
2938 #define __EFFEKSEER_LOADER_H__
2947 namespace Effekseer {
2962 CoordinateSystem m_coordinateSystem;
3057 #endif // __EFFEKSEER_LOADER_H__
3059 #ifndef __EFFEKSEER_SERVER_H__
3060 #define __EFFEKSEER_SERVER_H__
3062 #if !( defined(_PSVITA) || defined(_PS4) || defined(_SWITCH) || defined(_XBOXONE) )
3071 namespace Effekseer {
3087 virtual bool Start( uint16_t port ) = 0;
3089 virtual void Stop() = 0;
3096 virtual void Regist(
const EFK_CHAR* key,
Effect* effect ) = 0;
3107 virtual void Update() = 0;
3123 #endif // #if !( defined(_PSVITA) || defined(_PS4) || defined(_SWITCH) || defined(_XBOXONE) )
3125 #endif // __EFFEKSEER_SERVER_H__
3127 #ifndef __EFFEKSEER_CLIENT_H__
3128 #define __EFFEKSEER_CLIENT_H__
3130 #if !( defined(_PSVITA) || defined(_PS4) || defined(_SWITCH) || defined(_XBOXONE) )
3139 namespace Effekseer {
3151 virtual bool Start(
char* host, uint16_t port ) = 0;
3152 virtual void Stop()= 0;
3154 virtual void Reload(
const EFK_CHAR* key,
void* data, int32_t size ) = 0;
3155 virtual void Reload(
Manager* manager,
const EFK_CHAR* path,
const EFK_CHAR* key ) = 0;
3156 virtual bool IsConnected() = 0;
3167 #endif // #if !( defined(_PSVITA) || defined(_PS4) || defined(_SWITCH) || defined(_XBOXONE) )
3169 #endif // __EFFEKSEER_CLIENT_H__
3171 #ifndef __EFFEKSEER_CRITICALSESSION_H__
3172 #define __EFFEKSEER_CRITICALSESSION_H__
3193 mutable CRITICAL_SECTION m_criticalSection;
3194 #elif defined(_PSVITA) || defined(_PS4) || defined(_SWITCH) || defined(_XBOXONE)
3195 mutable CONSOLE_GAME_MUTEX m_mutex;
3197 mutable pthread_mutex_t m_mutex;
3218 #endif // __EFFEKSEER_CRITICALSESSION_H__
3220 #ifndef __EFFEKSEER_THREAD_H__
3221 #define __EFFEKSEER_THREAD_H__
3230 namespace Effekseer {
3240 static unsigned long EFK_STDCALL ThreadProc(
void* arguments);
3241 #elif defined(_PSVITA) || defined(_PS4) || defined(_SWITCH) || defined(_XBOXONE)
3244 static void* ThreadProc(
void* arguments );
3250 #elif defined(_PSVITA) || defined(_PS4) || defined(_SWITCH) || defined(_XBOXONE)
3258 void (*m_mainProc)(
void* );
3273 bool Create(
void (*threadFunc)(
void* ),
void* data );
3292 #endif // __EFFEKSEER_VECTOR3D_H__
virtual int Release()
参照カウンタを減算する。0になった時、インスタンスを削除する。
Definition: Effekseer.h:436
virtual int AddRef()
参照カウンタを加算する。
Definition: Effekseer.h:424
エフェクトファイル読み込み破棄関数指定クラス
Definition: Effekseer.h:2339
virtual void SetRemovingCallback(Handle handle, EffectInstanceRemovingCallback callback)=0
エフェクトのインスタンスに廃棄時のコールバックを設定する。
標準のファイル読み込みクラス
Definition: Effekseer.h:1164
virtual EffectNode * GetRoot() const =0
Rootを取得する。
virtual int GetChildrenCount() const =0
子のノードの数を取得する。
virtual void * GetModel(int n) const =0
格納されているモデルのポインタを取得する。
virtual void SetFreeFunc(FreeFunc func)=0
メモリ破棄関数を設定する。
TextureLoader * GetTextureLoader()
テクスチャローダーを取得する。
virtual Setting * GetSetting()=0
設定クラスを取得する。
Matrix44 & PerspectiveFovLH_OpenGL(float ovY, float aspect, float zn, float zf)
OpenGL用射影行列化(左手系)
virtual int GetDrawTime() const =0
Draw処理時間を取得。
virtual void CreateCullingWorld(float xsize, float ysize, float zsize, int32_t layerCount)=0
エフェクトをカリングし描画負荷を減らすための空間を生成する。
static float Length(const Vector3D &in)
長さ
Definition: Effekseer.h:2551
void RotationZ(float angle)
反時計周り方向のZ軸回転行列化を行う。
void RotationZ(float angle)
Z軸回転行列(右手)
virtual void SetModelRenderer(ModelRenderer *renderer)=0
モデル描画機能を設定する。
virtual TrackRenderer * GetTrackRenderer()=0
軌跡描画機能を取得する。
Definition: Effekseer.h:2189
クリティカルセクション
Definition: Effekseer.h:3189
static Vector3D & Cross(Vector3D &o, const Vector3D &in1, const Vector3D &in2)
外積
virtual int32_t GetColorImageCount() const =0
格納されている画像のポインタの個数を取得する。
float Z
Z.
Definition: Effekseer.h:557
ModelLoader * GetModelLoader()
モデルローダーを取得する。
virtual int32_t GetDistortionImageCount() const =0
格納されている歪み画像のポインタの個数を取得する。
virtual void SetRotation(Handle handle, float x, float y, float z)=0
エフェクトのインスタンスの回転角度を指定する。(ラジアン)
virtual void SetAutoDrawing(Handle handle, bool autoDraw)=0
エフェクトがDrawで描画されるか設定する。 autoDrawがfalseの場合、DrawHandleで描画する必要がある。
virtual int GetRef()
参照カウンタを取得する。
Definition: Effekseer.h:431
virtual MallocFunc GetMallocFunc() const =0
メモリ確保関数を取得する。
ノードインスタンス生成クラス
Definition: Effekseer.h:1444
void RotationXYZ(float rx, float ry, float rz)
反時計周り方向のXYZ軸回転行列化を行う。
void GetScale(Vector3D &s) const
行列から拡大ベクトルを取得する。
Model(void *data, int32_t size)
コンストラクタ
Definition: Effekseer.h:2577
Definition: Effekseer.h:1997
EffectLoader * GetEffectLoader()
エフェクトローダーを取得する。
virtual void SetTrackRenderer(TrackRenderer *renderer)=0
軌跡描画機能を設定する。
Definition: Effekseer.h:2047
virtual EffectBasicRenderParameter GetBasicRenderParameter()=0
共通描画パラメーターを取得する。
static Effect * Create(Manager *manager, void *data, int32_t size, float magnification=1.0f, const EFK_CHAR *materialPath=NULL)
エフェクトを生成する。
virtual void SetBasicRenderParameter(EffectBasicRenderParameter param)=0
共通描画パラメーターを設定する。
Matrix44 & OrthographicLH(float width, float height, float zn, float zf)
正射影行列化(左手系)
static void Add(Vector3D *pOut, const Vector3D *pIn1, const Vector3D *pIn2)
加算
virtual void RessignCulling()=0
現在存在するエフェクトのハンドルからカリングの空間を配置しなおす。
virtual int32_t GetRestInstancesCount() const =0
残りの確保したインスタンス数を取得する。
virtual void Destroy()=0
マネージャーを破棄する。
ModelLoader()
コンストラクタ
Definition: Effekseer.h:2467
void RotationY(float angle)
Y軸回転行列(右手)
void SetModelLoader(ModelLoader *loader)
モデルローダーを設定する。
float Values[4][4]
行列の値
Definition: Effekseer.h:958
virtual RandFunc GetRandFunc() const =0
ランダム関数を取得する。
Matrix44 & PerspectiveFovRH_OpenGL(float ovY, float aspect, float zn, float zf)
OpenGL用射影行列化(右手系)
virtual void SetMatrix(Handle handle, const Matrix43 &mat)=0
エフェクトのインスタンスに変換行列を設定する。
virtual void SetEffectLoader(EffectLoader *effectLoader)=0
エフェクト読込クラスを設定する。
virtual void SetRandMax(int max_)=0
ランダム関数を設定する。
CoordinateSystem GetCoordinateSystem() const
座標系を取得する。
bool IsExitThread() const
スレッド終了を確認する。
virtual void SetSoundLoader(SoundLoader *soundLoader)=0
サウンド読込クラスを設定する。
サウンド読み込み破棄関数指定クラス
Definition: Effekseer.h:2895
Matrix44 & LookAtRH(const Vector3D &eye, const Vector3D &at, const Vector3D &up)
カメラ行列化(右手系)
void GetRotation(Matrix43 &r) const
行列から回転行列を取得する。
virtual ~TextureLoader()
デストラクタ
Definition: Effekseer.h:2412
virtual ModelLoader * GetModelLoader()=0
モデル読込クラスを取得する。
Definition: Effekseer.h:1978
virtual int GetRandMax() const =0
ランダム最大値を取得する。
virtual Matrix43 GetMatrix(Handle handle)=0
エフェクトのインスタンスに設定されている行列を取得する。
virtual EffectNode * GetChild(int index) const =0
子のノードを取得する。
ファイルアクセス用のファクトリクラス
Definition: Effekseer.h:1127
uint8_t A
透明度
Definition: Effekseer.h:683
Definition: Effekseer.h:2138
エフェクト管理クラス
Definition: Effekseer.h:1505
Definition: Effekseer.h:2193
Definition: Effekseer.h:2525
virtual void SetTargetLocation(Handle handle, float x, float y, float z)=0
エフェクトのインスタンスのターゲット位置を指定する。
Matrix44 & Indentity()
単位行列化
virtual FreeFunc GetFreeFunc() const =0
メモリ破棄関数を取得する。
static Matrix44 & Mul(Matrix44 &o, const Matrix44 &in1, const Matrix44 &in2)
乗算
static Vector3D & Sub(Vector3D &o, const Vector3D &in1, const Vector3D &in2)
減算
テクスチャデータ
Definition: Effekseer.h:455
行列
Definition: Effekseer.h:944
virtual bool Exists(Handle handle)=0
エフェクトのインスタンスが存在しているか取得する。
Matrix44 & LookAtLH(const Vector3D &eye, const Vector3D &at, const Vector3D &up)
カメラ行列化(左手系)
virtual void SetRandFunc(RandFunc func)=0
ランダム関数を設定する。
static float Dot(const Vector3D &in1, const Vector3D &in2)
内積
virtual int GetRef()=0
参照カウンタを取得する。
virtual void SetRingRenderer(RingRenderer *renderer)=0
リング描画機能を設定する。
virtual void SetSpriteRenderer(SpriteRenderer *renderer)=0
スプライト描画機能を設定する。
Definition: Effekseer.h:1183
virtual SpriteRenderer * GetSpriteRenderer()=0
スプライト描画機能を取得する。
void RotationAxis(const Vector3D &axis, float angle)
任意軸に対する反時計周り方向回転行列化を行う。
void RotationX(float angle)
反時計周り方向のX軸回転行列化を行う。
virtual void AddLocation(Handle handle, const Vector3D &location)=0
エフェクトのインスタンスの位置に加算する。
SoundLoader()
コンストラクタ
Definition: Effekseer.h:2901
virtual Handle Play(Effect *effect, float x, float y, float z)=0
再生する。
virtual Matrix43 GetBaseMatrix(Handle handle)=0
エフェクトのベース行列を取得する。
virtual void SetModelLoader(ModelLoader *modelLoader)=0
モデル読込クラスを設定する。
virtual ~EffectLoader()
デストラクタ
Definition: Effekseer.h:2350
static Manager * Create(int instance_max, bool autoFlip=true)
マネージャーを生成する。
Definition: Effekseer.h:2051
virtual EffectLoader * GetEffectLoader()=0
エフェクト読込クラスを取得する。
virtual void SetShown(Handle handle, bool shown)=0
エフェクトのインスタンスをDraw時に描画するか設定する。
static void Mul(Color &o, const Color &in1, const Color &in2)
乗算
virtual void SetBaseMatrix(Handle handle, const Matrix43 &mat)=0
エフェクトのベース行列を設定する。
virtual int AddRef()=0
参照カウンタを加算する。
void SetEffectLoader(EffectLoader *loader)
エフェクトローダーを設定する。
void SetSoundLoader(SoundLoader *loader)
サウンドローダーを設定する。
virtual void Update(float deltaFrame=1.0f)=0
更新処理を行う。
テクスチャ読み込み破棄関数指定クラス
Definition: Effekseer.h:2401
virtual void SetMaterialPath(const EFK_CHAR *materialPath)=0
素材パスを設定する。
virtual TextureLoader * GetTextureLoader()=0
テクスチャ読込クラスを取得する。
virtual void CalcCulling(const Matrix44 &cameraProjMat, bool isOpenGL)=0
カリングを行い、カリングされたオブジェクトのみを描画するようにする。
モデル読み込み破棄関数指定クラス
Definition: Effekseer.h:2461
virtual int GetUpdateTime() const =0
Update処理時間を取得。
virtual void Unload(TextureData *data)
テクスチャを破棄する。
Definition: Effekseer.h:2432
void GetSRT(Vector3D &s, Matrix43 &r, Vector3D &t) const
行列を、拡大、回転、移動の行列とベクトルに分解する。
float X
X.
Definition: Effekseer.h:495
virtual void SetCoordinateSystem(CoordinateSystem coordinateSystem)=0
座標系を設定する。
四角形
Definition: Effekseer.h:727
virtual void * Load(const EFK_CHAR *path)
サウンドを読み込む。
Definition: Effekseer.h:2916
virtual void SetRibbonRenderer(RibbonRenderer *renderer)=0
ストライプ描画機能を設定する。
float Value[4][3]
行列の値
Definition: Effekseer.h:792
void RotationX(float angle)
X軸回転行列(右手)
エフェクトパラメータークラス
Definition: Effekseer.h:1245
virtual void Draw()=0
描画処理を行う。
virtual void SetSoundPlayer(SoundPlayer *soundPlayer)=0
サウンド再生機能を設定する。
virtual ~Model()
デストラクタ
Definition: Effekseer.h:2643
virtual void EndUpdate()=0
更新処理を終了する。
Matrix44 & PerspectiveFovLH(float ovY, float aspect, float zn, float zf)
射影行列化(左手系)
Definition: Effekseer.h:2118
4x3行列
Definition: Effekseer.h:784
virtual bool Load(const EFK_CHAR *path, void *&data, int32_t &size)=0
エフェクトファイルを読み込む。
void Quaternion(float x, float y, float z, float w)
クオータニオンから行列に変換
Definition: Effekseer.h:2836
Matrix44 & Transpose()
転置行列化
virtual ~SoundLoader()
デストラクタ
Definition: Effekseer.h:2906
ファイル読み込みクラス
Definition: Effekseer.h:1083
SoundLoader * GetSoundLoader()
サウンドローダーを取得する。
virtual void Unload(void *source)
サウンドを破棄する。
Definition: Effekseer.h:2925
void RotationY(float angle)
反時計周り方向のY軸回転行列化を行う。
Definition: Effekseer.h:1204
3次元ベクトル
Definition: Effekseer.h:541
virtual SoundLoader * GetSoundLoader()=0
サウンド読込クラスを取得する
3次元ベクトル
Definition: Effekseer.h:489
ファイル書き込みクラス
Definition: Effekseer.h:1104
virtual void SetLocation(Handle handle, float x, float y, float z)=0
エフェクトのインスタンスの位置を指定する。
float X
X.
Definition: Effekseer.h:547
void Translation(float x, float y, float z)
移動行列化を行う。
参照カウンタのインターフェース
Definition: Effekseer.h:381
virtual int GetVersion() const =0
エフェクトデータのバージョン取得
virtual void Update()=0
サーバーを更新し、エフェクトのリロードを行う。
共通描画パラメーター
Definition: Effekseer.h:1427
static float LengthSq(const Vector3D &in)
長さの二乗
virtual int32_t GetModelCount() const =0
格納されているモデルのポインタの個数を取得する。
Definition: Effekseer.h:2122
static Matrix44 & Inverse(Matrix44 &o, const Matrix44 &in)
逆行列
void SetTextureLoader(TextureLoader *loader)
テクスチャローダーを設定する。
virtual void * Load(const EFK_CHAR *path)
モデルを読み込む。
Definition: Effekseer.h:2482
static void Normal(Vector3D &o, const Vector3D &in)
単位ベクトル
Definition: Effekseer.h:2535
virtual Vector3D GetLocation(Handle handle)=0
エフェクトのインスタンスの位置を取得する。
Definition: Effekseer.h:2257
Definition: Effekseer.h:2280
virtual int32_t GetWaveCount() const =0
格納されている音波形のポインタの個数を取得する。
Definition: Effekseer.h:3075
virtual void Unload(void *data, int32_t size)=0
エフェクトファイルを破棄する。
virtual void StopRoot(Handle handle)=0
エフェクトのルートだけを停止する。
色
Definition: Effekseer.h:663
void RotationZXY(float rz, float rx, float ry)
反時計周り方向のZXY軸回転行列化を行う。
virtual TextureData * GetDistortionImage(int n) const =0
格納されている歪み画像のポインタを取得する。
virtual void StopAllEffects()=0
全てのエフェクトを停止する。
virtual void StopEffect(Handle handle)=0
エフェクトを停止する。
float Y
Y.
Definition: Effekseer.h:500
Definition: Effekseer.h:2261
Definition: Effekseer.h:2213
virtual ~ModelLoader()
デストラクタ
Definition: Effekseer.h:2472
Definition: Effekseer.h:2546
static void Multiple(Matrix43 &out, const Matrix43 &in1, const Matrix43 &in2)
行列同士の乗算を行う。
virtual void SetSetting(Setting *setting)=0
設定クラスを設定する。
virtual ModelRenderer * GetModelRenderer()=0
モデル描画機能を取得する。
void SetSRT(const Vector3D &s, const Matrix43 &r, const Vector3D &t)
行列の拡大、回転、移動を設定する。
virtual void BeginUpdate()=0
更新処理を開始する。
virtual SoundPlayer * GetSoundPlayer()=0
サウンド再生機能を取得する。
virtual int32_t GetNormalImageCount() const =0
格納されている法線画像のポインタの個数を取得する。
virtual void Regist(const EFK_CHAR *key, Effect *effect)=0
エフェクトをリロードの対象として登録する。
virtual void UpdateHandle(Handle handle, float deltaFrame=1.0f)=0
ハンドル単位の更新を行う。
void SetCoordinateSystem(CoordinateSystem coordinateSystem)
座標系を設定する。
uint8_t R
赤
Definition: Effekseer.h:668
void Translation(float x, float y, float z)
移動行列
virtual CoordinateSystem GetCoordinateSystem() const =0
座標系を取得する。
virtual void UnloadResources()=0
画像等リソースの破棄を行う。
virtual void SetScale(Handle handle, float x, float y, float z)=0
エフェクトのインスタンスの拡大率を指定する。
virtual int32_t GetInstanceCount(Handle handle)=0
エフェクトに使用されているインスタンス数を取得する。
EffectLoader()
コンストラクタ
Definition: Effekseer.h:2345
virtual TextureData * GetNormalImage(int n) const =0
格納されている法線画像のポインタを取得する。
void Scaling(float x, float y, float z)
拡大行列化を行う。
::Effekseer::EffectLoader * CreateEffectLoader(::Effekseer::FileInterface *fileInterface=NULL)
標準のエフェクト読込インスタンスを生成する。
モデルクラス
Definition: Effekseer.h:2520
Matrix44 & OrthographicRH(float width, float height, float zn, float zf)
正射影行列化(右手系)
Definition: Effekseer.h:1982
Definition: Effekseer.h:2066
Definition: Effekseer.h:3143
bool Wait() const
スレッド終了を待つ。
static Setting * Create()
設定インスタンスを生成する。
virtual void SetSpeed(Handle handle, float speed)=0
エフェクトのインスタンスを再生スピードを設定する。
Definition: Effekseer.h:3235
設定クラス
Definition: Effekseer.h:2957
virtual Setting * GetSetting() const =0
設定を取得する。
virtual RibbonRenderer * GetRibbonRenderer()=0
ストライプ描画機能を取得する。
virtual void DrawHandle(Handle handle)=0
ハンドル単位の描画処理を行う。
bool Create(void(*threadFunc)(void *), void *data)
スレッドを生成する。
void RotationAxis(const Vector3D &axis, float angle)
任意軸反時計回転行列
Definition: Effekseer.h:2833
virtual Effect * GetEffect() const =0
ノードが所属しているエフェクトを取得する。
virtual void SetMallocFunc(MallocFunc func)=0
メモリ確保関数を設定する。
void Indentity()
単位行列化を行う。
TextureLoader()
コンストラクタ
Definition: Effekseer.h:2407
virtual void ReloadResources(const EFK_CHAR *materialPath=NULL)=0
画像等リソースの再読み込みを行う。
virtual TextureData * Load(const EFK_CHAR *path, TextureType textureType)
テクスチャを読み込む。
Definition: Effekseer.h:2423
virtual int Release()=0
参照カウンタを減算する。0になった時、インスタンスを削除する。
virtual void SetPaused(Handle handle, bool paused)=0
エフェクトのインスタンスをUpdate時に更新するか設定する。
virtual void SetTextureLoader(TextureLoader *textureLoader)=0
テクスチャ読込クラスを設定する。
float Y
Y.
Definition: Effekseer.h:552
参照カウンタオブジェクト
Definition: Effekseer.h:409
void Scaling(float x, float y, float z)
拡大行列化
uint8_t B
青
Definition: Effekseer.h:678
virtual bool Reload(void *data, int32_t size, const EFK_CHAR *materialPath=NULL)=0
エフェクトのリロードを行う。
uint8_t G
緑
Definition: Effekseer.h:673
virtual void * GetWave(int n) const =0
格納されている音波形のポインタを取得する。
Definition: Effekseer.h:2275
virtual RingRenderer * GetRingRenderer()=0
リング描画機能を取得する。
virtual bool Start(uint16_t port)=0
サーバーを開始する。
virtual void Unload(void *data)
モデルを破棄する。
Definition: Effekseer.h:2491
virtual void Unregist(Effect *effect)=0
エフェクトをリロードの対象から外す。
virtual TextureData * GetColorImage(int n) const =0
格納されている色画像のポインタを取得する。
void GetTranslation(Vector3D &t) const
行列から移動ベクトルを取得する。
virtual void Flip()=0
今までのPlay等の処理をUpdate実行時に適用するようにする。
Matrix44 & PerspectiveFovRH(float ovY, float aspect, float zn, float zf)
射影行列化(右手系)