本文整理汇总了C#中GraphicFactory类的典型用法代码示例。如果您正苦于以下问题:C# GraphicFactory类的具体用法?C# GraphicFactory怎么用?C# GraphicFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
GraphicFactory类属于命名空间,在下文中一共展示了GraphicFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
///Create the Terrain Object
///Controls how the heigh map is loaded
TerrainObject to = new TerrainObject(factory, "..\\Content\\Textures\\Untitled", Vector3.Zero, Matrix.Identity, MaterialDescription.DefaultBepuMaterial(), 1, 1,10);
///Create the Model using the Terrain Object. Here we pass the textures used, in our case we are using MultiTextured Terrain so we pass lots of textures
TerrainModel stm = new TerrainModel(factory, to, "TerrainName", "..\\Content\\Textures\\Terraingrass");
stm.SetTexture(factory.CreateTexture2DColor(1,1,Color.Green), TextureType.DIFFUSE);
///Create the shader
///In this sample we passed lots of textures, each one describe a level in the terrain, the ground is the sand and grass. the hills are rocks and the "mountains" are snow
///They are interpolated in the shader, you can control how using the shader parameters exposed in the DeferredTerrainShader
ForwardXNABasicShader shader = new ForwardXNABasicShader();
///Deferred material
ForwardMaterial fmaterial = new ForwardMaterial(shader);
///The object itself
IObject obj = new IObject(fmaterial, stm, to);
///Add to the world
this.World.AddObject(obj);
shader.BasicEffect.EnableDefaultLighting();
CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo.Viewport);
this.World.CameraManager.AddCamera(cam);
}
示例3: Initialize
/// <summary>
/// Initializes this instance.
/// </summary>
/// <param name="ginfo"></param>
/// <param name="factory"></param>
/// <param name="obj"></param>
public override void Initialize(GraphicInfo ginfo, GraphicFactory factory, IObject obj)
{
effect = factory.GetAlphaTestEffect();
effect.ReferenceAlpha = alphaToCut;
effect.AlphaFunction = CompareFunction;
base.Initialize(ginfo,factory,obj);
}
示例4: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
base.LoadContent(GraphicInfo, factory, contentManager);
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
ConfigWriter cw = new ConfigWriter("teste.properties");
cw.AddKeyValue("teste", "value");
cw.Write();
ConfigReader cr = new ConfigReader("teste.properties");
cr.Read();
String v = cr.ReadValue("teste");
System.Diagnostics.Debug.Assert(v == "value");
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
this.RenderTechnic.AddPostEffect(new BlackWhitePostEffect());
}
示例5: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
base.LoadContent(GraphicInfo,factory, contentManager);
ExtractXmlModelLoader ext = new ExtractXmlModelLoader("Content//ModelInfos//", "Model//", "Textures//");
ModelLoaderData data = ext.Load(factory, GraphicInfo, "leonScene");
WorldLoader wl = new WorldLoader();
wl.OnCreateIObject += new CreateIObject(wl_OnCreateIObject);
wl.OnCreateILight += new CreateILight(wl_OnCreateILight);
wl.LoadWorld(factory, GraphicInfo, World, data);
//IModelo model = new SimpleModel(factory, "Model/leonScene");
//IPhysicObject po = new TriangleMeshObject(model, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
//GhostObject po = new GhostObject();
//IShader shader = new ForwardXNABasicShader();
//ForwardMaterial dm = new ForwardMaterial(shader);
//this.World.AddObject(new IObject(dm, model, po));
CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);
cam.MoveSpeed *= 5;
this.World.CameraManager.AddCamera(cam);
this.RenderTechnic.AddPostEffect(new AntiAliasingPostEffectStalker());
}
示例6: 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);
}
示例7: 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());
}
示例8: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
base.LoadContent(GraphicInfo, factory, contentManager);
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//uzi");
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, new Vector3(18 * j, 10, 8 * i), 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);
obj.OnUpdate += new OnUpdate(obj_OnUpdate);
this.World.AddObject(obj);
}
}
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
}
示例9: 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);
///Uncoment to add your model
SimpleModel simpleModel = new SimpleModel(factory, "Model/cenario");
///Physic info (position, rotation and scale are set here)
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
///Forward Shader (look at this shader construction for more info)
ForwardXNABasicShader shader = new ForwardXNABasicShader();
///Deferred material
ForwardMaterial fmaterial = new ForwardMaterial(shader);
///The object itself
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
///Add to the world
this.World.AddObject(obj);
///add a camera
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
///task sample
taskSample taskSample = new taskSample();
///when ended, call this (syncronous -- specified in the itask implementation) function
taskSample.Ended += new Action<ITask, IAsyncResult>(taskSample_Ended);
///create and send the task to the processor
TaskCommand TaskCommand = new TaskCommand(taskSample);
CommandProcessor.getCommandProcessor().SendCommandAssyncronous(TaskCommand);
}
示例10: SimpleModel
internal SimpleModel(GraphicFactory factory, String modelName, bool isInternal, String diffuseTextureName = null, bool forceFromDisk = false)
: base(isInternal,factory, modelName,false)
{
this.forceFromDisk = forceFromDisk;
this._diffuseName = diffuseTextureName;
LoadModel(factory, out BatchInformations, out TextureInformations);
}
示例11: iInit
internal void iInit(GraphicInfo ginfo, GraphicFactory factory)
{
this.graphicFactory = factory;
this.graphicInfo = ginfo;
isEnabled = true;
Init(ginfo,factory);
}
示例12: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
base.LoadContent(GraphicInfo, factory, contentManager);
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//uzi");
MobileMeshObject tmesh = new MobileMeshObject(simpleModel, new Vector3(100, 100, 10), Matrix.Identity, Vector3.One * 50, MaterialDescription.DefaultBepuMaterial(),BEPUphysics.CollisionShapes.MobileMeshSolidity.DoubleSided,10);
//TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, new Vector3(100, 100, 10), Matrix.Identity, Vector3.One * 50, MaterialDescription.DefaultBepuMaterial());
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
new LightThrowBepu(this.World, factory);
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
}
示例13: 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);
///Uncoment to add your model
SimpleModel simpleModel = new SimpleModel(factory, "Model/cenario");
///Physic info (position, rotation and scale are set here)
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
///Forward Shader (look at this shader construction for more info)
ForwardXNABasicShader shader = new ForwardXNABasicShader();
///Forward material
ForwardMaterial fmaterial = new ForwardMaterial(shader);
///The object itself
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
///Add to the world
this.World.AddObject(obj);
this.RenderTechnic.AddPostEffect(MotionBlurPostEffect);
this.RenderTechnic.AddPostEffect(BloomPostEffect);
BloomPostEffect.Enabled = false;
MotionBlurPostEffect.Enabled = false;
blurdefault = MotionBlurPostEffect.Amount;
RotatingCamera cam = new RotatingCamera(this, new Vector3(0,-100,-400));
this.World.CameraManager.AddCamera(cam);
RasterizerState = new RasterizerState();
RasterizerState.CullMode = CullMode.None;
}
示例14: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
base.LoadContent(GraphicInfo, factory, contentManager);
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
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());
}
示例15: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
base.LoadContent(GraphicInfo, factory, contentManager);
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
var newCameraFirstPerson = new CameraStatic(new Vector3(100,100,100), - new Vector3(100,100,100) );
this.World.CameraManager.AddCamera(newCameraFirstPerson);
SimpleConcreteGestureInputPlayable SimpleConcreteGestureInputPlayable = new SimpleConcreteGestureInputPlayable(Microsoft.Xna.Framework.Input.Touch.GestureType.DoubleTap, (sample) => doubleTapCount++);
this.BindInput(SimpleConcreteGestureInputPlayable);
this.BindInput(new SimpleConcreteGestureInputPlayable(Microsoft.Xna.Framework.Input.Touch.GestureType.Hold,
(sample) =>
{
this.RemoveInputBinding(SimpleConcreteGestureInputPlayable);
doubleTapDisabled = true;
}
));
}