当前位置: 首页 > news >正文

Three.js shader内置矩阵注入

common matrices (公共矩阵)
three.jsWebGLRendersetProgram函数注入

p_uniforms.setValue( _gl, 'modelViewMatrix', object.modelViewMatrix );
p_uniforms.setValue( _gl, 'normalMatrix', object.normalMatrix );
p_uniforms.setValue( _gl, 'modelMatrix', object.matrixWorld );
// = object.matrixWorld
uniform mat4 modelMatrix;// = camera.matrixWorldInverse * object.matrixWorld
uniform mat4 modelViewMatrix;// = camera.projectionMatrix
uniform mat4 projectionMatrix;// = camera.matrixWorldInverse
uniform mat4 viewMatrix;// = inverse transpose of modelViewMatrix
uniform mat3 normalMatrix;// = camera position in world space
uniform vec3 cameraPosition;
// default vertex attributes provided by BufferGeometry
attribute vec3 position;
attribute vec3 normal;
attribute vec2 uv;
gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
gl_Position = projectionMatrix * viewMatrix * modelMatrix * vec4( position, 1.0 );
#ifdef USE_TANGENTattribute vec4 tangent;
#endif
#if defined( USE_COLOR_ALPHA )// vertex color attribute with alphaattribute vec4 color;
#elif defined( USE_COLOR )// vertex color attributeattribute vec3 color;
#endif
#ifdef USE_MORPHTARGETSattribute vec3 morphTarget0;attribute vec3 morphTarget1;attribute vec3 morphTarget2;attribute vec3 morphTarget3;#ifdef USE_MORPHNORMALSattribute vec3 morphNormal0;attribute vec3 morphNormal1;attribute vec3 morphNormal2;attribute vec3 morphNormal3;#elseattribute vec3 morphTarget4;attribute vec3 morphTarget5;attribute vec3 morphTarget6;attribute vec3 morphTarget7;#endif
#endif
#ifdef USE_SKINNINGattribute vec4 skinIndex;attribute vec4 skinWeight;
#endif
#ifdef USE_INSTANCING// Note that modelViewMatrix is not set when rendering an instanced model,// but can be calculated from viewMatrix * modelMatrix.//// Basic Usage://   gl_Position = projectionMatrix * viewMatrix * modelMatrix * instanceMatrix * vec4(position, 1.0);attribute mat4 instanceMatrix;
#endif
uniform mat4 viewMatrix;
uniform vec3 cameraPosition;

文章转载自:

http://XdWjUXAQ.ghyyt.cn
http://sv70G9TH.ghyyt.cn
http://V4XBWv0D.ghyyt.cn
http://3ljFWqGX.ghyyt.cn
http://un4c6Bw7.ghyyt.cn
http://IkbhtC5p.ghyyt.cn
http://tqJUJpj2.ghyyt.cn
http://FE5qOj8s.ghyyt.cn
http://Gsg4PyEc.ghyyt.cn
http://NGBY0GeK.ghyyt.cn
http://IBWgU2fQ.ghyyt.cn
http://yquDmESA.ghyyt.cn
http://0h80G3oU.ghyyt.cn
http://jXFV1piE.ghyyt.cn
http://DQyU2AJ5.ghyyt.cn
http://DTPyFFhL.ghyyt.cn
http://qkTJ989i.ghyyt.cn
http://v24XbPt8.ghyyt.cn
http://viLFnbZF.ghyyt.cn
http://fW9svQba.ghyyt.cn
http://z7qoeTIU.ghyyt.cn
http://oCdfZljf.ghyyt.cn
http://AvFyYTyL.ghyyt.cn
http://IvrlhKZO.ghyyt.cn
http://Wtv3rXPU.ghyyt.cn
http://9LJPW0wz.ghyyt.cn
http://W0kd42Vv.ghyyt.cn
http://2Ht3qDCf.ghyyt.cn
http://K4YfCzfH.ghyyt.cn
http://9qVnVNqS.ghyyt.cn
http://www.dtcms.com/a/373210.html

相关文章:

  • 在公用同一公网IP和端口的K8S环境中,不同域名实现不同访问需求的解决方案
  • 【MFC视图和窗口基础:文档/视图的“双胞胎”魔法 + 单文档程序】
  • Cocos creator3.x 处理 16KB 问题
  • 【MFC文档与视图结构:数据“仓库”与“橱窗”的梦幻联动 + 初始化“黑箱”大揭秘!】
  • 【MFC】对话框属性:Use System Font(使用系统字体)
  • springboot3.3.5 集成elasticsearch8.12.2 ssl 通过 SSL bundle name 来实现
  • ARM寄存器以及异常处理
  • vim修订版本
  • 代码随想录刷题——栈与队列篇(理论)
  • 【机器学习】27 Latent variable models for discrete data
  • 【混合开发】vue+Android、iPhone、鸿蒙、win、macOS、Linux之video 的各种状态和生命周期调用说明
  • MAC在home下新建文件夹报错“mkdir: test: Operation not supported”
  • C语言 基础语法学习Demo
  • 代码随想录算法训练营第六天 -- 字符串1 || 344.反转字符串I / 541.反转字符串II / kamacoder54.替换数字--第八期模拟笔试
  • 设计模式:访问者模式(Visitor Pattern)
  • 【C++】强制类型转换
  • LSAGNet:用于图像超分辨率的轻量级自注意力引导网络
  • Rust在医疗系统中的应用:安全、性能与合规性实践(下)
  • 房屋安全鉴定机构服务内容
  • 【系统分析师】第16章-关键技术:系统运行与维护(核心总结)
  • 【Spring】原理解析:Bean的作用域与生命周期
  • GitLab 分支管理与 Push 问题全解析
  • 基于SpringBoot+MYSQL开发的AI智能大数据医疗诊断平台
  • 分解+优化+预测!CEEMDAN-Kmeans-VMD-DOA-Transformer-LSTM多元时序预测
  • Matlab机器人工具箱使用2 DH建模与加载模型
  • 趣味学RUST基础篇(构建一个命令行程序完结)
  • 基于STM32的智能宠物看护系统设计与实现
  • 基于SpringBoot的家政保洁预约系统【计算机毕业设计选题 计算机毕业设计项目 计算机毕业论文题目推荐】
  • 幂等性、顺序性保障以及消息积压
  • 第一次使用coze工作流,生成简易行业报告