combine

abstract fun combine(coords: DoubleArray?, data: Array<Any?>?, weight: FloatArray?, outData: Array<Any?>?)(source)

The combine callback method is called to create a new vertex when the tessellation detects an intersection, or wishes to merge features. The method takes four arguments: an array of three elements each of type double, an array of four references, an array of four elements each of type float, and a reference to a reference.

The vertex is defined as a linear combination of up to four existing vertices, stored in data. The coefficients of the linear combination are given by weight; these weights always add up to 1. All vertex pointers are valid even when some of the weights are 0. coords gives the location of the new vertex.

The user must allocate another vertex, interpolate parameters using data and weight, and return the new vertex pointer in outData. This handle is supplied during rendering callbacks. The user is responsible for freeing the memory some time after GLU.gluTessEndPolygon is called.

For example, if the polygon lies in an arbitrary plane in 3-space, and a color is associated with each vertex, the GLU_TESS_COMBINE callback might look like this:

*
void myCombine(double[] coords, Object[] data,
float[] weight, Object[] outData)
{
MyVertex newVertex = new MyVertex();

newVertex.x = coords0; newVertex.y = coords1; newVertex.z = coords2; newVertex.r = weight0*data0.r + weight1*data1.r + weight2*data2.r + weight3*data3.r; newVertex.g = weight0*data0.g + weight1*data1.g + weight2*data2.g + weight3*data3.g; newVertex.b = weight0*data0.b + weight1*data1.b + weight2*data2.b + weight3*data3.b; newVertex.a = weight0*data0.a + weight1*data1.a + weight2*data2.a + weight3*data3.a; outData = newVertex; }

Parameters

coords

Specifics the location of the new vertex.

data

Specifics the vertices used to create the new vertex.

weight

Specifics the weights used to create the new vertex.

outData

Reference user the put the coodinates of the new vertex.

See also

GLU.gluTessCallback

gluTessCallback

.combineData combineData