DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> HTML基礎知識 >> HTML5詳解 >> 這是html5中WebGL的演示
這是html5中WebGL的演示
編輯:HTML5詳解     
源文件:
部分代碼:
<!DOCTYPE Html>
<Html>
<head>
        <title>Geolocation love</title>
        <meta charset="utf-8">
        <script src="js/jquery-1.8.2.min.JS"></script>
        <script src="js/three.JS"></script>

        <script src="js/Detector.JS"></script>
        <script src="js/Stats.JS"></script>
        
        <script src="js/Tween.JS"></script>
        
        <script src="js/ShaderExtras.JS"></script>
        <script src="js/EffectComposer.JS"></script>
        <script src="js/ShaderPass.JS"></script>
        <script src="js/MaskPass.JS"></script>
        <script src="js/RenderPass.JS"></script>
        <script src="js/BloomPass.JS"></script>
        <script src="js/FilmPass.JS"></script>
        
        <script type="text/Javascript" src="js/main.JS"></script>
        
        <link href="style.css" rel="stylesheet" type="text/CSS" />
</head>

<body>

<div id="container"></div>

        <section class="box" id="messageBox">
                <div id="message">No matter where you are, always make the world brighter place</div>
                <div id="dist"></div>
                <div id="shareSwitcher"><a>Click to share your love with others!</a></div>
                <div id="likeIt"><a href="https://developer.mozilla.org/en-US/demos/detail/geolocation-love">Like this demo on DevDerby</a></div>
        </section>
        
        <section class="box" id="shareBox">
                <div id="form">
                        <h1>Type your message to the world</h1>
                        <textarea id="messageArea"> </textarea>
                        <input id="submitShare" type="button" value="get share link" />
                </div>
        </section>
</div>

</div>

<script type="x-shader/x-vertex" id="earthVertex">
varying vec3 vNormal;
varying vec2 vUv;
void main() {
        gl_Position = projectionMatrix * modelVIEwMatrix * vec4( position, 1.0 );
        vNormal = normalize( normalMatrix * normal );
        vUv = uv;
}
</script>
<script type="x-shader/x-fragment" id="earthFragment">
uniform sampler2D texture;
varying vec3 vNormal;
varying vec2 vUv;
void main() {
        vec3 diffuse = texture2D( texture, vUv ).xyz;
        float intensity = 1.15 - dot( vNormal, vec3( 0.0, 0.0, 1.0 ) );
        vec3 atmosphere = vec3( 1.0, 1.0, 1.0 ) * pow( intensity, 3.0 );
        gl_FragColor = vec4( diffuse + atmosphere, 1.0 );
}
</script>


<script type="x-shader/x-vertex" id="atmosphereVertex">
varying vec3 vNormal;
void main() {
        vNormal = normalize( normalMatrix * normal );
        gl_Position = projectionMatrix * modelVIEwMatrix * vec4( position, 1.0 );
}
</script>

<script type="x-shader/x-fragment" id="atmosphereFragment">
varying vec3 vNormal;
void main() {
        float intensity = pow( 0.8 - dot( vNormal, vec3( 0, 0, 1.0 ) ), 10.0 );
        gl_FragColor = vec4( 1.0, 1.0, 1.0, 1.0 ) * intensity;
}
</script>
</body>
</Html>
 
XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved