本文整理汇总了C#中ScriptCoreLib.identity方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptCoreLib.identity方法的具体用法?C# ScriptCoreLib.identity怎么用?C# ScriptCoreLib.identity使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScriptCoreLib
的用法示例。
在下文中一共展示了ScriptCoreLib.identity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Application
//.........这里部分代码省略.........
var __mat4 = new
{
// X:\jsc.svn\examples\javascript\Test\TestFloatArray\TestFloatArray\Application.cs
// https://sites.google.com/a/jsc-solutions.net/backlog/knowledge-base/2015/20150706/20150708
// generic in the sens of caller choosing is the return type a new struct or out ref?
perspective = new Func<float[], float, float, float, float, float[]>(
(that, fovy, aspect, near, far) =>
{
var f = 1.0f / (float)Math.Tan(fovy / 2f);
var nf = 1f / (near - far);
that[0] = f / aspect;
that[1] = 0;
that[2] = 0;
that[3] = 0;
that[4] = 0;
that[5] = f;
that[6] = 0;
that[7] = 0;
that[8] = 0;
that[9] = 0;
that[10] = (far + near) * nf;
that[11] = -1;
that[12] = 0;
that[13] = 0;
that[14] = (2 * far * near) * nf;
that[15] = 0;
return that;
}),
// reset content of mat4
identity = new Func<float[], float[]>(
that =>
{
//Array.Copy()
//var xx =&that;
var xx = new float[]
{
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1,
};
//is this the best way to update array contents?
xx.CopyTo(that, 0);
return xx;
}
),
create = new Func<float[]>(
() =>
//new mat4()
new float[]
{
1, 0, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1,
}
),