Beispiel #1
0
        public static void Init(ZApplication app)
        {
            defaultMaterial = new Material(null);
            GUIMaterial = new Material(null);
            GUIMaterial.Lighting = false;            
            defaultTexture = new Texture(null);
            defaultFont = new Font(null);

            GL.MatrixMode(All.MODELVIEW);
          
            GL.Enable(All.DEPTH_TEST);           

            //Enable Light
            //Use default position
            GL.Enable(All.LIGHTING);
            GL.Enable(All.LIGHT0);

            //Use glColor to color materials. 
            //This eliminates the need to set ambient and diffuse separately.
            GL.Enable(All.COLOR_MATERIAL);
            GL.ColorMaterial(All.FRONT_AND_BACK, All.AMBIENT_AND_DIFFUSE);

            //glMaterialfv(GL_FRONT, GL_SPECULAR, Specular);
            //glMaterialf(GL_FRONT, GL_SHININESS, LowShininess);         

            // IMPORTANT: Otherwise light will arise with scaled vectors, e.g. with Scale=0.1 then it will be too bright
            // This is because gl scales the normals with glScale
            //GL.Enable(All.NORMALIZE);

            var shape = new UnitQuad();
            unitQuad = new Mesh(null) { Name = "UnitQuad" };            
            unitQuad.CreateVBO(shape);

            defaultMaterial.Apply(null);            
        }
Beispiel #2
0
 public IconSystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <DebugInfo> debugInfos, IList <IComponentContainer> containers, IconLibrary library)
     : base(debugInfos, containers)
 {
     this.Device  = device;
     this.Effect  = effectFactory.Construct <TextureEffect>();
     this.Library = library;
     this.Quad    = new UnitQuad(device);
 }
Beispiel #3
0
 public IconSystem(GraphicsDevice device, EffectFactory effectFactory, IComponentContainer <DebugInfo> components, IComponentContainer <Pose> poses, IconLibrary library)
 {
     this.Device     = device;
     this.Components = components;
     this.Poses      = poses;
     this.Effect     = effectFactory.Construct <TextureEffect>();
     this.Library    = library;
     this.Quad       = new UnitQuad(device);
 }
        public AdditiveParticleSystem(
            GraphicsDevice device,
            EffectFactory effectFactory,
            IComponentContainer <AdditiveEmitter> emitters)
        {
            this.Device = device;

            this.AdditiveParticlesEffect = effectFactory.Construct <AdditiveParticlesEffect>();
            this.Emitters = emitters;

            this.Particles = new List <ParticlePose>();
            this.Quad      = new UnitQuad(device);
        }
        public AveragedParticleSystem(
            GraphicsDevice device,
            EffectFactory effectFactory,
            IComponentContainer <AveragedEmitter> emitters)
        {
            this.Device = device;
            this.WeightedParticlesEffect = effectFactory.Construct <WeightedParticlesEffect>();
            this.AverageParticlesEffect  = effectFactory.Construct <AverageParticlesEffect>();
            this.Emitters = emitters;

            this.Particles = new List <ParticlePose>();

            this.FullScreenTriangle = new FullScreenTriangle();
            this.Quad = new UnitQuad(device);
        }