position

ThreeJS 给 Shader传参

一笑奈何 提交于 2020-01-14 23:31:43
参考: https://www.cnblogs.com/softimagewht/p/4750847.html ThreeJS 给 Shader传参 一、Shader三种变量类型(uniform, attribute 和varying) 1、uniform 顶点着色器 和 片元着色器 都可以使用 一般用来传递:变换矩阵,材质,光照参数和颜色等信息 用法: 外部(js)给着色器传数据 // 着色器代码 uniform vec4 u_FragColor ; void main ( ) { gl_FragColor = u_FragColor ; } // js代码 var u_FragColor = gl . getUniformLocation ( gl . program , 'u_FragColor' ) ; gl . uniform4f ( u_FragColor , 0.0 , 1.0 , 1.0 , 1.0 ) ; 2、attribute 只能在 顶点着色器 中使用 一般用来传递顶点的数据,如:顶点坐标,法线,纹理坐标,顶点颜色 用法: 外部(js)给着色器传数据 类型: float,vec2,vec3,vec4,mat2,mat3,mat4 // 着色器代码 attribute vec4 a_Position ; void main ( ) { gl_position =

【创意编程作业】《代码本色》第2章——力

非 Y 不嫁゛ 提交于 2020-01-14 18:03:23
目录 Part1 实现效果以及扩展 Part2 力 Part3 设计思路 Part4 代码实现 Part1 实现效果以及扩展 水平方向给一个向左或向右的(风)力,垂直方向给一个重力或反重力,力的方向随帧数而改变。灰色小球为阻力小球,该区域内阻力系数不同。 操作说明: 1、点击鼠标重置。 2、移动鼠标来移动阻力球。 3、滚动滑轮来缩放阻力球大小。 Part2 力 力是一个向量。力的书面化概念源自牛顿运动定律。 牛顿三大运动定律: 1、物体有保持静止或运动的趋势。 2、力等于质量乘以加速度,F=M*A。 3、每个作用力都有一个大小相等、方向相反的作用力。 其中第二条定律编程时最为重要,在处理像素时,常常令所有对象的质量等于1。于是根据公式有A=F,即物体的加速度等于力。 因为加速度控制速度,速度控制位置,于是力就是物体运动的起因。 而当考虑质量时,加速度=力/质量。 程序常用的外力有:风力、摩擦力、空气和流体阻力、引力等。 《代码本色》参考案例: 1、制造两个外力:风力和重力。指向不同的方向,大小不相等,同时作用在对象上。 2、流体阻力 物体通过流体或者气体时同样会受摩擦力的作用。流体阻力产生的效果和摩擦力相同(物体会减速),计算阻力公式如下: 简化公式,以便于Processing模拟: 设置一块流体区域,该区域内阻力系数与区域外不同,当物体进入区域时,会产生与速度方向相反的阻力。

Vim start with cursor where last went off [closed]

坚强是说给别人听的谎言 提交于 2020-01-14 12:59:44
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 7 years ago . How do i make Vim always start at the line I was at when i exited that given file last time? 回答1: Put this in your .vimrc: " When editing a file, always jump to the last cursor position au BufReadPost * \ if ! exists("g:leave_my_cursor_position_alone") | \ if line("'\"") > 0 && line ("'\"") <= line("$") | \ exe

setting position of a control doesn't seem to work when scroll is 'moved' (c#, winforms)

夙愿已清 提交于 2020-01-14 10:18:13
问题 Description of the problem: Create a 'custom control'. Set it's property AutoScroll to 'true'. Change it's bg-color to green. Create second 'custom control'. Change it's bg-color to red. On main form place first custom control In code create 20 instances of second control Add a button and in the button: In code set their position in loop like c.Location = new Point(0, y); y += c.Height; Run App. Press the button Scroll the container Press the button again and can someone please explain me WHY

Arrow is not drawn correctly on fabricJS canvas

