本文整理汇总了C#中Quad类的典型用法代码示例。如果您正苦于以下问题:C# Quad类的具体用法?C# Quad怎么用?C# Quad使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Quad类属于命名空间,在下文中一共展示了Quad类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Initialize
protected override void Initialize()
{
quad = new Quad[6];
quad[0] = new Quad(Vector3.Backward, Vector3.Backward, Vector3.Up, 2, 2);
quad[1] = new Quad(Vector3.Left, Vector3.Left, Vector3.Up, 2, 2);
quad[2] = new Quad(Vector3.Right, Vector3.Right, Vector3.Up, 2, 2);
quad[3] = new Quad(Vector3.Forward, Vector3.Forward, Vector3.Up, 2, 2);
quad[4] = new Quad(Vector3.Down, Vector3.Down, Vector3.Right, 2, 2);
quad[5] = new Quad(Vector3.Up, Vector3.Up, Vector3.Left, 2, 2);
nh = new NodeHandle();
imgSub = nh.subscribe<Messages.sensor_msgs.Image>("/camera/rgb/image_rect_color", 1, (img) =>
{
if (padlock.WaitOne(10))
{
if (next_texture == null)
{
next_texture = new Texture2D(GraphicsDevice, (int) img.width, (int) img.height);
}
util.UpdateImage(GraphicsDevice, img.data, new Size((int)img.width, (int)img.height), ref next_texture, img.encoding.data);
padlock.ReleaseMutex();
}
});
base.Initialize();
}
开发者ID:rvlietstra,项目名称:ROS.NET,代码行数:25,代码来源:Game1.cs
示例2: OverlapQuads
public static bool OverlapQuads(Quad quad1, Quad quad2) {
bool triIntersect1 = TriTriIntersection.TriTriOverlap.TriTriIntersect(quad1.GetTri1(), quad2.GetTri1());
bool triIntersect2 = TriTriIntersection.TriTriOverlap.TriTriIntersect(quad1.GetTri1(), quad2.GetTri2());
bool triIntersect3 = TriTriIntersection.TriTriOverlap.TriTriIntersect(quad1.GetTri2(), quad2.GetTri1());
bool triIntersect4 = TriTriIntersection.TriTriOverlap.TriTriIntersect(quad1.GetTri2(), quad2.GetTri2());
return triIntersect1 || triIntersect2 || triIntersect3 || triIntersect4;
}
开发者ID:wtrebella,项目名称:Grappler,代码行数:7,代码来源:Quad.cs
示例3: Render
public void Render(GraphicsDeviceManager graphics, Matrix cameraViewMatrix, Matrix cameraProjectionMatrix, ParticleSystem system, Entity camera)
{
// TODO: Fix.
Vector3 ps = new Vector3(pos.X, pos.Y, pos.Z);
if (relativePosition)
{
ps += system.position;
}
Matrix billboardMatrix = Matrix.CreateBillboard(pos, camera.position, camera.getUpVector(), camera.getForwardVector());
if (quad == null)
{
}
quad = new Quad(ps, Vector3.Backward, Vector3.Up, size, size);
quadVertexDeclaration = new VertexDeclaration(graphics.GraphicsDevice, VertexPositionNormalTexture.VertexElements);
foreach (VertexPositionNormalTexture v in quad.Vertices)
{
Vector3.Transform(v.Position, billboardMatrix);
}
graphics.GraphicsDevice.VertexDeclaration = quadVertexDeclaration;
graphics.GraphicsDevice.DrawUserIndexedPrimitives
<VertexPositionNormalTexture>(
PrimitiveType.TriangleList,
quad.Vertices, 0, 4,
quad.Indexes, 0, 2);
}
开发者ID:zzorn,项目名称:Spike3D,代码行数:30,代码来源:ParticleSystem.cs
示例4: Player
public Player(GraphicsDeviceManager _graphics )
{
graphics = _graphics;
spriteEffect = new BasicEffect(graphics.GraphicsDevice);
Position = new Quad(new Vector3(0, 50, 0), Vector3.Backward, Vector3.Up, 100, 100);
}
开发者ID:aldrinmg,项目名称:SadPanda-1,代码行数:7,代码来源:Player.cs
示例5: Main
static void Main(string[] args)
{
Vector v1 = new Vector(0F, 5F, 0F);
Vector v2 = new Vector(5F, 5F, 0F);
Vector v3 = new Vector(0F, 5F, 5F);
Vector v4 = new Vector(5F, 5F, 5F);
Quad quad = new Quad(v1, v2, v3, v4, new MyColor(0F, 0F, 0F));
List<Quad> quads = new List<Quad>();
quads.Add(quad);
Vector observer = new Vector(2F, 6.5F, 3F);
float distanceToGround = MovingTools.DistanceToGround(observer, quads);
/*
float Distance = MovingTools.PointToPlaneDistance(observer, v1, v2, v3);
Console.WriteLine("distance: " + Distance.ToString());
bool intersectWithWall = MovingTools.PointIsWithinRangeOfTriangle(10F, observer, v1, v2, v3);
Console.WriteLine("intersection?: " + intersectWithWall);
v1 = new Vertex(10F, 0F, 0F);
v2 = new Vertex(10F, 3F, 0F);
v3 = new Vertex(0F, 3F, 0F);
observer = new Vertex(8F, 0.1F, 0.1F);
intersectWithWall = MovingTools.PointIsWithinRangeOfTriangle(1F, observer, v1, v2, v3);
Console.WriteLine("intersection?: " + intersectWithWall);
*/
Console.ReadKey();
}
开发者ID:NickStupich,项目名称:game-version1,代码行数:34,代码来源:Geometry.cs
示例6: AdjustPointToNotGoThroughQuad
public static bool AdjustPointToNotGoThroughQuad(float MinDistance, ref Vector observer, Quad quad)
{
Vector ab = quad.vertices[0].Difference(quad.vertices[1]);
Vector ad = quad.vertices[0].Difference(quad.vertices[3]);
Vector N = ab.CrossProduct(ad);
float d = -N.DotProduct(quad.vertices[0]);
float t = -(d + observer.DotProduct(N)) / (N.DotProduct(N));
float Distance = (float)Math.Abs(t * N.Length());
if (Distance > MinDistance)
return false; //too far away, regardless of where you are relative to the wall
Vector projectionOntoTriangle = new Vector(observer.x + t * N.x, observer.y + t * N.y, observer.z + t * N.z);
if (!PointIsInQuad(projectionOntoTriangle, quad))
return false; //outside the quad
//the point needs to be moved
float NormalMultiplier = MinDistance / N.Length();
if (N.x / (observer.x - projectionOntoTriangle.x) < 0
|| N.y / (observer.y - projectionOntoTriangle.y) < 0
|| N.z / (observer.z - projectionOntoTriangle.z) < 0)
NormalMultiplier *= -1.0F;
observer = new Vector(projectionOntoTriangle.x + N.x * NormalMultiplier, projectionOntoTriangle.y + N.y * NormalMultiplier, projectionOntoTriangle.z + N.z * NormalMultiplier);
return true;
}
开发者ID:NickStupich,项目名称:game-version1,代码行数:28,代码来源:MovingTools.cs
示例7: SLQuad
/// <summary>
/// Init SLQuad with Custom Quad Parameters
/// </summary>
/// <param name="gd"></param>
/// <param name="service"></param>
/// <param name="path"></param>
/// <param name="quad"></param>
public SLQuad(GraphicsDevice gd, IServiceProvider service, string path, Quad quad)
: base(gd)
{
Para = quad;
LoadContent(service, path, quad.BasePara.contentname);
Init(gd);
}
开发者ID:babaq,项目名称:StiLib,代码行数:14,代码来源:SLQuad.cs
示例8: HitTestQuadSegment
/// <summary>
/// This is a specialized version of HitTestPolygonSegment that takes
/// a Quad for a polygon. This method is called very intensively by
/// hit-testing API and we don't want to create Vector[] for every quad it hit-tests.
/// </summary>
/// <param name="quad">the connecting quad to test against</param>
/// <param name="hitBegin">begin point of the hitting segment</param>
/// <param name="hitEnd">end point of the hitting segment</param>
/// <returns>true if hit, false otherwise</returns>
internal static bool HitTestQuadSegment(Quad quad, Point hitBegin, Point hitEnd)
{
System.Diagnostics.Debug.Assert(quad.IsEmpty == false);
HitResult hitResult = HitResult.Right, firstResult = HitResult.Right, prevResult = HitResult.Right;
int count = 4;
Vector zeroVector = new Vector(0, 0);
Vector hitVector = hitEnd - hitBegin;
Vector vertex = quad[count - 1] - hitBegin;
for (int i = 0; i < count; i++)
{
Vector nextVertex = quad[i] - hitBegin;
hitResult = WhereIsSegmentAboutSegment(zeroVector, hitVector, vertex, nextVertex);
if (HitResult.Hit == hitResult)
{
return true;
}
if (true == IsOutside(hitResult, prevResult))
{
return false;
}
if (i == 0)
{
firstResult = hitResult;
}
prevResult = hitResult;
vertex = nextVertex;
}
return (false == IsOutside(firstResult, hitResult));
}
开发者ID:sjyanxin,项目名称:WPFSource,代码行数:40,代码来源:StrokeNodeOperations2.cs
示例9: Gen
public void Gen()
{
Vector3D[] verts = Verts( m_m, m_k );
Sphere[] tet = Tetrahedron( verts );
Quad quad = new Quad() { Verts = verts };
// We need to avoid infinities.
//tet = tet.Select( s => H3Models.UHSToBall( s ) ).ToArray();
//for( int i=0; i<quad.Verts.Length; i++ )
// quad.Verts[i] = H3Models.UHSToBall( quad.Verts[i] );
// Reflect it around.
//Quad[] quads = new Quad[] { quad };
Quad[] quads = CalcQuads( tet, quad );
List<H3.Cell.Edge> edges = new List<H3.Cell.Edge>();
foreach( Quad q in quads )
{
q.R3toS3();
edges.AddRange( q.GenEdges() );
}
string filename = string.Format( "lawson_{0}_{1}.pov", m_m, m_k );
PovRay.WriteEdges( new PovRay.Parameters() { AngularThickness = 0.01 },
Geometry.Spherical, edges.ToArray(), filename, append: false );
}
开发者ID:roice3,项目名称:Honeycombs,代码行数:26,代码来源:Lawson.cs
示例10: Beacon
public Beacon( int index, Vector3 position, bool active )
{
rotationScale = Matrix.CreateScale( .5f );
Position = position;
Active = active;
ContentManager content = ZombieCraft.Instance.Content;
model = content.Load<StillModel>( "Models/beacon" );
Texture2D haloTexture = content.Load<Texture2D>( "Textures/halo" );
Vector3[] verts =
{
new Vector3(-1f, 0f,-1f ),
new Vector3( 1f, 0f,-1f ),
new Vector3( 1f, 0f, 1f ),
new Vector3(-1f, 0f, 1f ),
};
halo = new Quad( verts, Position, haloTexture );
switch ( index )
{
case 0:
label = content.Load<Texture2D>( "Textures/beaconLabelA" );
break;
case 1:
label = content.Load<Texture2D>( "Textures/beaconLabelB" );
break;
case 2:
label = content.Load<Texture2D>( "Textures/beaconLabelX" );
break;
}
}
开发者ID:yxrkt,项目名称:outbreak,代码行数:32,代码来源:Beacon.cs
示例11: Initialise
public override void Initialise(Renderer renderer, ResourceContext context)
{
_quad = new Quad(renderer.Device);
//Create geometry management objects
_geometryProviders = renderer.Scene.FindManagers<IGeometryProvider>();
_depthPeeler = new DepthPeel();
var settings = renderer.Settings;
// 1 - Min
// 5 - Default
// 10 - Extreme
settings.Add("transparency_deferred_layers", "the max number of depth peeled layers to use for deferred transparency", 5);
//Make sure deferred lighting is enabled
LightingComponent.SetupScene(renderer.Scene, out _directLights, out _indirectLights);
// define inputs
context.DefineInput("gbuffer_depth");
context.DefineInput("gbuffer_normals");
context.DefineInput("gbuffer_diffuse");
context.DefineInput("lightbuffer");
//define outputs
context.DefineOutput("gbuffer_depth");
context.DefineOutput("lightbuffer", isLeftSet: true, surfaceFormat: SurfaceFormat.HdrBlendable, depthFormat: DepthFormat.Depth24Stencil8);
base.Initialise(renderer, context);
}
开发者ID:xoxota99,项目名称:Myre,代码行数:30,代码来源:DeferredTransparency.cs
示例12: Snowflake
public Snowflake(Vector3 position, float snowflakeTemperature)
{
float diameter = Snowflake.CalculateDiameter(snowflakeTemperature);
this.mass = Snowflake.CalculateMass (snowflakeTemperature, diameter);
this.basicEffect = new BasicEffect(this.graphicsDevice);
this.basicEffect.World = this.camera.World;
this.basicEffect.View = this.camera.View;
this.basicEffect.Projection = this.camera.Projection;
this.basicEffect.TextureEnabled = true;
if (this.showLeaf)
{
this.quad = new Quad(diameter * 2);
Texture2D texture = this.contentManager.Load<Texture2D>("leaf_" + (int)(Snowflake.random.NextDouble() * numTextures));
this.basicEffect.Texture = texture;
}
else
{
this.quad = new Quad(diameter);
Texture2D texture = this.contentManager.Load<Texture2D>("flake_" + (int)(Snowflake.random.NextDouble() * numTextures));
this.basicEffect.Texture = texture;
}
this.Position = position;
this.velocity = new Vector3(0f, -0.1f, 0f);
}
开发者ID:faint32,项目名称:COGR_Snowflake,代码行数:28,代码来源:Snowflake.cs
示例13: GetGeom
protected override DX11IndexedGeometry GetGeom(DX11RenderContext context, int slice)
{
Quad quad = new Quad();
quad.Size = this.FSize[slice];
return context.Primitives.QuadCross(quad);
}
开发者ID:hameleon-ed,项目名称:dx11-vvvv,代码行数:7,代码来源:DX11QuadCrossNode.cs
示例14: GetSortingOrder
private int GetSortingOrder(Quad newQuad, List<Building> buildings) {
int numberToCheck = Mathf.Min(buildings.Count, numBuildingsToCheck);
int sortingOrder;
int? sortingOrderUpperLimit = null;
int? sortingOrderLowerLimit = null;
for (int i = 1; i <= numberToCheck; i++) {
int index = buildings.Count - i;
Building otherBuilding = buildings[index];
Quad otherQuad = otherBuilding.attributes.quad;
if (!Quad.OverlapQuads(newQuad, otherQuad)) continue;
if (newQuad.ContainsTopPointsFromOtherQuad(otherQuad)) {
if (sortingOrderUpperLimit != null) sortingOrderUpperLimit = Mathf.Min((int)sortingOrderUpperLimit, otherBuilding.attributes.sortingOrder);
else sortingOrderUpperLimit = otherBuilding.attributes.sortingOrder;
}
else if (otherQuad.ContainsTopPointsFromOtherQuad(newQuad)) {
if (sortingOrderLowerLimit != null) sortingOrderLowerLimit = Mathf.Max((int)sortingOrderLowerLimit, otherBuilding.attributes.sortingOrder);
else sortingOrderLowerLimit = otherBuilding.attributes.sortingOrder;
}
}
if (sortingOrderLowerLimit == null && sortingOrderUpperLimit == null) sortingOrder = baseSortingOrder;
else if (sortingOrderLowerLimit == null) sortingOrder = (int)sortingOrderUpperLimit - 10;
else if (sortingOrderUpperLimit == null) sortingOrder = (int)sortingOrderLowerLimit + 10;
else sortingOrder = ((int)sortingOrderUpperLimit + (int)sortingOrderLowerLimit) / 2;
return sortingOrder;
}
开发者ID:wtrebella,项目名称:Grappler,代码行数:28,代码来源:BuildingAttributeGenerator.cs
示例15: Initialize
public void Initialize()
{
// TODO: Add your initialization logic here
quad = new Quad( Vector3.Zero, Vector3.Backward, Vector3.Up, 1, 1 );
View = Matrix.CreateLookAt( new Vector3( 0, 0, 2 ), Vector3.Zero, Vector3.Up );
Projection = Matrix.CreatePerspectiveFieldOfView( MathHelper.PiOver4, 4.0f / 3.0f, 1, 500 );
}
开发者ID:tsela85,项目名称:board3d,代码行数:7,代码来源:Quad.cs
示例16: Divide
public Quad[] Divide(Quad quad, int recursion)
{
var minx = quad.minx;
var miny = quad.miny;
var maxx = quad.maxx;
var maxy = quad.maxy;
if (recursion == 0) {
for (var y = miny; y < maxy; y++) {
for (var x = minx; x < maxx; x++) {
var c = _img.GetPixel(x, y);
if (c.a >= _alphaThreshold)
return new Quad[]{ quad };
}
}
return new Quad[0];
}
var midx = (minx + maxx) >> 1;
var midy = (miny + maxy) >> 1;
var quad0 = Divide(new Quad(minx, miny, midx, midy), recursion - 1);
var quad1 = Divide(new Quad(midx, miny, maxx, midy), recursion - 1);
var quad2 = Divide(new Quad(minx, midy, midx, maxy), recursion - 1);
var quad3 = Divide(new Quad(midx, midy, maxx, maxy), recursion - 1);
var nQuads = quad0.Length + quad1.Length + quad2.Length + quad3.Length;
if (quad0.Length == 1 && quad1.Length == 1 && quad2.Length == 1 && quad3.Length == 1)
return new Quad[]{ quad };
var list = new List<Quad>(nQuads);
list.AddRange(quad0);
list.AddRange(quad1);
list.AddRange(quad2);
list.AddRange(quad3);
return list.ToArray();
}
开发者ID:nobnak,项目名称:QuadtreeContour,代码行数:35,代码来源:QuadtreeContour.cs
示例17: CollisionTexture
public CollisionTexture(Quad quad, Texture2D texture)
{
this.quad = quad;
this.texture = texture;
this.textureData = new int[quad.rectangle.Width * quad.rectangle.Height];
}
开发者ID:Wotuu,项目名称:GDD_Game_2,代码行数:7,代码来源:ColorTexture.cs
示例18: Quad
public Quad(QuadRoot tree, Quad parent, Rectangle rectangle)
{
this.tree = tree;
this.parent = parent;
this.rectangle = rectangle;
this.imageX = this.rectangle.X / this.rectangle.Width;
this.imageY = this.rectangle.Y / this.rectangle.Height;
// Console.Out.WriteLine("Creating quad with " + this.rectangle + " this.GetDepth() = " + this.GetDepth() + ", maxDepth = " + tree.depth);
if (this.GetDepth() == tree.depth)
{
this.isLeaf = true;
tree.leafList.AddLast(this);
if (tree.collisionMap.game != null)
{
if (!tree.collisionMap.drawMode)
{
this.collisionTexture = new CollisionTexture(this, tree.collisionMap.game.Content.Load<Texture2D>
(tree.collisionMap.collisionMapPath + "/" + tree.collisionMap.collisionMapName + "_" + imageX + "_" + imageY));
}
else this.collisionTexture = new CollisionTexture(this, new Texture2D(tree.collisionMap.graphicsDevice,
this.rectangle.Width, this.rectangle.Height));
}
else
{
this.collisionTexture = new CollisionTexture(this, new Texture2D(tree.collisionMap.graphicsDevice,
this.rectangle.Width, this.rectangle.Height));
}
}
}
开发者ID:Wotuu,项目名称:RTS_XNA_v2,代码行数:33,代码来源:Quad.cs
示例19: Viewport
public Viewport()
{
_extent = new BoundingBox(0, 0, 0, 0);
_windowExtent = new Quad();
RenderResolutionMultiplier = 1;
_center.PropertyChanged += (sender, args) => _modified = true;
}
开发者ID:jdeksup,项目名称:Mapsui.Net4,代码行数:7,代码来源:Viewport.cs
示例20: ReflectEdgesRecursive
private static void ReflectEdgesRecursive( Sphere[] mirrors, Quad[] quads,
List<Quad> allQuads, HashSet<Vector3D> completed )
{
if( 0 == quads.Length )
return;
List<Quad> newQuads = new List<Quad>();
foreach( Quad quad in quads )
//foreach( Sphere mirror in mirrors )
{
Sphere mirror = mirrors[3];
Quad newQuad = quad.Clone();
for( int i = 0; i < newQuad.Verts.Length; i++ )
newQuad.Verts[i] = mirror.ReflectPoint( newQuad.Verts[i] );
if( completed.Add( newQuad.ID ) )
{
// Haven't seen this yet, so
// we'll need to recurse on it.
allQuads.Add( newQuad );
newQuads.Add( newQuad );
}
}
//ReflectEdgesRecursive( mirrors, newQuads.ToArray(), allQuads, completed );
}
开发者ID:roice3,项目名称:Honeycombs,代码行数:28,代码来源:Lawson.cs
注:本文中的Quad类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论