Beispiel #1
0
 public void GetInstanceData(RenderGroup RenderGroup)
 {
     Instance.Color = new Color(Color);
     Instance.Light = new Vector4(Node.Incident + Node.Emmision, 1);
     Instance.Texture = Texture;
     RenderGroup.AddInstance(Instance);
 }
Beispiel #2
0
        public void GetInstanceData(RenderGroup RenderGroup)
        {
            var cam = RenderGroup.Camera;
            int startx = (int)MathHelper.Clamp(cam.Position.X - cam.ViewSize.X / 2, 0, X);
            int endx = (int)MathHelper.Clamp(cam.Position.X + cam.ViewSize.X / 2 + 2, 0, X);
            int starty = (int)MathHelper.Clamp(cam.Position.Y - cam.ViewSize.Y / 2, 0, Y);
            int endy = (int)MathHelper.Clamp(cam.Position.Y + cam.ViewSize.Y / 2 + 2, 0, Y);

            for (int i1 = startx; i1 < endx; i1++)
                for (int i2 = starty; i2 < endy; i2++)
                {
                    var node = ForeGround[i1, i2];

                    if (node.Type.CanRender)
                    {
                        var testres = cam.Frustrum.Contains(node.CollisionBox);
                        if (testres == ContainmentType.Intersects || testres == ContainmentType.Contains)
                            RenderGroup.AddInstance(node);
                    }
                }
        }
Beispiel #3
0
        void Instanced.GetInstanceData(RenderGroup RenderGroup)
        {
            Instance.Color = new Color(Color);
            if (Environment.Node != null)
            {
                Instance.Light = new Vector4(Environment.Node.Incident + Environment.Node.Emmision, Opacity);
            }

            Instance.Texture = Frames.Active.Texture;
            RenderGroup.AddInstance(Instance);
        }
Beispiel #4
0
 public void GetInstanceData(InstanceData data, RenderGroup RenderGroup)
 {
     if (this.Opacity != 0 && OldNodeType != null && OldNodeType.CanRender)
     {
         data.Texture = OldNodeType.Texture;
         data.Color = new Color(OldNodeType.Color);
         data.Light.W = OldNodeType.Opacity;
         RenderGroup.AddInstance(data);
     }
 }
Beispiel #5
0
        public void GetInstanceData(RenderGroup RenderGroup)
        {
            Instance.Color = new Color(Type.Color);
            /*if (Emmision.X > 1 && Emmision.Y > 1 && Emmision.Z > 1)
                Instance.Light = Vector3.One; //Vector3.One * Type.Opacity;//
            else*/
            Instance.Light = new Vector4(Incident + Emmision, Type.Opacity);
            Instance.Texture = Type.Texture;
            Type.GetInstanceData(Instance, RenderGroup);
            RenderGroup.AddInstance(Instance);

            foreach (IDecal decal in Type.Decals)
            {
                decal.GetInstanceData(RenderGroup);
            }
        }
Beispiel #6
0
        protected override void Initialize()
        {
            IsMouseVisible = true;

            map = new Map (new Vector3(400, 200, 0));
            cam = new Camera();
            player = EntityFactory.GetPlayer();
            player.Postion = new Vector3(150, 200, 0);

            gameWorld = new World();
            gameWorld.AddEntity(player);
            gameWorld.Map = map;

            render = new Renderer();
            render.Groups.Add(
                new RenderGroup(400000, "atlas", map)
                );
            render.Groups.Add(
                entitygroup = new RenderGroup(200, "char1", player )
                );

            render.Groups.Add(
                itemgroup = new RenderGroup(2000, "char1") {TileCount = 32 }
                );

            //enemy.SetType(new NodeType { Texture = new Vector3(0, 2, 0) });

            GraphicsDevice.BlendState = BlendState.AlphaBlend;
            GraphicsDevice.DepthStencilState = DepthStencilState.None;

            map.Init();
            base.Initialize();
        }