summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2007-10-09 16:42:43 +0000
committerChien Yang <[email protected]>2007-10-09 16:42:43 +0000
commitd13ad0a770b019111334fcdf64b7df3367e56f9c (patch)
tree0c96c28afd54f8ba981fa380fc17cb1d10bfaf24
parent8da01910c3d9bae328c1e704ef627d80888441a7 (diff)
Fix to issue 532 : Background geometry BG isn't saved with SceneGraphFileWriter.
This fix is submitted by mcneillk. git-svn-id: https://svn.java.net/svn/j3d-core-utils~svn/trunk@172 9497e636-51bd-65ba-982d-a4982e1767a5
-rw-r--r--src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/BackgroundState.java14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/BackgroundState.java b/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/BackgroundState.java
index 44fad07..8c0d4fe 100644
--- a/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/BackgroundState.java
+++ b/src/classes/share/com/sun/j3d/utils/scenegraph/io/state/javax/media/j3d/BackgroundState.java
@@ -48,11 +48,11 @@ import java.io.DataInput;
import java.io.DataOutput;
import java.io.IOException;
import com.sun.j3d.utils.scenegraph.io.retained.Controller;
+import com.sun.j3d.utils.scenegraph.io.retained.RandomAccessFileControl;
import com.sun.j3d.utils.scenegraph.io.retained.SymbolTableData;
import javax.media.j3d.SceneGraphObject;
import javax.media.j3d.Background;
import javax.media.j3d.BoundingLeaf;
-import javax.media.j3d.Appearance;
import javax.media.j3d.ImageComponent2D;
import javax.media.j3d.BranchGroup;
import javax.vecmath.Color3f;
@@ -73,6 +73,7 @@ public class BackgroundState extends LeafState {
}
}
+ @Override
public void writeObject( DataOutput out ) throws IOException {
super.writeObject( out );
@@ -84,8 +85,11 @@ public class BackgroundState extends LeafState {
((Background)node).getColor(clr);
control.writeColor3f( out, clr );
out.writeInt( ((Background)node).getImageScaleMode() );
+ // Fixed to issue #532 : write the background geometry BranchGraph
+ control.writeBranchGraph(((Background) node).getGeometry(),null);
}
+ @Override
public void readObject( DataInput in ) throws IOException {
super.readObject( in );
@@ -94,9 +98,11 @@ public class BackgroundState extends LeafState {
image = in.readInt();
((Background)node).setApplicationBounds( control.readBounds(in));
- ((Background)node).setColor( control.readColor3f(in));
-
+ ((Background)node).setColor( control.readColor3f(in));
((Background)node).setImageScaleMode( in.readInt() );
+ // Fix to issue #532 : read the background geometry BranchGraph
+ int id = control.getSymbolTable().getSymbol(geometry).branchGraphID;
+ ((RandomAccessFileControl)control).readBranchGraph(id);
}
/**
@@ -109,6 +115,7 @@ public class BackgroundState extends LeafState {
control.getSymbolTable().incNodeComponentRefCount( image );
}
+ @Override
public void buildGraph() {
((Background)node).setApplicationBoundingLeaf( (BoundingLeaf)control.getSymbolTable().getJ3dNode( boundingLeaf ));
((Background)node).setGeometry( (BranchGroup)control.getSymbolTable().getJ3dNode( geometry ));
@@ -117,6 +124,7 @@ public class BackgroundState extends LeafState {
}
+ @Override
protected SceneGraphObject createNode() {
return new Background();
}