@@ -641,6 +641,7 @@ Lights.prototype.setPointLight=function(index,position){
641641* May be null or omitted; default is (0,0,0).
642642*/
643643function Material ( ambient , diffuse , specular , shininess , emission ) {
644+ //console.log([ambient,diffuse,specular,shininess,emission]+"")
644645 if ( ambient != null ) ambient = GLUtil [ "toGLColor" ] ( ambient )
645646 if ( diffuse != null ) diffuse = GLUtil [ "toGLColor" ] ( diffuse )
646647 if ( specular != null ) specular = GLUtil [ "toGLColor" ] ( specular )
@@ -1795,12 +1796,12 @@ Scene3D.prototype.render=function(){
17951796 if ( typeof this . fboFilter != "undefined" && this . fboFilter ) {
17961797 // Render to the framebuffer, then to the main buffer via
17971798 // a filter
1798- this . fbo . bind ( this . program ) ;
1799- this . _renderInner ( ) ;
1800- this . fbo . unbind ( ) ;
18011799 var oldProgram = this . program ;
18021800 var oldProj = this . _projectionMatrix . slice ( 0 , 16 ) ;
18031801 var oldView = this . _viewMatrix . slice ( 0 , 16 ) ;
1802+ this . fbo . bind ( this . program ) ;
1803+ this . _renderInner ( ) ;
1804+ this . fbo . unbind ( ) ;
18041805 this . useProgram ( this . fboFilter ) ;
18051806 this . context . clear (
18061807 this . context . COLOR_BUFFER_BIT | this . context . DEPTH_BUFFER_BIT ) ;
@@ -1906,13 +1907,17 @@ function ShapeGroup(){
19061907 * @param {* } shape
19071908 */
19081909ShapeGroup . prototype . addShape = function ( shape ) {
1909- this . shapes . add ( shape ) ;
1910+ shape . parent = this ;
1911+ this . shapes . push ( shape ) ;
19101912}
19111913/**
19121914 * Not documented yet.
19131915 */
19141916ShapeGroup . prototype . getTransform = function ( ) {
1915- return this . getTransform ( ) ;
1917+ return this . transform ;
1918+ }
1919+ ShapeGroup . prototype . getMatrix = function ( ) {
1920+ return this . getTransform ( ) . getMatrix ( ) ;
19161921}
19171922/**
19181923 * Not documented yet.
@@ -1922,6 +1927,18 @@ ShapeGroup.prototype.setTransform=function(transform){
19221927 this . transform = transform . copy ( ) ;
19231928 return this ;
19241929}
1930+ ShapeGroup . prototype . setPosition = function ( x , y , z ) {
1931+ this . transform . setPosition ( x , y , z )
1932+ return this ;
1933+ }
1934+ ShapeGroup . prototype . setQuaternion = function ( quat ) {
1935+ this . transform . setQuaternion ( quat ) ;
1936+ return this ;
1937+ }
1938+ ShapeGroup . prototype . setScale = function ( x , y , z ) {
1939+ this . transform . setScale ( x , y , z ) ;
1940+ return this ;
1941+ }
19251942/**
19261943* An object that associates a geometric mesh (the shape of the object) with
19271944* material data (which defines what is seen on the object's surface)
@@ -2060,7 +2077,12 @@ Shape.prototype.setQuaternion=function(quat){
20602077 * @return {Array<number> } The current transformation matrix.
20612078 */
20622079Shape . prototype . getMatrix = function ( ) {
2063- return this . getTransform ( ) . getMatrix ( ) ;
2080+ var mat = this . getTransform ( ) . getMatrix ( ) ;
2081+ if ( this . parent != null ) {
2082+ var pmat = this . parent . getMatrix ( ) ;
2083+ mat = GLMath . mat4multiply ( pmat , mat ) ;
2084+ }
2085+ return mat ;
20642086}
20652087/////////////
20662088// Deprecated methods
0 commit comments