Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperLicht
change the scale of a texture

bagg
Registered User
Quote
2011-06-15 17:57:48

Hi Niko.
Can you please point me on how can i change the scale of TCoords.X,TCoords.Y in a meshbuffer?
I am doing this but it doesn't work.

var SelMesh = SomeMesh.getMesh();
if (SelMesh)
{
var meshBuffer = SelMesh.GetMeshBuffers();
if (meshBuffer)
{
for (var j = 0; j < meshBuffer.length; j++)
{
var BufVertices = meshBuffer[j].Vertices;
for (var k = 0; k < BufVertices.length; k++ )
{
meshBuffer[j].Vertices[k].TCoords.X = 10;
meshBuffer[j].Vertices[k].TCoords.Y = 10;
}
meshBuffer[j].Mat.Tex1 = engine.getTextureManager().getTexture("Image.jpg", true);
}
}

}

Thank's


niko
Moderator
Quote
2011-06-16 13:17:43

Scaling is done by multiplying, so your code should probably something like this:


var yourScale = 2.0; // scale by 2
...

meshBuffer[j].Vertices[k].TCoords.X *= yourScale;
meshBuffer[j].Vertices[k].TCoords.Y *= yourScale;



bagg
Registered User
Quote
2011-06-16 19:26:13

It doesn't work can you please check it out?
And the other post i had about cloning a mesh bug did you checked it?

Thank's


niko
Moderator
Quote
2011-06-17 12:02:24

Should work, you probably forgot to call update() at the meshbuffer after you finished your modifications?
Cloning meshes should be fixed with the next update.


bagg
Registered User
Quote
2011-06-17 13:50:09

It's not working i called the update() and when i alert(meshBuffer[j].Vertices[k].TCoords.X ) it prints the right number (10) but it doesn't update the scale?????


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "In?ernational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact