Blender V2.61 - r43446

ImageRender.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 This source file is part of VideoTexture library
00004 
00005 Copyright (c) 2007 The Zdeno Ash Miklas
00006 
00007 This program is free software; you can redistribute it and/or modify it under
00008 the terms of the GNU Lesser General Public License as published by the Free Software
00009 Foundation; either version 2 of the License, or (at your option) any later
00010 version.
00011 
00012 This program is distributed in the hope that it will be useful, but WITHOUT
00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
00014 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
00015 
00016 You should have received a copy of the GNU Lesser General Public License along with
00017 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
00018 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
00019 http://www.gnu.org/copyleft/lesser.txt.
00020 -----------------------------------------------------------------------------
00021 */
00022 
00027 #if !defined IMAGERENDER_H
00028 #define IMAGERENDER_H
00029 
00030 
00031 #include "Common.h"
00032 
00033 #include <KX_Scene.h>
00034 #include <KX_Camera.h>
00035 #include <DNA_screen_types.h>
00036 #include <RAS_ICanvas.h>
00037 #include <RAS_IRasterizer.h>
00038 #include <RAS_IRenderTools.h>
00039 
00040 #include "ImageViewport.h"
00041 
00042 
00044 class ImageRender : public ImageViewport
00045 {
00046 public:
00048     ImageRender (KX_Scene * scene, KX_Camera * camera);
00049     ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObject * mirror, RAS_IPolyMaterial * mat);
00050 
00052     virtual ~ImageRender (void);
00053 
00055     int getBackground (int idx) { return (idx < 0 || idx > 3) ? 0 : int(m_background[idx]*255.f); }
00057     void setBackground (int red, int green, int blue, int alpha);
00058 
00060     float getClip (void) { return m_clip; }
00062     void setClip (float clip) { m_clip = clip; }
00063 
00064 protected:
00066     bool m_render;
00068     KX_Scene * m_scene;
00070     KX_Camera * m_camera;
00072     bool m_owncamera;
00074     KX_GameObject * m_observer;
00075     KX_GameObject * m_mirror;
00076     float m_clip;                       // clipping distance
00077     float m_mirrorHalfWidth;            // mirror width in mirror space
00078     float m_mirrorHalfHeight;           // mirror height in mirror space
00079     MT_Point3 m_mirrorPos;              // mirror center position in local space
00080     MT_Vector3 m_mirrorZ;               // mirror Z axis in local space
00081     MT_Vector3 m_mirrorY;               // mirror Y axis in local space
00082     MT_Vector3 m_mirrorX;               // mirror X axis in local space
00084     RAS_ICanvas* m_canvas;
00086     RAS_IRasterizer* m_rasterizer;
00088     RAS_IRenderTools* m_rendertools;
00090     KX_KetsjiEngine* m_engine;
00091 
00093     float  m_background[4];
00094 
00095 
00097     virtual void calcImage (unsigned int texId, double ts);
00098 
00099     void Render();
00100     void SetupRenderFrame(KX_Scene *scene, KX_Camera* cam);
00101     void RenderFrame(KX_Scene* scene, KX_Camera* cam);
00102     void SetBackGround(KX_WorldInfo* wi);
00103     void SetWorldSettings(KX_WorldInfo* wi);
00104 };
00105 
00106 
00107 #endif
00108