public static IndexStream Create(GeometryManager manager, int size, bool isLarge, bool dynamic)
        {
            IndexStream newStream = new IndexStream();

            if (newStream.Initialize(manager, size, isLarge, dynamic))
            {
                return(newStream);
            }

            return(null);
        }
        public static GeometryManager Create(Device _device)
        {
            GeometryManager geometryManager = new GeometryManager();

            if (geometryManager.Initialize(_device))
            {
                return(geometryManager);
            }

            return(null);
        }
Beispiel #3
0
        public static VertexStream Create(GeometryManager manager, Type vertexType, int size, bool pointsprites, bool dynamic)
        {
            VertexStream newVertexStream = new VertexStream();

            if (newVertexStream.Initialize(manager, vertexType, size, pointsprites, dynamic))
            {
                return(newVertexStream);
            }

            return(null);
        }
Beispiel #4
0
        private bool Initialize(GeometryManager manager, Type vertexType, int size, bool pointsprites, bool dynamic)
        {
            if (IsTypeValid(vertexType))
            {
                try
                {
                    D3d.Pool  d3dPool  = D3d.Pool.Managed;
                    D3d.Usage d3dUsage = D3d.Usage.WriteOnly;

                    if (dynamic)
                    {
                        d3dUsage |= D3d.Usage.Dynamic;
                    }

                    if (pointsprites)
                    {
                        d3dUsage |= D3d.Usage.Points;
                    }

                    d3dManager    = manager;
                    d3dVertexType = vertexType;
                    d3dVertexSize = size;

                    d3dVertexBuffer = new D3d.VertexBuffer(vertexType,
                                                           size,
                                                           manager.Device.D3dDevice,
                                                           d3dUsage,
                                                           D3d.VertexFormats.None,
                                                           d3dPool);

                    return(true);
                }
                catch (D3d.InvalidCallException e)
                {
                    log.Warning("Unable to create vertex stream: {0}", e.Message);
                }
                catch (D3d.OutOfVideoMemoryException e)
                {
                    log.Warning("Unable to create vertex stream: {0}", e.Message);
                }
                catch (OutOfMemoryException e)
                {
                    log.Warning("Unable to create vertex stream: {0}", e.Message);
                }
            }

            return(false);
        }
Beispiel #5
0
        private bool Initialize(System.Windows.Forms.Control renderWindow)
        {
            d3dSettings = new Settings();
            d3dDevice   = DeviceUtility.CreateDevice(d3dSettings, renderWindow);

            if (d3dDevice != null)
            {
                d3dCapabilities       = new Capabilities(this);
                d3dPrimaryFrameBuffer = FrameBuffer.Create(this);
                d3dGeometryManager    = GeometryManager.Create(this);
                d3dTextureManager     = TextureManager.Create(this);
                d3dQueryManager       = QueryManager.Create(this);

                return(true);
            }
            return(false);
        }
        private bool Initialize(GeometryManager manager, int size, bool isLarge, bool dynamic)
        {
            try
            {
                D3d.Pool  d3dPool  = D3d.Pool.Managed;
                D3d.Usage d3dUsage = D3d.Usage.WriteOnly;

                if (dynamic)
                {
                    d3dUsage |= D3d.Usage.Dynamic;
                }

                d3dManager   = manager;
                d3dIndexSize = size;
                d3dIsLarge   = isLarge;

                d3dIndexBuffer = new D3d.IndexBuffer(this.Type, d3dIndexSize, manager.Device.D3dDevice,
                                                     d3dUsage, d3dPool);

                return(true);
            }
            catch (D3d.InvalidCallException e)
            {
                log.Warning("Unable to create index stream: {0}", e.Message);
            }
            catch (D3d.OutOfVideoMemoryException e)
            {
                log.Warning("Unable to create index stream: {0}", e.Message);
            }
            catch (OutOfMemoryException e)
            {
                log.Warning("Unable to create index stream: {0}", e.Message);
            }

            return(false);
        }