本文整理汇总了C#中ITexture类的典型用法代码示例。如果您正苦于以下问题:C# ITexture类的具体用法?C# ITexture怎么用?C# ITexture使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ITexture类属于命名空间,在下文中一共展示了ITexture类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: VirtualMachine
public VirtualMachine(BytecodeContainer bytecode, int numContexts)
{
if (bytecode.Shader.Version.ProgramType == ProgramType.PixelShader && numContexts % 4 != 0)
throw new ArgumentOutOfRangeException("numContexts", "numContexts must be a multiple of 4 for pixel shaders.");
_bytecode = bytecode;
var instructionTokens = bytecode.Shader.Tokens.OfType<InstructionToken>().ToArray();
var branchingInstructions = ExplicitBranchingRewriter.Rewrite(instructionTokens);
var controlFlowGraph = ControlFlowGraph.FromInstructions(branchingInstructions);
_executableInstructions = ExecutableInstructionRewriter.Rewrite(controlFlowGraph).ToArray();
_requiredRegisters = RequiredRegisters.FromShader(bytecode.Shader);
_executionContexts = new ExecutionContext[numContexts];
for (int i = 0; i < _executionContexts.Length; i++)
_executionContexts[i] = new ExecutionContext(this, i, _requiredRegisters);
ConstantBuffers = new Number4[_requiredRegisters.ConstantBuffers.Count][];
for (int i = 0; i < _requiredRegisters.ConstantBuffers.Count; i++)
ConstantBuffers[i] = new Number4[_requiredRegisters.ConstantBuffers[i]];
TextureSamplers = new TextureSampler[_requiredRegisters.Resources.Count];
for (int i = 0; i < _requiredRegisters.Resources.Count; i++)
TextureSamplers[i] = TextureSamplerFactory.Create(_requiredRegisters.Resources[i]);
Textures = new ITexture[_requiredRegisters.Resources.Count];
Samplers = new SamplerState[_requiredRegisters.Samplers];
}
开发者ID:modulexcite,项目名称:slimshader,代码行数:29,代码来源:VirtualMachine.cs
示例2: Create
public IEnumerable<MapObject> Create(IDGenerator generator, Box box, ITexture texture)
{
var solid = new Solid(generator.GetNextObjectID()) { Colour = Colour.GetRandomBrushColour() };
// The lower Z plane will be base, the x planes will be triangles
var c1 = new Coordinate(box.Start.X, box.Start.Y, box.Start.Z);
var c2 = new Coordinate(box.End.X, box.Start.Y, box.Start.Z);
var c3 = new Coordinate(box.End.X, box.End.Y, box.Start.Z);
var c4 = new Coordinate(box.Start.X, box.End.Y, box.Start.Z);
var c5 = new Coordinate(box.Center.X, box.Start.Y, box.End.Z);
var c6 = new Coordinate(box.Center.X, box.End.Y, box.End.Z);
var faces = new[]
{
new[] { c1, c2, c3, c4 },
new[] { c2, c1, c5 },
new[] { c5, c6, c3, c2 },
new[] { c4, c3, c6 },
new[] { c6, c5, c1, c4 }
};
foreach (var arr in faces)
{
var face = new Face(generator.GetNextFaceID())
{
Parent = solid,
Plane = new Plane(arr[0], arr[1], arr[2]),
Colour = solid.Colour,
Texture = { Texture = texture }
};
face.Vertices.AddRange(arr.Select(x => new Vertex(x, face)));
face.UpdateBoundingBox();
face.AlignTextureToFace();
solid.Faces.Add(face);
}
solid.UpdateBoundingBox();
yield return solid;
}
开发者ID:jpiolho,项目名称:sledge,代码行数:35,代码来源:WedgeBrush.cs
示例3: LevelView
public LevelView(ILevel level, ISpriteBatch spriteBatch, ITexture texture, ICamera camera)
{
_level = level;
_spriteBatch = spriteBatch;
_texture = texture;
_camera = camera;
}
开发者ID:zakvdm,项目名称:Frenetic,代码行数:7,代码来源:LevelView.cs
示例4: SampleLevel
/// <summary>
///
/// </summary>
/// <param name="texture"></param>
/// <param name="samplerState"></param>
/// <param name="location"></param>
/// <param name="lod">A number that specifies the mipmap level. If the value is <=0, the zero'th (biggest map)
/// is used. The fractional value (if supplied) is used to interpolate between two mipmap levels.</param>
/// <returns></returns>
public Number4 SampleLevel(
ITexture texture, SamplerState samplerState,
ref Number4 location,
float lod)
{
// TODO: Don't always pass minifying=true to GetFilteredColor.
switch (samplerState.Filter)
{
case Filter.MinPointMagLinearMipPoint:
case Filter.MinLinearMagMipPoint:
case Filter.MinMagLinearMipPoint:
case Filter.MinMagMipPoint:
{
// Calculate nearest mipmap level.
var nearestLevel = MathUtility.Round(lod);
return GetFilteredColor(texture, samplerState, true, nearestLevel, ref location);
}
case Filter.MinLinearMagPointMipLinear:
case Filter.MinMagMipLinear:
case Filter.MinMagPointMipLinear:
case Filter.MinPointMagMipLinear:
{
// Calculate nearest two levels and linearly filter between them.
var nearestLevelInt = (int) lod;
var d = lod - nearestLevelInt;
var c1 = GetFilteredColor(texture, samplerState, true, nearestLevelInt, ref location);
var c2 = GetFilteredColor(texture, samplerState, true, nearestLevelInt + 1, ref location);
return Number4.Lerp(ref c1, ref c2, d);
}
default:
throw new NotSupportedException();
}
}
开发者ID:modulexcite,项目名称:slimshader,代码行数:43,代码来源:TextureSampler.cs
示例5: Create
public IEnumerable<MapObject> Create(IDGenerator generator, Box box, ITexture texture, int roundDecimals)
{
var numSides = (int)_numSides.GetValue();
if (numSides < 3) yield break;
var width = box.Width;
var length = box.Length;
var height = box.Height;
var major = width / 2;
var minor = length / 2;
var heightRadius = height / 2;
var angleV = DMath.DegreesToRadians(180) / numSides;
var angleH = DMath.DegreesToRadians(360) / numSides;
var faces = new List<Coordinate[]>();
var bottom = new Coordinate(box.Center.X, box.Center.Y, box.Start.Z).Round(roundDecimals);
var top = new Coordinate(box.Center.X, box.Center.Y, box.End.Z).Round(roundDecimals);
for (var i = 0; i < numSides; i++)
{
// Top -> bottom
var zAngleStart = angleV * i;
var zAngleEnd = angleV * (i + 1);
var zStart = heightRadius * DMath.Cos(zAngleStart);
var zEnd = heightRadius * DMath.Cos(zAngleEnd);
var zMultStart = DMath.Sin(zAngleStart);
var zMultEnd = DMath.Sin(zAngleEnd);
for (var j = 0; j < numSides; j++)
{
// Go around the circle in X/Y
var xyAngleStart = angleH * j;
var xyAngleEnd = angleH * ((j + 1) % numSides);
var xyStartX = major * DMath.Cos(xyAngleStart);
var xyStartY = minor * DMath.Sin(xyAngleStart);
var xyEndX = major * DMath.Cos(xyAngleEnd);
var xyEndY = minor * DMath.Sin(xyAngleEnd);
var one = (new Coordinate(xyStartX * zMultStart, xyStartY * zMultStart, zStart) + box.Center).Round(roundDecimals);
var two = (new Coordinate(xyEndX * zMultStart, xyEndY * zMultStart, zStart) + box.Center).Round(roundDecimals);
var three = (new Coordinate(xyEndX * zMultEnd, xyEndY * zMultEnd, zEnd) + box.Center).Round(roundDecimals);
var four = (new Coordinate(xyStartX * zMultEnd, xyStartY * zMultEnd, zEnd) + box.Center).Round(roundDecimals);
if (i == 0)
{
// Top faces are triangles
faces.Add(new[] { top, three, four });
}
else if (i == numSides - 1)
{
// Bottom faces are also triangles
faces.Add(new[] { bottom, one, two });
}
else
{
// Inner faces are quads
faces.Add(new[] { one, two, three, four });
}
}
}
yield return MakeSolid(generator, faces, texture, Colour.GetRandomBrushColour());
}
开发者ID:KonstantinUb,项目名称:sledge,代码行数:60,代码来源:SphereBrush.cs
示例6: SetTextureParameter
public void SetTextureParameter(string name, ITexture texture)
{
if (!_textureParameters.ContainsKey(name))
throw new ApplicationException("Texture doesnt exist in this shader");
_textureParameters[name] = texture;
_isDirty = true;
}
开发者ID:dgopena,项目名称:Starter3D.Base,代码行数:7,代码来源:Shader.cs
示例7: CPlayer
public CPlayer(IGameObjectManager pObjMan, IEngineCore pEngineCore)
: base(pObjMan, pEngineCore)
{
_fVelocity = 0f;
uiShotPause = 15;
ObjType = EGameObjectType.GotPlayer;
_stPos = new TPoint2(Res.GameVpWidth / 2f, Res.GameVpHeight / 2f);
_fSize = 150f;
_fColScale = 0.6f;
dimPl = new TPoint3(_fSize, _fSize, _fSize);
IResourceManager pResMan;
IEngineSubSystem pSubSys;
pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_INPUT, out pSubSys);
pInput = (IInput)pSubSys;
pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
pResMan = (IResourceManager)pSubSys;
IEngineBaseObject pBaseObj;
pResMan.GetResourceByName(Res.MeshShip, out pBaseObj);
pMesh = (IMesh)pBaseObj;
pResMan.GetResourceByName(Res.TexShip, out pBaseObj);
pTex = (ITexture)pBaseObj;
pResMan.GetResourceByName(Res.TexSpark, out pBaseObj);
pTexSpark = (ITexture)pBaseObj;
}
开发者ID:whztt07,项目名称:DGLE,代码行数:31,代码来源:CPlayer.cs
示例8: Init
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
public void Init(ITexture diffuse, ITexture normal, ITexture position, ITexture accumulation)
{
this._diffuseBuffer = diffuse;
this._normalBuffer = normal;
this._positionBuffer = position;
this._accBuffer = accumulation;
}
开发者ID:colin-dumitru,项目名称:GLSharp,代码行数:9,代码来源:DepthEffect.cs
示例9: CShot
public CShot(IGameObjectManager pObjMan, IEngineCore pEngineCore, TPoint2 stPos, float fAngle)
: base(pObjMan, pEngineCore)
{
ObjType = EGameObjectType.GotShot;
RenderLayer = 3;
_fSize = 64f;
_fColScale = 0.5f;
this._stPos = stPos;
this._fAngle = fAngle;
IResourceManager pResMan;
IEngineSubSystem pSubSys;
pEngineCore.GetSubSystem(E_ENGINE_SUB_SYSTEM.ESS_RESOURCE_MANAGER, out pSubSys);
pResMan = (IResourceManager)pSubSys;
IEngineBaseObject pBaseObj;
pResMan.GetResourceByName(Res.TexSpark, out pBaseObj);
pTexSpark = (ITexture)pBaseObj;
ISoundSample p_snd;
pResMan.GetResourceByName(Res.SndFire, out pBaseObj);
p_snd = (ISoundSample)pBaseObj;
p_snd.Play();
}
开发者ID:whztt07,项目名称:DGLE,代码行数:25,代码来源:CShot.cs
示例10: SetValue
public void SetValue(string name, ITexture t)
{
var texture = (Texture)t;
var param = Tao.Cg.Cg.cgGetNamedEffectParameter(effect, name);
if (param != IntPtr.Zero && texture != null)
Tao.Cg.CgGl.cgGLSetupSampler(param, texture.texture);
}
开发者ID:jeff-1amstudios,项目名称:OpenRA,代码行数:7,代码来源:Shader.cs
示例11: Bump
public static void Bump(ITexture<double> d, DifferentialGeometry dgGeom, DifferentialGeometry dgShading, ref DifferentialGeometry dgBump)
{
DifferentialGeometry dgEval = new DifferentialGeometry (dgShading);
double du = 0.5 * (Math.Abs (dgShading.dudx) + Math.Abs (dgShading.dudy));
if (du == 0.0)
du = 0.01;
dgEval.p = dgShading.p + du * dgShading.dpdu;
dgEval.u = dgShading.u + du;
dgEval.n = (new Normal(dgShading.dpdu % dgShading.dpdv) + du * dgShading.dndu).Normalized;
double uDisplace = d.Evaluate (dgEval);
double dv = 0.5 * (Math.Abs (dgShading.dvdx) + Math.Abs (dgShading.dvdy));
if (dv == 0.0)
dv = 0.01;
dgEval.p = dgShading.p + dv * dgShading.dpdv;
dgEval.u = dgShading.u;
dgEval.v = dgShading.v + dv;
dgEval.n = (new Normal(dgShading.dpdu % dgShading.dpdv) + dv * dgShading.dndv).Normalized;
double vDisplace = d.Evaluate (dgEval);
double displace = d.Evaluate (dgShading);
dgBump = new DifferentialGeometry (dgShading);
dgBump.dpdu = dgShading.dpdu + (uDisplace - displace) / du * new Vector (dgShading.n) + displace * new Vector (dgShading.dndu);
dgBump.dpdv = dgShading.dpdv + (vDisplace - displace) / dv * new Vector (dgShading.n) + displace * new Vector (dgShading.dndv);
dgBump.n = new Normal((dgBump.dpdu % dgBump.dpdv).Normalized);
if (dgShading.Shape.ReverseOrientation ^ dgShading.Shape.TransformSwapsHandedness)
dgBump.n *= -1.0;
dgBump.n = Util.FaceForward (dgBump.n, dgGeom.n);
}
开发者ID:Kintaro,项目名称:Hyperion,代码行数:34,代码来源:IMaterial.cs
示例12: LoadTexture
public bool LoadTexture(ThW.Render.Textures.Texture texture, ITexture noTexture)
{
Texture2D texture2d = this.contentManager.Load<Texture2D>(texture.Name);
texture.UpdateTexture(texture2d, TextureState.Loaded, texture2d.Width, texture2d.Height);
return true;
}
开发者ID:glocklueng,项目名称:px360,代码行数:7,代码来源:XNAContentTextureLoader.cs
示例13: Create
public IEnumerable<MapObject> Create(IDGenerator generator, Box box, ITexture texture, int roundDecimals)
{
var solid = new Solid(generator.GetNextObjectID()) { Colour = Colour.GetRandomBrushColour() };
// The higher Z plane will be triangle, with the lower X value getting the two corners
var c1 = new Coordinate(box.Start.X, box.Start.Y, box.End.Z).Round(roundDecimals);
var c2 = new Coordinate(box.End.X, box.Start.Y, box.End.Z).Round(roundDecimals);
var c3 = new Coordinate(box.Center.X, box.End.Y, box.End.Z).Round(roundDecimals);
var c4 = new Coordinate(box.Center.X, box.Center.Y, box.Start.Z).Round(roundDecimals);
var faces = new[]
{
new[] { c3, c2, c1 },
new[] { c3, c1, c4 },
new[] { c2, c3, c4 },
new[] { c1, c2, c4 }
};
foreach (var arr in faces)
{
var face = new Face(generator.GetNextFaceID())
{
Parent = solid,
Plane = new Plane(arr[0], arr[1], arr[2]),
Colour = solid.Colour,
Texture = { Texture = texture }
};
face.Vertices.AddRange(arr.Select(x => new Vertex(x, face)));
face.UpdateBoundingBox();
face.AlignTextureToFace();
solid.Faces.Add(face);
}
solid.UpdateBoundingBox();
yield return solid;
}
开发者ID:074769,项目名称:sledge,代码行数:32,代码来源:TetrahedronBrush.cs
示例14: BumpAsync
/// <summary>
///
/// </summary>
/// <param name="d"></param>
/// <param name="dgGeom"></param>
/// <param name="dgShading"></param>
/// <param name="dgBump"></param>
/// <returns></returns>
public static async Task<DifferentialGeometry> BumpAsync (ITexture<double> d, DifferentialGeometry dgGeom, DifferentialGeometry dgShading)
{
var dgBump = new DifferentialGeometry ();
var dgEval = new DifferentialGeometry (dgShading);
var du = .5 * (Math.Abs (dgShading.dudx) + Math.Abs (dgShading.dudy));
if (du == 0.0)
du = .01;
dgEval.p = dgShading.p + du * dgShading.dpdu;
dgEval.u = dgShading.u + du;
dgEval.nn = null;// TODO
var uDisplace = await d.EvaluateAsync (dgEval);
var dv = .5 * (Math.Abs (dgShading.dvdx) + Math.Abs (dgShading.dvdy));
//
var vDisplace = await d.EvaluateAsync (dgEval);
var displace = await d.EvaluateAsync (dgShading);
dgBump = new DifferentialGeometry (dgShading);
dgBump.dpdu = dgShading.dpdu + (uDisplace - displace) / du * new Vector (dgShading.nn) + displace * new Vector (dgShading.dndu);
dgBump.dpdv = dgShading.dpdv + (vDisplace - displace) / dv * new Vector (dgShading.nn) + displace * new Vector (dgShading.dndv);
if (dgShading.Shape.ReverseOrientation ^ dgShading.Shape.TransformSwapsHandedness)
dgBump.nn *= -1.0;
dgBump.nn = Util.FaceForward (dgBump.nn, dgGeom.nn);
return dgBump;
}
开发者ID:Kintaro,项目名称:Art,代码行数:40,代码来源:IMaterial.cs
示例15: ConsoleOverlaySetView
public ConsoleOverlaySetView(IOverlayView inputView, IOverlayView commandConsoleView, IOverlayView messageConsoleView, IOverlayView possibleCommandsView, ISpriteBatch spriteBatch, ITexture texture, IFont font)
: base(spriteBatch, texture, font)
{
_overlays.Add(inputView);
_overlays.Add(commandConsoleView);
_overlays.Add(messageConsoleView);
_overlays.Add(possibleCommandsView);
}
开发者ID:zakvdm,项目名称:Frenetic,代码行数:8,代码来源:ConsoleOverlaySetView.cs
示例16: Draw
public void Draw(ITexture texture, global::System.Drawing.Point position)
{
Texture mainTexture = texture as Texture;
graphicsDevice.BlendState = BlendState.Additive;
spriteBatch.Draw(mainTexture.Texture2D, new Rectangle(position.X, position.Y, texture.Width, texture.Height), new Color(255, 255, 255, texture.Alpha));
}
开发者ID:pzaps,项目名称:CrossGFX,代码行数:8,代码来源:RenderTarget.cs
示例17: SampleGrad
public Number4 SampleGrad(
ITexture texture, SamplerState samplerState,
ref Number4 location,
ref Number4 ddx, ref Number4 ddy)
{
var lod = CalculateLevelOfDetail(texture, samplerState, ref ddx, ref ddy);
return SampleLevel(texture, samplerState, ref location, lod);
}
开发者ID:modulexcite,项目名称:slimshader,代码行数:8,代码来源:TextureSampler.cs
示例18: Create
public IEnumerable<MapObject> Create(IDGenerator generator, Box box, ITexture texture, int roundDecimals)
{
var numsides = (int) _numSides.GetValue();
if (numsides < 3) yield break;
// Cylinders can be elliptical so use both major and minor rather than just the radius
// NOTE: when a low number (< 10ish) of faces are selected this will cause the cylinder to not touch all the edges of the box.
var width = box.Width;
var length = box.Length;
var height = box.Height;
var major = width / 2;
var minor = length / 2;
var angle = 2 * DMath.PI / numsides;
// Calculate the X and Y points for the ellipse
var points = new Coordinate[numsides];
for (var i = 0; i < numsides; i++)
{
var a = i * angle;
var xval = box.Center.X + major * DMath.Cos(a);
var yval = box.Center.Y + minor * DMath.Sin(a);
var zval = box.Start.Z;
points[i] = new Coordinate(xval, yval, zval).Round(roundDecimals);
}
var faces = new List<Coordinate[]>();
// Add the vertical faces
var z = new Coordinate(0, 0, height).Round(roundDecimals);
for (var i = 0; i < numsides; i++)
{
var next = (i + 1) % numsides;
faces.Add(new[] {points[i], points[i] + z, points[next] + z, points[next]});
}
// Add the elliptical top and bottom faces
faces.Add(points.ToArray());
faces.Add(points.Select(x => x + z).Reverse().ToArray());
// Nothing new here, move along
var solid = new Solid(generator.GetNextObjectID()) { Colour = Colour.GetRandomBrushColour() };
foreach (var arr in faces)
{
var face = new Face(generator.GetNextFaceID())
{
Parent = solid,
Plane = new Plane(arr[0], arr[1], arr[2]),
Colour = solid.Colour,
Texture = { Texture = texture }
};
face.Vertices.AddRange(arr.Select(x => new Vertex(x, face)));
face.UpdateBoundingBox();
face.AlignTextureToFace();
solid.Faces.Add(face);
}
solid.UpdateBoundingBox();
yield return solid;
}
开发者ID:074769,项目名称:sledge,代码行数:57,代码来源:CylinderBrush.cs
示例19: Subsurface
public Subsurface(double sc, ITexture<Spectrum> kr, ITexture<Spectrum> sa, ITexture<Spectrum> sps, ITexture<double> e, ITexture<double> bump)
{
Scale = sc;
Kr = kr;
SigmaA = sa;
SigmaPrimeS = sps;
Eta = e;
BumpMap = bump;
}
开发者ID:Kintaro,项目名称:Hyperion,代码行数:9,代码来源:Subsurface.cs
示例20: SetSky
public void SetSky( ITexture texture ) {
Engine.Atmosphere.SkySphere_SetRadius( 1000 );
Engine.Atmosphere.SkySphere_SetTexture( texture.ID );
Engine.Atmosphere.SkySphere_Enable( true );
// Engine.Atmosphere.SkyBox_SetDistance( 1000 );
// Engine.Atmosphere.SkyBox_SetTexture( texture.ID,texture.ID,texture.ID,texture.ID,texture.ID,texture.ID );
// Engine.Atmosphere.SkyBox_Enable(true, true);
}
开发者ID:timothypratley,项目名称:Strive.NET,代码行数:9,代码来源:Scene.cs
注:本文中的ITexture类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论