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  DISTI_DEPRECATED( "This identifier is forbidden by the C++ standard. Use BaseClass instead." )
106  typedef GLPolygon _BaseClass;
107  typedef GLPolygon BaseClass;
108  friend class GlsSchematicPolyLineInterconnectEditor;
109 
110  /** Create a new GlsSchematicPolyLineInterconnect.
111  * for this inputdevice */
112  GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GlsSchematicPolyLineInterconnect( void );
113  GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GlsSchematicPolyLineInterconnect( const GlsSchematicPolyLineInterconnect& that, const bool generateNames );
114 
115  /** Destructs a GlsSchematicPolyLineInterconnect object */
116  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT ~GlsSchematicPolyLineInterconnect();
117 
118  static GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT DisplayObject* CreateInstance();
119 
120  //////////////////////////////////////////////////
121  // Overridden base class methods
122  //////////////////////////////////////////////////
123 
124  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void SetAvailableAttributes( unsigned int value ) DISTI_METHOD_OVERRIDE;
125  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT DisplayObject* CloneObject( bool generateNames = false ) DISTI_METHOD_OVERRIDE;
126  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void CopyGeometry( DisplayObject* src ) DISTI_METHOD_OVERRIDE;
127  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void CopyProperties( DisplayObject* src ) DISTI_METHOD_OVERRIDE;
128 
129 #ifndef GLES
130  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT InterfaceListType* GetCppInterfaceDescription( InterfaceListType* addToThisList = NULL ) DISTI_METHOD_OVERRIDE;
131  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void GetCppInterfaceDescriptionFree( InterfaceListType* array ) DISTI_METHOD_OVERRIDE;
132 #endif
133 
134  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Calculate( double time ) DISTI_METHOD_OVERRIDE;
135  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void PreDraw( const OpenGLMatrices& parentMatrices, Culler& culler ) DISTI_METHOD_OVERRIDE;
136  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Draw( void ) DISTI_METHOD_OVERRIDE;
137 
138  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void CalculateTextureCoordinates( void ) DISTI_METHOD_OVERRIDE;
139 
140  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT DisplayObject* handle( DisplayEvent* ev ) DISTI_METHOD_OVERRIDE;
141 
142  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void SetValue( int spec, va_list& args ) DISTI_METHOD_OVERRIDE;
143 
144  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Scale( float px, float py, float pz, Vertex* anchor, int handleBar = 0 ) DISTI_METHOD_OVERRIDE;
145 
146  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void GetExtents( float& x, float& y, float& z, float& x1, float& y1, float& z1 ) DISTI_METHOD_OVERRIDE;
147 
148  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT bool Hit( float x, float y, float z, float scale, const Vector& directionVector, Vector* collisionPoint ) DISTI_METHOD_OVERRIDE;
149 
150  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void Rotate( const Vector& orig, float angle, const Vector& axis ) DISTI_METHOD_OVERRIDE;
151 
152  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT Vertex WorldVertex( unsigned int i ) DISTI_METHOD_OVERRIDE;
153 
154  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void SetVertices( unsigned int nPoints, Vertex* vertices ) DISTI_METHOD_OVERRIDE;
155 
156  GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void DeleteVertexAt( unsigned int index ) DISTI_METHOD_OVERRIDE;
157  GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void InsertVertexAt( unsigned int index ) DISTI_METHOD_OVERRIDE;
158 
159  //////////////////////////////////////////////////
160  // GlsSchematicPolyLineInterconnect specific operations
161  //////////////////////////////////////////////////
162 
163  /** set the i and j orientation vectors that orient the 2-D schematic in 3 space
164  * \param iVector new iVector
165  * \param jVector new jVector
166  * \pre i and j should be orhogonal
167  */
168  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetOrientationVectors( const Vector& iVector, const Vector& jVector );
169 
170  /** get the i and j orientation vectors that orient the 2-D schematic in 3 space
171  * \param iVector [out] iVector
172  * \param jVector [out] jVector
173  */
174  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetOrientationVectors( Vector& iVector /*out*/, Vector& jVector /*out*/ );
175 
176  /** set the line thickness in logical units
177  * \param lineThickness new line thickness in logical units
178  * \pre lineThickness > 0.0f
179  */
180  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetLineThickness( const float lineThickness );
181 
182  /** get the line thickness in logical units
183  * \return the line thickness in logical units
184  */
185  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetLineThickness( void );
186 
187  /** set rounded corners
188  * \param roundedCorners true for rounded corners
189  */
190  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetRoundedCorners( const bool roundedCorners );
191 
192  /** get rounded corners
193  * \return rounded corners
194  */
195  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetRoundedCorners( void );
196 
197  /** set the corner radius in logical units
198  * \param cornerRadius new corner radisu in logical units
199  * \pre cornerRadius > 0.0f
200  */
201  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetCornerRadius( const float cornerRadius );
202 
203  /** get the corner radius in logical units
204  * \return the corner radius in logical units
205  */
206  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetCornerRadius( void );
207 
208  /** set force exact corner radius
209  * \param forceExactCornerRadius true to force rounded corners to use the exact corner radius
210  * specified by SetCornerRadius(). If true, a corner that cannot be made
211  * with this radius will not be rounded.
212  */
213  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetForceExactCornerRadius( const bool forceExactCornerRadius );
214 
215  /** get force exact corner radius state
216  * \return force exact corner radius state
217  */
218  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetForceExactCornerRadius( void );
219 
220  /** set the number of segments used in rounded corners
221  * \param cornerSegments number of segments to use in rounded corners
222  * \pre 2 <= cornerSegments <= 100
223  */
224  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetCornerSegments( const unsigned int cornerSegments );
225 
226  /** get the number of segments used in rounded corners
227  * \return the number of segments used in rounded corners
228  */
229  virtual unsigned int GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetCornerSegments( void );
230 
231  /** set the interconnect texture index
232  * \param interconnectTextureIndex new interconnect texture index else NO_TEXTURE if no interconnect texture
233  */
234  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetInterconnectTextureIndex( const int interconnectTextureIndex );
235 
236  /** get the interconnect texture index else NO_TEXTURE if no interconnect texture
237  * \return the interconnect texture index else NO_TEXTURE if no interconnect texture
238  */
239  virtual int GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetInterconnectTextureIndex( void );
240 
241  /** set the number of logical units per interconnect texture repeat ( >0.0 )
242  * NOTE: number of actual repeats for the whole interconnect is always rounded
243  * to the nearest whole number so that adjacent interconnect's textures lineup
244  * \param interconnectTextureRepeatLength new interconnect texture repeat length
245  * \pre interconnectTextureRepeatLength > 0.0f
246  */
247  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetInterconnectTextureRepeatLength( const float interconnectTextureRepeatLength );
248 
249  /** get the number of logical units per interconnect texture repeat ( >0.0 )
250  * \return the number of logical units per interconnect texture repeat ( >0.0 )
251  */
252  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetInterconnectTextureRepeatLength( void );
253 
254  /** set the flow texture index
255  * \param flowTextureIndex new flow texture index else NO_TEXTURE if no flow texture
256  */
257  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowTextureIndex( const int flowTextureIndex );
258 
259  /** get the flow texture index else NO_TEXTURE if no flow texture
260  * \return the flow texture index else NO_TEXTURE if no flow texture
261  */
262  virtual int GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowTextureIndex( void );
263 
264  /** set the number of logical units per flow texture repeat ( >0.0 )
265  * NOTE: number of actual repeats for the whole interconnect is always rounded
266  * to the nearest whole number so that adjacent interconnect's textures lineup
267  * \param flowTextureRepeatLength new flow texture repeat length
268  * \pre flowTextureRepeatLength > 0.0f
269  */
270  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowTextureRepeatLength( const float flowTextureRepeatLength );
271 
272  /** get the number of logical units per flow texture repeat ( >0.0 )
273  * \return the number of logical units per flow texture repeat ( >0.0 )
274  */
275  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowTextureRepeatLength( void );
276 
277  /** set whether or not the flow is displayed
278  * \param showFlow true to show flow else false
279  */
280  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetShowFlow( const bool showFlow );
281 
282  /** get whether or not the flow is displayed
283  * \return true if flow is show else false
284  */
285  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetShowFlow( void );
286 
287  /** set the flow rate in "flow textures" / second
288  * \param flowRate flow rate in "flow textures" / second
289  */
290  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowRate( const float flowRate );
291 
292  /** get the flow rate in "flow textures" / second
293  * \return the flow rate in "flow textures" / second
294  */
295  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowRate( void );
296 
297  /** set whether or not the flow blink is displayed (NOTE: normal flow is not drawn if flow blink is true)
298  * \param showFlowBlink true to show flow blink else false
299  */
300  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetShowFlowBlink( const bool showFlowBlink );
301 
302  /** get whether or not the flow blink is displayed (NOTE: normal flow is not drawn if flow blink is true)
303  * \return true if flow blink is shown else false
304  */
305  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetShowFlowBlink( void );
306 
307  /** set the flow blink rate in hz
308  * \param flowBlinkRate flow blink rate in hz
309  */
310  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowBlinkRate( const float flowBlinkRate );
311 
312  /** get the flow blink rate in hz
313  * \return the flow blink rate in hz
314  */
315  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowBlinkRate( void );
316 
317  /** set the flow blink start color
318  * \param startColor flow blink start color
319  */
320  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowBlinkStartColor( const GlsColor& startColor );
321 
322  /** get the flow blink start color
323  * \return the flow blink start color
324  */
325  virtual GlsColor GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowBlinkStartColor( void );
326 
327  /** set the flow blink end color
328  * \param endColor flow blink end color
329  */
330  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetFlowBlinkEndColor( const GlsColor& endColor );
331 
332  /** get the flow blink end color
333  * \return the flow blink end color
334  */
335  virtual GlsColor GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetFlowBlinkEndColor( void );
336 
337 #ifndef GLES
338  /** enable/disable using display list for drawing
339  * \param useDisplayList true to use display list
340  */
341  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetUseDisplayList( const bool useDisplayList );
342 
343  /** get use display list
344  * \return true if using display list for drawing
345  */
346  virtual bool GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetUseDisplayList( void );
347 #endif
348 
349  /** set the last segment chamfer distance (NOTE: not controllable in editor, usually used by the GlsSchematicTeeInterconnect plugin at runtime)
350  * \param endingChamferDistance distance from end of last line segment to start chamfer ( 0.0f to disable )
351  * \pre endingChamferDistance >= 0.0f
352  */
353  virtual void GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT SetEndingChamferDistance( const float endingChamferDistance );
354 
355  /** get the last segment chamfer distance (NOTE: not controllable in editor, usually used by the GlsSchematicTeeInterconnect plugin at runtime)
356  * \return distance from end of last line segment to start chamfer ( 0.0f to disable )
357  */
358  virtual float GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT GetEndingChamferDistance( void );
359 
360 protected:
361  /** helper struct for storing computed verts for interconnect */
363  {
364  float _leftX, _leftY; /**< left side coord in 2D plane */
365  float _rightX, _rightY; /**< left side coord in 2D plane */
366  float _interconnectU; /**< corresponding U texture coord for interconnect texture */
367  float _flowU; /**< corresponding U texture coord for flow texture */
368 
369  /** ctor */
370  inline InterconnectVertex( const float leftX = 0.0f, const float leftY = 0.0f, const float rightX = 0.0f, const float rightY = 0.0f,
371  const float interconnectU = 0.0f, const float flowU = 0.0f )
372  : _leftX( leftX )
373  , _leftY( leftY )
374  , _rightX( rightX )
375  , _rightY( rightY )
376  , _interconnectU( interconnectU )
377  , _flowU( flowU )
378  {}
379  };
380 
381  /** array of InterconnectVertex */
383 
384  /** helper struct for storing info for corners in the poly line */
386  {
387  Vector _v0, _v1, _v2; /**< corner flows from _v0 -> _v1 -> _v2 */
388  bool _isRounded; /**< true if the corner is to be rounded */
389  Vector _center; /**< center of circle making round corner */
390  float _radius; /**< radius of circle making round corner */
391  double _startTheta, _endTheta; /**< starting and ending theta for arc in circle making round corner */
392  bool _isLeftTurn; /**< true if corners is a left turn else false */
393  Vector _tangent_v0_v1; /**< tangent point of corner circle on v0 -> v1 */
394  Vector _tangent_v1_v2; /**< tangent point of corner circle on v1 -> v2 */
395  };
396 
397  /** array of CornerCircle */
399 
400  /** array of Vector */
402 
403  /** notify that vertices have changed
404  */
405  virtual void VerticesChanged( void );
406 
407  /** notify that the orientation vectors have changed
408  */
409  virtual void OrientationChanged( void );
410 
411  /** get the rotation matrix for the current _orientation vectors
412  * \return the rotation matrix for the current _orientation vectors
413  */
414  virtual GlsMatrixType GetOrientationMatrix( void );
415 
416  /** flag line to be rebuilt on next draw */
417  virtual void SetRebuild( void );
418 
419  /** rebuild the polyline */
420  virtual void Rebuild( void );
421 
422 #ifdef GLES
423  /** prepare and bake the geometry in _interconnectQuads to a VBO as quads and an outline
424  * \param drawFlowUVs true to draw with flow UV's else false to draw with interconnect UV's
425  */
426  virtual void BakeInterconnectGeometry( const bool drawFlowUVs );
427 
428  /** Bakes the VBOS
429  */
430  void BakeVBOs();
431 #else
432  /** emit the geomentry in _interconnectQuads to OpenGL as quads and an outline
433  * \param drawFlowUVs true to draw with flow UV's else false to draw with interconnect UV's
434  */
435  virtual void EmitInterconnectGeometry( const bool drawFlowUVs );
436 
437  /** turn on/off preview Path drawing ( useful for debugging and when the object is selected in the editor )
438  * \param enablePreviewPath true to enable else false
439  */
440  virtual void EnablePreviewPath( const bool enablePreviewPath );
441 
442  /** emit the preview path geometry to GL -- mainly used fir debugging and when the line is selected in the editor */
443  virtual void EmitPreviewPathGeometry( void );
444 #endif
445 
446  /** Eliminate adjacent vertices that are not unique between each other
447  * \param numVertices number of input vertices
448  * \param vertices input vertices
449  * \return array of unique verts
450  */
451  virtual VectorArray GetUniqueVerts( const unsigned int numVertices, Vertex* vertices );
452 
453  /** Find a corner circle that will fit the corner defined by v0 -> v1 -> v2
454  * \param v0 starting point
455  * \param v1 corner point
456  * \param v2 ending point
457  * \param desiredCornerRadius desired radius for corner circle
458  * \param minRadius minimum radius for ccorner circle
459  * \param forceExactCornerRadius true if the corner can only be rounded with a radius equal to the desiredCornerRadius
460  * else false to allow a smaller radius to be used if needed (>minRadius)
461  * \param c [out] receives corner info
462  * \param forceCircle [optional, defaults to false] true to force a rounded corner to be found
463  * (used to avoid lack of precision issues when the circle is tangent at the midpoint of either v0 -> v1, or v1 -> v2
464  * \return true if a rounded corner was found
465  */
466  virtual bool FindCornerCircle( const Vector& v0, const Vector& v1, const Vector& v2, const float desiredCornerRadius, const float minRadius,
467  const bool forceExactCornerRadius, CornerCircle& c, bool forceCircle = false );
468 
469  /** Compute the length of the path described by the given corner array
470  * \param cornerCircles corners in question
471  */
472  virtual float ComputePathLength( CornerCircleArray& cornerCircles );
473 
474  /** Add a line segment to the given array of interconnect verts
475  * \param interconnectVerts receives line segment is start and finish are not virtually the same point
476  * \param start starting point of line segment
477  * \param finish finish point of line segment
478  * \param lineThickness thickness of line segment
479  * \param curLength current length of path at the starting point
480  * \param totalLength total length of path that contains the line segment
481  * \param numInterconnectRepeats number of interconnect texture repeats over entire path that contains the line segment
482  * \param numFlowRepeats number of flow texture repeats over entire path that contains the line segment
483  * \param lastSegmentInPath [optional, defaults to false] true if this line segment is the last in the path
484  */
485  virtual float AddInterconnectLineSegment( InterconnectVertexArray& interconnectVerts, const Vector& start, const Vector& finish, float lineThickness,
486  float curLength, const float totalLength,
487  const unsigned int numInterconnectRepeats, const unsigned int numFlowRepeats,
488  const bool lastSegmentInPath = false );
489 
490  /** Add a rounded to the given array of interconnect verts
491  * \param interconnectVerts receives line segment is start and finish are not virtually the same point
492  * \param c info for rounded corner to add
493  * \param lineThickness thickness of line segment
494  * \param curLength current length of path at the starting point
495  * \param totalLength total length of path that contains the line segment
496  * \param numInterconnectRepeats number of interconnect texture repeats over entire path that contains the line segment
497  * \param numFlowRepeats number of flow texture repeats over entire path that contains the line segment
498  */
499  virtual float AddInterconnectRoundedCorner( InterconnectVertexArray& interconnectVerts, const CornerCircle& c, float lineThickness,
500  float curLength, const float totalLength,
501  const unsigned int numInterconnectRepeats, const unsigned int numFlowRepeats );
502 #ifdef GLES
503  /** Set a single attribute from the GLO file.
504  * \param data The attribute to set and its associated data.
505  */
506  virtual GLSGEN_GLSSCHEMATICPOLYLINEINTERCONNECT_EXPORT void SetFromGloData( GlsGloFileAttribute& data ) DISTI_METHOD_OVERRIDE;
507 #endif
508 
509  Vector _orientation[ 2 ]; /**< Two orthogonal vectors defining the orientation */
510  float _lineThickness; /**< thickness of line in logical units ( >0.0 )*/
511  bool _roundedCorners; /**< true for rounded corners */
512  float _cornerRadius; /**< radius for rounded corners ( >0.0 )*/
513  bool _forceExactCornerRadius; /**< true to force rounded corners to use the exact corner radius
514  * specified by _cornerRadius. If true, a corner that cannot be made with this radius
515  * will not be rounded. */
516  unsigned int _cornerSegments; /**< number of segments to use in rounded corners (2 <= cornerSegments <= 100) */
517  float _interconnectTextureRepeatLength; /**< number of logical units per interconnect texture repeat ( >0.0 )
518  * NOTE: number of actual repeats for the whole interconnect is always rounded
519  * to the nearest whole number so that adjacent interconnect's textures lineup */
520  int _flowTextureIndex; /**< texture index for flow texture else NO_TEXTURE */
521  float _flowTextureRepeatLength; /**< number of logical units per flow texture repeat ( >0.0 )
522  * NOTE: number of actual repeats for the whole interconnect is always rounded
523  * to the nearest whole number so that adjacent interconnect's textures lineup */
524  bool _showFlow; /**< true to draw flow in interconnect else false */
525  float _flowRate; /**< the flow rate in "flow textures" / second */
526  bool _showFlowBlink; /**< true to draw the flow blink else false (NOTE: normal flow is not drawn if flow blink is true) */
527  float _flowBlinkRate; /**< rate of flow blink in hz >= 0.0 */
528  GlsColor _flowBlinkStartColor; /**< starting color for flow blink */
529  GlsColor _flowBlinkEndColor; /**< ending color for flow blink */
530 
531  bool _needsRebuild; /**< true if the line needs to be rebuilt */
532  double _lastCalculateTime; /**< last time stamp given to Calculate() method */
533  InterconnectVertexArray _interconnectVerts; /**< 2D verts and texture coords computed for interconnect */
534 
535 #ifndef GLES
536  bool _useDisplayList; /**< true to draw using display lists */
537  GlsDisplayList _interconnectDisplayList; /**< display list for drawing interconnect (if using display lists) */
538  GlsDisplayList _flowDisplayList; /**< display list for drawing flow (if using display lists) */
539 #endif
540 
541  float _endingChamferDistance; /**< distance from end of last line segment to start chamfer ( 0.0f to disable ) ( >= 0.0f ) */
542 
543  bool _drawPreviewPath; /**< true to draw the preview path (mainly used in editor) */
544  VectorArray _previewPathPoints; /**< points in preview path */
545  CornerCircleArray _previewCornerCircles; /**< corners in preview path */
546 
547 #ifdef GLES
548  GlsTriangleStrip2D _interconnectTris; /**< Triangle strip for the interconnect */
549  GlsTriangleStrip2D _flowTris; /**< Triangle strip for the flows */
550 #endif
551 };
552 
553 } // namespace disti
554 
555 #endif
Definition: cull.h:49
virtual void SetInterconnectTextureIndex(const int interconnectTextureIndex)
Definition: gls_triangle_storage.h:56
DynamicArray< InterconnectVertex > InterconnectVertexArray
Definition: gls_schematic_poly_line_interconnect.h:382
virtual void SetValue(int spec, va_list &args) DISTI_METHOD_OVERRIDE
virtual void Draw(void) DISTI_METHOD_OVERRIDE
virtual void Rotate(const Vector &orig, float angle, const Vector &axis) DISTI_METHOD_OVERRIDE
float _flowTextureRepeatLength
Definition: gls_schematic_poly_line_interconnect.h:521
virtual void SetCornerSegments(const unsigned int cornerSegments)
GlsColor _flowBlinkEndColor
Definition: gls_schematic_poly_line_interconnect.h:529
Vector _orientation[2]
Definition: gls_schematic_poly_line_interconnect.h:509
Definition: vertex.h:409
DynamicArray< CornerCircle > CornerCircleArray
Definition: gls_schematic_poly_line_interconnect.h:398
#define DISTI_DEPRECATED(msg)
Defines whether this compiler supports the C++14 deprecated attribute.
Definition: gls_cpp_lang_support.h:436
bool _isRounded
Definition: gls_schematic_poly_line_interconnect.h:388
virtual void SetCornerRadius(const float cornerRadius)
bool _isLeftTurn
Definition: gls_schematic_poly_line_interconnect.h:392
bool _showFlowBlink
Definition: gls_schematic_poly_line_interconnect.h:526
Definition: dynamic_array.h:66
float _interconnectU
Definition: gls_schematic_poly_line_interconnect.h:366
virtual void Calculate(double time) DISTI_METHOD_OVERRIDE
Class to contain current OpenGL view, projection and draw matrices.
Definition: util.h:471
virtual VectorArray GetUniqueVerts(const unsigned int numVertices, Vertex *vertices)
virtual void SetFlowBlinkEndColor(const GlsColor &endColor)
The Polygon class. Implements Polygons.
Definition: glpolygon.h:55
virtual float ComputePathLength(CornerCircleArray &cornerCircles)
bool _needsRebuild
Definition: gls_schematic_poly_line_interconnect.h:531
Vector _tangent_v0_v1
Definition: gls_schematic_poly_line_interconnect.h:393
GlsColor _flowBlinkStartColor
Definition: gls_schematic_poly_line_interconnect.h:528
virtual void SetInterconnectTextureRepeatLength(const float interconnectTextureRepeatLength)
virtual DisplayObject * handle(DisplayEvent *ev) DISTI_METHOD_OVERRIDE
float _flowU
Definition: gls_schematic_poly_line_interconnect.h:367
GlsDisplayList _flowDisplayList
Definition: gls_schematic_poly_line_interconnect.h:538
bool _drawPreviewPath
Definition: gls_schematic_poly_line_interconnect.h:543
Definition: display.h:98
virtual void GetCppInterfaceDescriptionFree(InterfaceListType *array) DISTI_METHOD_OVERRIDE
virtual GlsColor GetFlowBlinkEndColor(void)
The disti::GLPolygon class. Implements Polygons.
virtual float GetFlowTextureRepeatLength(void)
virtual void SetRoundedCorners(const bool roundedCorners)
virtual void CopyGeometry(DisplayObject *src) DISTI_METHOD_OVERRIDE
float _endingChamferDistance
Definition: gls_schematic_poly_line_interconnect.h:541
bool _roundedCorners
Definition: gls_schematic_poly_line_interconnect.h:511
virtual void EnablePreviewPath(const bool enablePreviewPath)
DynamicArray< Vector > VectorArray
Definition: gls_schematic_poly_line_interconnect.h:401
virtual void GetExtents(float &x, float &y, float &z, float &x1, float &y1, float &z1) DISTI_METHOD_OVERRIDE
InterconnectVertexArray _interconnectVerts
Definition: gls_schematic_poly_line_interconnect.h:533
Definition: gls_display_list.h:50
int _flowTextureIndex
Definition: gls_schematic_poly_line_interconnect.h:520
virtual unsigned int GetCornerSegments(void)
Definition: gls_glo_file.h:988
virtual float AddInterconnectRoundedCorner(InterconnectVertexArray &interconnectVerts, const CornerCircle &c, float lineThickness, float curLength, const float totalLength, const unsigned int numInterconnectRepeats, const unsigned int numFlowRepeats)
virtual InterfaceListType * GetCppInterfaceDescription(InterfaceListType *addToThisList=NULL) DISTI_METHOD_OVERRIDE
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)
virtual void SetVertices(unsigned int nPoints, Vertex *vertices) DISTI_METHOD_OVERRIDE
float _rightY
Definition: gls_schematic_poly_line_interconnect.h:365
virtual void CopyProperties(DisplayObject *src) DISTI_METHOD_OVERRIDE
virtual bool Hit(float x, float y, float z, float scale, const Vector &directionVector, Vector *collisionPoint) DISTI_METHOD_OVERRIDE
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:536
void DeleteVertexAt(unsigned int index) DISTI_METHOD_OVERRIDE
virtual void SetFlowTextureRepeatLength(const float flowTextureRepeatLength)
GlsDisplayList _interconnectDisplayList
Definition: gls_schematic_poly_line_interconnect.h:537
float _radius
Definition: gls_schematic_poly_line_interconnect.h:390
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:370
virtual void SetForceExactCornerRadius(const bool forceExactCornerRadius)
virtual void SetFlowRate(const float flowRate)
float _leftY
Definition: gls_schematic_poly_line_interconnect.h:364
Vector _v2
Definition: gls_schematic_poly_line_interconnect.h:387
virtual GlsMatrixType GetOrientationMatrix(void)
void InsertVertexAt(unsigned int index) DISTI_METHOD_OVERRIDE
Definition: events.h:112
Definition: gls_color.h:53
CornerCircleArray _previewCornerCircles
Definition: gls_schematic_poly_line_interconnect.h:545
float _lineThickness
Definition: gls_schematic_poly_line_interconnect.h:510
virtual DisplayObject * CloneObject(bool generateNames=false) DISTI_METHOD_OVERRIDE
The disti::GlsTriangleStrip2D class.
virtual GlsColor GetFlowBlinkStartColor(void)
The gls_auto_lib.
virtual void SetUseDisplayList(const bool useDisplayList)
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)
Definition: gls_schematic_poly_line_interconnect.h:98
virtual Vertex WorldVertex(unsigned int i) DISTI_METHOD_OVERRIDE
Vector _tangent_v1_v2
Definition: gls_schematic_poly_line_interconnect.h:394
Definition: gls_schematic_poly_line_interconnect.h:385
VectorArray _previewPathPoints
Definition: gls_schematic_poly_line_interconnect.h:544
double _lastCalculateTime
Definition: gls_schematic_poly_line_interconnect.h:532
Definition: vertex.h:84
virtual void PreDraw(const OpenGLMatrices &parentMatrices, Culler &culler) DISTI_METHOD_OVERRIDE
float _cornerRadius
Definition: gls_schematic_poly_line_interconnect.h:512
Vector _center
Definition: gls_schematic_poly_line_interconnect.h:389
virtual void SetOrientationVectors(const Vector &iVector, const Vector &jVector)
virtual void SetAvailableAttributes(unsigned int value) DISTI_METHOD_OVERRIDE
virtual void Scale(float px, float py, float pz, Vertex *anchor, int handleBar=0) DISTI_METHOD_OVERRIDE
float _interconnectTextureRepeatLength
Definition: gls_schematic_poly_line_interconnect.h:517
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:525
Macros and helper code to determine what subset of C++11/14/17 is available.
float _flowBlinkRate
Definition: gls_schematic_poly_line_interconnect.h:527
double _endTheta
Definition: gls_schematic_poly_line_interconnect.h:391
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:516
virtual void EmitInterconnectGeometry(const bool drawFlowUVs)
The disti::GlsDisplayList class.
bool _forceExactCornerRadius
Definition: gls_schematic_poly_line_interconnect.h:513
virtual float GetEndingChamferDistance(void)
Definition: gls_schematic_poly_line_interconnect.h:362
bool _showFlow
Definition: gls_schematic_poly_line_interconnect.h:524
virtual void SetLineThickness(const float lineThickness)
virtual void CalculateTextureCoordinates(void) DISTI_METHOD_OVERRIDE