Mercurial > hg > Game > Cerium
changeset 1366:ba6c080bf9a4 draft
work scale api.
author | Yutaka_Kinjyo <yutaka@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 18 Jan 2012 18:56:04 +0900 |
parents | df50c95267ba |
children | 6748a09c63cb |
files | Renderer/Engine/SceneGraph.cc Renderer/Engine/SceneGraph.h Renderer/Test/universe.cc |
diffstat | 3 files changed, 15 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Engine/SceneGraph.cc Tue Jan 17 18:02:27 2012 +0900 +++ b/Renderer/Engine/SceneGraph.cc Wed Jan 18 18:56:04 2012 +0900 @@ -1274,10 +1274,20 @@ } void -SceneGraph::scaleIt(float *scale) +SceneGraph::scaleIt(float sx, float sy, float sz) { - for(int i=0;i<4;i++) { - for(int j=0;i<3;j++) { + + float scale[3] = {sx, sy, sz}; + + /* + * | sx*r sx*r sx*r 0 | + * | sy*r sy*r sy*r 0 | + * | sz*r sz*r sz*r 0 | + * | t t t 1 | + */ + + for(int i=0;i<3;i++) { + for(int j=0;j<3;j++) { matrix[i*4+j] = matrix[i*4+j]*scale[i]; } }
--- a/Renderer/Engine/SceneGraph.h Tue Jan 17 18:02:27 2012 +0900 +++ b/Renderer/Engine/SceneGraph.h Wed Jan 18 18:56:04 2012 +0900 @@ -118,7 +118,7 @@ void translateX(float x); void translateY(float y); void translateZ(float z); - void scaleIt(float *scale); + void scaleIt(float sx, float sy, float sz); void angleIt(float xangle, float yangle, float zangle);
--- a/Renderer/Test/universe.cc Tue Jan 17 18:02:27 2012 +0900 +++ b/Renderer/Test/universe.cc Wed Jan 18 18:56:04 2012 +0900 @@ -71,6 +71,7 @@ earth->translateX(screen_w / 2); //earth->xyz[1] = screen_h / 2; earth->translateY(screen_h / 2); + earth->scaleIt(3,1,3); earth->stack_xyz[0] = 3.0f; earth->stack_xyz[1] = 3.0f;