GL Studio API
gls_schematic_poly_line_interconnect.h
Go to the documentation of this file.
1 #ifndef _GLSSCHEMATICPOLYLINEINTERCONNECT_H
2 #define _GLSSCHEMATICPOLYLINEINTERCONNECT_H
3 /*! \file
4  \brief The disti::GlsSchematicPolyLineInterconnect class.
5 
6  \par Copyright Information
7 
8  Copyright (c) 2015 by The DiSTI Corporation.<br>
9  11301 Corporate Blvd; Suite 100<br>
10  Orlando, Florida 32817<br>
11  USA<br>
12  <br>
13  All rights reserved.<br>
14 
15  This Software contains proprietary trade secrets of DiSTI and may not be
16 reproduced, in whole or part, in any form, or by any means of electronic,
17 mechanical, or otherwise, without the written permission of DiSTI. Said
18 permission may be derived through the purchase of applicable DiSTI product
19 licenses which detail the distribution rights of this content and any
20 Derivative Works based on this or other copyrighted DiSTI Software.
21 
22  NO WARRANTY. THE SOFTWARE IS PROVIDED "AS-IS," WITHOUT WARRANTY OF ANY KIND,
23 AND ANY USE OF THIS SOFTWARE PRODUCT IS AT YOUR OWN RISK. TO THE MAXIMUM EXTENT
24 PERMITTED BY APPLICABLE LAW, DISTI AND ITS SUPPLIERS DISCLAIM ALL WARRANTIES
25 AND CONDITIONS, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
26 IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY AND/OR FITNESS FOR A
27 PARTICULAR PURPOSE, TITLE, AND NON-INFRINGEMENT, WITH REGARD TO THE SOFTWARE.
28 
29  LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW,
30 IN NO EVENT SHALL DISTI OR ITS SUPPLIERS BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
31 INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER (INCLUDING, WITHOUT LIMITATION,
32 DAMAGES FOR LOSS OF BUSINESS PROFITS, BUSINESS INTERRUPTION, LOSS OF BUSINESS
33 INFORMATION, OR ANY OTHER PECUNIARY LOSS) ARISING OUT OF THE USE OF OR
34 INABILITY TO USE THE SOFTWARE, EVEN IF DISTI HAS BEEN ADVISED OF THE POSSIBILITY
35 OF SUCH DAMAGES. DISTI'S ENTIRE LIABILITY AND YOUR EXCLUSIVE REMEDY SHALL NOT
36 EXCEED FIVE DOLLARS (US$5.00).
37 
38  The aforementioned terms and restrictions are governed by the laws of the
39 State of Florida and the United States of America.
40 */
41 
42 #include "glpolygon.h"
43 #include "gls_cpp_lang_support.h"
44 
45 #ifdef GLES
46 #include "gls_triangle_storage.h"
47 #else
48 #include "gls_display_list.h"
49 #endif
50 
51 //////////////////// Provides support for creating DLLs ////////////////////////
52 #if (defined(GLSGEN_EXPORT_GLSSCHEMATICPOLYLINEINTERCONNECT) || \
53  defined(GLSGEN_IMPORT_GLSSCHEMATICPOLYLINEINTERCONNECT) || \
54  defined(GLS_EXPORT_GENERATED) || \
55  defined(GLS_IMPORT_GENERATED)) \
56  && defined(_MSC_VER)
57 # if defined(GLSGEN_EXPORT_GLSSCHEMATICPOLYLINEINTERCONNECT) || defined(GLS_EXPORT_GENERATED)
58 # define GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT __declspec(dllexport)
59 # else
60 # define GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT __declspec(dllimport)
61 # endif
62 #else
63 # define GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT
64 #endif
65 ///////////////////////////////////////////////////////////////////////////////
66 
67 #define LIB_BASE_NAME "gls_schematic_poly_line_interconnect"
68 #include "gls_auto_lib.h"
69 #undef LIB_BASE_NAME
70 
71 namespace disti
72 {
73 
74 // SetValue enumerations
75 enum {
76  GLS_SCHEMATICPOLYLINEINTERCONNECT_FIRST_VALUE = GLS_LAST_INITIALIZER+1,
77  GLS_SCHEMATICPOLYLINEINTERCONNECT_ORIENTATION,
78  GLS_SCHEMATICPOLYLINEINTERCONNECT_LINE_THICKNESS,
79  GLS_SCHEMATICPOLYLINEINTERCONNECT_ROUNDED_CORNERS,
80  GLS_SCHEMATICPOLYLINEINTERCONNECT_CORNER_RADIUS,
81  GLS_SCHEMATICPOLYLINEINTERCONNECT_FORCE_EXACT_CORNER_RADIUS,
82  GLS_SCHEMATICPOLYLINEINTERCONNECT_CORNER_SEGMENTS,
83  GLS_SCHEMATICPOLYLINEINTERCONNECT_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
84  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_TEXTURE_INDEX,
85  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_TEXTURE_REPEAT_LENGTH,
86  GLS_SCHEMATICPOLYLINEINTERCONNECT_SHOW_FLOW,
87  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_RATE,
88  GLS_SCHEMATICPOLYLINEINTERCONNECT_SHOW_FLOW_BLINK,
89  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_RATE,
90  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_START_COLOR,
91  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_END_COLOR,
92  GLS_SCHEMATICPOLYLINEINTERCONNECT_USE_DISPLAY_LIST,
93  GLS_SCHEMATICPOLYLINEINTERCONNECT_LAST_VALUE = GLS_SCHEMATICPOLYLINEINTERCONNECT_USE_DISPLAY_LIST
94  };
95 
96 #ifdef GLES
97 class GlsGloFileAttribute;
98 #endif
99 
100 /** Runtime implementation of a GlsSchematicPolyLineInterconnect */
102 {
103 private:
104  GlsSchematicPolyLineInterconnect& operator=( const GlsSchematicPolyLineInterconnect& ) DISTI_SPECIAL_MEM_FUN_DELETE;
105  GlsSchematicPolyLineInterconnect( const GlsSchematicPolyLineInterconnect& ) DISTI_SPECIAL_MEM_FUN_DELETE;
106 
107 public:
108  typedef GLPolygon _BaseClass;
109  friend class GlsSchematicPolyLineInterconnectEditor;
110 
111  /** Create a new GlsSchematicPolyLineInterconnect.
112  * for this inputdevice */
113  GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GlsSchematicPolyLineInterconnect( void );
114  GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GlsSchematicPolyLineInterconnect( const GlsSchematicPolyLineInterconnect& that, const bool generateNames );
115 
116  /** Destructs a GlsSchematicPolyLineInterconnect object */
117  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT ~GlsSchematicPolyLineInterconnect();
118 
119  static GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT DisplayObject* CreateInstance();
120 
121  //////////////////////////////////////////////////
122  // Overridden base class methods
123  //////////////////////////////////////////////////
124 
125  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void SetAvailableAttributes(unsigned int value);
126  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT DisplayObject* CloneObject(bool generateNames = false);
127  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void CopyGeometry(DisplayObject *src);
128  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void CopyProperties(DisplayObject *src);
129 
130 #ifndef GLES
131  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT InterfaceListType* GetCppInterfaceDescription(InterfaceListType* addToThisList= NULL );
132  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void GetCppInterfaceDescriptionFree(InterfaceListType* array);
133 #endif
134 
135  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Calculate(double time);
136  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices,Culler &culler );
137  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Draw(void);
138 
139  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void CalculateTextureCoordinates(void);
140 
141  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT DisplayObject* handle(DisplayEvent *ev);
142 
143  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void SetValue(int spec,va_list &args);
144 
145  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Scale(float px, float py, float pz, Vertex *anchor, int handleBar = 0);
146 
147  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void GetExtents(float &x,float &y,float &z,float &x1,float &y1,float &z1);
148 
149  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT bool Hit(float x,float y,float z,float scale, const Vector& directionVector,Vector* collisionPoint);
150 
151  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Rotate(const Vector &orig,float angle,const Vector &axis);
152 
153  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT Vertex WorldVertex(unsigned int i);
154 
155  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void SetVertices(unsigned int nPoints,Vertex *vertices);
156 
157  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void DeleteVertex(unsigned int index);
158  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void InsertVertex(unsigned int index);
159 
160  //////////////////////////////////////////////////
161  // GlsSchematicPolyLineInterconnect specific operations
162  //////////////////////////////////////////////////
163 
164  /** set the i and j orientation vectors that orient the 2-D schematic in 3 space
165  * \param iVector new iVector
166  * \param jVector new jVector
167  * \pre i and j should be orhogonal
168  */
169  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetOrientationVectors( const Vector &iVector, const Vector &jVector );
170 
171  /** get the i and j orientation vectors that orient the 2-D schematic in 3 space
172  * \param iVector [out] iVector
173  * \param jVector [out] jVector
174  */
175  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetOrientationVectors( Vector &iVector /*out*/, Vector &jVector /*out*/);
176 
177  /** set the line thickness in logical units
178  * \param lineThickness new line thickness in logical units
179  * \pre lineThickness > 0.0f
180  */
181  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetLineThickness( const float lineThickness );
182 
183  /** get the line thickness in logical units
184  * \return the line thickness in logical units
185  */
186  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetLineThickness( void );
187 
188  /** set rounded corners
189  * \param roundedCorners true for rounded corners
190  */
191  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetRoundedCorners( const bool roundedCorners );
192 
193  /** get rounded corners
194  * \return rounded corners
195  */
196  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetRoundedCorners( void );
197 
198  /** set the corner radius in logical units
199  * \param cornerRadius new corner radisu in logical units
200  * \pre cornerRadius > 0.0f
201  */
202  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetCornerRadius( const float cornerRadius );
203 
204  /** get the corner radius in logical units
205  * \return the corner radius in logical units
206  */
207  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetCornerRadius( void );
208 
209  /** set force exact corner radius
210  * \param forceExactCornerRadius true to force rounded corners to use the exact corner radius
211  * specified by SetCornerRadius(). If true, a corner that cannot be made
212  * with this radius will not be rounded.
213  */
214  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetForceExactCornerRadius( const bool forceExactCornerRadius );
215 
216  /** get force exact corner radius state
217  * \return force exact corner radius state
218  */
219  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetForceExactCornerRadius( void );
220 
221  /** set the number of segments used in rounded corners
222  * \param cornerSegments number of segments to use in rounded corners
223  * \pre 2 <= cornerSegments <= 100
224  */
225  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetCornerSegments( const unsigned int cornerSegments );
226 
227  /** get the number of segments used in rounded corners
228  * \return the number of segments used in rounded corners
229  */
230  virtual unsigned int GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetCornerSegments( void );
231 
232  /** set the interconnect texture index
233  * \param interconnectTextureIndex new interconnect texture index else NO_TEXTURE if no interconnect texture
234  */
235  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetInterconnectTextureIndex( const int interconnectTextureIndex );
236 
237  /** get the interconnect texture index else NO_TEXTURE if no interconnect texture
238  * \return the interconnect texture index else NO_TEXTURE if no interconnect texture
239  */
240  virtual int GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetInterconnectTextureIndex( void );
241 
242  /** set the number of logical units per interconnect texture repeat ( >0.0 )
243  * NOTE: number of actual repeats for the whole interconnect is always rounded
244  * to the nearest whole number so that adjacent interconnect's textures lineup
245  * \param interconnectTextureRepeatLength new interconnect texture repeat length
246  * \pre interconnectTextureRepeatLength > 0.0f
247  */
248  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetInterconnectTextureRepeatLength( const float interconnectTextureRepeatLength );
249 
250  /** get the number of logical units per interconnect texture repeat ( >0.0 )
251  * \return the number of logical units per interconnect texture repeat ( >0.0 )
252  */
253  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetInterconnectTextureRepeatLength( void );
254 
255  /** set the flow texture index
256  * \param flowTextureIndex new flow texture index else NO_TEXTURE if no flow texture
257  */
258  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowTextureIndex( const int flowTextureIndex );
259 
260  /** get the flow texture index else NO_TEXTURE if no flow texture
261  * \return the flow texture index else NO_TEXTURE if no flow texture
262  */
263  virtual int GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowTextureIndex( void );
264 
265  /** set the number of logical units per flow texture repeat ( >0.0 )
266  * NOTE: number of actual repeats for the whole interconnect is always rounded
267  * to the nearest whole number so that adjacent interconnect's textures lineup
268  * \param flowTextureRepeatLength new flow texture repeat length
269  * \pre flowTextureRepeatLength > 0.0f
270  */
271  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowTextureRepeatLength( const float flowTextureRepeatLength );
272 
273  /** get the number of logical units per flow texture repeat ( >0.0 )
274  * \return the number of logical units per flow texture repeat ( >0.0 )
275  */
276  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowTextureRepeatLength( void );
277 
278  /** set whether or not the flow is displayed
279  * \param showFlow true to show flow else false
280  */
281  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetShowFlow( const bool showFlow );
282 
283  /** get whether or not the flow is displayed
284  * \return true if flow is show else false
285  */
286  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetShowFlow( void );
287 
288  /** set the flow rate in "flow textures" / second
289  * \param flowRate flow rate in "flow textures" / second
290  */
291  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowRate( const float flowRate );
292 
293  /** get the flow rate in "flow textures" / second
294  * \return the flow rate in "flow textures" / second
295  */
296  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowRate( void );
297 
298  /** set whether or not the flow blink is displayed (NOTE: normal flow is not drawn if flow blink is true)
299  * \param showFlowBlink true to show flow blink else false
300  */
301  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetShowFlowBlink( const bool showFlowBlink );
302 
303  /** get whether or not the flow blink is displayed (NOTE: normal flow is not drawn if flow blink is true)
304  * \return true if flow blink is shown else false
305  */
306  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetShowFlowBlink( void );
307 
308  /** set the flow blink rate in hz
309  * \param flowBlinkRate flow blink rate in hz
310  */
311  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowBlinkRate( const float flowBlinkRate );
312 
313  /** get the flow blink rate in hz
314  * \return the flow blink rate in hz
315  */
316  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowBlinkRate( void );
317 
318  /** set the flow blink start color
319  * \param startColor flow blink start color
320  */
321  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowBlinkStartColor( const glsColor &startColor );
322 
323  /** get the flow blink start color
324  * \return the flow blink start color
325  */
326  virtual glsColor GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowBlinkStartColor( void );
327 
328  /** set the flow blink end color
329  * \param endColor flow blink end color
330  */
331  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowBlinkEndColor( const glsColor &endColor );
332 
333  /** get the flow blink end color
334  * \return the flow blink end color
335  */
336  virtual glsColor GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowBlinkEndColor( void );
337 
338 #ifndef GLES
339  /** enable/disable using display list for drawing
340  * \param useDisplayList true to use display list
341  */
342  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetUseDisplayList( const bool useDisplayList );
343 
344  /** get use display list
345  * \return true if using display list for drawing
346  */
347  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetUseDisplayList( void );
348 #endif
349 
350  /** set the last segment chamfer distance (NOTE: not controllable in editor, usually used by the GlsSchematicTeeInterconnect plugin at runtime)
351  * \param endingChamferDistance distance from end of last line segment to start chamfer ( 0.0f to disable )
352  * \pre endingChamferDistance >= 0.0f
353  */
354  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetEndingChamferDistance( const float endingChamferDistance );
355 
356  /** get the last segment chamfer distance (NOTE: not controllable in editor, usually used by the GlsSchematicTeeInterconnect plugin at runtime)
357  * \return distance from end of last line segment to start chamfer ( 0.0f to disable )
358  */
359  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetEndingChamferDistance( void );
360 
361 protected:
362  /** helper struct for storing computed verts for interconnect */
364  {
365  float _leftX, _leftY; /**< left side coord in 2D plane */
366  float _rightX, _rightY; /**< left side coord in 2D plane */
367  float _interconnectU; /**< corresponding U texture coord for interconnect texture */
368  float _flowU; /**< corresponding U texture coord for flow texture */
369 
370  /** ctor */
371  inline InterconnectVertex( const float leftX = 0.0f, const float leftY = 0.0f, const float rightX = 0.0f, const float rightY = 0.0f,
372  const float interconnectU = 0.0f, const float flowU = 0.0f ) :
373  _leftX( leftX ), _leftY( leftY ),
374  _rightX( rightX), _rightY( rightY ),
375  _interconnectU( interconnectU ), _flowU( flowU )
376  {}
377  };
378 
379  /** array of InterconnectVertex */
381 
382  /** helper struct for storing info for corners in the poly line */
384  {
385  Vector _v0, _v1, _v2; /**< corner flows from _v0 -> _v1 -> _v2 */
386  bool _isRounded; /**< true if the corner is to be rounded */
387  Vector _center; /**< center of circle making round corner */
388  float _radius; /**< radius of circle making round corner */
389  double _startTheta, _endTheta; /**< starting and ending theta for arc in circle making round corner */
390  bool _isLeftTurn; /**< true if corners is a left turn else false */
391  Vector _tangent_v0_v1; /**< tangent point of corner circle on v0 -> v1 */
392  Vector _tangent_v1_v2; /**< tangent point of corner circle on v1 -> v2 */
393  };
394 
395  /** array of CornerCircle */
397 
398  /** array of Vector */
400 
401  /** notify that vertices have changed
402  */
403  virtual void VerticesChanged( void );
404 
405  /** notify that the orientation vectors have changed
406  */
407  virtual void OrientationChanged( void );
408 
409  /** get the rotation matrix for the current _orientation vectors
410  * \return the rotation matrix for the current _orientation vectors
411  */
412  virtual GlsMatrixType GetOrientationMatrix( void );
413 
414  /** flag line to be rebuilt on next draw */
415  virtual void SetRebuild( void );
416 
417  /** rebuild the polyline */
418  virtual void Rebuild( void );
419 
420 #ifdef GLES
421  /** prepare and bake the geometry in _interconnectQuads to a VBO as quads and an outline
422  * \param drawFlowUVs true to draw with flow UV's else false to draw with interconnect UV's
423  */
424  virtual void BakeInterconnectGeometry( const bool drawFlowUVs );
425 
426  /** Bakes the VBOS
427  */
428  void BakeVBOs( );
429 #else
430  /** emit the geomentry in _interconnectQuads to OpenGL as quads and an outline
431  * \param drawFlowUVs true to draw with flow UV's else false to draw with interconnect UV's
432  */
433  virtual void EmitInterconnectGeometry( const bool drawFlowUVs );
434 
435  /** turn on/off preview Path drawing ( useful for debugging and when the object is selected in the editor )
436  * \param enablePreviewPath true to enable else false
437  */
438  virtual void EnablePreviewPath( const bool enablePreviewPath );
439 
440  /** emit the preview path geometry to GL -- mainly used fir debugging and when the line is selected in the editor */
441  virtual void EmitPreviewPathGeometry( void );
442 #endif
443 
444  /** Eliminate adjacent vertices that are not unique between each other
445  * \param numVertices number of input vertices
446  * \param vertices input vertices
447  * \return array of unique verts
448  */
449  virtual VectorArray GetUniqueVerts( const unsigned int numVertices, Vertex *vertices );
450 
451  /** Find a corner circle that will fit the corner defined by v0 -> v1 -> v2
452  * \param v0 starting point
453  * \param v1 corner point
454  * \param v2 ending point
455  * \param desiredCornerRadius desired radius for corner circle
456  * \param minRadius minimum radius for ccorner circle
457  * \param forceExactCornerRadius true if the corner can only be rounded with a radius equal to the desiredCornerRadius
458  * else false to allow a smaller radius to be used if needed (>minRadius)
459  * \param c [out] receives corner info
460  * \param forceCircle [optional, defaults to false] true to force a rounded corner to be found
461  * (used to avoid lack of precision issues when the circle is tangent at the midpoint of either v0 -> v1, or v1 -> v2
462  * \return true if a rounded corner was found
463  */
464  virtual bool FindCornerCircle( const Vector &v0, const Vector &v1, const Vector &v2, const float desiredCornerRadius, const float minRadius,
465  const bool forceExactCornerRadius, CornerCircle &c, bool forceCircle = false );
466 
467  /** Compute the length of the path described by the given corner array
468  * \param cornerCircles corners in question
469  */
470  virtual float ComputePathLength( CornerCircleArray &cornerCircles );
471 
472  /** Add a line segment to the given array of interconnect verts
473  * \param interconnectVerts receives line segment is start and finish are not virtually the same point
474  * \param start starting point of line segment
475  * \param finish finish point of line segment
476  * \param lineThickness thickness of line segment
477  * \param curLength current length of path at the starting point
478  * \param totalLength total length of path that contains the line segment
479  * \param numInterconnectRepeats number of interconnect texture repeats over entire path that contains the line segment
480  * \param numFlowRepeats number of flow texture repeats over entire path that contains the line segment
481  * \param lastSegmentInPath [optional, defaults to false] true if this line segment is the last in the path
482  */
483  virtual float AddInterconnectLineSegment( InterconnectVertexArray &interconnectVerts, const Vector &start, const Vector &finish, float lineThickness,
484  float curLength, const float totalLength,
485  const unsigned int numInterconnectRepeats, const unsigned int numFlowRepeats,
486  const bool lastSegmentInPath = false );
487 
488  /** Add a rounded to the given array of interconnect verts
489  * \param interconnectVerts receives line segment is start and finish are not virtually the same point
490  * \param c info for rounded corner to add
491  * \param lineThickness thickness of line segment
492  * \param curLength current length of path at the starting point
493  * \param totalLength total length of path that contains the line segment
494  * \param numInterconnectRepeats number of interconnect texture repeats over entire path that contains the line segment
495  * \param numFlowRepeats number of flow texture repeats over entire path that contains the line segment
496  */
497  virtual float AddInterconnectRoundedCorner( InterconnectVertexArray &interconnectVerts, const CornerCircle &c, float lineThickness,
498  float curLength, const float totalLength,
499  const unsigned int numInterconnectRepeats, const unsigned int numFlowRepeats );
500 #ifdef GLES
501  /** Set a single attribute from the GLO file.
502  * \param data The attribute to set and its associated data.
503  */
504  virtual void SetFromGloData(GlsGloFileAttribute &data);
505 #endif
506 
507  Vector _orientation[ 2 ]; /**< Two orthogonal vectors defining the orientation */
508  float _lineThickness; /**< thickness of line in logical units ( >0.0 )*/
509  bool _roundedCorners; /**< true for rounded corners */
510  float _cornerRadius; /**< radius for rounded corners ( >0.0 )*/
511  bool _forceExactCornerRadius; /**< true to force rounded corners to use the exact corner radius
512  * specified by _cornerRadius. If true, a corner that cannot be made with this radius
513  * will not be rounded. */
514  unsigned int _cornerSegments; /**< number of segments to use in rounded corners (2 <= cornerSegments <= 100) */
515  float _interconnectTextureRepeatLength; /**< number of logical units per interconnect texture repeat ( >0.0 )
516  * NOTE: number of actual repeats for the whole interconnect is always rounded
517  * to the nearest whole number so that adjacent interconnect's textures lineup */
518  int _flowTextureIndex; /**< texture index for flow texture else NO_TEXTURE */
519  float _flowTextureRepeatLength; /**< number of logical units per flow texture repeat ( >0.0 )
520  * NOTE: number of actual repeats for the whole interconnect is always rounded
521  * to the nearest whole number so that adjacent interconnect's textures lineup */
522  bool _showFlow; /**< true to draw flow in interconnect else false */
523  float _flowRate; /**< the flow rate in "flow textures" / second */
524  bool _showFlowBlink; /**< true to draw the flow blink else false (NOTE: normal flow is not drawn if flow blink is true) */
525  float _flowBlinkRate; /**< rate of flow blink in hz >= 0.0 */
526  glsColor _flowBlinkStartColor; /**< starting color for flow blink */
527  glsColor _flowBlinkEndColor; /**< ending color for flow blink */
528 
529  bool _needsRebuild; /**< true if the line needs to be rebuilt */
530  double _lastCalculateTime; /**< last time stamp given to Calculate() method */
531  InterconnectVertexArray _interconnectVerts; /**< 2D verts and texture coords computed for interconnect */
532 
533 #ifndef GLES
534  bool _useDisplayList; /**< true to draw using display lists */
535  GlsDisplayList _interconnectDisplayList; /**< display list for drawing interconnect (if using display lists) */
536  GlsDisplayList _flowDisplayList; /**< display list for drawing flow (if using display lists) */
537 #endif
538 
539  float _endingChamferDistance; /**< distance from end of last line segment to start chamfer ( 0.0f to disable ) ( >= 0.0f ) */
540 
541  bool _drawPreviewPath; /**< true to draw the preview path (mainly used in editor) */
542  VectorArray _previewPathPoints; /**< points in preview path */
543  CornerCircleArray _previewCornerCircles; /**< corners in preview path */
544 
545 #ifdef GLES
546  GlsTriangleStrip2D _interconnectTris; /**< Triangle strip for the interconnect */
547  GlsTriangleStrip2D _flowTris; /**< Triangle strip for the flows */
548 #endif
549 };
550 
551 } // namespace disti
552 
553 #endif
Definition: cull.h:50
virtual void SetInterconnectTextureIndex(const int interconnectTextureIndex)
float _flowTextureRepeatLength
Definition: gls_schematic_poly_line_interconnect.h:519
virtual void SetCornerSegments(const unsigned int cornerSegments)
virtual void GetExtents(float &x, float &y, float &z, float &x1, float &y1, float &z1)
Vector _orientation[2]
Definition: gls_schematic_poly_line_interconnect.h:507
Definition: vertex.h:365
bool _isRounded
Definition: gls_schematic_poly_line_interconnect.h:386
virtual bool Hit(float x, float y, float z, float scale, const Vector &directionVector, Vector *collisionPoint)
virtual void SetCornerRadius(const float cornerRadius)
virtual DisplayObject * handle(DisplayEvent *ev)
bool _isLeftTurn
Definition: gls_schematic_poly_line_interconnect.h:390
bool _showFlowBlink
Definition: gls_schematic_poly_line_interconnect.h:524
virtual glsColor GetFlowBlinkStartColor(void)
Definition: dynamic_array.h:63
float _interconnectU
Definition: gls_schematic_poly_line_interconnect.h:367
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:289
virtual VectorArray GetUniqueVerts(const unsigned int numVertices, Vertex *vertices)
virtual void SetValue(int spec, va_list &args)
virtual void Rotate(const Vector &orig, float angle, const Vector &axis)
The Polygon class. Implements Polygons.
Definition: glpolygon.h:56
virtual float ComputePathLength(CornerCircleArray &cornerCircles)
bool _needsRebuild
Definition: gls_schematic_poly_line_interconnect.h:529
Vector _tangent_v0_v1
Definition: gls_schematic_poly_line_interconnect.h:391
virtual void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler)
glsColor _flowBlinkStartColor
Definition: gls_schematic_poly_line_interconnect.h:526
virtual void SetInterconnectTextureRepeatLength(const float interconnectTextureRepeatLength)
float _flowU
Definition: gls_schematic_poly_line_interconnect.h:368
GlsDisplayList _flowDisplayList
Definition: gls_schematic_poly_line_interconnect.h:536
bool _drawPreviewPath
Definition: gls_schematic_poly_line_interconnect.h:541
Definition: display.h:98
virtual void DeleteVertex(unsigned int index)
The disti::GLPolygon class. Implements Polygons.
virtual float GetFlowTextureRepeatLength(void)
virtual void SetRoundedCorners(const bool roundedCorners)
float _endingChamferDistance
Definition: gls_schematic_poly_line_interconnect.h:539
DynamicArray< InterconnectVertex, true > InterconnectVertexArray
Definition: gls_schematic_poly_line_interconnect.h:380
bool _roundedCorners
Definition: gls_schematic_poly_line_interconnect.h:509
virtual void EnablePreviewPath(const bool enablePreviewPath)
InterconnectVertexArray _interconnectVerts
Definition: gls_schematic_poly_line_interconnect.h:531
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL)
DynamicArray< Vector, true > VectorArray
Definition: gls_schematic_poly_line_interconnect.h:399
Definition: gls_display_list.h:51
int _flowTextureIndex
Definition: gls_schematic_poly_line_interconnect.h:518
virtual unsigned int GetCornerSegments(void)
virtual float AddInterconnectRoundedCorner(InterconnectVertexArray &interconnectVerts, const CornerCircle &c, float lineThickness, float curLength, const float totalLength, const unsigned int numInterconnectRepeats, const unsigned int numFlowRepeats)
virtual float AddInterconnectLineSegment(InterconnectVertexArray &interconnectVerts, const Vector &start, const Vector &finish, float lineThickness, float curLength, const float totalLength, const unsigned int numInterconnectRepeats, const unsigned int numFlowRepeats, const bool lastSegmentInPath=false)
float _rightY
Definition: gls_schematic_poly_line_interconnect.h:366
virtual void SetFlowBlinkEndColor(const glsColor &endColor)
virtual void GetOrientationVectors(Vector &iVector, Vector &jVector)
virtual void SetFlowTextureIndex(const int flowTextureIndex)
bool _useDisplayList
Definition: gls_schematic_poly_line_interconnect.h:534
virtual void SetFlowTextureRepeatLength(const float flowTextureRepeatLength)
GlsDisplayList _interconnectDisplayList
Definition: gls_schematic_poly_line_interconnect.h:535
float _radius
Definition: gls_schematic_poly_line_interconnect.h:388
virtual void CopyProperties(DisplayObject *src)
virtual void Scale(float px, float py, float pz, Vertex *anchor, int handleBar=0)
InterconnectVertex(const float leftX=0.0f, const float leftY=0.0f, const float rightX=0.0f, const float rightY=0.0f, const float interconnectU=0.0f, const float flowU=0.0f)
Definition: gls_schematic_poly_line_interconnect.h:371
virtual glsColor GetFlowBlinkEndColor(void)
virtual void CalculateTextureCoordinates(void)
virtual void SetForceExactCornerRadius(const bool forceExactCornerRadius)
virtual void Calculate(double time)
virtual void SetFlowRate(const float flowRate)
float _leftY
Definition: gls_schematic_poly_line_interconnect.h:365
Vector _v2
Definition: gls_schematic_poly_line_interconnect.h:385
virtual GlsMatrixType GetOrientationMatrix(void)
virtual void CopyGeometry(DisplayObject *src)
Definition: events.h:111
CornerCircleArray _previewCornerCircles
Definition: gls_schematic_poly_line_interconnect.h:543
float _lineThickness
Definition: gls_schematic_poly_line_interconnect.h:508
glsColor _flowBlinkEndColor
Definition: gls_schematic_poly_line_interconnect.h:527
The gls_auto_lib.
Definition: gls_color.h:54
virtual void SetUseDisplayList(const bool useDisplayList)
virtual void InsertVertex(unsigned int index)
virtual void SetFlowBlinkStartColor(const glsColor &startColor)
virtual bool FindCornerCircle(const Vector &v0, const Vector &v1, const Vector &v2, const float desiredCornerRadius, const float minRadius, const bool forceExactCornerRadius, CornerCircle &c, bool forceCircle=false)
virtual float GetInterconnectTextureRepeatLength(void)
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array)
Definition: gls_schematic_poly_line_interconnect.h:101
Vector _tangent_v1_v2
Definition: gls_schematic_poly_line_interconnect.h:392
Definition: gls_schematic_poly_line_interconnect.h:383
VectorArray _previewPathPoints
Definition: gls_schematic_poly_line_interconnect.h:542
double _lastCalculateTime
Definition: gls_schematic_poly_line_interconnect.h:530
Definition: vertex.h:84
float _cornerRadius
Definition: gls_schematic_poly_line_interconnect.h:510
Vector _center
Definition: gls_schematic_poly_line_interconnect.h:387
virtual void SetOrientationVectors(const Vector &iVector, const Vector &jVector)
virtual void SetVertices(unsigned int nPoints, Vertex *vertices)
float _interconnectTextureRepeatLength
Definition: gls_schematic_poly_line_interconnect.h:515
virtual void SetShowFlowBlink(const bool showFlowBlink)
virtual bool GetForceExactCornerRadius(void)
virtual void SetEndingChamferDistance(const float endingChamferDistance)
float _flowRate
Definition: gls_schematic_poly_line_interconnect.h:523
virtual void SetAvailableAttributes(unsigned int value)
virtual DisplayObject * CloneObject(bool generateNames=false)
Macros and helper code to determine what subset of C++11/14/17 is available.
virtual Vertex WorldVertex(unsigned int i)
DynamicArray< CornerCircle, true > CornerCircleArray
Definition: gls_schematic_poly_line_interconnect.h:396
float _flowBlinkRate
Definition: gls_schematic_poly_line_interconnect.h:525
double _endTheta
Definition: gls_schematic_poly_line_interconnect.h:389
virtual void SetShowFlow(const bool showFlow)
virtual void SetFlowBlinkRate(const float flowBlinkRate)
Definition: bmpimage.h:46
unsigned int _cornerSegments
Definition: gls_schematic_poly_line_interconnect.h:514
virtual void EmitInterconnectGeometry(const bool drawFlowUVs)
The disti::GlsDisplayList class.
bool _forceExactCornerRadius
Definition: gls_schematic_poly_line_interconnect.h:511
virtual float GetEndingChamferDistance(void)
Definition: gls_schematic_poly_line_interconnect.h:363
bool _showFlow
Definition: gls_schematic_poly_line_interconnect.h:522
virtual void SetLineThickness(const float lineThickness)