Beispiel #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;
 }
Beispiel #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;
        }
Beispiel #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;
 }
Beispiel #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");
        }
Beispiel #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);
        }
Beispiel #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"];
        }
Beispiel #7
0
        public Camera1(PipeEngine engine)
        {
            this.engine = engine;

            ResetCamera();
        }
Beispiel #8
0
 public RenderContext(PipeEngine engine)
 {
     this.engine = engine;
 }
Beispiel #9
0
 public SingleTextureMaterial(PipeEngine engine, Effect eff)
     : base(engine, eff)
 {
 }
Beispiel #10
0
 public SingleTextureMaterial(PipeEngine engine, string effect_name)
     : base(engine,effect_name)
 {
 }
Beispiel #11
0
 /// <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("方向光必须设置方向");
 }
Beispiel #12
0
        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;
        }
Beispiel #13
0
 public Box(PipeEngine engine)
     : base(engine)
 {
     m_ctx = new RenderContext(engine);
 }
Beispiel #14
0
 public ModelEntity(PipeEngine engine)
     : base(engine)
 {
 }
Beispiel #15
0
 public Avatar(PipeEngine engine, string filename)
     : base(engine)
 {
     this.file_name = filename;
 }
Beispiel #16
0
 /// <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)
 {
 }
Beispiel #17
0
 public Sphere(PipeEngine engine)
     : base(engine)
 {
 }
Beispiel #18
0
 public UIEntity(PipeEngine engine, string texture_name, Vector2 pos)
     : this(engine, texture_name, pos, 0, Vector2.Zero, 0)
 {
 }
Beispiel #19
0
 public Controller(PipeEngine engine)
 {
     this.engine = engine;
 }
Beispiel #20
0
 /// <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)
 {
 }
Beispiel #21
0
 public Quad(PipeEngine engine)
     : base(engine)
 {
 }
Beispiel #22
0
 public Entity(PipeEngine engine)
     : base(engine)
 {
     IsVisible = true;
 }
Beispiel #23
0
 public Axis(PipeEngine engine)
     : base(engine)
 {
 }
Beispiel #24
0
 internal SceneManager(PipeEngine engine)
     : base(engine)
 {
     this.engine = engine;
 }