GL Studio C++ Runtime 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) 2017 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 ) || defined( GLSGEN_IMPORT_GLSSCHEMATICPOLYLINEINTERCONNECT ) || defined( GLS_EXPORT_GENERATED ) || defined( GLS_IMPORT_GENERATED ) ) \
53  && defined( _MSC_VER )
54 # if defined( GLSGEN_EXPORT_GLSSCHEMATICPOLYLINEINTERCONNECT ) || defined( GLS_EXPORT_GENERATED )
55 # define GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT __declspec( dllexport )
56 # else
57 # define GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT __declspec( dllimport )
58 # endif
59 #else
60 # define GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT
61 #endif
62 ///////////////////////////////////////////////////////////////////////////////
63 
64 #define LIB_BASE_NAME "gls_schematic_poly_line_interconnect"
65 #include "gls_auto_lib.h"
66 #undef LIB_BASE_NAME
67 
68 namespace disti
69 {
70 // SetValue enumerations
71 enum
72 {
73  GLS_SCHEMATICPOLYLINEINTERCONNECT_FIRST_VALUE = GLS_LAST_INITIALIZER + 1,
74  GLS_SCHEMATICPOLYLINEINTERCONNECT_ORIENTATION,
75  GLS_SCHEMATICPOLYLINEINTERCONNECT_LINE_THICKNESS,
76  GLS_SCHEMATICPOLYLINEINTERCONNECT_ROUNDED_CORNERS,
77  GLS_SCHEMATICPOLYLINEINTERCONNECT_CORNER_RADIUS,
78  GLS_SCHEMATICPOLYLINEINTERCONNECT_FORCE_EXACT_CORNER_RADIUS,
79  GLS_SCHEMATICPOLYLINEINTERCONNECT_CORNER_SEGMENTS,
80  GLS_SCHEMATICPOLYLINEINTERCONNECT_INTERCONNECT_TEXTURE_REPEAT_LENGTH,
81  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_TEXTURE_INDEX,
82  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_TEXTURE_REPEAT_LENGTH,
83  GLS_SCHEMATICPOLYLINEINTERCONNECT_SHOW_FLOW,
84  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_RATE,
85  GLS_SCHEMATICPOLYLINEINTERCONNECT_SHOW_FLOW_BLINK,
86  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_RATE,
87  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_START_COLOR,
88  GLS_SCHEMATICPOLYLINEINTERCONNECT_FLOW_BLINK_END_COLOR,
89  GLS_SCHEMATICPOLYLINEINTERCONNECT_USE_DISPLAY_LIST,
90  GLS_SCHEMATICPOLYLINEINTERCONNECT_LAST_VALUE = GLS_SCHEMATICPOLYLINEINTERCONNECT_USE_DISPLAY_LIST
91 };
92 
93 #ifdef GLES
94 class GlsGloFileAttribute;
95 #endif
96 
97 /** Runtime implementation of a GlsSchematicPolyLineInterconnect */
99 {
100 private:
101  GlsSchematicPolyLineInterconnect& operator=( const GlsSchematicPolyLineInterconnect& ) DISTI_SPECIAL_MEM_FUN_DELETE;
102  GlsSchematicPolyLineInterconnect( const GlsSchematicPolyLineInterconnect& ) DISTI_SPECIAL_MEM_FUN_DELETE;
103 
104 public:
105  typedef GLPolygon _BaseClass;
106  friend class GlsSchematicPolyLineInterconnectEditor;
107 
108  /** Create a new GlsSchematicPolyLineInterconnect.
109  * for this inputdevice */
110  GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GlsSchematicPolyLineInterconnect( void );
111  GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GlsSchematicPolyLineInterconnect( const GlsSchematicPolyLineInterconnect& that, const bool generateNames );
112 
113  /** Destructs a GlsSchematicPolyLineInterconnect object */
114  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT ~GlsSchematicPolyLineInterconnect();
115 
116  static GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT DisplayObject* CreateInstance();
117 
118  //////////////////////////////////////////////////
119  // Overridden base class methods
120  //////////////////////////////////////////////////
121 
122  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void SetAvailableAttributes( unsigned int value );
123  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT DisplayObject* CloneObject( bool generateNames = false );
124  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void CopyGeometry( DisplayObject* src );
125  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void CopyProperties( DisplayObject* src );
126 
127 #ifndef GLES
128  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL );
129  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array );
130 #endif
131 
132  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Calculate( double time );
133  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler );
134  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Draw( void );
135 
136  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void CalculateTextureCoordinates( void );
137 
138  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT DisplayObject* handle( DisplayEvent* ev );
139 
140  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void SetValue( int spec, va_list& args );
141 
142  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Scale( float px, float py, float pz, Vertex* anchor, int handleBar = 0 );
143 
144  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void GetExtents( float& x, float& y, float& z, float& x1, float& y1, float& z1 );
145 
146  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT bool Hit( float x, float y, float z, float scale, const Vector& directionVector, Vector* collisionPoint );
147 
148  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Rotate( const Vector& orig, float angle, const Vector& axis );
149 
150  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT Vertex WorldVertex( unsigned int i );
151 
152  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void SetVertices( unsigned int nPoints, Vertex* vertices );
153 
154  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void DeleteVertex( unsigned int index );
155  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void InsertVertex( unsigned int index );
156 
157  //////////////////////////////////////////////////
158  // GlsSchematicPolyLineInterconnect specific operations
159  //////////////////////////////////////////////////
160 
161  /** set the i and j orientation vectors that orient the 2-D schematic in 3 space
162  * \param iVector new iVector
163  * \param jVector new jVector
164  * \pre i and j should be orhogonal
165  */
166  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetOrientationVectors( const Vector& iVector, const Vector& jVector );
167 
168  /** get the i and j orientation vectors that orient the 2-D schematic in 3 space
169  * \param iVector [out] iVector
170  * \param jVector [out] jVector
171  */
172  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetOrientationVectors( Vector& iVector /*out*/, Vector& jVector /*out*/ );
173 
174  /** set the line thickness in logical units
175  * \param lineThickness new line thickness in logical units
176  * \pre lineThickness > 0.0f
177  */
178  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetLineThickness( const float lineThickness );
179 
180  /** get the line thickness in logical units
181  * \return the line thickness in logical units
182  */
183  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetLineThickness( void );
184 
185  /** set rounded corners
186  * \param roundedCorners true for rounded corners
187  */
188  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetRoundedCorners( const bool roundedCorners );
189 
190  /** get rounded corners
191  * \return rounded corners
192  */
193  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetRoundedCorners( void );
194 
195  /** set the corner radius in logical units
196  * \param cornerRadius new corner radisu in logical units
197  * \pre cornerRadius > 0.0f
198  */
199  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetCornerRadius( const float cornerRadius );
200 
201  /** get the corner radius in logical units
202  * \return the corner radius in logical units
203  */
204  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetCornerRadius( void );
205 
206  /** set force exact corner radius
207  * \param forceExactCornerRadius true to force rounded corners to use the exact corner radius
208  * specified by SetCornerRadius(). If true, a corner that cannot be made
209  * with this radius will not be rounded.
210  */
211  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetForceExactCornerRadius( const bool forceExactCornerRadius );
212 
213  /** get force exact corner radius state
214  * \return force exact corner radius state
215  */
216  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetForceExactCornerRadius( void );
217 
218  /** set the number of segments used in rounded corners
219  * \param cornerSegments number of segments to use in rounded corners
220  * \pre 2 <= cornerSegments <= 100
221  */
222  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetCornerSegments( const unsigned int cornerSegments );
223 
224  /** get the number of segments used in rounded corners
225  * \return the number of segments used in rounded corners
226  */
227  virtual unsigned int GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetCornerSegments( void );
228 
229  /** set the interconnect texture index
230  * \param interconnectTextureIndex new interconnect texture index else NO_TEXTURE if no interconnect texture
231  */
232  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetInterconnectTextureIndex( const int interconnectTextureIndex );
233 
234  /** get the interconnect texture index else NO_TEXTURE if no interconnect texture
235  * \return the interconnect texture index else NO_TEXTURE if no interconnect texture
236  */
237  virtual int GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetInterconnectTextureIndex( void );
238 
239  /** set the number of logical units per interconnect texture repeat ( >0.0 )
240  * NOTE: number of actual repeats for the whole interconnect is always rounded
241  * to the nearest whole number so that adjacent interconnect's textures lineup
242  * \param interconnectTextureRepeatLength new interconnect texture repeat length
243  * \pre interconnectTextureRepeatLength > 0.0f
244  */
245  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetInterconnectTextureRepeatLength( const float interconnectTextureRepeatLength );
246 
247  /** get the number of logical units per interconnect texture repeat ( >0.0 )
248  * \return the number of logical units per interconnect texture repeat ( >0.0 )
249  */
250  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetInterconnectTextureRepeatLength( void );
251 
252  /** set the flow texture index
253  * \param flowTextureIndex new flow texture index else NO_TEXTURE if no flow texture
254  */
255  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowTextureIndex( const int flowTextureIndex );
256 
257  /** get the flow texture index else NO_TEXTURE if no flow texture
258  * \return the flow texture index else NO_TEXTURE if no flow texture
259  */
260  virtual int GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowTextureIndex( void );
261 
262  /** set the number of logical units per flow texture repeat ( >0.0 )
263  * NOTE: number of actual repeats for the whole interconnect is always rounded
264  * to the nearest whole number so that adjacent interconnect's textures lineup
265  * \param flowTextureRepeatLength new flow texture repeat length
266  * \pre flowTextureRepeatLength > 0.0f
267  */
268  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowTextureRepeatLength( const float flowTextureRepeatLength );
269 
270  /** get the number of logical units per flow texture repeat ( >0.0 )
271  * \return the number of logical units per flow texture repeat ( >0.0 )
272  */
273  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowTextureRepeatLength( void );
274 
275  /** set whether or not the flow is displayed
276  * \param showFlow true to show flow else false
277  */
278  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetShowFlow( const bool showFlow );
279 
280  /** get whether or not the flow is displayed
281  * \return true if flow is show else false
282  */
283  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetShowFlow( void );
284 
285  /** set the flow rate in "flow textures" / second
286  * \param flowRate flow rate in "flow textures" / second
287  */
288  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowRate( const float flowRate );
289 
290  /** get the flow rate in "flow textures" / second
291  * \return the flow rate in "flow textures" / second
292  */
293  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowRate( void );
294 
295  /** set whether or not the flow blink is displayed (NOTE: normal flow is not drawn if flow blink is true)
296  * \param showFlowBlink true to show flow blink else false
297  */
298  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetShowFlowBlink( const bool showFlowBlink );
299 
300  /** get whether or not the flow blink is displayed (NOTE: normal flow is not drawn if flow blink is true)
301  * \return true if flow blink is shown else false
302  */
303  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetShowFlowBlink( void );
304 
305  /** set the flow blink rate in hz
306  * \param flowBlinkRate flow blink rate in hz
307  */
308  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowBlinkRate( const float flowBlinkRate );
309 
310  /** get the flow blink rate in hz
311  * \return the flow blink rate in hz
312  */
313  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowBlinkRate( void );
314 
315  /** set the flow blink start color
316  * \param startColor flow blink start color
317  */
318  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowBlinkStartColor( const GlsColor& startColor );
319 
320  /** get the flow blink start color
321  * \return the flow blink start color
322  */
323  virtual GlsColor GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowBlinkStartColor( void );
324 
325  /** set the flow blink end color
326  * \param endColor flow blink end color
327  */
328  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowBlinkEndColor( const GlsColor& endColor );
329 
330  /** get the flow blink end color
331  * \return the flow blink end color
332  */
333  virtual GlsColor GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowBlinkEndColor( void );
334 
335 #ifndef GLES
336  /** enable/disable using display list for drawing
337  * \param useDisplayList true to use display list
338  */
339  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetUseDisplayList( const bool useDisplayList );
340 
341  /** get use display list
342  * \return true if using display list for drawing
343  */
344  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetUseDisplayList( void );
345 #endif
346 
347  /** set the last segment chamfer distance (NOTE: not controllable in editor, usually used by the GlsSchematicTeeInterconnect plugin at runtime)
348  * \param endingChamferDistance distance from end of last line segment to start chamfer ( 0.0f to disable )
349  * \pre endingChamferDistance >= 0.0f
350  */
351  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetEndingChamferDistance( const float endingChamferDistance );
352 
353  /** get the last segment chamfer distance (NOTE: not controllable in editor, usually used by the GlsSchematicTeeInterconnect plugin at runtime)
354  * \return distance from end of last line segment to start chamfer ( 0.0f to disable )
355  */
356  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetEndingChamferDistance( void );
357 
358 protected:
359  /** helper struct for storing computed verts for interconnect */
361  {
362  float _leftX, _leftY; /**< left side coord in 2D plane */
363  float _rightX, _rightY; /**< left side coord in 2D plane */
364  float _interconnectU; /**< corresponding U texture coord for interconnect texture */
365  float _flowU; /**< corresponding U texture coord for flow texture */
366 
367  /** ctor */
368  inline InterconnectVertex( const float leftX = 0.0f, const float leftY = 0.0f, const float rightX = 0.0f, const float rightY = 0.0f,
369  const float interconnectU = 0.0f, const float flowU = 0.0f )
370  : _leftX( leftX )
371  , _leftY( leftY )
372  , _rightX( rightX )
373  , _rightY( rightY )
374  , _interconnectU( interconnectU )
375  , _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 GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT 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:49
virtual void SetInterconnectTextureIndex(const int interconnectTextureIndex)
Definition: gls_triangle_storage.h:56
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)
GlsColor _flowBlinkEndColor
Definition: gls_schematic_poly_line_interconnect.h:527
Vector _orientation[2]
Definition: gls_schematic_poly_line_interconnect.h:507
Definition: vertex.h:408
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
Definition: dynamic_array.h:62
float _interconnectU
Definition: gls_schematic_poly_line_interconnect.h:364
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:278
virtual VectorArray GetUniqueVerts(const unsigned int numVertices, Vertex *vertices)
virtual void SetValue(int spec, va_list &args)
virtual void SetFlowBlinkEndColor(const GlsColor &endColor)
virtual void Rotate(const Vector &orig, float angle, const Vector &axis)
The Polygon class. Implements Polygons.
Definition: glpolygon.h:55
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:365
GlsDisplayList _flowDisplayList
Definition: gls_schematic_poly_line_interconnect.h:536
bool _drawPreviewPath
Definition: gls_schematic_poly_line_interconnect.h:541
Definition: display.h:97
virtual void DeleteVertex(unsigned int index)
virtual GlsColor GetFlowBlinkEndColor(void)
The disti::GLPolygon class. Implements Polygons.
virtual float GetFlowTextureRepeatLength(void)
DynamicArray< InterconnectVertex, true > InterconnectVertexArray
Definition: gls_schematic_poly_line_interconnect.h:380
virtual void SetRoundedCorners(const bool roundedCorners)
float _endingChamferDistance
Definition: gls_schematic_poly_line_interconnect.h:539
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)
Definition: gls_display_list.h:50
int _flowTextureIndex
Definition: gls_schematic_poly_line_interconnect.h:518
virtual unsigned int GetCornerSegments(void)
Definition: gls_glo_file.h:835
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:363
virtual void SetFlowBlinkStartColor(const GlsColor &startColor)
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:368
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:362
Vector _v2
Definition: gls_schematic_poly_line_interconnect.h:385
virtual GlsMatrixType GetOrientationMatrix(void)
virtual void CopyGeometry(DisplayObject *src)
Definition: events.h:110
Definition: gls_color.h:53
CornerCircleArray _previewCornerCircles
Definition: gls_schematic_poly_line_interconnect.h:543
float _lineThickness
Definition: gls_schematic_poly_line_interconnect.h:508
The disti::GlsTriangleStrip2D class.
virtual GlsColor GetFlowBlinkStartColor(void)
The gls_auto_lib.
virtual void SetUseDisplayList(const bool useDisplayList)
virtual void InsertVertex(unsigned int index)
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:98
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:83
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)
DynamicArray< Vector, true > VectorArray
Definition: gls_schematic_poly_line_interconnect.h:399
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)
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
DynamicArray< CornerCircle, true > CornerCircleArray
Definition: gls_schematic_poly_line_interconnect.h:396
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:360
bool _showFlow
Definition: gls_schematic_poly_line_interconnect.h:522
virtual void SetLineThickness(const float lineThickness)