2 #include "BaseObject.h" 3 #include "PaintEngine/PaintDevice.h" 28 ATTRIBUTE_METHOD1(
CRenderTarget, GetClearColor_s,
Vector3*) { *p1 = cls->GetClearColor().ToVector3();
return S_OK; }
31 ATTRIBUTE_METHOD1(
CRenderTarget, GetRenderTargetSize_s,
Vector2*) { *p1 = cls->GetRenderTargetSize();
return S_OK; }
32 ATTRIBUTE_METHOD1(
CRenderTarget, SetRenderTargetSize_s,
Vector2) { cls->SetRenderTargetSize(p1);
return S_OK; }
34 ATTRIBUTE_METHOD1(
CRenderTarget, IsActiveRenderingEnabled_s,
bool*) { *p1 = cls->IsActiveRenderingEnabled();
return S_OK; }
35 ATTRIBUTE_METHOD1(
CRenderTarget, EnableActiveRendering_s,
bool) { cls->EnableActiveRendering(p1);
return S_OK; }
37 ATTRIBUTE_METHOD1(
CRenderTarget, IsDirty_s,
bool*) { *p1 = cls->IsDirty();
return S_OK; }
38 ATTRIBUTE_METHOD1(
CRenderTarget, SetDirty_s,
bool) { cls->SetDirty(p1);
return S_OK; }
40 ATTRIBUTE_METHOD1(
CRenderTarget, IsPersistentRenderTarget_s,
bool*) { *p1 = cls->IsPersistentRenderTarget();
return S_OK; }
41 ATTRIBUTE_METHOD1(
CRenderTarget, SetPersistentRenderTarget_s,
bool) { cls->SetPersistentRenderTarget(p1);
return S_OK; }
49 virtual int metric(PaintDeviceMetric metric)
const;
52 bool InitWithWidthAndHeight(
int width,
int height, D3DFORMAT format = D3DFMT_A8R8G8B8, D3DFORMAT depthStencilFormat = D3DFMT_D16);
67 virtual void Clear(
const LinearColor& color,
float depthValue = 1.f,
int stencilValue = 0, DWORD flags = D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER);
102 void SetPersistentRenderTarget(
bool val);
121 HRESULT
SaveToFile(
const char* filename,
int width = 0,
int height = 0, DWORD dwFormat = 3, UINT MipLevels = 0,
int srcLeft = 0,
int srcTop = 0,
int srcWidth = 0,
int srcHeight = 0);
135 void GetRenderTargetSize(
int* nWidth,
int* nHeight);
139 int GetTextureWidth()
const {
return m_nTextureWidth; }
140 int GetTextureHeight()
const {
return m_nTextureHeight; }
144 void SetDirty(
bool val);
146 int GetLifeTime()
const;
147 void SetLifeTime(
int val);
150 virtual void SetDead();
152 const std::string& GetCanvasTextureName();
153 void SetCanvasTextureName(
const std::string& sValue);
158 bool m_bPersistentRenderTarget;
160 int m_nTextureHeight;
164 DWORD m_depthStencilFormat;
167 #ifdef USE_DIRECTX_RENDERER 168 LPDIRECT3DSURFACE9 m_pCanvasSurface;
169 LPDIRECT3DSURFACE9 m_pDepthStencilSurface;
171 LPDIRECT3DSURFACE9 m_pOldRenderTarget;
172 LPDIRECT3DSURFACE9 m_pOldZBuffer;
173 #elif defined USE_OPENGL_RENDERER 175 GLuint _depthRenderBufffer;
204 m_pRenderTarget->Begin();
208 m_pRenderTarget->End();
Which DXT Compression to Use? Obviously, there are some trade-offs between the different formats whic...
Definition: TextureEntity.h:29
std::string m_sCanvasTextureName
render target canvas name
Definition: RenderTarget.h:193
an attribute class is a collection of attribute fields.
Definition: AttributeClass.h:10
HRESULT RestoreDeviceObjects()
restore device object
Definition: RenderTarget.cpp:98
It's used as parameter to Draw method of each scene object.
Definition: SceneState.h:284
HRESULT InitDeviceObjects()
init device objects.
Definition: RenderTarget.cpp:91
void SetClearColor(const LinearColor &bgColor)
set the color of the scene ground when it is not enabled.When scene is enabled, the background color ...
Definition: RenderTarget.cpp:585
LinearColor GetClearColor()
Get the color of the scene ground when it is not enabled.When scene is enabled, the background color ...
Definition: RenderTarget.cpp:590
a render target scene object.
Definition: RenderTarget.h:16
different physics engine has different winding order.
Definition: EventBinding.h:32
DEFINE_SCRIPT_EVENT(CRenderTarget, Paint)
define the On_Paint script callback for painting in 2d space.
bool InitWithWidthAndHeight(int width, int height, D3DFORMAT format=D3DFMT_A8R8G8B8, D3DFORMAT depthStencilFormat=D3DFMT_D16)
initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and R...
Definition: RenderTarget.cpp:472
bool IsDirty() const
whether render target is dirty and should be redraw on the next frame.
Definition: RenderTarget.cpp:662
virtual bool IsDead()
whether this object should be removed some time in the future.
Definition: RenderTarget.cpp:701
virtual HRESULT Draw(SceneState *sceneState)
only for drawable objects
Definition: RenderTarget.cpp:650
Standard 3-dimensional vector.
Definition: ParaVector3.h:16
bool m_bActiveRendering
if true, contents will be drawn to the current render target each frame.
Definition: RenderTarget.h:189
virtual int InstallFields(CAttributeClass *pClass, bool bOverride)
this class should be implemented if one wants to add new attribute.
Definition: RenderTarget.cpp:721
bool IsPersistentRenderTarget() const
default to false, where the render target texture will be deleted when scene object is deleted...
Definition: RenderTarget.cpp:67
Definition: BaseCamera.h:70
Standard 2-dimensional vector.
Definition: ParaVector2.h:16
DWORD m_dwClearColor
used when clearing background color
Definition: RenderTarget.h:183
virtual void Cleanup()
clean up all resource objects
Definition: RenderTarget.cpp:203
helper class for painting on render target
Definition: RenderTarget.h:199
asset_ptr< TextureEntity > m_pCanvasTexture
render target
Definition: RenderTarget.h:166
base class for a surface to paint to.
Definition: Painter.h:38
Definition: RenderCoreOpenGL.h:140
virtual void End()
end rendering to texture, restore old render target
Definition: RenderTarget.cpp:550
virtual TextureEntity * GetTexture()
the canvas texture, which can be used as any other ordinary texture on 3D or 2D object.
Definition: RenderTarget.cpp:77
void EnableActiveRendering(bool bEnable)
if true, contents will be drawn to the current render target each frame.
Definition: RenderTarget.cpp:677
void SetRenderTargetSize(int nWidth, int nHeight)
set the canvas size in pixels
Definition: RenderTarget.cpp:427
The CPaintEngine class provides an abstract definition of how CPainter draws to a given device on a g...
Definition: PaintEngine.h:34
virtual void DoPaint(CPainter *painter=NULL)
invoke the On_Paint script event handler if any.
Definition: RenderTarget.cpp:622
bool m_bIsDirty
whether render target is dirty and should be redraw on the next frame.
Definition: RenderTarget.h:191
HRESULT DeleteDeviceObjects()
delete device objects
Definition: RenderTarget.cpp:190
Defines the base class of all scene elements:CBaseObject for Parallel World Engine.
Definition: BaseObject.h:230
HRESULT InvalidateDeviceObjects()
Invalid device object.
Definition: RenderTarget.cpp:168
virtual int PrepareRender(CBaseCamera *pCamera, SceneState *pSceneState)
derived class can override this function to place the object in to the render pipeline.
Definition: RenderTarget.cpp:639
base class for a surface to paint to.
Definition: PaintDevice.h:10
HRESULT SaveToFile(const char *filename, int width=0, int height=0, DWORD dwFormat=3, UINT MipLevels=0, int srcLeft=0, int srcTop=0, int srcWidth=0, int srcHeight=0)
save o a different texture file format and save with full mipmapping to disk.
Definition: RenderTarget.cpp:209
A linear, 32-bit/component floating point RGBA color.
Definition: ParaColor.h:12
Definition: ParaColor.h:275
virtual bool Begin()
starts rendering to texture.
Definition: RenderTarget.cpp:492
Unlike TextureEntity, ImageEntity is a device independent entity in memory.
Definition: ImageEntity.h:9
bool IsActiveRenderingEnabled() const
if true, contents will be drawn to the current render target each frame.
Definition: RenderTarget.cpp:672
virtual void Clear(const LinearColor &color, float depthValue=1.f, int stencilValue=0, DWORD flags=D3DCLEAR_TARGET|D3DCLEAR_ZBUFFER)
this is usually the first function to call after calling begin().
Definition: RenderTarget.cpp:596
virtual AssetEntity * GetPrimaryAsset()
get the asset render target object.
Definition: RenderTarget.cpp:82
Base class for managed asset entity in ParaEngine.
Definition: AssetEntity.h:25
virtual CPaintEngine * paintEngine() const
Returns the paint engine.
Definition: RenderTarget.cpp:609