# HG changeset patch # User Yutaka_Kinjyo # Date 1326880564 -32400 # Node ID ba6c080bf9a43b1a9bcd7050c4d436f7366676db # Parent df50c95267ba4e05e1aaa19d4115c69509af4d68 work scale api. diff -r df50c95267ba -r ba6c080bf9a4 Renderer/Engine/SceneGraph.cc --- 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]; } } diff -r df50c95267ba -r ba6c080bf9a4 Renderer/Engine/SceneGraph.h --- 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); diff -r df50c95267ba -r ba6c080bf9a4 Renderer/Test/universe.cc --- 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;