本文整理汇总了C#中Microsoft.Xna.Framework.Graphics.BasicEffect.EnableDefaultLighting方法的典型用法代码示例。如果您正苦于以下问题:C# BasicEffect.EnableDefaultLighting方法的具体用法?C# BasicEffect.EnableDefaultLighting怎么用?C# BasicEffect.EnableDefaultLighting使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Xna.Framework.Graphics.BasicEffect
的用法示例。
在下文中一共展示了BasicEffect.EnableDefaultLighting方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GameMap
public GameMap(Game game, Map map)
{
_game = game;
_map = map;
_width =(int) map.Sizes.X + 1;
_height = (int)map.Sizes.Y + 1;
_basicEffect = new BasicEffect(game.GraphicsDevice)
{
FogEnabled = map.FogEnabled,
FogStart = map.ForStart,
FogEnd = map.FogEnd,
FogColor = map.FogColor,
};
_basicEffect.LightingEnabled = map.LightingEnabled;
if (map.DirectionalLight0 != null)
map.DirectionalLight0.Fill(_basicEffect.DirectionalLight0);
if (map.DirectionalLight1 != null)
map.DirectionalLight1.Fill(_basicEffect.DirectionalLight1);
if (map.DirectionalLight2 != null)
map.DirectionalLight2.Fill(_basicEffect.DirectionalLight2);
if (map.EnableDefaultLighting)
_basicEffect.EnableDefaultLighting();
CreateVertices();
}
示例2: LoadContent
public void LoadContent(IServiceProvider services)
{
// Get the necessary services.
_graphics = ((IGraphicsDeviceService)services.GetService(typeof(IGraphicsDeviceService))).GraphicsDevice;
// Create a vertex declaration, describing the format of our vertex data.
// Create a vertex buffer, and copy our vertex data into it.
_vertexBuffer = new VertexBuffer(_graphics,
typeof(VertexPositionNormal),
_vertices.Count, BufferUsage.None);
_vertexBuffer.SetData(_vertices.ToArray());
// Create an index buffer, and copy our index data into it.
_indexBuffer = new IndexBuffer(_graphics, typeof(ushort),
_indices.Count, BufferUsage.None);
_indexBuffer.SetData(_indices.ToArray());
// Create a BasicEffect, which will be used to render the primitive.
_basicEffect = new BasicEffect(_graphics);
_basicEffect.EnableDefaultLighting();
}
示例3: LoadContent
protected override void LoadContent()
{
base.LoadContent();
_basicEffect = new BasicEffect(GraphicsDevice);
_basicEffect.EnableDefaultLighting();
_numVertices = SIZE * SIZE;
int numInternalRows = SIZE - 2;
_numIndices = (2 * SIZE * (1 + numInternalRows)) + (2 * numInternalRows);
VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[_numVertices];
for (int z = 0; z < SIZE; z++)
{
for (int x = 0; x < SIZE; x++)
{
vertices[GetIndex(x, z)] = new VertexPositionNormalTexture(
new Vector3(x, 0, -z), new Vector3(0, 1, 0),
new Vector2(x / (float)(SIZE - 1) * 8, z / (float)(SIZE - 1) * 8));
}
}
_vertexBuffer = new VertexBuffer(
this.GraphicsDevice,
VertexPositionNormalTexture.VertexDeclaration,
vertices.Length,
BufferUsage.WriteOnly);
_vertexBuffer.SetData<VertexPositionNormalTexture>(vertices);
short[] indices = new short[_numIndices]; int indexCounter = 0;
for (int z = 0; z < SIZE - 1; z++)
{
// insert index for degenerate triangle
if (z > 0)
indices[indexCounter++] = GetIndex(0, z);
for (int x = 0; x < SIZE; x++)
{
indices[indexCounter++] = GetIndex(x, z);
indices[indexCounter++] = GetIndex(x, z + 1);
}
// insert index for degenerate triangle
if (z < SIZE - 2)
indices[indexCounter++] = GetIndex(SIZE - 1, z);
}
_indexBuffer = new IndexBuffer(
this.GraphicsDevice,
typeof(short),
indices.Length,
BufferUsage.WriteOnly);
_indexBuffer.SetData<short>(indices);
Texture2D texture = Game.Content.Load<Texture2D>(@"Textures\dirt");
_basicEffect.Texture = texture;
_basicEffect.TextureEnabled = true;
}
示例4: BasicEffectWrapper
public BasicEffectWrapper(GraphicsDevice graphicsDevice)
{
_innerEffect = new BasicEffect(graphicsDevice);
_innerEffect.EnableDefaultLighting();
_innerEffect.PreferPerPixelLighting = true;
_innerEffect.TextureEnabled = true;
}
示例5: Warm
public void Warm(GraphicsDevice device)
{
material = new BasicEffect(device);
material.EnableDefaultLighting();
material.VertexColorEnabled = true;
material.PreferPerPixelLighting = true;
}
示例6: LoadContent
protected override void LoadContent()
{
LineEffect = new BasicEffect(Game.GraphicsDevice);
LineEffect.EnableDefaultLighting();
LineEffect.DiffuseColor = new Vector3(1, 1, 1);
LineEffect.VertexColorEnabled = true;
LineEffect.LightingEnabled = false;
LineEffect.TextureEnabled = false;
sphereVertices = new VertexPositionColor[18];
for (int i = 0; i <= 16; i++)
{
float angle = (float)Math.PI * 2.0f * (float)i / 16;
sphereVertices[i].Color = Color.GreenYellow;
sphereVertices[i].Position = new Vector3(Sin(angle), Cos(angle), 0);
}
sphereVertices[17].Color = Color.GreenYellow;
sphereVertices[17].Position = Vector3.Zero;
Matrix terrainWorld = Matrix.CreateScale(0.03f);
base.LoadContent();
}
示例7: SetupShittyStupidShit
private static void SetupShittyStupidShit()
{
effect = new BasicEffect(Game1.Device);
effect.EnableDefaultLighting();
effect.TextureEnabled = true;
effect.Texture = texture;
}
示例8: ChunkModule
public ChunkModule(TrueCraftGame game)
{
Game = game;
ChunkRenderer = new ChunkRenderer(Game.Client.World, Game, Game.BlockRepository);
Game.Client.ChunkLoaded += (sender, e) => ChunkRenderer.Enqueue(e.Chunk);
Game.Client.ChunkUnloaded += (sender, e) => UnloadChunk(e.Chunk);
Game.Client.ChunkModified += (sender, e) => ChunkRenderer.Enqueue(e.Chunk, true);
ChunkRenderer.MeshCompleted += MeshCompleted;
ChunkRenderer.Start();
OpaqueEffect = new BasicEffect(Game.GraphicsDevice);
OpaqueEffect.EnableDefaultLighting();
OpaqueEffect.DirectionalLight0.SpecularColor = Color.Black.ToVector3();
OpaqueEffect.DirectionalLight1.SpecularColor = Color.Black.ToVector3();
OpaqueEffect.DirectionalLight2.SpecularColor = Color.Black.ToVector3();
OpaqueEffect.TextureEnabled = true;
OpaqueEffect.Texture = Game.TextureMapper.GetTexture("terrain.png");
OpaqueEffect.FogEnabled = true;
OpaqueEffect.FogStart = 512f;
OpaqueEffect.FogEnd = 1000f;
OpaqueEffect.FogColor = Color.CornflowerBlue.ToVector3();
OpaqueEffect.VertexColorEnabled = true;
TransparentEffect = new AlphaTestEffect(Game.GraphicsDevice);
TransparentEffect.AlphaFunction = CompareFunction.Greater;
TransparentEffect.ReferenceAlpha = 127;
TransparentEffect.Texture = Game.TextureMapper.GetTexture("terrain.png");
TransparentEffect.VertexColorEnabled = true;
ChunkMeshes = new List<ChunkMesh>();
IncomingChunks = new ConcurrentBag<Mesh>();
ActiveMeshes = new HashSet<Coordinates2D>();
}
示例9: ShipModel
private ShipModel(Model m, String name)
{
shipmodels.Add(name, this); //add to static dictionary of models
ship = m;
GraphicsDevice graphicsDevice = Game1.device;
Point center = Point.Zero;
m.Root.Transform = Matrix.CreateScale(10f);
basicEffect = new BasicEffect(Game1.device);
foreach (ModelMesh mesh in ship.Meshes)
{
foreach (ModelMeshPart part in mesh.MeshParts)
{
part.Effect = basicEffect;
}
}
// Create a BasicEffect, which will be used to render the primitive.
//basicEffect = new BasicEffect(graphicsDevice);
basicEffect.DiffuseColor = new Vector3(50, 50, 50);
basicEffect.EnableDefaultLighting();
}
示例10: onAddedToEntity
public override void onAddedToEntity()
{
base.onAddedToEntity();
_basicEffect = entity.scene.content.loadMonoGameEffect<BasicEffect>();
_basicEffect.VertexColorEnabled = true;
_basicEffect.EnableDefaultLighting();
}
示例11: Terrain
public Terrain(DagonGame game, int width, int length)
{
_basicEffect = new BasicEffect(game.GraphicsDevice) { TextureEnabled = true};
if (game.Settings.EnableDefaultLighting)
{
_basicEffect.EnableDefaultLighting();
_basicEffect.PreferPerPixelLighting = true;
}
_basicEffect.FogEnabled = true;
_basicEffect.FogStart = game.Settings.RangeOfVisibility / 3f;
_basicEffect.FogEnd = game.Settings.RangeOfVisibility;
_basicEffect.FogColor = game.World.SkyColor.ToVector3();
//_basicEffect.
_game = game;
_hightMap = new float[width + 1][];
var random = new Random(DateTime.Now.Millisecond);
for (int i = 0; i < width + 1; i++)
{
_hightMap[i] = new float[length + 1];
for (int j = 0; j < length + 1; j++)
{
_hightMap[i][j] = (float)(random.NextDouble() / 4);
}
}
vertexData = new VertexPositionNormalTexture[_hightMap.Length * _hightMap[0].Length * 2 * 3];
var index = 0;
//TODO make map width*length size
for (int i = 0; i < width-1; i++)
{
for (int j = 0; j < length-1; j++)
{
vertexData[index] = CreateVertex(i, j, new Vector2(0, 0));
index++;
vertexData[index] = CreateVertex(i + 1, j, new Vector2(1, 0));
index++;
vertexData[index] = CreateVertex(i, j + 1, new Vector2(0, 1));
index++;
vertexData[index] = CreateVertex(i + 1, j, new Vector2(1, 0));
index++;
vertexData[index] = CreateVertex(i + 1, j + 1, new Vector2(1, 1));
index++;
vertexData[index] = CreateVertex(i, j + 1, new Vector2(0, 1));
index++;
}
}
}
示例12: LoadContent
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
texturaPlano = Content.Load<Texture2D>("logo_ipca");
efeito = new BasicEffect(GraphicsDevice);
efeitoPlano = new BasicEffect(GraphicsDevice);
efeitoPlano.TextureEnabled = true;
efeitoPlano.EnableDefaultLighting();
efeitoPlano.Texture = texturaPlano;
}
示例13: ApplyToBasicEffect
public static void ApplyToBasicEffect(BasicEffect effect)
{
effect.EnableDefaultLighting();
effect.DirectionalLight0.Direction = new Vector3(-1.0f, 0.0f, 0.0f);
effect.DirectionalLight0.DiffuseColor = new Vector3(0.95f);
effect.DirectionalLight1.Enabled = false;
effect.DirectionalLight2.Enabled = false;
effect.AmbientLightColor = new Vector3(0.05f);
}
示例14: Obstacle
public Obstacle(Vector3 position, Color color)
{
unitCube = GameMultiVerse.Instance.Content.Load<Model>("Models/cube");
basicEffect = new BasicEffect(GameMultiVerse.Instance.GraphicsDevice);
Matrix W = Matrix.CreateTranslation(position);
boundingBox = Collision.UpdateBoundingBox(unitCube, W);
basicEffect.EnableDefaultLighting();
basicEffect.World = W;
basicEffect.DiffuseColor = color.ToVector3();
}
示例15: Initialize
protected override void Initialize()
{
// TODO: Add your initialization logic here
cam = new FreeCamera(new Vector3(10, 10, 60), 0, 0, GraphicsDevice);
setupworld();
groundeffect = new BasicEffect(GraphicsDevice);
groundeffect.TextureEnabled = true;
groundeffect.EnableDefaultLighting();
groundeffect.Texture = Content.Load<Texture2D>("Checker");
ground = new VertexPositionNormalTexture[6];
setupground();
base.Initialize();
}