Geometry

I2Djs provides a way to define custom geometry using a set of inbuilt geometry APIs. Geometries are used along with custom shader to create out of the box effects.

I2Djs provides APIs for Mesh, line, and points geometry.

Mesh Geometry:

Used for rendering mesh geometrical polygons. Default drawType is 'TRIANGLES'. Possible values are 'TRIANGLES' , 'TRIANGLE_STRIP' and 'TRIANGLE_FAN'.

meshInstance = new MeshGeometry();

Example of Mesh Geometry:

meshInstance = new MeshGeometry();

geometry.setAttr('a_position', {
		value: new Float32Array([]),
		size: 2
	});
	
geometry.setDrawRange(0, 6);

Line Geometry:

Used for rendering Line geometrical entities like lines, polylines. Default drayType is 'LINE'. Possible values are 'LINE', 'LINE_STRIP' and 'LINE_LOOP'.

lineInstance = new LineGeometry();

Example of Line Geometry :

lineInstance = new LineGeometry();

geometry.setAttr('a_position', {
		value: new Float32Array([]),
		size: 2
	});
	
geometry.setDrawRange(0, 6);

Points Geometry:

Used in rendering points. Default drawType is 'POINT'.

geometry = new PointsGeometry();

Example of Points Geometry :

geometry = new PointsGeometry();
geometry.setAttr('a_color', {
		value: new Float32Array([255,255,255,255]),
		size: 4
	});
geometry.setAttr('a_size', {
		value: new Float32Array([10]),
		size: 1
	});
geometry.setAttr('a_position', {
		value: new Float32Array([30,40]),
		size: 2
	});

Last updated