Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. const e1 = EIGHT.Geometric3.e1()
  2. const e2 = EIGHT.Geometric3.e2()
  3. const e3 = EIGHT.Geometric3.e3()
  4.  
  5. export interface Bivector extends EIGHT.Renderable {
  6. a: EIGHT.Geometric3;
  7. b: EIGHT.Geometric3;
  8. }
  9.  
  10. export default function bivector(contextManager: EIGHT.ContextManager): Bivector {
  11. let sceneName: string;
  12. const arrow = new EIGHT.Arrow({contextManager});
  13. const darea = new EIGHT.Parallelepiped(contextManager);
  14. darea.a = e1
  15. darea.b = e2
  16. darea.c = 0.01 * e3
  17.  
  18. darea.opacity = 0.5
  19. darea.transparent = true;
  20. const color = EIGHT.Color.blueviolet.clone().scale(0.05)
  21. darea.colors[0] = color
  22. darea.colors[1] = color
  23. darea.colors[2] = color
  24. darea.colors[3] = color
  25. darea.colors[4] = color
  26. darea.colors[5] = color
  27.  
  28. let refCount = 0;
  29. const addRef = function(): number {
  30. refCount++;
  31. return refCount;
  32. }
  33. const release = function(): number {
  34. refCount--;
  35. if (refCount === 0) {
  36.  
  37. }
  38. return refCount;
  39. }
  40. const render = function(ambients: EIGHT.Facet[]): void {
  41. // TODO: We really need a parameter that tells us whether
  42. // this is the non-transparent pass (1st), or transparent pass (2nd)
  43. arrow.h = darea.a;
  44. arrow.X = darea.X - 0.5 * darea.a - 0.5 * darea.b
  45. arrow.color = EIGHT.Color.red;
  46. arrow.render(ambients);
  47.  
  48. arrow.h = darea.b;
  49. arrow.X = darea.X + 0.5 * darea.a - 0.5 * darea.b
  50. arrow.color = EIGHT.Color.blue;
  51. arrow.render(ambients);
  52.  
  53. darea.render(ambients);
  54. }
  55. const that: Bivector = {
  56. a: darea.a,
  57. b: darea.b,
  58. get name(): string {
  59. return sceneName;
  60. },
  61. get transparent(): boolean {
  62. return false;
  63. },
  64. addRef,
  65. release,
  66. render
  67. }
  68. return Object.freeze(that);
  69. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement