LoadTexture2D() 공개 메소드

public LoadTexture2D ( Stream s ) : Microsoft.Xna.Framework.Graphics.Texture2D
s Stream
리턴 Microsoft.Xna.Framework.Graphics.Texture2D
예제 #1
0
        public void Load(RTSRenderer renderer, ParticleOptions o)
        {
            // Create Bullet System
            plBullets = new ParticleList <BulletParticle, VertexBulletInstance>(renderer, o.BulletMaxCount, ParticleType.Bullet);
            using (var fs = File.OpenRead(o.BulletModel)) {
                LoadBulletModel(renderer, fs, ParsingFlags.ConversionOpenGL);
            }
            LoadBulletTexture(renderer, o.BulletTexture);

            // Create Fire System
            plFires = new ParticleList <FireParticle, VertexFireInstance>(renderer, o.FireMaxCount, ParticleType.Fire);
            BuildFireModel(renderer, o.FireDetail);
            LoadFireShader(renderer, o.FireNoise, o.FireColor, o.FireAlpha);

            // Create Lightning System
            plBolts = new ParticleList <LightningParticle, VertexLightningInstance>(renderer, o.LightningMaxCount, ParticleType.Lightning);
            BuildLightningModel(renderer);
            LoadLightningShader(renderer, o.LightningImage, o.LightningNumTypes);

            // Create Alert System
            plAlerts = new ParticleList <AlertParticle, VertexAlertInstance>(renderer, o.AlertMaxCount, ParticleType.Alert);
            BuildAlertModel(renderer);
            tAlert = renderer.LoadTexture2D(o.AlertImage);

            // Create Blood System
            plBloods = new ParticleList <BloodParticle, VertexAlertInstance>(renderer, o.BloodMaxCount, ParticleType.Blood);
            BuildBloodModel(renderer);
            tBlood = renderer.LoadTexture2D(o.BloodImage);
        }
 public void Build(RTSRenderer renderer, string rootPath, string model, string[] tex)
 {
     using(var sModel = File.OpenRead(Path.Combine(rootPath, model))) {
         View = new RTSBuildingModel(renderer, sModel);
     }
     View.ModelTexture = renderer.LoadTexture2D(Path.Combine(rootPath, tex[0]));
     View.ColorCodeTexture = renderer.LoadTexture2D(Path.Combine(rootPath, tex[1]));
 }
예제 #3
0
        public RTSUnitDataPanel(RTSRenderer renderer, WidgetRenderer wr, UICUnitData _uic, UICCombatStats _uicCS)
        {
            uic = _uic;
            iconLib = renderer.IconLibrary;

            WidgetBase = new RectWidget(wr, renderer.LoadTexture2D(uic.PanelImage));
            WidgetBase.Width = uic.PanelSize.X;
            WidgetBase.Height = uic.PanelSize.Y;
            WidgetBase.Color = uic.PanelColor;

            icon = new RectWidget(wr);
            icon.Width = uic.IconSize;
            icon.Height = uic.IconSize;
            icon.Color = Color.White;
            icon.Offset = new Point(uic.IconBuffer, uic.IconBuffer);
            icon.Parent = WidgetBase;

            rectHealthBack = new RectWidget(wr);
            rectHealthBack.Width = uic.IconSize;
            rectHealthBack.Height = uic.HealthHeight;
            rectHealthBack.AlignX = Alignment.MID;
            rectHealthBack.OffsetAlignX = Alignment.MID;
            rectHealthBack.OffsetAlignY = Alignment.BOTTOM;
            rectHealthBack.Offset = new Point(0, uic.IconBuffer);
            rectHealthBack.Color = UserConfig.MainScheme.WidgetBorder;
            rectHealthBack.Parent = icon;

            rectHealthFore = new RectWidget(wr);
            rectHealthFore.Width = uic.IconSize;
            rectHealthFore.Height = uic.HealthHeight;
            rectHealthFore.AlignX = Alignment.MID;
            rectHealthFore.AlignY = Alignment.MID;
            rectHealthFore.OffsetAlignX = Alignment.MID;
            rectHealthFore.OffsetAlignY = Alignment.MID;
            rectHealthFore.Offset = new Point(0, 0);
            rectHealthFore.Color = uic.HealthMaxColor;
            rectHealthFore.Parent = rectHealthBack;

            txtName = new TextWidget(wr);
            txtName.Height = uic.TextHeight;
            txtName.OffsetAlignX = Alignment.RIGHT;
            txtName.Offset = new Point(uic.IconBuffer, 0);
            txtName.Color = UserConfig.MainScheme.Text;
            txtName.Parent = icon;

            combatData = new RectButton(wr, uic.CombatSize, uic.CombatSize, Color.Gray, Color.White, renderer.LoadTexture2D(uic.CombatImage));
            combatData.AlignX = Alignment.RIGHT;
            combatData.AlignY = Alignment.BOTTOM;
            combatData.OffsetAlignX = Alignment.RIGHT;
            combatData.OffsetAlignY = Alignment.BOTTOM;
            combatData.Parent = WidgetBase;

            uiCStats = new RTSUICombatStats(wr, _uicCS);
            uiCStats.WidgetBase.AlignY = Alignment.BOTTOM;
            uiCStats.WidgetBase.Anchor = new Point(1000000, 1000000);

            uiCSHover = new RTSUIHoverPanel(combatData, uiCStats.WidgetBase);
        }
예제 #4
0
 public void Build(RTSRenderer renderer, string rootPath, string model, string[] tex)
 {
     using(var sModel = File.OpenRead(Path.Combine(rootPath, model))) {
         Texture2D tAnim = AnimationFromBitmap(renderer, Path.Combine(rootPath, tex[0]));
         View = new RTSUnitModel(renderer, sModel, tAnim);
     }
     View.ModelTexture = renderer.LoadTexture2D(Path.Combine(rootPath, tex[1]));
     View.ColorCodeTexture = renderer.LoadTexture2D(Path.Combine(rootPath, tex[2]));
 }
예제 #5
0
        public void Build(RTSRenderer renderer, string image, Vector3 radii, Vector3 heights)
        {
            fx = renderer.CreateEffect();

            fx.FogEnabled         = false;
            fx.VertexColorEnabled = false;
            fx.LightingEnabled    = false;
            fx.TextureEnabled     = true;

            if (image == null || !File.Exists(image))
            {
                Texture = renderer.CreateTexture2D(3, 3, SurfaceFormat.Color, false);
                Texture.SetData(new Color[] {
                    Color.White, Color.Transparent, Color.White,
                    Color.Transparent, Color.Transparent, Color.Transparent,
                    Color.White, Color.Transparent, Color.White
                });
            }
            else
            {
                Texture = renderer.LoadTexture2D(image);
            }
            fx.Texture = Texture;

            VertexPositionTexture[] verts = new VertexPositionTexture[] {
                new VertexPositionTexture(new Vector3(-1, 1f, -1), new Vector2(0, 0)),
                new VertexPositionTexture(new Vector3(1, 1f, -1), new Vector2(0.5f, 0)),
                new VertexPositionTexture(new Vector3(-1, 1f, 1), new Vector2(0, 0.5f)),
                new VertexPositionTexture(new Vector3(1, 1f, 1), new Vector2(0.5f, 0.5f)),

                new VertexPositionTexture(new Vector3(-1, 1f, -1), new Vector2(0.5f, 0)),
                new VertexPositionTexture(new Vector3(1, 1f, -1), new Vector2(1f, 0)),
                new VertexPositionTexture(new Vector3(-1, 1f, 1), new Vector2(0.5f, 0.5f)),
                new VertexPositionTexture(new Vector3(1, 1f, 1), new Vector2(1f, 0.5f)),

                new VertexPositionTexture(new Vector3(-1, 1f, -1), new Vector2(0, 0.5f)),
                new VertexPositionTexture(new Vector3(1, 1f, -1), new Vector2(0.5f, 0.5f)),
                new VertexPositionTexture(new Vector3(-1, 1f, 1), new Vector2(0, 1f)),
                new VertexPositionTexture(new Vector3(1, 1f, 1), new Vector2(0.5f, 1f))
            };
            int[] inds = new int[] {
                0, 1, 2, 2, 1, 3,
                4, 5, 6, 6, 5, 7,
                8, 9, 10, 10, 9, 11
            };
            for (int i = 0; i < 4; i++)
            {
                verts[i].Position     *= new Vector3(radii.X, heights.X, radii.X);
                verts[i + 4].Position *= new Vector3(radii.Y, heights.Y, radii.Y);
                verts[i + 8].Position *= new Vector3(radii.Z, heights.Z, radii.Z);
            }

            vb = renderer.CreateVertexBuffer(VertexPositionTexture.VertexDeclaration, verts.Length, BufferUsage.WriteOnly);
            vb.SetData(verts);
            ib = renderer.CreateIndexBuffer(IndexElementSize.ThirtyTwoBits, inds.Length, BufferUsage.WriteOnly);
            ib.SetData(inds);
        }
