40#ifndef CLIP_VIEWPORT_H
41#define CLIP_VIEWPORT_H
44#include "component_base.h"
45#include "component_light_mgr.h"
72 for (
int i = 0; i < 6; i++)
89 if (_2 != -1)
_active[_2] =
true;
90 if (_3 != -1)
_active[_3] =
true;
91 if (_4 != -1)
_active[_4] =
true;
92 if (_5 != -1)
_active[_5] =
true;
93 if (_6 != -1)
_active[_6] =
true;
105 if (_2 != -1)
_active[_2] =
false;
106 if (_3 != -1)
_active[_3] =
false;
107 if (_4 != -1)
_active[_4] =
false;
108 if (_5 != -1)
_active[_5] =
false;
109 if (_6 != -1)
_active[_6] =
false;
123 ComponentBase::Draw();
128 if (!_visible || Culled() || (_blinking && BlinkedOff()))
133 float x,y,z,x1,y1,z1;
138 {{1.0, 0.0, 0.0, -x},
139 {-1.0, 0.0, 0.0, x1},
140 {0.0, -1.0, 0.0, y1},
142 {0.0, 0.0, -1.0, z1},
150 bool pushed = ApplyDynamicRotation();
154 if(!_parentDisplayFrame)
157 _lightMgr->TopFrameInitialize();
160 _lightMgr->SetupComponentLighting();
167 glColor4ubv(_color.RGBA());
174 glGetIntegerv(GL_MAX_CLIP_PLANES,&maxPlanes);
176 for (startPlane = 0; startPlane < maxPlanes; startPlane++)
178 if (!glIsEnabled( GL_CLIP_PLANE0 + startPlane))
186 currPlane = startPlane - 1;
188 for (i = 0; i < 6; i++)
194 glEnable(GL_CLIP_PLANE0 + currPlane);
195 glClipPlane(GL_CLIP_PLANE0 + currPlane,eqn[i]);
196 if (currPlane + 1 >= maxPlanes)
199 fprintf(stderr,
"Warning: Number of glPlanes exceeded in %s: %d\n",__FILE__,maxPlanes);
206 for (
unsigned int j=0; j < _objects.Count(); j++)
210 for (i = startPlane; i <= currPlane; i++)
212 glDisable(GL_CLIP_PLANE0 + i);
217 _lightMgr->CleanupComponentLighting();
219 if(!_parentDisplayFrame)
221 _lightMgr->TopFrameRestore();
ClipViewportBase()
Definition clip_viewport.h:70
virtual void SetViewport(DisplayObject *obj)
Definition clip_viewport.h:113
virtual void Draw()
Definition clip_viewport.h:118
virtual ~ClipViewportBase()
Definition clip_viewport.h:76
bool _active[6]
Definition clip_viewport.h:65
virtual void Deactivate(int _1, int _2=-1, int _3=-1, int _4=-1, int _5=-1, int _6=-1)
Definition clip_viewport.h:96
virtual void DrawInViewport()
Definition clip_viewport.h:126
E_BoxSideEnum
Definition clip_viewport.h:55
@ E_BOTTOM
Definition clip_viewport.h:59
@ E_LEFT
Definition clip_viewport.h:56
@ E_RIGHT
Definition clip_viewport.h:57
@ E_FRONT
Definition clip_viewport.h:60
@ E_BACK
Definition clip_viewport.h:61
@ E_TOP
Definition clip_viewport.h:58
virtual void Activate(int _1, int _2=-1, int _3=-1, int _4=-1, int _5=-1, int _6=-1)
Definition clip_viewport.h:80
DisplayObject * _viewportObject
Definition clip_viewport.h:67
Definition clip_viewport.h:48