本文整理汇总了C#中TextureCube类的典型用法代码示例。如果您正苦于以下问题:C# TextureCube类的具体用法?C# TextureCube怎么用?C# TextureCube使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TextureCube类属于命名空间,在下文中一共展示了TextureCube类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DrawModelWithEffect
public override void DrawModelWithEffect(Matrix world, Matrix view, Matrix projection, TextureCube reflectionTexture, Vector3 cameraPosition)
{
RasterizerState previous = _device.RasterizerState;
_device.RasterizerState = RasterizerState.CullCounterClockwise;
foreach (ModelMesh mesh in _model.Meshes)
{
foreach (ModelMeshPart part in mesh.MeshParts)
{
part.Effect = _effect;
// Basic
_effect.Parameters["Projection"].SetValue(projection);
_effect.Parameters["View"].SetValue(view);
_effect.Parameters["World"].SetValue((world * _localWorld) * mesh.ParentBone.Transform * Matrix.CreateTranslation(_position));
// Specular
_effect.Parameters["ViewVector"].SetValue(Matrix.Invert(view).Translation);
// Bump
_effect.Parameters["NormalMap"].SetValue(normalmap);
// Reflection
_effect.Parameters["ReflectionTexture"].SetValue(reflectionTexture);
_effect.Parameters["CameraPosition"].SetValue(cameraPosition);
// Fog
_effect.Parameters["FogColor"].SetValue(Color.Gray.ToVector3());
_effect.Parameters["FogEnd"].SetValue(30f);
_effect.Parameters["FogStart"].SetValue(20f);
// Other
_effect.Parameters["TextureColorDefault"].SetValue(Color.Gray.ToVector4());
_effect.Parameters["AmbientLightColor"].SetValue(Color.Gold.ToVector3());
}
mesh.Draw();
}
_device.RasterizerState = previous;
}
示例2: Draw
public void Draw(GameTime gameTime, ICamera cam, TextureCube skyTexture, Matrix proj)
{
// start the shader
//oceanEffect.Begin();
//oceanEffect.CurrentTechnique.Passes[0].Begin();
// set the transforms
oceanEffect.Parameters["World"].SetValue(Matrix.Identity);
oceanEffect.Parameters["View"].SetValue(cam.CameraMatrix);
oceanEffect.Parameters["Projection"].SetValue(proj);
oceanEffect.Parameters["EyePos"].SetValue(cam.Position);
// choose and set the ocean textures
int oceanTexIndex = ((int)(gameTime.TotalGameTime.TotalSeconds) % 4);
oceanEffect.Parameters["normalTex"].SetValue(OceanNormalMaps[(oceanTexIndex + 1) % 4]);
oceanEffect.Parameters["normalTex2"].SetValue(OceanNormalMaps[(oceanTexIndex) % 4]);
oceanEffect.Parameters["textureLerp"].SetValue((((((float)gameTime.TotalGameTime.TotalSeconds) - (int)(gameTime.TotalGameTime.TotalSeconds)) * 2 - 1) * 0.5f) + 0.5f);
// set the time used for moving waves
oceanEffect.Parameters["time"].SetValue((float)gameTime.TotalGameTime.TotalSeconds * 0.02f);
// set the sky texture
oceanEffect.Parameters["cubeTex"].SetValue(skyTexture);
//oceanEffect.CommitChanges();
oceanEffect.CurrentTechnique.Passes[0].Apply();
// draw our geometry
//Global.Graphics.VertexDeclaration = OceanVD;
Global.Graphics.DrawUserPrimitives<VertexPositionNormalTexture>(PrimitiveType.TriangleList, OceanVerts, 0, 2);
// and we're done!
//oceanEffect.CurrentTechnique.Passes[0].End();
//oceanEffect.End();
}
示例3: SkyboxNode
/// <summary>
/// Initializes a new instance of the <see cref="SkyboxNode" /> class.
/// </summary>
/// <param name="texture">The cube map texture (using premultiplied alpha).</param>
public SkyboxNode(TextureCube texture)
{
Texture = texture;
Color = new Vector3F(1, 1, 1);
Alpha = 1.0f;
Encoding = ColorEncoding.SRgb;
}
示例4: Enviroment
// loads new skybox content
public Enviroment(string skyboxTexture, ContentManager Content)
{
skyBox = Content.Load<Model>("Models/skyboxCube");
skyBoxTexture = Content.Load<TextureCube>("Effects/Sunset");
skyBoxEffect = Content.Load<Effect>("Effects/Skybox");
terrain = Content.Load<Model>("Models/desert");
}
示例5: Initialize
public override void Initialize(Microsoft.Xna.Framework.Content.ContentManager contentLoader, ComponentManifest manifest)
{
SkyTexture = contentLoader.Load<TextureCube>((string)(manifest.Properties[ManifestKeys.TEXTURE]));
OnEnvironmentMapAdded(EventArgs.Empty);
base.Initialize(contentLoader, manifest);
}
示例6: BeginGetTempTexture
public static Texture BeginGetTempTexture(Type type)
{
if (type == typeof(Texture))
type = typeof(Texture2D);
for (int i = 0; i < textureCache.Count; i++)
{
if (textureCache[i].GetType() == type)
{
Texture t = textureCache[i];
textureCache.RemoveAt(i);
return t;
}
}
//create.
SurfaceFormat format = SurfaceFormat.HalfSingle;
Texture texture = null;
if (type == typeof(Texture2D))
texture = new Texture2D(GraphicsDevice, 2, 2, false, format);
if (type == typeof(Texture3D))
texture = new Texture3D(GraphicsDevice, 2, 2, 2, false, format);
if (type == typeof(TextureCube))
texture = new TextureCube(GraphicsDevice, 2, false, format);
return texture;
}
示例7: Skybox
/// <summary>
/// Creates a new skybox
/// </summary>
/// <param name="skyboxTexture">the name of the skybox texture to use</param>
public Skybox(string skyboxTexture, float size, ContentManager Content)
{
skyBox = Content.Load<Model>("Models/cube");
skyBoxTexture = Content.Load<TextureCube>("Skybox/" + skyboxTexture);
skyBoxEffect = Content.Load<Effect>("Skybox/Skybox");
this.size = size;
}
示例8: SkyModel
public SkyModel(Game1 game, Model model, TextureCube Texture)
: base(game,model)
{
effect = game.Content.Load<Effect>("skysphere_effect");
effect.Parameters["CubeMap"].SetValue(Texture);
SetModelEffect(effect, false);
}
示例9: Draw
public void Draw(Scene scene, Matrix world, Matrix view, Matrix projection, TextureCube reflectionTexture, Vector3 cameraPosition, RenderPass pass)
{
foreach (AbstractEntity entity in scene.Entities)
{
entity.Draw(world, view, projection, reflectionTexture, cameraPosition, pass);
}
}
示例10: LoadContent
protected override void LoadContent()
{
skyBox = karoGame.Content.Load<Model>("cube");
texture = karoGame.Content.Load<TextureCube>("Islands");
skyBoxEffect = karoGame.Content.Load<Effect>("SkyBox");
base.LoadContent();
}
示例11: SkyBox
public SkyBox(Vector3 pos, string skyboxTexture, ContentManager Content)
{
this.position = pos;
skyBox = Content.Load<Model>("Assets/Models/Terrain/10x10x10Box1");
skyBoxTexture = Content.Load<TextureCube>(skyboxTexture);
skyBoxEffect = Content.Load<Effect>("Assets/Effects/SkyBox");
// skyBoxEffect = Content.Load<Effect>("Assets/Effects/Rainfall");
}
示例12: Sphere
public Sphere(GraphicsDevice device, Model model, Effect effect, TextureCube skyboxTexture)
: base(device, Vector3.Zero, Quaternion.Identity, 1f)
{
this.Position = new Vector3(-2f, 1f, 0f);
this.effect = effect;
this.model = model;
this.skyboxTexture = skyboxTexture;
}
示例13: SkySphere
public SkySphere(
VisionContent vtContent,
TextureCube texture)
: base(new VisionEffect(vtContent.Load<Effect>("effects/skysphere")))
{
_sphere = new SpherePrimitive<VertexPosition>(vtContent.GraphicsDevice, (p, n, t, tx) => new VertexPosition(p), 20000, 10, false);
Effect.Texture = texture;
}
示例14: LoadContent
public void LoadContent(TextureCube t, Effect e)
{
skyEffect = e;
skyTex = t;
skyEffect.Parameters["tex"].SetValue(skyTex);
}
示例15: LoadContent
public void LoadContent(ContentManager content, GraphicsDevice gfxDevice)
{
skyEffect = content.Load<Effect>(@"Effects\skyEffect");
skyTexture = content.Load<TextureCube>(@"Textures\Skybox\SkyBoxTex");
skyEffect.Parameters["tex"].SetValue(skyTexture);
CreateCubeVertexBuffer(gfxDevice);
CreateCubeIndexBuffer(gfxDevice);
}