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; }
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; }
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; }
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"); }
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); }
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"]; }
public Camera1(PipeEngine engine) { this.engine = engine; ResetCamera(); }
public RenderContext(PipeEngine engine) { this.engine = engine; }
public SingleTextureMaterial(PipeEngine engine, Effect eff) : base(engine, eff) { }
public SingleTextureMaterial(PipeEngine engine, string effect_name) : base(engine,effect_name) { }
/// <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("方向光必须设置方向"); }
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; }
public Box(PipeEngine engine) : base(engine) { m_ctx = new RenderContext(engine); }
public ModelEntity(PipeEngine engine) : base(engine) { }
public Avatar(PipeEngine engine, string filename) : base(engine) { this.file_name = filename; }
/// <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) { }
public Sphere(PipeEngine engine) : base(engine) { }
public UIEntity(PipeEngine engine, string texture_name, Vector2 pos) : this(engine, texture_name, pos, 0, Vector2.Zero, 0) { }
public Controller(PipeEngine engine) { this.engine = engine; }
/// <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) { }
public Quad(PipeEngine engine) : base(engine) { }
public Entity(PipeEngine engine) : base(engine) { IsVisible = true; }
public Axis(PipeEngine engine) : base(engine) { }
internal SceneManager(PipeEngine engine) : base(engine) { this.engine = engine; }