public PhysicsObj(MobileFortressClient game, Vector3 position, Quaternion orientation, ushort resource) : base(game) { Resource = Resources.GetResource(resource); Entity = Resources.GetEntity(position, resource); Entity.PositionUpdateMode = PositionUpdateMode.Continuous; game.Components.Add(this); Sector.Redria.Add(this); }
internal static void Validate(this RenderContext context, GraphicsResource resource) { if (context.GraphicsService == null) throw new GraphicsException("Invalid render context: Graphics service is not set."); if (resource != null && resource.GraphicsDevice != context.GraphicsService.GraphicsDevice) throw new GraphicsException("Invalid render context: Wrong graphics device."); }
void DrawPart(GraphicsResource Part, Effect Effect, LightMaterial Mat, Vector3 Offset, Color Color) { if (Part.lightmap != null) { Effect.Parameters["xLightmap"].SetValue(Part.lightmap); } foreach (ModelMesh mesh in Part.model.Meshes) { foreach (ModelMeshPart part in mesh.MeshParts) { Matrix world = mesh.ParentBone.Transform * Matrix.CreateTranslation(Offset) * Part.transform * shipRotation; part.Effect = Effect; Weather.SetStandardEffect(ref Effect, Mat, world); if (Part.texture != null) { Effect.CurrentTechnique = Effect.Techniques["TTexSM2"]; Effect.Parameters["xTexture"].SetValue(Part.texture); } else Effect.CurrentTechnique = Effect.Techniques["TSM2"]; Effect.Parameters["customColors"].SetValue(true); Effect.Parameters["customColorA"].SetValue(Color.ToVector4()); } mesh.Draw(); } Effect.Parameters["customColors"].SetValue(false); //Don't make gray in the entire world change kthx. }
static void CreateThePixel (GraphicsResource spriteBatch) { pixel = new Texture2D ( spriteBatch.GraphicsDevice, 1, 1, false, SurfaceFormat.Color); pixel.SetData (new[]{ Color.White }); }