About Store Forum Documentation Contact
Donations:
197$/mo



Post Reply 
transform(Scale)
Author Message
khces Offline
Member

Post: #1
transform(Scale)
Screenshot of the Anchor How do I write code to change anchor position??

And

changing anchor position, is it possible at cskel or mesh scale?


Attached File(s) Image(s)
   
(This post was last modified: 03-23-2010 11:37 AM by khces.)
03-23-2010 11:29 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #2
RE: transform(Scale)
Hello,

this is a sample code for scaling matrix at a specified 'anchor'

void Scale(Matrix &matrix,Vec &anchor,Flt scale)
{
matrix.move(-anchor);
matrix.scale(scale);
matrix.move(anchor);
}

this is code from my head (not tested but should be ok)


yes you can try applying scaled matrixes to drawing of meshes
03-23-2010 03:44 PM
Find all posts by this user Quote this message in a reply
khces Offline
Member

Post: #3
RE: transform(Scale)
hi, I've been doing, but did not
Code:
Box box( EffectMesh->box );
box += pos();
Matrix m; m.setPos(pos());
m.move(-box.down());
m.orn.scale(Size);
m.move(box.down());
EffectMesh->drawBlend(1.0,m);

http://www.youtube.com/watch?v=GkK84IPvjKE
(This post was last modified: 03-24-2010 11:12 AM by khces.)
03-24-2010 11:04 AM
Find all posts by this user Quote this message in a reply
Esenthel Offline
Administrator

Post: #4
RE: transform(Scale)
Try this:

this performs scale first, then moves to final position:
Code:
Vec local_anchor=EffectMesh->box.down();
Matrix m;
m.setPos(-local_anchor);
m.scale(Size);
m.move(local_anchor + pos());

If you don't want to play with 'anchors' then you can just translate your mesh in Mesh Editor so it is not centered, but located above the "identity matrix"
then you can just use m.scaleOrn(Size);
just like on this screen:
[Image: Import_Grass_1.jpg]
03-24-2010 04:57 PM
Find all posts by this user Quote this message in a reply
Post Reply