GithubHelp home page GithubHelp logo

rainsilence0911 / raytracer Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 0.0 179 KB

用react和vue2 + es6 webpack实现光线反射和雾化算法(内附效果图)

License: MIT License

HTML 10.38% JavaScript 78.55% GLSL 7.70% Vue 3.36%

raytracer's Introduction

raytracer

本项目的目的是用react es6 webpack实现光线反射和雾化效果的算法。

效果图

image

功能

三维视角上下旋转

球体高光

球体上下左右移动

球体光线反射倒影

环境雾化效果(远的雾强,近的雾弱)

无任何图片,所有像素皆由片段着色器生成

What is standalone version

standalone版本是此项目的原型,功能已经全部实现。可在所有支持webgl的浏览器上双击打开运行

What is reactES6 version

用react进行了重构,用webpack的raw-loader去模块化vertex shader和fragment shader文件。将html的控制逻辑和canvas的绘画逻辑解藕

代码总共分为三层:

gl目录下的原创轻量级webgl绘图引擎

framework层:util,manager,event文件夹下,包与包之间互相独立,不存在互相依赖

应用层: component,observer文件夹下,两个package之间依然互相独立,不存在互相依赖,但是会依赖bootstrap的代码

What is vue2ES6 version

用vue2进行了重构,结构类似react版本

How to install

Standalone版本直接双击test.html就可以运行

es6版本用了webpack+hot deploy plugin作为开发环境

1)进入webpack.config.js的目录

  1. npm install

  2. npm run hot-dev-server

  3. open browser and input http://localhost:8080

原理

请参考我以前的blog

http://rainsilence.iteye.com/blog/1347754

raytracer's People

Contributors

rainsilence0911 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.