GL Studio C++ Runtime API
glpolygon.h
Go to the documentation of this file.
1/*! \file
2 \brief The disti::GLPolygon class. Implements Polygons.
3
4 \par Copyright Information
5
6 Copyright (c) 2017 by The DiSTI Corporation.<br>
7 11301 Corporate Blvd; Suite 100<br>
8 Orlando, Florida 32817<br>
9 USA<br>
10 <br>
11 All rights reserved.<br>
12
13 This Software contains proprietary trade secrets of DiSTI and may not be
14reproduced, in whole or part, in any form, or by any means of electronic,
15mechanical, or otherwise, without the written permission of DiSTI. Said
16permission may be derived through the purchase of applicable DiSTI product
17licenses which detail the distribution rights of this content and any
18Derivative Works based on this or other copyrighted DiSTI Software.
19
20 NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
21AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
22PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
23AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
24IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
25PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
26
27 LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
28IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
29INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
30DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
31INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
32INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
33OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
34EXCEED FIVE DOLLARS (US$5.00).
35
36 The aforementioned terms and restrictions are governed by the laws of the
37State of Florida and the United States of America.
38
39*/
40#ifndef _GLPOLYGON_H
41#define _GLPOLYGON_H
42
43#include "gls_include.h"
44#ifdef GLES
45# include "gls_vertex_array.h"
46#endif
47#include "display.h"
49
50namespace disti
51{
52/**
53 \brief The Polygon class. Implements Polygons
54*/
56{
57private:
58 /** Assignment operator not implemented. Use CloneObject() or the copy constructor instead. */
59 GLPolygon& operator=( const GLPolygon& that ) DISTI_SPECIAL_MEM_FUN_DELETE;
61
62public:
63 DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
64 typedef DisplayObject _BaseClass; ///< Deprecated typedef for the base class.
65 typedef DisplayObject BaseClass; ///< Typedef for the base class.
66 friend class GLPolygonEditor;
67
68 /// \return A new GLPolygon instance.
70
71 /** Creates a polygon with the vertices specified
72 * \param nPoints The number of vertices in the new polygon
73 * \param vertices The array of vertices for the polygon
74 */
75 GLS_EXPORT GLPolygon( unsigned int nPoints, const Vertex* vertices );
76
77 /** Creates a polygon with the vertices specified
78 * \param nPoints The number of vertices in the new polygon
79 * \param vertices The array of vertices for the polygon
80 * \param location The location point of the object
81 */
82 GLS_EXPORT GLPolygon( unsigned int nPoints, const Vertex* vertices, const Vertex& location );
83
84 /** Allocate a (blank) polygon object */
86
87 /** Copy construct a new GLPolygon object
88 * \param polygon The polygon to be cloned
89 * \param generateNames Whether or not to generate a new instance name
90 */
91 GLS_EXPORT GLPolygon( const GLPolygon& polygon, const bool generateNames );
92
93 /** Destroy a polygon object */
95
96 /** Configures MetaData */
98
99 /* Copy+Create operation in one method. In derived classes, this
100 * method will create a new instance of the derived class and then
101 * copy the object into the new instance. The cut,copy,paste and undo
102 * operations use this method.
103 * \param generateNames Whether or not to generate new names for cloned objects
104 * \return A new object, identical to the original, except for the instance name
105 */
106 virtual GLS_EXPORT DisplayObject* CloneObject( bool generateNames = false );
107
108#ifdef GLES
109 virtual GLS_EXPORT void PreDraw( const OpenGLMatrices& current, Culler& culler );
110#endif
111
112 /** Draws this object on the current display frame (_parent member). */
113 virtual GLS_EXPORT void Draw();
114
115 /** Recalculates the texture coordinates for the object based on the TexturePoints.
116 */
118
119 /// Calculates normals based on the vertices and the specified winding order.
120 /// \param windingOrder Multiply calculated normals by -1 if less than 0.
121 virtual GLS_EXPORT void CalcNormals( int windingOrder = 1 );
122
123#ifdef GLES
124 /** Sets the RGBA color for filling the object
125 * \param r The new Red fill color (0-255 range) for the object
126 * \param g The new Green fill color (0-255 range) for the object
127 * \param b The new Blue fill color (0-255 range) for the object
128 * \param a The new Alpha fill color (0-255 range) for the object
129 */
130 virtual GLS_EXPORT void SetFillColor( unsigned char r, unsigned char g, unsigned char b, unsigned char a );
131
132 /** Sets the RGBA color for filling the object
133 * \param color The new RGBA fill color (0-255 range) for the object
134 */
135 virtual GLS_EXPORT void SetFillColor( const GlsColor& color );
136#endif
137
138 /// DeleteVertexAt is overloaded in polygon to prevent having a poly with less than 2 verts. This
139 /// prevents incorrect GL calls when polygon is set to POLY_MODE_FILLED
140 /// \param index The index of the vertex to delete.
141 virtual GLS_EXPORT void DeleteVertexAt( unsigned int index );
142
143 virtual GLS_EXPORT DisplayObject* Pick3D( const Vector& winLoc,
144 const Vector& logicalCoords,
145 float scale,
146 const Vector& directionVector,
147 Vector& collisionWinLoc, /*Returned*/
148 const OpenGLMatrices& parentDrawn );
149
150#ifdef GLES
151protected:
152 void DrawSolidGeometry( bool textureObject, bool color, bool normal );
153 void DrawOutlineGeometry();
154 void DrawPoints();
155 void BakeVBO( bool hasT, bool hasC, bool hasN );
156
157 GlsVertexArray _vertArray;
158 bool _pendingFillColor;
159#endif
160};
161
162} // namespace disti
163
164#endif
Definition: cull.h:50
Definition: display.h:96
virtual void PreDraw(const OpenGLMatrices &current, Culler &culler)
void SetFillColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
Definition: display.h:686
The Polygon class. Implements Polygons.
Definition: glpolygon.h:56
virtual void CalculateTextureCoordinates()
virtual void DeleteVertexAt(unsigned int index)
virtual void CalcNormals(int windingOrder=1)
virtual void Draw()
static DisplayObject * CreateInstance()
virtual DisplayObject * CloneObject(bool generateNames=false)
void ConfigureMetaData()
virtual DisplayObject * Pick3D(const Vector &winLoc, const Vector &logicalCoords, float scale, const Vector &directionVector, Vector &collisionWinLoc, const OpenGLMatrices &parentDrawn)
Definition: gls_color.h:54
Definition: gls_vertex_array.h:60
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:544
Definition: vertex.h:85
Definition: vertex.h:420
The disti::DisplayObject class and global enumerations.
Macros and helper code to determine what subset of C++11/14/17 is available.
#define DISTI_SPECIAL_MEM_FUN_DELETE
Macro to wrap function deletion, removed on compilers that don't support it.
Definition: gls_cpp_lang_support.h:235
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:457
A file for all GL Studio files to include.
#define GLS_EXPORT
Macro denoting which functions should be visible from the runtime library.
Definition: gls_include.h:52
An object for managing vertices, texture coordinates, colors and normals for GLPolygon and other disp...
Force inclusion of the DirectShow library.
Definition: bmpimage.h:47