mirror of
https://github.com/tengge1/ShadowEditor.git
synced 2026-01-25 15:08:11 +00:00
地球几何体材质。
This commit is contained in:
parent
3443ac64cf
commit
12e30210ff
@ -1,9 +1,12 @@
|
||||
import GlobeGeometry from './GlobeGeometry';
|
||||
import GlobeMaterial from './GlobeMaterial';
|
||||
|
||||
/**
|
||||
* 地球
|
||||
*/
|
||||
function Globe() {
|
||||
var geometry = new THREE.BoxBufferGeometry(1, 1, 1);
|
||||
var material = new THREE.MeshBasicMaterial();
|
||||
var geometry = new GlobeGeometry();
|
||||
var material = new GlobeMaterial();
|
||||
|
||||
THREE.Mesh.call(this, geometry, material);
|
||||
|
||||
|
||||
11
ShadowEditor.Web/src/gis/GlobeGeometry.js
Normal file
11
ShadowEditor.Web/src/gis/GlobeGeometry.js
Normal file
@ -0,0 +1,11 @@
|
||||
/**
|
||||
* 地球几何体
|
||||
*/
|
||||
function GlobeGeometry() {
|
||||
THREE.PlaneBufferGeometry.call(this, 1, 1, 256, 256);
|
||||
}
|
||||
|
||||
GlobeGeometry.prototype = Object.create(THREE.PlaneBufferGeometry.prototype);
|
||||
GlobeGeometry.prototype.constructor = GlobeGeometry;
|
||||
|
||||
export default GlobeGeometry;
|
||||
17
ShadowEditor.Web/src/gis/GlobeMaterial.js
Normal file
17
ShadowEditor.Web/src/gis/GlobeMaterial.js
Normal file
@ -0,0 +1,17 @@
|
||||
import GlobeVertex from './shader/globe_vertex.glsl';
|
||||
import GlobeFragment from './shader/globe_fragment.glsl';
|
||||
|
||||
/**
|
||||
* 地球材质
|
||||
*/
|
||||
function GlobeMaterial() {
|
||||
THREE.ShaderMaterial.call(this, {
|
||||
vertexShader: GlobeVertex,
|
||||
fragmentShader: GlobeFragment
|
||||
});
|
||||
}
|
||||
|
||||
GlobeMaterial.prototype = Object.create(THREE.ShaderMaterial.prototype);
|
||||
GlobeMaterial.prototype.constructor = GlobeMaterial;
|
||||
|
||||
export default GlobeMaterial;
|
||||
3
ShadowEditor.Web/src/gis/shader/globe_fragment.glsl
Normal file
3
ShadowEditor.Web/src/gis/shader/globe_fragment.glsl
Normal file
@ -0,0 +1,3 @@
|
||||
void main() {
|
||||
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
||||
}
|
||||
3
ShadowEditor.Web/src/gis/shader/globe_vertex.glsl
Normal file
3
ShadowEditor.Web/src/gis/shader/globe_vertex.glsl
Normal file
@ -0,0 +1,3 @@
|
||||
void main() {
|
||||
gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user