예제 #6
0
        public void Build(RTSRenderer renderer, string image, Vector3 radii, Vector3 heights)
        {
            fx = renderer.CreateEffect();

            fx.FogEnabled = false;
            fx.VertexColorEnabled = false;
            fx.LightingEnabled = false;
            fx.TextureEnabled = true;

            if(image == null || !File.Exists(image)) {
                Texture = renderer.CreateTexture2D(3, 3, SurfaceFormat.Color, false);
                Texture.SetData(new Color[] {
                    Color.White, Color.Transparent, Color.White,
                    Color.Transparent, Color.Transparent, Color.Transparent,
                    Color.White, Color.Transparent, Color.White
                });
            }
            else {
                Texture = renderer.LoadTexture2D(image);
            }
            fx.Texture = Texture;

            VertexPositionTexture[] verts = new VertexPositionTexture[] {
                new VertexPositionTexture(new Vector3(-1, 1f, -1), new Vector2(0, 0)),
                new VertexPositionTexture(new Vector3(1, 1f, -1), new Vector2(0.5f, 0)),
                new VertexPositionTexture(new Vector3(-1, 1f, 1), new Vector2(0, 0.5f)),
                new VertexPositionTexture(new Vector3(1, 1f, 1), new Vector2(0.5f, 0.5f)),

                new VertexPositionTexture(new Vector3(-1, 1f, -1), new Vector2(0.5f, 0)),
                new VertexPositionTexture(new Vector3(1, 1f, -1), new Vector2(1f, 0)),
                new VertexPositionTexture(new Vector3(-1, 1f, 1), new Vector2(0.5f, 0.5f)),
                new VertexPositionTexture(new Vector3(1, 1f, 1), new Vector2(1f, 0.5f)),

                new VertexPositionTexture(new Vector3(-1, 1f, -1), new Vector2(0, 0.5f)),
                new VertexPositionTexture(new Vector3(1, 1f, -1), new Vector2(0.5f, 0.5f)),
                new VertexPositionTexture(new Vector3(-1, 1f, 1), new Vector2(0, 1f)),
                new VertexPositionTexture(new Vector3(1, 1f, 1), new Vector2(0.5f, 1f))
            };
            int[] inds = new int[] {
                0, 1, 2, 2, 1, 3,
                4, 5, 6, 6, 5, 7,
                8, 9, 10, 10, 9, 11
            };
            for(int i = 0; i < 4; i++) {
                verts[i].Position *= new Vector3(radii.X, heights.X, radii.X);
                verts[i + 4].Position *= new Vector3(radii.Y, heights.Y, radii.Y);
                verts[i + 8].Position *= new Vector3(radii.Z, heights.Z, radii.Z);
            }

            vb = renderer.CreateVertexBuffer(VertexPositionTexture.VertexDeclaration, verts.Length, BufferUsage.WriteOnly);
            vb.SetData(verts);
            ib = renderer.CreateIndexBuffer(IndexElementSize.ThirtyTwoBits, inds.Length, BufferUsage.WriteOnly);
            ib.SetData(inds);
        }
