40 #ifndef INCLUDED_DISTI_DISPLAY_H
41 #define INCLUDED_DISTI_DISPLAY_H
70 class CallbackMethodCallerBase;
71 class GlsResourceFilter;
72 class DisplayObjectEditor;
76 class GlsGloFileAttribute;
81 GLS_EXPORT
void InitializeLibrary(
const char* unlockString = NULL,
const DisplayFrame* frame = NULL,
bool checkLicense =
false );
86 GLS_EXPORT
const char* LicenseUnlockedBy();
88 typedef DisplayObject* DisplayObjectPtr;
89 typedef DynamicArray<DisplayObjectPtr> DisplayObjectArray;
90 typedef DynamicArray<int> DynamicIntArray;
101 friend class DisplayObjectEditor;
117 GLS_EXPORT
DisplayObject(
const DisplayObject&
object,
const bool generateNames );
133 GLS_ATTRIBUTES_BASIC = 1,
134 GLS_ATTRIBUTES_DYNAMIC = 2,
135 GLS_ATTRIBUTES_APPEARANCE = 4,
136 GLS_ATTRIBUTES_GEOMETRY = 8,
137 GLS_ATTRIBUTES_SPECIALIZED = 16,
138 GLS_ATTRIBUTES_ALL = ~0,
139 GLS_ATTRIBUTES_NONE = 0
154 virtual GLS_EXPORT
void AlphaMode(
int mode );
160 virtual GLS_EXPORT
int AlphaMode(
void );
165 virtual GLS_EXPORT
bool AntiAlias(
void );
170 virtual GLS_EXPORT
void AntiAlias(
bool alias );
186 virtual GLS_EXPORT
void SetBlendColor(
const GlsColor& color );
201 GLS_EXPORT
void GetBlendColor(
unsigned char& r,
unsigned char& g,
unsigned char& b,
unsigned char& a );
221 GLS_EXPORT
void SetBlendColor(
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a );
229 virtual GLS_EXPORT
bool Blinking(
void );
234 virtual GLS_EXPORT
void Blinking(
const bool blink );
239 virtual GLS_EXPORT
float BlinkRate(
void );
244 virtual GLS_EXPORT
void BlinkRate(
const float rate );
288 virtual GLS_EXPORT
void Calculate(
double time );
334 virtual DisplayObject*
CloneObject(
bool generateNames =
false ) = 0;
345 GLS_EXPORT
void GetColor(
unsigned char c4[] );
354 GLS_EXPORT
void GetColor(
unsigned char& r,
unsigned char& g,
unsigned char& b,
unsigned char& a );
379 virtual GLS_EXPORT
void CopyGeometry( DisplayObject* src );
420 inline bool Culled()
const {
return _culled; }
421 inline void Culled(
bool val ) { _culled = val; }
465 void GLS_EXPORT
DcsMatrix(
const GlsMatrixType& matrix );
478 virtual GLS_EXPORT
void DeleteVertex(
unsigned int indexAfter ) DISTI_FINAL
489 virtual GLS_EXPORT
int DepthTest(
void );
494 virtual GLS_EXPORT
void DepthTest(
unsigned char zbuf );
498 virtual void Draw(
void ) = 0;
532 virtual GLS_EXPORT
void DynamicRotate(
float x,
float y,
float z );
545 virtual GLS_EXPORT
float DynamicRotation(
int axis );
546 virtual GLS_EXPORT
Vector DynamicRotation();
559 virtual GLS_EXPORT
void DynamicScale(
float x,
float y,
float z );
575 virtual GLS_EXPORT
void DynamicTranslate(
float x,
float y,
float z,
bool relative =
false );
596 virtual GLS_EXPORT
void DynamicTranslateAxis(
float amount,
int axis,
bool relative );
598 virtual GLS_EXPORT
void DynamicTranslate(
float amount,
int axis,
bool relative =
false );
615 GLS_EXPORT DisplayObjectEditor*
Editor();
621 GLS_EXPORT
const DisplayObjectEditor*
Editor()
const;
627 GLS_EXPORT
void Editor( DisplayObjectEditor* editor );
639 virtual GLS_EXPORT
void GetExtents(
float& x,
float& y,
float& z,
float& x1,
float& y1,
float& z1 );
654 GLS_EXPORT
void GetFillColor(
unsigned char& r,
unsigned char& g,
655 unsigned char& b,
unsigned char& a );
720 virtual GLS_EXPORT
bool Hit(
float x,
float y,
float z,
float scale,
const Vector& directionVector,
Vector* collisionPoint );
741 virtual GLS_EXPORT
bool HitUtil(
float x,
float y,
float z,
float scale,
Vertex* vertices,
unsigned int vertex_cnt,
const Vector& directionVector,
Vector* collisionPoint );
758 virtual GLS_EXPORT
void InsertVertex(
unsigned int indexAfter ) DISTI_FINAL
804 virtual GLS_EXPORT
float LineWidth(
void );
809 virtual GLS_EXPORT
void LineWidth(
float width );
826 virtual GLS_EXPORT
void Location(
float x,
float y,
float z );
838 virtual GLS_EXPORT
void GetLocation(
float& x,
float& y,
float& z );
885 virtual GLS_EXPORT
void SetNormals(
unsigned int nPoints,
Vector* vertices );
891 GLS_EXPORT
void VaSetNormals(
unsigned int nPoints, ... );
962 virtual GLS_EXPORT DisplayObject*
Pick3D(
const Vector& winLoc,
963 const Vector& logicalCoords,
965 const Vector& directionVector,
973 inline unsigned char Pickable() {
return _pickable; }
979 virtual GLS_EXPORT
void Pickable(
unsigned char pick );
985 virtual GLS_EXPORT
int PolygonOffset(
void )
const;
991 virtual GLS_EXPORT
void PolygonOffset(
const int offset );
1003 virtual GLS_EXPORT
void PolygonEnd(
const int end );
1036 virtual GLS_EXPORT
void ReallocateVertices(
unsigned int numVertices,
bool initializeNew,
bool copyOld );
1044 virtual GLS_EXPORT
float RelativeAngle(
const float x,
const float y );
1106 virtual GLS_EXPORT
void RotationPoint(
float x,
float y,
float z );
1119 virtual GLS_EXPORT
void Rotate(
float angle,
int axis =
Z_AXIS );
1127 virtual GLS_EXPORT
void Rotate(
const Vector& origin,
float angle,
int axis =
Z_AXIS );
1135 virtual GLS_EXPORT
void Rotate(
const Vector& orig,
float angle,
const Vector& axis );
1152 virtual GLS_EXPORT
void Scale(
float px,
float py,
float pz,
Vertex* anchor,
int handleBar = 0 );
1159 GLS_EXPORT
void Set(
int spec, ... );
1188 #if !defined( GLES )
1207 virtual GLS_EXPORT
int Shading(
void );
1213 virtual GLS_EXPORT
void Shading(
const int shading );
1232 virtual GLS_EXPORT
void SetTexCoords(
unsigned int nPoints,
Vector* new_tex_coord,
bool isVectorArray =
true );
1281 virtual GLS_EXPORT
void TextureIndex(
int textureIndex );
1345 virtual GLS_EXPORT
void Translate(
float tr[] );
1352 virtual GLS_EXPORT
void Translate(
float x,
float y,
float z );
1385 virtual GLS_EXPORT
void SetVertexColor(
unsigned int vertex,
unsigned char CurrentFillColor[] );
1417 virtual GLS_EXPORT
void VaListSetVertices(
unsigned int nPoints, va_list args );
1424 virtual GLS_EXPORT
void VaListSetNormals(
unsigned int nPoints, va_list args );
1450 virtual GLS_EXPORT
void Visibility(
const bool vis );
1494 Vector* directionVector = NULL,
1508 const Vector* directionVector,
1530 GLS_EXPORT
void GeometryRefresh();
1535 bool _geometryRefresh;
1537 GLS_EXPORT
void ApplyTextureMinMagSettings();
1538 GLS_EXPORT
void ApplyTextureEnvModeSettings();
1539 GLS_EXPORT
bool SetupTextureIsNeeded();
1567 bool _needCalcDrawMatrix;
1631 virtual GLS_EXPORT
int ColorMaterialMode(
void );
1678 inline void LastDrawMatrixLocation(
const Vertex& loc ) { _lastDrawMatrixLocation = loc; }
1681 inline const Vertex& LastDrawMatrixLocation() {
return _lastDrawMatrixLocation; }
1694 GLS_EXPORT
void PickSetup(
float x,
float y,
float z,
Vertex* vertices,
unsigned int vertex_cnt,
const Vector& directionVector );
1747 GLS_EXPORT
virtual bool IsVisibleInScene(
const DisplayObject* obj = NULL )
const;
1754 GLS_EXPORT
virtual void SetValue(
int spec, va_list& args );
1757 void CopyGeometryInternal(
const DisplayObject* src );
1758 void CopyPropertiesInternal(
const DisplayObject* src );
1759 void CopyHierarchyPropertiesInternal(
const DisplayObject* src,
bool copyName );
1763 Vector _boundingVolumeCenter;
1765 float _boundingVolumeRadius;
1772 float _dynamicTranslate[ 3 ];
1777 float _dynamicScale[ 3 ];
1781 char* _instanceName;
1785 Vertex _lastDrawMatrixLocation;
1787 bool _lightingEnabled;
1789 bool _needCalculate;
1795 Group* _parentGroup;
1799 unsigned char _pickable;
1801 float _rotation[ 3 ];
1813 GLS_EXPORT
void DisplayColorMaterialModeError(
const int mode );
1814 GLS_EXPORT
int DisplayColorMaterialModeError();
1816 void CommonConstructorInit(
float x,
float y,
float z );
1819 void OnDCSMatrixChanged();
1822 void OnVerticesChanged();
1825 void OnTextureCoordsChanged();
1828 DisplayObject& operator=(
const DisplayObject& that );
GlsMatrixType * _drawMatrix
Definition: display.h:1562
float Y(void) const
Definition: display.h:844
GlsColor _textureBlendColor
Definition: display.h:1601
bool InsideVertexExtents(float x, float y, unsigned int nVerts, Vertex *verts, float tolerance)
Definition: display_frame.h:85
void RestoreLighting(void)
virtual void CalculateMatrices(const OpenGLMatrices &newMatrices)
void * UserData(void) const
Definition: display.h:1374
void SetColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Definition: display.h:374
void SetTexCoords(unsigned int nPoints, Vertex *new_tex_coord)
Definition: display.h:1238
bool GetTexturePointTransformationMatrix(GlsMatrixType &world2tex)
Vector * _normals
Definition: display.h:1581
virtual const Vertex & Location(void) const
DistiAttribDict & Attributes()
Definition: display.h:180
virtual void CopyGeometry(DisplayObject *src)
virtual void UpdateBoundingVolume(void)
CallbackMethodCallerBase * CallbackCaller() const
Definition: display.h:311
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:436
virtual void Calculate(double time)
virtual float BlinkRate(void)
virtual void SetVertices(unsigned int nPoints, Vertex *vertices)
void VaSetTexCoords(unsigned int nPoints,...)
void SetupPolyDrawStyle(void)
virtual void SetVertexColor(unsigned int vertex, unsigned char CurrentFillColor[])
Vertex _location
Definition: display.h:1575
GlsMatrixType & DcsMatrix()
Definition: display.h:459
virtual void CalculateParentBoundingBox(void)
void SetFillColor(unsigned char c4[])
Definition: display.h:681
Definition: gls_state_manager_es20_interface.h:65
virtual void SetBlendColor(const GlsColor &color)
virtual void GetRotationPoint(Vertex &v)
Definition: dynamic_array.h:66
bool BoundingVolumeHit(const Vector &start, const Vector &direction)
The disti::DynamicArray class. A templated array of objects capable of dynamically growing...
GlsMatrixType * ModelMatrix()
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:473
bool SetupLineStyle(void)
void CalculateCollisionPoint(const Vector &pickLoc, const Vector &directionVector, Vector *collisionPoint)
Defines a base class which editor objects can derive.
virtual int TextureMagnificationFilter(void)
void NotifyAttributeChanged(const AttributeName &name) override
float MagnitudeSquared() const
Definition: vertex.h:335
virtual Vertex WorldVertex(unsigned int i)
virtual void PreDraw(const OpenGLMatrices ¤t, Culler &culler)
virtual float LineWidth(void)
virtual bool IsVisibleInScene(const DisplayObject *obj=NULL) const
void ApplyTextureSettings(int textureIndex=-1)
virtual int AlphaMode(void)
virtual void CalculateTextureCoordinates(void)
int GetApplicableTextureIndex()
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array)
The GlsMatrixAffine class.
unsigned char _lineStippleMultiplier
Definition: display.h:1569
virtual void CopyProperties(DisplayObject *src)
unsigned short _lineStipplePattern
Definition: display.h:1571
bool _visible
Definition: display.h:1629
DisplayFrame * Parent(void) const
Definition: display.h:932
virtual void VaListSetTexCoords(unsigned int nPoints, va_list args)
unsigned char _textureMagFilter
Definition: display.h:1607
virtual void SetValue(int spec, va_list &args)
unsigned char _textureMinFilter
Definition: display.h:1609
bool Visible(void) const
Definition: display.h:1440
virtual void SetTexCoords(unsigned int nPoints, Vector *new_tex_coord, bool isVectorArray=true)
bool Visibility(void) const
Definition: display.h:1445
virtual void GetResources(std::ostream &outstr, GlsResourceFilter *filter=NULL)
virtual void CopyHierarchyProperties(DisplayObject *src, bool copyName)
Definition: gls_state_manager_interface.h:67
Vector * Normals()
Definition: display.h:879
virtual void InsertVertexAt(unsigned int index)
virtual int MaterialIndex()
bool ApplyDynamicRotation(void)
bool CullTest(const GlsMatrixType *matrix, const Culler &culler)
Definition: display.h:427
virtual float ObjectHeight(void)
static void SetManualBlinkElapsedTime(double elapsedTime)
float _lineWidth
Definition: display.h:1573
DisplayObject(float x, float y, float z)
virtual bool HitUtil(float x, float y, float z, float scale, Vertex *vertices, unsigned int vertex_cnt, const Vector &directionVector, Vector *collisionPoint)
float Z(void) const
Definition: display.h:847
weak reference and related classes
The disti::GlsStateManager factory class. Creates an instance of a state manager that manages the GL ...
virtual DisplayObject * Pick3D(const Vector &winLoc, const Vector &logicalCoords, float scale, const Vector &directionVector, Vector &collisionWinLoc, const OpenGLMatrices &drawnMatrices)
bool SphereOutsideFrustum(const Vector ¢er, const float radius) const
Definition: cull.h:96
virtual void VaListSetNormals(unsigned int nPoints, va_list args)
static void UseManualBlinkElapsedTime(bool useManualTime)
Vector _texturePoints[4]
Definition: display.h:1613
GlsMatrixType * _projMatrix
Definition: display.h:1594
const Vector & BoundingVolumeCenter() const
Definition: display.h:259
Definition: gls_glo_file.h:988
void SetupDepthTest(void)
void SetColor(unsigned char c4[])
Definition: display.h:365
virtual Vector WorldRotationPoint(void)
virtual void Translate(float tr[])
unsigned char _polygonMode
Definition: display.h:1590
float _blinkRate
Definition: display.h:1551
void DynamicRotate(float angle, int axis)
virtual void ReallocateVertices(unsigned int numVertices, bool initializeNew, bool copyOld)
Definition: gls_glo_file.h:81
Vector * _texCoord
Definition: display.h:1598
Definition: gls_painter.h:51
void DCSToLogical(Vector dcsPoint, Vector &logicalPoint, const GlsMatrixType *dcsMatrix=NULL)
void LogicalToDCS(Vector logicalPoint, Vector &objectLocal, const Vector *directionVector, const Vector &planeNormal=Vector(0, 0, 1), const Vector &planePoint=Vector(), const GlsMatrixType *dcsMatrix=NULL)
virtual int Shading(void)
virtual Vector DynamicScale()
unsigned int _nTex_vertices
Definition: display.h:1584
bool _blinking
Definition: display.h:1549
virtual ~DisplayObject(void)
void Transform(Vector &v) const
Definition: gls_matrix_affine.h:271
virtual void FinishObject()
Definition: display.h:695
VertexNoColor Vector
Definition: gls_font_base.h:66
virtual GlsColor GetFillColor(void)
GlsMatrixType * _modelMatrix
Definition: display.h:1579
virtual Vertex * Vertices()
Definition: display.h:1392
virtual float ObjectDepth(void)
const GlsMatrixType * DrawMatrix()
Definition: display.h:503
GlsMatrixType * ProjMatrix()
bool NeedCalcDrawMatrix()
Definition: display.h:507
virtual int TextureIndex(void)
GL Studio Enumerations and constants.
bool _attributesAdded
Definition: display.h:1547
float X(void) const
Definition: display.h:841
virtual void SetNormals(unsigned int nPoints, Vector *vertices)
virtual DistiAttributeBase & Resource(const char *name)
The disti::Vertex class. A class for manipulating 3D vertices.
virtual void SetOrigin(const Vertex &vert)
virtual Vector * GetTexturePoints(void)
Generally useful defines, macros, enumerations and function prototypes.
virtual void DynamicRotateRelative(float angle, int axis)
virtual int TextureMappingTechnique(void)
virtual bool Hit(float x, float y, float z, float scale, const Vector &directionVector, Vector *collisionPoint)
virtual DynamicArray< int > & MaterialIndices()
void UserData(void *data)
Definition: display.h:1379
unsigned char _shading
Definition: display.h:1596
void Y(const float y)
Definition: display.h:853
unsigned char _textureRepeat
Definition: display.h:1619
int _polygonOffset
Definition: display.h:1592
void PickSetup(float x, float y, float z, Vertex *vertices, unsigned int vertex_cnt, const Vector &directionVector)
bool Culled() const
Definition: display.h:420
void X(const float x)
Definition: display.h:850
Definition: disti_metadata.h:186
void CalcDrawMatrixIfExists()
Definition: display.h:1654
virtual bool CullBackFace(void)
GlsColor _color
Definition: display.h:1553
int _textureIndex
Definition: display.h:1603
Vector * GetTextureCoordinates(void)
Definition: display.h:1270
Definition: gls_color.h:53
void Z(const float z)
Definition: display.h:856
virtual void Rotate(float angle, int axis=Z_AXIS)
char * InstanceName(void)
virtual void GetTransformedExtents(Vector &min, Vector &max, const GlsMatrixType &matrix, bool resetMinMax=true)
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL)
unsigned char _textureMap
Definition: display.h:1611
Definition: disti_metadata.h:668
Definition: weak_referenceable_mixin.h:52
#define MAX(A, B)
Definition: util.h:170
unsigned int _nVertices
Definition: display.h:1586
virtual void GetCenter(Vector ¢er)
void VaSetNormals(unsigned int nPoints,...)
Vector * TextureCoordinates(void)
Definition: display.h:1263
Definition: callback_caller_base.h:55
virtual int DepthTest(void)
virtual DisplayObject * CloneObject(bool generateNames=false)=0
virtual void SetPainter(GlsPainter *painter)
void VaSetVertices(unsigned int nPoints,...)
unsigned char _depthTest
Definition: display.h:1560
virtual float RelativeAngle(const float x, const float y)
The disti::Culler class. Implements view frustum culling.
virtual void Scale(float px, float py, float pz, Vertex *anchor, int handleBar=0)
virtual void GenerateInstanceName(void)
bool LogicalToWindow(const Vector &logical, Vector &winLoc, const OpenGLMatrices &alternateMatrices=OpenGLMatrices())
Definition: disti_metadata.h:458
unsigned char Pickable()
Definition: display.h:973
virtual bool AntiAlias(void)
virtual void SetColor(const GlsColor &color)
unsigned char _polygonEnd
Definition: display.h:1588
GlsMatrixType _dcsMatrix
Definition: display.h:1557
virtual void GetLocation(Vertex &v)
void PickCleanup(Vertex *vertices, unsigned int vertex_cnt)
virtual GlsColor GetColor()
virtual void TranslateVertices(float x, float y, float z)
virtual void Draw(void)=0
int _alphaMode
Definition: display.h:1543
virtual Vector DynamicTranslation()
void NeedCalculate(bool val)
Definition: display.h:1684
virtual void DeleteVertexAt(unsigned int index)
const Vertex & RotationPoint() const
Definition: display.h:1090
virtual bool Blinking(void)
The GlsPainter interface.
Vertex * _vertices
Definition: display.h:1623
void AllocateModelMatrix()
bool NeedCalculate()
Definition: display.h:874
virtual GlsPainter * GetPainter()
virtual bool LightingEnabled()
void * _userData
Definition: display.h:1621
virtual void SetAvailableAttributes(unsigned int value)
Definition: gls_resources.h:50
bool _antiAlias
Definition: display.h:1545
unsigned int NumberOfVertices() const
Definition: display.h:896
virtual bool TextureRepeat(void)
float BoundingVolumeRadius() const
Definition: display.h:276
bool WindowToLogical(const Vector &winLoc, Vector &logical, Vector *directionVector=NULL, const OpenGLMatrices &alternateMatrices=OpenGLMatrices())
bool SetupAntiAlias(void)
AvailableAttributesEnum
Definition: display.h:131
void GetExtentsDCS(Vector &min, Vector &max)
virtual void DeleteVertex(unsigned int indexAfter) final
Definition: display.h:478
virtual void InsertVertex(unsigned int indexAfter) final
Definition: display.h:758
Definition: disti_metadata.h:85
virtual bool GetPlaneVectorPoints(Vertex &p1, Vertex &p2, Vertex &p3, Vertex &planeVector)
int GetApplicableTextureRepeat()
void RestoreLineStyle(void)
Definition: bmpimage.h:46
virtual int LineStippleMultiplier(void)
virtual void GetExtents(float &x, float &y, float &z, float &x1, float &y1, float &z1)
virtual int PolygonMode(void)
virtual void VaListSetVertices(unsigned int nPoints, va_list args)
virtual int TextureMinificationFilter(void)
DisplayObjectEditor * Editor()
void SetFillColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Definition: display.h:675
virtual int PolygonEnd(void)
virtual GlsColor GetBlendColor()
virtual int LineStipplePattern(void)
bool _cullBackFace
Definition: display.h:1555
virtual void CalcDrawMatrix()
void RestoreAntiAlias(void)
Group * ParentGroup(void) const
Definition: display.h:942
virtual float ObjectWidth(void)
int * _viewMatrix
Definition: display.h:1627
virtual DisplayObject * handle(DisplayEvent *ev)
virtual void DynamicTranslate(float x, float y, float z, bool relative=false)
Definition: editor_object_base.h:48