arsa  2.7
EffekseerRendererDX11.h
Go to the documentation of this file.
1 
2 #ifndef __EFFEKSEERRENDERER_DX11_BASE_PRE_H__
3 #define __EFFEKSEERRENDERER_DX11_BASE_PRE_H__
4 
5 //----------------------------------------------------------------------------------
6 // Include
7 //----------------------------------------------------------------------------------
8 #include <Effekseer.h>
9 
10 #include <windows.h>
11 #include <d3d11.h>
12 
13 #if _WIN32
14 #pragma comment(lib, "gdiplus.lib")
15 #pragma comment(lib, "d3d11.lib" )
16 #endif
17 
18 //----------------------------------------------------------------------------------
19 //
20 //----------------------------------------------------------------------------------
22 {
23 //----------------------------------------------------------------------------------
24 //
25 //----------------------------------------------------------------------------------
26 class Renderer;
27 
28 //----------------------------------------------------------------------------------
29 //
30 //----------------------------------------------------------------------------------
31 }
32 //----------------------------------------------------------------------------------
33 //
34 //----------------------------------------------------------------------------------
35 #endif // __EFFEKSEERRENDERER_DX11_PRE_BASE_H__
36 
37 #ifndef __EFFEKSEERRENDERER_RENDERER_H__
38 #define __EFFEKSEERRENDERER_RENDERER_H__
39 
40 //----------------------------------------------------------------------------------
41 // Include
42 //----------------------------------------------------------------------------------
43 #include <Effekseer.h>
44 
45 //-----------------------------------------------------------------------------------
46 //
47 //-----------------------------------------------------------------------------------
49 {
50 //-----------------------------------------------------------------------------------
51 //
52 //-----------------------------------------------------------------------------------
53 
58 {
59 public:
61  virtual ~DistortingCallback() {}
62 
63  virtual bool OnDistorting() { return false; }
64 };
65 
71 enum class UVStyle
72 {
73  Normal,
75 };
76 
82 enum class ProxyTextureType
83 {
84  White,
85  Normal,
86 };
87 
94 {
95 public:
96  GraphicsDevice() = default;
97  virtual ~GraphicsDevice() = default;
98 };
99 
101 {
102 public:
103  CommandList() = default;
104  virtual ~CommandList() = default;
105 };
106 
108 {
109 public:
110  SingleFrameMemoryPool() = default;
111  virtual ~SingleFrameMemoryPool() = default;
112 
118  virtual void NewFrame() {}
119 };
120 
121 class Renderer
122  : public ::Effekseer::IReference
123 {
124 protected:
125  Renderer();
126  virtual ~Renderer();
127 
128  class Impl;
129  Impl* impl = nullptr;
130 
131 public:
132 
136  Impl* GetImpl();
137 
141  virtual void OnLostDevice() = 0;
142 
146  virtual void OnResetDevice() = 0;
147 
151  virtual void Destroy() = 0;
152 
156  virtual void SetRestorationOfStatesFlag(bool flag) = 0;
157 
161  virtual bool BeginRendering() = 0;
162 
166  virtual bool EndRendering() = 0;
167 
171  virtual ::Effekseer::Vector3D GetLightDirection() const;
172 
176  virtual void SetLightDirection(const ::Effekseer::Vector3D& direction);
177 
181  virtual const ::Effekseer::Color& GetLightColor() const;
182 
186  virtual void SetLightColor(const ::Effekseer::Color& color);
187 
191  virtual const ::Effekseer::Color& GetLightAmbientColor() const;
192 
196  virtual void SetLightAmbientColor(const ::Effekseer::Color& color);
197 
201  virtual int32_t GetSquareMaxCount() const = 0;
202 
206  virtual ::Effekseer::Matrix44 GetProjectionMatrix() const;
207 
211  virtual void SetProjectionMatrix( const ::Effekseer::Matrix44& mat );
212 
216  virtual ::Effekseer::Matrix44 GetCameraMatrix() const;
217 
221  virtual void SetCameraMatrix( const ::Effekseer::Matrix44& mat );
222 
226  virtual ::Effekseer::Matrix44 GetCameraProjectionMatrix() const;
227 
233  virtual ::Effekseer::Vector3D GetCameraFrontDirection() const;
234 
240  virtual ::Effekseer::Vector3D GetCameraPosition() const;
241 
249  virtual void SetCameraParameter(const ::Effekseer::Vector3D& front, const ::Effekseer::Vector3D& position);
250 
254  virtual ::Effekseer::SpriteRenderer* CreateSpriteRenderer() = 0;
255 
259  virtual ::Effekseer::RibbonRenderer* CreateRibbonRenderer() = 0;
260 
264  virtual ::Effekseer::RingRenderer* CreateRingRenderer() = 0;
265 
269  virtual ::Effekseer::ModelRenderer* CreateModelRenderer() = 0;
270 
274  virtual ::Effekseer::TrackRenderer* CreateTrackRenderer() = 0;
275 
279  virtual ::Effekseer::TextureLoader* CreateTextureLoader( ::Effekseer::FileInterface* fileInterface = NULL ) = 0;
280 
284  virtual ::Effekseer::ModelLoader* CreateModelLoader( ::Effekseer::FileInterface* fileInterface = NULL ) = 0;
285 
292  virtual ::Effekseer::MaterialLoader* CreateMaterialLoader(::Effekseer::FileInterface* fileInterface = nullptr) = 0;
293 
297  virtual void ResetRenderState() = 0;
298 
303 
307  virtual void SetDistortingCallback(DistortingCallback* callback) = 0;
308 
314  virtual int32_t GetDrawCallCount() const;
315 
321  virtual int32_t GetDrawVertexCount() const;
322 
328  virtual void ResetDrawCallCount();
329 
335  virtual void ResetDrawVertexCount();
336 
342  virtual Effekseer::RenderMode GetRenderMode() const;
343 
349  virtual void SetRenderMode(Effekseer::RenderMode renderMode);
350 
356  virtual UVStyle GetTextureUVStyle() const;
357 
363  virtual void SetTextureUVStyle(UVStyle style);
364 
370  virtual UVStyle GetBackgroundTextureUVStyle() const;
371 
377  virtual void SetBackgroundTextureUVStyle(UVStyle style);
378 
384  virtual float GetTime() const;
385 
391  virtual void SetTime(float time);
392 
398  virtual void SetCommandList(CommandList* commandList) {}
399 
408  virtual void SetBackgroundTexture(::Effekseer::TextureData* textureData);
409 
416 
423 };
424 
425 //----------------------------------------------------------------------------------
426 //
427 //----------------------------------------------------------------------------------
428 }
429 //----------------------------------------------------------------------------------
430 //
431 //----------------------------------------------------------------------------------
432 #endif // __EFFEKSEERRENDERER_RENDERER_H__
433 
434 #ifndef __EFFEKSEERRENDERER_DX11_RENDERER_H__
435 #define __EFFEKSEERRENDERER_DX11_RENDERER_H__
436 
437 //----------------------------------------------------------------------------------
438 // Include
439 //----------------------------------------------------------------------------------
440 
441 //----------------------------------------------------------------------------------
442 //
443 //----------------------------------------------------------------------------------
444 namespace EffekseerRendererDX11
445 {
446 //----------------------------------------------------------------------------------
447 //
448 //----------------------------------------------------------------------------------
449 
453 ::Effekseer::TextureLoader* CreateTextureLoader(ID3D11Device* device,
454  ID3D11DeviceContext* context,
455  ::Effekseer::FileInterface* fileInterface = nullptr,
457 
461 ::Effekseer::ModelLoader* CreateModelLoader(ID3D11Device* device, ::Effekseer::FileInterface* fileInterface = NULL);
462 
463 
467 class Renderer
469 {
470 protected:
471  Renderer() {}
472  virtual ~Renderer() {}
473 
474 public:
484  static Renderer* Create(
485  ID3D11Device* device,
486  ID3D11DeviceContext* context,
487  int32_t squareMaxCount,
488  D3D11_COMPARISON_FUNC depthFunc = D3D11_COMPARISON_LESS_EQUAL,
489  bool isMSAAEnabled = false);
490 
491  virtual ID3D11Device* GetDevice() = 0;
492 
493  virtual ID3D11DeviceContext* GetContext() = 0;
494 
499  virtual Effekseer::TextureData* GetBackground() = 0;
500 
505  virtual void SetBackground(ID3D11ShaderResourceView* background) = 0;
506 };
507 
508 //----------------------------------------------------------------------------------
509 //
510 //----------------------------------------------------------------------------------
515 class Model
516  : public Effekseer::Model
517 {
518 private:
519 
520 public:
521 
523  {
524  ID3D11Buffer* VertexBuffer;
525  ID3D11Buffer* IndexBuffer;
529 
531  {
532  VertexBuffer = nullptr;
533  IndexBuffer = nullptr;
534  VertexCount = 0;
535  IndexCount = 0;
536  FaceCount = 0;
537  }
538 
539  virtual ~InternalModel()
540  {
543  }
544  };
545 
548 
550  : Effekseer::Model ( data, size )
551  , InternalModels(nullptr)
552  , ModelCount(0)
553  {
554  this->m_vertexSize = sizeof(VertexWithIndex);
555  }
556 
557  virtual ~Model()
558  {
560  }
561 };
562 
563 
564 //----------------------------------------------------------------------------------
565 //
566 //----------------------------------------------------------------------------------
567 }
568 //----------------------------------------------------------------------------------
569 //
570 //----------------------------------------------------------------------------------
571 #endif // __EFFEKSEERRENDERER_DX11_RENDERER_H__
virtual void ResetDrawCallCount()
Reset draw call count.
virtual void ResetDrawVertexCount()
Reset the number of vertex drawn.
virtual void SetCameraMatrix(const ::Effekseer::Matrix44 &mat)
Set a camera matrix.
int32_t m_vertexSize
Definition: Effekseer.h:3304
virtual void SetTime(float time)
Set a current time (s)
#define ES_SAFE_RELEASE(val)
Definition: Effekseer.h:125
virtual ID3D11DeviceContext * GetContext()=0
virtual ::Effekseer::TrackRenderer * CreateTrackRenderer()=0
軌跡レンダラーを生成する。
#define ES_SAFE_DELETE_ARRAY(val)
Definition: Effekseer.h:127
背景を歪ませるエフェクトを描画する前に実行されるコールバック
signed int int32_t
virtual int32_t GetSquareMaxCount() const =0
最大描画スプライト数を取得する。
::Effekseer::TextureLoader * CreateTextureLoader(ID3D11Device *device, ID3D11DeviceContext *context, ::Effekseer::FileInterface *fileInterface=nullptr, ::Effekseer::ColorSpaceType colorSpaceType=::Effekseer::ColorSpaceType::Gamma)
テクスチャ読込クラスを生成する。
virtual float GetTime() const
Get a current time (s)
virtual ::Effekseer::MaterialLoader * CreateMaterialLoader(::Effekseer::FileInterface *fileInterface=nullptr)=0
Create default material loader.
virtual void SetCommandList(CommandList *commandList)
specify a command list to render. This function is available except DirectX9, DirectX11 and OpenGL.
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: SDL_opengl.h:1974
virtual void SetLightColor(const ::Effekseer::Color &color)
Specify the color of light.
virtual UVStyle GetTextureUVStyle() const
Get an UV Style of texture when particles are rendered.
virtual void SetBackgroundTextureUVStyle(UVStyle style)
Set an UV Style of background when particles are rendered.
virtual void DeleteProxyTexture(Effekseer::TextureData *data)
Delete a proxy texture.
static Renderer * Create(ID3D11Device *device, ID3D11DeviceContext *context, int32_t squareMaxCount, D3D11_COMPARISON_FUNC depthFunc=D3D11_COMPARISON_LESS_EQUAL, bool isMSAAEnabled=false)
インスタンスを生成する。
virtual ::Effekseer::RingRenderer * CreateRingRenderer()=0
リングレンダラーを生成する。
virtual ~CommandList()=default
factory class for io
Definition: Effekseer.h:1484
virtual void SetBackground(ID3D11ShaderResourceView *background)=0
Set background.
GLsizeiptr size
virtual void SetCameraParameter(const ::Effekseer::Vector3D &front, const ::Effekseer::Vector3D &position)
Set a front direction and position of camera manually.
virtual void SetRenderMode(Effekseer::RenderMode renderMode)
Specify a render mode.
virtual bool BeginRendering()=0
描画を開始する時に実行する。
Texture data.
Definition: Effekseer.h:541
virtual ::Effekseer::Vector3D GetCameraFrontDirection() const
Get a front direction of camera.
virtual void SetLightDirection(const ::Effekseer::Vector3D &direction)
Specifiy the direction of light.
virtual ::Effekseer::SpriteRenderer * CreateSpriteRenderer()=0
スプライトレンダラーを生成する。
virtual void SetProjectionMatrix(const ::Effekseer::Matrix44 &mat)
Set a projection matrix.
virtual Effekseer::RenderMode GetRenderMode() const
Get a render mode.
virtual void NewFrame()
notify that new frame is started.
virtual Effekseer::TextureData * GetBackground()=0
Get background.
virtual ::Effekseer::Matrix44 GetCameraProjectionMatrix() const
Get a camera projection matrix.
virtual ::Effekseer::ModelRenderer * CreateModelRenderer()=0
モデルレンダラーを生成する。
virtual int32_t GetDrawCallCount() const
Get draw call count.
virtual ID3D11Device * GetDevice()=0
A class which contains a graphics device.
テクスチャ読み込み破棄関数指定クラス
Definition: Effekseer.h:3012
モデル読み込み破棄関数指定クラス
Definition: Effekseer.h:3091
virtual void ResetRenderState()=0
レンダーステートを強制的にリセットする。
virtual void SetRestorationOfStatesFlag(bool flag)=0
ステートを復帰するかどうかのフラグを設定する。
virtual void OnLostDevice()=0
デバイスロストが発生した時に実行する。
virtual ::Effekseer::TextureLoader * CreateTextureLoader(::Effekseer::FileInterface *fileInterface=NULL)=0
標準のテクスチャ読込クラスを生成する。
virtual ::Effekseer::Vector3D GetCameraPosition() const
Get a position of camera.
ProxyTextureType
A type of texture which is rendered when textures are not assigned.
参照カウンタのインターフェース
Definition: Effekseer.h:416
Impl * GetImpl()
only for Effekseer backend developer. Effekseer User doesn't need it.
Model(uint8_t *data, int32_t size)
virtual void SetBackgroundTexture(::Effekseer::TextureData *textureData)
Specify a background texture. Specified texture is not deleted by the renderer. This function is avai...
#define NULL
Definition: begin_code.h:167
unsigned char uint8_t
virtual ::Effekseer::ModelLoader * CreateModelLoader(::Effekseer::FileInterface *fileInterface=NULL)=0
標準のモデル読込クラスを生成する。
virtual void SetDistortingCallback(DistortingCallback *callback)=0
背景を歪ませるエフェクトが描画される前に呼ばれるコールバックを設定する。
virtual void Destroy()=0
このインスタンスを破棄する。
GLuint color
Model class.
Definition: Effekseer.h:3244
UVStyle
A status of UV when particles are rendered.
GLuint GLuint GLsizei GLenum type
Definition: SDL_opengl.h:1571
virtual const ::Effekseer::Color & GetLightColor() const
Get the color of light.
virtual ::Effekseer::Matrix44 GetProjectionMatrix() const
Get a projection matrix.
virtual DistortingCallback * GetDistortingCallback()=0
背景を歪ませるエフェクトが描画される前に呼ばれるコールバックを取得する。
virtual ::Effekseer::Vector3D GetLightDirection() const
Get the direction of light.
virtual UVStyle GetBackgroundTextureUVStyle() const
Get an UV Style of background when particles are rendered.
virtual int32_t GetDrawVertexCount() const
Get the number of vertex drawn.
virtual void SetLightAmbientColor(const ::Effekseer::Color &color)
Specify the color of ambient.
virtual Effekseer::TextureData * CreateProxyTexture(ProxyTextureType type)
Create a proxy texture.
virtual ::Effekseer::Matrix44 GetCameraMatrix() const
Get a camera matrix.
::Effekseer::ModelLoader * CreateModelLoader(ID3D11Device *device, ::Effekseer::FileInterface *fileInterface=NULL)
モデル読込クラスを生成する。
virtual void SetTextureUVStyle(UVStyle style)
Set an UV Style of texture when particles are rendered.
virtual bool EndRendering()=0
描画を終了する時に実行する。
virtual ::Effekseer::RibbonRenderer * CreateRibbonRenderer()=0
リボンレンダラーを生成する。
virtual void OnResetDevice()=0
デバイスがリセットされた時に実行する。
virtual const ::Effekseer::Color & GetLightAmbientColor() const
Get the color of ambient.