

Public Member Functions | |
| PolylineInterpColorDrawerGL () | |
| void | drawPolyline (double[] xCoords, double[] yCoords, double[] zCoords, int[] colors) |
| boolean | isZConstant () |
Private Member Functions | |
| boolean | checkIfZconstant (double[] zCoords) |
Private Attributes | |
| boolean | isZconstant |
Static Private Attributes | |
| static final int | TRIANGLE_NB_EDGE = 3 |
Definition at line 33 of file PolylineInterpColorDrawerGL.java.
| org::scilab::modules::renderer::polylineDrawing::PolylineInterpColorDrawerGL::PolylineInterpColorDrawerGL | ( | ) | [inline] |
Default constructor
Definition at line 42 of file PolylineInterpColorDrawerGL.java.
References isZconstant.
00042 { 00043 super(); 00044 isZconstant = false; 00045 }
| void org::scilab::modules::renderer::polylineDrawing::PolylineInterpColorDrawerGL::drawPolyline | ( | double[] | xCoords, | |
| double[] | yCoords, | |||
| double[] | zCoords, | |||
| int[] | colors | |||
| ) | [inline] |
Create the display list for the polyline
| xCoords | X coordinates of the polylines vertices | |
| yCoords | Y coordinates of the polylines vertices | |
| zCoords | Z coordinates of the polylines vertices | |
| colors | colors index for each vertex |
Definition at line 54 of file PolylineInterpColorDrawerGL.java.
References checkIfZconstant(), org::scilab::modules::renderer::utils::ColorMap::convertScilabToColorMapIndex(), org::scilab::modules::renderer::utils::CoordinateTransformation::endPushPolygonsBack(), org::scilab::modules::renderer::ObjectGL::getColorMap(), org::scilab::modules::renderer::figureDrawing::DrawableFigureGL::getCoordinateTransformation(), org::scilab::modules::renderer::ObjectGL::getGL(), org::scilab::modules::renderer::ObjectGL::getParentFigureGL(), org::scilab::modules::renderer::figureDrawing::DrawableFigureGL::getShadeFacetDrawer(), org::scilab::modules::renderer::utils::TexturedColorMap::getTexture(), i, org::scilab::modules::renderer::polylineDrawing::ShadeFacetDrawer::paintPolygon(), org::scilab::modules::renderer::utils::CoordinateTransformation::pushPolygonsBack(), and TRIANGLE_NB_EDGE.
00055 { 00056 00057 // check if Z is constant 00058 this.isZconstant = checkIfZconstant(zCoords); 00059 00060 GL gl = getGL(); 00061 00062 Vector3D[] vertices = new Vector3D[xCoords.length]; 00063 for (int i = 0; i < xCoords.length; i++) { 00064 vertices[i] = new Vector3D(xCoords[i], yCoords[i], zCoords[i]); 00065 // colors are Scilab indices 00066 colors[i] = getColorMap().convertScilabToColorMapIndex(colors[i]); 00067 } 00068 00069 ShadeFacetDrawer sfd = getParentFigureGL().getShadeFacetDrawer(); 00070 00071 // push polygons back if needed 00072 CoordinateTransformation transform = getParentFigureGL().getCoordinateTransformation(); 00073 transform.pushPolygonsBack(gl, this); 00074 00075 Texture colorMapTexture = getColorMap().getTexture(); 00076 colorMapTexture.enable(); 00077 colorMapTexture.bind(); 00078 00079 gl.glBegin(GL.GL_TRIANGLES); 00080 00081 if (vertices.length == TRIANGLE_NB_EDGE) { 00082 // only a triangle 00083 sfd.paintPolygon(vertices, colors, gl, getColorMap()); 00084 00085 } else { 00086 00087 // its a quad, decompose it into 2 triangles 00088 Vector3D[] triangle1 = new Vector3D[TRIANGLE_NB_EDGE]; 00089 Vector3D[] triangle2 = new Vector3D[TRIANGLE_NB_EDGE]; 00090 int[] colorT1 = new int[TRIANGLE_NB_EDGE]; 00091 int[] colorT2 = new int[TRIANGLE_NB_EDGE]; 00092 GeomAlgos.decomposeQuad(vertices, colors, triangle1, colorT1, triangle2, colorT2); 00093 00094 // draw the two decomposed triangles 00095 sfd.paintPolygon(triangle1, colorT1, gl, getColorMap()); 00096 sfd.paintPolygon(triangle2, colorT2, gl, getColorMap()); 00097 } 00098 gl.glEnd(); 00099 00100 colorMapTexture.disable(); 00101 00102 transform.endPushPolygonsBack(gl, this); 00103 }

| boolean org::scilab::modules::renderer::polylineDrawing::PolylineInterpColorDrawerGL::checkIfZconstant | ( | double[] | zCoords | ) | [inline, private] |
Check if the z coordinate of the polyline is constant
| zCoords | z coordinates of the polyline vertices |
Definition at line 110 of file PolylineInterpColorDrawerGL.java.
References i.
Referenced by drawPolyline().
00110 { 00111 for (int i = 0; i < zCoords.length; i++) { 00112 if (zCoords[0] != zCoords[i]) { 00113 return false; 00114 } 00115 } 00116 return true; 00117 }

| boolean org::scilab::modules::renderer::polylineDrawing::PolylineInterpColorDrawerGL::isZConstant | ( | ) | [inline] |
This method is used to know if polygon offset is needed in 2d mode. If this function returns true, then the polygon offset is not needed in 2d mode. If it returns false, polygon offset is always needed.
Reimplemented from org::scilab::modules::renderer::drawers::FillDrawerGL.
Definition at line 125 of file PolylineInterpColorDrawerGL.java.
References isZconstant.
00125 { 00126 return isZconstant; 00127 }
final int org::scilab::modules::renderer::polylineDrawing::PolylineInterpColorDrawerGL::TRIANGLE_NB_EDGE = 3 [static, private] |
boolean org::scilab::modules::renderer::polylineDrawing::PolylineInterpColorDrawerGL::isZconstant [private] |
Definition at line 37 of file PolylineInterpColorDrawerGL.java.
Referenced by isZConstant(), and PolylineInterpColorDrawerGL().
1.5.5