Ejemplo n.º 1
0
 public static Texture2D LoadTexture(PipeEngine engine, string asset_or_filename)
 {
     Texture2D texture;
     string path = System.IO.Path.Combine(engine.Content.RootDirectory, asset_or_filename);
     path = path.Replace(".xnb", "");
     if(System.IO.File.Exists(path + ".xnb"))
     {
         texture = engine.Content.Load<Texture2D>(path);
     }
     else
     {
         path = System.IO.Path.Combine(Microsoft.Xna.Framework.Storage.StorageContainer.TitleLocation, "Content\\" + asset_or_filename);
         if (System.IO.File.Exists(path + ".xnb"))
         {
             texture = engine.Content.Load<Texture2D>(path);
         }
         else
         {
             if (System.IO.File.Exists(path))
                 texture = Texture2D.FromFile(engine.GraphicsDevice, path);
             else
                 texture = Texture2D.FromFile(engine.GraphicsDevice, asset_or_filename);
         }
     }
     if (texture != null)
         texture.Name = asset_or_filename;
     return texture;
 }
Ejemplo n.º 2
0
        public BasicMaterial(PipeEngine engine)
        {
            this.engine = engine;

            basic_effect = new BasicEffect(engine.GraphicsDevice, null);
            basic_effect.CurrentTechnique = basic_effect.Techniques[0];
            current_technique_name = basic_effect.CurrentTechnique.Name;
        }
Ejemplo n.º 3
0
 public UIEntity(PipeEngine engine, string texture_name, Vector2 position, float rotation, Vector2 origin, float layer_depth)
     : base(engine)
 {
     this.rotation = rotation;
     this.origin = origin;
     this.layer_depth = layer_depth;
     this.position = position;
     this.z_order = 0;
 }
Ejemplo n.º 4
0
        public ConsoleComponent(PipeEngine game, float interline, Color defaultTextColor)
            : base(game)
        {
            this.interline = interline;
            this.textColor = defaultTextColor;

            this.messages = new List<string>();

            spriteBatch = new SpriteBatch(game.GraphicsDevice);
            consoleFont = game.Content.Load<SpriteFont>("Fonts\\default_font");
        }
Ejemplo n.º 5
0
        public CameraBase(PipeEngine engine)
        {
            this.engine = engine;

            position = Vector3.Zero;
            fov_x = 45.0f;
            near_plane = 0.1f;
            far_plane = 1000.0f;

            view_matrix = Matrix.Identity;
            projection_matrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.ToRadians(fov_x), engine.GraphicsDevice.Viewport.AspectRatio, near_plane, far_plane);
        }
Ejemplo n.º 6
0
        public BaseMaterial(PipeEngine engine, Effect eff)
        {
            this.engine = engine;
            if(eff == null)
            {
                throw new ArgumentException("effect");
            }

            this.effect = eff.Clone(engine.GraphicsDevice);
            this.effect.CurrentTechnique = this.effect.Techniques[0];

            g_world = this.effect.Parameters["gWorld"];
            g_view = this.effect.Parameters["gView"];
        }
Ejemplo n.º 7
0
        public Camera1(PipeEngine engine)
        {
            this.engine = engine;

            ResetCamera();
        }
Ejemplo n.º 8
0
 public RenderContext(PipeEngine engine)
 {
     this.engine = engine;
 }
Ejemplo n.º 9
0
 public SingleTextureMaterial(PipeEngine engine, Effect eff)
     : base(engine, eff)
 {
 }
Ejemplo n.º 10
0
 public SingleTextureMaterial(PipeEngine engine, string effect_name)
     : base(engine,effect_name)
 {
 }
Ejemplo n.º 11
0
Archivo: Light.cs Proyecto: konlil/pipe
 /// <summary>
 /// 定义一个方向光
 /// </summary>
 /// <param name="engine"></param>
 /// <param name="color"></param>
 /// <param name="direction"></param>
 public Light(PipeEngine engine, Vector3 color, Vector3 direction)
     : this(engine, LightType.Directional, color, -direction, direction, 0, 0, 0, 0)
 {
     if (direction == Vector3.Zero)
         throw new System.ArgumentException("方向光必须设置方向");
 }
Ejemplo n.º 12
0
Archivo: Light.cs Proyecto: konlil/pipe
        public Light(PipeEngine engine, LightType lt, Vector3 color, Vector3 position, Vector3 direction, float range, float fallof, float theta, float phi)
        {
            this.engine = engine;

            this.light_type = lt;

            this.color = color;
            this.position = position;
            this.enabled = true;
            this.spot_prop.X = range;
            this.spot_prop.Y = fallof;
            this.spot_prop.Z = theta;
            this.spot_prop.W = phi;
        }
Ejemplo n.º 13
0
Archivo: Box.cs Proyecto: konlil/pipe
 public Box(PipeEngine engine)
     : base(engine)
 {
     m_ctx = new RenderContext(engine);
 }
Ejemplo n.º 14
0
 public ModelEntity(PipeEngine engine)
     : base(engine)
 {
 }
Ejemplo n.º 15
0
 public Avatar(PipeEngine engine, string filename)
     : base(engine)
 {
     this.file_name = filename;
 }
Ejemplo n.º 16
0
Archivo: Light.cs Proyecto: konlil/pipe
 /// <summary>
 /// 定义一个点光源
 /// </summary>
 /// <param name="engine"></param>
 /// <param name="color"></param>
 /// <param name="position"></param>
 /// <param name="range"></param>
 /// <param name="fallof"></param>
 public Light(PipeEngine engine, Vector3 color, Vector3 position, float range, float fallof)
     : this(engine, LightType.Point, color, position, Vector3.Zero, range, fallof, 0, 0)
 {
 }
Ejemplo n.º 17
0
 public Sphere(PipeEngine engine)
     : base(engine)
 {
 }
Ejemplo n.º 18
0
 public UIEntity(PipeEngine engine, string texture_name, Vector2 pos)
     : this(engine, texture_name, pos, 0, Vector2.Zero, 0)
 {
 }
Ejemplo n.º 19
0
 public Controller(PipeEngine engine)
 {
     this.engine = engine;
 }
Ejemplo n.º 20
0
Archivo: Light.cs Proyecto: konlil/pipe
 /// <summary>
 /// 定义一个聚光灯
 /// </summary>
 /// <param name="engine"></param>
 /// <param name="color"></param>
 /// <param name="position"></param>
 /// <param name="direction"></param>
 /// <param name="range"></param>
 /// <param name="fallof"></param>
 /// <param name="theta"></param>
 /// <param name="phi"></param>
 public Light(PipeEngine engine, Vector3 color, Vector3 position, Vector3 direction, float range, float fallof, float theta, float phi)
     : this(engine, LightType.Spot, color, position, direction, range, fallof, theta, phi)
 {
 }
Ejemplo n.º 21
0
Archivo: Quad.cs Proyecto: konlil/pipe
 public Quad(PipeEngine engine)
     : base(engine)
 {
 }
Ejemplo n.º 22
0
 public Entity(PipeEngine engine)
     : base(engine)
 {
     IsVisible = true;
 }
Ejemplo n.º 23
0
Archivo: Axis.cs Proyecto: konlil/pipe
 public Axis(PipeEngine engine)
     : base(engine)
 {
 }
Ejemplo n.º 24
0
 internal SceneManager(PipeEngine engine)
     : base(engine)
 {
     this.engine = engine;
 }