Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <canvas id="app"></canvas>
<script src='https://cdnjs.cloudflare.com/ajax/libs/three.js/r128/three.min.js'></script><script  src="./script.js"></script>
              
            
!

CSS

              
                #app {
  width: 100vw;
  height: 100vh;
}
              
            
!

JS

              
                
var go_half=0;
var go_left=0,go_right=0,go_up=0,go_down=0;
var player={};
player.position={x:0,y:1.5,z:2,s:0};
player.direction={x:0,y:0,z:-1};
player.angle={z:90,y:0};
var radian=Math.PI/180;


var mouse_sensitive=0.125;

var speed=0.1;
var go_lrc=Math.cos((player.angle.y)*radian)*speed;
var go_lrs=Math.sin((player.angle.y)*radian)*speed;
var go_udc=Math.cos((player.angle.y+90)*radian)*speed;
var go_uds=Math.sin((player.angle.y+90)*radian)*speed;


function lockChangeAlert(){
if(document.pointerLockElement===canvas || document.mozPointerLockElement===canvas){ document.addEventListener("mousemove",updatePosition,false); }
else{ document.removeEventListener("mousemove",updatePosition,false); }
}


function updatePosition(e,move_x,move_y){


// ÅÑËÈ ÍÅÒ move_x, ÇÍÀ×ÈÒ ÏÎÂÎÐÎÒ ÌÛØÊÎÉ
if(move_x==undefined){
player.angle.z+=e.movementY*mouse_sensitive;
player.angle.y-=e.movementX*mouse_sensitive;
}
// ÅÑËÈ ÅÑÒÜ, ÒÎ ÏÎÂÎÐÀ×ÈÂÀÅÌ ÍÀ ÝÒÓ ÂÅËÈ×ÈÍÓ
else{
player.angle.z-=move_y*mouse_sensitive;
player.angle.y+=move_x*mouse_sensitive;
}


if(player.angle.z>170){ player.angle.z=170; }
if(10>player.angle.z){ player.angle.z=10; }


if(player.angle.y>360){ player.angle.y-=360; }
if(player.angle.y<0){ player.angle.y+=360; }


go_lrc=Math.cos(player.angle.y*radian)*speed;
go_lrs=Math.sin(player.angle.y*radian)*speed;
go_udc=Math.cos((player.angle.y+90)*radian)*speed;
go_uds=Math.sin((player.angle.y+90)*radian)*speed;


player.direction.x=Math.cos((-player.angle.y-90)*radian)*(Math.sin(player.angle.z*radian));
player.direction.y=Math.cos(player.angle.z*radian);
player.direction.z=Math.sin((-player.angle.y-90)*radian)*(Math.sin(player.angle.z*radian));
try{
camera.lookAt(player.position.x+player.direction.x,player.position.y+player.direction.y,player.position.z+player.direction.z);
}
catch(e){}

}


function key(which,to){
if(which==65){ go_left=to; }
if(which==87){ go_up=to; }
if(which==68){ go_right=to; }
if(which==83){ go_down=to; }
}


document.onkeydown=function(e){ key((e||window.event).keyCode,1); }
document.onkeyup=function(e){ key((e||window.event).keyCode,0); }


var vs=[];
var fs=[];
var mesh=[];
var tex=[];
var mat=[];


var texture_loader=new THREE.TextureLoader();


const canvas = document.querySelector('#app');
const width = canvas.clientWidth;
const height = canvas.clientHeight;


canvas.requestPointerLock=canvas.requestPointerLock || canvas.mozRequestPointerLock;
document.exitPointerLock=document.exitPointerLock || document.mozExitPointerLock;
document.addEventListener("pointerlockchange",lockChangeAlert,false);
document.addEventListener("mozpointerlockchange",lockChangeAlert,false);
canvas.onclick=canvas.requestPointerLock;


