public XMaterial(ref XMain X, Texture2D Texture, bool EnableTextureMapping, Texture2D NormalMap, bool EnableNormalMapping, Vector4?DiffuseColor, bool AlphaBlendable, float Specularity) { if (Texture != null) { texture = Texture; } if (NormalMap != null) { normalmap = NormalMap; } if (DiffuseColor != null) { diffuse = DiffuseColor; } else { diffuse = new Vector4(1f, 1f, 1f, 1); } VertexWinding = CullMode.CullCounterClockwiseFace; this.AlphaBlendable = AlphaBlendable; this.EnableTexureMapping = EnableTextureMapping; this.EnableNormalMapping = EnableNormalMapping; this.Specularity = Specularity; }
public XGamePad(ref XMain X, int GamepadNumber) : base(ref X) { DrawOrder = 0; this.GamepadNumber = GamepadNumber; if (GamepadNumber == 1) { index = PlayerIndex.One; } else if (GamepadNumber == 2) { index = PlayerIndex.Two; } else if (GamepadNumber == 3) { index = PlayerIndex.Three; } else if (GamepadNumber == 4) { index = PlayerIndex.Four; } GetState(); idleTime = new XTimer(ref X); vibrationTimer = new XTimer(ref X); }
public XMaterial(ref XMain X, string Texture, bool EnableTextureMapping, string NormalMap, bool EnableNormalMapping, Vector4?DiffuseColor, bool AlphaBlendable, float Specularity) { if (!string.IsNullOrEmpty(Texture)) { texture = X.Content.Load <Texture2D>(Texture); } if (!string.IsNullOrEmpty(NormalMap)) { normalmap = X.Content.Load <Texture2D>(NormalMap); } if (DiffuseColor != null) { diffuse = DiffuseColor; } else { diffuse = new Vector4(1f, 1f, 1f, 1); } VertexWinding = CullMode.CullCounterClockwiseFace; this.AlphaBlendable = AlphaBlendable; this.EnableTexureMapping = EnableTextureMapping; this.EnableNormalMapping = EnableNormalMapping; this.Specularity = Specularity; }
public XHingeJoint(ref XMain X, XActor actor1, XActor actor2, Vector3 HingeAxis, Vector3 Offset, float Width, float ForwardMax, float BackWardMax, float Sideways, float Damping) : base(ref X) { hinge = new HingeJoint(); hinge.Initialise(actor1.PhysicsObject.PhysicsBody, actor2.PhysicsObject.PhysicsBody, HingeAxis, Offset, Width / 2, ForwardMax, BackWardMax, Sideways, Damping); hinge.EnableController(); hinge.EnableHinge(); }
public XTreeSystem(ref XMain X, string TreeMapFile, XHeightMap heightMap) : base(ref X) { treeMapFile = TreeMapFile; this.heightMap = heightMap; treeMap = new List <Vector3>(); trees = new List <XTree>(); }
public XModel(ref XMain X, string Filename) : base(ref X) { this.X = X; SASData = new SASContainer(ref X); this.Filename = Filename; Giftextures = new Dictionary <int, XGifTexture>(); Count++; Number = Count; }
public XComponent(ref XMain X) { this.componentID = X.Tools.GeneratorNewID(); this.X = X; X.Components.Add(this); this.Name = this.ToString().Replace("XEngine.", "") + this.componentID.ToString(); //sort X.Components list according to Draworder X.Components.Sort(); }
public XTriggerVolume(ref XMain X, XPhysicsObject obj, bool Continuous, Vector3 translation, Quaternion rotation, Vector3 scale) : base(ref X) { this.obj = obj; continuous = Continuous; triggered = false; this.translation = translation; this.rotation = rotation; this.scale = scale; }
/// <summary> /// Constructs a new particle emitter object. /// </summary> public XParticleEmitter(ref XMain X, XParticleSystem particleSystem, float particlesPerSecond, Vector3 initialPosition) : base(ref X) { this.particleSystem = particleSystem; timeBetweenParticles = 1.0f / particlesPerSecond; previousPosition = initialPosition; }
public XAnimatedActor(ref XMain X, XModel model, Vector3 Position, Vector3 Velocity, float Mass) : base(ref X, model, Position, Velocity, Mass) { if (model != null) { model.Parent = this; } }
public XSkyBox(ref XMain X, string SkyCubeMap) : base(ref X) { DrawOrder = 19; Filenames = new List <string>(); if (!string.IsNullOrEmpty(SkyCubeMap)) { Filenames.Add(SkyCubeMap); } }
public XAnimatedActor(ref XMain X, XPhysicsObject Object, XModel model, Vector3 ModelScale, Vector3 Velocity, float Mass) : base(ref X, Object, model, ModelScale, Velocity, Mass) { if (model != null) { model.Parent = this; } }
public XWater(ref XMain X, Vector2 pointOne, Vector2 size, float height) : base(ref X) { DrawOrder = 22; PointOne = pointOne; PointTwo = Vector2.Add(pointOne, size); this.Size = size; this.height = height; reflectionCamera = new XCamera(ref X, 1, 100); }
public XDynamicSky(ref XMain X, XEnvironmentParameters Parameters) : base(ref X) { if (Parameters != null) { this.Params = Parameters; } RealTime = false; Theta = 4.0f; Phi = 0.0f; }
public XWater(ref XMain X) : base(ref X) { DrawOrder = 22; height = 4; Size = new Vector2(128 * 2, 128 * 2); PointOne = new Vector2(-128, -128); PointTwo = Vector2.Add(PointOne, Size); reflectionCamera = new XCamera(ref X, 1, 100); }
public XWaterFast(ref XMain X, string EnvironmentMap) : base(ref X) { myWidth = 256; myHeight = 256; myPosition = new Vector3(0, 0, 0); myScale = new Vector3(10, 1, 10); //Vector3.One; myRotation = new Quaternion(0, 0, 0, 1); EnvAsset = EnvironmentMap; }
public Matrix GenerateProjection(ref XMain X, float FoV, float AspectRatio, ProjectionTypes type, float nearplane, float farplane) { if (type == ProjectionTypes.Perspective) { return(Matrix.CreatePerspectiveFieldOfView(FoV, AspectRatio, nearplane, farplane)); } else if (type == ProjectionTypes.Orthographic) { return(Matrix.CreateOrthographic(100, 100, nearplane, farplane)); } return(Matrix.Identity); }
public XCamera(ref XMain X, float nearplane, float farplane) : base(ref X) { ProjectionType = ProjectionTypes.Perspective; RenderType = RenderTypes.Normal; NearPlane = nearplane; FarPlane = farplane; FOV = MathHelper.PiOver4; GenerateProjection(ref X, this.FOV, this.ProjectionType, NearPlane, FarPlane); Base = this; DrawOrder = 50000; }
public XHeightMap(ref XMain X, string HeightMap, XEnvironmentParameters Params, string RTexture, string GTexture, string BTexture, string TextureMap) : base(ref X) { if (Params != null) { this.Params = Params; } HeightMapFile = HeightMap; TextureMapFile = TextureMap; RTextureFile = RTexture; GTextureFile = GTexture; BTextureFile = BTexture; DrawOrder = 21; }
public XRenderer(XMain X) : base(ref X) { DebugNoDraw = new List <XComponent>(); DebugNoDraw.Add(X.Debug); DebugNoDraw.Add(X.DebugDrawer); DebugNoDraw.Add(X.Console); DebugNoDraw.Add(X.FrameRate); //The menumanager is also added to this list elsewhere in the code, no access from here //Add particle systems to the DebugNoDrawTypes list DebugNoDrawTypes = new List <Type>(); DebugNoDrawTypes.Add(typeof(XParticleSystem)); DebugNoDrawTypes.Add(typeof(XDynamicSky)); }
public XTreeModel(ref XMain X, string XMLProfileFile, string BarkTextureFile, string LeafTextureFile) : base(ref X) { //generate some random values as default for a new TreeModel Random rand = new Random(); Seed = rand.Next(); RadialSegments = rand.Next(8, 12); AddLeaves = true; CuttoffLevel = rand.Next(0, 2); this.Profile = XMLProfileFile; this.LeafTexture = LeafTextureFile; this.BarkTexture = BarkTextureFile; }
public XTree(ref XMain X, XTreeModel model, Vector3 translation, Vector3 ModelScale) : base(ref X, new BoxObject(new Vector3(ModelScale.X, 10, ModelScale.Z), Matrix.Identity, translation), null, ModelScale, Vector3.Zero, 10000) { this.tree = model; this.Immovable = true; this.renderLeaves = true; // Enable/disable leaf sorting if (tree != null) { if (tree.Leaves != null) { tree.Leaves.SortingEnabled = false; } } }
/// <summary> /// Creates a new instance of QuaternionCamera with a position at the origin /// using a perspective projection with the specified projection parameters /// </summary> /// <param name="position">The position of the camera's eye point</param> /// <param name="orientation">The orientation of the camera</param> /// <param name="fov">The camera's perspective projection field of view</param> /// <param name="aspect">The camera's perspective projection aspect ratio</param> /// <param name="near">The near frustum plane distance of the camera's projection</param> /// <param name="far">The far frustum plane distance of the camera's projection</param> public XQuaternionCamera(ref XMain X, Vector3 position, Quaternion orientation, float fov, float aspect, float near, float far) : base(ref X, near, far) { Position = position; mOrientation = orientation; View = Matrix.Identity; mInverseViewMatrix = Matrix.Identity; Projection = Matrix.Identity; FOV = fov; AspectRatio = aspect; NearPlane = near; FarPlane = far; mBuildView = true; mBuildProjection = true; }
public XActor(ref XMain X, XPhysicsObject Object, XModel model, Vector3 ModelScale, Vector3 Velocity, float Mass) : base(ref X) { DrawOrder = 100; if (model != null) { this.model = model; model.Parent = this; this.modelNumber = model.Number; } this.PhysicsObject = Object; this.PhysicsObject.SetMass(Mass); this.PhysicsObject.scale = ModelScale; this.PhysicsObject.PhysicsBody.Velocity = Velocity; this.PhysicsObject.PhysicsBody.SetDeactivationTime(0.1f); this.PhysicsObject.PhysicsBody.SetActivityThreshold(5f, 5f); }
public XProp(ref XMain X, XModel model, Vector3 position, Vector3 modeloffset, Matrix orient, Vector3 scale) : base(ref X) { DrawOrder = 100; if (model != null) { this.model = model; model.Parent = this; modelNumber = model.Number; //if its not loaded try and load! //if (!model.loaded) model.Load(X.Content); } this.position = position; this.modeloffset = modeloffset; this.orientation = orient; this.scale = scale; }
/// <summary> /// Constructs a new projectile. /// </summary> public XProjectile(ref XMain X, XParticleSystem explosionParticles, XParticleSystem explosionSmokeParticles, XParticleSystem projectileTrailParticles) : base(ref X) { this.explosionParticles = explosionParticles; this.explosionSmokeParticles = explosionSmokeParticles; // Start at the origin, firing in a random (but roughly upward) direction. position = Vector3.Zero; velocity.X = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange; velocity.Y = (float)(random.NextDouble() + 0.5) * verticalVelocityRange; velocity.Z = (float)(random.NextDouble() - 0.5) * sidewaysVelocityRange; // Use the particle emitter helper to output our trail particles. trailEmitter = new XParticleEmitter(ref X, projectileTrailParticles, trailParticlesPerSecond, position); }
public XMouse(ref XMain X) : base(ref X) { DrawOrder = 0; Delta = Vector2.Zero; ScrollPosition = 0; ScrollDelta = 0; if (Reset) { Mouse.SetPosition(X.GraphicsDevice.Viewport.Width / 2, X.GraphicsDevice.Viewport.Height / 2); } CurrentState = Mouse.GetState(); LastState = CurrentState; InitialPosition = new Vector2(CurrentState.X, CurrentState.Y); CurrentPosition = InitialPosition; idleTime = new XTimer(ref X); }
public static HeightMapInfo GenerateFromHeightmap(ref XMain X, Texture2D Heighmap, float TerrainScale) { int Width = Heighmap.Width; int Height = Heighmap.Height; float[,] heights = new float[Width, Height]; Color[] colors = new Color[Width * Height]; Heighmap.GetData(colors); for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { heights[x, y] = colors[x + y * Width].R * 0.5f;//*.16f; } } return(new HeightMapInfo(heights, TerrainScale)); }
public XEnvironmentParameters(XMain X) : base(ref X) { LightDirection = new Vector4(100.0f, -100.0f, 100.0f, 1.0f); LightColor = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); LightColorAmbient = new Vector4(0.1f, 0.1f, 0.1f, 1.0f); FogColor = new Vector4(1.0f, 1.0f, 1.0f, 1.0f); FogDensity = .0045f; SunLightness = 0.2f; SunRadiusAttenuation = 256.0f; LargeSunLightness = 0.2f; LargeSunRadiusAttenuation = 1.0f; DayToSunsetSharpness = 1.15f; HazeTopAltitude = 100.0f; SunsetFile = @"Content\XEngine\Textures\SkySunset"; DayFile = @"Content\XEngine\Textures\SkyDay"; NightFile = @"Content\XEngine\Textures\SkyNight"; count++; number = count; Shadows = true; }
public XActor(ref XMain X, XModel model, Vector3 Position, Vector3 Velocity, float Mass) : base(ref X) { DrawOrder = 100; this.Scale = Vector3.One; if (model != null) { this.model = model; model.Parent = this; this.modelNumber = model.Number; if (model.Model != null) { RebuildCollisionSkin(); this.PhysicsObject.SetMass(Mass); this.PhysicsObject.PhysicsBody.Velocity = Velocity; } } this.Translation = Position; this.Velocity = Velocity; this.Mass = Mass; }