本文整理汇总了C#中PloobsEngine.Modelo.SimpleModel.SetTexture方法的典型用法代码示例。如果您正苦于以下问题:C# SimpleModel.SetTexture方法的具体用法?C# SimpleModel.SetTexture怎么用?C# SimpleModel.SetTexture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PloobsEngine.Modelo.SimpleModel
的用法示例。
在下文中一共展示了SimpleModel.SetTexture方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SpawnPrimitive
/// <summary>
/// Create a simple Sphere object
/// </summary>
/// <param name="pos"></param>
/// <param name="ori"></param>
/// <returns></returns>
private IObject SpawnPrimitive(Vector3 pos, Matrix ori)
{
///Load a Model with a custom texture
sm2 = new SimpleModel(factory,"Model\\ball");
sm2.SetTexture(factory.CreateTexture2DColor(1,1,Color.White,false), TextureType.DIFFUSE);
IMaterial m;
if (forward)
{
ForwardXNABasicShader nd = new ForwardXNABasicShader();
m = new ForwardMaterial(nd);
}
else
{
DeferredNormalShader nd = new DeferredNormalShader();
m = new DeferredMaterial(nd);
}
PhysxPhysicWorld PhysxPhysicWorld = _mundo.PhysicWorld as PhysxPhysicWorld;
///First we create a shape description
SphereShapeDescription SphereGeometry = new SphereShapeDescription(ballSize);
///then we create the physic object
PhysxPhysicObject PhysxPhysicObject = new PhysxPhysicObject(SphereGeometry,
0.5f, Matrix.CreateTranslation(pos), Vector3.One * ballSize);
IObject o = new IObject(m, sm2, PhysxPhysicObject);
return o;
}
示例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: 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);
}
示例4: 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);
RegisterDebugDrawCommand rc = new RegisterDebugDrawCommand(ddrawer);
CommandProcessor.getCommandProcessor().SendCommandAssyncronous(rc);
dlines = new DebugLines();
ddrawer.AddShape(dlines);
Picking pick = new Picking(this,2000);
pick.OnPickedLeftButton += new OnPicked(pick_OnPickedLeftButton);
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//block");
simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.White), TextureType.DIFFUSE);
///Physic info (position, rotation and scale are set here)
BoxObject tmesh = new BoxObject(Vector3.Zero, 1, 1, 1, 10, new Vector3(1000, 1, 1000), Matrix.Identity, MaterialDescription.DefaultBepuMaterial());
tmesh.isMotionLess = true;
///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);
}
wh = new WaypointHandler();
wh.LoadConnectedWaypoints("waypoints.xml");
start = wh.CurrentWaypointsCollection.GetWaypointsList()[0];
{
///Procedural yellow diffuse texture
SimpleModel sm = new SimpleModel(factory, "Model\\block");
sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Yellow), TextureType.DIFFUSE);
///physic Ghost object(no collision)
GhostObject pi = new GhostObject(start.WorldPos, Matrix.Identity, new Vector3(5));
ForwardXNABasicShader s = new ForwardXNABasicShader();
ForwardMaterial mat = new ForwardMaterial(s);
IObject obj4 = new IObject(mat, sm, pi);
this.World.AddObject(obj4);
}
///add a camera
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
{
SimpleModel sm = new SimpleModel(factory, "Model\\block");
sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Blue), TextureType.DIFFUSE);
GhostObject pi = new GhostObject(start.WorldPos, Matrix.Identity, new Vector3(5));
ForwardXNABasicShader s = new ForwardXNABasicShader();
ForwardMaterial mat = new ForwardMaterial(s);
IObject obj4 = new IObject(mat, sm, pi);
obj4.OnUpdate += new OnUpdate(obj4_OnUpdate);
this.World.AddObject(obj4);
}
}
示例5: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld;
base.LoadContent(GraphicInfo, factory, contentManager);
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
StillDesign.PhysX.Material material1 = PhysxPhysicWorld.CreatePhysicMaterial(
new StillDesign.PhysX.MaterialDescription()
{
Restitution = 0.3f,
DynamicFriction = 0.5f,
StaticFriction = 1,
}
);
PhysxTriangleMesh tmesh = new PhysxTriangleMesh(PhysxPhysicWorld, simpleModel,
Matrix.Identity, Vector3.One, 1, material1);
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory);
this.AttachCleanUpAble(BallThrowBullet);
for (int i = 0; i < 10; i++)
{
StillDesign.PhysX.Material material2 = PhysxPhysicWorld.CreatePhysicMaterial(
new StillDesign.PhysX.MaterialDescription()
{
Restitution = PloobsEngine.Utils.StaticRandom.RandomBetween(0,1),
DynamicFriction = PloobsEngine.Utils.StaticRandom.RandomBetween(0, 1),
StaticFriction = PloobsEngine.Utils.StaticRandom.RandomBetween(0, 1),
RestitutionCombineMode = CombineMode.Max,
}
);
///Load a Model with a custom texture
SimpleModel sm2 = new SimpleModel(factory, "Model\\ball");
sm2.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Green, false), TextureType.DIFFUSE);
ForwardXNABasicShader nd = new ForwardXNABasicShader();
IMaterial m = new ForwardMaterial(nd);
SphereShapeDescription SphereGeometry = new SphereShapeDescription(5f);
SphereGeometry.Material = material2;
PhysxPhysicObject PhysxPhysicObject = new PhysxPhysicObject(SphereGeometry,
0.5f, Matrix.CreateTranslation(new Vector3(100,100,50 * i)), Vector3.One * 5f);
IObject o = new IObject(m, sm2, PhysxPhysicObject);
this.World.AddObject(o);
}
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
}
示例6: DefaultTriangleMeshObj
protected IObject DefaultTriangleMeshObj(String modelName, Color color, Vector3 position, Vector3? scale = null, Matrix? orientation = null)
{
SimpleModel simpleModel = new SimpleModel(GraphicFactory, modelName);
simpleModel.SetTexture(color);
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, position, orientation, scale);
ForwardMaterial fmaterial = ForwardMaterial.DefaultForwardMaterial();
return new IObject(fmaterial, simpleModel, tmesh);
}
示例7: DefaultBoxObj
protected IObject DefaultBoxObj(String modelName, Color color, Vector3 position, Vector3? scale = null, float mass = 10, Matrix? orientation = null)
{
SimpleModel simpleModel = new SimpleModel(GraphicFactory, modelName);
simpleModel.SetTexture(color);
BoxObject tmesh = new BoxObject(position, 1, 1, 1, mass, scale, orientation);
ForwardMaterial fmaterial = ForwardMaterial.DefaultForwardMaterial();
return new IObject(fmaterial, simpleModel, tmesh);
}
示例8: DefaultSphereObj
protected IObject DefaultSphereObj(String modelName, Color color, Vector3 position, float radius, float scale = 1, float mass = 10)
{
SimpleModel simpleModel = new SimpleModel(GraphicFactory, modelName);
simpleModel.SetTexture(color);
SphereObject tmesh = new SphereObject(position, radius,mass,scale);
ForwardMaterial fmaterial = ForwardMaterial.DefaultForwardMaterial();
return new IObject(fmaterial, simpleModel, tmesh);
}
示例9: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
base.LoadContent(GraphicInfo, factory, contentManager);
SerializatorWrapper SerializatorWrapper = new SerializatorWrapper();
SerializatorWrapper.Serialize(new Vector3(10, 20, 30), "vetor.xml");
Vector3 vec = (Vector3) SerializatorWrapper.Desserialize<Vector3>("vetor.xml", null);
Debug.Assert(vec.X == 10);
Debug.Assert(vec.Y == 20);
Debug.Assert(vec.Z == 30);
ObjectMock ObjectMock = new ObjectMock(GraphicFactory, "Model/cenario", Vector3.Zero, Matrix.Identity, Vector3.One);
SerializatorWrapper.Serialize(ObjectMock, "cena.xml");
ObjectMock mloaded = (ObjectMock)SerializatorWrapper.Desserialize<ObjectMock>("cena.xml", GraphicFactory);
this.World.AddObject(mloaded);
IObject obj;
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//ball");
simpleModel.SetTexture(factory.CreateTexture2DColor(1,1,Color.Green),TextureType.DIFFUSE);
SphereObject tmesh = new SphereObject(new Vector3(100, 200, 10), 1 ,10, 5, MaterialDescription.DefaultBepuMaterial());
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
this.BindInput(new SimpleConcreteKeyboardInputPlayable(StateKey.PRESS, Keys.Space,
(a) =>
{
this.World.RemoveObject(obj);
DynamicObjectSaver DynamicObjectSaver = new Serialization.DynamicObjectSaver(obj.Modelo.Name, obj.PhysicObject.Position, obj.PhysicObject.Rotation, obj.PhysicObject.Scale, obj.PhysicObject.Velocity, obj.PhysicObject.AngularVelocity);
SerializatorWrapper.Serialize(DynamicObjectSaver, "dyn.xml");
DynamicObjectSaver dloaded = (DynamicObjectSaver)SerializatorWrapper.Desserialize<DynamicObjectSaver>("dyn.xml");
SimpleModel simpleModel = new SimpleModel(factory, dloaded.modelName);
simpleModel.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Green), TextureType.DIFFUSE);
SphereObject tmesh = new SphereObject(dloaded.position, 1, 10, dloaded.scale.X, MaterialDescription.DefaultBepuMaterial());
tmesh.Rotation = dloaded.orientation;
tmesh.Velocity = dloaded.LinearVelocity;
tmesh.AngularVelocity = dloaded.AngularVelocity;
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
saved++;
}
));
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
}
示例10: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
base.LoadContent(GraphicInfo, factory, contentManager);
{
SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\block");
sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Blue), TextureType.DIFFUSE);
DeferredNormalShader shader = new DeferredNormalShader();
IMaterial mat = new DeferredMaterial(shader);
CharacterControllerInput character = new CharacterControllerInput(this, new Vector3(100, 150, 1), 1, 1, 50, Vector3.One * 10,0.5f);
marine = new IObject(mat, sm, character.Characterobj);
this.World.AddObject(marine);
LightThrowBepu lt = new LightThrowBepu(this.World, factory);
}
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
DeferredNormalShader shader = new DeferredNormalShader();
DeferredMaterial fmaterial = new DeferredMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
#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(GraphicInfo);
cam.MoveSpeed *= 5;
this.World.CameraManager.AddCamera(cam);
SkyBoxSetTextureCube stc = new SkyBoxSetTextureCube("Textures//grasscube");
CommandProcessor.getCommandProcessor().SendCommandAssyncronous(stc);
}
示例11: 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());
DeferredNormalShader shader = new DeferredNormalShader();
DeferredMaterial fmaterial = new DeferredMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
{
SimpleModel sm = new SimpleModel(factory, "..\\Content\\Model\\block");
sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.White), TextureType.DIFFUSE);
BoxObject pi = new BoxObject(new Vector3(100, 40, 0), 1, 1, 1, 25, new Vector3(100, 10, 100), Matrix.Identity, MaterialDescription.DefaultBepuMaterial());
DeferredNormalShader shader = new DeferredNormalShader();
IMaterial mat = new DeferredMaterial(shader);
IObject obj3 = new IObject(mat, sm, pi);
this.World.AddObject(obj3);
}
#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
//SBlurPost hsv = new SBlurPost(1, SurfaceFormat.HdrBlendable);
//hsv.ImageSamplerState = SamplerState.PointClamp;
//this.RenderTechnic.AddPostEffect(hsv);
DownSamplePostEffect DownSamplePostEffect = new Post.DownSamplePostEffect();
this.RenderTechnic.AddPostEffect(DownSamplePostEffect);
CameraFirstPerson cam = new CameraFirstPerson(GraphicInfo);
cam.MoveSpeed *= 5;
this.World.CameraManager.AddCamera(cam);
LightThrowBepu lt = new LightThrowBepu(this.World, factory);
}
示例12: SpawnPrimitive
/// <summary>
/// Create a simple Sphere object
/// </summary>
/// <param name="pos"></param>
/// <param name="ori"></param>
/// <returns></returns>
private IObject SpawnPrimitive(Vector3 pos, Matrix ori)
{
///Load a Model with a custom texture
SimpleModel sm2 = new SimpleModel(factory,"Model\\ball");
sm2.SetTexture(factory.CreateTexture2DColor(1,1,Color.White,false), TextureType.DIFFUSE);
ForwardXNABasicShader nd = new ForwardXNABasicShader();
IMaterial m = new ForwardMaterial(nd);
SphereObject pi2 = new SphereObject(pos, 1,0.5f,1,MaterialDescription.DefaultBepuMaterial());
IObject o = new IObject(m,sm2,pi2);
return o;
}
示例13: SpawnPrimitive
/// <summary>
/// Create a simple Sphere object
/// </summary>
/// <param name="pos"></param>
/// <param name="ori"></param>
/// <returns></returns>
private IObject SpawnPrimitive(Vector3 pos, Matrix ori)
{
///Load a Model with a custom texture
SimpleModel sm2 = new SimpleModel(factory,"Model\\ball");
sm2.SetTexture(factory.CreateTexture2DColor(1,1,Color.White,false), TextureType.DIFFUSE);
ForwardXNABasicShader nd = new ForwardXNABasicShader();
IMaterial m = new ForwardMaterial(nd);
BulletPhysicObject BulletPhysicObject = new BulletPhysicObject(new SphereShape(1), pos, Matrix.Identity, Vector3.One , 10);
IObject o = new IObject(m, sm2, BulletPhysicObject);
return o;
}
示例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 sm = new SimpleModel(factory, "..\\Content\\Model\\block");
sm.SetTexture(factory.CreateTexture2DColor(1, 1, Color.Blue), TextureType.DIFFUSE);
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
CharacterControllerInput character = new CharacterControllerInput(this, new Vector3(100, 150, 1), 1, 1, 50, Vector3.One * 10, 0.5f);
BaseObject marine = new BaseObject(fmaterial, character.Characterobj,sm);
this.World.AddObject(marine);
///ever !!!
marine.Behavior = new Repeater<BaseObject>(
new Watch<BaseObject>(
(a,b)=>
{
///condition
if(a.PhysicObject.Position.Length() < 100)
{
return TaskResult.Failure;
}
return TaskResult.Success;
}
,
///chnage its color =P
new BehaviorTrees.Action<BaseObject>(
(a,b)=>
{
a.Modelo.SetTexture(factory.CreateTexture2DColor(1,1,StaticRandom.RandomColor()),TextureType.DIFFUSE);
return TaskResult.Success;
}
)
)
);
}
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
}
示例15: SpawnPrimitive
/// <summary>
/// Create a simple Sphere object
/// </summary>
/// <param name="pos"></param>
/// <param name="ori"></param>
/// <returns></returns>
private IObject SpawnPrimitive(Vector3 pos, Matrix ori)
{
///Load a Model with a custom texture
SimpleModel sm2 = new SimpleModel(factory, "Model\\ball");
sm2.SetTexture(factory.CreateTexture2DColor(1, 1, Color.White, false), TextureType.DIFFUSE);
ForwardXNABasicShader nd = new ForwardXNABasicShader();
IMaterial m = new ForwardMaterial(nd);
PhysxPhysicWorld PhysxPhysicWorld = _mundo.PhysicWorld as PhysxPhysicWorld;
SphereGeometry SphereGeometry = new PhysX.SphereGeometry(1);
PhysxPhysicObject PhysxPhysicObject = new PloobsEngine.Physics3x.PhysxPhysicObject(PhysxPhysicWorld.Scene, SphereGeometry,
10, Matrix.Identity, Matrix.CreateTranslation(pos), Vector3.One, PloobsEngine.Physics.MaterialDescription.DefaultPhysxMaterial());
IObject o = new IObject(m, sm2, PhysxPhysicObject);
return o;
}