const context = canvas.getContext('webgl');
const renderer = new THREE.WebGLRenderer({
  antialias: true,
  alpha: true,
  transparent:true,
  canvas: canvas,
  context: context,
});
renderer.setClearColor(0xB9EEFF,1);
renderer.setPixelRatio(window.devicePixelRatio);
renderer.setSize(width, height, false);


const camera = new THREE.PerspectiveCamera(45,width/height,0.05,100000);
const scene = new THREE.Scene();
const pl1 = new THREE.PointLight(0xFEE3B1, 2);
pl1.position.set(-20,20,20);
scene.add(pl1);
const clock = new THREE.Clock();


tex["one"]=texture_loader.load("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAIAAAACACAYAAADDPmHLAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9kFBhElH2xxI74AABEgSURBVHja7V3bcuM6DgQo7f9/8ETkPuzxHgbpbkC2ZDsesco1k8SWbaGJS+NCs2td61rXuta1rnWta13rWte61rWuda1rXeta17rWta51rWt97PK/5YuOMeR3dfdxAeCzhe/kO4/5378NCP6bd25FWJPw4+Mm9Pj4q0Dgv0To7HMOBobpGm5mLfwbAdDDv38NCPxNd3gFACP5ed7tLTxmAHTw+GtAsL7pDvcDQBqFv/zzuP08A2D75zGDaYwxPt5BXF8sfE8AoIAxlDMXAHAT/jqB4PbcLZgD+wcU82d+SuQw35tngW59sfCdCNzF7vdE8CPRAMtkBgZxCL3ynkdqiKgVbz+fDYT1BcL3BAAV4TOfYAYBs/8RABYcwAGuZwJ0D5sKcG+YlvudAABxuBc1gAnHzsLujbvYSPg3g+Im9BYihZH4Iih8HGOM3SAIwo/v4fdc820AAL6cisnRzVaevSdCMSH4KOz5752AgL1Xn32GPdqA3J+P0wAx/m4FAKgbEK8Tn9+D8Bp4T0tCRg/AYADo03O+cQljDC/uXP9IAAAGrhFheLL7q1pgiOey9x0AqAYAxNjDbdIA26QJeia8AkP57blnmYFnaQBFyJR5+kQLzDsSaQAGgtk5tAkEBl4Td38jHILfzMEdWuBpu/+ZUYAiZKqOnSUh5CA7uxVBYMAnWICpmcmjZkle4QH1fxrf8EoiyEVM7oLsUZoACabvBIAD53GZPqsL4UNncG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tDhf0TA0tuPy66hWeDceqa5Nrb0PZlK+cuMMNd7ygZimGdhEfGLVQITF2W2I/FZ96EFlF8fQgXa483TfE5P2N9vITbgMLLr5SYpUmLMxok+jN7Sj1+TkLJ+BkrM/HYDfpXEgEJRlElFbsBCSrEe7zREb36LRYyV8oDmrYxtyUuvPDFD9T7tK6pU1+jXSWZs2+x2gU/+P4P3rVV+8fNSuoAAAAASUVORK5CYII=");
tex["floor"].wrapS=tex["floor"].wrapT=THREE.RepeatWrapping;
tex["floor"].repeat.set(10,10);

vs["sprite"]=`


attribute vec3 offset;
attribute vec2 scale;
attribute vec4 quaternion;
attribute float rotation;
attribute vec4 color;
attribute float blend;
attribute float texture;
uniform float time;
varying vec2 vUv;
varying vec4 vColor;
varying float vBlend;
varying float num;


void main(){


float angle=time*rotation;
vec3 vRotated=vec3(position.x*scale.x*cos(angle)-position.y*scale.y*sin(angle),position.y*scale.y*cos(angle)+position.x*scale.x*sin(angle),position.z);


vUv=uv;
vColor=color;
vBlend=blend;
num=texture;


vec3 localUpVector=vec3(0.0,1.0,0.0);
vec3 vLook=offset-cameraPosition;
vec3 vRight=normalize(cross(vLook,localUpVector));
vec3 vPosition=vRotated.x*vRight+vRotated.y*localUpVector+vRotated.z;


gl_Position=projectionMatrix*modelViewMatrix*vec4(vPosition+offset,1.0);


}


`;


fs["sprite"]=`


const int count=2;
uniform sampler2D map[count];
varying vec2 vUv;
varying vec4 vColor;
varying float vBlend;
varying float num;


void main(){


if(num==0.0){ gl_FragColor=texture2D(map[0],vUv)*vColor; }
else if(num==1.0){ gl_FragColor=texture2D(map[1],vUv)*vColor; }


gl_FragColor.rgb*=gl_FragColor.a;
gl_FragColor.a*=vBlend;


}


`;


var particles=[];


function particles_update(){


particles=[];


var max_1=particles_flare_a.length;
particles.length=max_1;
for(var n=0;n<max_1;n++){
particles[n]=particles_flare_a[n];
}


var count=particles.length;
var item=camera.position;
var x=item.x;
var y=item.y;
var z=item.z;


for(var n=0;n<count;n++){
var item=particles[n].offset;
particles[n].d=Math.sqrt(Math.pow((x-item[0]),2)+Math.pow((y-item[1]),2)+Math.pow((z-item[2]),2));
}


particles.sort((a,b)=>b.d-a.d);


var offset=new Float32Array(count*3);
var scale=new Float32Array(count*2);
var quaternion=new Float32Array(count*4);
var rotation=new Float32Array(count);
var color=new Float32Array(count*4);
var blend=new Float32Array(count);
var texture=new Float32Array(count);


for(var n=0;n<count;n++){


// 1 VALUE
var item=particles[n];
rotation[n]=item.rotation;
texture[n]=item.texture;
blend[n]=item.blend;


// 2 VALUE
var p=n*2;
var one=p+1;
var i_scale=item.scale;
scale[p]=i_scale[0];
scale[one]=i_scale[1];


// 3 VALUE
var p=n*3;
var one=p+1;
var two=p+2;
var i_offset=item.offset;
offset[p]=i_offset[0];
offset[one]=i_offset[1];
offset[two]=i_offset[2];


// 4 VALUE
var p=n*4;
var one=p+1;
var two=p+2;
var three=p+3;
var i_color=item.color;
color[p]=i_color[0];
color[one]=i_color[1];
color[two]=i_color[2];
color[three]=i_color[3];
var i_quaternion=item.quaternion;
quaternion[p]=i_quaternion[0];
quaternion[one]=i_quaternion[1];
quaternion[two]=i_quaternion[2];
quaternion[three]=i_quaternion[3];


}


var item=mesh["sprite"].geometry.attributes;
item.offset=new THREE.InstancedBufferAttribute(offset,3).setUsage(THREE.DynamicDrawUsage);
item.scale=new THREE.InstancedBufferAttribute(scale,2).setUsage(THREE.DynamicDrawUsage);
item.quaternion=new THREE.InstancedBufferAttribute(quaternion,4).setUsage(THREE.DynamicDrawUsage);
item.rotation=new THREE.InstancedBufferAttribute(rotation,1).setUsage(THREE.DynamicDrawUsage);
item.color=new THREE.InstancedBufferAttribute(color,4).setUsage(THREE.DynamicDrawUsage);
item.blend=new THREE.InstancedBufferAttribute(blend,1).setUsage(THREE.DynamicDrawUsage);
item.texture=new THREE.InstancedBufferAttribute(texture,1).setUsage(THREE.DynamicDrawUsage);


mesh["sprite"].geometry._maxInstanceCount=count;


}


