예제 #1
0
파일: Billboard.cs 프로젝트: lvarvel/aura
 public Billboard(Texture image, Material color, Vector2 dimention, BillboardLockType lockType = BillboardLockType.Spherical)
 {
     Image = image;
     Color = color;
     Dimention = dimention;
     LockType = lockType;
 }
예제 #2
0
파일: Billboard.cs 프로젝트: lvarvel/aura
 public Billboard(Texture image, BillboardLockType lockType = BillboardLockType.Spherical, float scalefactor = 1.0f)
 {
     Image = image;
     Color = null;
     Dimention = new Vector2(1,1);
     LockType = lockType;
     scale = scalefactor;
 }
예제 #3
0
파일: IDrawable.cs 프로젝트: lvarvel/aura
 public DrawArgs(Vector3 position, Vector3 vector, Material material, Vector2 scale, float rotation = 0)
 {
     Position = position;
     LightingEnabled = true;
     Scale = scale;
     Vector = vector;
     _Material = material;
     Color = null;
     Rotation = rotation;
 }
예제 #4
0
파일: IDrawable.cs 프로젝트: lvarvel/aura
        public DrawArgs(Vector3 position, Color4 color, Vector2 scale, float rotation = 0)
        {
            Position = position;
            Color = color;
            LightingEnabled = false;
            Scale = scale;
            Rotation = rotation;

            _Material = null;
            Vector = null;
        }
예제 #5
0
파일: Light.cs 프로젝트: lvarvel/aura
 public Light(Material material, bool directional = false)
 {
     directionalEnabled = directional;
     lightMaterial = material;
     AssignIndex();
 }
예제 #6
0
파일: RawMesh.cs 프로젝트: lvarvel/aura
 public RawMesh()
 {
     Polygons = new List<Polygon>();
     Material = new Material();
 }
예제 #7
0
파일: IDrawable.cs 프로젝트: lvarvel/aura
 public void Dispose()
 {
     Position = null;
     Color = null;
     Vector = null;
     _Material = null;
 }
예제 #8
0
파일: Engine.cs 프로젝트: lvarvel/aura
        /// <summary>
        /// Initializes the engine
        /// </summary>
        internal void Prime()
        {
            #region Initialize SDL
            if (Sdl.SDL_Init(Sdl.SDL_INIT_VIDEO) != 0) throw new AuraEngineException("SDL failure: " + Sdl.SDL_GetError());
            Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_DOUBLEBUFFER, 1);

            screen = Sdl.SDL_SetVideoMode(x, y, 16, Sdl.SDL_OPENGL | Sdl.SDL_DOUBLEBUF);
            if (screen == IntPtr.Zero) throw new AuraEngineException("Unable to set video mode: " + Sdl.SDL_GetError());
            Sdl.SDL_WM_SetCaption(windowName,windowName);
            #endregion

            #region Initialize openGL
            Gl.glViewport(0, 0, x, y);
            Gl.glClearColor(0.8f, 0.8f, 0.8f, 1.0f);
            Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);
            Sdl.SDL_GL_SetAttribute(Sdl.SDL_GL_DEPTH_SIZE, 16);
            Gl.glEnableClientState(Gl.GL_VERTEX_ARRAY);
            Gl.glEnableClientState(Gl.GL_NORMAL_ARRAY);
            //Gl.glEnableClientState(Gl.GL_TEXTURE_COORD_ARRAY);
            Gl.glEnable(Gl.GL_DEPTH_TEST);
            Gl.glShadeModel(Gl.GL_SMOOTH);
            Gl.glEnable(Gl.GL_TEXTURE_2D);
            Gl.glAlphaFunc(Gl.GL_GREATER, .016f);
            Gl.glEnable(Gl.GL_ALPHA_TEST);
            #endregion

            #region Initialize ilut
            Il.ilInit();
            Ilu.iluInit();
            Ilut.ilutInit();
            Ilu.iluImageParameter(Ilu.ILU_PLACEMENT, Ilu.ILU_UPPER_LEFT);
            Ilut.ilutRenderer(Ilut.ILUT_OPENGL);
            #endregion

            CameraManager.SetCamera("Default", new Camera(new Vector3(10, 10, 10), new Vector3(0, 0, 0)));

            #region Set up explosion
            mrExplody = new Explosion(new Vector3(0, 0, 0), 5.0f, 5.0f);
            #endregion

            #region DEBUG
            //DEBUG: LIGHTING (BROKEN)
            LightManager.LightingEnabled = true;
            Texture t = TextureImporter.Instance.ImportContent("Data/grass.jpg");
            Texture leaf = TextureImporter.Instance.ImportContent("Data/leaf.png");
            Material lmaterial = new Material(new Color4(.1f, .1f, .1f, .1f), new Color4(.1f,0,0), new Color4(.1f,.1f,.1f), .1f);
            Light l = new Light(lmaterial, false);
            l.position = new Vector3(0,15,5);
            LightManager.Lights.Add(l);
            m = new Model(ObjImporter.Instance.ImportContent("Data/plane.obj"), t);
            m.scale = 2f;

            Billboard particleBillboard = new Billboard(TextureImporter.Instance.ImportContent("Data/particle.png"), BillboardLockType.Spherical, 0.2f);
            particleBillboard.Dimention = new Vector2(.1f, .1f);

            /* Create the particle systems for the core of the explosion */

            List<ParticleSystem> fireParticleSystems = new List<ParticleSystem>();
            Flames = new ParticleSystem(
                10f,  // 5... um.... units.
                particleBillboard,   //Using particle.png as the texture
                .5f, //scale = 1/2
                new Color4InterpolationHandler(FunctionAssets.LinearInterpolation),  //Linear Interpolation for color
                new ColorRange(new Color4(1, 1, 0, 1), new Color4(1, 0, 0, .3f)),   // Yellow to Red
                new FloatInterpolationHandler(FunctionAssets.LinearInterpolation),  //Linear Interpolation for speed
                new Range(1.0f, 0.0f));
            Flames.Count = 500;
            fireParticleSystems.Add(Flames);         //Speed from 1.0 to 0.0

            Fire = new EmitterBase(1, //75 umm... MS?
                fireParticleSystems, //This should be self-explanatory
                DirectionalClamp.ZeroClamp, //Nothing in the Negative Y
                Util.r.Next(), //Seed the RNG
                false);  //Repeat!

            Tree.flames = Flames;

            //Debug: Particles

            b = new Billboard(leaf, BillboardLockType.Spherical, 0.2f);
            b.Dimention = new Vector2(.1f, .1f);
            PointVisualization v = new PointVisualization();

            ps = new ParticleSystem(300, b, 0.15f, FunctionAssets.LinearInterpolation, new ColorRange(new Color4(1, 1, 1)), FunctionAssets.LinearInterpolation, new Range(.1f));
            ps.Count = 5;
            for (int i = 0; i < 20; ++i)
            {
                Vector3 rand = new Vector3((float)(Util.r.NextDouble() * Util.r.NextSign() * 8), 0, (float)(Util.r.NextDouble() * Util.r.NextSign() * 8));
                tree = new Tree(rand, 3.0f, 1.5f, .3f, 3, 3, b);
                Forest.Add(tree);
            }
            ParticleSystem[] tps = { ps };
            //e = new EmitterBase(1, tps, DirectionalClamp.ZeroClamp, null, true);
            #endregion
        }