本文整理汇总了C#中Material.SetBasicProperties方法的典型用法代码示例。如果您正苦于以下问题:C# Material.SetBasicProperties方法的具体用法?C# Material.SetBasicProperties怎么用?C# Material.SetBasicProperties使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Material
的用法示例。
在下文中一共展示了Material.SetBasicProperties方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadContent
/// <summary>
/// LoadContent will be called once per game and is the place to load
/// all of your content.
/// </summary>
protected override void LoadContent()
{
//SFX
Wind = Content.Load<SoundEffect>("windy2");
Heart = Content.Load<SoundEffect>("heart_beating_at_normal_speed");
Scream = Content.Load<SoundEffect>("bloodscream");
NearMonster = Content.Load<SoundEffect>("this_way_comes_2");
//Models
testmodel = Content.Load<Model>("box");
monsterModel = Content.Load<Model>("SphereHighPoly");
//Music
BackgroundMusic = Content.Load<Song>("MonsterMusicTest");
Music2 = Content.Load<Song>("breifing");
//Mini Map
MiniMap_Closed = Content.Load<Texture2D>("minimap_closed");
MiniMap_Monster = Content.Load<Texture2D>("minimap_monster");
MiniMap_Open = Content.Load<Texture2D>("minimap_open");
MiniMap_Player = Content.Load<Texture2D>("minimap_player");
//compass
CompassTexture = Content.Load<Texture2D>("gamecompass2");
CompassSkull = Content.Load<Texture2D>("skull");
CompassArrow = Content.Load<Texture2D>("tele");
CompassPointer = Content.Load<Texture2D>("compasspointer");
//Banner
Banner = Content.Load<Texture2D>("banner");
//Point Spirtes
pointSpritesEffect = Content.Load<Effect>("Effect\\pointsprites");
pointSpritesEffect.Parameters["SpriteTexture"].SetValue(
Content.Load<Texture2D>("fire"));
spriteArray = new VertexPositionColor[200];
vertexPosColDecl = new VertexDeclaration(graphics.GraphicsDevice,
VertexPositionColor.VertexElements);
device = graphics.GraphicsDevice;
basicEffect = new BasicEffect(device, null);
font = Content.Load<SpriteFont>("SpriteFont1");
smallfont = Content.Load<SpriteFont>("SpriteFont2");
if (graphics.GraphicsDevice.GraphicsDeviceCapabilities.
PixelShaderVersion.Major >= 3)
{
baseEffect = Content.Load<Effect>("Effect\\MaterialShader30");
numLights = 3;
baseEffect.Parameters["numLights"].SetValue(numLights);
shaderVersionString = "Using Shader Model 3.0";
}
else
{
baseEffect = Content.Load<Effect>("Effect\\MaterialShader20");
numLights = 3;
baseEffect.Parameters["numLights"].SetValue(numLights);
shaderVersionString = "Using Shader Model 2.0";
}
// cache the effect parameters
viewParameter = baseEffect.Parameters["view"];
projectionParameter = baseEffect.Parameters["projection"];
cameraPositionParameter = baseEffect.Parameters["cameraPosition"];
// create the materials
BasicMaterial = new Material(Content, graphics.GraphicsDevice,baseEffect);
WallMaterial = new Material(Content, graphics.GraphicsDevice, baseEffect);
FloorMaterial = new Material(Content, graphics.GraphicsDevice, baseEffect);
CeilingMaterial = new Material(Content, graphics.GraphicsDevice, baseEffect);
BasicMaterial.SetBasicProperties(Color.Purple, 0.5f, 1.2f);
WallMaterial.SetTexturedMaterial(Color.White, Stage.ConfigurationSettings.WallSpecularPower, Stage.ConfigurationSettings.WallSpecularIntensity*2,
"wall_diffuse",
"wall_specular", 1f, 1f);
FloorMaterial.SetTexturedMaterial(Color.White, 0, 0,
"ground06",
"ground06", 1f, 1f);
CeilingMaterial.SetTexturedMaterial(Color.White, 0, 0,
"ground06",
"ground06", 1f, 1f);
//Set ambient light
baseEffect.Parameters["ambientLightColor"].SetValue(
new Vector4(Stage.ConfigurationSettings.Ambient*1.4f,
Stage.ConfigurationSettings.Ambient*1.3f,
Stage.ConfigurationSettings.Ambient, 1.0f));
// Recalculate the projection properties on every LoadGraphicsContent call.
// That way, if the window gets resized, then the perspective matrix will
// be updated accordingly
float aspectRatio = (float)graphics.GraphicsDevice.Viewport.Width /
(float)graphics.GraphicsDevice.Viewport.Height;
float fieldOfView = aspectRatio * MathHelper.PiOver4 * 3f / 4f;
projection = Matrix.CreatePerspectiveFieldOfView(
fieldOfView, aspectRatio, .1f, 1000f);
projectionParameter.SetValue(projection);
// calculate the safe left and top edges of the screen
safeBounds = new Vector2(
//.........这里部分代码省略.........