原生webgl未知球形世界效果

代码语言:html

所属分类:动画

代码描述:原生webgl未知球形世界效果

代码标签: 球形 世界 效果

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<style>
body {
  background-color: #000;
  margin: 0;
  overflow: hidden;
  background-repeat: no-repeat;
}
canvas {
  position : absolute;
}
</style>

</head>
<body translate="no">


<script>
"use strict";

let canv, gl;
let dimension;
let animState;
let midx, midy;

let widthHandle, heightHandle;
let lookAtHandle;
let lookFromHandle;
let fluidHandle;

const mrandom = Math.random;
const mfloor = Math.floor;
const mround = Math.round;
const mceil = Math.ceil;
const mabs = Math.abs;
const mmin = Math.min;
const mmax = Math.max;

const mPI = Math.PI;
const mPIS2 = Math.PI / 2;
const m2PI = Math.PI * 2;
const msin = Math.sin;
const mcos = Math.cos;
const matan2 = Math.atan2;

const mhypot = Math.hypot;
const msqrt = Math.sqrt;

//-----------------------------------------------------------------------------
// miscellaneous functions
//-----------------------------------------------------------------------------

//************** Shader sources **************
let vertexSource = `
attribute vec2 position;

void main() {
  gl_Position = vec4(position, 0.0, 1.0);
}
`;

let fragmentSource = `
// "RayMarching starting point"
// by Martijn Steinrucken aka BigWings/CountFrolic - 2020
// License Creat.........完整代码请登录后点击上方下载按钮下载查看

网友评论0