本文整理汇总了C#中GraphicFactory.GetBasicEffect方法的典型用法代码示例。如果您正苦于以下问题:C# GraphicFactory.GetBasicEffect方法的具体用法?C# GraphicFactory.GetBasicEffect怎么用?C# GraphicFactory.GetBasicEffect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GraphicFactory
的用法示例。
在下文中一共展示了GraphicFactory.GetBasicEffect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Initialize
public override void Initialize(GraphicInfo ginfo, GraphicFactory factory, IObject obj)
{
effect = factory.GetBasicEffect();
base.Initialize(ginfo,factory,obj);
effect.PreferPerPixelLighting = true;
SetDescription(desc);
}
示例2: PrimitiveBatch
// the constructor creates a new PrimitiveBatch and sets up all of the internals
// that PrimitiveBatch will need.
public PrimitiveBatch(GraphicFactory factory)
{
device = factory.device;
// set up a new basic effect, and enable vertex colors.
basicEffect = factory.GetBasicEffect();
basicEffect.VertexColorEnabled = true;
}
示例3: Border
public Border(FarseerWorld world, GraphicFactory factory, GraphicInfo ginfo, Texture2D texture)
{
_world = world.World;
float halfWidth = ConvertUnits.ToSimUnits(ginfo.Viewport.Width) / 2f - 0.75f;
float halfHeight = ConvertUnits.ToSimUnits(ginfo.Viewport.Height) / 2f - 0.75f;
Vertices borders = new Vertices(4);
borders.Add(new Vector2(-halfWidth, halfHeight));
borders.Add(new Vector2(halfWidth, halfHeight));
borders.Add(new Vector2(halfWidth, -halfHeight));
borders.Add(new Vector2(-halfWidth, -halfHeight));
_anchor = BodyFactory.CreateLoopShape(_world, borders);
_anchor.CollisionCategories = Category.All;
_anchor.CollidesWith = Category.All;
_basicEffect = factory.GetBasicEffect();
_basicEffect.VertexColorEnabled = true;
_basicEffect.TextureEnabled = true;
_basicEffect.Texture = texture;
VertexPositionColorTexture[] vertice = new VertexPositionColorTexture[8];
vertice[0] = new VertexPositionColorTexture(new Vector3(-halfWidth, -halfHeight, 0f),
Color.LightGray, new Vector2(-halfWidth, -halfHeight) / 5.25f);
vertice[1] = new VertexPositionColorTexture(new Vector3(halfWidth, -halfHeight, 0f),
Color.LightGray, new Vector2(halfWidth, -halfHeight) / 5.25f);
vertice[2] = new VertexPositionColorTexture(new Vector3(halfWidth, halfHeight, 0f),
Color.LightGray, new Vector2(halfWidth, halfHeight) / 5.25f);
vertice[3] = new VertexPositionColorTexture(new Vector3(-halfWidth, halfHeight, 0f),
Color.LightGray, new Vector2(-halfWidth, halfHeight) / 5.25f);
vertice[4] = new VertexPositionColorTexture(new Vector3(-halfWidth - 2f, -halfHeight - 2f, 0f),
Color.LightGray,
new Vector2(-halfWidth - 2f, -halfHeight - 2f) / 5.25f);
vertice[5] = new VertexPositionColorTexture(new Vector3(halfWidth + 2f, -halfHeight - 2f, 0f),
Color.LightGray,
new Vector2(halfWidth + 2f, -halfHeight - 2f) / 5.25f);
vertice[6] = new VertexPositionColorTexture(new Vector3(halfWidth + 2f, halfHeight + 2f, 0f),
Color.LightGray,
new Vector2(halfWidth + 2f, halfHeight + 2f) / 5.25f);
vertice[7] = new VertexPositionColorTexture(new Vector3(-halfWidth - 2f, halfHeight + 2f, 0f),
Color.LightGray,
new Vector2(-halfWidth - 2f, halfHeight + 2f) / 5.25f);
_borderVerts = new VertexPositionColorTexture[24];
_borderVerts[0] = vertice[0];
_borderVerts[1] = vertice[5];
_borderVerts[2] = vertice[4];
_borderVerts[3] = vertice[0];
_borderVerts[4] = vertice[1];
_borderVerts[5] = vertice[5];
_borderVerts[6] = vertice[1];
_borderVerts[7] = vertice[6];
_borderVerts[8] = vertice[5];
_borderVerts[9] = vertice[1];
_borderVerts[10] = vertice[2];
_borderVerts[11] = vertice[6];
_borderVerts[12] = vertice[2];
_borderVerts[13] = vertice[7];
_borderVerts[14] = vertice[6];
_borderVerts[15] = vertice[2];
_borderVerts[16] = vertice[3];
_borderVerts[17] = vertice[7];
_borderVerts[18] = vertice[3];
_borderVerts[19] = vertice[4];
_borderVerts[20] = vertice[7];
_borderVerts[21] = vertice[3];
_borderVerts[22] = vertice[0];
_borderVerts[23] = vertice[4];
}
示例4: Initialize
/// <summary>
/// Initializes this instance.
/// </summary>
public virtual void Initialize(GraphicInfo ginfo, GraphicFactory factory, IObject obj)
{
#if !WINDOWS_PHONE && !REACH
basicDraw = factory.GetEffect("clippingPlane", false, true);
getDepth = factory.GetEffect("ShadowDepth",false,true);
BasicDrawSamplerState = SamplerState.LinearWrap;
#endif
if (useOcclusionCulling)
{
if(Modelo==null)
Modelo = new SimpleModel(factory, "block", true);
if (BasicEffect == null)
{
BasicEffect = factory.GetBasicEffect();
BasicEffect.TextureEnabled = false;
BasicEffect.VertexColorEnabled = false;
}
if (BlendState == null)
{
BlendState = new Microsoft.Xna.Framework.Graphics.BlendState();
BlendState.ColorWriteChannels = ColorWriteChannels.None;
}
OcclusionQuery = factory.CreateOcclusionQuery();
OcclusionQuery.Tag = "Begin";
}
this.GraphicFactory = factory;
isInitialized = true;
}