plane.ts 804 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. import { Primitive } from './primitive';
  7. import { Cage } from './cage';
  8. const plane: Primitive = {
  9. vertices: new Float32Array([
  10. -0.5, 0.5, 0,
  11. 0.5, 0.5, 0,
  12. -0.5, -0.5, 0,
  13. 0.5, -0.5, 0
  14. ]),
  15. normals: new Float32Array([
  16. 0, 0, 1,
  17. 0, 0, 1,
  18. 0, 0, 1,
  19. 0, 0, 1
  20. ]),
  21. indices: new Uint32Array([
  22. 0, 2, 1,
  23. 1, 2, 3
  24. ])
  25. };
  26. const planeCage: Cage = {
  27. vertices: plane.vertices,
  28. edges: new Uint32Array([0, 1, 2, 3, 3, 1, 2, 0])
  29. };
  30. export function Plane(): Primitive {
  31. return plane;
  32. }
  33. export function PlaneCage(): Cage {
  34. return planeCage;
  35. }