/// <summary> /// Constructor. The graphics device must be sent along, as it is needed to create new vertex buffers. /// The particle cloud system is also required, since the leaves are represented as a particle cloud. /// </summary> /// <param name="device">The graphics device.</param> /// <param name="cloudSystem">The particle cloud system. One system can be shared among many tree generators.</param> public TreeGenerator(GraphicsDevice device, ParticleCloudSystem cloudSystem, Effect trunk) { graphicsDevice = device; this.cloudSystem = cloudSystem; //trunkEffect = new BasicEffect(device, new EffectPool()); // Load the tree effect. trunkEffect = trunk; }
public XMain(GraphicsDevice GraphicsDevice, IServiceProvider Services, string ContentRootDir, XCamera defaultCamera) { Components = new List <XComponent>(); this.Content = new ContentManager(Services); this.Content.RootDirectory = ContentRootDir; this.GraphicsDevice = GraphicsDevice; this.Services = Services; Tools = new XTools(this); SystemFont = new XFont(this, @"Content\XEngine\Fonts\System"); Debug = new XDebug(this); FrameRate = new XFrameRate(this); Console = new XConsole(this); DebugDrawer = new XDebugDrawer(this); DepthMap = new XDepthMap(this); Environment = new XEnvironmentParameters(this); Physics = new PhysicsSystem(); Physics.EnableFreezing = true; Physics.SolverType = PhysicsSystem.Solver.Normal; Physics.CollisionSystem = new CollisionSystemGrid(32, 32, 32, 32, 32, 32); Physics.CollisionSystem.UseSweepTests = true; //New system //Physics.CollisionSystem = new CollisionSystemSAP(); //Rendering should be the last thing! The constructor requires some componnets like debug, debugdrawer to allready exist! Renderer = new XRenderer(this); this.DefaultCamera = defaultCamera; // Initialize the particle cloud system for tree leaves! cloudSystem = new ParticleCloudSystem(GraphicsDevice, Content, "Content/XEngine/Effects/ParticleCloud"); }
} //? sortedTechnique : unsortedTechnique #endregion /// <summary> /// Creates an empty particle cloud. /// </summary> /// <param name="system">The particle cloud system used to draw the particles. You only need one system for all your clouds.</param> public ParticleCloud(ParticleCloudSystem system) { Debug.Assert(system != null, "A null ParticleCloudSystem was passed to a ParticleCloud. It must be non-null."); this.system = system; }