/usr/include/crystalspace-2.0/iengine/rview.h is in libcrystalspace-dev 2.0+dfsg-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 | /*
Copyright (C) 2000 by Jorrit Tyberghein
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this library; if not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __CS_IENGINE_RVIEW_H__
#define __CS_IENGINE_RVIEW_H__
/**\file
* Render view
*/
/**
* \addtogroup engine3d_views
* @{ */
#include "csutil/scf.h"
#include "csgeom/plane3.h"
struct iCamera;
struct iClipper2D;
struct iEngine;
struct iGraphics2D;
struct iGraphics3D;
struct iPortal;
struct iSector;
struct csFog;
class csBox3;
class csReversibleTransform;
class csSphere;
class csVector3;
/**
* Information for vertex based fog. There is an instance of this
* structure in iRenderView for every fogged sector that
* we encounter. It contains information which allows us to calculate
* the thickness of the fog for any given ray through the incoming
* and outgoing portals of the sector.
*/
class csFogInfo
{
public:
/// Next in list (back in recursion time).
csFogInfo* next;
/// The incoming plane (plane of the portal).
csPlane3 incoming_plane;
/// The outgoing plane (also of a portal).
csPlane3 outgoing_plane;
/**
* If this is false then there is no incoming plane (the current sector has
* fog and is not being drawn through a portal).
*/
bool has_incoming_plane;
/**
* If this is false there is no outgoing plane. The 'outgoing plane
* distance' is then calculated by straight distance to a vertex instead of
* projecting throught the outgoing plane
*/
bool has_outgoing_plane;
/// The structure describing the fog.
csFog* fog;
};
/**
* This structure keeps track of the current render context.
* It is used by iRenderView. When recursing through a portal
* a new render context will be created and set in place of the
* old one.
*/
class csRenderContext
{
public:
/// A pointer back to the previous render context.
csRenderContext* previous;
/// The current camera.
csRef<iCamera> icamera;
/// The 2D polygon describing how everything drawn inside should be clipped.
csRef<iClipper2D> iview;
///// The frustum corresponding with iview.
csPlane3 frustum[5];
/// A set of clip planes for this context in world space.
csPlane3 clip_planes[7];
/// A frustum masks which indicates which planes of clip_planes are used.
uint32 clip_planes_mask;
/// The last portal we traversed through (or 0 if first sector).
iPortal* last_portal;
/// The previous sector (or 0 if the first sector).
iSector* previous_sector;
/// This sector.
iSector* this_sector;
/**
* This variable holds the plane of the portal through which the camera
* is looking.
*/
csPlane3 clip_plane;
/**
* If true then we clip all objects to 'clip_plane'. In principle
* one should always clip to 'clip_plane'. However, in many cases
* this is not required because portals mostly arrive in at the
* boundaries of a sector so there can actually be no objects
* after the portal plane. But it is possible that portals arive
* somewhere in the middle of a sector (for example with BSP sectors
* or with Things containing portals). In that case this variable
* will be set to true and clipping to 'clip_plane' is required.
*/
bool do_clip_plane;
/**
* If true then we have to clip all objects to the portal frustum
* (either in 2D or 3D). Normally this is not needed but some portals
* require this. If do_clip_plane is true then the value of this
* field is also implied to be true. The top-level portal should
* set do_clip_frustum to true in order for all geometry to be
* correctly clipped to screen boundaries.
*/
bool do_clip_frustum;
/**
* Every fogged sector we encountered results in an extra structure in the
* following list. This is only used if we are doing vertex based fog.
*/
csFogInfo* fog_info;
/**
* If the following variable is true then a fog_info was added in this
* recursion level.
*/
bool added_fog_info;
/**
* A number indicating the recursion level we are in. Starts with 0.
* Whenever the engine goes through a portal this number increases.
* Returning from a portal decreases the number again.
*/
int draw_rec_level;
/**
* This unique id can be used to check if you are still in the same
* render context. Checking on pointers is not safe since render contexts
* are reused so a different render context can result in the same pointer.
*/
uint32 context_id;
};
/**
* This interface represents all information needed to render
* some object in a current draw context.
*
* Main creators of instances implementing this interface:
* - iEngine
*
* Main users of this interface:
* - meshes
*/
struct iRenderView : public virtual iBase
{
SCF_INTERFACE(iRenderView, 2,2,0);
/// Get the current render context.
virtual csRenderContext* GetRenderContext () = 0;
/// Get the engine.
virtual iEngine* GetEngine () = 0;
/// Get the 2D graphics subsystem.
virtual iGraphics2D* GetGraphics2D () = 0;
/// Get the 3D graphics subsystem.
virtual iGraphics3D* GetGraphics3D () = 0;
/**
* Get the frustum.
*/
virtual void GetFrustum (float& lx, float& rx, float& ty, float& by) = 0;
//-----------------------------------------------------------------
// The following functions operate on the current render context.
//-----------------------------------------------------------------
/// Get the 2D clipper for this view.
virtual iClipper2D* GetClipper () = 0;
/**
* Get the current camera.
*/
virtual iCamera* GetCamera () = 0;
/**
* Get current sector.
*/
virtual iSector* GetThisSector () = 0;
/**
* Get previous sector.
*/
virtual iSector* GetPreviousSector () = 0;
/**
* Get the portal we last traversed through.
*/
virtual iPortal* GetLastPortal () = 0;
/**
* Get the original camera for this render view. This is
* the camera before any space warping portals.
*/
virtual iCamera* GetOriginalCamera () const = 0;
/**
* Get the number of the current frame.
*/
virtual uint GetCurrentFrameNumber () const = 0;
/**
* Create a new render context. This is typically used
* when going through a portal. Note that you should remember
* the old render context if you want to restore it later.
* The render context will get all the values from the current context
* (with SCF references properly incremented).
*/
virtual void CreateRenderContext () = 0;
/**
* Restore a render context. Use this to restore a previously overwritten
* render context. This function will take care of properly cleaning
* up the current render context.
*/
virtual void RestoreRenderContext () = 0;
/**
* Destroy a specific render context (and unlink it from the previous-links)
*/
virtual void DestroyRenderContext (csRenderContext* context) = 0;
};
/** @} */
#endif // __CS_IENGINE_RVIEW_H__
|