本文整理汇总了C#中Real类的典型用法代码示例。如果您正苦于以下问题:C# Real类的具体用法?C# Real怎么用?C# Real使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Real类属于命名空间,在下文中一共展示了Real类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MakeOrthoMatrix
public override void MakeOrthoMatrix(Radian fov, Real aspectRatio, Real near, Real far, out Matrix4 dest, bool forGpuPrograms)
{
float thetaY = Utility.DegreesToRadians(fov / 2.0f);
float tanThetaY = Utility.Tan(thetaY);
float tanThetaX = tanThetaY * aspectRatio;
float halfW = tanThetaX * near;
float halfH = tanThetaY * near;
var w = 1.0f / (halfW);
var h = 1.0f / (halfH);
var q = 0.0f;
if (far != 0)
{
q = 1.0f / (far - near);
}
dest = Matrix4.Zero;
dest.m00 = w;
dest.m11 = h;
dest.m22 = q;
dest.m23 = -near / (far - near);
dest.m33 = 1;
if (forGpuPrograms)
{
dest.m22 = -dest.m22;
}
}
示例2: Move
public override void Move(int moveX, int moveY)
{
TerminateThreads();
xorigin -= (Real)(moveX) * (xmax - xmin) / (Real)screenWidth;
yorigin -= (Real)(moveY) * (ymax - ymin) / (Real)screenHeight;
Draw(numIterations, numThreads);
}
示例3: AffectParticles
public override void AffectParticles( ParticleSystem system, Real timeElapsed )
{
Vector3 scaledVector = Vector3.Zero;
if ( this.forceApp == ForceApplication.Add )
{
// scale force by time
scaledVector = this.forceVector*timeElapsed;
}
// affect each particle
for ( int i = 0; i < system.Particles.Count; i++ )
{
var p = (Particle)system.Particles[ i ];
if ( this.forceApp == ForceApplication.Add )
{
p.Direction += scaledVector;
}
else
{
// Average
p.Direction = ( p.Direction + this.forceVector )/2;
}
}
}
示例4: AffectParticles
public override void AffectParticles( ParticleSystem system, Real timeElapsed )
{
float ds;
// Scale adjustments by time
ds = this.scaleAdjust*timeElapsed;
float newWide, newHigh;
// loop through the particles
for ( int i = 0; i < system.Particles.Count; i++ )
{
var p = (Particle)system.Particles[ i ];
if ( p.HasOwnDimensions == false )
{
newHigh = system.DefaultHeight + ds;
newWide = system.DefaultWidth + ds;
}
else
{
newWide = p.Width + ds;
newHigh = p.Height + ds;
}
p.SetDimensions( newWide, newHigh );
}
}
示例5: FrameRenderingQueued
public override bool FrameRenderingQueued( FrameEventArgs evt )
{
// shoot a ray from the cursor to the plane
var ray = TrayManager.GetCursorRay( Camera );
this.mCursorQuery.Ray = ray;
var result = this.mCursorQuery.Execute();
if ( result.Count != 0 )
{
// using the point of intersection, find the corresponding texel on our texture
var pt = ray.GetPoint( result[ result.Count - 1 ].Distance );
this.mBrushPos = ( ( new Vector2( pt.x, -pt.y ) )*( 1.0f/this.mPlaneSize ) + ( new Vector2( 0.5, 0.5 ) ) )*
TEXTURE_SIZE;
}
byte freezeAmount = 0;
this.mTimeSinceLastFreeze += evt.TimeSinceLastFrame;
// find out how much to freeze the plane based on time passed
while ( this.mTimeSinceLastFreeze >= 0.1 )
{
this.mTimeSinceLastFreeze -= 0.1;
freezeAmount += 0x04;
}
_updateTexture( freezeAmount ); // rebuild texture contents
this.mPenguinAnimState.AddTime( evt.TimeSinceLastFrame ); // increment penguin idle animation time
this.mPenguinNode.Yaw( (Real)( new Radian( (Real)evt.TimeSinceLastFrame ) ) ); // spin the penguin around
return base.FrameRenderingQueued( evt ); // don't forget the parent class updates!
}
示例6: MakeOrthoMatrix
public override void MakeOrthoMatrix( Radian fovy, Real aspectRatio, Real near, Real far, out Matrix4 dest,
bool forGpuPrograms )
{
var thetaY = fovy/2.0f;
var tanThetaY = Utility.Tan( thetaY );
var tanThetaX = tanThetaY*aspectRatio;
var half_w = tanThetaX*near;
var half_h = tanThetaY*near;
var iw = 1.0f/( half_w );
var ih = 1.0f/( half_h );
Real q = 0.0f;
if ( far != 0 )
{
q = 1.0/( far - near );
}
dest = Matrix4.Zero;
dest.m00 = iw;
dest.m11 = ih;
dest.m22 = q;
dest.m23 = -near/( far - near );
dest.m33 = 1;
if ( forGpuPrograms )
{
dest.m22 = -dest.m22;
}
}
示例7: Quaternion
// public Quaternion()
// {
// this.w = 1.0f;
// }
/// <summary>
/// Creates a new Quaternion.
/// </summary>
public Quaternion( Real w, Real x, Real y, Real z )
{
this.w = w;
this.x = x;
this.y = y;
this.z = z;
}
示例8: Vector4
/// <summary>
/// Creates a new 4 dimensional Vector.
/// </summary>
public Vector4( Real x, Real y, Real z, Real w )
{
this.x = x;
this.y = y;
this.z = z;
this.w = w;
}
示例9: UniformParameter
public UniformParameter( GpuProgramParameters.AutoConstantType autoConstantType, Real autoConstantData, int size,
GpuProgramParameters.GpuConstantType type )
: base(
Parameter.AutoParameters[ autoConstantType ].Type, Parameter.AutoParameters[ autoConstantType ].Name,
SemanticType.Unknown, -1, ContentType.Unknown, size )
{
AutoShaderParameter parameterDef = Parameter.AutoParameters[ autoConstantType ];
_name = parameterDef.Name;
if ( autoConstantData != 0.0 )
{
_name += autoConstantData.ToString();
//replace possible illegal point character in name
_name = _name.Replace( '.', '_' );
}
_type = type;
_semantic = SemanticType.Unknown;
_index = -1;
_content = Parameter.ContentType.Unknown;
this.isAutoConstantReal = true;
this.isAutoConstantInt = false;
this.autoConstantType = autoConstantType;
this.autoConstantRealData = autoConstantData;
this.variability = (int)GpuProgramParameters.GpuParamVariability.Global;
this._params = null;
this.physicalIndex = -1;
_size = size;
}
示例10: Start
public virtual void Start( RenderWindow window, ushort numGroupsInit, ushort numGroupsLoad, Real initProportion )
{
mWindow = window;
mNumGroupsInit = numGroupsInit;
mNumGroupsLoad = numGroupsLoad;
mInitProportion = initProportion;
// We need to pre-initialise the 'Bootstrap' group so we can use
// the basic contents in the loading screen
ResourceGroupManager.Instance.InitializeResourceGroup( "Bootstrap" );
OverlayManager omgr = OverlayManager.Instance;
mLoadOverlay = omgr.GetByName( "Core/LoadOverlay" );
if ( mLoadOverlay == null )
{
throw new KeyNotFoundException( "Cannot find loading overlay" );
}
mLoadOverlay.Show();
// Save links to the bar and to the loading text, for updates as we go
mLoadingBarElement = omgr.Elements.GetElement( "Core/LoadPanel/Bar/Progress" );
mLoadingCommentElement = omgr.Elements.GetElement( "Core/LoadPanel/Comment" );
mLoadingDescriptionElement = omgr.Elements.GetElement( "Core/LoadPanel/Description" );
OverlayElement barContainer = omgr.Elements.GetElement( "Core/LoadPanel/Bar" );
mProgressBarMaxSize = barContainer.Width;
mLoadingBarElement.Width = 0;
// self is listener
ResourceGroupManager.Instance.AddResourceGroupListener( this );
}
示例11: Merge
public void Merge( AxisAlignedBox boxBounds, Sphere sphereBounds, Camera cam, bool receiver )
{
aabb.Merge( boxBounds );
if ( receiver )
receiverAabb.Merge( boxBounds );
Real camDistToCenter = ( cam.DerivedPosition - sphereBounds.Center ).Length;
minDistance = System.Math.Min( minDistance, System.Math.Max( (Real)0, camDistToCenter - sphereBounds.Radius ) );
maxDistance = System.Math.Max( maxDistance, camDistToCenter + sphereBounds.Radius );
}
示例12: DrawInternal
protected override void DrawInternal(object threadParams)
{
var tParams = (MandelThreadParams)threadParams;
double ratio = (double)screenWidth / (double)screenHeight;
xmin = xorigin;
ymin = yorigin;
xmax = xmin + xextent;
ymax = ymin + xextent / ratio;
int maxY = tParams.startY + tParams.startHeight;
int maxX = tParams.startX + tParams.startWidth;
Real x, y, x0, y0, temp = new Real();
Real xscale = (xmax - xmin) / screenWidth;
Real yscale = (ymax - ymin) / screenHeight;
int iteration;
int iterScale = 1;
int px, py;
if (numIterations < colorPaletteSize) { iterScale = colorPaletteSize / numIterations; }
for (py = tParams.startY; py < maxY; py++)
{
y0 = ymin + py * yscale;
for (px = tParams.startX; px < maxX; px++)
{
x0 = xmin + px * xscale;
iteration = 0;
x = new Real(x0);
y = new Real(y0);
while ((iteration < numIterations) && (x.DoubleValue * x.DoubleValue + y.DoubleValue * y.DoubleValue <= 4))
{
Real.MandelbrotOperations(ref x, ref y, ref x0, ref y0, ref temp);
iteration++;
}
if (iteration >= numIterations)
{
bitmapBits[py * screenWidth + px] = 0xFF000000;
}
else
{
bitmapBits[py * screenWidth + px] = colorPalette[(iteration * iterScale) % colorPaletteSize];
}
}
if (terminateThreads) { break; }
}
tParams.parentForm.BeginInvoke(new MethodInvoker(delegate()
{
tParams.parentForm.Invalidate();
}));
}
示例13: Separator
/// <summary>
/// Do not instantiate any widgets directly. Use SdkTrayManager.
/// </summary>
/// <param name="name"></param>
/// <param name="width"></param>
public Separator( String name, Real width )
{
element = OverlayManager.Instance.Elements.CreateElementFromTemplate( "SdkTrays/Separator", "Panel", name );
if ( width <= 0 )
this.IsFitToTray = true;
else
{
this.IsFitToTray = false;
element.Width = width;
}
}
示例14: CreateVariables
public override BaseVariable[] CreateVariables()
{
var variables = new BaseVariable[Problema.NumberOfVariables];
for (var var = 0; var < Problema.NumberOfVariables; var++)
{
variables[var] = new Real(Problema.LowerLimit[var], Problema.UpperLimit[var]);
}
return variables;
}
示例15: ChangeValue
private void ChangeValue(dynamic calculator, Operations operation)
{
dynamic addvalue = null;
if (CurrentVal.Text != "Write your Value:")
{
if (state.CalcEnum == CalcEnum.IntCalc)
{
addvalue = new Real<int>(int.Parse(CurrentVal.Text));
}
if (state.CalcEnum == CalcEnum.FloatCalc)
{
addvalue = new Real<double>(double.Parse(CurrentVal.Text));
}
if (state.CalcEnum == CalcEnum.ComCalc)
{
addvalue = new Complecs(CurrentVal.Text);
}
switch (operation)
{
case Operations.Add:
calculator.Add(addvalue);
break;
case Operations.Remove:
calculator.Remove(addvalue);
break;
case Operations.Divide:
calculator.Divide(addvalue);
break;
case Operations.Multiply:
calculator.Multiply(addvalue);
break;
case Operations.Clear:
calculator.Clear(addvalue);
break;
case Operations.Sqrt:
try
{
calculator.Sqrt(addvalue);
}
catch (Exception)
{
MessageBox.Show("Eror: Divide at 0");
}
break;
case Operations.Modul:
calculator.Modul(addvalue);
break;
}
}
else
{
MessageBox.Show("Write Value!!!!");
}
}