SkinnedMesh不再添加边框。

This commit is contained in:
liteng 2018-08-28 21:47:46 +08:00
parent c872fa8695
commit 431fa7294c
3 changed files with 15 additions and 17 deletions

View File

@ -16,11 +16,16 @@ SelectEffect.prototype = Object.create(BaseEffect.prototype);
SelectEffect.prototype.constructor = SelectEffect;
SelectEffect.prototype.render = function (obj) {
if (obj instanceof THREE.SkinnedMesh) {
return;
}
var renderer = this.app.editor.renderer;
var scene = this.scene;
var camera = this.app.editor.camera;
var geometry = obj.geometry;
var material = new THREE.RawShaderMaterial({
uniforms: {
time: {
@ -32,6 +37,10 @@ SelectEffect.prototype.render = function (obj) {
});
var mesh = new THREE.Mesh(geometry, material);
mesh.position.copy(obj.position);
mesh.rotation.copy(obj.rotation);
mesh.scale.copy(obj.scale);
scene.children.length = 0;
scene.add(mesh);

View File

@ -1,11 +1,5 @@
precision mediump float;
uniform float time;
varying vec3 vPosition;
varying vec4 vColor;
void main() {
vec4 color = vec4(vColor);
color.r += sin(vPosition.x * 10.0 + time ) * 0.5;
gl_FragColor = color;
gl_FragColor = vec4(0.925, 0.396, 0.102, 1.0); // 0xec651a
}

View File

@ -1,17 +1,12 @@
precision mediump float;
uniform mat4 modelViewMatrix; // optional
uniform mat4 projectionMatrix; // optional
uniform mat4 modelViewMatrix;
uniform mat4 projectionMatrix;
attribute vec3 position;
attribute vec4 color;
varying vec3 vPosition;
varying vec4 vColor;
attribute vec3 normal;
void main() {
vPosition = position;
vColor = color;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
gl_Position.z = gl_Position.z - 0.1;
gl_Position = projectionMatrix * modelViewMatrix * vec4(position + normal * 0.01, 1.0);
gl_Position.z = gl_Position.z + 0.1;
}