public void drawParticles(float frameTime, Frustum frustum) { particleFactory.preDraw(); //int i = 0; //int j = 0; //if (frustum.inFrustum(boundingSphere)) //TODO Not working properly { foreach (Particle p in listParticles) { if (frustum.inFrustum(p.position)) { p.Draw(activeCamera, frameTime); } } } particleFactory.postDraw(); }
public static void test() { Camera c = new Camera(new Vector3f(0.0f, 0.0f, 0.0f), 90.0f, 1.0f, 1.0f, 10.0f); Frustum f = new Frustum(c); Check.AssertEquals(f.fc, new Vector3f(0.0f, 0.0f, -10.0f)); Check.AssertEquals(f.fbl, new Vector3f(-10.0f,-10.0f, -10.0f)); Check.AssertEquals(f.fbr, new Vector3f( 10.0f,-10.0f, -10.0f)); Check.AssertEquals(f.ftl, new Vector3f(-10.0f, 10.0f, -10.0f)); Check.AssertEquals(f.ftr, new Vector3f( 10.0f, 10.0f, -10.0f)); Check.AssertEquals("Testing p", f.inFrustum(new Vector3f(0.0f, 0.0f, -5.0f)), true); Check.AssertEquals(f.inFrustum(new Vector3f(10.0f, 10.0f, -10.0f)), true); Check.AssertEquals(f.inFrustum(new Vector3f(1.0f, 1.0f, -1.0f)), true); Check.AssertEquals(f.inFrustum(new Vector3f(0.0f, 0.0f, 0.0f)), false); Check.AssertEquals(f.inFrustum(new Vector3f(0.0f, 0.0f, 20.0f)), false); Check.AssertEquals(f.inFrustum(new Vector3f(-20.0f, -20.0f, 20.0f)), false); }
public static void test() { Camera c = new Camera(new Vector3f(0.0f, 0.0f, 0.0f), 90.0f, 1.0f, 1.0f, 10.0f); Frustum f = new Frustum(c); Check.AssertEquals(f.fc, new Vector3f(0.0f, 0.0f, -10.0f)); Check.AssertEquals(f.fbl, new Vector3f(-10.0f, -10.0f, -10.0f)); Check.AssertEquals(f.fbr, new Vector3f(10.0f, -10.0f, -10.0f)); Check.AssertEquals(f.ftl, new Vector3f(-10.0f, 10.0f, -10.0f)); Check.AssertEquals(f.ftr, new Vector3f(10.0f, 10.0f, -10.0f)); Check.AssertEquals("Testing p", f.inFrustum(new Vector3f(0.0f, 0.0f, -5.0f)), true); Check.AssertEquals(f.inFrustum(new Vector3f(10.0f, 10.0f, -10.0f)), true); Check.AssertEquals(f.inFrustum(new Vector3f(1.0f, 1.0f, -1.0f)), true); Check.AssertEquals(f.inFrustum(new Vector3f(0.0f, 0.0f, 0.0f)), false); Check.AssertEquals(f.inFrustum(new Vector3f(0.0f, 0.0f, 20.0f)), false); Check.AssertEquals(f.inFrustum(new Vector3f(-20.0f, -20.0f, 20.0f)), false); }
public void drawParticles(float frameTime, Frustum frustum) { particleFactory.preDraw(); //int i = 0; //int j = 0; //if (frustum.inFrustum(boundingSphere)) //TODO Not working properly { foreach (Particle p in listParticles) { if (frustum.inFrustum(p.position)) p.Draw(activeCamera, frameTime); } } particleFactory.postDraw(); }