ambiera logo

Ambiera Forum

Discussions, Help and Support.

folder icon Ambiera Forum > CopperLicht
forum topic indicator change the scale of a texture
person icon
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

person icon
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;


person icon
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

person icon
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.

person icon
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:










 

  

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


icon_holyicon_cryicon_devilicon_lookicon_grinicon_kissicon_monkeyicon_hmpf
icon_sadicon_happyicon_smileicon_uhicon_blink   






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