牧云@^-^@ 提交于 2020-01-14 05:32:05
问题 I'm working on a project in which several shapes (rectangle, triangle, ellipse, ..) can be drawn on a fabricJS canvas. Now I'm implementing the functionality to draw an arrow. This arrow consists out of two shapes, a line and a triangle (arrow head). They are added to the canvas as a group object but the problem is that the arrow is not drawn correctly on the canvas. (see this picture ). Below is my code to draw the arrow: drawShape: function(canvas, shape) { let selectedShape; let pointer,

小白初学HTML的一些小理解

本秂侑毒 提交于 2020-01-14 00:12:01
小白初学HTML 在我学习css语法时遇到了一些问题 在子元素浮动时,导致父元素坍塌。 如何去解决父级元素坍塌的问题 position 的属性 position的实际应用 在我学习css语法时遇到了一些问题 在子元素浮动时,导致父元素坍塌。 <style> .box{ background-color: red; } .box1{ width: 200px; height: 200px; background-color: green; float: left; } .box2{ width: 200px; height: 200px; background-color: blue; float: left; } </style> </head> <body> <div class="box"> <div class="box1"></div class="box1"> <div class="box2"></div> </div> </body> 此时的效果为 父元素设置的红色并没有显示出来,因为他的高度变成了 0。 此时父级元素高度坍塌了。 如何去解决父级元素坍塌的问题 1.为父元素设置高度 .box{ background-color: red; height: 400px; } 此时的显示效果为 这个方法并不好,当要调整子级元素时,父级元素也有相应的做调整。 2.

Android: Positioning buttons when turned from portrait to landscape

瘦欲@ 提交于 2020-01-13 22:39:42
问题 I have a menu-activity, in which I have several positioned buttons. It fits my phone screen perfectly when in portrait mode, but in landscape mode it's destroyed. I know that when I have fixed positioning this will be the result. Can anyone tell me how to position my buttons so my activity keeps its form also in landscape mode? Thank you. Here is my xml file: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http:/

elementUI表格合并单元格

自作多情 提交于 2020-01-13 18:38:58
相信你肯定看了 ElementUI 官方文档了,没看的话先去看下表格各个属性的意义,方便下文阅读: 传送门 但你会发现此例过于简单,死数据,但我们开发的时候往往都是后台传递过来的数据,导致我们 rowspan 的参数需要自己做判断,根据数据的相同行(或列)进行合并; 我们先看下结果: 代码附上: 1 <template> 2 <div class=""> 3 <el-table 4 :data="listData" 5 :span-method="objectSpanMethod" 6 class="tableArea" 7 style="width: 100%"> 8 <el-table-column 9 prop="type" 10 label="序号" 11 align="center" 12 width="200"/> 13 <el-table-column 14 prop="sheetType" 15 label="工单类型" 16 /> 17 <el-table-column 18 prop="taskKey" 19 label="taskKey" 20 /> 21 <el-table-column 22 prop="templateUrl" 23 label="templateUrl" 24 /> 25 <el-table-column 26 label="操作"

HTML5 & MUI 界面样式

流过昼夜 提交于 2020-01-13 13:25:05
什么?这是要做前端的节奏吗?只要公司有需要,我分分钟变身、前端、美工、UI、交互、后端、数据库管理员......快速学习、快速响应,快速适应。公司需要我干啥,我就干啥,而我存在于公司的意义就是利用所学的东西帮公司解决问题......事实上,如果让一个人来搞定整个项目包括移动端、PC端等等,那你还不是被逼得啥都会。 垂直居中+自动换行 样式效果如下所示,当文字没有超出一行时,显示如“备注信息”,当文字超出一行时,显示如“维修地点” HTML代码如下: <div class="mui-input-row multi-line"> <div class="box label-right"> <div class="div-leftauto">维修地点</div> <div class="wrap">广东省深圳市南山区西丽街道桃源路1001号</div> </div> </div> css样式如下: /*不固定高宽div垂直居中的方法:其它页用*/ .box {width: 100%;height: 40px;border: 1px solid #FFF;display: table;margin-right:5px;} .wrap{display: table-cell; vertical-align: middle; width: 100%;padding: 6px 0px;line

Rolling a circle around a square

我与影子孤独终老i 提交于 2020-01-13 12:16:28
问题 After almost a month I am still stuck on this issue I managed to decide whether the circles (or pedestrians as I call them) should move left/right or up/down but I need to have the possibility to move the pedestrians around a building (that means they have to turn on the corners, basically does not matter whether direction, they just need to turn by 90 degrees Thank you very much import numpy as np import random import keyboard from Box2D.b2 import world, polygonShape, circleShape, edgeShape,