本文整理汇总了C#中ScriptCoreLib.perspective方法的典型用法代码示例。如果您正苦于以下问题:C# ScriptCoreLib.perspective方法的具体用法?C# ScriptCoreLib.perspective怎么用?C# ScriptCoreLib.perspective使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ScriptCoreLib
的用法示例。
在下文中一共展示了ScriptCoreLib.perspective方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Application
//.........这里部分代码省略.........
gl.linkProgram(shaderProgram);
gl.useProgram(shaderProgram);
var shaderProgram_vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition");
gl.enableVertexAttribArray((uint)shaderProgram_vertexPositionAttribute);
// new in lesson 02
var shaderProgram_vertexColorAttribute = gl.getAttribLocation(shaderProgram, "aVertexColor");
gl.enableVertexAttribArray((uint)shaderProgram_vertexColorAttribute);
var shaderProgram_pMatrixUniform = gl.getUniformLocation(shaderProgram, "uPMatrix");
var shaderProgram_mvMatrixUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix");
// https://hacks.mozilla.org/2014/10/introducing-simd-js/
// https://github.com/toji/gl-matrix/blob/master/src/gl-matrix/mat4.js
// http://www.i-programmer.info/news/167-javascript/8578-chrome-to-support-simdjs.html
// https://code.google.com/p/v8/issues/detail?id=2228
//var SIMD_mat4 = new System.Numerics.Matrix4x4();
//var SIMD_mat4s = new Stack<System.Numerics.Matrix4x4>();
// can we convert this code to NDK friendly non GC library?
// for gearVR 90FOV and cardboard wearality 150FOV
#region __mat4
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;