/***************************************************************************
vim:tabstop=4
bloc.h - description
-------------------
begin : Sun Jul 1 2001
copyright : (C) 2001 by Francois Biot
email : fbiot@free.fr
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef _bloc_
#define _bloc_
#include "glsolid.h"
#include "rectangle.h"
#include "couleur.h"
extern bool ModeLight;
/** A bloc is defined with one rectangle : the road (top) one
* (the road has a direction)
* Notice that the resource file format does not define bocs
* with their top rectangle, but by many front (mrf) ones !
* See bloc.h in ascii/fixed fond width */
/*
* c/b'_________d/a' _
* |\ \ |\ ^
* | \ :\ \ | ->
* | \ r : \ \ | n
* | \ : \ \ |
* | \ : \ \
* | \ M \ \
* | \ R \ \
* | m r\f T \ \
* | \ \ \
* | \ : \ \
* | M b_:_________\ a \ -->
* | R | : m | dir
* |c'_ _S_ _ |_:d' r |
* \ 1 | \ s |
* \ | 2 |
* \ | |
* \ | \ |
* \ | MRR |
* \ | \ |
* \ | mru |
* \ | \ |
* \ | |
* \|__________\|
*
*
* Rectangles:
* mrs1,mrs2 Side 1 & side2
* mrt top ( same as r used for constructor
* mru under
* mrf front
* mrr rear
*/
class bloc : public glsolid
{
public:
// Constructor for a 0z bloc:
// bloc that begins on the floor.
bloc( const CString &sName,
const rectangle &r,
const couleur &cside,
const rectangle &rbot,
bool bShowFront=false,
bool bShowRear=false,
bool bShowUnder=false,
bool bVisible=true);
// from glsurface
virtual void Translate (const vect &v);
virtual void Render () const;
virtual glsurface* Duplicate () const;
/** Plan side returns
* >0 upside the plan
* = 0 cut or in the plan
* <0 downside the plan */
virtual float PlanSide (const planesurf *face) const;
virtual planesurf* Collision ( const point &ptStart,
const vect &vPath,
point* pptInter,
glsolid* &pSolid);
virtual void SetColor (const couleur& col)
{
mrs1.SetColor(col);
mrt.SetColor(col);
mrs2.SetColor(col);
};
virtual const vect& Normal () const;
/**
* This method return the point that
* is the mass center of the bloc
*/
virtual point GPoint () const;
virtual bool IsInside (const point &) const;
// New methods
const vect Direction() const;
bool IsVisible() const { return !mbVisible; };
private:
bloc(const bloc &cpy)
:
glsolid (cpy.GetName()),
mrs1 (cpy.mrs1),
mrt (cpy.mrt),
mrs2 (cpy.mrs2),
mru (cpy.mru),
mrr (cpy.mrr),
mrf (cpy.mrf),
mbShowFront (cpy.mbShowFront),
mbShowRear (cpy.mbShowRear),
mbShowUnder (cpy.mbShowUnder),
mbVisible (cpy.mbVisible) {};
rectangle mrs1;
rectangle mrt;
rectangle mrs2;
rectangle mru; // rectangle under
rectangle mrr; // rear
rectangle mrf; // front
bool mbShowFront;
bool mbShowRear;
bool mbShowUnder;
bool mbVisible;
};
#endif
| Generated by: saturn on FrancoisLinux on Sun Feb 3 20:01:44 2002, using kdoc 2.0a53. |