Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
        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.");
        }
Exemplo n.º 3
0
 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.
 }
Exemplo n.º 4
0
		static void CreateThePixel (GraphicsResource spriteBatch)
		{
			pixel = new Texture2D (
				spriteBatch.GraphicsDevice,
				1,
				1,
				false,
				SurfaceFormat.Color);
			pixel.SetData (new[]{ Color.White });
		}