Commit | Line | Data |
---|---|---|

b311480e | 1 | -- Created on: 2009-12-10 |

2 | -- Created by: Paul SUPRYATKIN | |

973c2be1 | 3 | -- Copyright (c) 2009-2014 OPEN CASCADE SAS |

b311480e | 4 | -- |

973c2be1 | 5 | -- This file is part of Open CASCADE Technology software library. |

b311480e | 6 | -- |

973c2be1 | 7 | -- This library is free software; you can redistribute it and / or modify it |

8 | -- under the terms of the GNU Lesser General Public version 2.1 as published | |

9 | -- by the Free Software Foundation, with special exception defined in the file | |

10 | -- OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT | |

11 | -- distribution for complete text of the license and disclaimer of any warranty. | |

b311480e | 12 | -- |

973c2be1 | 13 | -- Alternatively, this file may be used under the terms of Open CASCADE |

14 | -- commercial license or contractual agreement. | |

7fd59977 | 15 | |

16 | class Triangulation from AIS inherits InteractiveObject from AIS | |

17 | ||

18 | ||

19 | ---Purpose: Interactive object that draws data from Poly_Triangulation, optionally with colors associated | |

20 | -- with each triangulation vertex. For maximum efficiency colors are represented as 32-bit integers | |

21 | -- instead of classic Quantity_Color values. | |

22 | -- Interactive selection of triangles and vertices is not yet implemented. | |

23 | ||

24 | ||

25 | uses | |

26 | Triangulation from Poly, | |

27 | HArray1OfInteger from TColStd, | |

28 | Presentation from Prs3d, | |

29 | PresentationManager3d from PrsMgr, | |

30 | Selection from SelectMgr | |

31 | ||

32 | is | |

33 | ||

34 | Create(aTriangulation : Triangulation from Poly) | |

35 | returns Triangulation from AIS; | |

36 | ---Purpose: Constructs the Triangulation display object | |

37 | ||

38 | -- -- Methods from PresentableObject | |

39 | ||

40 | Compute(me : mutable; | |

41 | aPresentationManager : PresentationManager3d from PrsMgr; | |

42 | aPresentation : mutable Presentation from Prs3d; | |

43 | aMode : Integer from Standard = 0) | |

44 | is redefined private; | |

45 | ||

46 | -- Methods from SelectableObject | |

47 | ||

48 | ComputeSelection(me : mutable; | |

49 | aSelection : mutable Selection from SelectMgr; | |

50 | aMode : Integer from Standard) | |

51 | is redefined private; | |

52 | --- Empty implementation, does nothing | |

53 | ||

54 | SetColors(me : mutable; | |

55 | aColor : HArray1OfInteger from TColStd); | |

56 | ---Level: Public | |

57 | ---Purpose: | |

58 | -- Set the color for each node. | |

59 | -- Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red | |

60 | -- Order of color components is essential for further usage by OpenGL | |

61 | ||

62 | GetColors(me) | |

63 | ---Level: Public | |

64 | ---Purpose: | |

65 | -- Get the color for each node. | |

66 | -- Each 32-bit color is Alpha << 24 + Blue << 16 + Green << 8 + Red | |

67 | ||

68 | returns HArray1OfInteger from TColStd; | |

69 | ||

70 | ||

71 | SetTriangulation( me : mutable; | |

72 | aTriangulation : Triangulation from Poly); | |

73 | ---Level: Public | |

74 | ||

75 | ||

76 | GetTriangulation( me ) | |

77 | returns Triangulation from Poly; | |

78 | ---Level: Public | |

79 | ---Purpose: Returns Poly_Triangulation . | |

80 | ||

81 | AttenuateColor( me : mutable; | |

82 | aColor : Integer from Standard; | |

83 | aComponent : Real from Standard ) | |

84 | returns Integer from Standard | |

85 | is private; | |

86 | ---Level: Private | |

87 | ---Purpose: Attenuates 32-bit color by a given attenuation factor (0...1): | |

88 | -- aColor = Alpha << 24 + Blue << 16 + Green << 8 + Red | |

89 | -- All color components are multiplied by aComponent, the result is then packed again as 32-bit integer. | |

90 | -- Color attenuation is applied to the vertex colors in order to have correct visual result | |

91 | -- after glColorMaterial(GL_AMBIENT_AND_DIFFUSE). Without it, colors look unnatural and flat. | |

92 | ||

93 | ||

94 | fields | |

95 | ||

96 | myTriangulation : Triangulation from Poly; | |

97 | myColor : HArray1OfInteger from TColStd; | |

98 | myFlagColor : Integer from Standard; | |

99 | myNbNodes : Integer from Standard; | |

100 | myNbTriangles : Integer from Standard; | |

101 | ||

102 | end Triangulation; |