123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- //===========================================================================//
- // Copyright (C) Microsoft Corporation. All rights reserved. //
- //===========================================================================//
- #pragma once
- #define MLR_MLRCLIPPER_HPP
- #if !defined(MLR_MLR_HPP)
- #include <MLR\MLR.hpp>
- #endif
- #if !defined(MLR_MLRSORTER_HPP)
- #include <MLR\MLRSorter.hpp>
- #endif
- #if !defined(MLR_MLRLIGHT_HPP)
- #include <MLR\MLRLight.hpp>
- #endif
- #if !defined(MLR_MLRSHAPE_HPP)
- #include <MLR\MLRShape.hpp>
- #endif
- #if !defined(MLR_GOSVERTEXPOOL_HPP)
- #include <MLR\GOSVertexPool.hpp>
- #endif
- namespace MidLevelRenderer {
- typedef int AndyDisplay;
- class DrawShapeInformation
- #if defined(_ARMOR)
- : public Stuff::Signature
- #endif
- {
- public:
- DrawShapeInformation();
- MLRShape *shape;
- MLRState state;
- MLRClippingState clippingFlags;
- const Stuff::LinearMatrix4D *shapeToWorld;
- const Stuff::LinearMatrix4D *worldToShape;
- MLRLight *const *activeLights;
- int nrOfActiveLights;
- void
- TestInstance() const
- {}
- };
- class DrawScalableShapeInformation : public DrawShapeInformation
- {
- public:
- DrawScalableShapeInformation();
- const Stuff::Vector3D *scaling;
- const Stuff::RGBAColor *paintMe;
- void
- TestInstance() const
- {}
- };
- class MLREffect;
- class DrawEffectInformation
- #if defined(_ARMOR)
- : public Stuff::Signature
- #endif
- {
- public:
- DrawEffectInformation();
- MLREffect *effect;
- MLRState state;
- MLRClippingState clippingFlags;
- const Stuff::LinearMatrix4D *effectToWorld;
- #if 0 // for the time being no lights on the effects
- MLRLight *const *activeLights;
- int nrOfActiveLights;
- #endif
- void
- TestInstance() const
- {}
- };
- class DrawScreenQuadsInformation
- #if defined(_ARMOR)
- : public Stuff::Signature
- #endif
- {
- public:
- DrawScreenQuadsInformation();
- const Stuff::Vector4D *coords;
- const Stuff::RGBAColor *colors;
- const Vector2DScalar *texCoords;
- const bool *onOrOff;
- int
- nrOfQuads,
- currentNrOfQuads;
- MLRState state;
- void
- TestInstance() const
- {}
- };
- //##########################################################################
- //######################### MLRClipper #################################
- //##########################################################################
- class MLRClipper :
- public Stuff::RegisteredClass
- {
- public:
- static void
- InitializeClass();
- static void
- TerminateClass();
- // Camera gets attached to a film
- MLRClipper(AndyDisplay*, MLRSorter*);
- ~MLRClipper();
- // lets begin the dance
- void StartDraw(
- const Stuff::LinearMatrix4D& camera_to_world,
- const Stuff::Matrix4D& clip_matrix,
- const Stuff::RGBAColor &fog_color, // NOT USED ANYMORE
- const Stuff::RGBAColor *background_color,
- const MLRState &default_state,
- const Stuff::Scalar *z_value
- );
- // add another shape
- void DrawShape (DrawShapeInformation*);
- // add another shape
- void DrawScalableShape (DrawScalableShapeInformation*);
- // add screen quads
- void DrawScreenQuads (DrawScreenQuadsInformation*);
- // add another effect
- void DrawEffect (DrawEffectInformation*);
-
- // starts the action
- void RenderNow ()
- { Check_Object(this); sorter->RenderNow(); }
-
- // clear the film
- void Clear (unsigned int flags);
- AndyDisplay* GetDisplay () const
- { Check_Object(this); return display; };
- // statistics and time
- unsigned int GetFrameRate () const
- { Check_Object(this); return frameRate; }
- void SetTime (Stuff::Scalar t)
- { Check_Object(this); nowTime = t; }
- Stuff::Scalar GetTime () const
- { Check_Object(this); return nowTime; }
- const Stuff::LinearMatrix4D&
- GetCameraToWorldMatrix()
- {Check_Object(this); return cameraToWorldMatrix;}
- const Stuff::LinearMatrix4D&
- GetWorldToCameraMatrix()
- {Check_Object(this); return worldToCameraMatrix;}
- const Stuff::Matrix4D&
- GetCameraToClipMatrix()
- {Check_Object(this); return cameraToClipMatrix;}
- void
- ResetSorter()
- {Check_Object(this); sorter->Reset();}
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // Class Data Support
- //
- public:
- static ClassData
- *DefaultData;
- //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- // Testing
- //
- public:
- void
- TestInstance() const
- {};
- protected:
- // statistics and time
- unsigned int frameRate;
- Stuff::Scalar usedTime;
- Stuff::Scalar nowTime;
- // world-to-camera matrix
- Stuff::LinearMatrix4D
- worldToCameraMatrix;
- Stuff::LinearMatrix4D
- cameraToWorldMatrix;
- Stuff::Matrix4D
- cameraToClipMatrix;
- Stuff::Matrix4D
- worldToClipMatrix;
- Stuff::Point3D
- cameraPosition;
- // this is the film
- AndyDisplay *display;
- // this defines the sort order of the draw
- MLRSorter *sorter;
- GOSVertexPool allVerticesToDraw;
- };
- }
|