コード例 #1
0
        /// <summary>
        /// TODO: fix for better DI
        /// </summary>
        /// <param name="sceneGraphNode"></param>
        /// <returns></returns>
        public EntityNode CreateEntityNode(SceneGraphNode node)
        {
            var ret = new EntityNode(this, node, worldOctree);

            EntityNodes.Add(ret);

            worldOctree.AddWorldObject(ret);
            node.ObserveDestroy(() =>
            {
                EntityNodes.Remove(ret);
                worldOctree.RemoveWorldObject(ret);
                ret.Dispose();
            });
            return(ret);
        }
コード例 #2
0
        public void TestPhysicalLodRendererOptimized()
        {
            float size = 1000f;

            setupObjects(size, () => new RenderablePhysical());

            var tree = new OptimizedWorldOctree <RenderablePhysical>(new Vector3(size, 200, size), 5);
            var lod  = new LinebasedLodRenderer(tree);

            TW.Data.Objects.OfType <RenderablePhysical>().ForEach(delegate(RenderablePhysical p) { tree.AddWorldObject(p); p.Visible = false; });

            engine.AddSimulator(new BasicSimulator(lod.UpdateRendererState));



            engine.AddSimulator(new PhysicalSimulator());
            engine.AddSimulator(new WorldRenderingSimulator());

            engine.AddSimulator(new BasicSimulator(lod.RenderLines));
        }