|
@@ -20,10 +20,11 @@
|
|
* You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements).
|
|
* You can set different colors and different images to each box side by using the parameters `faceColors` (an array of 6 Color3 elements) and `faceUV` (an array of 6 Vector4 elements).
|
|
* Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
|
|
* Please read this tutorial : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreateBox(name: string, options: { size?: number, width?: number, height?: number, depth?: number, faceUV?: Vector4[], faceColors?: Color4[], sideOrientation?: number, updatable?: boolean }, scene: Scene): Mesh {
|
|
|
|
|
|
+ public static CreateBox(name: string, options: { size?: number, width?: number, height?: number, depth?: number, faceUV?: Vector4[], faceColors?: Color4[], sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4, updatable?: boolean }, scene: Scene): Mesh {
|
|
var box = new Mesh(name, scene);
|
|
var box = new Mesh(name, scene);
|
|
|
|
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
@@ -45,10 +46,11 @@
|
|
* You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio
|
|
* You can create an unclosed sphere with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference (latitude) : 2 x PI x ratio
|
|
* You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude).
|
|
* You can create an unclosed sphere on its height with the parameter `slice` (positive float, default1), valued between 0 and 1, what is the height ratio (longitude).
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreateSphere(name: string, options: { segments?: number, diameter?: number, diameterX?: number, diameterY?: number, diameterZ?: number, arc?: number, slice?: number, sideOrientation?: number, updatable?: boolean }, scene: any): Mesh {
|
|
|
|
|
|
+ public static CreateSphere(name: string, options: { segments?: number, diameter?: number, diameterX?: number, diameterY?: number, diameterZ?: number, arc?: number, slice?: number, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4, updatable?: boolean }, scene: any): Mesh {
|
|
var sphere = new Mesh(name, scene);
|
|
var sphere = new Mesh(name, scene);
|
|
|
|
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
@@ -68,10 +70,11 @@
|
|
* The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc.
|
|
* The parameter `tessellation` sets the number of polygon sides (positive integer, default 64). So a tessellation valued to 3 will build a triangle, to 4 a square, etc.
|
|
* You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio
|
|
* You can create an unclosed polygon with the parameter `arc` (positive float, default 1), valued between 0 and 1, what is the ratio of the circumference : 2 x PI x ratio
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreateDisc(name: string, options: { radius?: number, tessellation?: number, arc?: number, updatable?: boolean, sideOrientation?: number }, scene: Scene): Mesh {
|
|
|
|
|
|
+ public static CreateDisc(name: string, options: { radius?: number, tessellation?: number, arc?: number, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }, scene: Scene): Mesh {
|
|
var disc = new Mesh(name, scene);
|
|
var disc = new Mesh(name, scene);
|
|
|
|
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
@@ -92,10 +95,11 @@
|
|
* The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
|
|
* The parameter `subdivisions` sets the number of subdivisions (postive integer, default 4). The more subdivisions, the more faces on the icosphere whatever its size.
|
|
* The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface.
|
|
* The parameter `flat` (boolean, default true) gives each side its own normals. Set it to false to get a smooth continuous light reflection on the surface.
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreateIcoSphere(name: string, options: { radius?: number, radiusX?: number, radiusY?: number, radiusZ?: number, flat?: boolean, subdivisions?: number, sideOrientation?: number, updatable?: boolean }, scene: Scene): Mesh {
|
|
|
|
|
|
+ public static CreateIcoSphere(name: string, options: { radius?: number, radiusX?: number, radiusY?: number, radiusZ?: number, flat?: boolean, subdivisions?: number, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4, updatable?: boolean }, scene: Scene): Mesh {
|
|
var sphere = new Mesh(name, scene);
|
|
var sphere = new Mesh(name, scene);
|
|
|
|
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
@@ -120,6 +124,7 @@
|
|
* It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11.
|
|
* It's the offset to join the points from the same path. Ex : offset = 10 means the point 1 is joined to the point 11.
|
|
* The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
|
|
* The optional parameter `instance` is an instance of an existing Ribbon object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#ribbon
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
|
|
* The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
|
|
* The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones.
|
|
* The parameter `uvs` is an optional flat array of `Vector2` to update/set each ribbon vertex with its own custom UV values instead of the computed ones.
|
|
@@ -129,7 +134,7 @@
|
|
* Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time.
|
|
* Moreover, you can use the parameter `color` with `instance` (to update the ribbon), only if you previously used it at creation time.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreateRibbon(name: string, options: { pathArray: Vector3[][], closeArray?: boolean, closePath?: boolean, offset?: number, updatable?: boolean, sideOrientation?: number, instance?: Mesh, invertUV?: boolean, uvs?: Vector2[], colors?: Color4[] }, scene?: Scene): Mesh {
|
|
|
|
|
|
+ public static CreateRibbon(name: string, options: { pathArray: Vector3[][], closeArray?: boolean, closePath?: boolean, offset?: number, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4, instance?: Mesh, invertUV?: boolean, uvs?: Vector2[], colors?: Color4[] }, scene?: Scene): Mesh {
|
|
var pathArray = options.pathArray;
|
|
var pathArray = options.pathArray;
|
|
var closeArray = options.closeArray;
|
|
var closeArray = options.closeArray;
|
|
var closePath = options.closePath;
|
|
var closePath = options.closePath;
|
|
@@ -280,10 +285,11 @@
|
|
* If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.
|
|
* If `enclose` is true, a ring surface is 3 successive elements in the array : the tubular surface, then the two closing faces.
|
|
* Example how to set colors and textures on a sliced cylinder : http://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379
|
|
* Example how to set colors and textures on a sliced cylinder : http://www.html5gamedevs.com/topic/17945-creating-a-closed-slice-of-a-cylinder/#comment-106379
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreateCylinder(name: string, options: { height?: number, diameterTop?: number, diameterBottom?: number, diameter?: number, tessellation?: number, subdivisions?: number, arc?: number, faceColors?: Color4[], faceUV?: Vector4[], updatable?: boolean, hasRings?: boolean, enclose?: boolean, sideOrientation?: number }, scene: any): Mesh {
|
|
|
|
|
|
+ public static CreateCylinder(name: string, options: { height?: number, diameterTop?: number, diameterBottom?: number, diameter?: number, tessellation?: number, subdivisions?: number, arc?: number, faceColors?: Color4[], faceUV?: Vector4[], updatable?: boolean, hasRings?: boolean, enclose?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }, scene: any): Mesh {
|
|
var cylinder = new Mesh(name, scene);
|
|
var cylinder = new Mesh(name, scene);
|
|
|
|
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
@@ -303,10 +309,11 @@
|
|
* The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
|
|
* The parameter `thickness` sets the diameter size of the tube of the torus (float, default 0.5).
|
|
* The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
|
|
* The parameter `tessellation` sets the number of torus sides (postive integer, default 16).
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreateTorus(name: string, options: { diameter?: number, thickness?: number, tessellation?: number, updatable?: boolean, sideOrientation?: number }, scene: any): Mesh {
|
|
|
|
|
|
+ public static CreateTorus(name: string, options: { diameter?: number, thickness?: number, tessellation?: number, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }, scene: any): Mesh {
|
|
var torus = new Mesh(name, scene);
|
|
var torus = new Mesh(name, scene);
|
|
|
|
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
@@ -327,10 +334,11 @@
|
|
* The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
|
|
* The parameter `tubularSegments` sets the number of tubes to decompose the knot into (positive integer, default 32).
|
|
* The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
|
|
* The parameters `p` and `q` are the number of windings on each axis (positive integers, default 2 and 3).
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreateTorusKnot(name: string, options: { radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, p?: number, q?: number, updatable?: boolean, sideOrientation?: number }, scene: any): Mesh {
|
|
|
|
|
|
+ public static CreateTorusKnot(name: string, options: { radius?: number, tube?: number, radialSegments?: number, tubularSegments?: number, p?: number, q?: number, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }, scene: any): Mesh {
|
|
var torusKnot = new Mesh(name, scene);
|
|
var torusKnot = new Mesh(name, scene);
|
|
|
|
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
@@ -487,11 +495,12 @@
|
|
* The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
|
|
* The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
|
|
* Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
|
|
* Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
|
|
* The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static ExtrudeShape(name: string, options: { shape: Vector3[], path: Vector3[], scale?: number, rotation?: number, cap?: number, updatable?: boolean, sideOrientation?: number, instance?: Mesh, invertUV?: boolean }, scene: Scene): Mesh {
|
|
|
|
|
|
+ public static ExtrudeShape(name: string, options: { shape: Vector3[], path: Vector3[], scale?: number, rotation?: number, cap?: number, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4, instance?: Mesh, invertUV?: boolean }, scene: Scene): Mesh {
|
|
var path = options.path;
|
|
var path = options.path;
|
|
var shape = options.shape;
|
|
var shape = options.shape;
|
|
var scale = options.scale || 1;
|
|
var scale = options.scale || 1;
|
|
@@ -502,7 +511,7 @@
|
|
var instance = options.instance;
|
|
var instance = options.instance;
|
|
var invertUV = options.invertUV || false;
|
|
var invertUV = options.invertUV || false;
|
|
|
|
|
|
- return MeshBuilder._ExtrudeShapeGeneric(name, shape, path, scale, rotation, null, null, false, false, cap, false, scene, updatable, sideOrientation, instance, invertUV);
|
|
|
|
|
|
+ return MeshBuilder._ExtrudeShapeGeneric(name, shape, path, scale, rotation, null, null, false, false, cap, false, scene, updatable, sideOrientation, instance, invertUV, options.frontUVs, options.backUVs);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -536,11 +545,12 @@
|
|
* The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
|
|
* The optional parameter `instance` is an instance of an existing ExtrudedShape object to be updated with the passed `shape`, `path`, `scale` or `rotation` parameters : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#extruded-shape
|
|
* Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
|
|
* Remember you can only change the shape or path point positions, not their number when updating an extruded shape.
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
|
|
* The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static ExtrudeShapeCustom(name: string, options: { shape: Vector3[], path: Vector3[], scaleFunction?: any, rotationFunction?: any, ribbonCloseArray?: boolean, ribbonClosePath?: boolean, cap?: number, updatable?: boolean, sideOrientation?: number, instance?: Mesh, invertUV?: boolean }, scene: Scene): Mesh {
|
|
|
|
|
|
+ public static ExtrudeShapeCustom(name: string, options: { shape: Vector3[], path: Vector3[], scaleFunction?: any, rotationFunction?: any, ribbonCloseArray?: boolean, ribbonClosePath?: boolean, cap?: number, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4, instance?: Mesh, invertUV?: boolean }, scene: Scene): Mesh {
|
|
var path = options.path;
|
|
var path = options.path;
|
|
var shape = options.shape;
|
|
var shape = options.shape;
|
|
var scaleFunction = options.scaleFunction || (() => { return 1; });
|
|
var scaleFunction = options.scaleFunction || (() => { return 1; });
|
|
@@ -552,7 +562,7 @@
|
|
var sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
var sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
var instance = options.instance;
|
|
var instance = options.instance;
|
|
var invertUV = options.invertUV || false;
|
|
var invertUV = options.invertUV || false;
|
|
- return MeshBuilder._ExtrudeShapeGeneric(name, shape, path, null, null, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, true, scene, updatable, sideOrientation, instance, invertUV);
|
|
|
|
|
|
+ return MeshBuilder._ExtrudeShapeGeneric(name, shape, path, null, null, scaleFunction, rotationFunction, ribbonCloseArray, ribbonClosePath, cap, true, scene, updatable, sideOrientation, instance, invertUV, options.frontUVs, options.backUVs);
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -568,11 +578,12 @@
|
|
* The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
|
|
* The parameter `closed` (boolean, default true) opens/closes the lathe circumference. This should be set to false when used with the parameter "arc".
|
|
* The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
|
|
* The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
|
|
* The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreateLathe(name: string, options: { shape: Vector3[], radius?: number, tessellation?: number, arc?: number, closed?: boolean, updatable?: boolean, sideOrientation?: number, cap?: number, invertUV?: boolean }, scene: Scene): Mesh {
|
|
|
|
|
|
+ public static CreateLathe(name: string, options: { shape: Vector3[], radius?: number, tessellation?: number, arc?: number, closed?: boolean, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4, cap?: number, invertUV?: boolean }, scene: Scene): Mesh {
|
|
var arc: number = options.arc ? ((options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc) : 1.0;
|
|
var arc: number = options.arc ? ((options.arc <= 0 || options.arc > 1) ? 1.0 : options.arc) : 1.0;
|
|
var closed: boolean = (options.closed === undefined) ? true : options.closed;
|
|
var closed: boolean = (options.closed === undefined) ? true : options.closed;
|
|
var shape = options.shape;
|
|
var shape = options.shape;
|
|
@@ -608,7 +619,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
// lathe ribbon
|
|
// lathe ribbon
|
|
- var lathe = MeshBuilder.CreateRibbon(name, { pathArray: paths, closeArray: closed, sideOrientation: sideOrientation, updatable: updatable, invertUV: invertUV }, scene);
|
|
|
|
|
|
+ var lathe = MeshBuilder.CreateRibbon(name, { pathArray: paths, closeArray: closed, sideOrientation: sideOrientation, updatable: updatable, invertUV: invertUV, frontUVs: options.frontUVs, backUVs: options.backUVs }, scene);
|
|
return lathe;
|
|
return lathe;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -619,10 +630,11 @@
|
|
* You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value than `size`).
|
|
* You can set some different plane dimensions by using the parameters `width` and `height` (both by default have the same value than `size`).
|
|
* The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane.
|
|
* The parameter `sourcePlane` is a Plane instance. It builds a mesh plane from a Math plane.
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreatePlane(name: string, options: { size?: number, width?: number, height?: number, sideOrientation?: number, updatable?: boolean, sourcePlane?: Plane }, scene: Scene): Mesh {
|
|
|
|
|
|
+ public static CreatePlane(name: string, options: { size?: number, width?: number, height?: number, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4, updatable?: boolean, sourcePlane?: Plane }, scene: Scene): Mesh {
|
|
var plane = new Mesh(name, scene);
|
|
var plane = new Mesh(name, scene);
|
|
|
|
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
@@ -789,11 +801,12 @@
|
|
* The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
|
|
* The parameter `cap` sets the way the extruded shape is capped. Possible values : BABYLON.Mesh.NO_CAP (default), BABYLON.Mesh.CAP_START, BABYLON.Mesh.CAP_END, BABYLON.Mesh.CAP_ALL
|
|
* The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#tube
|
|
* The optional parameter `instance` is an instance of an existing Tube object to be updated with the passed `pathArray` parameter : http://doc.babylonjs.com/tutorials/How_to_dynamically_morph_a_mesh#tube
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
|
|
* The optional parameter `invertUV` (boolean, default false) swaps in the geometry the U and V coordinates to apply a texture.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreateTube(name: string, options: { path: Vector3[], radius?: number, tessellation?: number, radiusFunction?: { (i: number, distance: number): number; }, cap?: number, arc?: number, updatable?: boolean, sideOrientation?: number, instance?: Mesh, invertUV?: boolean }, scene: Scene): Mesh {
|
|
|
|
|
|
+ public static CreateTube(name: string, options: { path: Vector3[], radius?: number, tessellation?: number, radiusFunction?: { (i: number, distance: number): number; }, cap?: number, arc?: number, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4, instance?: Mesh, invertUV?: boolean }, scene: Scene): Mesh {
|
|
var path = options.path;
|
|
var path = options.path;
|
|
var radius = options.radius || 1.0;
|
|
var radius = options.radius || 1.0;
|
|
var tessellation = options.tessellation || 64|0;
|
|
var tessellation = options.tessellation || 64|0;
|
|
@@ -884,7 +897,7 @@
|
|
var newPathArray = new Array<Array<Vector3>>();
|
|
var newPathArray = new Array<Array<Vector3>>();
|
|
cap = (cap < 0 || cap > 3) ? 0 : cap;
|
|
cap = (cap < 0 || cap > 3) ? 0 : cap;
|
|
pathArray = tubePathArray(path, path3D, newPathArray, radius, tessellation, radiusFunction, cap, options.arc);
|
|
pathArray = tubePathArray(path, path3D, newPathArray, radius, tessellation, radiusFunction, cap, options.arc);
|
|
- var tube = MeshBuilder.CreateRibbon(name, { pathArray: pathArray, closePath: true, closeArray: false, updatable: updatable, sideOrientation: sideOrientation, invertUV: invertUV }, scene);
|
|
|
|
|
|
+ var tube = MeshBuilder.CreateRibbon(name, { pathArray: pathArray, closePath: true, closeArray: false, updatable: updatable, sideOrientation: sideOrientation, invertUV: invertUV, frontUVs: options.frontUVs, backUVs: options.backUVs }, scene);
|
|
(<any>tube).pathArray = pathArray;
|
|
(<any>tube).pathArray = pathArray;
|
|
(<any>tube).path3D = path3D;
|
|
(<any>tube).path3D = path3D;
|
|
(<any>tube).tessellation = tessellation;
|
|
(<any>tube).tessellation = tessellation;
|
|
@@ -908,10 +921,11 @@
|
|
* To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
|
|
* To understand how to set `faceUV` or `faceColors`, please read this by considering the right number of faces of your polyhedron, instead of only 6 for the box : http://doc.babylonjs.com/tutorials/CreateBox_Per_Face_Textures_And_Colors
|
|
* The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored.
|
|
* The parameter `flat` (boolean, default true). If set to false, it gives the polyhedron a single global face, so less vertices and shared normals. In this case, `faceColors` and `faceUV` are ignored.
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
* You can also set the mesh side orientation with the values : BABYLON.Mesh.FRONTSIDE (default), BABYLON.Mesh.BACKSIDE or BABYLON.Mesh.DOUBLESIDE
|
|
|
|
+ * If you create a double-sided mesh, you can choose what parts of the texture image to crop and stick respectively on the front and the back sides with the parameters `frontUVs` and `backUVs` (Vector4).
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* Detail here : http://doc.babylonjs.com/tutorials/02._Discover_Basic_Elements#side-orientation
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
* The mesh can be set to updatable with the boolean parameter `updatable` (default false) if its internal geometry is supposed to change once created.
|
|
*/
|
|
*/
|
|
- public static CreatePolyhedron(name: string, options: { type?: number, size?: number, sizeX?: number, sizeY?: number, sizeZ?: number, custom?: any, faceUV?: Vector4[], faceColors?: Color4[], flat?: boolean, updatable?: boolean, sideOrientation?: number }, scene: Scene): Mesh {
|
|
|
|
|
|
+ public static CreatePolyhedron(name: string, options: { type?: number, size?: number, sizeX?: number, sizeY?: number, sizeZ?: number, custom?: any, faceUV?: Vector4[], faceColors?: Color4[], flat?: boolean, updatable?: boolean, sideOrientation?: number, frontUVs?: Vector4, backUVs?: Vector4 }, scene: Scene): Mesh {
|
|
var polyhedron = new Mesh(name, scene);
|
|
var polyhedron = new Mesh(name, scene);
|
|
|
|
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
options.sideOrientation = MeshBuilder.updateSideOrientation(options.sideOrientation, scene);
|
|
@@ -1140,7 +1154,7 @@
|
|
}
|
|
}
|
|
|
|
|
|
// Privates
|
|
// Privates
|
|
- private static _ExtrudeShapeGeneric(name: string, shape: Vector3[], curve: Vector3[], scale: number, rotation: number, scaleFunction: { (i: number, distance: number): number; }, rotateFunction: { (i: number, distance: number): number; }, rbCA: boolean, rbCP: boolean, cap: number, custom: boolean, scene: Scene, updtbl: boolean, side: number, instance: Mesh, invertUV: boolean): Mesh {
|
|
|
|
|
|
+ private static _ExtrudeShapeGeneric(name: string, shape: Vector3[], curve: Vector3[], scale: number, rotation: number, scaleFunction: { (i: number, distance: number): number; }, rotateFunction: { (i: number, distance: number): number; }, rbCA: boolean, rbCP: boolean, cap: number, custom: boolean, scene: Scene, updtbl: boolean, side: number, instance: Mesh, invertUV: boolean, frontUVs: Vector4, backUVs: Vector4): Mesh {
|
|
// extrusion geometry
|
|
// extrusion geometry
|
|
var extrusionPathArray = (shape, curve, path3D, shapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom) => {
|
|
var extrusionPathArray = (shape, curve, path3D, shapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom) => {
|
|
var tangents = path3D.getTangents();
|
|
var tangents = path3D.getTangents();
|
|
@@ -1222,7 +1236,7 @@
|
|
var newShapePaths = new Array<Array<Vector3>>();
|
|
var newShapePaths = new Array<Array<Vector3>>();
|
|
cap = (cap < 0 || cap > 3) ? 0 : cap;
|
|
cap = (cap < 0 || cap > 3) ? 0 : cap;
|
|
pathArray = extrusionPathArray(shape, curve, path3D, newShapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom);
|
|
pathArray = extrusionPathArray(shape, curve, path3D, newShapePaths, scale, rotation, scaleFunction, rotateFunction, cap, custom);
|
|
- var extrudedGeneric = MeshBuilder.CreateRibbon(name, {pathArray: pathArray, closeArray: rbCA, closePath: rbCP, updatable: updtbl, sideOrientation: side, invertUV: invertUV}, scene);
|
|
|
|
|
|
+ var extrudedGeneric = MeshBuilder.CreateRibbon(name, {pathArray: pathArray, closeArray: rbCA, closePath: rbCP, updatable: updtbl, sideOrientation: side, invertUV: invertUV, frontUVs: frontUVs, backUVs: backUVs}, scene);
|
|
(<any>extrudedGeneric).pathArray = pathArray;
|
|
(<any>extrudedGeneric).pathArray = pathArray;
|
|
(<any>extrudedGeneric).path3D = path3D;
|
|
(<any>extrudedGeneric).path3D = path3D;
|
|
(<any>extrudedGeneric).cap = cap;
|
|
(<any>extrudedGeneric).cap = cap;
|