var geometry=new THREE.InstancedBufferGeometry();
geometry.setAttribute('position',new THREE.Float32BufferAttribute(new Float32Array([-0.5,0.5,0,-0.5,-0.5,0,0.5,0.5,0,0.5,-0.5,0,0.5,0.5,0,-0.5,-0.5,0]),3));
geometry.setAttribute('uv',new THREE.Float32BufferAttribute(new Float32Array([0,1,0,0,1,1,1,0,1,1,0,0]),2));
geometry.setAttribute('offset',new THREE.InstancedBufferAttribute(new Float32Array(),3));
geometry.setAttribute('scale',new THREE.InstancedBufferAttribute(new Float32Array(),2));
geometry.setAttribute('quaternion',new THREE.InstancedBufferAttribute(new Float32Array(),4));
geometry.setAttribute('rotation',new THREE.InstancedBufferAttribute(new Float32Array(),1));
geometry.setAttribute('color',new THREE.InstancedBufferAttribute(new Float32Array(),4));
geometry.setAttribute('blend',new THREE.InstancedBufferAttribute(new Float32Array(),1));
geometry.setAttribute('texture',new THREE.InstancedBufferAttribute(new Float32Array(),1));


mat["sprite"]=new THREE.ShaderMaterial({
uniforms:{
map:{value:[tex["one"],tex["two"]]},
time:{value:0}
},
vertexShader:vs["sprite"],
fragmentShader:fs["sprite"],
side:THREE.DoubleSide,
transparent:true,
depthWrite:false,
blending:THREE.CustomBlending,
blendEquation:THREE.AddEquation,
blendSrc:THREE.OneFactor,
blendDst:THREE.OneMinusSrcAlphaFactor
});


mesh["sprite"]=new THREE.Mesh(geometry,mat["sprite"]);
mesh["sprite"].frustumCulled=false;
mesh["sprite"].matrixAutoUpdate=false;
mesh["sprite"].updateMatrixWorld=function(){};
scene.add(mesh["sprite"]);


var particles_flare_a=[];


particles_flare_a.push({offset:[10,2,0],scale:[4,4],quaternion:[0,0,0,1],rotation:0,color:[1,1,1,1],blend:1,texture:1});


for(var n=0;n<100;n++){
particles_flare_a.push({offset:[Math.random()*20-10,0.5,Math.random()*20-10],scale:[1,1],quaternion:[0,0,0,1],rotation:10,color:[Math.random()*0.1,Math.random()*0.1,Math.random()*0.1,1],blend:1,texture:0});
}


for(var n=0;n<100;n++){
var scale=Math.random()*0.5+0.5;
particles_flare_a.push({offset:[Math.random()*20-10,scale/2,Math.random()*20-10],scale:[scale,scale],quaternion:[0,0,0,1],rotation:0,color:[1,1,1,1],blend:1,texture:1});
}


mat["floor"]=new THREE.MeshStandardMaterial({
map:tex["floor"],bumpMap:tex["floor"],bumpScale:0.005,metalness:0.16
})


mesh["floor"]=new THREE.Mesh(new THREE.BoxBufferGeometry(20,1,20),mat["floor"]);
mesh["floor"].position.y=-0.5;
scene.add(mesh["floor"]);



function loop(){


requestAnimationFrame(loop);
const delta=clock.getDelta();
particles_update();
mat["sprite"].uniforms.time.value=clock.elapsedTime;


go_half=0;


if(go_left==1){ go_half++;  }
if(go_right==1){ go_half++; ; }
if(go_up==1){ go_half++; }
if(go_down==1){ go_half++;  }


if(go_half>1){ go_half=0.68; }


if(go_left==1){ player.position.x-=go_lrc*go_half; player.position.z+=go_lrs*go_half; }
if(go_right==1){ player.position.x+=go_lrc*go_half; player.position.z-=go_lrs*go_half; }
if(go_up==1){ player.position.x+=go_udc*go_half; player.position.z-=go_uds*go_half; }
if(go_down==1){  player.position.x-=go_udc*go_half; player.position.z+=go_uds*go_half; }


camera.position.set(player.position.x,player.position.y,player.position.z);


renderer.render(scene, camera);


}


loop();
              
            
!
999px

Console