MarianG Posted March 8, 2015 Share Posted March 8, 2015 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#3http://www.babylonjs-playground.com/#RF9W9#5, c[0] is undefined Quote Link to comment Share on other sites More sharing options...
jerome Posted March 8, 2015 Share Posted March 8, 2015 Yepthe doc was in advance on the engine version running the playground : extrusion wasn't yet merged :-)I'll check monday if it's done Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted March 8, 2015 Share Posted March 8, 2015 Hello! To specify which part of the texture to use, you can:- Play with the UVs of your mesh- Use texture.uOffset, texture.vOffset, texture.uScale, texture.vScale Quote Link to comment Share on other sites More sharing options...
jerome Posted March 9, 2015 Share Posted March 9, 2015 @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. Quote Link to comment Share on other sites More sharing options...
MarianG Posted March 9, 2015 Author Share Posted March 9, 2015 Thanks Deltakosh.This is that I want. Quote Link to comment Share on other sites More sharing options...
jerome Posted March 11, 2015 Share Posted March 11, 2015 off-topic, but noticed by bulisor in this post : extrusion now fixed by DK Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.