Commits

Anonymous committed b25d413 Draft

Ditto, fixed a careless build break.

Comments (0)

Files changed (3)

 		moon.setAngularVelocity(Vec3f(0, 0.01, 0));
 
 		// Asteroids
-		asteroidBelt(100000, 12000, this);
+		asteroidBelt(4000, 5000, this);
 	}
 	
 	override void update(float delta)

src/yage/scene/camera.d

 		list.timestamp = Clock.now().ticks(); // 100-nanosecond precision
 		list.cameraPosition = getWorldPosition();
 		list.cameraRotation = getWorldRotation();
-		//list.cameraVelocity = getWorldVelocity();
-	}
-	
-	/*
-	 * Cameras update a list of RenderCommands for every Scene they see.
-	 * This is typically one Scene and its Skybox. */
-	package void updateRenderCommands()
-	{
-		
-		void writeCommands(Node root, Plane[] frustum, LightNode[] lights, ref ArrayBuilder!(RenderCommand) result)
-		{
-			// Test this node for visibility
-			VisibleNode vnode = cast(VisibleNode)root;
-			if (vnode && vnode.getVisible()) 
-			{
-				/* // inlining doesn't help performance any.
-				ModelNode m = cast(ModelNode)vnode;
-				if (m)
-				{	Vec3f wp = m.getWorldPosition();
-					if (scene !is scene)
-						wp += getWorldPosition();		
-					
-					if (isVisible(wp, m.getRadius()))	
-					{	
-						RenderCommand rc;			
-						rc.transform = m.getWorldTransform().scale(m.getSize());
-						rc.geometry = m.getModel();
-						rc.materialOverrides = m.materialOverrides;
-						rc.setLights(m.getLights(lights, 8));
-						result.append(rc);
-					}
-				} else */
-					vnode.getRenderCommands(this, lights, result);
-			}
-			
-			// Recurse through and render children.
-			foreach (Node c;  root.getChildren())
-				writeCommands(c, frustum, lights, result);
-		}
-
-		
-		//assert(Thread.getThis() == scene.getUpdateThread());
-		
-		currentYres = Window.getInstance().getHeight(); // TODO Break dependance on Window.
-		
-		// TODO: If this takes 1ms, it's still 15ms longer until this is called a second time that the renderer
-		// can use this info!  Maybe we need a way to say we're done writing?
-		// e.g. renderlists.performWrite(void (ref RenderList list) { ... });
-		auto list = renderLists.getNextWrite();
-		
-		// Iterate through skyboxes, clearing out the RenderList commands and refilling them
-		list.cameraInverse = getWorldTransform().inverse(); // must occur before the loop below
-		list.timestamp = Clock.now().ticks(); // 100-nanosecond precision
-		
-		// Ensure we have a command set for this scene
-			
-		list.commands.reserveAndClear(); // reset content
-		list.scene = scene;
-
-		// Add lights that affect what this camera can see.			
-		int j;
-		scope allLights = scene.getAllLights();
-		list.lights.length = allLights.length;
-		foreach (ref light; allLights) // Make a deep copy of the scene's lights 
-		{	list.lights.data[j] = light.clone(false, list.lights.data[j]); // to prevent locking when the render thread uses them.
-			list.lights.data[j].setPosition(light.getWorldPosition());
-			list.lights.data[j].cameraSpacePosition = light.getWorldPosition().transform(list.cameraInverse); 
-			if (light.type == LightNode.Type.SPOT)
-				list.lights.data[j].setRotation(light.getWorldRotation());
-			list.lights.data[j].transform.worldPosition = list.lights.data[j].transform.position;
-			list.lights.data[j].transform.worldDirty = false; // hack to prevent it from being recalculated.
-			j++;
-		}
-			
-		writeCommands(scene, frustum, list.lights.data, list.commands);
+		list.cameraVelocity = getWorldVelocity();
 	}
 
 	static RenderScene* currentRenderList;

src/yage/scene/scene.d

 	 *     delta = time in seconds.  If not set, defaults to the amount of time since the last time update() was called. */
 	void update(float delta)
 	{
+		scope a = new Timer(true);
+
 		mixin(Sync!("this"));
 	
-		// Update all nodes recursively
-		//super.update(delta); 
 
 		foreach (camera; cameras)
 			camera.beginUpdateRenderCommands();