本文整理汇总了C#中float3类的典型用法代码示例。如果您正苦于以下问题:C# float3类的具体用法?C# float3怎么用?C# float3使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
float3类属于命名空间,在下文中一共展示了float3类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Acceleration
// Callback for acceleration
// (ODE solver uses x" = F/m) applied to particle i.
// The positions and velocities are not necessarily
// m_akPosition and m_akVelocity since the ODE solver evaluates the
// impulse function at intermediate positions.
protected override float3 Acceleration(int i, Real fTime, float3[] akPosition, float3[] akVelocity)
{
// Compute spring forces on position X[i]. The positions are not
// necessarily m_akPosition since the RK4 solver in ParticleSystem
// evaluates the acceleration function at intermediate positions. The end
// points of the curve of masses must be handled separately since each
// has only one spring attached to it.
float3 kAcceleration = ExternalAcceleration(i, fTime, akPosition, akVelocity);
float3 kDiff, kForce;
Real fRatio;
if (i > 0)
{
int iM1 = i - 1;
kDiff = akPosition[iM1] - akPosition[i];
fRatio = m_afLength[iM1] / kDiff.Length;
kForce = m_afConstant[iM1] * (((Real)1.0) - fRatio) * kDiff;
kAcceleration += MassInverse[i] * kForce;
}
int iP1 = i + 1;
if (iP1 < NumParticles)
{
kDiff = akPosition[iP1] - akPosition[i];
fRatio = m_afLength[i] / kDiff.Length;
kForce = m_afConstant[i] * (((Real)1.0) - fRatio) * kDiff;
kAcceleration += MassInverse[i] * kForce;
}
return kAcceleration;
}
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:38,代码来源:MassSpringCurve.cs
示例2: Sheep
public Sheep(RenderContext rc, float3 position, float3 rotation, float3 scaleFactor, SceneRenderer sc, Game game)
: base(rc, position, rotation, scaleFactor, sc)
{
_distance = position.Length;
if (_distance > 60)
{
_score = 120;
}
if (_distance > 40)
{
_score = 80;
}
else
{
_score = 50;
}
Speed = (5 / _distance) * game.Level;
Radius = 4f;
_game = game;
Pos = position;
_alpha = (float)Math.Tan(Pos.z/Pos.x);
Tag = "Sheep";
_level = 1;
//zufällige Wellenbewegung
if (position.x % 2 == 0)
{
TheWave = SinWave;
}
else
{
TheWave = CosWave;
}
}
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:34,代码来源:Sheep.cs
示例3: float4x3
public float4x3(float3x3 R, float3 t)
{
M11 = R.M11; M12 = R.M12; M13 = R.M13;
M21 = R.M21; M22 = R.M22; M23 = R.M23;
M31 = R.M31; M32 = R.M32; M33 = R.M33;
M41 = t.x; M42 = t.y; M43 = t.z;
}
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:7,代码来源:float4x3.cs
示例4: float4
public float4(float3 v, float _w)
{
x = v.x;
y = v.y;
z = v.z;
w = _w;
}
开发者ID:QueenStarfinder,项目名称:WhiteCore-Dev,代码行数:7,代码来源:float4.cs
示例5: EvalDistance
/// <summary>
/// Evaluates the distance to the closest distance field primitive in the field
/// </summary>
/// <param name="_Position"></param>
/// <returns></returns>
public float EvalDistance( float3 _Position )
{
float Distance = float.MaxValue;
foreach ( IDistanceFieldPrimitive P in m_Primitives )
Distance = Math.Min( Distance, P.Eval( _Position ) );
return Distance;
}
开发者ID:Patapom,项目名称:GodComplex,代码行数:12,代码来源:AABBTree.cs
示例6: PointLight
/// <summary>
/// Initializes a new instance of the <see cref="PointLight"/> class. Only the channel is needed. Other params
/// will be set to default value.
/// </summary>
/// <param name="channel">The memory space of the light(0 - 7).</param>
public PointLight(int channel)
{
_type = LightType.Point;
_position = new float3(0, 0, 0);
_diffuseColor = new float4(1, 1, 1, 1);
_channel = channel;
}
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:12,代码来源:PointLight.cs
示例7: float4x4
public float4x4(float3x3 R, float3 t)
{
M11 = R.M11; M12 = R.M12; M13 = R.M13; M14 = 0;
M21 = R.M21; M22 = R.M22; M23 = R.M23; M24 = 0;
M31 = R.M31; M32 = R.M32; M33 = R.M33; M34 = 0;
M41 = t.x; M42 = t.y; M43 = t.z; M44 = 1;
}
开发者ID:Wiladams,项目名称:NewTOAPIA,代码行数:7,代码来源:float4x4.cs
示例8: axis
public float3 axis()
{
float3 a = new float3(x, y, z);
if (Math.Abs(angle()) < 0.0000001f)
return new float3(1f, 0f, 0f);
return a * (1 / (float)Math.Sin(angle() / 2.0f));
}
开发者ID:BogusCurry,项目名称:halcyon,代码行数:7,代码来源:Quaternion.cs
示例9: DrawLine
public void DrawLine(float3 start, float3 end, float width, Color startColor, Color endColor)
{
renderer.CurrentBatchRenderer = this;
if (nv + 6 > renderer.TempBufferSize)
Flush();
var delta = (end - start) / (end - start).XY.Length;
var corner = width / 2 * new float3(-delta.Y, delta.X, delta.Z);
startColor = Util.PremultiplyAlpha(startColor);
var sr = startColor.R / 255.0f;
var sg = startColor.G / 255.0f;
var sb = startColor.B / 255.0f;
var sa = startColor.A / 255.0f;
endColor = Util.PremultiplyAlpha(endColor);
var er = endColor.R / 255.0f;
var eg = endColor.G / 255.0f;
var eb = endColor.B / 255.0f;
var ea = endColor.A / 255.0f;
vertices[nv++] = new Vertex(start - corner + Offset, sr, sg, sb, sa, 0, 0);
vertices[nv++] = new Vertex(start + corner + Offset, sr, sg, sb, sa, 0, 0);
vertices[nv++] = new Vertex(end + corner + Offset, er, eg, eb, ea, 0, 0);
vertices[nv++] = new Vertex(end + corner + Offset, er, eg, eb, ea, 0, 0);
vertices[nv++] = new Vertex(end - corner + Offset, er, eg, eb, ea, 0, 0);
vertices[nv++] = new Vertex(start - corner + Offset, sr, sg, sb, sa, 0, 0);
}
开发者ID:pchote,项目名称:OpenRA,代码行数:29,代码来源:RgbaColorRenderer.cs
示例10: AddBoxShape
public BoxShape AddBoxShape(float3 boxHalfExtents)
{
IBoxShapeImp iBoxShapeImp = _dwi.AddBoxShape(boxHalfExtents);
var retval = new BoxShape();
retval.BoxShapeImp = iBoxShapeImp;
iBoxShapeImp.UserObject = retval;
return retval;
}
开发者ID:juradosa,项目名称:BeeTheGame,代码行数:8,代码来源:DynamicWorld.cs
示例11: Float3Lerp
/// <summary>
/// Lerp Function for Float3.
/// </summary>
public static float3 Float3Lerp(float3 val1, float3 val2, float time1, float time2)
{
float3 values = new float3();
values.x = val1.x + ((val2.x - val1.x) / time1) * time2;
values.y = val1.y + ((val2.y - val1.y) / time1) * time2;
values.z = val1.z + ((val2.z - val1.z) / time1) * time2;
return values;
}
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:11,代码来源:Lerp.cs
示例12: SpotLight
/// <summary>
/// Initializes a new instance of the <see cref="SpotLight"/> class. Only the channel is needed.
/// </summary>
/// <param name="channel">The memory space of the light(0 - 7).</param>
public SpotLight( int channel)
{
_type = LightType.Spot;
_position = new float3(0,0,0);
_direction = new float3(0,-1,0);
_diffuseColor = new float4(1, 1, 1, 1);
_channel = channel;
}
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:12,代码来源:SpotLight.cs
示例13: DrawTargetMarker
public static void DrawTargetMarker(WorldRenderer wr, Color color, float3 location)
{
var iz = 1 / wr.Viewport.Zoom;
var offset = new float2(iz, iz);
var tl = location - offset;
var br = location + offset;
Game.Renderer.WorldRgbaColorRenderer.FillRect(tl, br, color);
}
开发者ID:pchote,项目名称:OpenRA,代码行数:8,代码来源:TargetLineRenderable.cs
示例14: RenderAFrame
// is called once a frame
public override void RenderAFrame()
{
RC.Clear(ClearFlags.Color | ClearFlags.Depth);
Point pt = Input.Instance.GetMousePos();
var mousePosWorld = new float3(pt.x - Width/2, Height/2 - pt.y, 0);
mousePosWorld = 2*CamDist/SquareScreenPxls*mousePosWorld;
var lineWidthFactor = 1.0f;
if (Input.Instance.IsButton(MouseButtons.Left))
{
lineWidthFactor = 3.0f;
_shaderEffect.SetEffectParam("uLineColor", new float4(1, 0.2f, 0.2f, 0.9f));
}
else
{
_shaderEffect.SetEffectParam("uLineColor", new float4(0, 0, 0, 1));
}
_shaderEffect.SetEffectParam("uLineWidth",
new float2(lineWidthFactor*LineWidth/_normWidth, lineWidthFactor*LineWidth/_normHeight));
var curMaxRotChange =
(float) (MaxRotChange*Math.Abs(Input.Instance.GetAxis(InputAxis.MouseX))*Time.Instance.DeltaTime);
float angleHorzDelta =
Math.Min(
Math.Max(RotationSpeed*-Input.Instance.GetAxis(InputAxis.MouseX) - _angleHorz, -curMaxRotChange),
curMaxRotChange);
_angleHorz = (float) Math.Max(-0.5f*Math.PI, Math.Min(_angleHorz + angleHorzDelta, 0.5f*Math.PI));
curMaxRotChange =
(float) (MaxRotChange*Math.Abs(Input.Instance.GetAxis(InputAxis.MouseY))*Time.Instance.DeltaTime);
float angleVertDelta =
Math.Min(
Math.Max(RotationSpeed*-Input.Instance.GetAxis(InputAxis.MouseY) - _angleVert, -curMaxRotChange),
curMaxRotChange);
_angleVert = (float) Math.Max(-0.7f*Math.PI, Math.Min(_angleVert + angleVertDelta, 0.2f*Math.PI));
/* float angleVertDelta =
Math.Min(Math.Max(_angleVert - RotationSpeed * -Input.Instance.GetAxis(InputAxis.MouseX), -_maxRotChange), _maxRotChange);
_angleVert += angleVertDelta;*/
var mtxRot = float4x4.CreateRotationY(_angleHorz)*float4x4.CreateRotationX(_angleVert);
var mtxCam = float4x4.LookAt(0, 0, CamDist, 0, 0, 0, 0, 1, 0);
var curDamp = (float) Math.Exp(-Damping*Time.Instance.DeltaTime);
_angleHorz *= curDamp;
_angleVert *= curDamp;
// first mesh
RC.ModelView = float4x4.CreateRotationX((float) (-0.3*Math.PI))*
new float4x4(HandScale, 0, 0, 0, 0, HandScale, 0, 0, 0, 0, HandScale, 0, 0, 0, 0, 1)*mtxRot*
float4x4.CreateTranslation(mousePosWorld)*mtxCam;
_shaderEffect.RenderMesh(_meshTea);
// swap buffers
Present();
}
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:59,代码来源:Main.cs
示例15: Quaternion
public Quaternion(float3 v, float t)
{
v = float3.normalize(v);
w = (float)Math.Cos(t / 2.0f);
v = v * (float)Math.Sin(t / 2.0f);
x = v.x;
y = v.y;
z = v.z;
}
开发者ID:VirtualReality,项目名称:Universe,代码行数:9,代码来源:Quaternion.cs
示例16: RenderPointLight
/// <summary>
/// Initializes a new instance of the <see cref="RenderPointLight" /> class. Position, color, type and channel are needed.
/// </summary>
/// <param name="position">The position of the light.</param>
/// <param name="diffuse">The diffuse light color.</param>
/// <param name="ambient">The ambient light color.</param>
/// <param name="specular">The specular light color.</param>
/// <param name="type">The light type.</param>
/// <param name="channel">The memory space of the light(0 - 7).</param>
public RenderPointLight(float3 position, float4 diffuse, float4 ambient, float4 specular, Light.LightType type, int channel)
{
_position = position;
_type = Light.LightType.Point;
_diffuseColor = diffuse;
_ambientColor = ambient;
_specularColor = specular;
_channel = channel;
}
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:18,代码来源:RenderPointLight.cs
示例17: getSidePlane
private static PlaneTriResult getSidePlane(float3 p, float4 plane, float epsilon)
{
float d = DistToPt(p, plane);
if ((d + epsilon) > 0f)
return PlaneTriResult.PTR_FRONT; // it is 'in front' within the provided epsilon value.
return PlaneTriResult.PTR_BACK;
}
开发者ID:Virtual-Universe,项目名称:Virtual-Universe,代码行数:9,代码来源:PlaneTri.cs
示例18: Tomato
public Tomato(RenderContext rc, float3 position, float3 rotation, float3 scaleFactor,SceneRenderer sc, RigidBody tomatoRigidBody, Game game, DynamicWorld world)
: base(rc, position, rotation, scaleFactor, sc)
{
TomatoRb = tomatoRigidBody;
Radius = 2f;
Tag = "Tomato";
timer = 2.0f;
_game = game;
_world = world;
}
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:10,代码来源:Tomato.cs
示例19: Transform
public void Transform(float3 position, Quaternion orientation)
{
// Transforms the plane to the space defined by the
// given position/orientation
float3 newNormal = Quaternion.Inverse(orientation) * normal;
float3 origin = Quaternion.Inverse(orientation) * (-normal * dist - position);
normal = newNormal;
dist = -float3.dot(newNormal, origin);
}
开发者ID:Gitlab11,项目名称:opensim,代码行数:10,代码来源:Plane.cs
示例20: DirectionalLight
/// <summary>
/// Creates a directional light in the scene. Direction, color and position will get standart values.
/// Channel is needed. It is possible to set up to 8 lights in the scene.
/// </summary>
/// <param name="channel">The memory space of the light(0 - 7).</param>
public DirectionalLight( int channel)
{
_position = new float3(0,0,0);
_direction = new float3(0,-1,0);
_diffuseColor = new float4(0.6f, 0.6f, 0.6f, 1);
_ambientColor = new float4(0.3f, 0.3f, 0.3f, 1);
_specularColor = new float4(0.1f, 0.1f, 0.1f, 1);
_type = LightType.Directional;
_channel = channel;
}
开发者ID:GameProduction,项目名称:ScharfschiessenGame,代码行数:15,代码来源:DirectionalLight.cs
注:本文中的float3类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论