graflow 1.0
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
<style>
|
||||
.bzgf-node {
|
||||
border-width:2px;
|
||||
border-style: solid;
|
||||
border-radius: 6px;
|
||||
width: 160px;
|
||||
height: 80px;
|
||||
color: black;
|
||||
text-align: center;
|
||||
position: absolute;
|
||||
padding: .5em;
|
||||
}
|
||||
|
||||
.bzgf-node .title {
|
||||
font-weight: bold;
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 2em;
|
||||
color: white;
|
||||
}
|
||||
.bzgf-node .body { margin-top: 2em; }
|
||||
.bzgf-node .body input {
|
||||
width:4em;
|
||||
font-size: .9em;
|
||||
border-radius: 6px;
|
||||
border: 1px solid #CCC;
|
||||
}
|
||||
.bzgf-node .port{
|
||||
position: absolute;
|
||||
height: 10px;
|
||||
width: 10px;
|
||||
border: 1px solid black;
|
||||
border-radius: 10px;
|
||||
}
|
||||
.bzgf-node .port[data-type="in"] { background: #0F0; }
|
||||
.bzgf-node .port[data-type="out"] { background: #FF0; }
|
||||
|
||||
.bzgf-node [data-direction="w"]{ left: -7px; top: 50%; }
|
||||
.bzgf-node [data-direction="e"]{ right: -7px; top: 50%;}
|
||||
.bzgf-node [data-direction="n"]{ top: -7px; left: 50%;}
|
||||
.bzgf-node [data-direction="s"]{ bottom: -7px; left: 50%;}
|
||||
|
||||
.bzgf-node[data-nodetype="inc"]{
|
||||
background: #DFD;
|
||||
border-color: #090;
|
||||
}
|
||||
.bzgf-node[data-nodetype="inc"] .title{ background: #090; }
|
||||
|
||||
.bzgf-node[data-nodetype="factor"]{
|
||||
background: #DDF;
|
||||
border-color: #009;
|
||||
}
|
||||
.bzgf-node[data-nodetype="factor"] .title{ background: #009; }
|
||||
|
||||
.bzgf-wire{
|
||||
stroke: #0AF;
|
||||
stroke-width: 2;
|
||||
}
|
||||
</style>
|
||||
|
||||
<template>
|
||||
<div class="bzgf-node" data-nodetype="inc">
|
||||
<div class="title">Increment</div>
|
||||
<div class="port" data-type="in" data-id="inp1" data-direction="w"></div>
|
||||
<div class="port" data-type="in" data-id="inp2" data-direction="s"></div>
|
||||
<div class="port" data-type="out" data-id="out1" data-direction="e"></div>
|
||||
<div class="body">
|
||||
<input type="text" value="1">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<template>
|
||||
<div class="bzgf-node" data-nodetype="factor">
|
||||
<div class="title">Multiply</div>
|
||||
<div class="port" data-type="in" data-id="inp1" data-direction="w"></div>
|
||||
<div class="port" data-type="in" data-id="inp2" data-direction="s"></div>
|
||||
<div class="port" data-type="out" data-id="out1" data-direction="e"></div>
|
||||
<div class="body">
|
||||
<input type="text" value="0.5">
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
+5
-228
@@ -5,236 +5,13 @@
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
|
||||
<link type="text/css" rel="stylesheet" href="https://threejs.org/examples/main.css">
|
||||
<script type="importmap">
|
||||
{
|
||||
"imports": {
|
||||
"three": "https://unpkg.com/three@0.160.0/build/three.module.js",
|
||||
"three/examples/jsm/loaders/FontLoader.js": "https://unpkg.com/three@0.160.0/examples/jsm/loaders/FontLoader.js",
|
||||
"three/examples/jsm/geometries/TextGeometry.js": "https://unpkg.com/three@0.160.0/examples/jsm/geometries/TextGeometry.js",
|
||||
"three/examples/jsm/loaders/RGBELoader.js": "https://unpkg.com/three@0.160.0/examples/jsm/loaders/RGBELoader.js",
|
||||
"three/examples/jsm/controls/OrbitControls.js": "https://unpkg.com/three@0.160.0/examples/jsm/controls/OrbitControls.js",
|
||||
"three/examples/jsm/libs/tween.module.js": "https://unpkg.com/three@0.160.0/examples/jsm/libs/tween.module.js",
|
||||
"three/addons/": "https://unpkg.com/three@0.160.0/examples/jsm/"
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<link type="text/css" rel="stylesheet" href="../../thirdparty/buildoz/buildoz.css">
|
||||
<script src="../../thirdparty/buildoz/buildoz.js"></script>
|
||||
<script src="../../thirdparty/buildoz/bzGraflow.js"></script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id="info">
|
||||
<a href="https://threejs.org" target="_blank" rel="noopener">three.js</a> - FBXLoader<br />
|
||||
Character and animation from <a href="https://www.mixamo.com/" target="_blank" rel="noopener">Mixamo</a>
|
||||
</div>
|
||||
|
||||
|
||||
<script type="module">
|
||||
|
||||
import * as THREE from 'three';
|
||||
|
||||
import Stats from 'three/addons/libs/stats.module.js';
|
||||
|
||||
import { OrbitControls } from 'three/addons/controls/OrbitControls.js';
|
||||
import { FBXLoader } from 'three/addons/loaders/FBXLoader.js';
|
||||
import { GUI } from 'three/addons/libs/lil-gui.module.min.js';
|
||||
|
||||
const manager = new THREE.LoadingManager();
|
||||
|
||||
let camera, scene, renderer, stats, object, loader, guiMorphsFolder;
|
||||
let mixer;
|
||||
|
||||
const clock = new THREE.Clock();
|
||||
|
||||
const params = {
|
||||
asset: 'Samba Dancing'
|
||||
};
|
||||
|
||||
const assets = [
|
||||
'Samba Dancing',
|
||||
'morph_test',
|
||||
'monkey',
|
||||
'monkey_embedded_texture',
|
||||
'vCube',
|
||||
];
|
||||
|
||||
|
||||
init();
|
||||
|
||||
function init() {
|
||||
|
||||
const container = document.createElement( 'div' );
|
||||
document.body.appendChild( container );
|
||||
|
||||
camera = new THREE.PerspectiveCamera( 45, window.innerWidth / window.innerHeight, 1, 2000 );
|
||||
camera.position.set( 100, 200, 300 );
|
||||
|
||||
scene = new THREE.Scene();
|
||||
scene.background = new THREE.Color( 0xa0a0a0 );
|
||||
scene.fog = new THREE.Fog( 0xa0a0a0, 200, 1000 );
|
||||
|
||||
const hemiLight = new THREE.HemisphereLight( 0xffffff, 0x444444, 5 );
|
||||
hemiLight.position.set( 0, 200, 0 );
|
||||
scene.add( hemiLight );
|
||||
|
||||
const dirLight = new THREE.DirectionalLight( 0xffffff, 5 );
|
||||
dirLight.position.set( 0, 200, 100 );
|
||||
dirLight.castShadow = true;
|
||||
dirLight.shadow.camera.top = 180;
|
||||
dirLight.shadow.camera.bottom = - 100;
|
||||
dirLight.shadow.camera.left = - 120;
|
||||
dirLight.shadow.camera.right = 120;
|
||||
scene.add( dirLight );
|
||||
|
||||
// scene.add( new THREE.CameraHelper( dirLight.shadow.camera ) );
|
||||
|
||||
// ground
|
||||
const mesh = new THREE.Mesh( new THREE.PlaneGeometry( 2000, 2000 ), new THREE.MeshPhongMaterial( { color: 0x999999, depthWrite: false } ) );
|
||||
mesh.rotation.x = - Math.PI / 2;
|
||||
mesh.receiveShadow = true;
|
||||
scene.add( mesh );
|
||||
|
||||
const grid = new THREE.GridHelper( 2000, 20, 0x000000, 0x000000 );
|
||||
grid.material.opacity = 0.2;
|
||||
grid.material.transparent = true;
|
||||
scene.add( grid );
|
||||
|
||||
loader = new FBXLoader( manager );
|
||||
loadAsset( params.asset );
|
||||
|
||||
renderer = new THREE.WebGLRenderer( { antialias: true } );
|
||||
renderer.setPixelRatio( window.devicePixelRatio );
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
renderer.setAnimationLoop( animate );
|
||||
renderer.shadowMap.enabled = true;
|
||||
container.appendChild( renderer.domElement );
|
||||
|
||||
const controls = new OrbitControls( camera, renderer.domElement );
|
||||
controls.target.set( 0, 100, 0 );
|
||||
controls.update();
|
||||
|
||||
window.addEventListener( 'resize', onWindowResize );
|
||||
|
||||
// stats
|
||||
stats = new Stats();
|
||||
container.appendChild( stats.dom );
|
||||
|
||||
const gui = new GUI();
|
||||
gui.add( params, 'asset', assets ).onChange( function ( value ) {
|
||||
|
||||
loadAsset( value );
|
||||
|
||||
} );
|
||||
|
||||
guiMorphsFolder = gui.addFolder( 'Morphs' ).hide();
|
||||
|
||||
}
|
||||
|
||||
function loadAsset( asset ) {
|
||||
|
||||
loader.load( 'models/ffbxbx/' + asset + '.fbx', function ( group ) {
|
||||
|
||||
if ( object ) {
|
||||
|
||||
object.traverse( function ( child ) {
|
||||
|
||||
if ( child.isSkinnedMesh ) {
|
||||
|
||||
child.skeleton.dispose();
|
||||
|
||||
}
|
||||
|
||||
if ( child.material ) {
|
||||
|
||||
const materials = Array.isArray( child.material ) ? child.material : [ child.material ];
|
||||
materials.forEach( material => {
|
||||
|
||||
if ( material.map ) material.map.dispose();
|
||||
material.dispose();
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
if ( child.geometry ) child.geometry.dispose();
|
||||
|
||||
} );
|
||||
|
||||
scene.remove( object );
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
object = group;
|
||||
|
||||
if ( object.animations && object.animations.length ) {
|
||||
|
||||
mixer = new THREE.AnimationMixer( object );
|
||||
|
||||
const action = mixer.clipAction( object.animations[ 0 ] );
|
||||
action.play();
|
||||
|
||||
} else {
|
||||
|
||||
mixer = null;
|
||||
|
||||
}
|
||||
|
||||
guiMorphsFolder.children.forEach( ( child ) => child.destroy() );
|
||||
guiMorphsFolder.hide();
|
||||
|
||||
object.traverse( function ( child ) {
|
||||
|
||||
if ( child.isMesh ) {
|
||||
|
||||
child.castShadow = true;
|
||||
child.receiveShadow = true;
|
||||
|
||||
if ( child.morphTargetDictionary ) {
|
||||
|
||||
guiMorphsFolder.show();
|
||||
const meshFolder = guiMorphsFolder.addFolder( child.name || child.uuid );
|
||||
Object.keys( child.morphTargetDictionary ).forEach( ( key ) => {
|
||||
|
||||
meshFolder.add( child.morphTargetInfluences, child.morphTargetDictionary[ key ], 0, 1, 0.01 );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} );
|
||||
|
||||
scene.add( object );
|
||||
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
function onWindowResize() {
|
||||
|
||||
camera.aspect = window.innerWidth / window.innerHeight;
|
||||
camera.updateProjectionMatrix();
|
||||
|
||||
renderer.setSize( window.innerWidth, window.innerHeight );
|
||||
|
||||
}
|
||||
|
||||
//
|
||||
|
||||
function animate() {
|
||||
|
||||
const delta = clock.getDelta();
|
||||
|
||||
if ( mixer ) mixer.update( delta );
|
||||
|
||||
renderer.render( scene, camera );
|
||||
|
||||
stats.update();
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<bz-graflow flow="/app/assets/json/bzGraflow/testFlow1.json"></bz-graflow>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"nodesFile": "/app/assets/html/bzGraflow/nodesTest1.html",
|
||||
"flow": {
|
||||
"nodes":[
|
||||
{ "nodeType": "inc",
|
||||
"id": "aze",
|
||||
"coords": { "x": 20, "y": 10}
|
||||
},
|
||||
{ "nodeType": "factor",
|
||||
"id": "qsd",
|
||||
"coords": { "x": 270, "y": 50}
|
||||
},
|
||||
{ "nodeType": "inc",
|
||||
"id": "wcx",
|
||||
"coords": { "x": 520, "y": 50}
|
||||
},
|
||||
{ "nodeType": "inc",
|
||||
"id": "ert",
|
||||
"coords": { "x": 150, "y": 350}
|
||||
}
|
||||
],
|
||||
"links": [
|
||||
{ "from": ["aze", "out1"], "to": ["qsd", "inp1"] },
|
||||
{ "from": ["qsd", "out1"], "to": ["wcx", "inp1"] },
|
||||
{ "from": ["qsd", "out1"], "to": ["ert", "inp2"] },
|
||||
{ "from": ["ert", "out1"], "to": ["aze", "inp2"] }
|
||||
|
||||
]
|
||||
}
|
||||
}
|
||||
+18
-7
@@ -228,7 +228,7 @@ class Intro{
|
||||
this.matEE.defines = this.matEE.defines || {}
|
||||
this.matEE.defines.USE_UV = ""
|
||||
this.matEE.onBeforeCompile = shader => {
|
||||
shader.uniforms.uReveal = { value: 0 }
|
||||
shader.uniforms.uReveal = { value: -0.3 }
|
||||
shader.uniforms.uTime = { value: 0 };
|
||||
shader.fragmentShader = shader.fragmentShader
|
||||
.replace(
|
||||
@@ -241,15 +241,26 @@ class Intro{
|
||||
.replace(
|
||||
`#include <envmap_fragment>`,
|
||||
`#include <envmap_fragment>
|
||||
if ((uReveal-vUv.x) < (1.0-uReveal)){
|
||||
float random = fract(sin(dot(gl_FragCoord.xy + vec2(uTime) , vec2(12.9898,78.233))) * 43758.5453);
|
||||
if(random > 0.1) discard;
|
||||
}
|
||||
|
||||
float bandWidth = 0.20;
|
||||
|
||||
if (vUv.x > uReveal) {
|
||||
float d = (vUv.x - uReveal) / bandWidth; // 0 at front, grows to the right
|
||||
if (d < 1.0) { // inside noisy band
|
||||
float density = smoothstep(1.0, 0.0, d);
|
||||
float random = fract( sin(dot(gl_FragCoord.xy + vec2(uTime), vec2(12.9898,78.233))) * 43758.5453 );
|
||||
if (random > density) discard;
|
||||
} else {
|
||||
// fully hidden
|
||||
discard;
|
||||
}
|
||||
|
||||
}
|
||||
`
|
||||
)
|
||||
this.matEE.userData.shader = shader
|
||||
}
|
||||
|
||||
|
||||
this.planeEE = new THREE.Mesh(geo, this.matEE)
|
||||
this.planeEE.scale.set(.2, .2, 1)
|
||||
this.planeEE.position.set(0,-0.8,.1)
|
||||
@@ -269,7 +280,7 @@ class Intro{
|
||||
requestAnimationFrame(this.animate.bind(this))
|
||||
if (this.matEE.userData.shader) {
|
||||
if(this.matEE.userData.shader.uniforms.uReveal.value<1){
|
||||
this.matEE.userData.shader.uniforms.uReveal.value += 0.01
|
||||
this.matEE.userData.shader.uniforms.uReveal.value += 0.005
|
||||
this.matEE.userData.shader.uniforms.uTime.value = Math.floor(performance.now() / 200)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ body[eicapp] {
|
||||
min-height: 100vh;
|
||||
box-sizing: border-box;
|
||||
background: repeating-linear-gradient( -45deg, #000, #333 10px, #000 10px, #333 20px );
|
||||
overflow: hidden;
|
||||
}
|
||||
.helperBotCanvas{
|
||||
display: block;
|
||||
|
||||
Reference in New Issue
Block a user