geometry done
parent
123b89cf26
commit
f20ed1760f
|
@ -335,61 +335,63 @@ GameLib.Component.MATERIAL_BASIC = 0x66;
|
||||||
GameLib.Component.TEXTURE = 0x67;
|
GameLib.Component.TEXTURE = 0x67;
|
||||||
GameLib.Component.MATERIAL_PHONG = 0x68;
|
GameLib.Component.MATERIAL_PHONG = 0x68;
|
||||||
|
|
||||||
GameLib.Component.GEOMETRY = 0x69;
|
GameLib.Component.GEOMETRY_NORMAL = 0x69;
|
||||||
GameLib.Component.GEOMETRY_BOX = 0x6a;
|
GameLib.Component.GEOMETRY_NORMAL_BOX = 0x6a;
|
||||||
GameLib.Component.GEOMETRY_CIRCLE = 0x6b;
|
GameLib.Component.GEOMETRY_NORMAL_CIRCLE = 0x6b;
|
||||||
GameLib.Component.GEOMETRY_CONE = 0x6c;
|
GameLib.Component.GEOMETRY_NORMAL_CONE = 0x6c;
|
||||||
GameLib.Component.GEOMETRY_CYLINDER = 0x6d;
|
GameLib.Component.GEOMETRY_NORMAL_CYLINDER = 0x6d;
|
||||||
GameLib.Component.GEOMETRY_DODECAHEDRON = 0x6e;
|
GameLib.Component.GEOMETRY_NORMAL_DODECAHEDRON = 0x6e;
|
||||||
GameLib.Component.GEOMETRY_EDGES = 0x6f;
|
GameLib.Component.GEOMETRY_NORMAL_EDGES = 0x6f;
|
||||||
GameLib.Component.GEOMETRY_EXTRUDE = 0x70;
|
GameLib.Component.GEOMETRY_NORMAL_EXTRUDE = 0x70;
|
||||||
GameLib.Component.GEOMETRY_ICOSAHEDRON = 0x71;
|
GameLib.Component.GEOMETRY_NORMAL_ICOSAHEDRON = 0x71;
|
||||||
GameLib.Component.GEOMETRY_LATHE = 0x72;
|
GameLib.Component.GEOMETRY_NORMAL_LATHE = 0x72;
|
||||||
GameLib.Component.GEOMETRY_OCTAHEDRON = 0x73;
|
GameLib.Component.GEOMETRY_NORMAL_OCTAHEDRON = 0x73;
|
||||||
GameLib.Component.GEOMETRY_PARAMETRIC = 0x74;
|
GameLib.Component.GEOMETRY_NORMAL_PARAMETRIC = 0x74;
|
||||||
GameLib.Component.GEOMETRY_PLANE = 0x75;
|
GameLib.Component.GEOMETRY_NORMAL_PLANE = 0x75;
|
||||||
GameLib.Component.GEOMETRY_POLYHEDRON = 0x76;
|
GameLib.Component.GEOMETRY_NORMAL_POLYHEDRON = 0x76;
|
||||||
GameLib.Component.GEOMETRY_RING = 0x77;
|
GameLib.Component.GEOMETRY_NORMAL_RING = 0x77;
|
||||||
GameLib.Component.GEOMETRY_SHAPE = 0x78;
|
GameLib.Component.GEOMETRY_NORMAL_SHAPE = 0x78;
|
||||||
GameLib.Component.GEOMETRY_SPHERE = 0x79;
|
GameLib.Component.GEOMETRY_NORMAL_SPHERE = 0x79;
|
||||||
GameLib.Component.GEOMETRY_TETRAHEDRON = 0x7a;
|
GameLib.Component.GEOMETRY_NORMAL_TETRAHEDRON = 0x7a;
|
||||||
GameLib.Component.GEOMETRY_TEXT = 0x7b;
|
GameLib.Component.GEOMETRY_NORMAL_TEXT = 0x7b;
|
||||||
GameLib.Component.GEOMETRY_TORUS = 0x7c;
|
GameLib.Component.GEOMETRY_NORMAL_TORUS = 0x7c;
|
||||||
GameLib.Component.GEOMETRY_TORUS_KNOT = 0x7d;
|
GameLib.Component.GEOMETRY_NORMAL_TORUS_KNOT = 0x7d;
|
||||||
GameLib.Component.GEOMETRY_TUBE = 0x7e;
|
GameLib.Component.GEOMETRY_NORMAL_TUBE = 0x7e;
|
||||||
GameLib.Component.GEOMETRY_WIREFRAME = 0x7f;
|
GameLib.Component.GEOMETRY_NORMAL_WIREFRAME = 0x7f;
|
||||||
|
|
||||||
GameLib.Component.BUFFER_GEOMETRY = 0x80;
|
GameLib.Component.GEOMETRY_BUFFER = 0x80;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_BOX = 0x81;
|
GameLib.Component.GEOMETRY_BUFFER_BOX = 0x81;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_CIRCLE = 0x82;
|
GameLib.Component.GEOMETRY_BUFFER_CIRCLE = 0x82;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_CONE = 0x83;
|
GameLib.Component.GEOMETRY_BUFFER_CONE = 0x83;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_CYLINDER = 0x84;
|
GameLib.Component.GEOMETRY_BUFFER_CYLINDER = 0x84;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_DODECAHEDRON = 0x85;
|
GameLib.Component.GEOMETRY_BUFFER_DODECAHEDRON = 0x85;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_EXTRUDE = 0x86;
|
GameLib.Component.GEOMETRY_BUFFER_EXTRUDE = 0x86;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_ICOSAHEDRON = 0x87;
|
GameLib.Component.GEOMETRY_BUFFER_ICOSAHEDRON = 0x87;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_LATHE = 0x88;
|
GameLib.Component.GEOMETRY_BUFFER_LATHE = 0x88;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_OCTAHEDRON = 0x89;
|
GameLib.Component.GEOMETRY_BUFFER_OCTAHEDRON = 0x89;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_PARAMETRIC = 0x8a;
|
GameLib.Component.GEOMETRY_BUFFER_PARAMETRIC = 0x8a;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_PLANE = 0x8b;
|
GameLib.Component.GEOMETRY_BUFFER_PLANE = 0x8b;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_POLYHEDRON = 0x8c;
|
GameLib.Component.GEOMETRY_BUFFER_POLYHEDRON = 0x8c;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_RING = 0x8d;
|
GameLib.Component.GEOMETRY_BUFFER_RING = 0x8d;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_SHAPE = 0x8e;
|
GameLib.Component.GEOMETRY_BUFFER_SHAPE = 0x8e;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_SPHERE = 0x8f;
|
GameLib.Component.GEOMETRY_BUFFER_SPHERE = 0x8f;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_TETRAHEDRON = 0x90;
|
GameLib.Component.GEOMETRY_BUFFER_TETRAHEDRON = 0x90;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_TEXT = 0x91;
|
GameLib.Component.GEOMETRY_BUFFER_TEXT = 0x91;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_TORUS = 0x92;
|
GameLib.Component.GEOMETRY_BUFFER_TORUS = 0x92;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_TORUS_KNOT = 0x93;
|
GameLib.Component.GEOMETRY_BUFFER_TORUS_KNOT = 0x93;
|
||||||
GameLib.Component.BUFFER_GEOMETRY_TUBE = 0x94;
|
GameLib.Component.GEOMETRY_BUFFER_TUBE = 0x94;
|
||||||
|
|
||||||
GameLib.Component.CURVE = 0x95;
|
GameLib.Component.GEOMETRY = 0x95;
|
||||||
GameLib.Component.CURVE_PATH = 0x96;
|
|
||||||
GameLib.Component.CURVE_PATH_D2 = 0x97;
|
|
||||||
GameLib.Component.CURVE_PATH_D2_SHAPE = 0x98;
|
|
||||||
GameLib.Component.BOX3 = 0x99;
|
|
||||||
GameLib.Component.DRAW_RANGE = 0x9a;
|
|
||||||
GameLib.Component.GROUP = 0x9b;
|
|
||||||
|
|
||||||
GameLib.Component.MAX_COMPONENTS = 0x9c;
|
GameLib.Component.CURVE = 0x96;
|
||||||
|
GameLib.Component.CURVE_PATH = 0x97;
|
||||||
|
GameLib.Component.CURVE_PATH_D2 = 0x98;
|
||||||
|
GameLib.Component.CURVE_PATH_D2_SHAPE = 0x99;
|
||||||
|
GameLib.Component.BOX3 = 0x9a;
|
||||||
|
GameLib.Component.DRAW_RANGE = 0x9b;
|
||||||
|
GameLib.Component.GROUP = 0x9c;
|
||||||
|
|
||||||
|
GameLib.Component.MAX_COMPONENTS = 0x9d;
|
||||||
|
|
||||||
GameLib.Component.GRAPHICS_RUNTIME = 0x1;
|
GameLib.Component.GRAPHICS_RUNTIME = 0x1;
|
||||||
GameLib.Component.PHYSICS_RUNTIME = 0x2;
|
GameLib.Component.PHYSICS_RUNTIME = 0x2;
|
||||||
|
@ -1035,306 +1037,312 @@ GameLib.Component.GetComponentInfo = function(number) {
|
||||||
apiConstructor : GameLib.D3.API.Material.Phong
|
apiConstructor : GameLib.D3.API.Material.Phong
|
||||||
};
|
};
|
||||||
case 0x69 : return {
|
case 0x69 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal
|
||||||
|
};
|
||||||
|
case 0x6a : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Box',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Box,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Box
|
||||||
|
};
|
||||||
|
case 0x6b : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Circle',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Circle,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Circle
|
||||||
|
};
|
||||||
|
case 0x6c : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Cone',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Cone,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Cone
|
||||||
|
};
|
||||||
|
case 0x6d : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Cylinder',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Cylinder,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Cylinder
|
||||||
|
};
|
||||||
|
case 0x6e : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Dodecahedron',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Dodecahedron,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Dodecahedron
|
||||||
|
};
|
||||||
|
case 0x6f : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Edges',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Edges,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Edges
|
||||||
|
};
|
||||||
|
case 0x70 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Extrude',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Extrude,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Extrude
|
||||||
|
};
|
||||||
|
case 0x71 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Icosahedron',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Icosahedron,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Icosahedron
|
||||||
|
};
|
||||||
|
case 0x72 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Lathe',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Lathe,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Lathe
|
||||||
|
};
|
||||||
|
case 0x73 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Octahedron',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Octahedron,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Octahedron
|
||||||
|
};
|
||||||
|
case 0x74 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Parametric',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Parametric,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Parametric
|
||||||
|
};
|
||||||
|
case 0x75 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Plane',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Plane,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Plane
|
||||||
|
};
|
||||||
|
case 0x76 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Polyhedron',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Polyhedron,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Polyhedron
|
||||||
|
};
|
||||||
|
case 0x77 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Ring',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Ring,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Ring
|
||||||
|
};
|
||||||
|
case 0x78 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Shape',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Shape,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Shape
|
||||||
|
};
|
||||||
|
case 0x79 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Sphere',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Sphere,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Sphere
|
||||||
|
};
|
||||||
|
case 0x7a : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Tetrahedron',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Tetrahedron,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Tetrahedron
|
||||||
|
};
|
||||||
|
case 0x7b : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Text',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Text,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Text
|
||||||
|
};
|
||||||
|
case 0x7c : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Torus',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Torus,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Torus
|
||||||
|
};
|
||||||
|
case 0x7d : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.TorusKnot',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.TorusKnot,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.TorusKnot
|
||||||
|
};
|
||||||
|
case 0x7e : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Tube',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Tube,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Tube
|
||||||
|
};
|
||||||
|
case 0x7f : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Normal.Wireframe',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Normal.Wireframe,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Normal.Wireframe
|
||||||
|
};
|
||||||
|
case 0x80 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer
|
||||||
|
};
|
||||||
|
case 0x81 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Box',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Box,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Box
|
||||||
|
};
|
||||||
|
case 0x82 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Circle',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Circle,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Circle
|
||||||
|
};
|
||||||
|
case 0x83 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Cone',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Cone,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Cone
|
||||||
|
};
|
||||||
|
case 0x84 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Cylinder',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Cylinder,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Cylinder
|
||||||
|
};
|
||||||
|
case 0x85 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Dodecahedron',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Dodecahedron,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Dodecahedron
|
||||||
|
};
|
||||||
|
case 0x86 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Extrude',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Extrude,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Extrude
|
||||||
|
};
|
||||||
|
case 0x87 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Icosahedron',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Icosahedron,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Icosahedron
|
||||||
|
};
|
||||||
|
case 0x88 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Lathe',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Lathe,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Lathe
|
||||||
|
};
|
||||||
|
case 0x89 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Octahedron',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Octahedron,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Octahedron
|
||||||
|
};
|
||||||
|
case 0x8a : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Parametric',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Parametric,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Parametric
|
||||||
|
};
|
||||||
|
case 0x8b : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Plane',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Plane,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Plane
|
||||||
|
};
|
||||||
|
case 0x8c : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Polyhedron',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Polyhedron,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Polyhedron
|
||||||
|
};
|
||||||
|
case 0x8d : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Ring',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Ring,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Ring
|
||||||
|
};
|
||||||
|
case 0x8e : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Shape',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Shape,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Shape
|
||||||
|
};
|
||||||
|
case 0x8f : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Sphere',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Sphere,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Sphere
|
||||||
|
};
|
||||||
|
case 0x90 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Tetrahedron',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Tetrahedron,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Tetrahedron
|
||||||
|
};
|
||||||
|
case 0x91 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Text',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Text,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Text
|
||||||
|
};
|
||||||
|
case 0x92 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Torus',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Torus,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Torus
|
||||||
|
};
|
||||||
|
case 0x93 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.TorusKnot',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.TorusKnot,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.TorusKnot
|
||||||
|
};
|
||||||
|
case 0x94 : return {
|
||||||
|
name : 'GameLib.D3.Geometry.Buffer.Tube',
|
||||||
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
|
constructor : GameLib.D3.Geometry.Buffer.Tube,
|
||||||
|
apiConstructor : GameLib.D3.API.Geometry.Buffer.Tube
|
||||||
|
};
|
||||||
|
case 0x95 : return {
|
||||||
name : 'GameLib.D3.Geometry',
|
name : 'GameLib.D3.Geometry',
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
constructor : GameLib.D3.Geometry,
|
constructor : GameLib.D3.Geometry,
|
||||||
apiConstructor : GameLib.D3.API.Geometry
|
apiConstructor : GameLib.D3.API.Geometry
|
||||||
};
|
};
|
||||||
case 0x6a : return {
|
case 0x96 : return {
|
||||||
name : 'GameLib.D3.Geometry.Box',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Box,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Box
|
|
||||||
};
|
|
||||||
case 0x6b : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Circle',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Circle,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Circle
|
|
||||||
};
|
|
||||||
case 0x6c : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Cone',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Cone,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Cone
|
|
||||||
};
|
|
||||||
case 0x6d : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Cylinder',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Cylinder,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Cylinder
|
|
||||||
};
|
|
||||||
case 0x6e : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Dodecahedron',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Dodecahedron,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Dodecahedron
|
|
||||||
};
|
|
||||||
case 0x6f : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Edges',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Edges,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Edges
|
|
||||||
};
|
|
||||||
case 0x70 : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Extrude',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Extrude,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Extrude
|
|
||||||
};
|
|
||||||
case 0x71 : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Icosahedron',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Icosahedron,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Icosahedron
|
|
||||||
};
|
|
||||||
case 0x72 : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Lathe',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Lathe,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Lathe
|
|
||||||
};
|
|
||||||
case 0x73 : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Octahedron',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Octahedron,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Octahedron
|
|
||||||
};
|
|
||||||
case 0x74 : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Parametric',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Parametric,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Parametric
|
|
||||||
};
|
|
||||||
case 0x75 : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Plane',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Plane,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Plane
|
|
||||||
};
|
|
||||||
case 0x76 : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Polyhedron',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Polyhedron,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Polyhedron
|
|
||||||
};
|
|
||||||
case 0x77 : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Ring',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Ring,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Ring
|
|
||||||
};
|
|
||||||
case 0x78 : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Shape',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Shape,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Shape
|
|
||||||
};
|
|
||||||
case 0x79 : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Sphere',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Sphere,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Sphere
|
|
||||||
};
|
|
||||||
case 0x7a : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Tetrahedron',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Tetrahedron,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Tetrahedron
|
|
||||||
};
|
|
||||||
case 0x7b : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Text',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Text,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Text
|
|
||||||
};
|
|
||||||
case 0x7c : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Torus',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Torus,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Torus
|
|
||||||
};
|
|
||||||
case 0x7d : return {
|
|
||||||
name : 'GameLib.D3.Geometry.TorusKnot',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.TorusKnot,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.TorusKnot
|
|
||||||
};
|
|
||||||
case 0x7e : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Tube',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Tube,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Tube
|
|
||||||
};
|
|
||||||
case 0x7f : return {
|
|
||||||
name : 'GameLib.D3.Geometry.Wireframe',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.Geometry.Wireframe,
|
|
||||||
apiConstructor : GameLib.D3.API.Geometry.Wireframe
|
|
||||||
};
|
|
||||||
case 0x80 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry
|
|
||||||
};
|
|
||||||
case 0x81 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Box',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Box,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Box
|
|
||||||
};
|
|
||||||
case 0x82 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Circle',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Circle,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Circle
|
|
||||||
};
|
|
||||||
case 0x83 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Cone',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Cone,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Cone
|
|
||||||
};
|
|
||||||
case 0x84 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Cylinder',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Cylinder,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Cylinder
|
|
||||||
};
|
|
||||||
case 0x85 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Dodecahedron',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Dodecahedron,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Dodecahedron
|
|
||||||
};
|
|
||||||
case 0x86 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Extrude',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Extrude,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Extrude
|
|
||||||
};
|
|
||||||
case 0x87 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Icosahedron',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Icosahedron,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Icosahedron
|
|
||||||
};
|
|
||||||
case 0x88 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Lathe',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Lathe,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Lathe
|
|
||||||
};
|
|
||||||
case 0x89 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Octahedron',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Octahedron,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Octahedron
|
|
||||||
};
|
|
||||||
case 0x8a : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Parametric',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Parametric,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Parametric
|
|
||||||
};
|
|
||||||
case 0x8b : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Plane',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Plane,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Plane
|
|
||||||
};
|
|
||||||
case 0x8c : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Polyhedron',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Polyhedron,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Polyhedron
|
|
||||||
};
|
|
||||||
case 0x8d : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Ring',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Ring,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Ring
|
|
||||||
};
|
|
||||||
case 0x8e : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Shape',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Shape,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Shape
|
|
||||||
};
|
|
||||||
case 0x8f : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Sphere',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Sphere,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Sphere
|
|
||||||
};
|
|
||||||
case 0x90 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Tetrahedron',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Tetrahedron,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Tetrahedron
|
|
||||||
};
|
|
||||||
case 0x91 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Text',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Text,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Text
|
|
||||||
};
|
|
||||||
case 0x92 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Torus',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Torus,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Torus
|
|
||||||
};
|
|
||||||
case 0x93 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.TorusKnot',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.TorusKnot,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.TorusKnot
|
|
||||||
};
|
|
||||||
case 0x94 : return {
|
|
||||||
name : 'GameLib.D3.BufferGeometry.Tube',
|
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
|
||||||
constructor : GameLib.D3.BufferGeometry.Tube,
|
|
||||||
apiConstructor : GameLib.D3.API.BufferGeometry.Tube
|
|
||||||
};
|
|
||||||
case 0x95 : return {
|
|
||||||
name : 'GameLib.Curve',
|
name : 'GameLib.Curve',
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
constructor : GameLib.Curve,
|
constructor : GameLib.Curve,
|
||||||
apiConstructor : GameLib.API.Curve
|
apiConstructor : GameLib.API.Curve
|
||||||
};
|
};
|
||||||
case 0x96 : return {
|
case 0x97 : return {
|
||||||
name : 'GameLib.Curve.Path',
|
name : 'GameLib.Curve.Path',
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
constructor : GameLib.Curve.Path,
|
constructor : GameLib.Curve.Path,
|
||||||
apiConstructor : GameLib.API.Curve.Path
|
apiConstructor : GameLib.API.Curve.Path
|
||||||
};
|
};
|
||||||
case 0x97 : return {
|
case 0x98 : return {
|
||||||
name : 'GameLib.Curve.Path.D2',
|
name : 'GameLib.Curve.Path.D2',
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
constructor : GameLib.Curve.Path.D2,
|
constructor : GameLib.Curve.Path.D2,
|
||||||
apiConstructor : GameLib.API.Curve.Path.D2
|
apiConstructor : GameLib.API.Curve.Path.D2
|
||||||
};
|
};
|
||||||
case 0x98 : return {
|
case 0x99 : return {
|
||||||
name : 'GameLib.Curve.Path.D2.Shape',
|
name : 'GameLib.Curve.Path.D2.Shape',
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
constructor : GameLib.Curve.Path.D2.Shape,
|
constructor : GameLib.Curve.Path.D2.Shape,
|
||||||
apiConstructor : GameLib.API.Curve.Path.D2.Shape
|
apiConstructor : GameLib.API.Curve.Path.D2.Shape
|
||||||
};
|
};
|
||||||
case 0x99 : return {
|
case 0x9a : return {
|
||||||
name : 'GameLib.Box3',
|
name : 'GameLib.Box3',
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
constructor : GameLib.Box3,
|
constructor : GameLib.Box3,
|
||||||
apiConstructor : GameLib.API.Box3
|
apiConstructor : GameLib.API.Box3
|
||||||
};
|
};
|
||||||
case 0x9a : return {
|
case 0x9b : return {
|
||||||
name : 'GameLib.DrawRange',
|
name : 'GameLib.DrawRange',
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
constructor : GameLib.DrawRange,
|
constructor : GameLib.DrawRange,
|
||||||
apiConstructor : GameLib.API.DrawRange
|
apiConstructor : GameLib.API.DrawRange
|
||||||
};
|
};
|
||||||
case 0x9b : return {
|
case 0x9c : return {
|
||||||
name : 'GameLib.Group',
|
name : 'GameLib.Group',
|
||||||
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
runtime : GameLib.Component.GRAPHICS_RUNTIME,
|
||||||
constructor : GameLib.Group,
|
constructor : GameLib.Group,
|
||||||
|
|
|
@ -32,6 +32,18 @@ GameLib.Box3 = function (
|
||||||
apiBox3.max
|
apiBox3.max
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.min = new GameLib.Vector3(
|
||||||
|
this.implementation,
|
||||||
|
this.min,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
|
||||||
|
this.max = new GameLib.Vector3(
|
||||||
|
this.implementation,
|
||||||
|
this.max,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
|
||||||
this.createInstance();
|
this.createInstance();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -1,269 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry
|
|
||||||
* @param id
|
|
||||||
* @param name
|
|
||||||
* @param bufferGeometryType
|
|
||||||
* @param parentEntity
|
|
||||||
* @param faces
|
|
||||||
* @param vertices
|
|
||||||
* @param colors
|
|
||||||
* @param attributes
|
|
||||||
* @param boundingBox
|
|
||||||
* @param boundingSphere
|
|
||||||
* @param drawRange
|
|
||||||
* @param groups
|
|
||||||
* @param index
|
|
||||||
* @param morphAttributes
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry = function(
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
bufferGeometryType,
|
|
||||||
parentEntity,
|
|
||||||
faces,
|
|
||||||
vertices,
|
|
||||||
colors,
|
|
||||||
attributes,
|
|
||||||
boundingBox,
|
|
||||||
boundingSphere,
|
|
||||||
drawRange,
|
|
||||||
groups,
|
|
||||||
index,
|
|
||||||
morphAttributes
|
|
||||||
) {
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
|
||||||
id = GameLib.Utils.RandomId();
|
|
||||||
}
|
|
||||||
this.id = id;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(bufferGeometryType)) {
|
|
||||||
bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_NONE;
|
|
||||||
}
|
|
||||||
this.bufferGeometryType = bufferGeometryType;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(name)) {
|
|
||||||
|
|
||||||
switch (this.bufferGeometryType) {
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_NONE :
|
|
||||||
name = 'BufferGeometry';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_BOX :
|
|
||||||
name = 'BufferGeometry Box';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CIRCLE :
|
|
||||||
name = 'BufferGeometry Circle';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CONE :
|
|
||||||
name = 'BufferGeometry Cone';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CYLINDER :
|
|
||||||
name = 'BufferGeometry Cylinder';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_DODECAHEDRON :
|
|
||||||
name = 'BufferGeometry Dodecahedron';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_EXTRUDE :
|
|
||||||
name = 'BufferGeometry Extrude';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_ICOSAHEDRON :
|
|
||||||
name = 'BufferGeometry Icosahedron';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_LATHE :
|
|
||||||
name = 'BufferGeometry Lathe';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_OCTAHEDRON :
|
|
||||||
name = 'BufferGeometry Octahedron';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_PARAMETRIC :
|
|
||||||
name = 'BufferGeometry Parametric';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_PLANE :
|
|
||||||
name = 'BufferGeometry Plane';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_POLYHEDRON :
|
|
||||||
name = 'BufferGeometry Polyhedron';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_RING :
|
|
||||||
name = 'BufferGeometry Ring';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_SHAPE :
|
|
||||||
name = 'BufferGeometry Shape';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_SPHERE :
|
|
||||||
name = 'BufferGeometry Sphere';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TETRAHEDRON :
|
|
||||||
name = 'BufferGeometry Tetrahedron';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TEXT :
|
|
||||||
name = 'BufferGeometry Text';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TORUS :
|
|
||||||
name = 'BufferGeometry Torus';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TORUS_KNOT :
|
|
||||||
name = 'BufferGeometry Torus Knot';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TUBE :
|
|
||||||
name = 'BufferGeometry Tube';
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
console.warn('no nice name for geometry');
|
|
||||||
name = 'BufferGeometry';
|
|
||||||
}
|
|
||||||
|
|
||||||
name += ' (' + id + ')';
|
|
||||||
}
|
|
||||||
this.name = name;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(attributes)) {
|
|
||||||
attributes = [];
|
|
||||||
}
|
|
||||||
this.attributes = attributes;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(boundingBox)) {
|
|
||||||
boundingBox = new GameLib.API.Box3();
|
|
||||||
}
|
|
||||||
this.boundingBox = boundingBox;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(boundingSphere)) {
|
|
||||||
boundingSphere = new GameLib.API.Sphere();
|
|
||||||
}
|
|
||||||
this.boundingSphere = boundingSphere;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(groups)) {
|
|
||||||
groups = [];
|
|
||||||
}
|
|
||||||
this.groups = groups;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(index)) {
|
|
||||||
index = null;
|
|
||||||
}
|
|
||||||
this.index = index;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(morphAttributes)) {
|
|
||||||
morphAttributes = null;
|
|
||||||
}
|
|
||||||
this.morphAttributes = morphAttributes;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(faces)) {
|
|
||||||
faces = [];
|
|
||||||
}
|
|
||||||
this.faces = faces;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(vertices)) {
|
|
||||||
vertices = [];
|
|
||||||
}
|
|
||||||
this.vertices = vertices;
|
|
||||||
|
|
||||||
GameLib.API.Component.call(
|
|
||||||
this,
|
|
||||||
GameLib.D3.API.BufferGeometry.GetComponentType(this.bufferGeometryType),
|
|
||||||
parentEntity
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.prototype = Object.create(GameLib.API.Component.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.prototype.constructor = GameLib.D3.API.BufferGeometry;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.GetComponentType = function(bufferGeometryType) {
|
|
||||||
|
|
||||||
var componentType = null;
|
|
||||||
|
|
||||||
switch (bufferGeometryType) {
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_NONE :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_BOX :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_BOX;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CIRCLE :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_CIRCLE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CONE :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_CONE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CYLINDER :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_CYLINDER;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_DODECAHEDRON :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_DODECAHEDRON;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_EXTRUDE :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_EXTRUDE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_ICOSAHEDRON :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_ICOSAHEDRON;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_LATHE :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_LATHE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_OCTAHEDRON :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_OCTAHEDRON;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_PARAMETRIC:
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_PARAMETRIC;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_PLANE :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_PLANE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_POLYHEDRON :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_POLYHEDRON;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_RING:
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_RING;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_SHAPE :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_SHAPE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_SPHERE :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_SPHERE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TETRAHEDRON :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_TETRAHEDRON;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TEXT :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_TEXT;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TORUS :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_TORUS;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TORUS_KNOT :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_TORUS_KNOT;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TUBE :
|
|
||||||
componentType = GameLib.Component.BUFFER_GEOMETRY_TUBE;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Error('unhandled geometry type: ' + bufferGeometryType);
|
|
||||||
}
|
|
||||||
|
|
||||||
return componentType;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BufferGeometry Type
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_NONE = 0x1;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_BOX = 0x2;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CIRCLE = 0x3;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CONE = 0x4;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CYLINDER = 0x5;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_DODECAHEDRON = 0x6;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_EXTRUDE = 0x7;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_ICOSAHEDRON = 0x8;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_LATHE = 0x9;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_OCTAHEDRON = 0xa;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_PARAMETRIC = 0xb;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_PLANE = 0xc;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_POLYHEDRON = 0xd;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_RING = 0xe;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_SHAPE = 0xf;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_SPHERE = 0x10;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TETRAHEDRON = 0x11;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TEXT = 0x12;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TORUS = 0x13;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TORUS_KNOT = 0x14;
|
|
||||||
GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TUBE = 0x15;
|
|
|
@ -1,81 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Box
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param width
|
|
||||||
* @param height
|
|
||||||
* @param depth
|
|
||||||
* @param widthSegments
|
|
||||||
* @param heightSegments
|
|
||||||
* @param depthSegments
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Box = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
depth,
|
|
||||||
widthSegments,
|
|
||||||
heightSegments,
|
|
||||||
depthSegments
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_BOX
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_BOX;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(width)) {
|
|
||||||
width = 1;
|
|
||||||
}
|
|
||||||
this.width = width;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(height)) {
|
|
||||||
height = 1;
|
|
||||||
}
|
|
||||||
this.height = height;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(depth)) {
|
|
||||||
depth = 1;
|
|
||||||
}
|
|
||||||
this.depth = depth;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(widthSegments)) {
|
|
||||||
widthSegments = 1;
|
|
||||||
}
|
|
||||||
this.widthSegments = widthSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
|
||||||
heightSegments = 1;
|
|
||||||
}
|
|
||||||
this.heightSegments = heightSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(depthSegments)) {
|
|
||||||
depthSegments = 1;
|
|
||||||
}
|
|
||||||
this.depthSegments = depthSegments;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Box.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Box.prototype.constructor = GameLib.D3.API.BufferGeometry.Box;
|
|
|
@ -1,67 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Circle
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param segments
|
|
||||||
* @param thetaStart
|
|
||||||
* @param thetaLength
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Circle = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
radius,
|
|
||||||
segments,
|
|
||||||
thetaStart,
|
|
||||||
thetaLength
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CIRCLE
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CIRCLE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(segments)) {
|
|
||||||
segments = 8;
|
|
||||||
}
|
|
||||||
this.segments = segments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(thetaStart)) {
|
|
||||||
thetaStart = 0;
|
|
||||||
}
|
|
||||||
this.thetaStart = thetaStart;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(thetaLength)) {
|
|
||||||
thetaLength = Math.PI * 2;
|
|
||||||
}
|
|
||||||
this.thetaLength = thetaLength;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Circle.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Circle.prototype.constructor = GameLib.D3.API.BufferGeometry.Circle;
|
|
|
@ -1,88 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Cone
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param height
|
|
||||||
* @param radialSegments
|
|
||||||
* @param heightSegments
|
|
||||||
* @param openEnded
|
|
||||||
* @param thetaStart
|
|
||||||
* @param thetaLength
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Cone = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
radius,
|
|
||||||
height,
|
|
||||||
radialSegments,
|
|
||||||
heightSegments,
|
|
||||||
openEnded,
|
|
||||||
thetaStart,
|
|
||||||
thetaLength
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CONE
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(height)) {
|
|
||||||
height = 100;
|
|
||||||
}
|
|
||||||
this.height = height;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radialSegments)) {
|
|
||||||
radialSegments = 8;
|
|
||||||
}
|
|
||||||
this.radialSegments = radialSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
|
||||||
heightSegments = 1;
|
|
||||||
}
|
|
||||||
this.heightSegments = heightSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(openEnded)) {
|
|
||||||
openEnded = false;
|
|
||||||
}
|
|
||||||
this.openEnded = openEnded;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(thetaStart)) {
|
|
||||||
thetaStart = 0;
|
|
||||||
}
|
|
||||||
this.thetaStart = thetaStart;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(thetaLength)) {
|
|
||||||
thetaLength = Math.PI * 2;
|
|
||||||
}
|
|
||||||
this.thetaLength = thetaLength;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Cone.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Cone.prototype.constructor = GameLib.D3.API.BufferGeometry.Cone;
|
|
|
@ -1,53 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Dodecahedron
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param detail
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Dodecahedron = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
radius,
|
|
||||||
detail
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_DODECAHEDRON
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_DODECAHEDRON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
|
||||||
detail = 0;
|
|
||||||
}
|
|
||||||
this.detail = detail;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Dodecahedron.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Dodecahedron.prototype.constructor = GameLib.D3.API.BufferGeometry.Dodecahedron;
|
|
|
@ -1,53 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Icosahedron
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param detail
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Icosahedron = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
radius,
|
|
||||||
detail
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_ICOSAHEDRON
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_ICOSAHEDRON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
|
||||||
detail = 0;
|
|
||||||
}
|
|
||||||
this.detail = detail;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Icosahedron.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Icosahedron.prototype.constructor = GameLib.D3.API.BufferGeometry.Icosahedron;
|
|
|
@ -1,67 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Lathe
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param points [GameLib.Vector2]
|
|
||||||
* @param segments
|
|
||||||
* @param phiStart
|
|
||||||
* @param phiLength
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Lathe = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
points,
|
|
||||||
segments,
|
|
||||||
phiStart,
|
|
||||||
phiLength
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_LATHE
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_LATHE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(points)) {
|
|
||||||
points = [];
|
|
||||||
}
|
|
||||||
this.points = points;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(segments)) {
|
|
||||||
segments = 12;
|
|
||||||
}
|
|
||||||
this.segments = segments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(phiStart)) {
|
|
||||||
phiStart = 0;
|
|
||||||
}
|
|
||||||
this.phiStart = phiStart;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(phiLength)) {
|
|
||||||
phiLength = Math.PI * 2;
|
|
||||||
}
|
|
||||||
this.phiLength = phiLength;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Lathe.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Lathe.prototype.constructor = GameLib.D3.API.BufferGeometry.Lathe;
|
|
|
@ -1,53 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Octahedron
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param detail
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Octahedron = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
radius,
|
|
||||||
detail
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_OCTAHEDRON
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_OCTAHEDRON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
|
||||||
detail = 0;
|
|
||||||
}
|
|
||||||
this.detail = detail;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Octahedron.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Octahedron.prototype.constructor = GameLib.D3.API.BufferGeometry.Octahedron;
|
|
|
@ -1,60 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Parametric
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param generatorFn(u,v) => returns Vector3, u and v is values between 0 and 1
|
|
||||||
* @param slices
|
|
||||||
* @param stacks
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Parametric = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
generatorFn,
|
|
||||||
slices,
|
|
||||||
stacks
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_PARAMETRIC
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_PARAMETRIC;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(generatorFn)) {
|
|
||||||
generatorFn = '';
|
|
||||||
}
|
|
||||||
this.generatorFn = generatorFn;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(slices)) {
|
|
||||||
slices = 20;
|
|
||||||
}
|
|
||||||
this.slices = slices;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(stacks)) {
|
|
||||||
stacks = 20;
|
|
||||||
}
|
|
||||||
this.stacks = stacks;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Parametric.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Parametric.prototype.constructor = GameLib.D3.API.BufferGeometry.Parametric;
|
|
|
@ -1,67 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Plane
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param width
|
|
||||||
* @param height
|
|
||||||
* @param widthSegments
|
|
||||||
* @param heightSegments
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Plane = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
width,
|
|
||||||
height,
|
|
||||||
widthSegments,
|
|
||||||
heightSegments
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_PLANE
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_PLANE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(width)) {
|
|
||||||
width = 1;
|
|
||||||
}
|
|
||||||
this.width = width;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(height)) {
|
|
||||||
height = 1;
|
|
||||||
}
|
|
||||||
this.height = height;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(widthSegments)) {
|
|
||||||
widthSegments = 1;
|
|
||||||
}
|
|
||||||
this.widthSegments = widthSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
|
||||||
heightSegments = 1;
|
|
||||||
}
|
|
||||||
this.heightSegments = heightSegments;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Plane.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Plane.prototype.constructor = GameLib.D3.API.BufferGeometry.Plane;
|
|
|
@ -1,67 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Polyhedron
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param vertices
|
|
||||||
* @param indices
|
|
||||||
* @param radius
|
|
||||||
* @param detail
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Polyhedron = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
vertices,
|
|
||||||
indices,
|
|
||||||
radius,
|
|
||||||
detail
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_POLYHEDRON
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_POLYHEDRON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(vertices)) {
|
|
||||||
vertices = [];
|
|
||||||
}
|
|
||||||
this.vertices = vertices;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(indices)) {
|
|
||||||
indices = 1;
|
|
||||||
}
|
|
||||||
this.indices = indices;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 5;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
|
||||||
detail = 0;
|
|
||||||
}
|
|
||||||
this.detail = detail;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Polyhedron.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Polyhedron.prototype.constructor = GameLib.D3.API.BufferGeometry.Polyhedron;
|
|
|
@ -1,81 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Ring
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param innerRadius
|
|
||||||
* @param outerRadius
|
|
||||||
* @param thetaSegments
|
|
||||||
* @param phiSegments
|
|
||||||
* @param thetaStart
|
|
||||||
* @param thetaLength
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Ring = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
innerRadius,
|
|
||||||
outerRadius,
|
|
||||||
thetaSegments,
|
|
||||||
phiSegments,
|
|
||||||
thetaStart,
|
|
||||||
thetaLength
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_RING
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_RING;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(innerRadius)) {
|
|
||||||
innerRadius = 0.5;
|
|
||||||
}
|
|
||||||
this.innerRadius = innerRadius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(outerRadius)) {
|
|
||||||
outerRadius = 1;
|
|
||||||
}
|
|
||||||
this.outerRadius = outerRadius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(thetaSegments)) {
|
|
||||||
thetaSegments = 8;
|
|
||||||
}
|
|
||||||
this.thetaSegments = thetaSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(phiSegments)) {
|
|
||||||
phiSegments = 8;
|
|
||||||
}
|
|
||||||
this.phiSegments = phiSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(thetaStart)) {
|
|
||||||
thetaStart = 0;
|
|
||||||
}
|
|
||||||
this.thetaStart = thetaStart;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(thetaLength)) {
|
|
||||||
thetaLength = Math.PI * 2;
|
|
||||||
}
|
|
||||||
this.thetaLength = thetaLength;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Ring.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Ring.prototype.constructor = GameLib.D3.API.BufferGeometry.Ring;
|
|
|
@ -1,53 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Shape
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param shapes
|
|
||||||
* @param curveSegments
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Shape = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
shapes,
|
|
||||||
curveSegments
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_SHAPE
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_SHAPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(shapes)) {
|
|
||||||
shapes = [];
|
|
||||||
}
|
|
||||||
this.shapes = shapes;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(curveSegments)) {
|
|
||||||
curveSegments = 12;
|
|
||||||
}
|
|
||||||
this.curveSegments = curveSegments;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Shape.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Shape.prototype.constructor = GameLib.D3.API.BufferGeometry.Shape;
|
|
|
@ -1,88 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Sphere
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param widthSegments
|
|
||||||
* @param heightSegments
|
|
||||||
* @param phiStart
|
|
||||||
* @param phiLength
|
|
||||||
* @param thetaStart
|
|
||||||
* @param thetaLength
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Sphere = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
radius,
|
|
||||||
widthSegments,
|
|
||||||
heightSegments,
|
|
||||||
phiStart,
|
|
||||||
phiLength,
|
|
||||||
thetaStart,
|
|
||||||
thetaLength
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_SPHERE
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_SPHERE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(widthSegments)) {
|
|
||||||
widthSegments = 8;
|
|
||||||
}
|
|
||||||
this.widthSegments = widthSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
|
||||||
heightSegments = 6;
|
|
||||||
}
|
|
||||||
this.heightSegments = heightSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(phiStart)) {
|
|
||||||
phiStart = 0;
|
|
||||||
}
|
|
||||||
this.phiStart = phiStart;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(phiLength)) {
|
|
||||||
phiLength = Math.PI * 2;
|
|
||||||
}
|
|
||||||
this.phiLength = phiLength;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(thetaStart)) {
|
|
||||||
thetaStart = 0;
|
|
||||||
}
|
|
||||||
this.thetaStart = thetaStart;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(thetaLength)) {
|
|
||||||
thetaLength = Math.PI * 2;
|
|
||||||
}
|
|
||||||
this.thetaLength = thetaLength;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Sphere.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Sphere.prototype.constructor = GameLib.D3.API.BufferGeometry.Sphere;
|
|
|
@ -1,53 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Tetrahedron
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param detail
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Tetrahedron = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
radius,
|
|
||||||
detail
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TETRAHEDRON
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TETRAHEDRON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
|
||||||
detail = 0;
|
|
||||||
}
|
|
||||||
this.detail = detail;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Tetrahedron.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Tetrahedron.prototype.constructor = GameLib.D3.API.BufferGeometry.Tetrahedron;
|
|
|
@ -1,81 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.TorusKnot
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param tube
|
|
||||||
* @param radialSegments
|
|
||||||
* @param tubularSegments
|
|
||||||
* @param p
|
|
||||||
* @param q
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.TorusKnot = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
radius,
|
|
||||||
tube,
|
|
||||||
radialSegments,
|
|
||||||
tubularSegments,
|
|
||||||
p,
|
|
||||||
q
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TORUS_KNOT
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TORUS_KNOT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(tube)) {
|
|
||||||
tube = 0.4;
|
|
||||||
}
|
|
||||||
this.tube = tube;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radialSegments)) {
|
|
||||||
radialSegments = 8;
|
|
||||||
}
|
|
||||||
this.radialSegments = radialSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(tubularSegments)) {
|
|
||||||
tubularSegments = 64;
|
|
||||||
}
|
|
||||||
this.tubularSegments = tubularSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(p)) {
|
|
||||||
p = 2;
|
|
||||||
}
|
|
||||||
this.p = p;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(q)) {
|
|
||||||
q = 3;
|
|
||||||
}
|
|
||||||
this.q = q;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.TorusKnot.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.TorusKnot.prototype.constructor = GameLib.D3.API.BufferGeometry.TorusKnot;
|
|
|
@ -1,74 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Torus
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param tube
|
|
||||||
* @param radialSegments
|
|
||||||
* @param tubularSegments
|
|
||||||
* @param arc
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Torus = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
radius,
|
|
||||||
tube,
|
|
||||||
radialSegments,
|
|
||||||
tubularSegments,
|
|
||||||
arc
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TORUS
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TORUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(tube)) {
|
|
||||||
tube = 0.4;
|
|
||||||
}
|
|
||||||
this.tube = tube;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radialSegments)) {
|
|
||||||
radialSegments = 8;
|
|
||||||
}
|
|
||||||
this.radialSegments = radialSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(tubularSegments)) {
|
|
||||||
tubularSegments = 6;
|
|
||||||
}
|
|
||||||
this.tubularSegments = tubularSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(arc)) {
|
|
||||||
arc = Math.PI * 2;
|
|
||||||
}
|
|
||||||
this.arc = arc;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Torus.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Torus.prototype.constructor = GameLib.D3.API.BufferGeometry.Torus;
|
|
|
@ -1,74 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.BufferGeometry.Tube
|
|
||||||
* @param apiBufferGeometry
|
|
||||||
* @param path
|
|
||||||
* @param tubularSegments
|
|
||||||
* @param radius
|
|
||||||
* @param radialSegments
|
|
||||||
* @param closed
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.BufferGeometry.Tube = function(
|
|
||||||
apiBufferGeometry,
|
|
||||||
path,
|
|
||||||
tubularSegments,
|
|
||||||
radius,
|
|
||||||
radialSegments,
|
|
||||||
closed
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
|
||||||
apiBufferGeometry = {
|
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TUBE
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TUBE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(path)) {
|
|
||||||
path = null;
|
|
||||||
}
|
|
||||||
this.path = path;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(tubularSegments)) {
|
|
||||||
tubularSegments = 64;
|
|
||||||
}
|
|
||||||
this.tubularSegments = tubularSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radialSegments)) {
|
|
||||||
radialSegments = 8;
|
|
||||||
}
|
|
||||||
this.radialSegments = radialSegments;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(closed)) {
|
|
||||||
closed = false;
|
|
||||||
}
|
|
||||||
this.closed = closed;
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
apiBufferGeometry.id,
|
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Tube.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.API.BufferGeometry.Tube.prototype.constructor = GameLib.D3.API.BufferGeometry.Tube;
|
|
|
@ -1,20 +1,22 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.GeometryBase
|
* GameLib.D3.API.Geometry
|
||||||
* @param id
|
* @param id
|
||||||
* @param name
|
* @param name
|
||||||
* @param geometryType
|
* @param geometryType
|
||||||
* @param parentEntity
|
* @param parentEntity
|
||||||
|
* @param parentMesh
|
||||||
* @param boundingBox
|
* @param boundingBox
|
||||||
* @param boundingSphere
|
* @param boundingSphere
|
||||||
* @param faces
|
* @param faces
|
||||||
* @param vertices
|
* @param vertices
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.GeometryBase = function(
|
GameLib.D3.API.Geometry = function(
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
geometryType,
|
geometryType,
|
||||||
parentEntity,
|
parentEntity,
|
||||||
|
parentMesh,
|
||||||
boundingBox,
|
boundingBox,
|
||||||
boundingSphere,
|
boundingSphere,
|
||||||
faces,
|
faces,
|
||||||
|
@ -26,81 +28,144 @@ GameLib.D3.API.GeometryBase = function(
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(geometryType)) {
|
||||||
geometryType = GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_BASE;
|
geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NONE;
|
||||||
}
|
}
|
||||||
this.geometryType = geometryType;
|
this.geometryType = geometryType;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(name)) {
|
if (GameLib.Utils.UndefinedOrNull(name)) {
|
||||||
|
|
||||||
switch (this.geometryType) {
|
switch (this.geometryType) {
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_NORMAL :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL :
|
||||||
name = 'Geometry';
|
name = 'Geometry';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_BOX :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_BOX :
|
||||||
name = 'Geometry Box';
|
name = 'Geometry Normal Box';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_CIRCLE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CIRCLE :
|
||||||
name = 'Geometry Circle';
|
name = 'Geometry Normal Circle';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_CONE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CONE :
|
||||||
name = 'Geometry Cone';
|
name = 'Geometry Normal Cone';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_CYLINDER :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CYLINDER :
|
||||||
name = 'Geometry Cylinder';
|
name = 'Geometry Normal Cylinder';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_DODECAHEDRON :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_DODECAHEDRON :
|
||||||
name = 'Geometry Dodecahedron';
|
name = 'Geometry Normal Dodecahedron';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_EDGES :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EDGES :
|
||||||
name = 'Geometry Edges';
|
name = 'Geometry Normal Edges';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_EXTRUDE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EXTRUDE :
|
||||||
name = 'Geometry Extrude';
|
name = 'Geometry Normal Extrude';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_ICOSAHEDRON :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_ICOSAHEDRON :
|
||||||
name = 'Geometry Icosahedron';
|
name = 'Geometry Normal Icosahedron';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_LATHE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_LATHE :
|
||||||
name = 'Geometry Lathe';
|
name = 'Geometry Normal Lathe';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_OCTAHEDRON :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_OCTAHEDRON :
|
||||||
name = 'Geometry Octahedron';
|
name = 'Geometry Normal Octahedron';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_PARAMETRIC :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PARAMETRIC :
|
||||||
name = 'Geometry Parametric';
|
name = 'Geometry Normal Parametric';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_PLANE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PLANE :
|
||||||
name = 'Geometry Plane';
|
name = 'Geometry Normal Plane';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_POLYHEDRON :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_POLYHEDRON :
|
||||||
name = 'Geometry Polyhedron';
|
name = 'Geometry Normal Polyhedron';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_RING :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_RING :
|
||||||
name = 'Geometry Ring';
|
name = 'Geometry Normal Ring';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_SHAPE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SHAPE :
|
||||||
name = 'Geometry Shape';
|
name = 'Geometry Normal Shape';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_SPHERE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SPHERE :
|
||||||
name = 'Geometry Sphere';
|
name = 'Geometry Normal Sphere';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TETRAHEDRON :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TETRAHEDRON :
|
||||||
name = 'Geometry Tetrahedron';
|
name = 'Geometry Normal Tetrahedron';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TEXT :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TEXT :
|
||||||
name = 'Geometry Text';
|
name = 'Geometry Normal Text';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TORUS :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS :
|
||||||
name = 'Geometry Torus';
|
name = 'Geometry Normal Torus';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TORUS_KNOT :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS_KNOT :
|
||||||
name = 'Geometry Torus Knot';
|
name = 'Geometry Normal Torus Knot';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TUBE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TUBE :
|
||||||
name = 'Geometry Tube';
|
name = 'Geometry Normal Tube';
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_WIREFRAME :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_WIREFRAME :
|
||||||
name = 'Geometry Wireframe';
|
name = 'Geometry Normal Wireframe';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER :
|
||||||
|
name = 'Geometry Buffer';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_BOX :
|
||||||
|
name = 'Geometry Buffer Box';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CIRCLE :
|
||||||
|
name = 'Geometry Buffer Circle';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CONE :
|
||||||
|
name = 'Geometry Buffer Cone';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER :
|
||||||
|
name = 'Geometry Buffer Cylinder';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_DODECAHEDRON :
|
||||||
|
name = 'Geometry Buffer Dodecahedron';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE :
|
||||||
|
name = 'Geometry Buffer Extrude';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_ICOSAHEDRON :
|
||||||
|
name = 'Geometry Buffer Icosahedron';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_LATHE :
|
||||||
|
name = 'Geometry Buffer Lathe';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_OCTAHEDRON :
|
||||||
|
name = 'Geometry Buffer Octahedron';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PARAMETRIC :
|
||||||
|
name = 'Geometry Buffer Parametric';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PLANE :
|
||||||
|
name = 'Geometry Buffer Plane';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_POLYHEDRON :
|
||||||
|
name = 'Geometry Buffer Polyhedron';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING :
|
||||||
|
name = 'Geometry Buffer Ring';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE :
|
||||||
|
name = 'Geometry Buffer Shape';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SPHERE :
|
||||||
|
name = 'Geometry Buffer Sphere';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TETRAHEDRON :
|
||||||
|
name = 'Geometry Buffer Tetrahedron';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT :
|
||||||
|
name = 'Geometry Buffer Text';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS :
|
||||||
|
name = 'Geometry Buffer Torus';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT :
|
||||||
|
name = 'Geometry Buffer Torus Knot';
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TUBE :
|
||||||
|
name = 'Geometry Buffer Tube';
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
console.warn('no nice name for geometry');
|
console.warn('no nice name for geometry');
|
||||||
|
@ -111,6 +176,11 @@ GameLib.D3.API.GeometryBase = function(
|
||||||
}
|
}
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(parentMesh)) {
|
||||||
|
parentMesh = null;
|
||||||
|
}
|
||||||
|
this.parentMesh = parentMesh;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(boundingBox)) {
|
if (GameLib.Utils.UndefinedOrNull(boundingBox)) {
|
||||||
boundingBox = new GameLib.API.Box3();
|
boundingBox = new GameLib.API.Box3();
|
||||||
}
|
}
|
||||||
|
@ -138,82 +208,145 @@ GameLib.D3.API.GeometryBase = function(
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.GeometryBase.prototype = Object.create(GameLib.API.Component.prototype);
|
GameLib.D3.API.Geometry.prototype = Object.create(GameLib.API.Component.prototype);
|
||||||
GameLib.D3.API.GeometryBase.prototype.constructor = GameLib.D3.API.GeometryBase;
|
GameLib.D3.API.Geometry.prototype.constructor = GameLib.D3.API.Geometry;
|
||||||
|
|
||||||
GameLib.D3.API.GeometryBase.GetComponentType = function(geometryType) {
|
GameLib.D3.API.Geometry.GetComponentType = function(geometryType) {
|
||||||
|
|
||||||
var componentType = null;
|
var componentType = null;
|
||||||
|
|
||||||
switch (geometryType) {
|
switch (geometryType) {
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_NORMAL :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL :
|
||||||
componentType = GameLib.Component.GEOMETRY;
|
componentType = GameLib.Component.GEOMETRY_NORMAL;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_BOX :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_BOX :
|
||||||
componentType = GameLib.Component.GEOMETRY_BOX;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_BOX;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_CIRCLE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CIRCLE :
|
||||||
componentType = GameLib.Component.GEOMETRY_CIRCLE;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_CIRCLE;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_CONE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CONE :
|
||||||
componentType = GameLib.Component.GEOMETRY_CONE;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_CONE;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_CYLINDER :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CYLINDER :
|
||||||
componentType = GameLib.Component.GEOMETRY_CYLINDER;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_CYLINDER;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_DODECAHEDRON :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_DODECAHEDRON :
|
||||||
componentType = GameLib.Component.GEOMETRY_DODECAHEDRON;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_DODECAHEDRON;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_EDGES :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EDGES :
|
||||||
componentType = GameLib.Component.GEOMETRY_EDGES;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_EDGES;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_EXTRUDE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EXTRUDE :
|
||||||
componentType = GameLib.Component.GEOMETRY_EXTRUDE;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_EXTRUDE;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_ICOSAHEDRON :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_ICOSAHEDRON :
|
||||||
componentType = GameLib.Component.GEOMETRY_ICOSAHEDRON;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_ICOSAHEDRON;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_LATHE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_LATHE :
|
||||||
componentType = GameLib.Component.GEOMETRY_LATHE;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_LATHE;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_OCTAHEDRON :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_OCTAHEDRON :
|
||||||
componentType = GameLib.Component.GEOMETRY_OCTAHEDRON;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_OCTAHEDRON;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_PARAMETRIC :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PARAMETRIC :
|
||||||
componentType = GameLib.Component.GEOMETRY_PARAMETRIC;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_PARAMETRIC;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_PLANE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PLANE :
|
||||||
componentType = GameLib.Component.GEOMETRY_PLANE;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_PLANE;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_POLYHEDRON :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_POLYHEDRON :
|
||||||
componentType = GameLib.Component.GEOMETRY_POLYHEDRON;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_POLYHEDRON;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_RING :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_RING :
|
||||||
componentType = GameLib.Component.GEOMETRY_RING;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_RING;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_SHAPE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SHAPE :
|
||||||
componentType = GameLib.Component.GEOMETRY_SHAPE;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_SHAPE;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_SPHERE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SPHERE :
|
||||||
componentType = GameLib.Component.GEOMETRY_SPHERE;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_SPHERE;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TETRAHEDRON :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TETRAHEDRON :
|
||||||
componentType = GameLib.Component.GEOMETRY_TETRAHEDRON;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_TETRAHEDRON;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TEXT :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TEXT :
|
||||||
componentType = GameLib.Component.GEOMETRY_TEXT;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_TEXT;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TORUS :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS :
|
||||||
componentType = GameLib.Component.GEOMETRY_TORUS;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_TORUS;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TORUS_KNOT :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS_KNOT :
|
||||||
componentType = GameLib.Component.GEOMETRY_TORUS_KNOT;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_TORUS_KNOT;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TUBE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TUBE :
|
||||||
componentType = GameLib.Component.GEOMETRY_TUBE;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_TUBE;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_WIREFRAME :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_WIREFRAME :
|
||||||
componentType = GameLib.Component.GEOMETRY_WIREFRAME;
|
componentType = GameLib.Component.GEOMETRY_NORMAL_WIREFRAME;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_BOX :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_BOX;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CIRCLE :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_CIRCLE;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CONE :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_CONE;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_CYLINDER;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_DODECAHEDRON :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_DODECAHEDRON;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_EXTRUDE;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_ICOSAHEDRON :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_ICOSAHEDRON;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_LATHE :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_LATHE;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_OCTAHEDRON :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_OCTAHEDRON;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PARAMETRIC:
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_PARAMETRIC;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PLANE :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_PLANE;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_POLYHEDRON :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_POLYHEDRON;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING:
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_RING;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_SHAPE;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SPHERE :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_SPHERE;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TETRAHEDRON :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_TETRAHEDRON;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_TEXT;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_TORUS;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_TORUS_KNOT;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TUBE :
|
||||||
|
componentType = GameLib.Component.GEOMETRY_BUFFER_TUBE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw new Error('unhandled geometry type: ' + geometryType);
|
throw new Error('unhandled geometry type: ' + geometryType);
|
||||||
|
@ -223,30 +356,51 @@ GameLib.D3.API.GeometryBase.GetComponentType = function(geometryType) {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* GeometryBase Type
|
* Geometry Type
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_BASE = 0x0;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NONE = 0x0;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_NORMAL = 0x1;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL = 0x1;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_BOX = 0x2;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_BOX = 0x2;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_CIRCLE = 0x3;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CIRCLE = 0x3;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_CONE = 0x4;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CONE = 0x4;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_CYLINDER = 0x5;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CYLINDER = 0x5;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_DODECAHEDRON = 0x6;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_DODECAHEDRON = 0x6;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_EDGES = 0x7;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EDGES = 0x7;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_EXTRUDE = 0x8;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EXTRUDE = 0x8;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_ICOSAHEDRON = 0x9;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_ICOSAHEDRON = 0x9;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_LATHE = 0xa;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_LATHE = 0xa;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_OCTAHEDRON = 0xb;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_OCTAHEDRON = 0xb;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_PARAMETRIC = 0xc;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PARAMETRIC = 0xc;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_PLANE = 0xd;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PLANE = 0xd;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_POLYHEDRON = 0xe;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_POLYHEDRON = 0xe;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_RING = 0xf;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_RING = 0xf;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_SHAPE = 0x10;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SHAPE = 0x10;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_SPHERE = 0x11;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SPHERE = 0x11;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TETRAHEDRON = 0x12;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TETRAHEDRON = 0x12;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TEXT = 0x13;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TEXT = 0x13;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TORUS = 0x14;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS = 0x14;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TORUS_KNOT = 0x15;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS_KNOT = 0x15;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_TUBE = 0x16;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TUBE = 0x16;
|
||||||
GameLib.D3.API.GeometryBase.GEOMETRY_TYPE_WIREFRAME = 0x17;
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_WIREFRAME = 0x17;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER = 0x18;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_BOX = 0x19;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CIRCLE = 0x1a;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CONE = 0x1b;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER = 0x1c;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_DODECAHEDRON = 0x1d;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE = 0x1e;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_ICOSAHEDRON = 0x1f;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_LATHE = 0x20;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_OCTAHEDRON = 0x21;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PARAMETRIC = 0x22;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PLANE = 0x23;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_POLYHEDRON = 0x24;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING = 0x25;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE = 0x26;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SPHERE = 0x27;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TETRAHEDRON = 0x28;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT = 0x29;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS = 0x2a;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT = 0x2b;
|
||||||
|
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TUBE = 0x2c;
|
||||||
|
|
|
@ -1,342 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.Geometry
|
|
||||||
* @param id
|
|
||||||
* @param name
|
|
||||||
* @param geometryType
|
|
||||||
* @param parentEntity
|
|
||||||
* @param boundingBox
|
|
||||||
* @param boundingSphere
|
|
||||||
* @param colors
|
|
||||||
* @param faces
|
|
||||||
* @param lineDistances
|
|
||||||
* @param morphTargets
|
|
||||||
* @param morphNormals
|
|
||||||
* @param skinWeights
|
|
||||||
* @param skinIndices
|
|
||||||
* @param vertices
|
|
||||||
* @param verticesNeedsUpdate
|
|
||||||
* @param elementsNeedUpdate
|
|
||||||
* @param uvsNeedUpdate
|
|
||||||
* @param normalsNeedUpdate
|
|
||||||
* @param colorsNeedUpdate
|
|
||||||
* @param groupsNeedUpdate
|
|
||||||
* @param lineDistancesNeedUpdate
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.Geometry = function(
|
|
||||||
id,
|
|
||||||
name,
|
|
||||||
geometryType,
|
|
||||||
parentEntity,
|
|
||||||
boundingBox,
|
|
||||||
boundingSphere,
|
|
||||||
colors,
|
|
||||||
faces,
|
|
||||||
lineDistances,
|
|
||||||
morphTargets,
|
|
||||||
morphNormals,
|
|
||||||
skinWeights,
|
|
||||||
skinIndices,
|
|
||||||
vertices,
|
|
||||||
verticesNeedsUpdate,
|
|
||||||
elementsNeedUpdate,
|
|
||||||
uvsNeedUpdate,
|
|
||||||
normalsNeedUpdate,
|
|
||||||
colorsNeedUpdate,
|
|
||||||
groupsNeedUpdate,
|
|
||||||
lineDistancesNeedUpdate
|
|
||||||
) {
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(id)) {
|
|
||||||
id = GameLib.Utils.RandomId();
|
|
||||||
}
|
|
||||||
this.id = id;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(geometryType)) {
|
|
||||||
geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL;
|
|
||||||
}
|
|
||||||
this.geometryType = geometryType;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(name)) {
|
|
||||||
|
|
||||||
switch (this.geometryType) {
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL :
|
|
||||||
name = 'Geometry';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BOX :
|
|
||||||
name = 'Geometry Box';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_CIRCLE :
|
|
||||||
name = 'Geometry Circle';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_CONE :
|
|
||||||
name = 'Geometry Cone';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_CYLINDER :
|
|
||||||
name = 'Geometry Cylinder';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_DODECAHEDRON :
|
|
||||||
name = 'Geometry Dodecahedron';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_EDGES :
|
|
||||||
name = 'Geometry Edges';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_EXTRUDE :
|
|
||||||
name = 'Geometry Extrude';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_ICOSAHEDRON :
|
|
||||||
name = 'Geometry Icosahedron';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_LATHE :
|
|
||||||
name = 'Geometry Lathe';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_OCTAHEDRON :
|
|
||||||
name = 'Geometry Octahedron';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_PARAMETRIC :
|
|
||||||
name = 'Geometry Parametric';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_PLANE :
|
|
||||||
name = 'Geometry Plane';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_POLYHEDRON :
|
|
||||||
name = 'Geometry Polyhedron';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_RING :
|
|
||||||
name = 'Geometry Ring';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_SHAPE :
|
|
||||||
name = 'Geometry Shape';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_SPHERE :
|
|
||||||
name = 'Geometry Sphere';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_TETRAHEDRON :
|
|
||||||
name = 'Geometry Tetrahedron';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_TEXT :
|
|
||||||
name = 'Geometry Text';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_TORUS :
|
|
||||||
name = 'Geometry Torus';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_TORUS_KNOT :
|
|
||||||
name = 'Geometry Torus Knot';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_TUBE :
|
|
||||||
name = 'Geometry Tube';
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_WIREFRAME :
|
|
||||||
name = 'Geometry Wireframe';
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
console.warn('no nice name for geometry');
|
|
||||||
name = 'Geometry';
|
|
||||||
}
|
|
||||||
|
|
||||||
name += ' (' + id + ')';
|
|
||||||
}
|
|
||||||
this.name = name;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(boundingBox)) {
|
|
||||||
boundingBox = new GameLib.API.Box3();
|
|
||||||
}
|
|
||||||
this.boundingBox = boundingBox;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(boundingSphere)) {
|
|
||||||
boundingSphere = new GameLib.API.Sphere();
|
|
||||||
}
|
|
||||||
this.boundingSphere = boundingSphere;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(colors)) {
|
|
||||||
colors = [];
|
|
||||||
}
|
|
||||||
this.colors = colors;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(faces)) {
|
|
||||||
faces = [];
|
|
||||||
}
|
|
||||||
this.faces = faces;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(lineDistances)) {
|
|
||||||
lineDistances = [];
|
|
||||||
}
|
|
||||||
this.lineDistances = lineDistances;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(morphTargets)) {
|
|
||||||
morphTargets = [];
|
|
||||||
}
|
|
||||||
this.morphTargets = morphTargets;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(morphNormals)) {
|
|
||||||
morphNormals = [];
|
|
||||||
}
|
|
||||||
this.morphNormals = morphNormals;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(skinWeights)) {
|
|
||||||
skinWeights = [];
|
|
||||||
}
|
|
||||||
this.skinWeights = skinWeights;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(skinIndices)) {
|
|
||||||
skinIndices = [];
|
|
||||||
}
|
|
||||||
this.skinIndices = skinIndices;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(vertices)) {
|
|
||||||
vertices = [];
|
|
||||||
}
|
|
||||||
this.vertices = vertices;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(verticesNeedsUpdate)) {
|
|
||||||
verticesNeedsUpdate = false;
|
|
||||||
}
|
|
||||||
this.verticesNeedsUpdate = verticesNeedsUpdate;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(elementsNeedUpdate)) {
|
|
||||||
elementsNeedUpdate = false;
|
|
||||||
}
|
|
||||||
this.elementsNeedUpdate = elementsNeedUpdate;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(uvsNeedUpdate)) {
|
|
||||||
uvsNeedUpdate = false;
|
|
||||||
}
|
|
||||||
this.uvsNeedUpdate = uvsNeedUpdate;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(normalsNeedUpdate)) {
|
|
||||||
normalsNeedUpdate = false;
|
|
||||||
}
|
|
||||||
this.normalsNeedUpdate = normalsNeedUpdate;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(colorsNeedUpdate)) {
|
|
||||||
colorsNeedUpdate = false;
|
|
||||||
}
|
|
||||||
this.colorsNeedUpdate = colorsNeedUpdate;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(groupsNeedUpdate)) {
|
|
||||||
groupsNeedUpdate = false;
|
|
||||||
}
|
|
||||||
this.groupsNeedUpdate = groupsNeedUpdate;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(lineDistancesNeedUpdate)) {
|
|
||||||
lineDistancesNeedUpdate = false;
|
|
||||||
}
|
|
||||||
this.lineDistancesNeedUpdate = lineDistancesNeedUpdate;
|
|
||||||
|
|
||||||
GameLib.API.Component.call(
|
|
||||||
this,
|
|
||||||
GameLib.D3.API.Geometry.GetComponentType(this.geometryType),
|
|
||||||
parentEntity
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.prototype = Object.create(GameLib.API.Component.prototype);
|
|
||||||
GameLib.D3.API.Geometry.prototype.constructor = GameLib.D3.API.Geometry;
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.GetComponentType = function(geometryType) {
|
|
||||||
|
|
||||||
var componentType = null;
|
|
||||||
|
|
||||||
switch (geometryType) {
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL :
|
|
||||||
componentType = GameLib.Component.GEOMETRY;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BOX :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_BOX;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_CIRCLE :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_CIRCLE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_CONE :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_CONE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_CYLINDER :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_CYLINDER;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_DODECAHEDRON :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_DODECAHEDRON;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_EDGES :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_EDGES;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_EXTRUDE :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_EXTRUDE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_ICOSAHEDRON :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_ICOSAHEDRON;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_LATHE :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_LATHE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_OCTAHEDRON :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_OCTAHEDRON;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_PARAMETRIC :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_PARAMETRIC;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_PLANE :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_PLANE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_POLYHEDRON :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_POLYHEDRON;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_RING :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_RING;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_SHAPE :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_SHAPE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_SPHERE :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_SPHERE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_TETRAHEDRON :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_TETRAHEDRON;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_TEXT :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_TEXT;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_TORUS :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_TORUS;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_TORUS_KNOT :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_TORUS_KNOT;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_TUBE :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_TUBE;
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_WIREFRAME :
|
|
||||||
componentType = GameLib.Component.GEOMETRY_WIREFRAME;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
throw new Error('unhandled geometry type: ' + geometryType);
|
|
||||||
}
|
|
||||||
|
|
||||||
return componentType;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Geometry Type
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL = 0x0;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_BOX = 0x1;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_CIRCLE = 0x2;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_CONE = 0x3;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_CYLINDER = 0x4;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_DODECAHEDRON = 0x5;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_EDGES = 0x6;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_EXTRUDE = 0x7;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_ICOSAHEDRON = 0x8;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_LATHE = 0x9;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_OCTAHEDRON = 0xa;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_PARAMETRIC = 0xb;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_PLANE = 0xc;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_POLYHEDRON = 0xd;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_RING = 0xe;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_SHAPE = 0xf;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_SPHERE = 0x10;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_TETRAHEDRON = 0x11;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_TEXT = 0x12;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_TORUS = 0x13;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_TORUS_KNOT = 0x14;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_TUBE = 0x15;
|
|
||||||
GameLib.D3.API.Geometry.GEOMETRY_TYPE_WIREFRAME = 0x16;
|
|
|
@ -0,0 +1,69 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param attributes
|
||||||
|
* @param drawRange
|
||||||
|
* @param groups
|
||||||
|
* @param index
|
||||||
|
* @param morphAttributes
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer = function(
|
||||||
|
apiGeometry,
|
||||||
|
attributes,
|
||||||
|
drawRange,
|
||||||
|
groups,
|
||||||
|
index,
|
||||||
|
morphAttributes
|
||||||
|
) {
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(attributes)) {
|
||||||
|
attributes = [];
|
||||||
|
}
|
||||||
|
this.attributes = attributes;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(groups)) {
|
||||||
|
groups = [];
|
||||||
|
}
|
||||||
|
this.groups = groups;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(drawRange)) {
|
||||||
|
drawRange = new GameLib.API.DrawRange()
|
||||||
|
}
|
||||||
|
this.drawRange = drawRange;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(index)) {
|
||||||
|
index = null;
|
||||||
|
}
|
||||||
|
this.index = index;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(morphAttributes)) {
|
||||||
|
morphAttributes = null;
|
||||||
|
}
|
||||||
|
this.morphAttributes = morphAttributes;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.call(
|
||||||
|
this,
|
||||||
|
apiGeometry.id,
|
||||||
|
apiGeometry.name,
|
||||||
|
apiGeometry.geometryType,
|
||||||
|
apiGeometry.parentEntity,
|
||||||
|
apiGeometry.parentMesh,
|
||||||
|
apiGeometry.boundingBox,
|
||||||
|
apiGeometry.boundingSphere,
|
||||||
|
apiGeometry.faces,
|
||||||
|
apiGeometry.vertices
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.prototype.constructor = GameLib.D3.API.Geometry.Buffer;
|
|
@ -0,0 +1,74 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Box
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param width
|
||||||
|
* @param height
|
||||||
|
* @param depth
|
||||||
|
* @param widthSegments
|
||||||
|
* @param heightSegments
|
||||||
|
* @param depthSegments
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Box = function(
|
||||||
|
apiGeometry,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
depth,
|
||||||
|
widthSegments,
|
||||||
|
heightSegments,
|
||||||
|
depthSegments
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_BOX
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_BOX;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(width)) {
|
||||||
|
width = 1;
|
||||||
|
}
|
||||||
|
this.width = width;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(height)) {
|
||||||
|
height = 1;
|
||||||
|
}
|
||||||
|
this.height = height;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(depth)) {
|
||||||
|
depth = 1;
|
||||||
|
}
|
||||||
|
this.depth = depth;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(widthSegments)) {
|
||||||
|
widthSegments = 1;
|
||||||
|
}
|
||||||
|
this.widthSegments = widthSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
||||||
|
heightSegments = 1;
|
||||||
|
}
|
||||||
|
this.heightSegments = heightSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(depthSegments)) {
|
||||||
|
depthSegments = 1;
|
||||||
|
}
|
||||||
|
this.depthSegments = depthSegments;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Box.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Box.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Box;
|
|
@ -0,0 +1,60 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Circle
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param segments
|
||||||
|
* @param thetaStart
|
||||||
|
* @param thetaLength
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Circle = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
segments,
|
||||||
|
thetaStart,
|
||||||
|
thetaLength
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CIRCLE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CIRCLE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(segments)) {
|
||||||
|
segments = 8;
|
||||||
|
}
|
||||||
|
this.segments = segments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(thetaStart)) {
|
||||||
|
thetaStart = 0;
|
||||||
|
}
|
||||||
|
this.thetaStart = thetaStart;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(thetaLength)) {
|
||||||
|
thetaLength = Math.PI * 2;
|
||||||
|
}
|
||||||
|
this.thetaLength = thetaLength;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Circle.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Circle.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Circle;
|
|
@ -0,0 +1,81 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Cone
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param height
|
||||||
|
* @param radialSegments
|
||||||
|
* @param heightSegments
|
||||||
|
* @param openEnded
|
||||||
|
* @param thetaStart
|
||||||
|
* @param thetaLength
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Cone = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
height,
|
||||||
|
radialSegments,
|
||||||
|
heightSegments,
|
||||||
|
openEnded,
|
||||||
|
thetaStart,
|
||||||
|
thetaLength
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CONE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(height)) {
|
||||||
|
height = 100;
|
||||||
|
}
|
||||||
|
this.height = height;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radialSegments)) {
|
||||||
|
radialSegments = 8;
|
||||||
|
}
|
||||||
|
this.radialSegments = radialSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
||||||
|
heightSegments = 1;
|
||||||
|
}
|
||||||
|
this.heightSegments = heightSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(openEnded)) {
|
||||||
|
openEnded = false;
|
||||||
|
}
|
||||||
|
this.openEnded = openEnded;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(thetaStart)) {
|
||||||
|
thetaStart = 0;
|
||||||
|
}
|
||||||
|
this.thetaStart = thetaStart;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(thetaLength)) {
|
||||||
|
thetaLength = Math.PI * 2;
|
||||||
|
}
|
||||||
|
this.thetaLength = thetaLength;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Cone.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Cone.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Cone;
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.BufferGeometry.Cylinder
|
* GameLib.D3.API.Geometry.Buffer.Cylinder
|
||||||
* @param apiBufferGeometry
|
* @param apiGeometry
|
||||||
* @param radiusTop
|
* @param radiusTop
|
||||||
* @param radiusBottom
|
* @param radiusBottom
|
||||||
* @param height
|
* @param height
|
||||||
|
@ -11,8 +11,8 @@
|
||||||
* @param thetaLength
|
* @param thetaLength
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.BufferGeometry.Cylinder = function(
|
GameLib.D3.API.Geometry.Buffer.Cylinder = function(
|
||||||
apiBufferGeometry,
|
apiGeometry,
|
||||||
radiusTop,
|
radiusTop,
|
||||||
radiusBottom,
|
radiusBottom,
|
||||||
height,
|
height,
|
||||||
|
@ -23,14 +23,14 @@ GameLib.D3.API.BufferGeometry.Cylinder = function(
|
||||||
thetaLength
|
thetaLength
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiBufferGeometry = {
|
apiGeometry = {
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CYLINDER
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_CYLINDER;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radiusTop)) {
|
if (GameLib.Utils.UndefinedOrNull(radiusTop)) {
|
||||||
|
@ -73,23 +73,16 @@ GameLib.D3.API.BufferGeometry.Cylinder = function(
|
||||||
}
|
}
|
||||||
this.thetaLength = thetaLength;
|
this.thetaLength = thetaLength;
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
this,
|
this,
|
||||||
apiBufferGeometry.id,
|
apiGeometry,
|
||||||
apiBufferGeometry.name,
|
apiGeometry.attributes,
|
||||||
apiBufferGeometry.bufferGeometryType,
|
apiGeometry.drawRange,
|
||||||
apiBufferGeometry.parentEntity,
|
apiGeometry.groups,
|
||||||
apiBufferGeometry.faces,
|
apiGeometry.index,
|
||||||
apiBufferGeometry.vertices,
|
apiGeometry.morphAttributes
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Cylinder.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
GameLib.D3.API.Geometry.Buffer.Cylinder.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
GameLib.D3.API.BufferGeometry.Cylinder.prototype.constructor = GameLib.D3.API.BufferGeometry.Cylinder;
|
GameLib.D3.API.Geometry.Buffer.Cylinder.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Cylinder;
|
|
@ -0,0 +1,46 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Dodecahedron
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param detail
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Dodecahedron = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
detail
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_DODECAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_DODECAHEDRON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
||||||
|
detail = 0;
|
||||||
|
}
|
||||||
|
this.detail = detail;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Dodecahedron.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Dodecahedron.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Dodecahedron;
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.BufferGeometry.Extrude
|
* GameLib.D3.API.Geometry.Buffer.Extrude
|
||||||
* @param apiBufferGeometry
|
* @param apiGeometry
|
||||||
* @param shapes
|
* @param shapes
|
||||||
* @param curveSegments
|
* @param curveSegments
|
||||||
* @param steps
|
* @param steps
|
||||||
|
@ -14,8 +14,8 @@
|
||||||
* @param UVGenerator
|
* @param UVGenerator
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.BufferGeometry.Extrude = function(
|
GameLib.D3.API.Geometry.Buffer.Extrude = function(
|
||||||
apiBufferGeometry,
|
apiGeometry,
|
||||||
shapes,
|
shapes,
|
||||||
curveSegments,
|
curveSegments,
|
||||||
steps,
|
steps,
|
||||||
|
@ -29,14 +29,14 @@ GameLib.D3.API.BufferGeometry.Extrude = function(
|
||||||
UVGenerator
|
UVGenerator
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiBufferGeometry = {
|
apiGeometry = {
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_EXTRUDE
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_EXTRUDE;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(shapes)) {
|
if (GameLib.Utils.UndefinedOrNull(shapes)) {
|
||||||
|
@ -89,23 +89,16 @@ GameLib.D3.API.BufferGeometry.Extrude = function(
|
||||||
}
|
}
|
||||||
this.UVGenerator = UVGenerator;
|
this.UVGenerator = UVGenerator;
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
this,
|
this,
|
||||||
apiBufferGeometry.id,
|
apiGeometry,
|
||||||
apiBufferGeometry.name,
|
apiGeometry.attributes,
|
||||||
apiBufferGeometry.bufferGeometryType,
|
apiGeometry.drawRange,
|
||||||
apiBufferGeometry.parentEntity,
|
apiGeometry.groups,
|
||||||
apiBufferGeometry.faces,
|
apiGeometry.index,
|
||||||
apiBufferGeometry.vertices,
|
apiGeometry.morphAttributes
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Extrude.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
GameLib.D3.API.Geometry.Buffer.Extrude.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
GameLib.D3.API.BufferGeometry.Extrude.prototype.constructor = GameLib.D3.API.BufferGeometry.Extrude;
|
GameLib.D3.API.Geometry.Buffer.Extrude.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Extrude;
|
|
@ -0,0 +1,46 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Icosahedron
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param detail
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Icosahedron = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
detail
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_ICOSAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_ICOSAHEDRON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
||||||
|
detail = 0;
|
||||||
|
}
|
||||||
|
this.detail = detail;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Icosahedron.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Icosahedron.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Icosahedron;
|
|
@ -0,0 +1,60 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Lathe
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param points [GameLib.Vector2] (x must be larger than 0)
|
||||||
|
* @param segments
|
||||||
|
* @param phiStart
|
||||||
|
* @param phiLength
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Lathe = function(
|
||||||
|
apiGeometry,
|
||||||
|
points,
|
||||||
|
segments,
|
||||||
|
phiStart,
|
||||||
|
phiLength
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_LATHE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_LATHE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(points)) {
|
||||||
|
points = [];
|
||||||
|
}
|
||||||
|
this.points = points;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(segments)) {
|
||||||
|
segments = 12;
|
||||||
|
}
|
||||||
|
this.segments = segments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(phiStart)) {
|
||||||
|
phiStart = 0;
|
||||||
|
}
|
||||||
|
this.phiStart = phiStart;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(phiLength)) {
|
||||||
|
phiLength = Math.PI * 2;
|
||||||
|
}
|
||||||
|
this.phiLength = phiLength;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Lathe.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Lathe.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Lathe;
|
|
@ -0,0 +1,46 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Octahedron
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param detail
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Octahedron = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
detail
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_OCTAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_OCTAHEDRON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
||||||
|
detail = 0;
|
||||||
|
}
|
||||||
|
this.detail = detail;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Octahedron.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Octahedron.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Octahedron;
|
|
@ -0,0 +1,53 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Parametric
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param generatorFn(u,v) => returns Vector3, u and v is values between 0 and 1
|
||||||
|
* @param slices
|
||||||
|
* @param stacks
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Parametric = function(
|
||||||
|
apiGeometry,
|
||||||
|
generatorFn,
|
||||||
|
slices,
|
||||||
|
stacks
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PARAMETRIC
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PARAMETRIC;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(generatorFn)) {
|
||||||
|
generatorFn = '';
|
||||||
|
}
|
||||||
|
this.generatorFn = generatorFn;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(slices)) {
|
||||||
|
slices = 20;
|
||||||
|
}
|
||||||
|
this.slices = slices;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(stacks)) {
|
||||||
|
stacks = 20;
|
||||||
|
}
|
||||||
|
this.stacks = stacks;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Parametric.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Parametric.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Parametric;
|
|
@ -0,0 +1,60 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Plane
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param width
|
||||||
|
* @param height
|
||||||
|
* @param widthSegments
|
||||||
|
* @param heightSegments
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Plane = function(
|
||||||
|
apiGeometry,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
widthSegments,
|
||||||
|
heightSegments
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PLANE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PLANE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(width)) {
|
||||||
|
width = 1;
|
||||||
|
}
|
||||||
|
this.width = width;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(height)) {
|
||||||
|
height = 1;
|
||||||
|
}
|
||||||
|
this.height = height;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(widthSegments)) {
|
||||||
|
widthSegments = 1;
|
||||||
|
}
|
||||||
|
this.widthSegments = widthSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
||||||
|
heightSegments = 1;
|
||||||
|
}
|
||||||
|
this.heightSegments = heightSegments;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Plane.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Plane.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Plane;
|
|
@ -0,0 +1,60 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Polyhedron
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param vertices
|
||||||
|
* @param indices
|
||||||
|
* @param radius
|
||||||
|
* @param detail
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Polyhedron = function(
|
||||||
|
apiGeometry,
|
||||||
|
vertices,
|
||||||
|
indices,
|
||||||
|
radius,
|
||||||
|
detail
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_POLYHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_POLYHEDRON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(vertices)) {
|
||||||
|
vertices = [];
|
||||||
|
}
|
||||||
|
this.vertices = vertices;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(indices)) {
|
||||||
|
indices = 1;
|
||||||
|
}
|
||||||
|
this.indices = indices;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 5;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
||||||
|
detail = 0;
|
||||||
|
}
|
||||||
|
this.detail = detail;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Polyhedron.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Polyhedron.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Polyhedron;
|
|
@ -0,0 +1,74 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Ring
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param innerRadius
|
||||||
|
* @param outerRadius
|
||||||
|
* @param thetaSegments
|
||||||
|
* @param phiSegments
|
||||||
|
* @param thetaStart
|
||||||
|
* @param thetaLength
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Ring = function(
|
||||||
|
apiGeometry,
|
||||||
|
innerRadius,
|
||||||
|
outerRadius,
|
||||||
|
thetaSegments,
|
||||||
|
phiSegments,
|
||||||
|
thetaStart,
|
||||||
|
thetaLength
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(innerRadius)) {
|
||||||
|
innerRadius = 0.5;
|
||||||
|
}
|
||||||
|
this.innerRadius = innerRadius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(outerRadius)) {
|
||||||
|
outerRadius = 1;
|
||||||
|
}
|
||||||
|
this.outerRadius = outerRadius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(thetaSegments)) {
|
||||||
|
thetaSegments = 8;
|
||||||
|
}
|
||||||
|
this.thetaSegments = thetaSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(phiSegments)) {
|
||||||
|
phiSegments = 8;
|
||||||
|
}
|
||||||
|
this.phiSegments = phiSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(thetaStart)) {
|
||||||
|
thetaStart = 0;
|
||||||
|
}
|
||||||
|
this.thetaStart = thetaStart;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(thetaLength)) {
|
||||||
|
thetaLength = Math.PI * 2;
|
||||||
|
}
|
||||||
|
this.thetaLength = thetaLength;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Ring.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Ring.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Ring;
|
|
@ -0,0 +1,46 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Shape
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param shapes
|
||||||
|
* @param curveSegments
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Shape = function(
|
||||||
|
apiGeometry,
|
||||||
|
shapes,
|
||||||
|
curveSegments
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(shapes)) {
|
||||||
|
shapes = [];
|
||||||
|
}
|
||||||
|
this.shapes = shapes;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(curveSegments)) {
|
||||||
|
curveSegments = 12;
|
||||||
|
}
|
||||||
|
this.curveSegments = curveSegments;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Shape.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Shape.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Shape;
|
|
@ -0,0 +1,81 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Sphere
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param widthSegments
|
||||||
|
* @param heightSegments
|
||||||
|
* @param phiStart
|
||||||
|
* @param phiLength
|
||||||
|
* @param thetaStart
|
||||||
|
* @param thetaLength
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Sphere = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
widthSegments,
|
||||||
|
heightSegments,
|
||||||
|
phiStart,
|
||||||
|
phiLength,
|
||||||
|
thetaStart,
|
||||||
|
thetaLength
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SPHERE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SPHERE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(widthSegments)) {
|
||||||
|
widthSegments = 8;
|
||||||
|
}
|
||||||
|
this.widthSegments = widthSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(heightSegments)) {
|
||||||
|
heightSegments = 6;
|
||||||
|
}
|
||||||
|
this.heightSegments = heightSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(phiStart)) {
|
||||||
|
phiStart = 0;
|
||||||
|
}
|
||||||
|
this.phiStart = phiStart;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(phiLength)) {
|
||||||
|
phiLength = Math.PI * 2;
|
||||||
|
}
|
||||||
|
this.phiLength = phiLength;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(thetaStart)) {
|
||||||
|
thetaStart = 0;
|
||||||
|
}
|
||||||
|
this.thetaStart = thetaStart;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(thetaLength)) {
|
||||||
|
thetaLength = Math.PI;
|
||||||
|
}
|
||||||
|
this.thetaLength = thetaLength;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Sphere.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Sphere.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Sphere;
|
|
@ -0,0 +1,46 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Tetrahedron
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param detail
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Tetrahedron = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
detail
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TETRAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TETRAHEDRON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
||||||
|
detail = 0;
|
||||||
|
}
|
||||||
|
this.detail = detail;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Tetrahedron.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Tetrahedron.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Tetrahedron;
|
|
@ -1,6 +1,6 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.BufferGeometry.Text
|
* GameLib.D3.API.Geometry.Buffer.Text
|
||||||
* @param apiBufferGeometry
|
* @param apiGeometry
|
||||||
* @param text
|
* @param text
|
||||||
* @param font
|
* @param font
|
||||||
* @param size
|
* @param size
|
||||||
|
@ -12,8 +12,8 @@
|
||||||
* @param bevelSegments
|
* @param bevelSegments
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.BufferGeometry.Text = function(
|
GameLib.D3.API.Geometry.Buffer.Text = function(
|
||||||
apiBufferGeometry,
|
apiGeometry,
|
||||||
text,
|
text,
|
||||||
font,
|
font,
|
||||||
size,
|
size,
|
||||||
|
@ -25,14 +25,14 @@ GameLib.D3.API.BufferGeometry.Text = function(
|
||||||
bevelSegments
|
bevelSegments
|
||||||
) {
|
) {
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiBufferGeometry = {
|
apiGeometry = {
|
||||||
bufferGeometryType: GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TEXT
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry.bufferGeometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiBufferGeometry.bufferGeometryType = GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TEXT;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(text)) {
|
if (GameLib.Utils.UndefinedOrNull(text)) {
|
||||||
|
@ -46,12 +46,12 @@ GameLib.D3.API.BufferGeometry.Text = function(
|
||||||
this.font = font;
|
this.font = font;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(size)) {
|
if (GameLib.Utils.UndefinedOrNull(size)) {
|
||||||
size = 100;
|
size = 10;
|
||||||
}
|
}
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(height)) {
|
if (GameLib.Utils.UndefinedOrNull(height)) {
|
||||||
height = 50;
|
height = 5;
|
||||||
}
|
}
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ GameLib.D3.API.BufferGeometry.Text = function(
|
||||||
this.bevelEnabled = bevelEnabled;
|
this.bevelEnabled = bevelEnabled;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(bevelThickness)) {
|
if (GameLib.Utils.UndefinedOrNull(bevelThickness)) {
|
||||||
bevelThickness = 10;
|
bevelThickness = 1;
|
||||||
}
|
}
|
||||||
this.bevelThickness = bevelThickness;
|
this.bevelThickness = bevelThickness;
|
||||||
|
|
||||||
|
@ -80,23 +80,16 @@ GameLib.D3.API.BufferGeometry.Text = function(
|
||||||
}
|
}
|
||||||
this.bevelSegments = bevelSegments;
|
this.bevelSegments = bevelSegments;
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
this,
|
this,
|
||||||
apiBufferGeometry.id,
|
apiGeometry,
|
||||||
apiBufferGeometry.name,
|
apiGeometry.attributes,
|
||||||
apiBufferGeometry.bufferGeometryType,
|
apiGeometry.drawRange,
|
||||||
apiBufferGeometry.parentEntity,
|
apiGeometry.groups,
|
||||||
apiBufferGeometry.faces,
|
apiGeometry.index,
|
||||||
apiBufferGeometry.vertices,
|
apiGeometry.morphAttributes
|
||||||
apiBufferGeometry.attributes,
|
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
|
||||||
apiBufferGeometry.groups,
|
|
||||||
apiBufferGeometry.index,
|
|
||||||
apiBufferGeometry.morphAttributes
|
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Text.prototype = Object.create(GameLib.D3.API.BufferGeometry.prototype);
|
GameLib.D3.API.Geometry.Buffer.Text.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
GameLib.D3.API.BufferGeometry.Text.prototype.constructor = GameLib.D3.API.BufferGeometry.Text;
|
GameLib.D3.API.Geometry.Buffer.Text.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Text;
|
|
@ -0,0 +1,74 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.TorusKnot
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param tube
|
||||||
|
* @param radialSegments
|
||||||
|
* @param tubularSegments
|
||||||
|
* @param p
|
||||||
|
* @param q
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.TorusKnot = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
tube,
|
||||||
|
radialSegments,
|
||||||
|
tubularSegments,
|
||||||
|
p,
|
||||||
|
q
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(tube)) {
|
||||||
|
tube = 0.4;
|
||||||
|
}
|
||||||
|
this.tube = tube;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radialSegments)) {
|
||||||
|
radialSegments = 8;
|
||||||
|
}
|
||||||
|
this.radialSegments = radialSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(tubularSegments)) {
|
||||||
|
tubularSegments = 64;
|
||||||
|
}
|
||||||
|
this.tubularSegments = tubularSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(p)) {
|
||||||
|
p = 2;
|
||||||
|
}
|
||||||
|
this.p = p;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(q)) {
|
||||||
|
q = 3;
|
||||||
|
}
|
||||||
|
this.q = q;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.TorusKnot.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.TorusKnot.prototype.constructor = GameLib.D3.API.Geometry.Buffer.TorusKnot;
|
|
@ -0,0 +1,67 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Torus
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param tube
|
||||||
|
* @param radialSegments
|
||||||
|
* @param tubularSegments
|
||||||
|
* @param arc
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Torus = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
tube,
|
||||||
|
radialSegments,
|
||||||
|
tubularSegments,
|
||||||
|
arc
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(tube)) {
|
||||||
|
tube = 0.4;
|
||||||
|
}
|
||||||
|
this.tube = tube;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radialSegments)) {
|
||||||
|
radialSegments = 8;
|
||||||
|
}
|
||||||
|
this.radialSegments = radialSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(tubularSegments)) {
|
||||||
|
tubularSegments = 6;
|
||||||
|
}
|
||||||
|
this.tubularSegments = tubularSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(arc)) {
|
||||||
|
arc = Math.PI * 2;
|
||||||
|
}
|
||||||
|
this.arc = arc;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Torus.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Torus.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Torus;
|
|
@ -0,0 +1,67 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Buffer.Tube
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param path
|
||||||
|
* @param tubularSegments
|
||||||
|
* @param radius
|
||||||
|
* @param radialSegments
|
||||||
|
* @param closed
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Tube = function(
|
||||||
|
apiGeometry,
|
||||||
|
path,
|
||||||
|
tubularSegments,
|
||||||
|
radius,
|
||||||
|
radialSegments,
|
||||||
|
closed
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TUBE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TUBE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(path)) {
|
||||||
|
path = null;
|
||||||
|
}
|
||||||
|
this.path = path;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(tubularSegments)) {
|
||||||
|
tubularSegments = 64;
|
||||||
|
}
|
||||||
|
this.tubularSegments = tubularSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radialSegments)) {
|
||||||
|
radialSegments = 8;
|
||||||
|
}
|
||||||
|
this.radialSegments = radialSegments;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(closed)) {
|
||||||
|
closed = false;
|
||||||
|
}
|
||||||
|
this.closed = closed;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.attributes,
|
||||||
|
apiGeometry.drawRange,
|
||||||
|
apiGeometry.groups,
|
||||||
|
apiGeometry.index,
|
||||||
|
apiGeometry.morphAttributes
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Tube.prototype = Object.create(GameLib.D3.API.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Tube.prototype.constructor = GameLib.D3.API.Geometry.Buffer.Tube;
|
|
@ -1,63 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.Geometry.Dodecahedron
|
|
||||||
* @param apiGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param detail
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.Geometry.Dodecahedron = function(
|
|
||||||
apiGeometry,
|
|
||||||
radius,
|
|
||||||
detail
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
|
||||||
apiGeometry = {
|
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_DODECAHEDRON
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_DODECAHEDRON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
|
||||||
detail = 0;
|
|
||||||
}
|
|
||||||
this.detail = detail;
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
|
||||||
this,
|
|
||||||
apiGeometry.id,
|
|
||||||
apiGeometry.name,
|
|
||||||
apiGeometry.geometryType,
|
|
||||||
|
|
||||||
apiGeometry.parentEntity,
|
|
||||||
apiGeometry.boundingBox,
|
|
||||||
apiGeometry.boundingSphere,
|
|
||||||
apiGeometry.colors,
|
|
||||||
apiGeometry.faces,
|
|
||||||
|
|
||||||
apiGeometry.lineDistances,
|
|
||||||
apiGeometry.morphTargets,
|
|
||||||
apiGeometry.morphNormals,
|
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Dodecahedron.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
|
||||||
GameLib.D3.API.Geometry.Dodecahedron.prototype.constructor = GameLib.D3.API.Geometry.Dodecahedron;
|
|
|
@ -1,63 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.Geometry.Edges
|
|
||||||
* @param apiGeometry
|
|
||||||
* @param geometry
|
|
||||||
* @param thresholdAngle (degrees)
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.Geometry.Edges = function(
|
|
||||||
apiGeometry,
|
|
||||||
geometry,
|
|
||||||
thresholdAngle
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
|
||||||
apiGeometry = {
|
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_EDGES
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_EDGES;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(geometry)) {
|
|
||||||
geometry = null;
|
|
||||||
}
|
|
||||||
this.geometry = geometry;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(thresholdAngle)) {
|
|
||||||
thresholdAngle = 1;
|
|
||||||
}
|
|
||||||
this.thresholdAngle = thresholdAngle;
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
|
||||||
this,
|
|
||||||
apiGeometry.id,
|
|
||||||
apiGeometry.name,
|
|
||||||
apiGeometry.geometryType,
|
|
||||||
|
|
||||||
apiGeometry.parentEntity,
|
|
||||||
apiGeometry.boundingBox,
|
|
||||||
apiGeometry.boundingSphere,
|
|
||||||
apiGeometry.colors,
|
|
||||||
apiGeometry.faces,
|
|
||||||
|
|
||||||
apiGeometry.lineDistances,
|
|
||||||
apiGeometry.morphTargets,
|
|
||||||
apiGeometry.morphNormals,
|
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Edges.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
|
||||||
GameLib.D3.API.Geometry.Edges.prototype.constructor = GameLib.D3.API.Geometry.Edges;
|
|
|
@ -1,63 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.Geometry.Icosahedron
|
|
||||||
* @param apiGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param detail
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.Geometry.Icosahedron = function(
|
|
||||||
apiGeometry,
|
|
||||||
radius,
|
|
||||||
detail
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
|
||||||
apiGeometry = {
|
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_ICOSAHEDRON
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_ICOSAHEDRON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
|
||||||
detail = 0;
|
|
||||||
}
|
|
||||||
this.detail = detail;
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
|
||||||
this,
|
|
||||||
apiGeometry.id,
|
|
||||||
apiGeometry.name,
|
|
||||||
apiGeometry.geometryType,
|
|
||||||
|
|
||||||
apiGeometry.parentEntity,
|
|
||||||
apiGeometry.boundingBox,
|
|
||||||
apiGeometry.boundingSphere,
|
|
||||||
apiGeometry.colors,
|
|
||||||
apiGeometry.faces,
|
|
||||||
|
|
||||||
apiGeometry.lineDistances,
|
|
||||||
apiGeometry.morphTargets,
|
|
||||||
apiGeometry.morphNormals,
|
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Icosahedron.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
|
||||||
GameLib.D3.API.Geometry.Icosahedron.prototype.constructor = GameLib.D3.API.Geometry.Icosahedron;
|
|
|
@ -0,0 +1,125 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param colors
|
||||||
|
* @param lineDistances
|
||||||
|
* @param morphTargets
|
||||||
|
* @param morphNormals
|
||||||
|
* @param skinWeights
|
||||||
|
* @param skinIndices
|
||||||
|
* @param verticesNeedsUpdate
|
||||||
|
* @param elementsNeedUpdate
|
||||||
|
* @param uvsNeedUpdate
|
||||||
|
* @param normalsNeedUpdate
|
||||||
|
* @param colorsNeedUpdate
|
||||||
|
* @param groupsNeedUpdate
|
||||||
|
* @param lineDistancesNeedUpdate
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Normal = function(
|
||||||
|
apiGeometry,
|
||||||
|
colors,
|
||||||
|
lineDistances,
|
||||||
|
morphTargets,
|
||||||
|
morphNormals,
|
||||||
|
skinWeights,
|
||||||
|
skinIndices,
|
||||||
|
verticesNeedsUpdate,
|
||||||
|
elementsNeedUpdate,
|
||||||
|
uvsNeedUpdate,
|
||||||
|
normalsNeedUpdate,
|
||||||
|
colorsNeedUpdate,
|
||||||
|
groupsNeedUpdate,
|
||||||
|
lineDistancesNeedUpdate
|
||||||
|
) {
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(colors)) {
|
||||||
|
colors = [];
|
||||||
|
}
|
||||||
|
this.colors = colors;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(lineDistances)) {
|
||||||
|
lineDistances = [];
|
||||||
|
}
|
||||||
|
this.lineDistances = lineDistances;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(morphTargets)) {
|
||||||
|
morphTargets = [];
|
||||||
|
}
|
||||||
|
this.morphTargets = morphTargets;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(morphNormals)) {
|
||||||
|
morphNormals = [];
|
||||||
|
}
|
||||||
|
this.morphNormals = morphNormals;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(skinWeights)) {
|
||||||
|
skinWeights = [];
|
||||||
|
}
|
||||||
|
this.skinWeights = skinWeights;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(skinIndices)) {
|
||||||
|
skinIndices = [];
|
||||||
|
}
|
||||||
|
this.skinIndices = skinIndices;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(verticesNeedsUpdate)) {
|
||||||
|
verticesNeedsUpdate = false;
|
||||||
|
}
|
||||||
|
this.verticesNeedsUpdate = verticesNeedsUpdate;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(elementsNeedUpdate)) {
|
||||||
|
elementsNeedUpdate = false;
|
||||||
|
}
|
||||||
|
this.elementsNeedUpdate = elementsNeedUpdate;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(uvsNeedUpdate)) {
|
||||||
|
uvsNeedUpdate = false;
|
||||||
|
}
|
||||||
|
this.uvsNeedUpdate = uvsNeedUpdate;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(normalsNeedUpdate)) {
|
||||||
|
normalsNeedUpdate = false;
|
||||||
|
}
|
||||||
|
this.normalsNeedUpdate = normalsNeedUpdate;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(colorsNeedUpdate)) {
|
||||||
|
colorsNeedUpdate = false;
|
||||||
|
}
|
||||||
|
this.colorsNeedUpdate = colorsNeedUpdate;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(groupsNeedUpdate)) {
|
||||||
|
groupsNeedUpdate = false;
|
||||||
|
}
|
||||||
|
this.groupsNeedUpdate = groupsNeedUpdate;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(lineDistancesNeedUpdate)) {
|
||||||
|
lineDistancesNeedUpdate = false;
|
||||||
|
}
|
||||||
|
this.lineDistancesNeedUpdate = lineDistancesNeedUpdate;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.call(
|
||||||
|
this,
|
||||||
|
apiGeometry.id,
|
||||||
|
apiGeometry.name,
|
||||||
|
apiGeometry.geometryType,
|
||||||
|
apiGeometry.parentEntity,
|
||||||
|
apiGeometry.parentMesh,
|
||||||
|
apiGeometry.boundingBox,
|
||||||
|
apiGeometry.boundingSphere,
|
||||||
|
apiGeometry.faces,
|
||||||
|
apiGeometry.vertices
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Normal.prototype.constructor = GameLib.D3.API.Geometry.Normal;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Box
|
* GameLib.D3.API.Geometry.Normal.Box
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param width
|
* @param width
|
||||||
* @param height
|
* @param height
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
* @param depthSegments
|
* @param depthSegments
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Box = function(
|
GameLib.D3.API.Geometry.Normal.Box = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
@ -21,12 +21,12 @@ GameLib.D3.API.Geometry.Box = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_BOX
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_BOX
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_BOX;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_BOX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(width)) {
|
if (GameLib.Utils.UndefinedOrNull(width)) {
|
||||||
|
@ -59,33 +59,24 @@ GameLib.D3.API.Geometry.Box = function(
|
||||||
}
|
}
|
||||||
this.depthSegments = depthSegments;
|
this.depthSegments = depthSegments;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Box.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Box.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Box.prototype.constructor = GameLib.D3.API.Geometry.Box;
|
GameLib.D3.API.Geometry.Normal.Box.prototype.constructor = GameLib.D3.API.Geometry.Normal.Box;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Circle
|
* GameLib.D3.API.Geometry.Normal.Circle
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param radius
|
* @param radius
|
||||||
* @param segments
|
* @param segments
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
* @param thetaLength
|
* @param thetaLength
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Circle = function(
|
GameLib.D3.API.Geometry.Normal.Circle = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
radius,
|
radius,
|
||||||
segments,
|
segments,
|
||||||
|
@ -17,12 +17,12 @@ GameLib.D3.API.Geometry.Circle = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_CIRCLE
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CIRCLE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_CIRCLE;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CIRCLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
@ -45,33 +45,24 @@ GameLib.D3.API.Geometry.Circle = function(
|
||||||
}
|
}
|
||||||
this.thetaLength = thetaLength;
|
this.thetaLength = thetaLength;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Circle.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Circle.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Circle.prototype.constructor = GameLib.D3.API.Geometry.Circle;
|
GameLib.D3.API.Geometry.Normal.Circle.prototype.constructor = GameLib.D3.API.Geometry.Normal.Circle;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Cone
|
* GameLib.D3.API.Geometry.Normal.Cone
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param radius
|
* @param radius
|
||||||
* @param height
|
* @param height
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
* @param thetaLength
|
* @param thetaLength
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Cone = function(
|
GameLib.D3.API.Geometry.Normal.Cone = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
radius,
|
radius,
|
||||||
height,
|
height,
|
||||||
|
@ -23,12 +23,12 @@ GameLib.D3.API.Geometry.Cone = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_CONE
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CONE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_CONE;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
@ -66,33 +66,24 @@ GameLib.D3.API.Geometry.Cone = function(
|
||||||
}
|
}
|
||||||
this.thetaLength = thetaLength;
|
this.thetaLength = thetaLength;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Cone.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Cone.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Cone.prototype.constructor = GameLib.D3.API.Geometry.Cone;
|
GameLib.D3.API.Geometry.Normal.Cone.prototype.constructor = GameLib.D3.API.Geometry.Normal.Cone;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Cylinder
|
* GameLib.D3.API.Geometry.Normal.Cylinder
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param radiusTop
|
* @param radiusTop
|
||||||
* @param radiusBottom
|
* @param radiusBottom
|
||||||
|
@ -11,7 +11,7 @@
|
||||||
* @param thetaLength
|
* @param thetaLength
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Cylinder = function(
|
GameLib.D3.API.Geometry.Normal.Cylinder = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
radiusTop,
|
radiusTop,
|
||||||
radiusBottom,
|
radiusBottom,
|
||||||
|
@ -25,12 +25,12 @@ GameLib.D3.API.Geometry.Cylinder = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_CYLINDER
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CYLINDER
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_CYLINDER;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CYLINDER;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radiusTop)) {
|
if (GameLib.Utils.UndefinedOrNull(radiusTop)) {
|
||||||
|
@ -73,33 +73,24 @@ GameLib.D3.API.Geometry.Cylinder = function(
|
||||||
}
|
}
|
||||||
this.thetaLength = thetaLength;
|
this.thetaLength = thetaLength;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Cylinder.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Cylinder.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Cylinder.prototype.constructor = GameLib.D3.API.Geometry.Cylinder;
|
GameLib.D3.API.Geometry.Normal.Cylinder.prototype.constructor = GameLib.D3.API.Geometry.Normal.Cylinder;
|
|
@ -0,0 +1,54 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Normal.Dodecahedron
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param detail
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Normal.Dodecahedron = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
detail
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_DODECAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_DODECAHEDRON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
||||||
|
detail = 0;
|
||||||
|
}
|
||||||
|
this.detail = detail;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.colors,
|
||||||
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
|
apiGeometry.morphNormals,
|
||||||
|
apiGeometry.skinWeights,
|
||||||
|
apiGeometry.skinIndices,
|
||||||
|
apiGeometry.verticesNeedsUpdate,
|
||||||
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
|
apiGeometry.normalsNeedUpdate,
|
||||||
|
apiGeometry.colorsNeedUpdate,
|
||||||
|
apiGeometry.groupsNeedUpdate,
|
||||||
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.Dodecahedron.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Normal.Dodecahedron.prototype.constructor = GameLib.D3.API.Geometry.Normal.Dodecahedron;
|
|
@ -0,0 +1,54 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Normal.Edges
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param geometry
|
||||||
|
* @param thresholdAngle (degrees)
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Normal.Edges = function(
|
||||||
|
apiGeometry,
|
||||||
|
geometry,
|
||||||
|
thresholdAngle
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EDGES
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EDGES;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(geometry)) {
|
||||||
|
geometry = null;
|
||||||
|
}
|
||||||
|
this.geometry = geometry;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(thresholdAngle)) {
|
||||||
|
thresholdAngle = 1;
|
||||||
|
}
|
||||||
|
this.thresholdAngle = thresholdAngle;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.colors,
|
||||||
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
|
apiGeometry.morphNormals,
|
||||||
|
apiGeometry.skinWeights,
|
||||||
|
apiGeometry.skinIndices,
|
||||||
|
apiGeometry.verticesNeedsUpdate,
|
||||||
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
|
apiGeometry.normalsNeedUpdate,
|
||||||
|
apiGeometry.colorsNeedUpdate,
|
||||||
|
apiGeometry.groupsNeedUpdate,
|
||||||
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.Edges.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Normal.Edges.prototype.constructor = GameLib.D3.API.Geometry.Normal.Edges;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Extrude
|
* GameLib.D3.API.Geometry.Normal.Extrude
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param shapes
|
* @param shapes
|
||||||
* @param curveSegments
|
* @param curveSegments
|
||||||
|
@ -14,7 +14,7 @@
|
||||||
* @param UVGenerator
|
* @param UVGenerator
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Extrude = function(
|
GameLib.D3.API.Geometry.Normal.Extrude = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
shapes,
|
shapes,
|
||||||
curveSegments,
|
curveSegments,
|
||||||
|
@ -31,12 +31,12 @@ GameLib.D3.API.Geometry.Extrude = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_EXTRUDE
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EXTRUDE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_EXTRUDE;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EXTRUDE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(shapes)) {
|
if (GameLib.Utils.UndefinedOrNull(shapes)) {
|
||||||
|
@ -89,33 +89,24 @@ GameLib.D3.API.Geometry.Extrude = function(
|
||||||
}
|
}
|
||||||
this.UVGenerator = UVGenerator;
|
this.UVGenerator = UVGenerator;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Extrude.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Extrude.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Extrude.prototype.constructor = GameLib.D3.API.Geometry.Extrude;
|
GameLib.D3.API.Geometry.Normal.Extrude.prototype.constructor = GameLib.D3.API.Geometry.Normal.Extrude;
|
|
@ -0,0 +1,54 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Normal.Icosahedron
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param detail
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Normal.Icosahedron = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
detail
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_ICOSAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_ICOSAHEDRON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
||||||
|
detail = 0;
|
||||||
|
}
|
||||||
|
this.detail = detail;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.colors,
|
||||||
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
|
apiGeometry.morphNormals,
|
||||||
|
apiGeometry.skinWeights,
|
||||||
|
apiGeometry.skinIndices,
|
||||||
|
apiGeometry.verticesNeedsUpdate,
|
||||||
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
|
apiGeometry.normalsNeedUpdate,
|
||||||
|
apiGeometry.colorsNeedUpdate,
|
||||||
|
apiGeometry.groupsNeedUpdate,
|
||||||
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.Icosahedron.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Normal.Icosahedron.prototype.constructor = GameLib.D3.API.Geometry.Normal.Icosahedron;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Lathe
|
* GameLib.D3.API.Geometry.Normal.Lathe
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param points [GameLib.Vector2]
|
* @param points [GameLib.Vector2]
|
||||||
* @param segments
|
* @param segments
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
* @param phiLength
|
* @param phiLength
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Lathe = function(
|
GameLib.D3.API.Geometry.Normal.Lathe = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
points,
|
points,
|
||||||
segments,
|
segments,
|
||||||
|
@ -17,12 +17,12 @@ GameLib.D3.API.Geometry.Lathe = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_LATHE
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_LATHE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_LATHE;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_LATHE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(points)) {
|
if (GameLib.Utils.UndefinedOrNull(points)) {
|
||||||
|
@ -45,33 +45,24 @@ GameLib.D3.API.Geometry.Lathe = function(
|
||||||
}
|
}
|
||||||
this.phiLength = phiLength;
|
this.phiLength = phiLength;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Lathe.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Lathe.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Lathe.prototype.constructor = GameLib.D3.API.Geometry.Lathe;
|
GameLib.D3.API.Geometry.Normal.Lathe.prototype.constructor = GameLib.D3.API.Geometry.Normal.Lathe;
|
|
@ -0,0 +1,54 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Normal.Octahedron
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param detail
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Normal.Octahedron = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
detail
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_OCTAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_OCTAHEDRON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
||||||
|
detail = 0;
|
||||||
|
}
|
||||||
|
this.detail = detail;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.colors,
|
||||||
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
|
apiGeometry.morphNormals,
|
||||||
|
apiGeometry.skinWeights,
|
||||||
|
apiGeometry.skinIndices,
|
||||||
|
apiGeometry.verticesNeedsUpdate,
|
||||||
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
|
apiGeometry.normalsNeedUpdate,
|
||||||
|
apiGeometry.colorsNeedUpdate,
|
||||||
|
apiGeometry.groupsNeedUpdate,
|
||||||
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.Octahedron.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Normal.Octahedron.prototype.constructor = GameLib.D3.API.Geometry.Normal.Octahedron;
|
|
@ -1,12 +1,12 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Parametric
|
* GameLib.D3.API.Geometry.Normal.Parametric
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param generatorFn(u,v) => returns Vector3, u and v is values between 0 and 1
|
* @param generatorFn(u,v) => returns Vector3, u and v is values between 0 and 1
|
||||||
* @param slices
|
* @param slices
|
||||||
* @param stacks
|
* @param stacks
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Parametric = function(
|
GameLib.D3.API.Geometry.Normal.Parametric = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
generatorFn,
|
generatorFn,
|
||||||
slices,
|
slices,
|
||||||
|
@ -15,12 +15,12 @@ GameLib.D3.API.Geometry.Parametric = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_PARAMETRIC
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PARAMETRIC
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_PARAMETRIC;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PARAMETRIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(generatorFn)) {
|
if (GameLib.Utils.UndefinedOrNull(generatorFn)) {
|
||||||
|
@ -38,33 +38,24 @@ GameLib.D3.API.Geometry.Parametric = function(
|
||||||
}
|
}
|
||||||
this.stacks = stacks;
|
this.stacks = stacks;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Parametric.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Parametric.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Parametric.prototype.constructor = GameLib.D3.API.Geometry.Parametric;
|
GameLib.D3.API.Geometry.Normal.Parametric.prototype.constructor = GameLib.D3.API.Geometry.Normal.Parametric;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Plane
|
* GameLib.D3.API.Geometry.Normal.Plane
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param width
|
* @param width
|
||||||
* @param height
|
* @param height
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
* @param heightSegments
|
* @param heightSegments
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Plane = function(
|
GameLib.D3.API.Geometry.Normal.Plane = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
|
@ -17,12 +17,12 @@ GameLib.D3.API.Geometry.Plane = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_PLANE
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PLANE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_PLANE;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_PLANE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(width)) {
|
if (GameLib.Utils.UndefinedOrNull(width)) {
|
||||||
|
@ -45,33 +45,24 @@ GameLib.D3.API.Geometry.Plane = function(
|
||||||
}
|
}
|
||||||
this.heightSegments = heightSegments;
|
this.heightSegments = heightSegments;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Plane.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Plane.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Plane.prototype.constructor = GameLib.D3.API.Geometry.Plane;
|
GameLib.D3.API.Geometry.Normal.Plane.prototype.constructor = GameLib.D3.API.Geometry.Normal.Plane;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Polyhedron
|
* GameLib.D3.API.Geometry.Normal.Polyhedron
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param vertices
|
* @param vertices
|
||||||
* @param indices
|
* @param indices
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
* @param detail
|
* @param detail
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Polyhedron = function(
|
GameLib.D3.API.Geometry.Normal.Polyhedron = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
vertices,
|
vertices,
|
||||||
indices,
|
indices,
|
||||||
|
@ -17,12 +17,12 @@ GameLib.D3.API.Geometry.Polyhedron = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_POLYHEDRON
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_POLYHEDRON
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_POLYHEDRON;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_POLYHEDRON;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(vertices)) {
|
if (GameLib.Utils.UndefinedOrNull(vertices)) {
|
||||||
|
@ -45,33 +45,24 @@ GameLib.D3.API.Geometry.Polyhedron = function(
|
||||||
}
|
}
|
||||||
this.detail = detail;
|
this.detail = detail;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Polyhedron.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Polyhedron.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Polyhedron.prototype.constructor = GameLib.D3.API.Geometry.Polyhedron;
|
GameLib.D3.API.Geometry.Normal.Polyhedron.prototype.constructor = GameLib.D3.API.Geometry.Normal.Polyhedron;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Ring
|
* GameLib.D3.API.Geometry.Normal.Ring
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param innerRadius
|
* @param innerRadius
|
||||||
* @param outerRadius
|
* @param outerRadius
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
* @param thetaLength
|
* @param thetaLength
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Ring = function(
|
GameLib.D3.API.Geometry.Normal.Ring = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
innerRadius,
|
innerRadius,
|
||||||
outerRadius,
|
outerRadius,
|
||||||
|
@ -21,12 +21,12 @@ GameLib.D3.API.Geometry.Ring = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_RING
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_RING
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_RING;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_RING;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(innerRadius)) {
|
if (GameLib.Utils.UndefinedOrNull(innerRadius)) {
|
||||||
|
@ -59,33 +59,24 @@ GameLib.D3.API.Geometry.Ring = function(
|
||||||
}
|
}
|
||||||
this.thetaLength = thetaLength;
|
this.thetaLength = thetaLength;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Ring.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Ring.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Ring.prototype.constructor = GameLib.D3.API.Geometry.Ring;
|
GameLib.D3.API.Geometry.Normal.Ring.prototype.constructor = GameLib.D3.API.Geometry.Normal.Ring;
|
|
@ -0,0 +1,54 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Normal.Shape
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param shapes
|
||||||
|
* @param curveSegments
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Normal.Shape = function(
|
||||||
|
apiGeometry,
|
||||||
|
shapes,
|
||||||
|
curveSegments
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SHAPE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SHAPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(shapes)) {
|
||||||
|
shapes = [];
|
||||||
|
}
|
||||||
|
this.shapes = shapes;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(curveSegments)) {
|
||||||
|
curveSegments = 12;
|
||||||
|
}
|
||||||
|
this.curveSegments = curveSegments;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.colors,
|
||||||
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
|
apiGeometry.morphNormals,
|
||||||
|
apiGeometry.skinWeights,
|
||||||
|
apiGeometry.skinIndices,
|
||||||
|
apiGeometry.verticesNeedsUpdate,
|
||||||
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
|
apiGeometry.normalsNeedUpdate,
|
||||||
|
apiGeometry.colorsNeedUpdate,
|
||||||
|
apiGeometry.groupsNeedUpdate,
|
||||||
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.Shape.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Normal.Shape.prototype.constructor = GameLib.D3.API.Geometry.Normal.Shape;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Sphere
|
* GameLib.D3.API.Geometry.Normal.Sphere
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param radius
|
* @param radius
|
||||||
* @param widthSegments
|
* @param widthSegments
|
||||||
|
@ -10,7 +10,7 @@
|
||||||
* @param thetaLength
|
* @param thetaLength
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Sphere = function(
|
GameLib.D3.API.Geometry.Normal.Sphere = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
radius,
|
radius,
|
||||||
widthSegments,
|
widthSegments,
|
||||||
|
@ -23,12 +23,12 @@ GameLib.D3.API.Geometry.Sphere = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_SPHERE
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SPHERE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_SPHERE;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SPHERE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
@ -62,37 +62,28 @@ GameLib.D3.API.Geometry.Sphere = function(
|
||||||
this.thetaStart = thetaStart;
|
this.thetaStart = thetaStart;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(thetaLength)) {
|
if (GameLib.Utils.UndefinedOrNull(thetaLength)) {
|
||||||
thetaLength = Math.PI * 2;
|
thetaLength = Math.PI;
|
||||||
}
|
}
|
||||||
this.thetaLength = thetaLength;
|
this.thetaLength = thetaLength;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Sphere.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Sphere.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Sphere.prototype.constructor = GameLib.D3.API.Geometry.Sphere;
|
GameLib.D3.API.Geometry.Normal.Sphere.prototype.constructor = GameLib.D3.API.Geometry.Normal.Sphere;
|
|
@ -0,0 +1,54 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Normal.Tetrahedron
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param radius
|
||||||
|
* @param detail
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Normal.Tetrahedron = function(
|
||||||
|
apiGeometry,
|
||||||
|
radius,
|
||||||
|
detail
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TETRAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TETRAHEDRON;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
radius = 1;
|
||||||
|
}
|
||||||
|
this.radius = radius;
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
||||||
|
detail = 0;
|
||||||
|
}
|
||||||
|
this.detail = detail;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.colors,
|
||||||
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
|
apiGeometry.morphNormals,
|
||||||
|
apiGeometry.skinWeights,
|
||||||
|
apiGeometry.skinIndices,
|
||||||
|
apiGeometry.verticesNeedsUpdate,
|
||||||
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
|
apiGeometry.normalsNeedUpdate,
|
||||||
|
apiGeometry.colorsNeedUpdate,
|
||||||
|
apiGeometry.groupsNeedUpdate,
|
||||||
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.Tetrahedron.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Normal.Tetrahedron.prototype.constructor = GameLib.D3.API.Geometry.Normal.Tetrahedron;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Text
|
* GameLib.D3.API.Geometry.Normal.Text
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param text
|
* @param text
|
||||||
* @param font
|
* @param font
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
* @param bevelSegments
|
* @param bevelSegments
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Text = function(
|
GameLib.D3.API.Geometry.Normal.Text = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
text,
|
text,
|
||||||
font,
|
font,
|
||||||
|
@ -27,12 +27,12 @@ GameLib.D3.API.Geometry.Text = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_TEXT
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TEXT
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_TEXT;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(text)) {
|
if (GameLib.Utils.UndefinedOrNull(text)) {
|
||||||
|
@ -46,12 +46,12 @@ GameLib.D3.API.Geometry.Text = function(
|
||||||
this.font = font;
|
this.font = font;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(size)) {
|
if (GameLib.Utils.UndefinedOrNull(size)) {
|
||||||
size = 100;
|
size = 10;
|
||||||
}
|
}
|
||||||
this.size = size;
|
this.size = size;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(height)) {
|
if (GameLib.Utils.UndefinedOrNull(height)) {
|
||||||
height = 50;
|
height = 5;
|
||||||
}
|
}
|
||||||
this.height = height;
|
this.height = height;
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ GameLib.D3.API.Geometry.Text = function(
|
||||||
this.bevelEnabled = bevelEnabled;
|
this.bevelEnabled = bevelEnabled;
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(bevelThickness)) {
|
if (GameLib.Utils.UndefinedOrNull(bevelThickness)) {
|
||||||
bevelThickness = 10;
|
bevelThickness = 1;
|
||||||
}
|
}
|
||||||
this.bevelThickness = bevelThickness;
|
this.bevelThickness = bevelThickness;
|
||||||
|
|
||||||
|
@ -80,33 +80,24 @@ GameLib.D3.API.Geometry.Text = function(
|
||||||
}
|
}
|
||||||
this.bevelSegments = bevelSegments;
|
this.bevelSegments = bevelSegments;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Text.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Text.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Text.prototype.constructor = GameLib.D3.API.Geometry.Text;
|
GameLib.D3.API.Geometry.Normal.Text.prototype.constructor = GameLib.D3.API.Geometry.Normal.Text;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.TorusKnot
|
* GameLib.D3.API.Geometry.Normal.TorusKnot
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param radius
|
* @param radius
|
||||||
* @param tube
|
* @param tube
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
* @param q
|
* @param q
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.TorusKnot = function(
|
GameLib.D3.API.Geometry.Normal.TorusKnot = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
radius,
|
radius,
|
||||||
tube,
|
tube,
|
||||||
|
@ -21,12 +21,12 @@ GameLib.D3.API.Geometry.TorusKnot = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_TORUS_KNOT
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS_KNOT
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_TORUS_KNOT;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS_KNOT;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
@ -59,33 +59,24 @@ GameLib.D3.API.Geometry.TorusKnot = function(
|
||||||
}
|
}
|
||||||
this.q = q;
|
this.q = q;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.TorusKnot.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.TorusKnot.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.TorusKnot.prototype.constructor = GameLib.D3.API.Geometry.TorusKnot;
|
GameLib.D3.API.Geometry.Normal.TorusKnot.prototype.constructor = GameLib.D3.API.Geometry.Normal.TorusKnot;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Torus
|
* GameLib.D3.API.Geometry.Normal.Torus
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param radius
|
* @param radius
|
||||||
* @param tube
|
* @param tube
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
* @param arc
|
* @param arc
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Torus = function(
|
GameLib.D3.API.Geometry.Normal.Torus = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
radius,
|
radius,
|
||||||
tube,
|
tube,
|
||||||
|
@ -19,12 +19,12 @@ GameLib.D3.API.Geometry.Torus = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_TORUS
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_TORUS;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TORUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
||||||
|
@ -52,33 +52,24 @@ GameLib.D3.API.Geometry.Torus = function(
|
||||||
}
|
}
|
||||||
this.arc = arc;
|
this.arc = arc;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Torus.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Torus.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Torus.prototype.constructor = GameLib.D3.API.Geometry.Torus;
|
GameLib.D3.API.Geometry.Normal.Torus.prototype.constructor = GameLib.D3.API.Geometry.Normal.Torus;
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.API.Geometry.Tube
|
* GameLib.D3.API.Geometry.Normal.Tube
|
||||||
* @param apiGeometry
|
* @param apiGeometry
|
||||||
* @param path
|
* @param path
|
||||||
* @param tubularSegments
|
* @param tubularSegments
|
||||||
|
@ -8,7 +8,7 @@
|
||||||
* @param closed
|
* @param closed
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.API.Geometry.Tube = function(
|
GameLib.D3.API.Geometry.Normal.Tube = function(
|
||||||
apiGeometry,
|
apiGeometry,
|
||||||
path,
|
path,
|
||||||
tubularSegments,
|
tubularSegments,
|
||||||
|
@ -19,12 +19,12 @@ GameLib.D3.API.Geometry.Tube = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_TUBE
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TUBE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_TUBE;
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TUBE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(path)) {
|
if (GameLib.Utils.UndefinedOrNull(path)) {
|
||||||
|
@ -52,33 +52,24 @@ GameLib.D3.API.Geometry.Tube = function(
|
||||||
}
|
}
|
||||||
this.closed = closed;
|
this.closed = closed;
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
this,
|
this,
|
||||||
apiGeometry.id,
|
apiGeometry,
|
||||||
apiGeometry.name,
|
apiGeometry.colors,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.morphNormals,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.skinWeights,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.skinIndices,
|
||||||
apiGeometry.colors,
|
apiGeometry.verticesNeedsUpdate,
|
||||||
apiGeometry.faces,
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.normalsNeedUpdate,
|
||||||
apiGeometry.morphTargets,
|
apiGeometry.colorsNeedUpdate,
|
||||||
apiGeometry.morphNormals,
|
apiGeometry.groupsNeedUpdate,
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Tube.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
GameLib.D3.API.Geometry.Normal.Tube.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
GameLib.D3.API.Geometry.Tube.prototype.constructor = GameLib.D3.API.Geometry.Tube;
|
GameLib.D3.API.Geometry.Normal.Tube.prototype.constructor = GameLib.D3.API.Geometry.Normal.Tube;
|
|
@ -0,0 +1,47 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.API.Geometry.Normal.Wireframe
|
||||||
|
* @param apiGeometry
|
||||||
|
* @param geometry
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.API.Geometry.Normal.Wireframe = function(
|
||||||
|
apiGeometry,
|
||||||
|
geometry
|
||||||
|
) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
|
apiGeometry = {
|
||||||
|
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_WIREFRAME
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
||||||
|
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_WIREFRAME;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(geometry)) {
|
||||||
|
geometry = null;
|
||||||
|
}
|
||||||
|
this.geometry = geometry;
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
|
this,
|
||||||
|
apiGeometry,
|
||||||
|
apiGeometry.colors,
|
||||||
|
apiGeometry.lineDistances,
|
||||||
|
apiGeometry.morphTargets,
|
||||||
|
apiGeometry.morphNormals,
|
||||||
|
apiGeometry.skinWeights,
|
||||||
|
apiGeometry.skinIndices,
|
||||||
|
apiGeometry.verticesNeedsUpdate,
|
||||||
|
apiGeometry.elementsNeedUpdate,
|
||||||
|
apiGeometry.uvsNeedUpdate,
|
||||||
|
apiGeometry.normalsNeedUpdate,
|
||||||
|
apiGeometry.colorsNeedUpdate,
|
||||||
|
apiGeometry.groupsNeedUpdate,
|
||||||
|
apiGeometry.lineDistancesNeedUpdate
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.Wireframe.prototype = Object.create(GameLib.D3.API.Geometry.Normal.prototype);
|
||||||
|
GameLib.D3.API.Geometry.Normal.Wireframe.prototype.constructor = GameLib.D3.API.Geometry.Normal.Wireframe;
|
|
@ -1,63 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.Geometry.Octahedron
|
|
||||||
* @param apiGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param detail
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.Geometry.Octahedron = function(
|
|
||||||
apiGeometry,
|
|
||||||
radius,
|
|
||||||
detail
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
|
||||||
apiGeometry = {
|
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_OCTAHEDRON
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_OCTAHEDRON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
|
||||||
detail = 0;
|
|
||||||
}
|
|
||||||
this.detail = detail;
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
|
||||||
this,
|
|
||||||
apiGeometry.id,
|
|
||||||
apiGeometry.name,
|
|
||||||
apiGeometry.geometryType,
|
|
||||||
|
|
||||||
apiGeometry.parentEntity,
|
|
||||||
apiGeometry.boundingBox,
|
|
||||||
apiGeometry.boundingSphere,
|
|
||||||
apiGeometry.colors,
|
|
||||||
apiGeometry.faces,
|
|
||||||
|
|
||||||
apiGeometry.lineDistances,
|
|
||||||
apiGeometry.morphTargets,
|
|
||||||
apiGeometry.morphNormals,
|
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Octahedron.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
|
||||||
GameLib.D3.API.Geometry.Octahedron.prototype.constructor = GameLib.D3.API.Geometry.Octahedron;
|
|
|
@ -1,63 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.Geometry.Shape
|
|
||||||
* @param apiGeometry
|
|
||||||
* @param shapes
|
|
||||||
* @param curveSegments
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.Geometry.Shape = function(
|
|
||||||
apiGeometry,
|
|
||||||
shapes,
|
|
||||||
curveSegments
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
|
||||||
apiGeometry = {
|
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_SHAPE
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_SHAPE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(shapes)) {
|
|
||||||
shapes = [];
|
|
||||||
}
|
|
||||||
this.shapes = shapes;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(curveSegments)) {
|
|
||||||
curveSegments = 12;
|
|
||||||
}
|
|
||||||
this.curveSegments = curveSegments;
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
|
||||||
this,
|
|
||||||
apiGeometry.id,
|
|
||||||
apiGeometry.name,
|
|
||||||
apiGeometry.geometryType,
|
|
||||||
|
|
||||||
apiGeometry.parentEntity,
|
|
||||||
apiGeometry.boundingBox,
|
|
||||||
apiGeometry.boundingSphere,
|
|
||||||
apiGeometry.colors,
|
|
||||||
apiGeometry.faces,
|
|
||||||
|
|
||||||
apiGeometry.lineDistances,
|
|
||||||
apiGeometry.morphTargets,
|
|
||||||
apiGeometry.morphNormals,
|
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Shape.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
|
||||||
GameLib.D3.API.Geometry.Shape.prototype.constructor = GameLib.D3.API.Geometry.Shape;
|
|
|
@ -1,63 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.Geometry.Tetrahedron
|
|
||||||
* @param apiGeometry
|
|
||||||
* @param radius
|
|
||||||
* @param detail
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.Geometry.Tetrahedron = function(
|
|
||||||
apiGeometry,
|
|
||||||
radius,
|
|
||||||
detail
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
|
||||||
apiGeometry = {
|
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_TETRAHEDRON
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_TETRAHEDRON;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(radius)) {
|
|
||||||
radius = 1;
|
|
||||||
}
|
|
||||||
this.radius = radius;
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(detail)) {
|
|
||||||
detail = 0;
|
|
||||||
}
|
|
||||||
this.detail = detail;
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
|
||||||
this,
|
|
||||||
apiGeometry.id,
|
|
||||||
apiGeometry.name,
|
|
||||||
apiGeometry.geometryType,
|
|
||||||
|
|
||||||
apiGeometry.parentEntity,
|
|
||||||
apiGeometry.boundingBox,
|
|
||||||
apiGeometry.boundingSphere,
|
|
||||||
apiGeometry.colors,
|
|
||||||
apiGeometry.faces,
|
|
||||||
|
|
||||||
apiGeometry.lineDistances,
|
|
||||||
apiGeometry.morphTargets,
|
|
||||||
apiGeometry.morphNormals,
|
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Tetrahedron.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
|
||||||
GameLib.D3.API.Geometry.Tetrahedron.prototype.constructor = GameLib.D3.API.Geometry.Tetrahedron;
|
|
|
@ -1,54 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.API.Geometry.Wireframe
|
|
||||||
* @param apiGeometry
|
|
||||||
* @param geometry
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.API.Geometry.Wireframe = function(
|
|
||||||
apiGeometry,
|
|
||||||
geometry
|
|
||||||
) {
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
|
||||||
apiGeometry = {
|
|
||||||
geometryType: GameLib.D3.API.Geometry.GEOMETRY_TYPE_WIREFRAME
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry.geometryType)) {
|
|
||||||
apiGeometry.geometryType = GameLib.D3.API.Geometry.GEOMETRY_TYPE_WIREFRAME;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(geometry)) {
|
|
||||||
geometry = null;
|
|
||||||
}
|
|
||||||
this.geometry = geometry;
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.call(
|
|
||||||
this,
|
|
||||||
apiGeometry.id,
|
|
||||||
apiGeometry.name,
|
|
||||||
apiGeometry.geometryType,
|
|
||||||
apiGeometry.parentEntity,
|
|
||||||
apiGeometry.boundingBox,
|
|
||||||
apiGeometry.boundingSphere,
|
|
||||||
apiGeometry.colors,
|
|
||||||
apiGeometry.faces,
|
|
||||||
apiGeometry.lineDistances,
|
|
||||||
apiGeometry.morphTargets,
|
|
||||||
apiGeometry.morphNormals,
|
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.API.Geometry.Wireframe.prototype = Object.create(GameLib.D3.API.Geometry.prototype);
|
|
||||||
GameLib.D3.API.Geometry.Wireframe.prototype.constructor = GameLib.D3.API.Geometry.Wireframe;
|
|
|
@ -1,103 +0,0 @@
|
||||||
/**
|
|
||||||
* GameLib.D3.BufferGeometry.Box
|
|
||||||
* @param graphics GameLib.GraphicsRuntime
|
|
||||||
* @param apiBoxBufferGeometry
|
|
||||||
* @constructor
|
|
||||||
*/
|
|
||||||
GameLib.D3.BufferGeometry.Box = function(
|
|
||||||
graphics,
|
|
||||||
apiBoxBufferGeometry
|
|
||||||
) {
|
|
||||||
|
|
||||||
this.graphics = graphics;
|
|
||||||
this.graphics.isNotThreeThrow();
|
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBoxBufferGeometry)) {
|
|
||||||
apiBoxBufferGeometry = {
|
|
||||||
bufferGeometryType : GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_BOX
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.Box.call(
|
|
||||||
this,
|
|
||||||
apiBoxBufferGeometry,
|
|
||||||
apiBoxBufferGeometry.width,
|
|
||||||
apiBoxBufferGeometry.height,
|
|
||||||
apiBoxBufferGeometry.depth,
|
|
||||||
apiBoxBufferGeometry.widthSegments,
|
|
||||||
apiBoxBufferGeometry.heightSegments,
|
|
||||||
apiBoxBufferGeometry.depthSegments
|
|
||||||
);
|
|
||||||
|
|
||||||
GameLib.D3.BufferGeometry.call(
|
|
||||||
this,
|
|
||||||
this.graphics,
|
|
||||||
apiBoxBufferGeometry
|
|
||||||
);
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.BufferGeometry.Box.prototype = Object.create(GameLib.D3.BufferGeometry.prototype);
|
|
||||||
GameLib.D3.BufferGeometry.Box.prototype.constructor = GameLib.D3.BufferGeometry.Box;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a light instance
|
|
||||||
* @returns {*}
|
|
||||||
*/
|
|
||||||
GameLib.D3.BufferGeometry.Box.prototype.createInstance = function() {
|
|
||||||
|
|
||||||
this.instance = new THREE.BoxBufferGeometry(
|
|
||||||
this.width,
|
|
||||||
this.height,
|
|
||||||
this.depth,
|
|
||||||
this.widthSegments,
|
|
||||||
this.heightSegments,
|
|
||||||
this.depthSegments
|
|
||||||
);
|
|
||||||
|
|
||||||
GameLib.D3.BufferGeometry.prototype.createInstance.call(this);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Updates the instance with the current state
|
|
||||||
*/
|
|
||||||
GameLib.D3.BufferGeometry.Box.prototype.updateInstance = function(property, oldTarget) {
|
|
||||||
|
|
||||||
if (
|
|
||||||
property === 'width' ||
|
|
||||||
property === 'height' ||
|
|
||||||
property === 'depth' ||
|
|
||||||
property === 'widthSegments' ||
|
|
||||||
property === 'heightSegments' ||
|
|
||||||
property === 'depthSegments'
|
|
||||||
) {
|
|
||||||
console.warn('todo: check if i can update this without creating a new instance');
|
|
||||||
//this.createInstance();
|
|
||||||
this.instance.width = this.width;
|
|
||||||
this.instance.attributes.position.needsUpdate = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GameLib.D3.BufferGeometry.prototype.updateInstance.call(this, property);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Converts a GameLib.D3.BufferGeometry to a GameLib.D3.API.BufferGeometry
|
|
||||||
* @returns {GameLib.D3.API.BufferGeometry}
|
|
||||||
*/
|
|
||||||
GameLib.D3.BufferGeometry.Box.prototype.toApiObject = function() {
|
|
||||||
|
|
||||||
var apiBufferGeometry = GameLib.D3.BufferGeometry.prototype.toApiObject.call(this);
|
|
||||||
|
|
||||||
var apiBoxBufferGeometry = new GameLib.D3.API.BufferGeometry.Box(
|
|
||||||
apiBufferGeometry,
|
|
||||||
this.width,
|
|
||||||
this.height,
|
|
||||||
this.depth,
|
|
||||||
this.widthSegments,
|
|
||||||
this.heightSegments,
|
|
||||||
this.depthSegments
|
|
||||||
);
|
|
||||||
|
|
||||||
return apiBoxBufferGeometry;
|
|
||||||
};
|
|
|
@ -42,6 +42,9 @@ GameLib.D3.Font.prototype.createInstance = function() {
|
||||||
},
|
},
|
||||||
function(fontInstance) {
|
function(fontInstance) {
|
||||||
this.instance = fontInstance;
|
this.instance = fontInstance;
|
||||||
|
|
||||||
|
console.log('font instance loaded');
|
||||||
|
|
||||||
GameLib.Component.prototype.createInstance.call(this);
|
GameLib.Component.prototype.createInstance.call(this);
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
function(error) {
|
function(error) {
|
||||||
|
@ -56,14 +59,11 @@ GameLib.D3.Font.prototype.createInstance = function() {
|
||||||
/**
|
/**
|
||||||
* Updates the instance with the current state
|
* Updates the instance with the current state
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Font.prototype.updateInstance = function() {
|
GameLib.D3.Font.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
GameLib.Event.Emit(
|
if (property === 'url') {
|
||||||
GameLib.Event.LOAD_FONT,
|
this.createInstance();
|
||||||
{
|
}
|
||||||
font : this
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
GameLib.Component.prototype.updateInstance.call(this, property);
|
GameLib.Component.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
|
@ -15,7 +15,7 @@ GameLib.D3.Geometry = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiGeometry)) {
|
||||||
apiGeometry = {
|
apiGeometry = {
|
||||||
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_NONE
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -25,34 +25,23 @@ GameLib.D3.Geometry = function(
|
||||||
apiGeometry.name,
|
apiGeometry.name,
|
||||||
apiGeometry.geometryType,
|
apiGeometry.geometryType,
|
||||||
apiGeometry.parentEntity,
|
apiGeometry.parentEntity,
|
||||||
|
apiGeometry.parentMesh,
|
||||||
apiGeometry.boundingBox,
|
apiGeometry.boundingBox,
|
||||||
apiGeometry.boundingSphere,
|
apiGeometry.boundingSphere,
|
||||||
apiGeometry.colors,
|
|
||||||
apiGeometry.faces,
|
apiGeometry.faces,
|
||||||
apiGeometry.lineDistances,
|
apiGeometry.vertices
|
||||||
apiGeometry.morphTargets,
|
|
||||||
apiGeometry.morphNormals,
|
|
||||||
apiGeometry.skinWeights,
|
|
||||||
apiGeometry.skinIndices,
|
|
||||||
apiGeometry.vertices,
|
|
||||||
apiGeometry.verticesNeedsUpdate,
|
|
||||||
apiGeometry.elementsNeedUpdate,
|
|
||||||
apiGeometry.uvsNeedUpdate,
|
|
||||||
apiGeometry.normalsNeedUpdate,
|
|
||||||
apiGeometry.colorsNeedUpdate,
|
|
||||||
apiGeometry.groupsNeedUpdate,
|
|
||||||
apiGeometry.lineDistancesNeedUpdate
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.colors = this.colors.map(
|
this.boundingBox = new GameLib.Box3(
|
||||||
function(color) {
|
this.graphics,
|
||||||
return new GameLib.Color(
|
this.boundingBox
|
||||||
this.graphics,
|
|
||||||
color
|
|
||||||
)
|
|
||||||
}.bind(this)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
this.boundingSphere = new GameLib.Sphere(
|
||||||
|
this.graphics,
|
||||||
|
this.boundingSphere
|
||||||
|
);
|
||||||
|
|
||||||
this.faces = this.faces.map(
|
this.faces = this.faces.map(
|
||||||
function(face) {
|
function(face) {
|
||||||
return new GameLib.D3.Face(
|
return new GameLib.D3.Face(
|
||||||
|
@ -61,27 +50,7 @@ GameLib.D3.Geometry = function(
|
||||||
)
|
)
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.skinWeights = this.skinWeights.map(
|
|
||||||
function(skinWeight) {
|
|
||||||
return new GameLib.Vector4(
|
|
||||||
this.graphics,
|
|
||||||
skinWeight,
|
|
||||||
this
|
|
||||||
)
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.skinIndices = this.skinIndices.map(
|
|
||||||
function(skinIndex) {
|
|
||||||
return new GameLib.Vector4(
|
|
||||||
this.graphics,
|
|
||||||
skinIndex,
|
|
||||||
this
|
|
||||||
)
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
this.vertices = this.vertices.map(
|
this.vertices = this.vertices.map(
|
||||||
function(vertex) {
|
function(vertex) {
|
||||||
return new GameLib.D3.Vertex(
|
return new GameLib.D3.Vertex(
|
||||||
|
@ -90,25 +59,36 @@ GameLib.D3.Geometry = function(
|
||||||
)
|
)
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
var linkedObjects = {};
|
var linkedObjects = {};
|
||||||
|
|
||||||
switch (this.geometryType) {
|
switch (this.geometryType) {
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_EDGES :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EDGES :
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_WIREFRAME :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_WIREFRAME :
|
||||||
linkedObjects.geometry = GameLib.D3.Geometry;
|
linkedObjects.geometry = GameLib.D3.Geometry;
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_EXTRUDE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_EXTRUDE :
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_SHAPE :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_SHAPE :
|
||||||
linkedObjects.shapes = [GameLib.Curve.Path.D2.Shape];
|
linkedObjects.shapes = [GameLib.Curve.Path.D2.Shape];
|
||||||
break;
|
break;
|
||||||
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_TEXT :
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_TEXT :
|
||||||
|
linkedObjects.font = GameLib.D3.Font;
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE:
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE :
|
||||||
|
linkedObjects.shapes = [GameLib.Curve.Path.D2.Shape];
|
||||||
|
break;
|
||||||
|
case GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT :
|
||||||
linkedObjects.font = GameLib.D3.Font;
|
linkedObjects.font = GameLib.D3.Font;
|
||||||
break;
|
break;
|
||||||
default :
|
default :
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this instanceof GameLib.D3.Geometry.Buffer) {
|
||||||
|
linkedObjects.groups = [GameLib.Group];
|
||||||
|
}
|
||||||
|
|
||||||
GameLib.Component.call(
|
GameLib.Component.call(
|
||||||
this,
|
this,
|
||||||
linkedObjects
|
linkedObjects
|
||||||
|
@ -118,61 +98,11 @@ GameLib.D3.Geometry = function(
|
||||||
GameLib.D3.Geometry.prototype = Object.create(GameLib.Component.prototype);
|
GameLib.D3.Geometry.prototype = Object.create(GameLib.Component.prototype);
|
||||||
GameLib.D3.Geometry.prototype.constructor = GameLib.D3.Geometry;
|
GameLib.D3.Geometry.prototype.constructor = GameLib.D3.Geometry;
|
||||||
|
|
||||||
GameLib.D3.Geometry.prototype.applyToInstance = function(property) {
|
|
||||||
|
|
||||||
if (property === 'faces') {
|
|
||||||
|
|
||||||
this.faces = GameLib.Utils.SortFacesByMaterialIndex(this.faces);
|
|
||||||
|
|
||||||
var standardUvs = [];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Now setup each face and collect UV information during this process
|
|
||||||
*/
|
|
||||||
this.instance.faces = this.faces.map(
|
|
||||||
function (face) {
|
|
||||||
|
|
||||||
if (face.uvs[0].length > 0) {
|
|
||||||
standardUvs.push(
|
|
||||||
face.uvs[0].map(
|
|
||||||
function (uv) {
|
|
||||||
return uv.instance;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!face.instance) {
|
|
||||||
face.createInstance(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return face.instance;
|
|
||||||
}.bind(this)
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* UV data - but only if it exists
|
|
||||||
*/
|
|
||||||
if (standardUvs.length > 0) {
|
|
||||||
this.instance.faceVertexUvs = [standardUvs];
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'vertices') {
|
|
||||||
this.instance.vertices = this.vertices.map(
|
|
||||||
function (vertex) {
|
|
||||||
return vertex.position.instance;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
GameLib.D3.Geometry.prototype.createInstance = function() {
|
GameLib.D3.Geometry.prototype.createInstance = function() {
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(this.instance)) {
|
if (GameLib.Utils.UndefinedOrNull(this.instance)) {
|
||||||
this.instance = new THREE.Geometry();
|
console.warn('do not instantiate this class directly');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.instance.name = this.name;
|
this.instance.name = this.name;
|
||||||
|
@ -200,88 +130,30 @@ GameLib.D3.Geometry.prototype.createInstance = function() {
|
||||||
this.boundingSphere.center.z = this.instance.boundingSphere.center.z;
|
this.boundingSphere.center.z = this.instance.boundingSphere.center.z;
|
||||||
this.boundingSphere.radius = this.instance.boundingSphere.radius;
|
this.boundingSphere.radius = this.instance.boundingSphere.radius;
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup colors
|
|
||||||
*/
|
|
||||||
this.instance.colors = this.colors.map(
|
|
||||||
function(color) {
|
|
||||||
return color.instance;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup faces
|
|
||||||
*/
|
|
||||||
this.applyToInstance('faces');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup line distances - we let three calculate it and then update our information
|
|
||||||
*/
|
|
||||||
this.instance.computeLineDistances();
|
|
||||||
this.lineDistances = this.instance.lineDistances;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Some more stuff
|
|
||||||
*/
|
|
||||||
if (this.morphTargets && this.morphTargets.length > 0) {
|
|
||||||
this.instance.morphTargets = this.morphTargets;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.morphNormals && this.morphNormals.length > 0) {
|
|
||||||
this.instance.morphNormals = this.morphNormals;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.skinWeights && this.skinWeights.length > 0) {
|
|
||||||
this.instance.skinWeights = this.skinWeights.map(
|
|
||||||
function(skinWeight) {
|
|
||||||
return skinWeight.instance;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.skinIndices && this.skinIndices.length > 0) {
|
|
||||||
this.instance.skinIndices = this.skinIndices.map(
|
|
||||||
function(skinIndex) {
|
|
||||||
return skinIndex.instance;
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup vertices
|
|
||||||
*/
|
|
||||||
this.applyToInstance('vertices');
|
|
||||||
|
|
||||||
this.instance.computeFaceNormals();
|
|
||||||
this.instance.computeVertexNormals();
|
|
||||||
|
|
||||||
// this.instance.verticesNeedUpdate = true;
|
|
||||||
// this.instance.elementsNeedUpdate = true;
|
|
||||||
// this.instance.uvsNeedUpdate = true;
|
|
||||||
// this.instance.normalsNeedUpdate = true;
|
|
||||||
// this.instance.colorsNeedUpdate = true;
|
|
||||||
// this.instance.groupsNeedUpdate = true;
|
|
||||||
// this.instance.lineDistancesNeedUpdate = true;
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * Re-compute normals - we don't do this for buffer geometry because it assigns to every vertex normal the face
|
|
||||||
// * normal - essentially disabling 'smooth shading'
|
|
||||||
// */
|
|
||||||
// geometry.computeFaceNormals();
|
|
||||||
// // geometry.computeBoundingBox();
|
|
||||||
// geometry.computeVertexNormals();
|
|
||||||
|
|
||||||
GameLib.Component.prototype.createInstance.call(this);
|
GameLib.Component.prototype.createInstance.call(this);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update Instance
|
||||||
|
* @param property
|
||||||
|
*/
|
||||||
GameLib.D3.Geometry.prototype.updateInstance = function(property) {
|
GameLib.D3.Geometry.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(this.instance)) {
|
if (GameLib.Utils.UndefinedOrNull(this.instance)) {
|
||||||
console.warn('no geometry instance');
|
console.warn('no geometry instance');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (property === 'parentMesh') {
|
||||||
|
if (this.parentMesh) {
|
||||||
|
console.log('geometry assigned to new parent mesh ' + this.parentMesh.name);
|
||||||
|
} else {
|
||||||
|
console.log('geometry removed from parent');
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (property === 'name') {
|
if (property === 'name') {
|
||||||
this.instance.name = this.name;
|
this.instance.name = this.name;
|
||||||
return;
|
return;
|
||||||
|
@ -297,115 +169,14 @@ GameLib.D3.Geometry.prototype.updateInstance = function(property) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'colors') {
|
if (
|
||||||
this.instance.colors = this.colors.map(
|
property === 'faces' ||
|
||||||
function(color) {
|
property === 'vertices'
|
||||||
return color.instance;
|
) {
|
||||||
}
|
console.warn('the child class should take care of updating faces or vertices');
|
||||||
);
|
return;
|
||||||
this.instance.colorsNeedUpdate = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'faces') {
|
|
||||||
this.applyToInstance(property);
|
|
||||||
this.instance.elementsNeedUpdate = true;
|
|
||||||
this.instance.groupsNeedUpdate = true;
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'lineDistances') {
|
|
||||||
this.instance.lineDistances = this.lineDistances;
|
|
||||||
this.instance.lineDistancesNeedUpdate = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'morphTargets') {
|
|
||||||
this.instance.morphTargets = this.morphTargets;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'morphNormals') {
|
|
||||||
this.instance.morphNormals = this.morphNormals;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'skinWeights') {
|
|
||||||
|
|
||||||
if (this.skinWeights) {
|
|
||||||
this.instance.skinWeights = this.skinWeights.map(
|
|
||||||
function(skinWeight) {
|
|
||||||
return skinWeight.instance;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
console.warn('todo : check deleting skinweights');
|
|
||||||
delete this.instance.skinWeights;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'skinIndices') {
|
|
||||||
|
|
||||||
if (this.skinIndices) {
|
|
||||||
this.instance.skinIndices = this.skinIndices.map(
|
|
||||||
function(skinIndex) {
|
|
||||||
return skinIndex.instance;
|
|
||||||
}
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
console.warn('todo : check deleting skinIndices');
|
|
||||||
delete this.instance.skinIndices;
|
|
||||||
}
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'vertices') {
|
|
||||||
this.applyToInstance(property);
|
|
||||||
this.instance.verticesNeedUpdate = true;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Manually trigger updates (and ignore our setting)
|
|
||||||
*/
|
|
||||||
if (property === 'verticesNeedsUpdate') {
|
|
||||||
this.instance.verticesNeedsUpdate = true;
|
|
||||||
this.verticesNeedUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'elementsNeedUpdate') {
|
|
||||||
this.instance.elementsNeedUpdate = true;
|
|
||||||
this.elementsNeedUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'uvsNeedUpdate') {
|
|
||||||
this.instance.uvsNeedUpdate = true;
|
|
||||||
this.uvsNeedUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'normalsNeedUpdate') {
|
|
||||||
this.instance.normalsNeedUpdate = true;
|
|
||||||
this.normalsNeedUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'colorsNeedUpdate') {
|
|
||||||
this.instance.colorsNeedUpdate = true;
|
|
||||||
this.colorsNeedUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'groupsNeedUpdate') {
|
|
||||||
this.instance.groupsNeedUpdate = true;
|
|
||||||
this.groupsNeedUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'lineDistancesNeedUpdate') {
|
|
||||||
this.instance.lineDistancesNeedUpdate = true;
|
|
||||||
this.lineDistancesNeedUpdate = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GameLib.Component.prototype.updateInstance.call(this, property);
|
GameLib.Component.prototype.updateInstance.call(this, property);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -416,36 +187,19 @@ GameLib.D3.Geometry.prototype.updateInstance = function(property) {
|
||||||
GameLib.D3.Geometry.prototype.toApiObject = function() {
|
GameLib.D3.Geometry.prototype.toApiObject = function() {
|
||||||
|
|
||||||
var apiGeometry = new GameLib.D3.API.Geometry(
|
var apiGeometry = new GameLib.D3.API.Geometry(
|
||||||
|
|
||||||
this.id,
|
this.id,
|
||||||
this.name,
|
this.name,
|
||||||
this.geometryType,
|
this.geometryType,
|
||||||
this.isBufferGeometry,
|
|
||||||
GameLib.Utils.IdOrNull(this.parentEntity),
|
GameLib.Utils.IdOrNull(this.parentEntity),
|
||||||
|
GameLib.Utils.IdOrNull(this.parentMesh),
|
||||||
this.boundingBox.toApiObject(),
|
this.boundingBox.toApiObject(),
|
||||||
this.boundingSphere.toApiObject(),
|
this.boundingSphere.toApiObject(),
|
||||||
this.colors.map(
|
|
||||||
function(color) {
|
|
||||||
return color.toApiObject();
|
|
||||||
}
|
|
||||||
),
|
|
||||||
this.faces.map(
|
this.faces.map(
|
||||||
function(face) {
|
function(face) {
|
||||||
return face.toApiObject();
|
return face.toApiObject();
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
this.lineDistances,
|
|
||||||
this.morphTargets,
|
|
||||||
this.morphNormals,
|
|
||||||
this.skinWeights.map(
|
|
||||||
function(skinWeight) {
|
|
||||||
return skinWeight.toApiObject();
|
|
||||||
}
|
|
||||||
),
|
|
||||||
this.skinIndices.map(
|
|
||||||
function(skinIndex) {
|
|
||||||
return skinIndex.toApiObject();
|
|
||||||
}
|
|
||||||
),
|
|
||||||
this.vertices.map(
|
this.vertices.map(
|
||||||
function (vertex) {
|
function (vertex) {
|
||||||
return vertex.toApiObject();
|
return vertex.toApiObject();
|
||||||
|
@ -461,108 +215,6 @@ GameLib.D3.Geometry.prototype.toApiObject = function() {
|
||||||
* Update GameLib.D3.Geometry from instance
|
* Update GameLib.D3.Geometry from instance
|
||||||
*/
|
*/
|
||||||
GameLib.D3.Geometry.prototype.updateFromInstance = function() {
|
GameLib.D3.Geometry.prototype.updateFromInstance = function() {
|
||||||
|
console.warn('the child class should take care of updating from instance');
|
||||||
var processed = 0;
|
return;
|
||||||
|
};
|
||||||
this.instance.faces.map(function(face, faceIndex){
|
|
||||||
|
|
||||||
processed++;
|
|
||||||
|
|
||||||
if (processed % 100 === 0) {
|
|
||||||
console.log('processed ' + processed + ' faces');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.faces.push(
|
|
||||||
new GameLib.D3.Face(
|
|
||||||
this.graphics,
|
|
||||||
new GameLib.D3.API.Face(
|
|
||||||
null,
|
|
||||||
null,
|
|
||||||
face.a,
|
|
||||||
face.b,
|
|
||||||
face.c,
|
|
||||||
face.materialIndex,
|
|
||||||
[[
|
|
||||||
new GameLib.API.Vector2(
|
|
||||||
this.instance.faceVertexUvs[0][faceIndex][0].x,
|
|
||||||
this.instance.faceVertexUvs[0][faceIndex][0].y
|
|
||||||
),
|
|
||||||
new GameLib.API.Vector2(
|
|
||||||
this.instance.faceVertexUvs[0][faceIndex][1].x,
|
|
||||||
this.instance.faceVertexUvs[0][faceIndex][1].y
|
|
||||||
),
|
|
||||||
new GameLib.API.Vector2(
|
|
||||||
this.instance.faceVertexUvs[0][faceIndex][2].x,
|
|
||||||
this.instance.faceVertexUvs[0][faceIndex][2].y
|
|
||||||
)
|
|
||||||
]],
|
|
||||||
new GameLib.Color(
|
|
||||||
this.graphics,
|
|
||||||
new GameLib.API.Color(
|
|
||||||
face.color.r,
|
|
||||||
face.color.g,
|
|
||||||
face.color.b
|
|
||||||
)
|
|
||||||
),
|
|
||||||
face.vertexColors.map(function(vertexColor){
|
|
||||||
return new GameLib.Color(
|
|
||||||
this.graphics,
|
|
||||||
new GameLib.API.Color(
|
|
||||||
vertexColor.r,
|
|
||||||
vertexColor.g,
|
|
||||||
vertexColor.b
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}.bind(this)),
|
|
||||||
face.vertexNormals.map(function(vertexNormal){
|
|
||||||
return new GameLib.Vector3(
|
|
||||||
this.graphics,
|
|
||||||
new GameLib.API.Vector3(
|
|
||||||
vertexNormal.x,
|
|
||||||
vertexNormal.y,
|
|
||||||
vertexNormal.z
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}.bind(this)),
|
|
||||||
new GameLib.Vector3(
|
|
||||||
this.graphics,
|
|
||||||
new GameLib.API.Vector3(
|
|
||||||
face.normal.x,
|
|
||||||
face.normal.y,
|
|
||||||
face.normal.z
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}.bind(this));
|
|
||||||
|
|
||||||
processed = 0;
|
|
||||||
|
|
||||||
this.instance.vertices.map(function(vertex){
|
|
||||||
|
|
||||||
processed++;
|
|
||||||
|
|
||||||
if (processed % 100 === 0) {
|
|
||||||
console.log('processed ' + processed + ' vertices');
|
|
||||||
}
|
|
||||||
|
|
||||||
this.vertices.push(
|
|
||||||
new GameLib.D3.Vertex(
|
|
||||||
this.graphics,
|
|
||||||
new GameLib.D3.API.Vertex(
|
|
||||||
new GameLib.Vector3(
|
|
||||||
this.graphics,
|
|
||||||
new GameLib.API.Vector3(
|
|
||||||
vertex.x,
|
|
||||||
vertex.y,
|
|
||||||
vertex.z
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
}.bind(this));
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
/**
|
/**
|
||||||
* GameLib.D3.BufferGeometry
|
* GameLib.D3.Geometry.Buffer
|
||||||
* @param graphics
|
* @param graphics
|
||||||
* @param apiBufferGeometry
|
* @param apiBufferGeometry
|
||||||
* @property bufferGeometryType
|
* @property geometryType
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
GameLib.D3.BufferGeometry = function(
|
GameLib.D3.Geometry.Buffer = function(
|
||||||
graphics,
|
graphics,
|
||||||
apiBufferGeometry
|
apiBufferGeometry
|
||||||
) {
|
) {
|
||||||
|
@ -15,86 +15,88 @@ GameLib.D3.BufferGeometry = function(
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
if (GameLib.Utils.UndefinedOrNull(apiBufferGeometry)) {
|
||||||
apiBufferGeometry = {
|
apiBufferGeometry = {
|
||||||
bufferGeometryType : GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_NONE
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
GameLib.D3.API.BufferGeometry.call(
|
GameLib.D3.API.Geometry.Buffer.call(
|
||||||
this,
|
this,
|
||||||
apiBufferGeometry.id,
|
apiBufferGeometry,
|
||||||
apiBufferGeometry.name,
|
|
||||||
apiBufferGeometry.bufferGeometryType,
|
|
||||||
apiBufferGeometry.parentEntity,
|
|
||||||
apiBufferGeometry.faces,
|
|
||||||
apiBufferGeometry.vertices,
|
|
||||||
apiBufferGeometry.attributes,
|
apiBufferGeometry.attributes,
|
||||||
apiBufferGeometry.boundingBox,
|
|
||||||
apiBufferGeometry.boundingSphere,
|
|
||||||
apiBufferGeometry.drawRange,
|
apiBufferGeometry.drawRange,
|
||||||
apiBufferGeometry.groups,
|
apiBufferGeometry.groups,
|
||||||
apiBufferGeometry.index,
|
apiBufferGeometry.index,
|
||||||
apiBufferGeometry.morphAttributes
|
apiBufferGeometry.morphAttributes
|
||||||
);
|
);
|
||||||
|
|
||||||
this.faces = this.faces.map(
|
|
||||||
function(face) {
|
this.drawRange = new GameLib.DrawRange(
|
||||||
return new GameLib.D3.Face(
|
this.graphics,
|
||||||
this.graphics,
|
this.drawRange,
|
||||||
face
|
this
|
||||||
)
|
|
||||||
}.bind(this)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
this.vertices = this.vertices.map(
|
this.groups = this.groups.map(
|
||||||
function(vertex) {
|
function(group) {
|
||||||
return new GameLib.D3.Vertex(
|
if (group instanceof GameLib.API.Group) {
|
||||||
this.graphics,
|
return new GameLib.Group(
|
||||||
vertex
|
this.graphics,
|
||||||
)
|
group,
|
||||||
|
this
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
return group;
|
||||||
|
}
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
var linkedObjects = {};
|
GameLib.D3.Geometry.call(
|
||||||
|
|
||||||
switch (this.bufferGeometryType) {
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_EXTRUDE :
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_SHAPE :
|
|
||||||
linkedObjects.shapes = [GameLib.Curve.Path.D2.Shape];
|
|
||||||
break;
|
|
||||||
case GameLib.D3.API.BufferGeometry.BUFFER_GEOMETRY_TYPE_TEXT :
|
|
||||||
linkedObjects.font = GameLib.D3.Font;
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
GameLib.Component.call(
|
|
||||||
this,
|
this,
|
||||||
linkedObjects
|
this.graphics,
|
||||||
|
this
|
||||||
);
|
);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.BufferGeometry.prototype = Object.create(GameLib.Component.prototype);
|
GameLib.D3.Geometry.Buffer.prototype = Object.create(GameLib.D3.Geometry.prototype);
|
||||||
GameLib.D3.BufferGeometry.prototype.constructor = GameLib.D3.BufferGeometry;
|
GameLib.D3.Geometry.Buffer.prototype.constructor = GameLib.D3.Geometry.Buffer;
|
||||||
|
|
||||||
GameLib.D3.BufferGeometry.prototype.createInstance = function() {
|
GameLib.D3.Geometry.Buffer.prototype.commonInstance = function() {
|
||||||
|
|
||||||
|
this.instance.setDrawRange(
|
||||||
|
this.drawRange.start,
|
||||||
|
this.drawRange.count
|
||||||
|
);
|
||||||
|
|
||||||
|
this.groups.map(
|
||||||
|
function(group) {
|
||||||
|
this.instance.addGroup(
|
||||||
|
group.start,
|
||||||
|
group.count,
|
||||||
|
group.materialIndex
|
||||||
|
)
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance = function() {
|
||||||
|
|
||||||
if (GameLib.Utils.Defined(this.instance)) {
|
if (GameLib.Utils.Defined(this.instance)) {
|
||||||
|
|
||||||
|
this.commonInstance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* We already have our object - just call our parent and return
|
* We already have our object - just call our parent and return
|
||||||
*/
|
*/
|
||||||
GameLib.Component.prototype.createInstance.call(this);
|
GameLib.D3.Geometry.prototype.createInstance.call(this);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Then we convert to the new BufferGeometry type
|
|
||||||
*/
|
|
||||||
this.instance = new THREE.BufferGeometry();
|
this.instance = new THREE.BufferGeometry();
|
||||||
|
|
||||||
|
this.commonInstance();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup mesh vertices positions
|
* Setup mesh vertices positions
|
||||||
* @type {Float32Array}
|
* @type {Float32Array}
|
||||||
|
@ -116,7 +118,6 @@ GameLib.D3.BufferGeometry.prototype.createInstance = function() {
|
||||||
[]
|
[]
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
this.instance.addAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
this.instance.addAttribute('position', new THREE.BufferAttribute(vertices, 3));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -193,10 +194,9 @@ GameLib.D3.BufferGeometry.prototype.createInstance = function() {
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
this.instance.addAttribute('normal', new THREE.BufferAttribute(normals, 3 ));
|
this.instance.addAttribute('normal', new THREE.BufferAttribute(normals, 3 ));
|
||||||
|
|
||||||
this.instance.normalizeNormals();
|
|
||||||
|
|
||||||
//TODO: check below i don't do this - i used to but i don't think i should
|
//TODO: check below i don't do this - i used to but i don't think i should
|
||||||
|
//this.instance.normalizeNormals();
|
||||||
//this.instance.computeVertexNormals();
|
//this.instance.computeVertexNormals();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -245,22 +245,17 @@ GameLib.D3.BufferGeometry.prototype.createInstance = function() {
|
||||||
0
|
0
|
||||||
);
|
);
|
||||||
|
|
||||||
GameLib.Component.prototype.createInstance.call(this);
|
GameLib.D3.Geometry.prototype.createInstance.call(this);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
GameLib.D3.BufferGeometry.prototype.updateInstance = function(property) {
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
if (GameLib.Utils.UndefinedOrNull(this.instance)) {
|
if (GameLib.Utils.UndefinedOrNull(this.instance)) {
|
||||||
console.warn('no buffer geometry instance');
|
console.warn('no buffer geometry instance');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'name') {
|
|
||||||
this.instance.name = this.name;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'faces') {
|
if (property === 'faces') {
|
||||||
console.warn('todo: faces setup');
|
console.warn('todo: faces setup');
|
||||||
return;
|
return;
|
||||||
|
@ -271,26 +266,11 @@ GameLib.D3.BufferGeometry.prototype.updateInstance = function(property) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'colors') {
|
|
||||||
console.warn('todo: colors setup');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'attributes') {
|
if (property === 'attributes') {
|
||||||
console.warn('todo: attributes setup');
|
console.warn('todo: attributes setup');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'boundingBox') {
|
|
||||||
console.warn('boundingBox is read only');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'boundingSphere') {
|
|
||||||
console.warn('boundingSphere is read only');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (property === 'drawRange') {
|
if (property === 'drawRange') {
|
||||||
this.instance.setDrawRange(
|
this.instance.setDrawRange(
|
||||||
this.drawRange.start,
|
this.drawRange.start,
|
||||||
|
@ -300,7 +280,19 @@ GameLib.D3.BufferGeometry.prototype.updateInstance = function(property) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (property === 'groups') {
|
if (property === 'groups') {
|
||||||
console.warn('todo: groups setup');
|
|
||||||
|
this.instance.clearGroups();
|
||||||
|
|
||||||
|
this.groups.map(
|
||||||
|
function(group) {
|
||||||
|
this.instance.addGroup(
|
||||||
|
group.start,
|
||||||
|
group.count,
|
||||||
|
group.materialIndex
|
||||||
|
)
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,45 +306,35 @@ GameLib.D3.BufferGeometry.prototype.updateInstance = function(property) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.prototype.updateInstance.call(this, property);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Converts a GameLib.D3.BufferGeometry to a GameLib.D3.API.BufferGeometry
|
* Converts a GameLib.D3.Geometry.Buffer to a GameLib.D3.API.Geometry.Buffer
|
||||||
* @returns {GameLib.D3.API.BufferGeometry}
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
*/
|
*/
|
||||||
GameLib.D3.BufferGeometry.prototype.toApiObject = function() {
|
GameLib.D3.Geometry.Buffer.prototype.toApiObject = function() {
|
||||||
|
|
||||||
var apiBufferGeometry = new GameLib.D3.API.BufferGeometry(
|
var apiGeometry = GameLib.D3.Geometry.prototype.toApiObject.call(this);
|
||||||
this.id,
|
|
||||||
this.name,
|
/**
|
||||||
this.bufferGeometryType,
|
* Right now we don't store attributes and index, also we don't use morphAttributes yet.
|
||||||
GameLib.Utils.IdOrNull(this.parentEntity),
|
* @type {GameLib.D3.API.Geometry.Buffer}
|
||||||
this.faces.map(
|
*/
|
||||||
function(face) {
|
|
||||||
return face.toApiObject();
|
var apiBufferGeometry = new GameLib.D3.API.Geometry.Buffer(
|
||||||
}
|
|
||||||
),
|
apiGeometry,
|
||||||
this.vertices.map(
|
null, //attributes,
|
||||||
function (vertex) {
|
|
||||||
return vertex.toApiObject();
|
|
||||||
}
|
|
||||||
),
|
|
||||||
this.colors.map(
|
|
||||||
function(color) {
|
|
||||||
return color.toApiObject();
|
|
||||||
}
|
|
||||||
),
|
|
||||||
null, //fuck attributes
|
|
||||||
this.boundingBox.toApiObject(),
|
|
||||||
this.boundingSphere.toApiObject(),
|
|
||||||
this.drawRange.toApiObject(),
|
this.drawRange.toApiObject(),
|
||||||
this.groups.map(
|
this.groups.map(
|
||||||
function(group){
|
function(group){
|
||||||
return group.toApiObject()
|
return group.toApiObject()
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
null, //fuck index
|
null, //index,
|
||||||
null //fuck morphAttributes
|
null //morphAttributes
|
||||||
);
|
);
|
||||||
|
|
||||||
return apiBufferGeometry;
|
return apiBufferGeometry;
|
||||||
|
@ -360,9 +342,9 @@ GameLib.D3.BufferGeometry.prototype.toApiObject = function() {
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Update GameLib.D3.BufferGeometry from instance
|
* Update GameLib.D3.Geometry.Buffer from instance
|
||||||
*/
|
*/
|
||||||
GameLib.D3.BufferGeometry.prototype.updateFromInstance = function() {
|
GameLib.D3.Geometry.Buffer.prototype.updateFromInstance = function() {
|
||||||
|
|
||||||
var vertices = this.instance.getAttribute('position').array;
|
var vertices = this.instance.getAttribute('position').array;
|
||||||
|
|
||||||
|
@ -454,41 +436,87 @@ GameLib.D3.BufferGeometry.prototype.updateFromInstance = function() {
|
||||||
/**
|
/**
|
||||||
* Clears all groups
|
* Clears all groups
|
||||||
*/
|
*/
|
||||||
GameLib.D3.BufferGeometry.prototype.clearGroups = function() {
|
GameLib.D3.Geometry.Buffer.prototype.clearGroups = function() {
|
||||||
this.instance.clearGroups();
|
this.instance.clearGroups();
|
||||||
this.groups = this.instance.groups;
|
this.groups = this.instance.groups;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Clears all groups
|
* Clears all material groups and makes the geometry use a single material only
|
||||||
*/
|
*/
|
||||||
GameLib.D3.BufferGeometry.prototype.singleMaterial = function() {
|
GameLib.D3.Geometry.Buffer.prototype.toSingleMaterial = function() {
|
||||||
|
|
||||||
this.instance.clearGroups();
|
if (this.instance && this.instance.index) {
|
||||||
|
|
||||||
this.instance.addGroup(
|
this.instance.clearGroups();
|
||||||
0,
|
|
||||||
this.instance.index.count,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
|
|
||||||
this.groups = this.instance.groups;
|
this.instance.addGroup(
|
||||||
|
0,
|
||||||
|
this.instance.index.count,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
this.groups = this.instance.groups;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
console.warn('this is not an indexed buffer geometry or geometry not loaded');
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* To non-index buffer geometry
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.toNonIndexed = function() {
|
||||||
|
console.warn('not yet tested fully');
|
||||||
|
|
||||||
|
this.instance = this.instance.toNonIndexed();
|
||||||
|
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
// this.updateFromInstance();
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.applyPositionRotationScale = function() {
|
||||||
|
|
||||||
|
console.warn('todo and test');
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
You want to get the world position of a mesh's geometry, taking into consideration the mesh's transform matrix, mesh.matrix.
|
||||||
|
Also, your mesh geometry is THREE.BufferGeometry.
|
||||||
|
|
||||||
|
Here is the pattern to follow:
|
||||||
|
|
||||||
|
mesh = new THREE.Mesh( geometry, material );
|
||||||
|
mesh.position.set( 10, 10, 10 );
|
||||||
|
mesh.rotation.set( - Math.PI / 2, 0, 0 );
|
||||||
|
mesh.scale.set( 1, 1, 1 );
|
||||||
|
scene.add( mesh );
|
||||||
|
|
||||||
|
mesh.updateMatrix(); // make sure the mesh's matrix is updated
|
||||||
|
|
||||||
|
var vec = new THREE.Vector3();
|
||||||
|
var attribute = mesh.geometry.attributes.position; // we want the position data
|
||||||
|
var index = 1; // index is zero-based, so this the the 2nd vertex
|
||||||
|
|
||||||
|
vec.fromAttribute( attribute, index ); // extract the x,y,z coordinates
|
||||||
|
|
||||||
|
vec.applyMatrix4( mesh.matrix ); // apply the mesh's matrix transform
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Compute Vertex Normals
|
* Buffer geometry needs to do more work after updating vertex normals
|
||||||
*/
|
*/
|
||||||
GameLib.D3.BufferGeometry.prototype.computeVertexNormals = function() {
|
GameLib.D3.Geometry.Buffer.prototype.computeVertexNormals = function() {
|
||||||
|
|
||||||
this.instance.computeVertexNormals();
|
this.instance.computeVertexNormals();
|
||||||
|
// var attribute = this.instance.getAttribute('normal');
|
||||||
|
// attribute.setDynamic(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
GameLib.D3.Geometry.Buffer.prototype.normalizeNormals = function() {
|
||||||
* Compute Vertex Normals
|
this.instance.normalizeNormals();
|
||||||
*/
|
// var attribute = this.instance.getAttribute('normal');
|
||||||
GameLib.D3.BufferGeometry.prototype.toNonIndexed = function() {
|
// attribute.setDynamic(true);
|
||||||
|
|
||||||
this.instance.toNonIndexed();
|
|
||||||
|
|
||||||
};
|
};
|
|
@ -0,0 +1,108 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Box
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferBox
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Box = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferBox
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferBox)) {
|
||||||
|
apiGeometryBufferBox = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_BOX
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Box.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferBox,
|
||||||
|
apiGeometryBufferBox.width,
|
||||||
|
apiGeometryBufferBox.height,
|
||||||
|
apiGeometryBufferBox.depth,
|
||||||
|
apiGeometryBufferBox.widthSegments,
|
||||||
|
apiGeometryBufferBox.heightSegments,
|
||||||
|
apiGeometryBufferBox.depthSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferBox
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Box.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Box.prototype.constructor = GameLib.D3.Geometry.Buffer.Box;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Box.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.BoxBufferGeometry(
|
||||||
|
this.width,
|
||||||
|
this.height,
|
||||||
|
this.depth,
|
||||||
|
this.widthSegments,
|
||||||
|
this.heightSegments,
|
||||||
|
this.depthSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
this.instance.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Box.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'width' ||
|
||||||
|
property === 'height' ||
|
||||||
|
property === 'depth' ||
|
||||||
|
property === 'widthSegments' ||
|
||||||
|
property === 'heightSegments' ||
|
||||||
|
property === 'depthSegments'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Box to a GameLib.D3.API.Geometry.Buffer.Box
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Box.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferBox = new GameLib.D3.API.Geometry.Buffer.Box(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.width,
|
||||||
|
this.height,
|
||||||
|
this.depth,
|
||||||
|
this.widthSegments,
|
||||||
|
this.heightSegments,
|
||||||
|
this.depthSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferBox;
|
||||||
|
};
|
|
@ -0,0 +1,110 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Circle
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferCircle
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Circle = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferCircle
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferCircle)) {
|
||||||
|
apiGeometryBufferCircle = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CIRCLE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Circle.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferCircle,
|
||||||
|
apiGeometryBufferCircle.radius,
|
||||||
|
apiGeometryBufferCircle.segments,
|
||||||
|
apiGeometryBufferCircle.thetaStart,
|
||||||
|
apiGeometryBufferCircle.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferCircle
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Circle.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Circle.prototype.constructor = GameLib.D3.Geometry.Buffer.Circle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Circle.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.CircleBufferGeometry(
|
||||||
|
this.radius,
|
||||||
|
this.segments,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The instance doesn't have any groups associated with it - so I just create the default single material group
|
||||||
|
*/
|
||||||
|
this.toSingleMaterial();
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Circle.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'segments' ||
|
||||||
|
property === 'thetaStart' ||
|
||||||
|
property === 'thetaLength'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Circle to a GameLib.D3.API.Geometry.Buffer.Circle
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Circle.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferCircle = new GameLib.D3.API.Geometry.Buffer.Circle(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.radius,
|
||||||
|
this.segments,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferCircle;
|
||||||
|
};
|
|
@ -0,0 +1,117 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Cone
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferCone
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Cone = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferCone
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferCone)) {
|
||||||
|
apiGeometryBufferCone = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CONE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Cone.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferCone,
|
||||||
|
apiGeometryBufferCone.radius,
|
||||||
|
apiGeometryBufferCone.height,
|
||||||
|
apiGeometryBufferCone.radialSegments,
|
||||||
|
apiGeometryBufferCone.heightSegments,
|
||||||
|
apiGeometryBufferCone.openEnded,
|
||||||
|
apiGeometryBufferCone.thetaStart,
|
||||||
|
apiGeometryBufferCone.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferCone
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Cone.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Cone.prototype.constructor = GameLib.D3.Geometry.Buffer.Cone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Cone.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.ConeBufferGeometry(
|
||||||
|
this.radius,
|
||||||
|
this.height,
|
||||||
|
this.radialSegments,
|
||||||
|
this.heightSegments,
|
||||||
|
this.openEnded,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Cone.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'height' ||
|
||||||
|
property === 'radialSegments' ||
|
||||||
|
property === 'heightSegments' ||
|
||||||
|
property === 'openEnded' ||
|
||||||
|
property === 'thetaStart' ||
|
||||||
|
property === 'thetaLength'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Cone to a GameLib.D3.API.Geometry.Buffer.Cone
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Cone.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferCone = new GameLib.D3.API.Geometry.Buffer.Cone(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.radius,
|
||||||
|
this.height,
|
||||||
|
this.radialSegments,
|
||||||
|
this.heightSegments,
|
||||||
|
this.openEnded,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferCone;
|
||||||
|
};
|
|
@ -0,0 +1,121 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Cylinder
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferCylinder
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Cylinder = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferCylinder
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferCylinder)) {
|
||||||
|
apiGeometryBufferCylinder = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_CYLINDER
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Cylinder.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferCylinder,
|
||||||
|
apiGeometryBufferCylinder.radiusTop,
|
||||||
|
apiGeometryBufferCylinder.radiusBottom,
|
||||||
|
apiGeometryBufferCylinder.height,
|
||||||
|
apiGeometryBufferCylinder.radialSegments,
|
||||||
|
apiGeometryBufferCylinder.heightSegments,
|
||||||
|
apiGeometryBufferCylinder.openEnded,
|
||||||
|
apiGeometryBufferCylinder.thetaStart,
|
||||||
|
apiGeometryBufferCylinder.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferCylinder
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Cylinder.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Cylinder.prototype.constructor = GameLib.D3.Geometry.Buffer.Cylinder;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Cylinder.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.CylinderBufferGeometry(
|
||||||
|
this.radiusTop,
|
||||||
|
this.radiusBottom,
|
||||||
|
this.height,
|
||||||
|
this.radialSegments,
|
||||||
|
this.heightSegments,
|
||||||
|
this.openEnded,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Cylinder.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'radiusTop' ||
|
||||||
|
property === 'radiusBottom' ||
|
||||||
|
property === 'height' ||
|
||||||
|
property === 'radialSegments' ||
|
||||||
|
property === 'heightSegments' ||
|
||||||
|
property === 'openEnded' ||
|
||||||
|
property === 'thetaStart' ||
|
||||||
|
property === 'thetaLength'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Cylinder to a GameLib.D3.API.Geometry.Buffer.Cylinder
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Cylinder.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferCylinder = new GameLib.D3.API.Geometry.Buffer.Cylinder(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.radiusTop,
|
||||||
|
this.radiusBottom,
|
||||||
|
this.height,
|
||||||
|
this.radialSegments,
|
||||||
|
this.heightSegments,
|
||||||
|
this.openEnded,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferCylinder;
|
||||||
|
};
|
|
@ -0,0 +1,103 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Dodecahedron
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferDodecahedron
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Dodecahedron = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferDodecahedron
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferDodecahedron)) {
|
||||||
|
apiGeometryBufferDodecahedron = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_DODECAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Dodecahedron.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferDodecahedron,
|
||||||
|
apiGeometryBufferDodecahedron.radius,
|
||||||
|
apiGeometryBufferDodecahedron.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferDodecahedron
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Dodecahedron.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Dodecahedron.prototype.constructor = GameLib.D3.Geometry.Buffer.Dodecahedron;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Dodecahedron.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.DodecahedronBufferGeometry(
|
||||||
|
this.radius,
|
||||||
|
this.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
this.instance.addGroup(
|
||||||
|
0,
|
||||||
|
this.instance.attributes.position.count,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Dodecahedron.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'detail'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Dodecahedron to a GameLib.D3.API.Geometry.Buffer.Dodecahedron
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Dodecahedron.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferDodecahedron = new GameLib.D3.API.Geometry.Buffer.Dodecahedron(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.radius,
|
||||||
|
this.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferDodecahedron;
|
||||||
|
};
|
|
@ -0,0 +1,146 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Extrude
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferExtrude
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Extrude = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferExtrude
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferExtrude)) {
|
||||||
|
apiGeometryBufferExtrude = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_EXTRUDE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Extrude.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferExtrude,
|
||||||
|
apiGeometryBufferExtrude.shapes,
|
||||||
|
apiGeometryBufferExtrude.curveSegments,
|
||||||
|
apiGeometryBufferExtrude.steps,
|
||||||
|
apiGeometryBufferExtrude.amount,
|
||||||
|
apiGeometryBufferExtrude.bevelEnabled,
|
||||||
|
apiGeometryBufferExtrude.bevelThickness,
|
||||||
|
apiGeometryBufferExtrude.bevelSize,
|
||||||
|
apiGeometryBufferExtrude.bevelSegments,
|
||||||
|
apiGeometryBufferExtrude.extrudePath,
|
||||||
|
apiGeometryBufferExtrude.frames,
|
||||||
|
apiGeometryBufferExtrude.UVGenerator
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferExtrude
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Extrude.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Extrude.prototype.constructor = GameLib.D3.Geometry.Buffer.Extrude;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Extrude.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
if (this.shapes.length === 0) {
|
||||||
|
console.warn('shapes are not ready for this instance');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.instance = new THREE.ExtrudeBufferGeometry(
|
||||||
|
this.shapes.map(
|
||||||
|
function(shape) {
|
||||||
|
return shape.instance;
|
||||||
|
}
|
||||||
|
),
|
||||||
|
{
|
||||||
|
curveSegments : this.curveSegments,
|
||||||
|
steps : this.steps,
|
||||||
|
amount : this.amount,
|
||||||
|
bevelEnabled : this.bevelEnabled,
|
||||||
|
bevelThickness : this.bevelThickness,
|
||||||
|
bevelSize : this.bevelSize,
|
||||||
|
bevelSegments : this.bevelSegments
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Extrude.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'shapes' ||
|
||||||
|
property === 'curveSegments' ||
|
||||||
|
property === 'steps' ||
|
||||||
|
property === 'amount' ||
|
||||||
|
property === 'bevelEnabled' ||
|
||||||
|
property === 'bevelThickness' ||
|
||||||
|
property === 'bevelSize' ||
|
||||||
|
property === 'bevelSegments'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.warn('do other properties here');
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Extrude to a GameLib.D3.API.Geometry.Buffer.Extrude
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Extrude.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferExtrude = new GameLib.D3.API.Geometry.Buffer.Extrude(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.shapes.map(
|
||||||
|
function(shape) {
|
||||||
|
return GameLib.Utils.IdOrNull(shape);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.curveSegments,
|
||||||
|
this.steps,
|
||||||
|
this.amount,
|
||||||
|
this.bevelEnabled,
|
||||||
|
this.bevelThickness,
|
||||||
|
this.bevelSize,
|
||||||
|
this.bevelSegments,
|
||||||
|
GameLib.Utils.IdOrNull(this.extrudePath),
|
||||||
|
this.frames.map(function(frame){
|
||||||
|
return GameLib.Utils.IdOrNull(frame);
|
||||||
|
}),
|
||||||
|
GameLib.Utils.IdOrNull(this.UVGenerator)
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferExtrude;
|
||||||
|
};
|
|
@ -0,0 +1,103 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Icosahedron
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferIcosahedron
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Icosahedron = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferIcosahedron
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferIcosahedron)) {
|
||||||
|
apiGeometryBufferIcosahedron = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_ICOSAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Icosahedron.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferIcosahedron,
|
||||||
|
apiGeometryBufferIcosahedron.radius,
|
||||||
|
apiGeometryBufferIcosahedron.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferIcosahedron
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Icosahedron.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Icosahedron.prototype.constructor = GameLib.D3.Geometry.Buffer.Icosahedron;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Icosahedron.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.IcosahedronBufferGeometry(
|
||||||
|
this.radius,
|
||||||
|
this.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
this.instance.addGroup(
|
||||||
|
0,
|
||||||
|
this.instance.attributes.position.count,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Icosahedron.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'detail'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Icosahedron to a GameLib.D3.API.Geometry.Buffer.Icosahedron
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Icosahedron.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferIcosahedron = new GameLib.D3.API.Geometry.Buffer.Icosahedron(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.radius,
|
||||||
|
this.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferIcosahedron;
|
||||||
|
};
|
|
@ -0,0 +1,118 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Lathe
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferLathe
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Lathe = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferLathe
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferLathe)) {
|
||||||
|
apiGeometryBufferLathe = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_LATHE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Lathe.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferLathe,
|
||||||
|
apiGeometryBufferLathe.points,
|
||||||
|
apiGeometryBufferLathe.segments,
|
||||||
|
apiGeometryBufferLathe.phiStart,
|
||||||
|
apiGeometryBufferLathe.phiLength
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferLathe
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Lathe.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Lathe.prototype.constructor = GameLib.D3.Geometry.Buffer.Lathe;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Lathe.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.LatheBufferGeometry(
|
||||||
|
this.points.map(
|
||||||
|
function(point) {
|
||||||
|
return point.instance;
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.segments,
|
||||||
|
this.phiStart,
|
||||||
|
this.phiLength
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The instance doesn't have any groups associated with it - so I just create the default single material group
|
||||||
|
*/
|
||||||
|
this.toSingleMaterial();
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Lathe.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'points' ||
|
||||||
|
property === 'segments' ||
|
||||||
|
property === 'phiStart' ||
|
||||||
|
property === 'phiLength'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Lathe to a GameLib.D3.API.Geometry.Buffer.Lathe
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Lathe.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferLathe = new GameLib.D3.API.Geometry.Buffer.Lathe(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.points.map(
|
||||||
|
function(point) {
|
||||||
|
return point.toApiObject();
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.segments,
|
||||||
|
this.phiStart,
|
||||||
|
this.phiLength
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferLathe;
|
||||||
|
};
|
|
@ -0,0 +1,103 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Octahedron
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferOctahedron
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Octahedron = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferOctahedron
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferOctahedron)) {
|
||||||
|
apiGeometryBufferOctahedron = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_OCTAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Octahedron.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferOctahedron,
|
||||||
|
apiGeometryBufferOctahedron.radius,
|
||||||
|
apiGeometryBufferOctahedron.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferOctahedron
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Octahedron.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Octahedron.prototype.constructor = GameLib.D3.Geometry.Buffer.Octahedron;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Octahedron.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.OctahedronBufferGeometry(
|
||||||
|
this.radius,
|
||||||
|
this.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
this.instance.addGroup(
|
||||||
|
0,
|
||||||
|
this.instance.attributes.position.count,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Octahedron.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'detail'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Octahedron to a GameLib.D3.API.Geometry.Buffer.Octahedron
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Octahedron.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferOctahedron = new GameLib.D3.API.Geometry.Buffer.Octahedron(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.radius,
|
||||||
|
this.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferOctahedron;
|
||||||
|
};
|
|
@ -0,0 +1,107 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Parametric
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferParametric
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Parametric = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferParametric
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferParametric)) {
|
||||||
|
apiGeometryBufferParametric = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PARAMETRIC
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Parametric.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferParametric,
|
||||||
|
apiGeometryBufferParametric.generatorFn,
|
||||||
|
apiGeometryBufferParametric.slices,
|
||||||
|
apiGeometryBufferParametric.stacks
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferParametric
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Parametric.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Parametric.prototype.constructor = GameLib.D3.Geometry.Buffer.Parametric;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Parametric.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.ParametricBufferGeometry(
|
||||||
|
new Function('u', 'v', this.generatorFn).bind(this),
|
||||||
|
this.slices,
|
||||||
|
this.stacks
|
||||||
|
);
|
||||||
|
|
||||||
|
this.instance.addGroup(
|
||||||
|
0,
|
||||||
|
this.instance.attributes.position.count,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Parametric.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'generatorFn' ||
|
||||||
|
property === 'slices' ||
|
||||||
|
property === 'stacks'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Parametric to a GameLib.D3.API.Geometry.Buffer.Parametric
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Parametric.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferParametric = new GameLib.D3.API.Geometry.Buffer.Parametric(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.generatorFn,
|
||||||
|
this.slices,
|
||||||
|
this.stacks
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferParametric;
|
||||||
|
};
|
|
@ -0,0 +1,100 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Plane
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferPlane
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Plane = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferPlane
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferPlane)) {
|
||||||
|
apiGeometryBufferPlane = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_PLANE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Plane.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferPlane,
|
||||||
|
apiGeometryBufferPlane.width,
|
||||||
|
apiGeometryBufferPlane.height,
|
||||||
|
apiGeometryBufferPlane.widthSegments,
|
||||||
|
apiGeometryBufferPlane.heightSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferPlane
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Plane.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Plane.prototype.constructor = GameLib.D3.Geometry.Buffer.Plane;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Plane.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.PlaneBufferGeometry(
|
||||||
|
this.width,
|
||||||
|
this.height,
|
||||||
|
this.widthSegments,
|
||||||
|
this.heightSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Plane.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'width' ||
|
||||||
|
property === 'height' ||
|
||||||
|
property === 'widthSegments' ||
|
||||||
|
property === 'heightSegments'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Plane to a GameLib.D3.API.Geometry.Buffer.Plane
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Plane.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferPlane = new GameLib.D3.API.Geometry.Buffer.Plane(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.width,
|
||||||
|
this.height,
|
||||||
|
this.widthSegments,
|
||||||
|
this.heightSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferPlane;
|
||||||
|
};
|
|
@ -0,0 +1,116 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Polyhedron
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferPolyhedron
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Polyhedron = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferPolyhedron
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferPolyhedron)) {
|
||||||
|
apiGeometryBufferPolyhedron = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_POLYHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Polyhedron.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferPolyhedron,
|
||||||
|
apiGeometryBufferPolyhedron.vertices,
|
||||||
|
apiGeometryBufferPolyhedron.indices,
|
||||||
|
apiGeometryBufferPolyhedron.radius,
|
||||||
|
apiGeometryBufferPolyhedron.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferPolyhedron
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Polyhedron.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Polyhedron.prototype.constructor = GameLib.D3.Geometry.Buffer.Polyhedron;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Polyhedron.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.PolyhedronBufferGeometry(
|
||||||
|
this.vertices.map(
|
||||||
|
function(vertex) {
|
||||||
|
return vertex.position.instance;
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.indices.map(
|
||||||
|
function(index) {
|
||||||
|
return index.instance;
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.radius,
|
||||||
|
this.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Polyhedron.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'vertices' ||
|
||||||
|
property === 'indices' ||
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'detail'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Polyhedron to a GameLib.D3.API.Geometry.Buffer.Polyhedron
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Polyhedron.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferPolyhedron = new GameLib.D3.API.Geometry.Buffer.Polyhedron(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.vertices.map(
|
||||||
|
function(vertex){
|
||||||
|
return vertex.toApiObject();
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.indices.map(
|
||||||
|
function(index){
|
||||||
|
return index.toApiObject();
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.radius,
|
||||||
|
this.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferPolyhedron;
|
||||||
|
};
|
|
@ -0,0 +1,113 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Ring
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferRing
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Ring = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferRing
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferRing)) {
|
||||||
|
apiGeometryBufferRing = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_RING
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Ring.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferRing,
|
||||||
|
apiGeometryBufferRing.innerRadius,
|
||||||
|
apiGeometryBufferRing.outerRadius,
|
||||||
|
apiGeometryBufferRing.thetaSegments,
|
||||||
|
apiGeometryBufferRing.phiSegments,
|
||||||
|
apiGeometryBufferRing.thetaStart,
|
||||||
|
apiGeometryBufferRing.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferRing
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Ring.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Ring.prototype.constructor = GameLib.D3.Geometry.Buffer.Ring;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Ring.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.RingBufferGeometry(
|
||||||
|
this.innerRadius,
|
||||||
|
this.outerRadius,
|
||||||
|
this.thetaSegments,
|
||||||
|
this.phiSegments,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Ring.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'innerRadius' ||
|
||||||
|
property === 'outerRadius' ||
|
||||||
|
property === 'thetaSegments' ||
|
||||||
|
property === 'phiSegments' ||
|
||||||
|
property === 'thetaStart' ||
|
||||||
|
property === 'thetaLength'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Ring to a GameLib.D3.API.Geometry.Buffer.Ring
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Ring.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferRing = new GameLib.D3.API.Geometry.Buffer.Ring(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.innerRadius,
|
||||||
|
this.outerRadius,
|
||||||
|
this.thetaSegments,
|
||||||
|
this.phiSegments,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferRing;
|
||||||
|
};
|
|
@ -0,0 +1,112 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Shape
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferShape
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Shape = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferShape
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferShape)) {
|
||||||
|
apiGeometryBufferShape = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SHAPE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Shape.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferShape,
|
||||||
|
apiGeometryBufferShape.shapes,
|
||||||
|
apiGeometryBufferShape.curveSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferShape
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Shape.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Shape.prototype.constructor = GameLib.D3.Geometry.Buffer.Shape;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Shape.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
if (this.shapes.length === 0) {
|
||||||
|
console.warn('shapes are not ready for this instance');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.instance = new THREE.ShapeBufferGeometry(
|
||||||
|
this.shapes.map(
|
||||||
|
function(shape) {
|
||||||
|
return shape.instance;
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.curveSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Shape.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'shapes' ||
|
||||||
|
property === 'curveSegments'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.warn('do other properties here');
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Shape to a GameLib.D3.API.Geometry.Buffer.Shape
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Shape.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferShape = new GameLib.D3.API.Geometry.Buffer.Shape(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.shapes.map(
|
||||||
|
function(shape) {
|
||||||
|
return GameLib.Utils.IdOrNull(shape);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.curveSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferShape;
|
||||||
|
};
|
|
@ -0,0 +1,117 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Sphere
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferSphere
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Sphere = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferSphere
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferSphere)) {
|
||||||
|
apiGeometryBufferSphere = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_SPHERE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Sphere.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferSphere,
|
||||||
|
apiGeometryBufferSphere.radius,
|
||||||
|
apiGeometryBufferSphere.widthSegments,
|
||||||
|
apiGeometryBufferSphere.heightSegments,
|
||||||
|
apiGeometryBufferSphere.phiStart,
|
||||||
|
apiGeometryBufferSphere.phiLength,
|
||||||
|
apiGeometryBufferSphere.thetaStart,
|
||||||
|
apiGeometryBufferSphere.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferSphere
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Sphere.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Sphere.prototype.constructor = GameLib.D3.Geometry.Buffer.Sphere;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Sphere.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.SphereBufferGeometry(
|
||||||
|
this.radius,
|
||||||
|
this.widthSegments,
|
||||||
|
this.heightSegments,
|
||||||
|
this.phiStart,
|
||||||
|
this.phiLength,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Sphere.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'widthSegments' ||
|
||||||
|
property === 'heightSegments' ||
|
||||||
|
property === 'phiStart' ||
|
||||||
|
property === 'phiLength' ||
|
||||||
|
property === 'thetaStart' ||
|
||||||
|
property === 'thetaLength'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Sphere to a GameLib.D3.API.Geometry.Buffer.Sphere
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Sphere.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferSphere = new GameLib.D3.API.Geometry.Buffer.Sphere(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.radius,
|
||||||
|
this.widthSegments,
|
||||||
|
this.heightSegments,
|
||||||
|
this.phiStart,
|
||||||
|
this.phiLength,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferSphere;
|
||||||
|
};
|
|
@ -0,0 +1,103 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Tetrahedron
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferTetrahedron
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Tetrahedron = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferTetrahedron
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferTetrahedron)) {
|
||||||
|
apiGeometryBufferTetrahedron = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TETRAHEDRON
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Tetrahedron.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferTetrahedron,
|
||||||
|
apiGeometryBufferTetrahedron.radius,
|
||||||
|
apiGeometryBufferTetrahedron.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferTetrahedron
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Tetrahedron.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Tetrahedron.prototype.constructor = GameLib.D3.Geometry.Buffer.Tetrahedron;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create Instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Tetrahedron.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.TetrahedronBufferGeometry(
|
||||||
|
this.radius,
|
||||||
|
this.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
this.instance.addGroup(
|
||||||
|
0,
|
||||||
|
this.instance.attributes.position.count,
|
||||||
|
0
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Tetrahedron.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'detail'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Tetrahedron to a GameLib.D3.API.Geometry.Buffer.Tetrahedron
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Tetrahedron.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferTetrahedron = new GameLib.D3.API.Geometry.Buffer.Tetrahedron(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.radius,
|
||||||
|
this.detail
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferTetrahedron;
|
||||||
|
};
|
|
@ -0,0 +1,142 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Text
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferText
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Text = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferText
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferText)) {
|
||||||
|
apiGeometryBufferText = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TEXT
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Text.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferText,
|
||||||
|
apiGeometryBufferText.text,
|
||||||
|
apiGeometryBufferText.font,
|
||||||
|
apiGeometryBufferText.size,
|
||||||
|
apiGeometryBufferText.height,
|
||||||
|
apiGeometryBufferText.curveSegments,
|
||||||
|
apiGeometryBufferText.bevelEnabled,
|
||||||
|
apiGeometryBufferText.bevelThickness,
|
||||||
|
apiGeometryBufferText.bevelSize,
|
||||||
|
apiGeometryBufferText.bevelSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferText
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Text.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Text.prototype.constructor = GameLib.D3.Geometry.Buffer.Text;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Text.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
if (!this.font || !this.font.instance) {
|
||||||
|
console.warn('font not ready for this instance');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.instance = new THREE.TextBufferGeometry(
|
||||||
|
this.text,
|
||||||
|
{
|
||||||
|
font : this.font.instance,
|
||||||
|
size : this.size,
|
||||||
|
curveSegments : this.curveSegments,
|
||||||
|
steps : this.steps,
|
||||||
|
amount : this.amount,
|
||||||
|
bevelEnabled : this.bevelEnabled,
|
||||||
|
bevelThickness : this.bevelThickness,
|
||||||
|
bevelSize : this.bevelSize,
|
||||||
|
bevelSegments : this.bevelSegments
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Text.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'text' ||
|
||||||
|
property === 'font' ||
|
||||||
|
property === 'size' ||
|
||||||
|
property === 'height' ||
|
||||||
|
property === 'curveSegments' ||
|
||||||
|
property === 'bevelEnabled' ||
|
||||||
|
property === 'bevelThickness' ||
|
||||||
|
property === 'bevelSize' ||
|
||||||
|
property === 'bevelSegments'
|
||||||
|
) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Could be that the instance does not exist - because font was not ready
|
||||||
|
*/
|
||||||
|
if (this.instance) {
|
||||||
|
this.instance.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.warn('do other properties here');
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Text to a GameLib.D3.API.Geometry.Buffer.Text
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Text.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferText = new GameLib.D3.API.Geometry.Buffer.Text(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.text,
|
||||||
|
GameLib.Utils.IdOrNull(this.font),
|
||||||
|
this.size,
|
||||||
|
this.height,
|
||||||
|
this.curveSegments,
|
||||||
|
this.bevelEnabled,
|
||||||
|
this.bevelThickness,
|
||||||
|
this.bevelSize,
|
||||||
|
this.bevelSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferText;
|
||||||
|
};
|
|
@ -0,0 +1,113 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.TorusKnot
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferTorusKnot
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.TorusKnot = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferTorusKnot
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferTorusKnot)) {
|
||||||
|
apiGeometryBufferTorusKnot = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS_KNOT
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.TorusKnot.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferTorusKnot,
|
||||||
|
apiGeometryBufferTorusKnot.radius,
|
||||||
|
apiGeometryBufferTorusKnot.tube,
|
||||||
|
apiGeometryBufferTorusKnot.radialSegments,
|
||||||
|
apiGeometryBufferTorusKnot.tubularSegments,
|
||||||
|
apiGeometryBufferTorusKnot.p,
|
||||||
|
apiGeometryBufferTorusKnot.q
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferTorusKnot
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.TorusKnot.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.TorusKnot.prototype.constructor = GameLib.D3.Geometry.Buffer.TorusKnot;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.TorusKnot.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.TorusKnotBufferGeometry(
|
||||||
|
this.radius,
|
||||||
|
this.tube,
|
||||||
|
this.radialSegments,
|
||||||
|
this.tubularSegments,
|
||||||
|
this.p,
|
||||||
|
this.q
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.TorusKnot.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'tube' ||
|
||||||
|
property === 'radialSegments' ||
|
||||||
|
property === 'tubularSegments' ||
|
||||||
|
property === 'p' ||
|
||||||
|
property === 'q'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.TorusKnot to a GameLib.D3.API.Geometry.Buffer.TorusKnot
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.TorusKnot.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferTorusKnot = new GameLib.D3.API.Geometry.Buffer.TorusKnot(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.radius,
|
||||||
|
this.tube,
|
||||||
|
this.radialSegments,
|
||||||
|
this.tubularSegments,
|
||||||
|
this.p,
|
||||||
|
this.q
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferTorusKnot;
|
||||||
|
};
|
|
@ -0,0 +1,109 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Torus
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferTorus
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Torus = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferTorus
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferTorus)) {
|
||||||
|
apiGeometryBufferTorus = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TORUS
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Torus.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferTorus,
|
||||||
|
apiGeometryBufferTorus.radius,
|
||||||
|
apiGeometryBufferTorus.tube,
|
||||||
|
apiGeometryBufferTorus.radialSegments,
|
||||||
|
apiGeometryBufferTorus.tubularSegments,
|
||||||
|
apiGeometryBufferTorus.arc
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferTorus
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Torus.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Torus.prototype.constructor = GameLib.D3.Geometry.Buffer.Torus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Torus.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.TorusBufferGeometry(
|
||||||
|
this.radius,
|
||||||
|
this.tube,
|
||||||
|
this.radialSegments,
|
||||||
|
this.tubularSegments,
|
||||||
|
this.arc
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Torus.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'tube' ||
|
||||||
|
property === 'radialSegments' ||
|
||||||
|
property === 'tubularSegments' ||
|
||||||
|
property === 'arc'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Torus to a GameLib.D3.API.Geometry.Buffer.Torus
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Torus.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferTorus = new GameLib.D3.API.Geometry.Buffer.Torus(
|
||||||
|
apiBufferGeometry,
|
||||||
|
this.radius,
|
||||||
|
this.tube,
|
||||||
|
this.radialSegments,
|
||||||
|
this.tubularSegments,
|
||||||
|
this.arc
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferTorus;
|
||||||
|
};
|
|
@ -0,0 +1,109 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Buffer.Tube
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryBufferTube
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Tube = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryBufferTube
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryBufferTube)) {
|
||||||
|
apiGeometryBufferTube = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_BUFFER_TUBE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Buffer.Tube.call(
|
||||||
|
this,
|
||||||
|
apiGeometryBufferTube,
|
||||||
|
apiGeometryBufferTube.path,
|
||||||
|
apiGeometryBufferTube.tubularSegments,
|
||||||
|
apiGeometryBufferTube.radius,
|
||||||
|
apiGeometryBufferTube.radialSegments,
|
||||||
|
apiGeometryBufferTube.closed
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryBufferTube
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.Tube.prototype = Object.create(GameLib.D3.Geometry.Buffer.prototype);
|
||||||
|
GameLib.D3.Geometry.Buffer.Tube.prototype.constructor = GameLib.D3.Geometry.Buffer.Tube;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Tube.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.TubeBufferGeometry(
|
||||||
|
this.path.instance,
|
||||||
|
this.tubularSegments,
|
||||||
|
this.radius,
|
||||||
|
this.radialSegments,
|
||||||
|
this.closed
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Tube.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'path' ||
|
||||||
|
property === 'tubularSegments' ||
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'radialSegments' ||
|
||||||
|
property === 'closed'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Buffer.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Buffer.Tube to a GameLib.D3.API.Geometry.Buffer.Tube
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Buffer}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Buffer.Tube.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiBufferGeometry = GameLib.D3.Geometry.Buffer.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryBufferTube = new GameLib.D3.API.Geometry.Buffer.Tube(
|
||||||
|
apiBufferGeometry,
|
||||||
|
GameLib.Utils.IdOrNull(this.path),
|
||||||
|
this.tubularSegments,
|
||||||
|
this.radius,
|
||||||
|
this.radialSegments,
|
||||||
|
this.closed
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryBufferTube;
|
||||||
|
};
|
|
@ -0,0 +1,471 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Normal
|
||||||
|
* @param graphics
|
||||||
|
* @param apiNormalGeometry
|
||||||
|
* @property geometryType
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal = function(
|
||||||
|
graphics,
|
||||||
|
apiNormalGeometry
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiNormalGeometry)) {
|
||||||
|
apiNormalGeometry = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.call(
|
||||||
|
this,
|
||||||
|
apiNormalGeometry,
|
||||||
|
apiNormalGeometry.colors,
|
||||||
|
apiNormalGeometry.lineDistances,
|
||||||
|
apiNormalGeometry.morphTargets,
|
||||||
|
apiNormalGeometry.morphNormals,
|
||||||
|
apiNormalGeometry.skinWeights,
|
||||||
|
apiNormalGeometry.skinIndices,
|
||||||
|
apiNormalGeometry.verticesNeedsUpdate,
|
||||||
|
apiNormalGeometry.elementsNeedUpdate,
|
||||||
|
apiNormalGeometry.uvsNeedUpdate,
|
||||||
|
apiNormalGeometry.normalsNeedUpdate,
|
||||||
|
apiNormalGeometry.colorsNeedUpdate,
|
||||||
|
apiNormalGeometry.groupsNeedUpdate,
|
||||||
|
apiNormalGeometry.lineDistancesNeedUpdate
|
||||||
|
);
|
||||||
|
|
||||||
|
this.colors = this.colors.map(
|
||||||
|
function(color) {
|
||||||
|
return new GameLib.Color(
|
||||||
|
this.graphics,
|
||||||
|
color
|
||||||
|
)
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.skinWeights = this.skinWeights.map(
|
||||||
|
function(skinWeight) {
|
||||||
|
return new GameLib.Vector4(
|
||||||
|
this.graphics,
|
||||||
|
skinWeight,
|
||||||
|
this
|
||||||
|
)
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
this.skinIndices = this.skinIndices.map(
|
||||||
|
function(skinIndex) {
|
||||||
|
return new GameLib.Vector4(
|
||||||
|
this.graphics,
|
||||||
|
skinIndex,
|
||||||
|
this
|
||||||
|
)
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
this
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.prototype = Object.create(GameLib.D3.Geometry.prototype);
|
||||||
|
GameLib.D3.Geometry.Normal.prototype.constructor = GameLib.D3.Geometry.Normal;
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
if (GameLib.Utils.Defined(this.instance)) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We already have our object - just call our parent and return
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.prototype.createInstance.call(this);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.instance = new THREE.Geometry();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup colors
|
||||||
|
*/
|
||||||
|
this.instance.colors = this.colors.map(
|
||||||
|
function(color) {
|
||||||
|
return color.instance;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup faces
|
||||||
|
*/
|
||||||
|
this.applyToInstance('faces');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup line distances - we let three calculate it and then update our information
|
||||||
|
*/
|
||||||
|
this.instance.computeLineDistances();
|
||||||
|
this.lineDistances = this.instance.lineDistances;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Some more stuff
|
||||||
|
*/
|
||||||
|
if (this.morphTargets && this.morphTargets.length > 0) {
|
||||||
|
this.instance.morphTargets = this.morphTargets;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.morphNormals && this.morphNormals.length > 0) {
|
||||||
|
this.instance.morphNormals = this.morphNormals;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.skinWeights && this.skinWeights.length > 0) {
|
||||||
|
this.instance.skinWeights = this.skinWeights.map(
|
||||||
|
function(skinWeight) {
|
||||||
|
return skinWeight.instance;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.skinIndices && this.skinIndices.length > 0) {
|
||||||
|
this.instance.skinIndices = this.skinIndices.map(
|
||||||
|
function(skinIndex) {
|
||||||
|
return skinIndex.instance;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup vertices
|
||||||
|
*/
|
||||||
|
this.applyToInstance('vertices');
|
||||||
|
|
||||||
|
//TODO: Below is actually for blender data - fix this server side and then remove this eventually
|
||||||
|
//this.instance.computeFaceNormals();
|
||||||
|
//this.instance.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(this.instance)) {
|
||||||
|
console.warn('no geometry instance');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'colors') {
|
||||||
|
this.instance.colors = this.colors.map(
|
||||||
|
function(color) {
|
||||||
|
return color.instance;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
this.instance.colorsNeedUpdate = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'faces') {
|
||||||
|
this.applyToInstance(property);
|
||||||
|
this.instance.elementsNeedUpdate = true;
|
||||||
|
this.instance.groupsNeedUpdate = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'lineDistances') {
|
||||||
|
this.instance.lineDistances = this.lineDistances;
|
||||||
|
this.instance.lineDistancesNeedUpdate = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'morphTargets') {
|
||||||
|
this.instance.morphTargets = this.morphTargets;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'morphNormals') {
|
||||||
|
this.instance.morphNormals = this.morphNormals;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'skinWeights') {
|
||||||
|
|
||||||
|
if (this.skinWeights) {
|
||||||
|
this.instance.skinWeights = this.skinWeights.map(
|
||||||
|
function(skinWeight) {
|
||||||
|
return skinWeight.instance;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
console.warn('todo : check deleting skinweights');
|
||||||
|
delete this.instance.skinWeights;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'skinIndices') {
|
||||||
|
|
||||||
|
if (this.skinIndices) {
|
||||||
|
this.instance.skinIndices = this.skinIndices.map(
|
||||||
|
function(skinIndex) {
|
||||||
|
return skinIndex.instance;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
console.warn('todo : check deleting skinIndices');
|
||||||
|
delete this.instance.skinIndices;
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'vertices') {
|
||||||
|
this.applyToInstance(property);
|
||||||
|
this.instance.verticesNeedUpdate = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manually trigger updates (and ignore our setting)
|
||||||
|
*/
|
||||||
|
if (property === 'verticesNeedsUpdate') {
|
||||||
|
this.instance.verticesNeedsUpdate = true;
|
||||||
|
this.verticesNeedUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'elementsNeedUpdate') {
|
||||||
|
this.instance.elementsNeedUpdate = true;
|
||||||
|
this.elementsNeedUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'uvsNeedUpdate') {
|
||||||
|
this.instance.uvsNeedUpdate = true;
|
||||||
|
this.uvsNeedUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'normalsNeedUpdate') {
|
||||||
|
this.instance.normalsNeedUpdate = true;
|
||||||
|
this.normalsNeedUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'colorsNeedUpdate') {
|
||||||
|
this.instance.colorsNeedUpdate = true;
|
||||||
|
this.colorsNeedUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'groupsNeedUpdate') {
|
||||||
|
this.instance.groupsNeedUpdate = true;
|
||||||
|
this.groupsNeedUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'lineDistancesNeedUpdate') {
|
||||||
|
this.instance.lineDistancesNeedUpdate = true;
|
||||||
|
this.lineDistancesNeedUpdate = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Normal to a GameLib.D3.API.Geometry.Normal
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Normal}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiGeometry = GameLib.D3.Geometry.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiNormalGeometry = new GameLib.D3.API.Geometry.Normal(
|
||||||
|
apiGeometry,
|
||||||
|
this.colors.map(
|
||||||
|
function(color) {
|
||||||
|
return color.toApiObject();
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.lineDistances,
|
||||||
|
this.morphTargets,
|
||||||
|
this.morphNormals,
|
||||||
|
this.skinWeights.map(
|
||||||
|
function(skinWeight) {
|
||||||
|
return skinWeight.toApiObject();
|
||||||
|
}
|
||||||
|
),
|
||||||
|
this.skinIndices.map(
|
||||||
|
function(skinIndex) {
|
||||||
|
return skinIndex.toApiObject();
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiNormalGeometry;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update GameLib.D3.Geometry.Normal from instance
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal.prototype.updateFromInstance = function() {
|
||||||
|
|
||||||
|
var processed = 0;
|
||||||
|
|
||||||
|
this.instance.faces.map(function(face, faceIndex){
|
||||||
|
|
||||||
|
processed++;
|
||||||
|
|
||||||
|
if (processed % 100 === 0) {
|
||||||
|
console.log('processed ' + processed + ' faces');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.faces.push(
|
||||||
|
new GameLib.D3.Face(
|
||||||
|
this.graphics,
|
||||||
|
new GameLib.D3.API.Face(
|
||||||
|
null,
|
||||||
|
null,
|
||||||
|
face.a,
|
||||||
|
face.b,
|
||||||
|
face.c,
|
||||||
|
face.materialIndex,
|
||||||
|
[[
|
||||||
|
new GameLib.API.Vector2(
|
||||||
|
this.instance.faceVertexUvs[0][faceIndex][0].x,
|
||||||
|
this.instance.faceVertexUvs[0][faceIndex][0].y
|
||||||
|
),
|
||||||
|
new GameLib.API.Vector2(
|
||||||
|
this.instance.faceVertexUvs[0][faceIndex][1].x,
|
||||||
|
this.instance.faceVertexUvs[0][faceIndex][1].y
|
||||||
|
),
|
||||||
|
new GameLib.API.Vector2(
|
||||||
|
this.instance.faceVertexUvs[0][faceIndex][2].x,
|
||||||
|
this.instance.faceVertexUvs[0][faceIndex][2].y
|
||||||
|
)
|
||||||
|
]],
|
||||||
|
new GameLib.Color(
|
||||||
|
this.graphics,
|
||||||
|
new GameLib.API.Color(
|
||||||
|
face.color.r,
|
||||||
|
face.color.g,
|
||||||
|
face.color.b
|
||||||
|
)
|
||||||
|
),
|
||||||
|
face.vertexColors.map(function(vertexColor){
|
||||||
|
return new GameLib.Color(
|
||||||
|
this.graphics,
|
||||||
|
new GameLib.API.Color(
|
||||||
|
vertexColor.r,
|
||||||
|
vertexColor.g,
|
||||||
|
vertexColor.b
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}.bind(this)),
|
||||||
|
face.vertexNormals.map(function(vertexNormal){
|
||||||
|
return new GameLib.Vector3(
|
||||||
|
this.graphics,
|
||||||
|
new GameLib.API.Vector3(
|
||||||
|
vertexNormal.x,
|
||||||
|
vertexNormal.y,
|
||||||
|
vertexNormal.z
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}.bind(this)),
|
||||||
|
new GameLib.Vector3(
|
||||||
|
this.graphics,
|
||||||
|
new GameLib.API.Vector3(
|
||||||
|
face.normal.x,
|
||||||
|
face.normal.y,
|
||||||
|
face.normal.z
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
processed = 0;
|
||||||
|
|
||||||
|
this.instance.vertices.map(function(vertex){
|
||||||
|
|
||||||
|
processed++;
|
||||||
|
|
||||||
|
if (processed % 100 === 0) {
|
||||||
|
console.log('processed ' + processed + ' vertices');
|
||||||
|
}
|
||||||
|
|
||||||
|
this.vertices.push(
|
||||||
|
new GameLib.D3.Vertex(
|
||||||
|
this.graphics,
|
||||||
|
new GameLib.D3.API.Vertex(
|
||||||
|
new GameLib.Vector3(
|
||||||
|
this.graphics,
|
||||||
|
new GameLib.API.Vector3(
|
||||||
|
vertex.x,
|
||||||
|
vertex.y,
|
||||||
|
vertex.z
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
}.bind(this));
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.prototype.applyToInstance = function(property) {
|
||||||
|
|
||||||
|
if (property === 'faces') {
|
||||||
|
|
||||||
|
this.faces = GameLib.Utils.SortFacesByMaterialIndex(this.faces);
|
||||||
|
|
||||||
|
var standardUvs = [];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Now setup each face and collect UV information during this process
|
||||||
|
*/
|
||||||
|
this.instance.faces = this.faces.map(
|
||||||
|
function (face) {
|
||||||
|
|
||||||
|
if (face.uvs[0].length > 0) {
|
||||||
|
standardUvs.push(
|
||||||
|
face.uvs[0].map(
|
||||||
|
function (uv) {
|
||||||
|
return uv.instance;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!face.instance) {
|
||||||
|
face.createInstance(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
return face.instance;
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* UV data - but only if it exists
|
||||||
|
*/
|
||||||
|
if (standardUvs.length > 0) {
|
||||||
|
this.instance.faceVertexUvs = [standardUvs];
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (property === 'vertices') {
|
||||||
|
this.instance.vertices = this.vertices.map(
|
||||||
|
function (vertex) {
|
||||||
|
return vertex.position.instance;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Re-compute vertex normals
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal.prototype.computeVertexNormals = function() {
|
||||||
|
console.log('re-computing vertex normals');
|
||||||
|
this.instance.computeVertexNormals();
|
||||||
|
};
|
|
@ -0,0 +1,97 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Normal.Box
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryNormalBox
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal.Box = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryNormalBox
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryNormalBox)) {
|
||||||
|
apiGeometryNormalBox = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_BOX
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.Box.call(
|
||||||
|
this,
|
||||||
|
apiGeometryNormalBox,
|
||||||
|
apiGeometryNormalBox.width,
|
||||||
|
apiGeometryNormalBox.height,
|
||||||
|
apiGeometryNormalBox.depth,
|
||||||
|
apiGeometryNormalBox.widthSegments,
|
||||||
|
apiGeometryNormalBox.heightSegments,
|
||||||
|
apiGeometryNormalBox.depthSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryNormalBox
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.Box.prototype = Object.create(GameLib.D3.Geometry.Normal.prototype);
|
||||||
|
GameLib.D3.Geometry.Normal.Box.prototype.constructor = GameLib.D3.Geometry.Normal.Box;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal.Box.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.BoxGeometry(
|
||||||
|
this.width,
|
||||||
|
this.height,
|
||||||
|
this.depth,
|
||||||
|
this.widthSegments,
|
||||||
|
this.heightSegments,
|
||||||
|
this.depthSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal.Box.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'width'
|
||||||
|
) {
|
||||||
|
this.createInstance();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Normal.Box to a GameLib.D3.API.Geometry.Normal.Box
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Normal}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal.Box.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiNormalGeometry = GameLib.D3.Geometry.Normal.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryNormalBox = new GameLib.D3.API.Geometry.Normal.Box(
|
||||||
|
apiNormalGeometry,
|
||||||
|
this.width,
|
||||||
|
this.height,
|
||||||
|
this.depth,
|
||||||
|
this.widthSegments,
|
||||||
|
this.heightSegments,
|
||||||
|
this.depthSegments
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryNormalBox;
|
||||||
|
};
|
|
@ -0,0 +1,105 @@
|
||||||
|
/**
|
||||||
|
* GameLib.D3.Geometry.Normal.Circle
|
||||||
|
* @param graphics GameLib.GraphicsRuntime
|
||||||
|
* @param apiGeometryNormalCircle
|
||||||
|
* @constructor
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal.Circle = function(
|
||||||
|
graphics,
|
||||||
|
apiGeometryNormalCircle
|
||||||
|
) {
|
||||||
|
|
||||||
|
this.graphics = graphics;
|
||||||
|
this.graphics.isNotThreeThrow();
|
||||||
|
|
||||||
|
if (GameLib.Utils.UndefinedOrNull(apiGeometryNormalCircle)) {
|
||||||
|
apiGeometryNormalCircle = {
|
||||||
|
geometryType : GameLib.D3.API.Geometry.GEOMETRY_TYPE_NORMAL_CIRCLE
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.API.Geometry.Normal.Circle.call(
|
||||||
|
this,
|
||||||
|
apiGeometryNormalCircle,
|
||||||
|
apiGeometryNormalCircle.radius,
|
||||||
|
apiGeometryNormalCircle.segments,
|
||||||
|
apiGeometryNormalCircle.thetaStart,
|
||||||
|
apiGeometryNormalCircle.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.call(
|
||||||
|
this,
|
||||||
|
this.graphics,
|
||||||
|
apiGeometryNormalCircle
|
||||||
|
);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.Circle.prototype = Object.create(GameLib.D3.Geometry.Normal.prototype);
|
||||||
|
GameLib.D3.Geometry.Normal.Circle.prototype.constructor = GameLib.D3.Geometry.Normal.Circle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a light instance
|
||||||
|
* @returns {*}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal.Circle.prototype.createInstance = function() {
|
||||||
|
|
||||||
|
this.instance = new THREE.CircleGeometry(
|
||||||
|
this.radius,
|
||||||
|
this.segments,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
this.computeVertexNormals();
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.prototype.createInstance.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the instance with the current state
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal.Circle.prototype.updateInstance = function(property) {
|
||||||
|
|
||||||
|
if (
|
||||||
|
property === 'radius' ||
|
||||||
|
property === 'segments' ||
|
||||||
|
property === 'thetaStart' ||
|
||||||
|
property === 'thetaLength'
|
||||||
|
) {
|
||||||
|
this.instance.dispose();
|
||||||
|
this.createInstance();
|
||||||
|
|
||||||
|
if (this.parentMesh && this.parentMesh.instance) {
|
||||||
|
this.parentMesh.instance.geometry = this.instance;
|
||||||
|
|
||||||
|
if (this.parentMesh.helper) {
|
||||||
|
this.parentMesh.removeHelper();
|
||||||
|
this.parentMesh.createHelper();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameLib.D3.Geometry.Normal.prototype.updateInstance.call(this, property);
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Converts a GameLib.D3.Geometry.Normal.Circle to a GameLib.D3.API.Geometry.Normal.Circle
|
||||||
|
* @returns {GameLib.D3.API.Geometry.Normal}
|
||||||
|
*/
|
||||||
|
GameLib.D3.Geometry.Normal.Circle.prototype.toApiObject = function() {
|
||||||
|
|
||||||
|
var apiNormalGeometry = GameLib.D3.Geometry.Normal.prototype.toApiObject.call(this);
|
||||||
|
|
||||||
|
var apiGeometryNormalCircle = new GameLib.D3.API.Geometry.Normal.Circle(
|
||||||
|
apiNormalGeometry,
|
||||||
|
this.radius,
|
||||||
|
this.segments,
|
||||||
|
this.thetaStart,
|
||||||
|
this.thetaLength
|
||||||
|
);
|
||||||
|
|
||||||
|
return apiGeometryNormalCircle;
|
||||||
|
};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue