Ejemplo n.º 1
0
 internal static RenderableMock CreateRenderableMock(Device device)
 {
     return new RenderableMock()
     {
         Shader = TestHelpers.CreateSimpleShader(device)
     };
 }
Ejemplo n.º 2
0
 public Framework(IntPtr handle, int width, int height, string mediaRootPath)
 {
     Device = new Device(handle, width, height);
     AssetManager = new AssetManager(Device, mediaRootPath);
     Light = new Light();
     SpriteRenderer = new SpriteRenderer(Device);
     Renderer = new RenderSystem(Device, SpriteRenderer);
 }
Ejemplo n.º 3
0
        public void Device_RenderTarget_Test()
        {
            var device = new Device(Window.Handle, Window.Width, Window.Height);
            var renderTarget = new TextureRenderTarget(device, new Size(100, 100));

            Assert.AreEqual(true, device.SetRenderTarget(renderTarget));
            Assert.AreEqual(renderTarget, device.RenderTarget);
        }
Ejemplo n.º 4
0
 public void Device_GetVertexDeclarations_Test()
 {
     Device device = new Device(Window.Handle, Window.Width, Window.Height);
     Assert.IsNotNull(device.TransformedColoredVertexDecl);
     Assert.IsNotNull(device.MeshVertexDecl);
     Assert.IsNotNull(device.TextureVertexDecl);
     Assert.IsNotNull(device.ScreenVertexDecl);
 }
Ejemplo n.º 5
0
 public ScreenVertexDecl(Device device)
     : base(device, new[] {
             new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
             new VertexElement(0, 12, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
             VertexElement.VertexDeclarationEnd
         })
 {
 }
Ejemplo n.º 6
0
 public TextureRenderTarget(Device device, Size size)
 {
     Texture = new Texture(device, "RenderTarget", size);
     TargetSurface = Texture.RawTexture.GetSurfaceLevel(0);
     DepthStencilSurface = D3D.Surface.CreateDepthStencil(device.RawDevice, (int)size.Width, (int)size.Height, D3D.Format.D16,
         D3D.MultisampleType.None, 0, false);
     Size = size;
 }
Ejemplo n.º 7
0
        public Shader(Device device, string effectFile, string name)
        {
            this.device = device;
            EffectFile = effectFile;
            Name = name;

            this.effect = new Effect(this.device, EffectFile);
        }
Ejemplo n.º 8
0
 internal static Device GetDevice()
 {
     if (device == null)
     {
         Window window = new Window("TestHelpers.GetDevice", 640, 480);
         device = new Device(window.Handle, window.Width, window.Height);
     }
     return device;
 }
Ejemplo n.º 9
0
        public TransformedColoredVertexDecl(Device device)
            : base(device, new[] 
            {
        		new VertexElement(0, 0, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.PositionTransformed, 0),
        		new VertexElement(0, 16, DeclarationType.Color, DeclarationMethod.Default, DeclarationUsage.Color, 0),
				VertexElement.VertexDeclarationEnd
        	})
        {
        }
Ejemplo n.º 10
0
        public MeshNode(Device device, Mesh mesh)
        {
            Position = Vector3.Zero;
            Orientation = Quaternion.Identity;
            Scale = new Vector3(1.0f, 1.0f, 1.0f);

            this.device = device;
            this.mesh = mesh;
        }
Ejemplo n.º 11
0
        public SceneManager(Device device, AssetManager assetManager)
        {
            this.device = device;
            this.assetManager = assetManager;

            // Create default camera and light.
            Camera = new Camera();
            Light = new Light();
        }
Ejemplo n.º 12
0
        public Texture(Device device, string name, Size size)
        {
            RawTexture = new D3D.Texture(device.RawDevice, (int)size.Width, (int)size.Height, 1, D3D.Usage.RenderTarget,
                D3D.Format.A8R8G8B8, D3D.Pool.Default);

            Name = name;
            Width = (int)size.Width;
            Height = (int)size.Height;
            this.imageFileFormat = D3D.ImageFileFormat.Bmp;
        }
Ejemplo n.º 13
0
        public VertexDecl(Device device, VertexElement[] elements)
        {
            if (elements == null)
                return;

            if (elements[elements.Length - 1] != VertexElement.VertexDeclarationEnd)
                return;

            d3d9VertexDecl = new VertexDeclaration(device.RawDevice, elements);
        }
Ejemplo n.º 14
0
        public static Font Load(Device device, string fileName, string name, AssetManager assetManager)
        {
            using (var zip = new ZipArchive(fileName))
            {
                string textureFile = Path.ChangeExtension(Path.GetFileName(fileName), ".tga");
                Texture texture = new Texture(device, zip.Load(textureFile), name);

                string widthDataFile = Path.ChangeExtension(Path.GetFileName(fileName), ".dat");
                return new Font(name, texture, zip.Load(widthDataFile));
            }
        }
Ejemplo n.º 15
0
        public Glow(Device device, AssetManager assetManager)
        {
            this.device = device;
            this.shader = assetManager.Load(@"Engine\Glow.fx") as Shader;

            IsEnabled = true;
            RadialBlurScaleFactor = -0.004f;
            BlurWidth = 8.0f;
            GlowIntensity = 0.7f;
            HighlightIntensity = 0.4f;
        }
Ejemplo n.º 16
0
        public RenderSystem(Device device, SpriteRenderer spriteRenderer)
        {
            if (device == null)
                throw new ArgumentNullException("device");
            if (spriteRenderer == null)
                throw new ArgumentNullException("spriteRenderer");

            this.device = device;
            this.spriteRenderer = spriteRenderer;
            PrimaryRenderTarget = new RenderTarget();
        }
Ejemplo n.º 17
0
        public MeshVertexDecl(Device device)
            : base(device, new[] {
                new VertexElement(0, 0, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Position, 0),
        		new VertexElement(0, 12, DeclarationType.Float2, DeclarationMethod.Default, DeclarationUsage.TextureCoordinate, 0),
				new VertexElement(0, 20, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Normal, 0),
				new VertexElement(0, 32, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Binormal, 0),
				new VertexElement(0, 44, DeclarationType.Float3, DeclarationMethod.Default, DeclarationUsage.Tangent, 0),
				new VertexElement(0, 56, DeclarationType.Float4, DeclarationMethod.Default, DeclarationUsage.Color, 0),
                VertexElement.VertexDeclarationEnd
            })
        {
        }
Ejemplo n.º 18
0
 public object Load(Device device, string filePath, AssetLoadArguments args, string name, AssetManager assetManager)
 {
     bool loadHierarchy = args.GetValue<bool>("loadHierarchy", false);
     //if (loadHierarchy)
     //{
     //    return new BoneMesh(this.device, this, fullPath, name);
     //}
     //else
     {
         return Mesh.CreateFromXFile(device, assetManager, filePath, name);
     }
 }
Ejemplo n.º 19
0
        public Terrain(Device device, AssetManager assetManager,  int width, int length, int maxHeight, string[] textures)
        {
            this.heightMap = new HeightMap(width, length, maxHeight);

            CreatePatches(device);

            this.materials = textures.Select((texture, i) =>
                new Material("Terrain" + i)
                {
                    Shader = assetManager.Load(@"Engine\UberShader.fx") as Shader,
                    DiffuseTexture = assetManager.Load(texture) as Texture
                }).ToList();
            this.device = device;
        }
Ejemplo n.º 20
0
        public Texture(Device device, string filePath, string name)
        {
            var imgInfo = D3D.ImageInformation.FromFile(filePath);

            RawTexture = D3D.Texture.FromFile(device.RawDevice, filePath,
                                              imgInfo.Width, imgInfo.Height,
                                              1,
                                              D3D.Usage.None,
                                              D3D.Format.Unknown,
                                              D3D.Pool.Default,
                                              D3D.Filter.Default,
                                              D3D.Filter.Default,
                                              new Color(1.0f, 0.0f, 1.0f, 0.0f).ToArgb());
            Name = name;
            Width = imgInfo.Width;
            Height = imgInfo.Height;
            this.imageFileFormat = imgInfo.ImageFileFormat;
        }
Ejemplo n.º 21
0
        public Texture(Device device, Stream stream, string name)
        {
            var imgInfo = D3D.ImageInformation.FromStream(stream);
            RawTexture = D3D.Texture.FromStream(device.RawDevice, stream, (int)(stream.Length - stream.Position),
                                                imgInfo.Width, imgInfo.Height,
                                                1,
                                                D3D.Usage.None,
                                                D3D.Format.Unknown,
                                                D3D.Pool.Default,
                                                D3D.Filter.Default,
                                                D3D.Filter.Default,
                                                new Color(1.0f, 0.0f, 1.0f, 0.0f).ToArgb());

            Name = name;
            Width = imgInfo.Width;
            Height = imgInfo.Height;
            this.imageFileFormat = imgInfo.ImageFileFormat;
        }
Ejemplo n.º 22
0
 public Skybox(Device device, AssetManager assetManager)
 {
     this.device = device;
     this.shader = assetManager.Load(@"Engine\Skybox.fx") as Shader;
     AmbientColor = Color.White;
 }
Ejemplo n.º 23
0
 public IndexBuffer(Device device)
 {
     this.device = device;
     Indices = new List<short>();
 }
Ejemplo n.º 24
0
 public void CreateDevice()
 {
     Window window = new Window("VertexDeclTest", 640, 480);
     this.device = new Irelia.Render.Device(window.Handle, window.Width, window.Height);
 }
Ejemplo n.º 25
0
 public object Load(Device device, string filePath, AssetLoadArguments args, string name, AssetManager assetManager)
 {
     return Font.Load(device, filePath, name, assetManager);
 }
Ejemplo n.º 26
0
 public VectorShape(Device device)
 {
     this.d3dLine = new D3D.Line(device.RawDevice);
 }
Ejemplo n.º 27
0
 public void SetUp()
 {
     Device = TestHelpers.GetDevice();
     AssetManager = new AssetManager(Device, RenderSettings.MediaPath);
 }
Ejemplo n.º 28
0
 public DarkenBorder(Device device, AssetManager assetManager)
 {
     this.device = device;
     this.shader = assetManager.Load(@"Engine\DarkenBorder.fx") as Shader;
     IsEnabled = true;
 }
Ejemplo n.º 29
0
 public void SetUp()
 {
     Device = TestHelpers.GetDevice();
 }
Ejemplo n.º 30
0
 public object Load(Device device, string filePath, AssetLoadArguments args, string name, AssetManager assetManager)
 {
     bool cube = args.GetValue<bool>("cube", false);
     if (cube)
     {
         return new CubeTexture(device, filePath, name);
     }
     else
     {
         return new Texture(device, filePath, name);
     }
 }