本文整理汇总了C#中vec4类的典型用法代码示例。如果您正苦于以下问题:C# vec4类的具体用法?C# vec4怎么用?C# vec4使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
vec4类属于命名空间,在下文中一共展示了vec4类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DragParam
public DragParam(mat4 projectionMatrix, mat4 viewMatrix, vec4 viewport, Point lastMousePositionOnScreen)
{
this.projectionMatrix = projectionMatrix;
this.viewMatrix = viewMatrix;
this.lastMousePositionOnScreen = lastMousePositionOnScreen;
this.viewport = viewport;
}
示例2: mat4
/// <summary>
/// Initializes a new instance of the <see cref="mat4"/> struct.
/// The matrix is initialised with the <paramref name="cols"/>.
/// </summary>
/// <param name="cols">The colums of the matrix.</param>
public mat4(vec4[] cols)
{
this.col0 = cols[0];
this.col1 = cols[1];
this.col2 = cols[2];
this.col3 = cols[3];
}
示例3: Apply
public static void Apply(vec4 cameraPos, float cameraAspect, Texture2D Current, RenderTarget2D Output)
{
GridHelper.GraphicsDevice.SetRenderTarget(Output);
GridHelper.GraphicsDevice.Clear(Color.Transparent);
Using(cameraPos, cameraAspect, Current);
GridHelper.DrawGrid();
}
示例4: GetResult
protected virtual vec4 GetResult(vec4 baseColor, vec4 blend)
{
vec4 result = blend + baseColor;
result = clamp(result, 0, 1);
return result;
}
示例5: main
public override void main()
{
float real = Position.x * Zoom + Xcenter;
float imag = Position.y * Zoom + Ycenter;
float Creal = real; // change this line...
float Cimag = imag; // ...and this one to get a Julia Set
// Julia Set
//float Creal = -1.36f;
//float Cimag = 0.11f;
float r2 = 0;
float iter;
for (iter = 0.0f; iter < MaxIterations && r2 < 4.0f; ++iter)
{
float tempreal = real;
real = (tempreal * tempreal) - (imag * imag) + Creal;
imag = 2.0f * tempreal * imag + Cimag;
r2 = (real * real) + (imag * imag);
}
// Base the color on the number of iterations
vec3 color;
if (r2 < 4.0f)
color = InnerColor;
else
color = mix(OuterColor1, OuterColor2, fract(iter * 0.05f));
color *= LightIntensity;
FragColor = new vec4(color, 1.0f);
}
示例6: GetResult
protected override vec4 GetResult(vec4 baseColor, vec4 blend)
{
float noise = (noise1(new vec2(TexCoord * noiseScale)) + 1.0f) * 0.5f;
vec4 result = (noise < Opacity) ? blend : baseColor;
return result;
}
示例7: DoInitialize
protected override void DoInitialize()
{
base.DoInitialize();
{
// velocity
var buffer = VertexBuffer.Create(typeof(vec4), ParticleModel.particleCount, VBOConfig.Vec4, "empty", BufferUsage.DynamicCopy);
unsafe
{
var random = new Random();
var array = (vec4*)buffer.MapBuffer(MapBufferAccess.WriteOnly);
for (int i = 0; i < ParticleModel.particleCount; i++)
{
array[i] = new vec4(
(float)(random.NextDouble() - 0.5) * 0.2f,
(float)(random.NextDouble() - 0.5) * 0.2f,
(float)(random.NextDouble() - 0.5) * 0.2f,
0);
}
buffer.UnmapBuffer();
}
this.VelocityBuffer = buffer;
}
this.PositionBuffer = this.DataSource.GetVertexAttributeBuffer(ParticleModel.strPosition, null);
}
示例8: MovePositions
/// <summary>
/// Move vertexes' position accroding to difference on screen.
/// <para>根据<paramref name="differenceOnScreen"/>来修改指定索引处的顶点位置。</para>
/// </summary>
/// <param name="differenceOnScreen"></param>
/// <param name="viewMatrix"></param>
/// <param name="projectionMatrix"></param>
/// <param name="viewport"></param>
/// <param name="positionIndexes"></param>
public override void MovePositions(Point differenceOnScreen,
mat4 viewMatrix, mat4 projectionMatrix, vec4 viewport, params uint[] positionIndexes)
{
base.MovePositions(differenceOnScreen, viewMatrix, projectionMatrix, viewport, positionIndexes);
this.needsUpdating = true;
}
示例9: mat4
public mat4(vec4 r0, vec4 r1, vec4 r2, vec4 r3)
:base(4)
{
this[0, 0] = r0.x; this[1, 0] = r0.y; this[2, 0] = r0.z; this[3, 0] = r0.w;
this[0, 1] = r1.x; this[1, 1] = r1.y; this[2, 1] = r1.z; this[3, 1] = r1.w;
this[0, 2] = r2.x; this[1, 2] = r2.y; this[2, 2] = r2.z; this[3, 2] = r2.w;
this[0, 3] = r3.x; this[1, 3] = r3.y; this[2, 3] = r3.z; this[3, 3] = r3.w;
}
示例10: GetResult
protected override vec4 GetResult(vec4 baseColor, vec4 blend)
{
vec4 white = new vec4(1, 1, 1, 1);
vec4 r = white - ((white - blend) * (white - baseColor));
return r;
}
示例11: GetResult
protected override vec4 GetResult(vec4 baseColor, vec4 blend)
{
vec4 result = new vec4();
result.rgb = baseColor.rgb;
result.a = 0;
return result;
}
示例12: MovePositions
/// <summary>
/// Move vertexes' position accroding to difference on screen.
/// <para>根据<paramref name="differenceOnScreen"/>来修改指定索引处的顶点位置。</para>
/// </summary>
/// <param name="differenceOnScreen"></param>
/// <param name="viewMatrix"></param>
/// <param name="projectionMatrix"></param>
/// <param name="viewport"></param>
/// <param name="positionIndexes"></param>
public virtual void MovePositions(Point differenceOnScreen,
mat4 viewMatrix, mat4 projectionMatrix, vec4 viewport, IEnumerable<uint> positionIndexes)
{
if (positionIndexes == null) { return; }
if (positionIndexes.Count() == 0) { return; }
this.innerPickableRenderer.MovePositions(differenceOnScreen, viewMatrix, projectionMatrix, viewport, positionIndexes);
}
示例13: Using
public static void Using(vec4 cameraPos, float cameraAspect, Texture2D Current)
{
CompiledEffect.Parameters["vs_param_cameraPos"].SetValue(FragSharpMarshal.Marshal(cameraPos));
CompiledEffect.Parameters["vs_param_cameraAspect"].SetValue(FragSharpMarshal.Marshal(cameraAspect));
CompiledEffect.Parameters["fs_param_Current_Texture"].SetValue(FragSharpMarshal.Marshal(Current));
CompiledEffect.Parameters["fs_param_Current_size"].SetValue(FragSharpMarshal.Marshal(vec(Current.Width, Current.Height)));
CompiledEffect.Parameters["fs_param_Current_dxdy"].SetValue(FragSharpMarshal.Marshal(1.0f / vec(Current.Width, Current.Height)));
CompiledEffect.CurrentTechnique.Passes[0].Apply();
}
示例14: main
public override void main()
{
vec4 color = texture(texture1, pass_UV) * percent + texture(texture2, pass_UV) * (1.0f - percent);
if (color.a < 0.1)
{
discard();
}
out_Color = color;
}
示例15: Scale
public static mat4 Scale(ref vec4 s)
{
return new mat4(
s.x, 0, 0, 0,
0, s.y, 0, 0,
0, 0, s.z, 0,
0, 0, 0, 1
);
}