本文整理汇总了C#中GraphicFactory.GetTextureCube方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicFactory.GetTextureCube方法的具体用法?C# GraphicFactory.GetTextureCube怎么用?C# GraphicFactory.GetTextureCube使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicFactory
的用法示例。
在下文中一共展示了GraphicFactory.GetTextureCube方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadContent
/// <summary>
/// Load content for the screen.
/// </summary>
/// <param name="GraphicInfo"></param>
/// <param name="factory"></param>
/// <param name="contentManager"></param>
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
{
base.LoadContent(GraphicInfo, factory, contentManager);
#region Models
{
///Need to load the height, the normal texture and the difuse texture
SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\block", "..\\Content\\Textures\\color_map");
sm.SetTexture("Textures\\normal_map", TextureType.BUMP);
sm.SetCubeTexture(factory.GetTextureCube("Textures//cubemap"),TextureType.ENVIRONMENT);
BoxObject pi = new BoxObject(new Vector3(200, 110, 0), 1, 1, 1, 5, new Vector3(100, 100, 100), Matrix.Identity, MaterialDescription.DefaultBepuMaterial());
DeferredEnvironmentCustomShader DeferredEnvironmentCustomShader = new DeferredEnvironmentCustomShader(false, true, false);
DeferredEnvironmentCustomShader.SpecularIntensity = 0.2f;
DeferredEnvironmentCustomShader.SpecularPower = 30;
DeferredEnvironmentCustomShader.ShaderId = ShaderUtils.CreateSpecificBitField(true);
IMaterial mat = new DeferredMaterial(DeferredEnvironmentCustomShader);
IObject obj3 = new IObject(mat, sm, pi);
this.World.AddObject(obj3);
}
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
DeferredCustomShader shader = new DeferredCustomShader(false,false,false,false);
DeferredMaterial fmaterial = new DeferredMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
#endregion
#region NormalLight
DirectionalLightPE ld1 = new DirectionalLightPE(Vector3.Left, Color.White);
DirectionalLightPE ld2 = new DirectionalLightPE(Vector3.Right, Color.White);
DirectionalLightPE ld3 = new DirectionalLightPE(Vector3.Backward, Color.White);
DirectionalLightPE ld4 = new DirectionalLightPE(Vector3.Forward, Color.White);
DirectionalLightPE ld5 = new DirectionalLightPE(Vector3.Down, Color.White);
float li = 0.5f;
ld1.LightIntensity = li;
ld2.LightIntensity = li;
ld3.LightIntensity = li;
ld4.LightIntensity = li;
ld5.LightIntensity = li;
this.World.AddLight(ld1);
this.World.AddLight(ld2);
this.World.AddLight(ld3);
this.World.AddLight(ld4);
this.World.AddLight(ld5);
#endregion
CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(10), MathHelper.ToRadians(-10), new Vector3(200, 150, 250), GraphicInfo);
this.World.CameraManager.AddCamera(cam);
new LightThrowBepu(this.World, GraphicFactory);
SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//cubemap");
CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
}
示例2: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
base.LoadContent(GraphicInfo, factory, contentManager);
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
simpleModel.SetTexture(factory.CreateTexture2DColor(1,1,Color.Gray), TextureType.MULTITEX1);
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
//ForwardDualTextureShader shader = new ForwardDualTextureShader();
ForwardEnvironmentShader shader = new ForwardEnvironmentShader(factory.GetTextureCube("Textures//grassCUBE"));
ForwardMaterial fmaterial = new ForwardMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//uzi");
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, new Vector3(100,10,10), Matrix.Identity, Vector3.One * 10, MaterialDescription.DefaultBepuMaterial());
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
this.RenderTechnic.AddPostEffect(new BlackWhitePostEffect());
}
示例3: Load
//.........这里部分代码省略.........
Model model = factory.GetModel(modelPath + Name);
modelNames.Add(modelPath + Name);
Matrix[] m = new Matrix[model.Bones.Count];
model.CopyAbsoluteBoneTransformsTo(m);
////////////EXTRAINDO MESHES
for (int i = 0; i < model.Meshes.Count; i++)
{
String name = model.Meshes[i].Name.Substring(5);
if (infos.ContainsKey(name))
{
for (int j = 0; j < model.Meshes[i].MeshParts.Count; j++)
{
XmlModelMeshInfo inf = infos[name];
Matrix tr = m[model.Meshes[i].ParentBone.Index];
Vector3 scale;
Vector3 pos;
Quaternion ori;
tr.Decompose(out scale, out ori, out pos);
ObjectInformation mi = new ObjectInformation();
mi.modelName = inf.modelName;
mi.meshPartIndex = j;
mi.meshIndex = i;
mi.position = pos;
mi.scale = scale;
mi.rotation = ori;
ModelBuilderHelper.Extract(m, model.Meshes[i].MeshParts[j], out mi.batchInformation);
mi.ellasticity = inf.ellasticity;
mi.dinamicfriction = inf.dinamicfriction;
mi.staticfriction = inf.staticfriction;
mi.collisionType = inf.collisionType;
mi.mass = inf.mass;
mi.batchInformation.ModelLocalTransformation = m[model.Meshes[i].ParentBone.Index];
mi.textureInformation = new TextureInformation(false, factory);
if (inf.material.reflectionName != null)
{
mi.textureInformation.SetCubeTexture(factory.GetTextureCube(texturePath + inf.material.reflectionName), TextureType.ENVIRONMENT);
texturesNames.Add(texturePath + inf.material.reflectionName);
}
else
{
if (inf.material.difuseName != null)
{
mi.textureInformation.SetTexture(factory.GetTexture2D(texturePath + inf.material.difuseName), TextureType.DIFFUSE);
texturesNames.Add(texturePath + inf.material.difuseName);
}
if (inf.material.glowName != null)
{
mi.textureInformation.SetTexture(factory.GetTexture2D(texturePath + inf.material.glowName), TextureType.GLOW);
texturesNames.Add(texturePath + inf.material.glowName);
}
if (inf.material.specularName != null)
{
mi.textureInformation.SetTexture(factory.GetTexture2D(texturePath + inf.material.specularName), TextureType.SPECULAR);
texturesNames.Add(texturePath + inf.material.specularName);
}
if (inf.material.bumpName != null)
{
mi.textureInformation.SetTexture(factory.GetTexture2D(texturePath + inf.material.bumpName), TextureType.BUMP);
texturesNames.Add(texturePath + inf.material.bumpName);
}
}
if (inf.collisionType != null)
{
if (inf.collisionType.Contains("Water"))
{
mi.extra = inf.material.extrainformation;
}
}
mi.textureInformation.LoadTexture();
elements.ModelMeshesInfo.Add(mi);
}
}
}
SerializerHelper.ChangeDecimalSymbolToSystemDefault();
//Clear Stuffs
infos.Clear();
targets.Clear();
spotLights.Clear();
cameras.Clear();
return elements;
}
示例4: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
{
RasterizerState = new Microsoft.Xna.Framework.Graphics.RasterizerState();
RasterizerState.FillMode = FillMode.WireFrame;
BloomPostEffect = new BloomPostEffect();
BloomPostEffect.Enabled = false;
this.RenderTechnic.AddPostEffect(BloomPostEffect);
base.LoadContent(GraphicInfo, factory, contentManager);
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cena");
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
ForwardXNABasicShaderDescription ForwardXNABasicShaderDescription = ForwardXNABasicShaderDescription.Default();
ForwardXNABasicShaderDescription.EnableTexture = true;
ForwardXNABasicShaderDescription.EnableLightning = true;
ForwardXNABasicShaderDescription.DefaultLightning = true;
shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription);
ForwardMaterial fmaterial = new ForwardMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
shader.Initialize(GraphicInfo, factory, obj);
this.World.AddObject(obj);
}
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cilos");
///tem mais de um cilo neste mesh, tem q setar as texturas de todo mundo ....
Texture2D tex = factory.CreateTexture2DColor(1, 1, Color.White);
for (int i = 0; i < simpleModel.MeshNumber; i++)
{
simpleModel.SetTexture(tex, TextureType.DIFFUSE,i,0);
}
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
shader2 = new ForwardEnvironmentShader(factory.GetTextureCube("Textures//cubeMap"),1,false);
ForwardMaterial fmaterial = new ForwardMaterial(shader2);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
shader.BasicEffect.FogEnabled = true;
shader.BasicEffect.FogColor = new Vector3(0.1f, 0.1f, 0.1f); // Dark grey
shader.BasicEffect.FogStart = 30;
shader.BasicEffect.FogEnd = 1000;
shader2.EnvironmentMapEffect.FogEnabled = true;
shader2.EnvironmentMapEffect.FogColor = new Vector3(0.1f, 0.1f, 0.1f); // Dark grey
shader2.EnvironmentMapEffect.FogStart = 30;
shader2.EnvironmentMapEffect.FogEnd = 1000;
cam = new RotatingCamera(this);
this.World.CameraManager.AddCamera(cam);
}