예제 #7
0
        public RTSUIMinimap(RTSRenderer renderer, WidgetRenderer wr, Texture2D tPhys, Texture2D tImp, UICMinimap uic)
        {
            tPhysical = tPhys;
            tImpact = tImp;

            WidgetBase = new RectWidget(wr);
            WidgetBase.Width = uic.ButtonWidth + uic.MapSize + uic.Buffer * 2;
            WidgetBase.Height = uic.MapSize + uic.Buffer * 2;
            WidgetBase.Color = uic.BaseColor;

            int bh = uic.MapSize / 2;
            btnPhysical = new RectButton(wr, uic.ButtonWidth, bh,
                uic.PhysicalInactiveColor,
                uic.PhysicalActiveColor,
                renderer.LoadTexture2D(uic.PhysicalTexture)
                );
            btnImpact = new RectButton(wr, uic.ButtonWidth, bh,
                uic.ImpactInactiveColor,
                uic.ImpactActiveColor,
                renderer.LoadTexture2D(uic.ImpactTexture)
                );

            btnPhysical.Offset = new Point(uic.Buffer, uic.Buffer);
            btnPhysical.Parent = WidgetBase;
            btnImpact.OffsetAlignY = Alignment.BOTTOM;
            btnImpact.Parent = btnPhysical;

            MapRect = new RectWidget(wr, tPhysical);
            MapRect.Width = uic.MapSize;
            MapRect.Height = uic.MapSize;
            MapRect.Color = Color.White;
            MapRect.OffsetAlignX = Alignment.RIGHT;
            MapRect.Parent = btnPhysical;

            btnPhysical.OnButtonPress += (b, p) => {
                MapRect.Texture = tPhysical;
            };
            btnImpact.OnButtonPress += (b, p) => {
                MapRect.Texture = tImpact;
            };
        }
예제 #8
0
 private void LoadLightningShader(RTSRenderer renderer, string fLMap, int splits)
 {
     tLightningMap = renderer.LoadTexture2D(fLMap);
     fxParticle.LightningSplits = splits;
 }
예제 #9
0
 private void LoadFireShader(RTSRenderer renderer, string fNoise, string fColor, string fAlpha)
 {
     tFireColor = renderer.LoadTexture2D(fColor);
     tFireNoise = renderer.LoadTexture2D(fNoise);
     tFireAlpha = renderer.LoadTexture2D(fAlpha);
 }
예제 #10
0
 private void LoadBulletTexture(RTSRenderer renderer, string f)
 {
     tBullet = renderer.LoadTexture2D(f);
 }
예제 #11
0
 private void BuildSelectionPanel(RTSRenderer renderer)
 {
     SelectionPanel = new RTSUISelectionPanel(wrMain, uic.SelectionRows, uic.SelectionColumns, uic.SelectionIconSize, uic.SelectionIconBuffer);
     SelectionPanel.BackPanel.Texture = renderer.LoadTexture2D(uic.SelectionTexture);
     SelectionPanel.IconLibrary = renderer.IconLibrary;
     SelectionPanel.BackPanel.AlignX = Alignment.LEFT;
     SelectionPanel.BackPanel.AlignY = Alignment.BOTTOM;
     SelectionPanel.BackPanel.OffsetAlignX = Alignment.RIGHT;
     SelectionPanel.BackPanel.OffsetAlignY = Alignment.BOTTOM;
     SelectionPanel.BackPanel.Color = UserConfig.MainScheme.WidgetBase;
     SelectionPanel.BackPanel.Offset = new Point(0, 0);
     SelectionPanel.BackPanel.Parent = BBPanel.BackPanel;
 }
예제 #12
0
 public void Build(RTSRenderer renderer, string fxFile, string fLightningMap, int numSplits)
 {
     Build(renderer, renderer.LoadEffect(fxFile), renderer.LoadTexture2D(fLightningMap), numSplits);
 }
예제 #13
0
 public void Build(RTSRenderer renderer, string fxFile, string fLightningMap, int numSplits)
 {
     Build(renderer, renderer.LoadEffect(fxFile), renderer.LoadTexture2D(fLightningMap), numSplits);
 }
예제 #14
0
 private void BuildBBPanel(RTSRenderer renderer)
 {
     BBPanel = new RTSUIBuildingButtonPanel(wrMain, uic.BBRows, uic.BBColumns, uic.BBIconSize, uic.BBIconBuffer);
     BBPanel.BackPanel.Texture = renderer.LoadTexture2D(uic.BBTexture);
     BBPanel.BackPanel.Parent = rectBounds;
     BBPanel.BackPanel.AlignY = Alignment.BOTTOM;
     BBPanel.BackPanel.OffsetAlignY = Alignment.BOTTOM;
     BBPanel.BackPanel.Offset = new Point(0, 0);
     BBPanel.IconLibrary = renderer.IconLibrary;
     BBPanel.BackPanel.Color = UserConfig.MainScheme.WidgetBase;
 }
예제 #15
0
 private void LoadLightningShader(RTSRenderer renderer, string fLMap, int splits)
 {
     tLightningMap = renderer.LoadTexture2D(fLMap);
     fxParticle.LightningSplits = splits;
 }
예제 #16
0
 private void LoadFireShader(RTSRenderer renderer, string fNoise, string fColor, string fAlpha)
 {
     tFireColor = renderer.LoadTexture2D(fColor);
     tFireNoise = renderer.LoadTexture2D(fNoise);
     tFireAlpha = renderer.LoadTexture2D(fAlpha);
 }
예제 #17
0
 private void LoadBulletTexture(RTSRenderer renderer, string f)
 {
     tBullet = renderer.LoadTexture2D(f);
 }
예제 #18
0
        public void Load(RTSRenderer renderer, ParticleOptions o)
        {
            // Create Bullet System
            plBullets = new ParticleList<BulletParticle, VertexBulletInstance>(renderer, o.BulletMaxCount, ParticleType.Bullet);
            using(var fs = File.OpenRead(o.BulletModel)) {
                LoadBulletModel(renderer, fs, ParsingFlags.ConversionOpenGL);
            }
            LoadBulletTexture(renderer, o.BulletTexture);

            // Create Fire System
            plFires = new ParticleList<FireParticle, VertexFireInstance>(renderer, o.FireMaxCount, ParticleType.Fire);
            BuildFireModel(renderer, o.FireDetail);
            LoadFireShader(renderer, o.FireNoise, o.FireColor, o.FireAlpha);

            // Create Lightning System
            plBolts = new ParticleList<LightningParticle, VertexLightningInstance>(renderer, o.LightningMaxCount, ParticleType.Lightning);
            BuildLightningModel(renderer);
            LoadLightningShader(renderer, o.LightningImage, o.LightningNumTypes);

            // Create Alert System
            plAlerts = new ParticleList<AlertParticle, VertexAlertInstance>(renderer, o.AlertMaxCount, ParticleType.Alert);
            BuildAlertModel(renderer);
            tAlert = renderer.LoadTexture2D(o.AlertImage);

            // Create Blood System
            plBloods = new ParticleList<BloodParticle, VertexAlertInstance>(renderer, o.BloodMaxCount, ParticleType.Blood);
            BuildBloodModel(renderer);
            tBlood = renderer.LoadTexture2D(o.BloodImage);
        }