• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# TextureCube类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中TextureCube的典型用法代码示例。如果您正苦于以下问题:C# TextureCube类的具体用法?C# TextureCube怎么用?C# TextureCube使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



TextureCube类属于命名空间,在下文中一共展示了TextureCube类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
        }
开发者ID:johdah,项目名称:XNAShadingEffects,代码行数:33,代码来源:Sphere.cs


示例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();
        }
开发者ID:nagyistoce,项目名称:flightsim,代码行数:34,代码来源:Ocean.cs


示例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;
 }
开发者ID:Zolniu,项目名称:DigitalRune,代码行数:11,代码来源:SkyboxNode.cs


示例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");
 }
开发者ID:Bhanna200,项目名称:GP3_Submission,代码行数:8,代码来源:Enviroment.cs


示例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);
        }
开发者ID:Tengato,项目名称:Mechadrone1,代码行数:7,代码来源:SkyboxRenderComponent.cs


示例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;
		}
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:29,代码来源:Graphics.cs


示例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;
 }
开发者ID:matyicsapo,项目名称:MultiVerse,代码行数:11,代码来源:Skybox.cs


示例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);
 }
开发者ID:blackEagle2012,项目名称:XNA-Game-project,代码行数:7,代码来源:SkyModel.cs


示例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);
     }
 }
开发者ID:johdah,项目名称:XNAShadingEffects,代码行数:7,代码来源:RenderManager.cs


示例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();
        }
开发者ID:Bakkes,项目名称:Karo,代码行数:8,代码来源:SkyBoxComponent.cs


示例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");
 }
开发者ID:KleinerMensch,项目名称:CR4VE,代码行数:8,代码来源:SkyBox.cs


示例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;
 }
开发者ID:tornvall,项目名称:LaborationVFX,代码行数:8,代码来源:Sphere.cs


示例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;
 }
开发者ID:danbystrom,项目名称:VisionQuest,代码行数:8,代码来源:SkySphere.cs


示例14: LoadContent

        public void LoadContent(TextureCube t, Effect e)
        {
            skyEffect = e;

            skyTex = t;

            skyEffect.Parameters["tex"].SetValue(skyTex);
        }
开发者ID:romain-lefevere,项目名称:cassebrique,代码行数:8,代码来源:SkyBox.cs


示例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);
 }
开发者ID:skakri09,项目名称:LabyrinthExplorer-XNA-3D-game,代码行数:8,代码来源:Skybox.cs


示例16: Init

        public void Init(Microsoft.Xna.Framework.Graphics.Model model, Effect effect, TextureCube texture)
        {
            m_model = model;
            m_effect = effect;
            m_cubemap = texture;

            m_scale = new Vector3(2000.0f, 2000.0f, 2000.0f);
            m_position = new Vector3(0.0f, -500.0f, 0.0f);
        }
开发者ID:SamOatesUniversity,项目名称:Year-2---Game-Software-Development---Out-Of-Scope,代码行数:9,代码来源:SkyBox.cs


示例17: SkySphere

        public SkySphere(ContentManager Content, GraphicsDevice graphicsDevice, TextureCube Texture)
        {
            model = new Models(Content, Content.Load<Model>("models//skySphere"), Vector3.Zero, Vector3.Zero, new Vector3(-100000), graphicsDevice);
            effect = Content.Load<Effect>("shaders//SkyBox");
            effect.Parameters["CubeMap"].SetValue(Texture);
            model.SetModelEffect(effect, false);

            this.graphics = graphicsDevice;
        }
开发者ID:razvanalex,项目名称:XNAEnvironment,代码行数:9,代码来源:SkyBox.cs


示例18: Skybox

 // Creates a new skybox instance using the texture provided
 public Skybox(string skyboxTexture, ContentManager Content)
 {
     // Loads cube model
     skyBox = Content.Load<Model>("Models/cube");
     // Loads texture
     skyBoxTexture = Content.Load<TextureCube>(skyboxTexture);
     // Loads fx file
     skyBoxEffect = Content.Load<Effect>("Effects/Skybox");
 }
开发者ID:LaurieGreen,项目名称:GP3Coursework,代码行数:10,代码来源:Skybox.cs


示例19: Skybox

        public Skybox(GraphicsDevice device, TextureCube environment, Effect shader)
        {
            this.Environment = environment;
            this.Shader = shader;

            this.Device = device;

            this.VertexDeclaration = new VertexDeclaration(device, VertexPositionColor.VertexElements);
            this.VertexBuffer = new VertexBuffer(device, typeof(VertexPositionColor), 8, BufferUsage.WriteOnly);
            this.IndexBuffer = new IndexBuffer(device, 36 * sizeof(ushort), BufferUsage.WriteOnly, IndexElementSize.SixteenBits);

            VertexPositionColor[] vertices = new VertexPositionColor[8];
            vertices[0].Position = new Vector3(-1, 1, 1);
            vertices[1].Position = new Vector3(1, 1, 1);
            vertices[2].Position = new Vector3(1, 1, -1);
            vertices[3].Position = new Vector3(-1, 1, -1);

            vertices[4].Position = new Vector3(-1, -1, 1);
            vertices[5].Position = new Vector3(1, -1, 1);
            vertices[6].Position = new Vector3(1, -1, -1);
            vertices[7].Position = new Vector3(-1, -1, -1);

            this.VertexBuffer.SetData(vertices, 0, 8);

            vertices = null;

            ushort[] indices = new ushort[36];

            // top
            indices[0] = 0; indices[1] = 1; indices[2] = 3;
            indices[3] = 2; indices[4] = 3; indices[5] = 1;

            //bottom
            indices[6] = 5; indices[7] = 4; indices[8] = 6;
            indices[9] = 7; indices[10] = 6; indices[11] = 4;

            // front
            indices[12] = 3; indices[13] = 2; indices[14] = 7;
            indices[15] = 6; indices[16] = 7; indices[17] = 2;

            // back
            indices[18] = 1; indices[19] = 0; indices[20] = 4;
            indices[21] = 4; indices[22] = 5; indices[23] = 1;

            // left
            indices[24] = 0; indices[25] = 3; indices[26] = 4;
            indices[27] = 4; indices[28] = 3; indices[29] = 7;

            // right
            indices[30] = 2; indices[31] = 1; indices[32] = 6;
            indices[33] = 5; indices[34] = 6; indices[35] = 1;

            this.IndexBuffer.SetData(indices, 0, 36);

            indices = null;
        }
开发者ID:alewol,项目名称:SeaMon,代码行数:56,代码来源:Skybox(2).cs


示例20: Initialize

        public static void Initialize(ContentManager Content, string strEffectLocation, string strModelLocation, string strTextureLocation)
        {
            _SkyboxEffect = Content.Load<Effect>(strEffectLocation);
            SkyboxModel = Content.Load<Model>(strModelLocation);
            SkyboxTexture = Content.Load<TextureCube>(strTextureLocation);
            TextureOffsetX = TextureOffsetY = 0;

            for (int m = 0; m < SkyboxModel.Meshes.Count; m++)
                for (int p = 0; p < SkyboxModel.Meshes[m].MeshParts.Count; p++)
                    SkyboxModel.Meshes[m].MeshParts[p].Effect = _SkyboxEffect;
        }
开发者ID:apolaskey,项目名称:Inkwell,代码行数:11,代码来源:Skybox.cs



注:本文中的TextureCube类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# TextureFlags类代码示例发布时间:2022-05-24
下一篇:
C# Texture2DDescription类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap