Jump to content

sprite texture


MarianG
 Share

Recommended Posts

Hi.

Please tell me what kind of texture I need to use, if I have a big image 2048x2048, what contain a lot of litlle image (sprite of images) and I want to apply to mesh a specific image from there, and at click, another image from same sprite.

 

I found informations, only about Procedural Textures, on documentation, and on Github, are a lot of textures.

Thanks.

 

PS:

tutorials from http://doc.babylonjs.com/, section  Parametric Shapes, doesn't work :

http://www.babylonjs-playground.com/#RF9W9#3

http://www.babylonjs-playground.com/#RF9W9#5,  

 

c[0] is undefined

 

 

Link to comment
Share on other sites

@bulisor :

Ok, I understand why the playground examples don't work (parametric shapes / extrusion )... and why they still work on my computer with my one week old last generated babylonjs-2.1.js.

There are actually many missing lines in the Mesh._ExtrudeShapeGeneric() function in the current github babylonjs2.1.js file.

Don't know why ...

 

@DK :

Can you see this commit : https://github.com/jbousquie/Babylon.js/commit/5fa4e0e2632ba71048191fb2c8dd16846057cb57 ?

Green lines of the right panel from 1187 to 1211 are missing the Mesh._ExtrudeShapeGeneric() function of the current github babylonjs-2.1.js file.

(beware : there were following ones + some of your manual cleanups)

 

current js  :

        Mesh._ExtrudeShapeGeneric = function (name, shape, curve, scale, rotation, scaleFunction, rotationFunction, rbCA, rbCP, custom, scene, updtbl, side) {            var path3D = new BABYLON.Path3D(curve);            var shapePaths = [];            var extrudedGeneric = Mesh.CreateRibbon(name, shapePaths, rbCA, rbCP, 0, scene, updtbl, side);            return extrudedGeneric;        };

current mesh.ts file :

 private static _ExtrudeShapeGeneric(name: string, shape: Vector3[], curve: Vector3[], scale: number, rotation: number, scaleFunction, rotationFunction, rbCA:     boolean, rbCP: boolean, custom: boolean, scene: Scene, updtbl: boolean, side: number): Mesh {  var path3D = new Path3D(curve);  var shapePaths: Vector3[][] = [];  var extrudedGeneric = Mesh.CreateRibbon(name, shapePaths, rbCA, rbCP, 0, scene, updtbl, side);  return extrudedGeneric;}

Needed lines (all the logic for extrusion is here !) :

 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, custom: boolean, scene: Scene, updtbl: boolean, side: number): Mesh {  var path3D: Path3D = new BABYLON.Path3D(curve);  var tangents: Vector3[] = path3D.getTangents();  var normals: Vector3[] = path3D.getNormals();  var binormals: Vector3[] = path3D.getBinormals();  var distances: number[] = path3D.getDistances();  var shapePaths: Vector3[][] = [];  var angle: number = 0;  var returnScale: { (i: number, distance: number): number; } = function(i, distance) { return scale; };  var returnRotation: { (i: number, distance: number): number; } = function(i, distance) { return rotation; };  var rotate: { (i: number, distance: number): number; } = custom ? rotateFunction : returnRotation;  var scl: { (i: number, distance: number): number; } = custom ? scaleFunction : returnScale;  for (var i: number = 0; i < curve.length; i++) {    var shapePath: Vector3[] = [];    var angleStep: number = rotate(i, distances[i]);    var scaleRatio: number = scl(i, distances[i]);    for (var p: number = 0; p < shape.length; p++) {      var rotationMatrix: Matrix = BABYLON.Matrix.RotationAxis(tangents[i], angle);      var planed: Vector3 = ( (tangents[i].scale(shape[p].z)).add(normals[i].scale(shape[p].x)).add(binormals[i].scale(shape[p].y)) );      var rotated: Vector3 = BABYLON.Vector3.TransformCoordinates(planed, rotationMatrix).scaleInPlace(scaleRatio).add(curve[i]);      shapePath.push(rotated);    }    shapePaths.push(shapePath);    angle += angleStep;  }  var extrudedGeneric = BABYLON.Mesh.CreateRibbon(name, shapePaths, rbCA, rbCP, 0, scene, updtbl, side);  return extrudedGeneric;}

Maybe something wen't wrong with the last fix/edition about the scope variable cleanup, I don't really know. :(

Maybe in this commit : https://github.com/BabylonJS/Babylon.js/commit/77d51c86bffe3094bb2170f0d98113e9cc5ad9af where 20 lines seem to have gone away.

 

It used to work, it doesn't work anymore.

Lines are just missing.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...