⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 slang_120_core.gc

📁 Mesa is an open-source implementation of the OpenGL specification - a system for rendering interacti
💻 GC
📖 第 1 页 / 共 3 页
字号:
/* * Mesa 3-D graphics library * Version:  6.5 * * Copyright (C) 2006  Brian Paul   All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included * in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. *///// Constructors and operators introduced in GLSL 1.20 - mostly on new// (non-square) types of matrices.//// One important change in the language is that when a matrix is used// as an argument to a matrix constructor, it must be the only argument// for the constructor. The compiler takes care of it by itself and// here we only care to re-introduce constructors for old (square)// types of matrices.////// From Shader Spec, ver. 1.20, rev. 6////// mat2x3: 2 columns of vec3mat2x3 __constructor(const float f00, const float f10, const float f20,                     const float f01, const float f11, const float f21){   __retVal[0].x = f00;   __retVal[0].y = f10;   __retVal[0].z = f20;   __retVal[1].x = f01;   __retVal[1].y = f11;   __retVal[1].z = f21;}mat2x3 __constructor(const float f){   __retVal = mat2x3(  f, 0.0, 0.0,                     0.0,   f, 0.0);}mat2x3 __constructor(const int  i){   const float f = float(i);   __retVal = mat2x3(f);}mat2x3 __constructor(const bool b){   const float f = float(b);   __retVal = mat2x3(f);}mat2x3 __constructor(const vec3 c0, const vec3 c1){   __retVal[0] = c0;   __retVal[1] = c1;}//// mat2x4: 2 columns of vec4mat2x4 __constructor(const float f00, const float f10, const float f20, const float f30,                     const float f01, const float f11, const float f21, const float f31){   __retVal[0].x = f00;   __retVal[0].y = f10;   __retVal[0].z = f20;   __retVal[0].w = f30;   __retVal[1].x = f01;   __retVal[1].y = f11;   __retVal[1].z = f21;   __retVal[1].w = f31;}mat2x4 __constructor(const float f){   __retVal = mat2x4(  f, 0.0, 0.0, 0.0,                     0.0,   f, 0.0, 0.0);}mat2x4 __constructor(const int i){   const float f = float(i);   __retVal = mat2x4(f);}mat2x4 __constructor(const bool b){   const float f = float(b);   __retVal = mat2x4(f);}mat2x4 __constructor(const vec4 c0, const vec4 c1){   __retVal[0] = c0;   __retVal[1] = c1;}//// mat3x2: 3 columns of vec2mat3x2 __constructor(const float f00, const float f10,                     const float f01, const float f11,                     const float f02, const float f12){   __retVal[0].x = f00;   __retVal[0].y = f10;   __retVal[1].x = f01;   __retVal[1].y = f11;   __retVal[2].x = f02;   __retVal[2].y = f12;}mat3x2 __constructor(const float f){   __retVal = mat3x2(  f, 0.0,                     0.0,   f,                     0.0, 0.0);}mat3x2 __constructor(const int i){   const float f = float(i);   __retVal = mat3x2(f);}mat3x2 __constructor(const bool b){   const float f = float(b);   __retVal = mat3x2(f);}mat3x2 __constructor(const vec2 c0, const vec2 c1, const vec2 c2){   __retVal[0] = c0;   __retVal[1] = c1;   __retVal[2] = c2;}//// mat3x4: 3 columns of vec4mat3x4 __constructor(const float f00, const float f10, const float f20, const float f30,                     const float f01, const float f11, const float f21, const float f31,		     const float f02, const float f12, const float f22, const float f32){   __retVal[0].x = f00;   __retVal[0].y = f10;   __retVal[0].z = f20;   __retVal[0].w = f30;   __retVal[1].x = f01;   __retVal[1].y = f11;   __retVal[1].z = f21;   __retVal[1].w = f31;   __retVal[2].x = f02;   __retVal[2].y = f12;   __retVal[2].z = f22;   __retVal[2].w = f32;}mat3x4 __constructor(const float f){   __retVal = mat3x4(  f, 0.0, 0.0, 0.0,                     0.0,   f, 0.0, 0.0,                     0.0, 0.0,   f, 0.0);}mat3x4 __constructor(const int i){   const float f = float(i);   __retVal = mat3x4(f);}mat3x4 __constructor(const bool b){   const float f = float(b);   __retVal = mat3x4(f);}mat3x4 __constructor(const vec4 c0, const vec4 c1, const vec4 c2){   __retVal[0] = c0;   __retVal[1] = c1;   __retVal[2] = c2;}//// mat4x2: 4 columns of vec2mat4x2 __constructor(const float f00, const float f10,                     const float f01, const float f11,		     const float f02, const float f12,		     const float f03, const float f13){   __retVal[0].x = f00;   __retVal[0].y = f10;   __retVal[1].x = f01;   __retVal[1].y = f11;   __retVal[2].x = f02;   __retVal[2].y = f12;   __retVal[3].x = f03;   __retVal[3].y = f13;}mat4x2 __constructor(const float f){   __retVal = mat4x2(  f, 0.0,                     0.0,   4,                     0.0, 0.0,                     0.0, 0.0);}mat4x2 __constructor(const int i){   const float f = float(i);   __retVal = mat4x2(f);}mat4x2 __constructor(const bool b){   const float f = float(b);   __retVal = mat4x2(f);}mat4x2 __constructor(const vec2 c0, const vec2 c1, const vec2 c2, const vec2 c3){   __retVal[0] = c0;   __retVal[1] = c1;   __retVal[2] = c2;   __retVal[3] = c3;}//// mat4x3: 4 columns of vec3mat4x3 __constructor(const float f00, const float f10, const float f20,                     const float f01, const float f11, const float f21,		     const float f02, const float f12, const float f22,		     const float f03, const float f13, const float f23){   __retVal[0].x = f00;   __retVal[0].y = f10;   __retVal[0].z = f20;   __retVal[1].x = f01;   __retVal[1].y = f11;   __retVal[1].z = f21;   __retVal[2].x = f02;   __retVal[2].y = f12;   __retVal[2].z = f22;   __retVal[3].x = f03;   __retVal[3].y = f13;   __retVal[3].z = f23;}mat4x3 __constructor(const float f){   __retVal = mat4x3(  f, 0.0, 0.0,                     0.0,   f, 0.0,                     0.0, 0.0,   f,                     0.0, 0.0, 0.0);}mat4x3 __constructor(const int i){   const float f = float(i);   __retVal = mat4x3(f);}mat4x3 __constructor(const bool b){   const float f = float(b);   __retVal = mat4x3(f);}mat4x3 __constructor(const vec3 c0, const vec3 c1, const vec3 c2, const vec3 c3){   __retVal[0] = c0;   __retVal[1] = c1;   __retVal[2] = c2;   __retVal[3] = c3;}//// misc assorted matrix constructorsmat2 __constructor(const mat2 m){   __retVal = m;}mat2 __constructor(const mat3x2 m){   __retVal = mat2(m[0], m[1]);}mat2 __constructor(const mat4x2 m){   __retVal = mat2(m[0], m[1]);}mat2 __constructor(const mat2x3 m){   __retVal = mat2(m[0].xy, m[1].xy);}mat2 __constructor(const mat2x4 m){   __retVal = mat2(m[0].xy, m[1].xy);}mat2 __constructor(const mat3 m){   __retVal = mat2(m[0].xy, m[1].xy);}mat2 __constructor(const mat3x4 m){   __retVal = mat2(m[0].xy, m[1].xy);}mat2 __constructor(const mat4x3 m){   __retVal = mat2(m[0].xy, m[1].xy);}mat2 __constructor(const mat4 m){   __retVal = mat2(m[0].xy, m[1].xy);}mat2x3 __constructor(const mat2x3 m){   __retVal = m;}mat2x3 __constructor(const mat3 m){   __retVal = mat2x3(m[0], m[1]);}mat2x3 __constructor(const mat4x3 m){   __retVal = mat2x3(m[0], m[1]);}mat2x3 __constructor(const mat2x4 m){   __retVal = mat2x3(m[0].xyz, m[1].xyz);}mat2x3 __constructor(const mat3x4 m){   __retVal = mat2x3(m[0].xyz, m[1].xyz);}mat2x3 __constructor(const mat4 m){   __retVal = mat2x3(m[0].xyz, m[1].xyz);}mat2x3 __constructor(const mat2 m){   __retVal = mat2x3(m[0].x, m[0].y, 0.0,                     m[1].x, m[1].y, 0.0);}mat2x3 __constructor(const mat3x2 m){   __retVal = mat2x3(m[0].x, m[0].y, 0.0,                     m[1].x, m[1].y, 0.0);}mat2x3 __constructor(const mat4x2 m){   __retVal = mat2x3(m[0].x, m[0].y, 0.0,                     m[1].x, m[1].y, 0.0);}mat2x4 __constructor(const mat2x4 m){   __retVal = m;}mat2x4 __constructor(const mat3x4 m){   __retVal = mat2x4(m[0], m[1]);}mat2x4 __constructor(const mat4 m){   __retVal = mat2x4(m[0], m[1]);}mat2x4 __constructor(const mat2x3 m){   __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0,                     m[1].x, m[1].y, m[1].z, 0.0);}mat2x4 __constructor(const mat3 m){   __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0,                     m[1].x, m[1].y, m[1].z, 0.0);}mat2x4 __constructor(const mat4x3 m){   __retVal = mat2x4(m[0].x, m[0].y, m[0].z, 0.0,                     m[1].x, m[1].y, m[1].z, 0.0);}mat2x4 __constructor(const mat2 m){   __retVal = mat2x4(m[0].x, m[1].y, 0.0, 0.0,                     m[1].x, m[1].y, 0.0, 0.0);}mat2x4 __constructor(const mat3x2 m){   __retVal = mat2x4(m[0].x, m[0].y, 0.0, 0.0,                     m[1].x, m[1].y, 0.0, 0.0);}mat2x4 __constructor(const mat4x2 m){   __retVal = mat2x4(m[0].x, m[0].y, 0.0, 0.0,                     m[1].x, m[1].y, 0.0, 0.0);}mat3x2 __constructor(const mat3x2 m){   __retVal = m;}mat3x2 __constructor(const mat4x2 m){   __retVal = mat3x2(m[0], m[1], m[2]);}mat3x2 __constructor(const mat3 m){   __retVal = mat3x2(m[0], m[1], m[2]);}mat3x2 __constructor(const mat3x4 m){   __retVal = mat3x2(m[0].x, m[0].y,                     m[1].x, m[1].y,                     m[2].x, m[2].y);}mat3x2 __constructor(const mat4x3 m){   __retVal = mat3x2(m[0].x, m[0].y,                     m[1].x, m[1].y,                     m[2].x, m[2].y);}mat3x2 __constructor(const mat4 m){   __retVal = mat3x2(m[0].x, m[0].y,                     m[1].x, m[1].y,                        0.0,    0.0);}mat3x2 __constructor(const mat2 m){   __retVal = mat3x2(m[0], m[1], vec2(0.0));}mat3x2 __constructor(const mat2x3 m){   __retVal = mat3x2(m[0].x, m[0].y,                     m[1].x, m[1].y,                        0.0,    0.0);}mat3x2 __constructor(const mat2x4 m){   __retVal = mat3x2(m[0].x, m[0].y,                     m[1].x, m[1].y,                        0.0,    0.0);}mat3 __constructor(const mat3 m){   __retVal = m;}mat3 __constructor(const mat4x3 m){   __retVal = mat3 (        m[0],        m[1],        m[2]    );}mat3 __constructor(const mat3x4 m){   __retVal = mat3 (        m[0].xyz,        m[1].xyz,        m[2].xyz    );}mat3 __constructor(const mat4 m){   __retVal = mat3 (        m[0].xyz,        m[1].xyz,        m[2].xyz    );}mat3 __constructor(const mat2x3 m){   __retVal = mat3 (        m[0],        m[1],        0., 0., 1.    );}mat3 __constructor(const mat2x4 m){   __retVal = mat3 (        m[0].xyz,        m[1].xyz,        0., 0., 1.    );}mat3 __constructor(const mat3x2 m){   __retVal = mat3 (        m[0], 0.,        m[1], 0.,        m[2], 1.    );}mat3 __constructor(const mat4x2 m){   __retVal = mat3 (        m[0], 0.,        m[1], 0.,        m[2], 1.    );}mat3 __constructor(const mat2 m){   __retVal = mat3 (        m[0], 0.,        m[1], 0.,        0., 0., 1.    );}mat3x4 __constructor(const mat3x4 m){   __retVal = m;}mat3x4 __constructor(const mat4 m){   __retVal = mat3x4 (        m[0],        m[1],        m[2]    );}mat3x4 __constructor(const mat3 m){   __retVal = mat3x4 (        m[0], 0.,        m[1], 0.,        m[2], 0.    );}mat3x4 __constructor(const mat4x3 m){   __retVal = mat3x4 (        m[0], 0.,        m[1], 0.,        m[2], 0.    );}mat3x4 __constructor(const mat2x4 m){   __retVal = mat3x4 (        m[0],        m[1],        0., 0., 1., 0.    );}mat3x4 __constructor(const mat2x3 m){   __retVal = mat3x4 (        m[0], 0.,        m[1], 0.,        0., 0., 1., 0.    );}mat3x4 __constructor(const mat3x2 m){   __retVal = mat3x4 (        m[0], 0., 0.,        m[1], 0., 0.,        m[2], 1., 0.    );}mat3x4 __constructor(const mat4x2 m){   __retVal = mat3x4 (        m[0], 0., 0.,        m[1], 0., 0.,        m[2], 1., 0.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -