UNPKG

@polygonjs/polygonjs

Version:

node-based WebGL 3D engine https://polygonjs.com

28 lines (25 loc) 969 B
import {CoreObjectType, ObjectContent} from '../../ObjectContent'; import {CsgPrimitive} from './CsgPrimitive'; import {CsgGeometryType, CsgTypeMap} from './CsgCommon'; import {CsgObject} from './CsgObject'; export class CsgPrimitiveGeom3 extends CsgPrimitive<CsgGeometryType.GEOM3> { constructor(object: CsgObject<CsgGeometryType.GEOM3>, index: number) { super(object, index); } static primitiveName() { return 'polygon'; } static override entitiesCount<T extends CoreObjectType>(object: ObjectContent<T>) { const csgOobject = object as any as CsgObject<CsgGeometryType.GEOM3>; const geometry = csgOobject.geometry as CsgTypeMap[CsgGeometryType.GEOM3]; return geometry.polygons.length; } // position(target: Vector3): Vector3 { // console.warn('CsgPrimitiveGeom3.position not implemented'); // return target; // } // normal(target: Vector3): Vector3 { // console.warn('CsgPrimitiveGeom3.normal not implemented'); // return target; // } }