Skip to content

Commit

Permalink
Removes the hardcoded camera ID
Browse files Browse the repository at this point in the history
Also cleans up the handling of cameras.  This doesn’t fix all of the
issues with glee however.  The navObject changes were never made in
glge, and this would take too long to get working at this point
  • Loading branch information
scottnc27603 committed Feb 10, 2015
1 parent c2ee692 commit 79042bd
Showing 1 changed file with 14 additions and 65 deletions.
79 changes: 14 additions & 65 deletions support/client/lib/vwf/model/glge.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,7 @@ define( [ "module", "vwf/model", "vwf/utility" ], function( module, model, utili
glgeKeys: new GLGE.KeyInput(),
type: childExtendsID,
camera: {
ID: undefined,
defaultCamID: "http-vwf-example-com-camera-vwf-camera",
glgeCameras: {},
ID: undefined
},
xmlColladaObjects: [],
srcColladaObjects: [],
Expand All @@ -124,7 +122,6 @@ define( [ "module", "vwf/model", "vwf/utility" ], function( module, model, utili
};

if ( sceneNode.glgeScene.camera ) {
sceneNode.camera.glgeCameras[ sceneNode.camera.defaultCamID ] = sceneNode.glgeScene.camera;
sceneNode.glgeScene.camera.name = "camera";
this.state.cameraInUse = sceneNode.glgeScene.camera;
initCamera.call( this, sceneNode.glgeScene.camera );
Expand Down Expand Up @@ -162,24 +159,11 @@ define( [ "module", "vwf/model", "vwf/utility" ], function( module, model, utili
sourceType: childType,
};

if ( nodeID != 0 && !node.glgeObject ) {
if ( nodeID === this.kernel.application() && childName === "camera" ) {

} else if ( node.glgeObject === undefined ){
createCamera.call( this, nodeID, childID, childName );
}

if ( sceneNode && sceneNode.camera ) {
if ( childID == sceneNode.camera.defaultCamID ) {
if ( !sceneNode.camera.glgeCameras[ childID ] ) {
var cam = new GLGE.Camera();
sceneNode.camera.glgeCameras[ childID ] = cam;
initCamera.call( this, cam );
}
node.name = camName;
node.glgeObject = sceneNode.camera.glgeCameras[ childID ];

} else if ( node.glgeObject ) {
sceneNode.camera.glgeCameras[ childID ] = node.glgeObject;
}
}
}
} else if ( prototypes && isGlgeLightDefinition.call( this, prototypes ) ) {
if ( childName !== undefined ) {
Expand Down Expand Up @@ -327,28 +311,6 @@ define( [ "module", "vwf/model", "vwf/utility" ], function( module, model, utili
};
findMaterial.call( this, nodeID, childName, node );
}
} else {

switch ( childExtendsID ) {
case "appscene.vwf":
case "http://vwf.example.com/node.vwf":
case "http://vwf.example.com/node2.vwf":
case "http://vwf.example.com/scene.vwf":
case "http://vwf.example.com/navscene.vwf":
case undefined:
break;

default:
node = this.state.nodes[ childID ] = {
name: childName,
glgeObject: glgeChild,
ID: childID,
parentID: nodeID,
type: childExtendsID,
sourceType: childType,
};
break;
} // end of switch
} // end of else

// If we do not have a load a model for this node, then we are almost done, so we can update all
Expand Down Expand Up @@ -1965,30 +1927,17 @@ define( [ "module", "vwf/model", "vwf/utility" ], function( module, model, utili
if ( sceneNode && parent ) {
var child = this.state.nodes[childID];
if ( child ) {
var cam;
if ( sceneNode.camera && sceneNode.camera.glgeCameras ) {
if ( !sceneNode.camera.glgeCameras[childID] ) {
cam = new GLGE.Camera();
initCamera.call( this, cam );
sceneNode.camera.glgeCameras[childID] = cam;
} else {
cam = sceneNode.camera.glgeCameras[childID];
}
var glgeParent = parent.glgeObject;
if ( glgeParent && ( glgeParent instanceof GLGE.Scene || glgeParent instanceof GLGE.Group )) {
glgeParent.addObject( cam );
}

var glgeParent = parent.glgeObject;
if ( glgeParent && ( glgeParent instanceof GLGE.Scene || glgeParent instanceof GLGE.Group )) {
glgeParent.addObject( cam );
}

child.name = childName;
child.glgeObject = cam;
child.uid = child.glgeObject.uid;
cam.name = childName;
var cam = new GLGE.Camera();;
initCamera.call( this, cam );
var glgeParent = parent.glgeObject;
if ( glgeParent && ( glgeParent instanceof GLGE.Scene || glgeParent instanceof GLGE.Group )) {
glgeParent.addObject( cam );
}

child.name = childName;
child.glgeObject = cam;
child.uid = child.glgeObject.uid;
cam.name = childName;
}
}

Expand Down

0 comments on commit 79042bd

Please sign in to comment.