├── README.md ├── models └── secondtemple │ ├── ark │ └── ark.blend │ ├── cow │ ├── cow.blend │ └── cow.jpg │ ├── priest │ ├── priest.blend │ └── priest.jpg │ ├── shofar │ ├── shofar.blend │ └── shofar.jpg │ └── temple │ ├── aerial2.jpg │ ├── aerial3.jpg │ ├── altar.png │ ├── arch.png │ ├── archeast.png │ ├── archtop.png │ ├── archtop2.png │ ├── ark.png │ ├── box.jpg │ ├── cemetary.jpg │ ├── clouds.png │ ├── cobblestones.jpg │ ├── column.png │ ├── column2.png │ ├── columntop.jpg │ ├── curtain.jpg │ ├── cyprus.png │ ├── dan.png │ ├── door.png │ ├── dooreast.jpg │ ├── god.png │ ├── ground.jpg │ ├── ground2.jpg │ ├── ground3.jpg │ ├── house.jpg │ ├── insidefloor.jpg │ ├── insidewall.jpg │ ├── insidewall2.jpg │ ├── minorah.png │ ├── olive.png │ ├── panorama.png │ ├── path.jpg │ ├── pool.jpg │ ├── roof.jpg │ ├── rooftop.jpg │ ├── showbreadbase.png │ ├── showbreadtop.png │ ├── sign.jpg │ ├── skydomeday.jpg │ ├── skydomesunset.jpg │ ├── steps.jpg │ ├── steps2.jpg │ ├── temple.blend │ ├── temple.jpg │ ├── templefront.jpg │ ├── templetop.png │ ├── towernorth2.jpg │ ├── towernorthi.png │ ├── wall.png │ ├── wallback.jpg │ ├── wallside.jpg │ ├── wallsidetop.png │ ├── westernwall.png │ ├── windowtop.jpg │ └── wood.jpg ├── server ├── base_server.php ├── openworld.sql └── secondtemple.php └── web └── secondtemple ├── actors ├── cow │ ├── cow.jpg │ └── cow.json ├── priest │ ├── priest.jpg │ └── priest.json └── shofar │ ├── shofar.jpg │ ├── shofar.json │ ├── shofar2.jpg │ └── shofar3.jpg ├── build ├── three.js └── three.min.js ├── icons ├── arrow.png ├── config.png ├── disconnect.png ├── msg.png ├── wave.png ├── who.png └── wings.png ├── index.html ├── js ├── AnimationClipCreator.js ├── BlendCharacter.js ├── BlendCharacterGui.js ├── BufferGeometryUtils.js ├── Car.js ├── Cloth.js ├── CurveExtras.js ├── Detector.js ├── Encodings.js ├── GPUComputationRenderer.js ├── GPUParticleSystem.js ├── Gyroscope.js ├── Half.js ├── ImprovedNoise.js ├── MD2Character.js ├── MD2CharacterComplex.js ├── MarchingCubes.js ├── Mirror.js ├── MorphAnimMesh.js ├── MorphAnimation.js ├── Ocean.js ├── Octree.js ├── PRNG.js ├── ParametricGeometries.js ├── RollerCoaster.js ├── ShaderGodRays.js ├── ShaderSkin.js ├── ShaderTerrain.js ├── ShaderToon.js ├── SimplexNoise.js ├── SkyShader.js ├── TimelinerController.js ├── TypedArrayUtils.js ├── UCSCharacter.js ├── ViveController.js ├── Volume.js ├── VolumeSlice.js ├── WaterShader.js ├── WebVR.js ├── animation │ ├── CCDIKSolver.js │ └── MMDPhysics.js ├── cameras │ ├── CinematicCamera.js │ └── CombinedCamera.js ├── controls │ ├── DeviceOrientationControls.js │ ├── DragControls.js │ ├── EditorControls.js │ ├── FirstPersonControls.js │ ├── FlyControls.js │ ├── MouseControls.js │ ├── OrbitControls.js │ ├── OrthographicTrackballControls.js │ ├── PointerLockControls.js │ ├── TrackballControls.js │ ├── TransformControls.js │ └── VRControls.js ├── crossfade │ ├── gui.js │ ├── scenes.js │ └── transition.js ├── curves │ ├── NURBSCurve.js │ ├── NURBSSurface.js │ └── NURBSUtils.js ├── effects │ ├── AnaglyphEffect.js │ ├── AsciiEffect.js │ ├── ParallaxBarrierEffect.js │ ├── PeppersGhostEffect.js │ ├── StereoEffect.js │ └── VREffect.js ├── exporters │ ├── OBJExporter.js │ ├── STLBinaryExporter.js │ ├── STLExporter.js │ └── TypedGeometryExporter.js ├── geometries │ ├── ConvexGeometry.js │ ├── DecalGeometry.js │ ├── TeapotBufferGeometry.js │ ├── hilbert2D.js │ └── hilbert3D.js ├── libs │ ├── ammo.js │ ├── charsetencoder.min.js │ ├── dat.gui.min.js │ ├── earcut.js │ ├── inflate.min.js │ ├── jszip.min.js │ ├── msgpack-js.js │ ├── pnltri.min.js │ ├── stats.min.js │ ├── system.min.js │ ├── timeliner_gui.min.js │ ├── tween.min.js │ ├── zlib_and_gzip.min.js │ └── zlib_and_gzip.min.js.map ├── loaders │ ├── 3MFLoader.js │ ├── AMFLoader.js │ ├── AWDLoader.js │ ├── AssimpJSONLoader.js │ ├── BabylonLoader.js │ ├── BinaryLoader.js │ ├── ColladaLoader.js │ ├── ColladaLoader2.js │ ├── DDSLoader.js │ ├── FBXLoader.js │ ├── GLTFLoader.js │ ├── HDRCubeTextureLoader.js │ ├── KMZLoader.js │ ├── MD2Loader.js │ ├── MMDLoader.js │ ├── MTLLoader.js │ ├── NRRDLoader.js │ ├── OBJLoader.js │ ├── PCDLoader.js │ ├── PDBLoader.js │ ├── PLYLoader.js │ ├── PVRLoader.js │ ├── PlayCanvasLoader.js │ ├── RGBELoader.js │ ├── STLLoader.js │ ├── SVGLoader.js │ ├── TGALoader.js │ ├── UTF8Loader.js │ ├── VRMLLoader.js │ ├── VTKLoader.js │ ├── collada │ │ ├── Animation.js │ │ ├── AnimationHandler.js │ │ └── KeyFrameAnimation.js │ ├── ctm │ │ ├── CTMLoader.js │ │ ├── CTMWorker.js │ │ ├── ctm.js │ │ ├── license │ │ │ ├── OpenCTM.txt │ │ │ ├── js-lzma.txt │ │ │ └── js-openctm.txt │ │ └── lzma.js │ ├── deprecated │ │ └── SceneLoader.js │ ├── gltf │ │ ├── glTF-parser.js │ │ ├── glTFAnimation.js │ │ ├── glTFLoader.js │ │ ├── glTFLoaderUtils.js │ │ ├── glTFShaders.js │ │ └── gltfUtilities.js │ └── sea3d │ │ ├── SEA3D.js │ │ ├── SEA3DDeflate.js │ │ ├── SEA3DLZMA.js │ │ ├── SEA3DLegacy.js │ │ └── SEA3DLoader.js ├── math │ ├── ColorConverter.js │ └── Lut.js ├── modifiers │ ├── BufferSubdivisionModifier.js │ ├── ExplodeModifier.js │ ├── SubdivisionModifier.js │ └── TessellateModifier.js ├── nodes │ ├── BuilderNode.js │ ├── ConstNode.js │ ├── FunctionCallNode.js │ ├── FunctionNode.js │ ├── GLNode.js │ ├── InputNode.js │ ├── NodeLib.js │ ├── NodeMaterial.js │ ├── RawNode.js │ ├── TempNode.js │ ├── accessors │ │ ├── CameraNode.js │ │ ├── ColorsNode.js │ │ ├── LightNode.js │ │ ├── NormalNode.js │ │ ├── PositionNode.js │ │ ├── ReflectNode.js │ │ ├── ScreenUVNode.js │ │ └── UVNode.js │ ├── inputs │ │ ├── ColorNode.js │ │ ├── CubeTextureNode.js │ │ ├── FloatNode.js │ │ ├── IntNode.js │ │ ├── Matrix4Node.js │ │ ├── MirrorNode.js │ │ ├── ScreenNode.js │ │ ├── TextureNode.js │ │ ├── Vector2Node.js │ │ ├── Vector3Node.js │ │ └── Vector4Node.js │ ├── materials │ │ ├── PhongNode.js │ │ ├── PhongNodeMaterial.js │ │ ├── StandardNode.js │ │ └── StandardNodeMaterial.js │ ├── math │ │ ├── Math1Node.js │ │ ├── Math2Node.js │ │ ├── Math3Node.js │ │ └── OperatorNode.js │ ├── postprocessing │ │ └── NodePass.js │ └── utils │ │ ├── ColorAdjustmentNode.js │ │ ├── JoinNode.js │ │ ├── LuminanceNode.js │ │ ├── NoiseNode.js │ │ ├── NormalMapNode.js │ │ ├── ResolutionNode.js │ │ ├── RoughnessToBlinnExponentNode.js │ │ ├── SwitchNode.js │ │ ├── TimerNode.js │ │ └── VelocityNode.js ├── objects │ └── ShadowMesh.js ├── pmrem │ ├── PMREMCubeUVPacker.js │ └── PMREMGenerator.js ├── postprocessing │ ├── AdaptiveToneMappingPass.js │ ├── BloomPass.js │ ├── BokehPass.js │ ├── ClearPass.js │ ├── DotScreenPass.js │ ├── EffectComposer.js │ ├── FilmPass.js │ ├── GlitchPass.js │ ├── ManualMSAARenderPass.js │ ├── MaskPass.js │ ├── RenderPass.js │ ├── SMAAPass.js │ ├── SavePass.js │ ├── ShaderPass.js │ ├── TAARenderPass.js │ └── TexturePass.js ├── renderers │ ├── CSS2DRenderer.js │ ├── CSS3DRenderer.js │ ├── CanvasRenderer.js │ ├── Projector.js │ ├── RaytracingRenderer.js │ ├── RaytracingWorker.js │ ├── SVGRenderer.js │ └── SoftwareRenderer.js ├── shaders │ ├── BasicShader.js │ ├── BleachBypassShader.js │ ├── BlendShader.js │ ├── BokehShader.js │ ├── BokehShader2.js │ ├── BrightnessContrastShader.js │ ├── ColorCorrectionShader.js │ ├── ColorifyShader.js │ ├── ConvolutionShader.js │ ├── CopyShader.js │ ├── DOFMipMapShader.js │ ├── DigitalGlitch.js │ ├── DotScreenShader.js │ ├── EdgeShader.js │ ├── EdgeShader2.js │ ├── FXAAShader.js │ ├── FilmShader.js │ ├── FocusShader.js │ ├── FresnelShader.js │ ├── GammaCorrectionShader.js │ ├── HorizontalBlurShader.js │ ├── HorizontalTiltShiftShader.js │ ├── HueSaturationShader.js │ ├── KaleidoShader.js │ ├── LuminosityShader.js │ ├── MirrorShader.js │ ├── NormalMapShader.js │ ├── OceanShaders.js │ ├── ParallaxShader.js │ ├── RGBShiftShader.js │ ├── SMAAShader.js │ ├── SSAOShader.js │ ├── SepiaShader.js │ ├── TechnicolorShader.js │ ├── ToneMapShader.js │ ├── TriangleBlurShader.js │ ├── UnpackDepthRGBAShader.js │ ├── VerticalBlurShader.js │ ├── VerticalTiltShiftShader.js │ └── VignetteShader.js └── utils │ ├── GeometryUtils.js │ ├── ImageUtils.js │ ├── ShadowMapViewer.js │ └── UVsDebug.js ├── models ├── ark │ ├── ark.obj │ ├── lensflare0.png │ └── lensflare2.jpg └── temple │ ├── aerial2.jpg │ ├── aerial3.jpg │ ├── altar.png │ ├── arch.png │ ├── archeast.png │ ├── archtop.png │ ├── archtop2.png │ ├── ark.png │ ├── box.jpg │ ├── cemetary.jpg │ ├── clouds.png │ ├── cobblestones.jpg │ ├── column.png │ ├── column2.png │ ├── columntop.jpg │ ├── curtain.jpg │ ├── cyprus.png │ ├── dan.png │ ├── door.png │ ├── dooreast.jpg │ ├── god.png │ ├── ground.jpg │ ├── ground2.jpg │ ├── ground3.jpg │ ├── house.jpg │ ├── insidefloor.jpg │ ├── insidewall.jpg │ ├── insidewall2.jpg │ ├── minorah.png │ ├── olive.png │ ├── panorama.png │ ├── path.jpg │ ├── pool.jpg │ ├── roof.jpg │ ├── rooftop.jpg │ ├── showbreadbase.png │ ├── showbreadtop.png │ ├── sign.jpg │ ├── skydomeday.jpg │ ├── skydomesunset.jpg │ ├── steps.jpg │ ├── steps2.jpg │ ├── temple.jpg │ ├── temple.mtl │ ├── temple.obj │ ├── templefront.jpg │ ├── templetop.png │ ├── towernorth2.jpg │ ├── towernorthi.png │ ├── wall.png │ ├── wallback.jpg │ ├── wallside.jpg │ ├── wallsidetop.png │ ├── westernwall.png │ ├── windowtop.jpg │ └── wood.jpg ├── openworldjs ├── OpenWorld.js ├── VolumetricFire.js └── VolumetricFireTextures │ ├── firetex.png │ └── nzw.png └── sounds ├── blessing.mp3 ├── flap1.mp3 ├── flap2.mp3 ├── flap3.mp3 ├── moo1.mp3 ├── moo2.mp3 ├── moo3.mp3 └── shofar.mp3 /models/secondtemple/ark/ark.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/ark/ark.blend -------------------------------------------------------------------------------- /models/secondtemple/cow/cow.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/cow/cow.blend -------------------------------------------------------------------------------- /models/secondtemple/cow/cow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/cow/cow.jpg -------------------------------------------------------------------------------- /models/secondtemple/priest/priest.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/priest/priest.blend -------------------------------------------------------------------------------- /models/secondtemple/priest/priest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/priest/priest.jpg -------------------------------------------------------------------------------- /models/secondtemple/shofar/shofar.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/shofar/shofar.blend -------------------------------------------------------------------------------- /models/secondtemple/shofar/shofar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/shofar/shofar.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/aerial2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/aerial2.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/aerial3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/aerial3.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/altar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/altar.png -------------------------------------------------------------------------------- /models/secondtemple/temple/arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/arch.png -------------------------------------------------------------------------------- /models/secondtemple/temple/archeast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/archeast.png -------------------------------------------------------------------------------- /models/secondtemple/temple/archtop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/archtop.png -------------------------------------------------------------------------------- /models/secondtemple/temple/archtop2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/archtop2.png -------------------------------------------------------------------------------- /models/secondtemple/temple/ark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/ark.png -------------------------------------------------------------------------------- /models/secondtemple/temple/box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/box.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/cemetary.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/cemetary.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/clouds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/clouds.png -------------------------------------------------------------------------------- /models/secondtemple/temple/cobblestones.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/cobblestones.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/column.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/column.png -------------------------------------------------------------------------------- /models/secondtemple/temple/column2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/column2.png -------------------------------------------------------------------------------- /models/secondtemple/temple/columntop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/columntop.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/curtain.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/curtain.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/cyprus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/cyprus.png -------------------------------------------------------------------------------- /models/secondtemple/temple/dan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/dan.png -------------------------------------------------------------------------------- /models/secondtemple/temple/door.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/door.png -------------------------------------------------------------------------------- /models/secondtemple/temple/dooreast.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/dooreast.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/god.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/god.png -------------------------------------------------------------------------------- /models/secondtemple/temple/ground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/ground.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/ground2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/ground2.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/ground3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/ground3.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/house.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/house.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/insidefloor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/insidefloor.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/insidewall.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/insidewall.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/insidewall2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/insidewall2.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/minorah.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/minorah.png -------------------------------------------------------------------------------- /models/secondtemple/temple/olive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/olive.png -------------------------------------------------------------------------------- /models/secondtemple/temple/panorama.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/panorama.png -------------------------------------------------------------------------------- /models/secondtemple/temple/path.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/path.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/pool.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/pool.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/roof.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/roof.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/rooftop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/rooftop.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/showbreadbase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/showbreadbase.png -------------------------------------------------------------------------------- /models/secondtemple/temple/showbreadtop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/showbreadtop.png -------------------------------------------------------------------------------- /models/secondtemple/temple/sign.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/sign.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/skydomeday.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/skydomeday.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/skydomesunset.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/skydomesunset.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/steps.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/steps.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/steps2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/steps2.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/temple.blend: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/temple.blend -------------------------------------------------------------------------------- /models/secondtemple/temple/temple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/temple.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/templefront.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/templefront.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/templetop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/templetop.png -------------------------------------------------------------------------------- /models/secondtemple/temple/towernorth2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/towernorth2.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/towernorthi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/towernorthi.png -------------------------------------------------------------------------------- /models/secondtemple/temple/wall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/wall.png -------------------------------------------------------------------------------- /models/secondtemple/temple/wallback.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/wallback.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/wallside.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/wallside.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/wallsidetop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/wallsidetop.png -------------------------------------------------------------------------------- /models/secondtemple/temple/westernwall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/westernwall.png -------------------------------------------------------------------------------- /models/secondtemple/temple/windowtop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/windowtop.jpg -------------------------------------------------------------------------------- /models/secondtemple/temple/wood.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/models/secondtemple/temple/wood.jpg -------------------------------------------------------------------------------- /server/secondtemple.php: -------------------------------------------------------------------------------- 1 | Welcome to Second Temple"; 20 | $alone_message="You the only player on"; 21 | 22 | 23 | // When a person logs on this is called to set the spawn position 24 | // Here just try to make sure players aren't all on top of eachother 25 | function game_spawn_position() 26 | { 27 | global $ret; 28 | global $position; 29 | // normal spawn pos is 8.59 1.31 30 | if ($ret["num_players"]>1&&abs(8.59-$position[0]->x)+abs(1.31-$position[0]->y)<0.2) { 31 | // Player is entering so make sure players are not on top of eachother so make slightly random 32 | $ret["player_pos"]=array($position[0]->x+random()*0.5-0.25,$position[0]->y+random()*0.5-0.25,0); 33 | } 34 | } 35 | 36 | function game_action() 37 | { 38 | global $position; 39 | if ($position[0]->action=="wave") { 40 | tell_message($position[0]->name,"You wave", userid()); 41 | shout_message_exclude($position[0]->name,$position[0]->name." waves",userid()); 42 | } 43 | } 44 | 45 | 46 | include_once "base_server.php"; 47 | 48 | ?> 49 | -------------------------------------------------------------------------------- /web/secondtemple/actors/cow/cow.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/actors/cow/cow.jpg -------------------------------------------------------------------------------- /web/secondtemple/actors/priest/priest.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/actors/priest/priest.jpg -------------------------------------------------------------------------------- /web/secondtemple/actors/shofar/shofar.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/actors/shofar/shofar.jpg -------------------------------------------------------------------------------- /web/secondtemple/actors/shofar/shofar2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/actors/shofar/shofar2.jpg -------------------------------------------------------------------------------- /web/secondtemple/actors/shofar/shofar3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/actors/shofar/shofar3.jpg -------------------------------------------------------------------------------- /web/secondtemple/icons/arrow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/icons/arrow.png -------------------------------------------------------------------------------- /web/secondtemple/icons/config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/icons/config.png -------------------------------------------------------------------------------- /web/secondtemple/icons/disconnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/icons/disconnect.png -------------------------------------------------------------------------------- /web/secondtemple/icons/msg.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/icons/msg.png -------------------------------------------------------------------------------- /web/secondtemple/icons/wave.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/icons/wave.png -------------------------------------------------------------------------------- /web/secondtemple/icons/who.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/icons/who.png -------------------------------------------------------------------------------- /web/secondtemple/icons/wings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/icons/wings.png -------------------------------------------------------------------------------- /web/secondtemple/js/Detector.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * @author mr.doob / http://mrdoob.com/ 4 | */ 5 | 6 | var Detector = { 7 | 8 | canvas: !! window.CanvasRenderingContext2D, 9 | webgl: ( function () { 10 | 11 | try { 12 | 13 | var canvas = document.createElement( 'canvas' ); return !! ( window.WebGLRenderingContext && ( canvas.getContext( 'webgl' ) || canvas.getContext( 'experimental-webgl' ) ) ); 14 | 15 | } catch ( e ) { 16 | 17 | return false; 18 | 19 | } 20 | 21 | } )(), 22 | workers: !! window.Worker, 23 | fileapi: window.File && window.FileReader && window.FileList && window.Blob, 24 | 25 | getWebGLErrorMessage: function () { 26 | 27 | var element = document.createElement( 'div' ); 28 | element.id = 'webgl-error-message'; 29 | element.style.fontFamily = 'monospace'; 30 | element.style.fontSize = '13px'; 31 | element.style.fontWeight = 'normal'; 32 | element.style.textAlign = 'center'; 33 | element.style.background = '#fff'; 34 | element.style.color = '#000'; 35 | element.style.padding = '1.5em'; 36 | element.style.width = '400px'; 37 | element.style.margin = '5em auto 0'; 38 | 39 | if ( ! this.webgl ) { 40 | 41 | element.innerHTML = window.WebGLRenderingContext ? [ 42 | 'Your graphics card does not seem to support WebGL.
', 43 | 'Find out how to get it here.' 44 | ].join( '\n' ) : [ 45 | 'Your browser does not seem to support WebGL.
', 46 | 'Find out how to get it here.' 47 | ].join( '\n' ); 48 | 49 | } 50 | 51 | return element; 52 | 53 | }, 54 | 55 | addGetWebGLMessage: function ( parameters ) { 56 | 57 | var parent, id, element; 58 | 59 | parameters = parameters || {}; 60 | 61 | parent = parameters.parent !== undefined ? parameters.parent : document.body; 62 | id = parameters.id !== undefined ? parameters.id : 'oldie'; 63 | 64 | element = Detector.getWebGLErrorMessage(); 65 | element.id = id; 66 | 67 | parent.appendChild( element ); 68 | 69 | } 70 | 71 | }; 72 | 73 | // browserify support 74 | if ( typeof module === 'object' ) { 75 | 76 | module.exports = Detector; 77 | 78 | } 79 | -------------------------------------------------------------------------------- /web/secondtemple/js/Encodings.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author Ben Houston / http://clara.io / bhouston 3 | * @author Prashant Sharma / spidersharma03 4 | */ 5 | 6 | THREE.Encodings = function() { 7 | if( THREE.toHalf === undefined ) throw new Error("THREE.Encodings is required for HDRCubeMapLoader when loading half data."); 8 | } 9 | 10 | THREE.Encodings.RGBEByteToRGBFloat = function( sourceArray, sourceOffset, destArray, destOffset ) { 11 | var e = sourceArray[sourceOffset+3]; 12 | var scale = Math.pow(2.0, e - 128.0) / 255.0; 13 | 14 | destArray[destOffset+0] = sourceArray[sourceOffset+0] * scale; 15 | destArray[destOffset+1] = sourceArray[sourceOffset+1] * scale; 16 | destArray[destOffset+2] = sourceArray[sourceOffset+2] * scale; 17 | } 18 | 19 | THREE.Encodings.RGBEByteToRGBHalf = function( sourceArray, sourceOffset, destArray, destOffset ) { 20 | var e = sourceArray[sourceOffset+3]; 21 | var scale = Math.pow(2.0, e - 128.0) / 255.0; 22 | 23 | destArray[destOffset+0] = THREE.toHalf( sourceArray[sourceOffset+0] * scale ); 24 | destArray[destOffset+1] = THREE.toHalf( sourceArray[sourceOffset+1] * scale ); 25 | destArray[destOffset+2] = THREE.toHalf( sourceArray[sourceOffset+2] * scale ); 26 | } 27 | -------------------------------------------------------------------------------- /web/secondtemple/js/Gyroscope.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.Gyroscope = function () { 6 | 7 | THREE.Object3D.call( this ); 8 | 9 | }; 10 | 11 | THREE.Gyroscope.prototype = Object.create( THREE.Object3D.prototype ); 12 | THREE.Gyroscope.prototype.constructor = THREE.Gyroscope; 13 | 14 | THREE.Gyroscope.prototype.updateMatrixWorld = ( function () { 15 | 16 | var translationObject = new THREE.Vector3(); 17 | var quaternionObject = new THREE.Quaternion(); 18 | var scaleObject = new THREE.Vector3(); 19 | 20 | var translationWorld = new THREE.Vector3(); 21 | var quaternionWorld = new THREE.Quaternion(); 22 | var scaleWorld = new THREE.Vector3(); 23 | 24 | return function updateMatrixWorld( force ) { 25 | 26 | this.matrixAutoUpdate && this.updateMatrix(); 27 | 28 | // update matrixWorld 29 | 30 | if ( this.matrixWorldNeedsUpdate || force ) { 31 | 32 | if ( this.parent !== null ) { 33 | 34 | this.matrixWorld.multiplyMatrices( this.parent.matrixWorld, this.matrix ); 35 | 36 | this.matrixWorld.decompose( translationWorld, quaternionWorld, scaleWorld ); 37 | this.matrix.decompose( translationObject, quaternionObject, scaleObject ); 38 | 39 | this.matrixWorld.compose( translationWorld, quaternionObject, scaleWorld ); 40 | 41 | 42 | } else { 43 | 44 | this.matrixWorld.copy( this.matrix ); 45 | 46 | } 47 | 48 | 49 | this.matrixWorldNeedsUpdate = false; 50 | 51 | force = true; 52 | 53 | } 54 | 55 | // update children 56 | 57 | for ( var i = 0, l = this.children.length; i < l; i ++ ) { 58 | 59 | this.children[ i ].updateMatrixWorld( force ); 60 | 61 | } 62 | 63 | }; 64 | 65 | }() ); 66 | -------------------------------------------------------------------------------- /web/secondtemple/js/Half.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Source: http://gamedev.stackexchange.com/questions/17326/conversion-of-a-number-from-single-precision-floating-point-representation-to-a/17410#17410 3 | */ 4 | 5 | THREE.toHalf = (function() { 6 | var floatView = new Float32Array(1); 7 | var int32View = new Int32Array(floatView.buffer); 8 | 9 | /* This method is faster than the OpenEXR implementation (very often 10 | * used, eg. in Ogre), with the additional benefit of rounding, inspired 11 | * by James Tursa?s half-precision code. */ 12 | return function toHalf(val) { 13 | 14 | floatView[0] = val; 15 | var x = int32View[0]; 16 | 17 | var bits = (x >> 16) & 0x8000; /* Get the sign */ 18 | var m = (x >> 12) & 0x07ff; /* Keep one extra bit for rounding */ 19 | var e = (x >> 23) & 0xff; /* Using int is faster here */ 20 | 21 | /* If zero, or denormal, or exponent underflows too much for a denormal 22 | * half, return signed zero. */ 23 | if (e < 103) { 24 | return bits; 25 | } 26 | 27 | /* If NaN, return NaN. If Inf or exponent overflow, return Inf. */ 28 | if (e > 142) { 29 | bits |= 0x7c00; 30 | /* If exponent was 0xff and one mantissa bit was set, it means NaN, 31 | * not Inf, so make sure we set one mantissa bit too. */ 32 | bits |= ((e == 255) ? 0 : 1) && (x & 0x007fffff); 33 | return bits; 34 | } 35 | 36 | /* If exponent underflows but not too much, return a denormal */ 37 | if (e < 113) { 38 | m |= 0x0800; 39 | /* Extra rounding may overflow and set mantissa to 0 and exponent 40 | * to 1, which is OK. */ 41 | bits |= (m >> (114 - e)) + ((m >> (113 - e)) & 1); 42 | return bits; 43 | } 44 | 45 | bits |= ((e - 112) << 10) | (m >> 1); 46 | /* Extra rounding. An overflow will set mantissa to 0 and increment 47 | * the exponent, which is OK. */ 48 | bits += m & 1; 49 | return bits; 50 | }; 51 | }()); 52 | -------------------------------------------------------------------------------- /web/secondtemple/js/ImprovedNoise.js: -------------------------------------------------------------------------------- 1 | // http://mrl.nyu.edu/~perlin/noise/ 2 | 3 | var ImprovedNoise = function () { 4 | 5 | var p = [ 151,160,137,91,90,15,131,13,201,95,96,53,194,233,7,225,140,36,103,30,69,142,8,99,37,240,21,10, 6 | 23,190,6,148,247,120,234,75,0,26,197,62,94,252,219,203,117,35,11,32,57,177,33,88,237,149,56,87, 7 | 174,20,125,136,171,168,68,175,74,165,71,134,139,48,27,166,77,146,158,231,83,111,229,122,60,211, 8 | 133,230,220,105,92,41,55,46,245,40,244,102,143,54,65,25,63,161,1,216,80,73,209,76,132,187,208, 9 | 89,18,169,200,196,135,130,116,188,159,86,164,100,109,198,173,186,3,64,52,217,226,250,124,123,5, 10 | 202,38,147,118,126,255,82,85,212,207,206,59,227,47,16,58,17,182,189,28,42,223,183,170,213,119, 11 | 248,152,2,44,154,163,70,221,153,101,155,167,43,172,9,129,22,39,253,19,98,108,110,79,113,224,232, 12 | 178,185,112,104,218,246,97,228,251,34,242,193,238,210,144,12,191,179,162,241,81,51,145,235,249, 13 | 14,239,107,49,192,214,31,181,199,106,157,184,84,204,176,115,121,50,45,127,4,150,254,138,236,205, 14 | 93,222,114,67,29,24,72,243,141,128,195,78,66,215,61,156,180 ]; 15 | 16 | for (var i = 0; i < 256 ; i ++) { 17 | 18 | p[256 + i] = p[i]; 19 | 20 | } 21 | 22 | function fade(t) { 23 | 24 | return t * t * t * (t * (t * 6 - 15) + 10); 25 | 26 | } 27 | 28 | function lerp(t, a, b) { 29 | 30 | return a + t * (b - a); 31 | 32 | } 33 | 34 | function grad(hash, x, y, z) { 35 | 36 | var h = hash & 15; 37 | var u = h < 8 ? x : y, v = h < 4 ? y : h == 12 || h == 14 ? x : z; 38 | return ((h&1) == 0 ? u : -u) + ((h&2) == 0 ? v : -v); 39 | 40 | } 41 | 42 | return { 43 | 44 | noise: function (x, y, z) { 45 | 46 | var floorX = ~~x, floorY = ~~y, floorZ = ~~z; 47 | 48 | var X = floorX & 255, Y = floorY & 255, Z = floorZ & 255; 49 | 50 | x -= floorX; 51 | y -= floorY; 52 | z -= floorZ; 53 | 54 | var xMinus1 = x - 1, yMinus1 = y - 1, zMinus1 = z - 1; 55 | 56 | var u = fade(x), v = fade(y), w = fade(z); 57 | 58 | var A = p[X] + Y, AA = p[A] + Z, AB = p[A + 1] + Z, B = p[X + 1] + Y, BA = p[B] + Z, BB = p[B + 1] + Z; 59 | 60 | return lerp(w, lerp(v, lerp(u, grad(p[AA], x, y, z), 61 | grad(p[BA], xMinus1, y, z)), 62 | lerp(u, grad(p[AB], x, yMinus1, z), 63 | grad(p[BB], xMinus1, yMinus1, z))), 64 | lerp(v, lerp(u, grad(p[AA + 1], x, y, zMinus1), 65 | grad(p[BA + 1], xMinus1, y, z - 1)), 66 | lerp(u, grad(p[AB + 1], x, yMinus1, zMinus1), 67 | grad(p[BB + 1], xMinus1, yMinus1, zMinus1)))); 68 | 69 | } 70 | } 71 | }; 72 | -------------------------------------------------------------------------------- /web/secondtemple/js/MorphAnimMesh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.MorphAnimMesh = function ( geometry, material ) { 6 | 7 | THREE.Mesh.call( this, geometry, material ); 8 | 9 | this.type = 'MorphAnimMesh'; 10 | 11 | this.mixer = new THREE.AnimationMixer( this ); 12 | this.activeAction = null; 13 | }; 14 | 15 | THREE.MorphAnimMesh.prototype = Object.create( THREE.Mesh.prototype ); 16 | THREE.MorphAnimMesh.prototype.constructor = THREE.MorphAnimMesh; 17 | 18 | THREE.MorphAnimMesh.prototype.setDirectionForward = function () { 19 | 20 | this.mixer.timeScale = 1.0; 21 | 22 | }; 23 | 24 | THREE.MorphAnimMesh.prototype.setDirectionBackward = function () { 25 | 26 | this.mixer.timeScale = -1.0; 27 | 28 | }; 29 | 30 | THREE.MorphAnimMesh.prototype.playAnimation = function ( label, fps ) { 31 | 32 | if( this.activeAction ) { 33 | 34 | this.activeAction.stop(); 35 | this.activeAction = null; 36 | 37 | } 38 | 39 | var clip = THREE.AnimationClip.findByName( this, label ); 40 | 41 | if ( clip ) { 42 | 43 | var action = this.mixer.clipAction( clip ); 44 | action.timeScale = ( clip.tracks.length * fps ) / clip.duration; 45 | this.activeAction = action.play(); 46 | 47 | } else { 48 | 49 | throw new Error( 'THREE.MorphAnimMesh: animations[' + label + '] undefined in .playAnimation()' ); 50 | 51 | } 52 | 53 | }; 54 | 55 | THREE.MorphAnimMesh.prototype.updateAnimation = function ( delta ) { 56 | 57 | this.mixer.update( delta ); 58 | 59 | }; 60 | 61 | THREE.MorphAnimMesh.prototype.copy = function ( source ) { 62 | 63 | THREE.Mesh.prototype.copy.call( this, source ); 64 | 65 | this.mixer = new THREE.AnimationMixer( this ); 66 | 67 | return this; 68 | 69 | }; 70 | -------------------------------------------------------------------------------- /web/secondtemple/js/MorphAnimation.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com 3 | * @author willy-vvu / http://willy-vvu.github.io 4 | */ 5 | 6 | THREE.MorphAnimation = function ( mesh ) { 7 | 8 | this.mesh = mesh; 9 | this.frames = mesh.morphTargetInfluences.length; 10 | this.currentTime = 0; 11 | this.duration = 1000; 12 | this.loop = true; 13 | this.lastFrame = 0; 14 | this.currentFrame = 0; 15 | 16 | this.isPlaying = false; 17 | 18 | }; 19 | 20 | THREE.MorphAnimation.prototype = { 21 | 22 | constructor: THREE.MorphAnimation, 23 | 24 | play: function () { 25 | 26 | this.isPlaying = true; 27 | 28 | }, 29 | 30 | pause: function () { 31 | 32 | this.isPlaying = false; 33 | 34 | }, 35 | 36 | update: function ( delta ) { 37 | 38 | if ( this.isPlaying === false ) return; 39 | 40 | this.currentTime += delta; 41 | 42 | if ( this.loop === true && this.currentTime > this.duration ) { 43 | 44 | this.currentTime %= this.duration; 45 | 46 | } 47 | 48 | this.currentTime = Math.min( this.currentTime, this.duration ); 49 | 50 | var frameTime = this.duration / this.frames; 51 | var frame = Math.floor( this.currentTime / frameTime ); 52 | 53 | var influences = this.mesh.morphTargetInfluences; 54 | 55 | if ( frame !== this.currentFrame ) { 56 | 57 | influences[ this.lastFrame ] = 0; 58 | influences[ this.currentFrame ] = 1; 59 | influences[ frame ] = 0; 60 | 61 | this.lastFrame = this.currentFrame; 62 | this.currentFrame = frame; 63 | 64 | } 65 | 66 | var mix = ( this.currentTime % frameTime ) / frameTime; 67 | 68 | influences[ frame ] = mix; 69 | influences[ this.lastFrame ] = 1 - mix; 70 | 71 | } 72 | 73 | }; 74 | -------------------------------------------------------------------------------- /web/secondtemple/js/PRNG.js: -------------------------------------------------------------------------------- 1 | // Park-Miller-Carta Pseudo-Random Number Generator 2 | // https://github.com/pnitsch/BitmapData.js/blob/master/js/BitmapData.js 3 | 4 | var PRNG = function () { 5 | 6 | this.seed = 1; 7 | this.next = function() { 8 | 9 | return ( this.gen() / 2147483647 ); 10 | 11 | }; 12 | this.nextRange = function( min, max ) { 13 | 14 | return min + ( ( max - min ) * this.next() ) 15 | 16 | }; 17 | this.gen = function() { 18 | 19 | return this.seed = ( this.seed * 16807 ) % 2147483647; 20 | 21 | }; 22 | 23 | }; 24 | -------------------------------------------------------------------------------- /web/secondtemple/js/ViveController.js: -------------------------------------------------------------------------------- 1 | THREE.ViveController = function ( id ) { 2 | 3 | THREE.Object3D.call( this ); 4 | 5 | this.matrixAutoUpdate = false; 6 | this.standingMatrix = new THREE.Matrix4(); 7 | 8 | var scope = this; 9 | 10 | function update() { 11 | 12 | requestAnimationFrame( update ); 13 | 14 | var gamepad = navigator.getGamepads()[ id ]; 15 | 16 | if ( gamepad !== undefined && gamepad.pose !== null ) { 17 | 18 | var pose = gamepad.pose; 19 | 20 | scope.position.fromArray( pose.position ); 21 | scope.quaternion.fromArray( pose.orientation ); 22 | scope.matrix.compose( scope.position, scope.quaternion, scope.scale ); 23 | scope.matrix.multiplyMatrices( scope.standingMatrix, scope.matrix ); 24 | scope.matrixWorldNeedsUpdate = true; 25 | 26 | scope.visible = true; 27 | 28 | } else { 29 | 30 | scope.visible = false; 31 | 32 | } 33 | 34 | } 35 | 36 | update(); 37 | 38 | }; 39 | 40 | THREE.ViveController.prototype = Object.create( THREE.Object3D.prototype ); 41 | THREE.ViveController.prototype.constructor = THREE.ViveController; 42 | -------------------------------------------------------------------------------- /web/secondtemple/js/controls/MouseControls.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author dmarcos / http://github.com/dmarcos 3 | * 4 | * This controls allow to change the orientation of the camera using the mouse 5 | */ 6 | 7 | THREE.MouseControls = function ( object ) { 8 | 9 | var scope = this; 10 | var PI_2 = Math.PI / 2; 11 | var mouseQuat = { 12 | x: new THREE.Quaternion(), 13 | y: new THREE.Quaternion() 14 | }; 15 | var object = object; 16 | var xVector = new THREE.Vector3( 1, 0, 0 ); 17 | var yVector = new THREE.Vector3( 0, 1, 0 ); 18 | 19 | var onMouseMove = function ( event ) { 20 | 21 | if ( scope.enabled === false ) return; 22 | 23 | var orientation = scope.orientation; 24 | 25 | var movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0; 26 | var movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0; 27 | 28 | orientation.y += movementX * 0.0025; 29 | orientation.x += movementY * 0.0025; 30 | 31 | orientation.x = Math.max( - PI_2, Math.min( PI_2, orientation.x ) ); 32 | 33 | }; 34 | 35 | this.enabled = true; 36 | 37 | this.orientation = { 38 | x: 0, 39 | y: 0, 40 | }; 41 | 42 | this.update = function() { 43 | 44 | if ( this.enabled === false ) return; 45 | 46 | mouseQuat.x.setFromAxisAngle( xVector, this.orientation.x ); 47 | mouseQuat.y.setFromAxisAngle( yVector, this.orientation.y ); 48 | object.quaternion.copy( mouseQuat.y ).multiply( mouseQuat.x ); 49 | return; 50 | 51 | }; 52 | 53 | this.dispose = function() { 54 | 55 | document.removeEventListener( 'mousemove', onMouseMove, false ); 56 | 57 | } 58 | 59 | document.addEventListener( 'mousemove', onMouseMove, false ); 60 | 61 | }; 62 | -------------------------------------------------------------------------------- /web/secondtemple/js/controls/PointerLockControls.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.PointerLockControls = function ( camera ) { 6 | 7 | var scope = this; 8 | 9 | camera.rotation.set( 0, 0, 0 ); 10 | 11 | var pitchObject = new THREE.Object3D(); 12 | pitchObject.add( camera ); 13 | 14 | var yawObject = new THREE.Object3D(); 15 | yawObject.position.y = 10; 16 | yawObject.add( pitchObject ); 17 | 18 | var PI_2 = Math.PI / 2; 19 | 20 | var onMouseMove = function ( event ) { 21 | 22 | if ( scope.enabled === false ) return; 23 | 24 | var movementX = event.movementX || event.mozMovementX || event.webkitMovementX || 0; 25 | var movementY = event.movementY || event.mozMovementY || event.webkitMovementY || 0; 26 | 27 | yawObject.rotation.y -= movementX * 0.002; 28 | pitchObject.rotation.x -= movementY * 0.002; 29 | 30 | pitchObject.rotation.x = Math.max( - PI_2, Math.min( PI_2, pitchObject.rotation.x ) ); 31 | 32 | }; 33 | 34 | this.dispose = function() { 35 | 36 | document.removeEventListener( 'mousemove', onMouseMove, false ); 37 | 38 | }; 39 | 40 | document.addEventListener( 'mousemove', onMouseMove, false ); 41 | 42 | this.enabled = false; 43 | 44 | this.getObject = function () { 45 | 46 | return yawObject; 47 | 48 | }; 49 | 50 | this.getDirection = function() { 51 | 52 | // assumes the camera itself is not rotated 53 | 54 | var direction = new THREE.Vector3( 0, 0, - 1 ); 55 | var rotation = new THREE.Euler( 0, 0, 0, "YXZ" ); 56 | 57 | return function( v ) { 58 | 59 | rotation.set( pitchObject.rotation.x, yawObject.rotation.y, 0 ); 60 | 61 | v.copy( direction ).applyEuler( rotation ); 62 | 63 | return v; 64 | 65 | }; 66 | 67 | }(); 68 | 69 | }; 70 | -------------------------------------------------------------------------------- /web/secondtemple/js/crossfade/gui.js: -------------------------------------------------------------------------------- 1 | var transitionParams = { 2 | "useTexture": true, 3 | "transition": 0.5, 4 | "transitionSpeed": 2.0, 5 | "texture": 5, 6 | "loopTexture": true, 7 | "animateTransition": true, 8 | "textureThreshold": 0.3 9 | }; 10 | 11 | function initGUI() { 12 | 13 | var gui = new dat.GUI(); 14 | 15 | gui.add( transitionParams, "useTexture" ).onChange( function( value ) { 16 | 17 | transition.useTexture( value ); 18 | 19 | } ); 20 | 21 | gui.add( transitionParams, 'loopTexture' ); 22 | 23 | gui.add( transitionParams, 'texture', { Perlin: 0, Squares: 1, Cells: 2, Distort: 3, Gradient: 4, Radial: 5 } ).onChange( function( value ) { 24 | 25 | transition.setTexture( value ); 26 | 27 | } ).listen(); 28 | 29 | gui.add( transitionParams, "textureThreshold", 0, 1, 0.01 ).onChange( function( value ) { 30 | 31 | transition.setTextureThreshold( value ); 32 | 33 | } ); 34 | 35 | gui.add( transitionParams, "animateTransition" ); 36 | gui.add( transitionParams, "transition", 0, 1, 0.01 ).listen(); 37 | gui.add( transitionParams, "transitionSpeed", 0.5, 5, 0.01 ); 38 | 39 | } 40 | -------------------------------------------------------------------------------- /web/secondtemple/js/curves/NURBSCurve.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author renej 3 | * NURBS curve object 4 | * 5 | * Derives from Curve, overriding getPoint and getTangent. 6 | * 7 | * Implementation is based on (x, y [, z=0 [, w=1]]) control points with w=weight. 8 | * 9 | **/ 10 | 11 | 12 | /************************************************************** 13 | * NURBS curve 14 | **************************************************************/ 15 | 16 | THREE.NURBSCurve = function ( degree, knots /* array of reals */, controlPoints /* array of Vector(2|3|4) */ ) { 17 | 18 | this.degree = degree; 19 | this.knots = knots; 20 | this.controlPoints = []; 21 | for ( var i = 0; i < controlPoints.length; ++ i ) { 22 | 23 | // ensure Vector4 for control points 24 | var point = controlPoints[ i ]; 25 | this.controlPoints[ i ] = new THREE.Vector4( point.x, point.y, point.z, point.w ); 26 | 27 | } 28 | 29 | }; 30 | 31 | 32 | THREE.NURBSCurve.prototype = Object.create( THREE.Curve.prototype ); 33 | THREE.NURBSCurve.prototype.constructor = THREE.NURBSCurve; 34 | 35 | 36 | THREE.NURBSCurve.prototype.getPoint = function ( t ) { 37 | 38 | var u = this.knots[ 0 ] + t * ( this.knots[ this.knots.length - 1 ] - this.knots[ 0 ] ); // linear mapping t->u 39 | 40 | // following results in (wx, wy, wz, w) homogeneous point 41 | var hpoint = THREE.NURBSUtils.calcBSplinePoint( this.degree, this.knots, this.controlPoints, u ); 42 | 43 | if ( hpoint.w != 1.0 ) { 44 | 45 | // project to 3D space: (wx, wy, wz, w) -> (x, y, z, 1) 46 | hpoint.divideScalar( hpoint.w ); 47 | 48 | } 49 | 50 | return new THREE.Vector3( hpoint.x, hpoint.y, hpoint.z ); 51 | 52 | }; 53 | 54 | 55 | THREE.NURBSCurve.prototype.getTangent = function ( t ) { 56 | 57 | var u = this.knots[ 0 ] + t * ( this.knots[ this.knots.length - 1 ] - this.knots[ 0 ] ); 58 | var ders = THREE.NURBSUtils.calcNURBSDerivatives( this.degree, this.knots, this.controlPoints, u, 1 ); 59 | var tangent = ders[ 1 ].clone(); 60 | tangent.normalize(); 61 | 62 | return tangent; 63 | 64 | }; 65 | 66 | -------------------------------------------------------------------------------- /web/secondtemple/js/curves/NURBSSurface.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author renej 3 | * NURBS surface object 4 | * 5 | * Implementation is based on (x, y [, z=0 [, w=1]]) control points with w=weight. 6 | * 7 | **/ 8 | 9 | 10 | /************************************************************** 11 | * NURBS surface 12 | **************************************************************/ 13 | 14 | THREE.NURBSSurface = function ( degree1, degree2, knots1, knots2 /* arrays of reals */, controlPoints /* array^2 of Vector(2|3|4) */ ) { 15 | 16 | this.degree1 = degree1; 17 | this.degree2 = degree2; 18 | this.knots1 = knots1; 19 | this.knots2 = knots2; 20 | this.controlPoints = []; 21 | 22 | var len1 = knots1.length - degree1 - 1; 23 | var len2 = knots2.length - degree2 - 1; 24 | 25 | // ensure Vector4 for control points 26 | for ( var i = 0; i < len1; ++ i ) { 27 | 28 | this.controlPoints[ i ] = []; 29 | for ( var j = 0; j < len2; ++ j ) { 30 | 31 | var point = controlPoints[ i ][ j ]; 32 | this.controlPoints[ i ][ j ] = new THREE.Vector4( point.x, point.y, point.z, point.w ); 33 | 34 | } 35 | 36 | } 37 | 38 | }; 39 | 40 | 41 | THREE.NURBSSurface.prototype = { 42 | 43 | constructor: THREE.NURBSSurface, 44 | 45 | getPoint: function ( t1, t2 ) { 46 | 47 | var u = this.knots1[ 0 ] + t1 * ( this.knots1[ this.knots1.length - 1 ] - this.knots1[ 0 ] ); // linear mapping t1->u 48 | var v = this.knots2[ 0 ] + t2 * ( this.knots2[ this.knots2.length - 1 ] - this.knots2[ 0 ] ); // linear mapping t2->u 49 | 50 | return THREE.NURBSUtils.calcSurfacePoint( this.degree1, this.degree2, this.knots1, this.knots2, this.controlPoints, u, v ); 51 | 52 | } 53 | }; 54 | 55 | 56 | -------------------------------------------------------------------------------- /web/secondtemple/js/effects/ParallaxBarrierEffect.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | * @author marklundin / http://mark-lundin.com/ 4 | * @author alteredq / http://alteredqualia.com/ 5 | */ 6 | 7 | THREE.ParallaxBarrierEffect = function ( renderer ) { 8 | 9 | var _camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); 10 | 11 | var _scene = new THREE.Scene(); 12 | 13 | var _stereo = new THREE.StereoCamera(); 14 | 15 | var _params = { minFilter: THREE.LinearFilter, magFilter: THREE.NearestFilter, format: THREE.RGBAFormat }; 16 | 17 | var _renderTargetL = new THREE.WebGLRenderTarget( 512, 512, _params ); 18 | var _renderTargetR = new THREE.WebGLRenderTarget( 512, 512, _params ); 19 | 20 | var _material = new THREE.ShaderMaterial( { 21 | 22 | uniforms: { 23 | 24 | "mapLeft": { value: _renderTargetL.texture }, 25 | "mapRight": { value: _renderTargetR.texture } 26 | 27 | }, 28 | 29 | vertexShader: [ 30 | 31 | "varying vec2 vUv;", 32 | 33 | "void main() {", 34 | 35 | " vUv = vec2( uv.x, uv.y );", 36 | " gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 37 | 38 | "}" 39 | 40 | ].join( "\n" ), 41 | 42 | fragmentShader: [ 43 | 44 | "uniform sampler2D mapLeft;", 45 | "uniform sampler2D mapRight;", 46 | "varying vec2 vUv;", 47 | 48 | "void main() {", 49 | 50 | " vec2 uv = vUv;", 51 | 52 | " if ( ( mod( gl_FragCoord.y, 2.0 ) ) > 1.00 ) {", 53 | 54 | " gl_FragColor = texture2D( mapLeft, uv );", 55 | 56 | " } else {", 57 | 58 | " gl_FragColor = texture2D( mapRight, uv );", 59 | 60 | " }", 61 | 62 | "}" 63 | 64 | ].join( "\n" ) 65 | 66 | } ); 67 | 68 | var mesh = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), _material ); 69 | _scene.add( mesh ); 70 | 71 | this.setSize = function ( width, height ) { 72 | 73 | renderer.setSize( width, height ); 74 | 75 | var pixelRatio = renderer.getPixelRatio(); 76 | 77 | _renderTargetL.setSize( width * pixelRatio, height * pixelRatio ); 78 | _renderTargetR.setSize( width * pixelRatio, height * pixelRatio ); 79 | 80 | }; 81 | 82 | this.render = function ( scene, camera ) { 83 | 84 | scene.updateMatrixWorld(); 85 | 86 | if ( camera.parent === null ) camera.updateMatrixWorld(); 87 | 88 | _stereo.update( camera ); 89 | 90 | renderer.render( scene, _stereo.cameraL, _renderTargetL, true ); 91 | renderer.render( scene, _stereo.cameraR, _renderTargetR, true ); 92 | renderer.render( _scene, _camera ); 93 | 94 | }; 95 | 96 | }; 97 | -------------------------------------------------------------------------------- /web/secondtemple/js/effects/StereoEffect.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * @authod mrdoob / http://mrdoob.com/ 4 | * @authod arodic / http://aleksandarrodic.com/ 5 | * @authod fonserbc / http://fonserbc.github.io/ 6 | */ 7 | 8 | THREE.StereoEffect = function ( renderer ) { 9 | 10 | var _stereo = new THREE.StereoCamera(); 11 | _stereo.aspect = 0.5; 12 | 13 | this.setSize = function ( width, height ) { 14 | 15 | renderer.setSize( width, height ); 16 | 17 | }; 18 | 19 | this.render = function ( scene, camera ) { 20 | 21 | scene.updateMatrixWorld(); 22 | 23 | if ( camera.parent === null ) camera.updateMatrixWorld(); 24 | 25 | _stereo.update( camera ); 26 | 27 | var size = renderer.getSize(); 28 | 29 | renderer.setScissorTest( true ); 30 | renderer.clear(); 31 | 32 | renderer.setScissor( 0, 0, size.width / 2, size.height ); 33 | renderer.setViewport( 0, 0, size.width / 2, size.height ); 34 | renderer.render( scene, _stereo.cameraL ); 35 | 36 | renderer.setScissor( size.width / 2, 0, size.width / 2, size.height ); 37 | renderer.setViewport( size.width / 2, 0, size.width / 2, size.height ); 38 | renderer.render( scene, _stereo.cameraR ); 39 | 40 | renderer.setScissorTest( false ); 41 | 42 | }; 43 | 44 | }; 45 | -------------------------------------------------------------------------------- /web/secondtemple/js/exporters/STLBinaryExporter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author kovacsv / http://kovacsv.hu/ 3 | * @author mrdoob / http://mrdoob.com/ 4 | * @author mudcube / http://mudcu.be/ 5 | */ 6 | 7 | THREE.STLBinaryExporter = function () {}; 8 | 9 | THREE.STLBinaryExporter.prototype = { 10 | 11 | constructor: THREE.STLBinaryExporter, 12 | 13 | parse: ( function () { 14 | 15 | var vector = new THREE.Vector3(); 16 | var normalMatrixWorld = new THREE.Matrix3(); 17 | 18 | return function parse( scene ) { 19 | 20 | // We collect objects first, as we may need to convert from BufferGeometry to Geometry 21 | var objects = []; 22 | var triangles = 0; 23 | scene.traverse( function ( object ) { 24 | 25 | if ( ! ( object instanceof THREE.Mesh ) ) return; 26 | 27 | var geometry = object.geometry; 28 | if ( geometry instanceof THREE.BufferGeometry ) { 29 | 30 | geometry = new THREE.Geometry().fromBufferGeometry( geometry ); 31 | 32 | } 33 | 34 | if ( ! ( geometry instanceof THREE.Geometry ) ) return; 35 | triangles += geometry.faces.length; 36 | 37 | objects.push( { 38 | 39 | geometry: geometry, 40 | matrix: object.matrixWorld 41 | 42 | } ); 43 | 44 | } ); 45 | 46 | var offset = 80; // skip header 47 | var bufferLength = triangles * 2 + triangles * 3 * 4 * 4 + 80 + 4; 48 | var arrayBuffer = new ArrayBuffer( bufferLength ); 49 | var output = new DataView( arrayBuffer ); 50 | output.setUint32( offset, triangles, true ); offset += 4; 51 | 52 | // Traversing our collected objects 53 | objects.forEach( function ( object ) { 54 | 55 | var vertices = object.geometry.vertices; 56 | var faces = object.geometry.faces; 57 | 58 | normalMatrixWorld.getNormalMatrix( object.matrix ); 59 | 60 | for ( var i = 0, l = faces.length; i < l; i ++ ) { 61 | 62 | var face = faces[ i ]; 63 | 64 | vector.copy( face.normal ).applyMatrix3( normalMatrixWorld ).normalize(); 65 | 66 | output.setFloat32( offset, vector.x, true ); offset += 4; // normal 67 | output.setFloat32( offset, vector.y, true ); offset += 4; 68 | output.setFloat32( offset, vector.z, true ); offset += 4; 69 | 70 | var indices = [ face.a, face.b, face.c ]; 71 | 72 | for ( var j = 0; j < 3; j ++ ) { 73 | 74 | vector.copy( vertices[ indices[ j ] ] ).applyMatrix4( object.matrix ); 75 | 76 | output.setFloat32( offset, vector.x, true ); offset += 4; // vertices 77 | output.setFloat32( offset, vector.y, true ); offset += 4; 78 | output.setFloat32( offset, vector.z, true ); offset += 4; 79 | 80 | } 81 | 82 | output.setUint16( offset, 0, true ); offset += 2; // attribute byte count 83 | 84 | } 85 | 86 | } ); 87 | 88 | return output; 89 | 90 | }; 91 | 92 | }() ) 93 | 94 | }; 95 | -------------------------------------------------------------------------------- /web/secondtemple/js/exporters/STLExporter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author kovacsv / http://kovacsv.hu/ 3 | * @author mrdoob / http://mrdoob.com/ 4 | */ 5 | 6 | THREE.STLExporter = function () {}; 7 | 8 | THREE.STLExporter.prototype = { 9 | 10 | constructor: THREE.STLExporter, 11 | 12 | parse: ( function () { 13 | 14 | var vector = new THREE.Vector3(); 15 | var normalMatrixWorld = new THREE.Matrix3(); 16 | 17 | return function parse( scene ) { 18 | 19 | var output = ''; 20 | 21 | output += 'solid exported\n'; 22 | 23 | scene.traverse( function ( object ) { 24 | 25 | if ( object instanceof THREE.Mesh ) { 26 | 27 | var geometry = object.geometry; 28 | var matrixWorld = object.matrixWorld; 29 | 30 | if ( geometry instanceof THREE.Geometry ) { 31 | 32 | var vertices = geometry.vertices; 33 | var faces = geometry.faces; 34 | 35 | normalMatrixWorld.getNormalMatrix( matrixWorld ); 36 | 37 | for ( var i = 0, l = faces.length; i < l; i ++ ) { 38 | 39 | var face = faces[ i ]; 40 | 41 | vector.copy( face.normal ).applyMatrix3( normalMatrixWorld ).normalize(); 42 | 43 | output += '\tfacet normal ' + vector.x + ' ' + vector.y + ' ' + vector.z + '\n'; 44 | output += '\t\touter loop\n'; 45 | 46 | var indices = [ face.a, face.b, face.c ]; 47 | 48 | for ( var j = 0; j < 3; j ++ ) { 49 | 50 | vector.copy( vertices[ indices[ j ] ] ).applyMatrix4( matrixWorld ); 51 | 52 | output += '\t\t\tvertex ' + vector.x + ' ' + vector.y + ' ' + vector.z + '\n'; 53 | 54 | } 55 | 56 | output += '\t\tendloop\n'; 57 | output += '\tendfacet\n'; 58 | 59 | } 60 | 61 | } 62 | 63 | } 64 | 65 | } ); 66 | 67 | output += 'endsolid exported\n'; 68 | 69 | return output; 70 | 71 | }; 72 | 73 | }() ) 74 | 75 | }; 76 | -------------------------------------------------------------------------------- /web/secondtemple/js/exporters/TypedGeometryExporter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.TypedGeometryExporter = function () {}; 6 | 7 | THREE.TypedGeometryExporter.prototype = { 8 | 9 | constructor: THREE.TypedGeometryExporter, 10 | 11 | parse: function ( geometry ) { 12 | 13 | var output = { 14 | metadata: { 15 | version: 4.0, 16 | type: 'TypedGeometry', 17 | generator: 'TypedGeometryExporter' 18 | } 19 | }; 20 | 21 | var attributes = [ 'vertices', 'normals', 'uvs' ]; 22 | 23 | for ( var key in attributes ) { 24 | 25 | var attribute = attributes[ key ]; 26 | 27 | var typedArray = geometry[ attribute ]; 28 | var array = []; 29 | 30 | for ( var i = 0, l = typedArray.length; i < l; i ++ ) { 31 | 32 | array[ i ] = typedArray[ i ]; 33 | 34 | } 35 | 36 | output[ attribute ] = array; 37 | 38 | } 39 | 40 | var boundingSphere = geometry.boundingSphere; 41 | 42 | if ( boundingSphere !== null ) { 43 | 44 | output.boundingSphere = { 45 | center: boundingSphere.center.toArray(), 46 | radius: boundingSphere.radius 47 | } 48 | 49 | } 50 | 51 | return output; 52 | 53 | } 54 | 55 | }; 56 | -------------------------------------------------------------------------------- /web/secondtemple/js/geometries/hilbert2D.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Hilbert Curve: Generates 2D-Coordinates in a very fast way. 3 | * 4 | * @author Dylan Grafmyre 5 | * 6 | * Based on work by: 7 | * @author Thomas Diewald 8 | * @link http://www.openprocessing.org/sketch/15493 9 | * 10 | * @param center Center of Hilbert curve. 11 | * @param size Total width of Hilbert curve. 12 | * @param iterations Number of subdivisions. 13 | * @param v0 Corner index -X, -Z. 14 | * @param v1 Corner index -X, +Z. 15 | * @param v2 Corner index +X, +Z. 16 | * @param v3 Corner index +X, -Z. 17 | */ 18 | function hilbert2D ( center, size, iterations, v0, v1, v2, v3 ) { 19 | 20 | // Default Vars 21 | var center = undefined !== center ? center : new THREE.Vector3( 0, 0, 0 ), 22 | size = undefined !== size ? size : 10, 23 | half = size / 2, 24 | iterations = undefined !== iterations ? iterations : 1, 25 | v0 = undefined !== v0 ? v0 : 0, 26 | v1 = undefined !== v1 ? v1 : 1, 27 | v2 = undefined !== v2 ? v2 : 2, 28 | v3 = undefined !== v3 ? v3 : 3 29 | ; 30 | 31 | var vec_s = [ 32 | new THREE.Vector3( center.x - half, center.y, center.z - half ), 33 | new THREE.Vector3( center.x - half, center.y, center.z + half ), 34 | new THREE.Vector3( center.x + half, center.y, center.z + half ), 35 | new THREE.Vector3( center.x + half, center.y, center.z - half ) 36 | ]; 37 | 38 | var vec = [ 39 | vec_s[ v0 ], 40 | vec_s[ v1 ], 41 | vec_s[ v2 ], 42 | vec_s[ v3 ] 43 | ]; 44 | 45 | // Recurse iterations 46 | if ( 0 <= -- iterations ) { 47 | 48 | var tmp = []; 49 | 50 | Array.prototype.push.apply( tmp, hilbert2D ( vec[ 0 ], half, iterations, v0, v3, v2, v1 ) ); 51 | Array.prototype.push.apply( tmp, hilbert2D ( vec[ 1 ], half, iterations, v0, v1, v2, v3 ) ); 52 | Array.prototype.push.apply( tmp, hilbert2D ( vec[ 2 ], half, iterations, v0, v1, v2, v3 ) ); 53 | Array.prototype.push.apply( tmp, hilbert2D ( vec[ 3 ], half, iterations, v2, v1, v0, v3 ) ); 54 | 55 | // Return recursive call 56 | return tmp; 57 | 58 | } 59 | 60 | // Return complete Hilbert Curve. 61 | return vec; 62 | 63 | } 64 | -------------------------------------------------------------------------------- /web/secondtemple/js/libs/stats.min.js: -------------------------------------------------------------------------------- 1 | // stats.js - http://github.com/mrdoob/stats.js 2 | var Stats=function(){function h(a){c.appendChild(a.dom);return a}function k(a){for(var d=0;de+1E3&&(r.update(1E3*a/(c-e),100),e=c,a=0,t)){var d=performance.memory;t.update(d.usedJSHeapSize/1048576,d.jsHeapSizeLimit/1048576)}return c},update:function(){g=this.end()},domElement:c,setMode:k}}; 4 | Stats.Panel=function(h,k,l){var c=Infinity,g=0,e=Math.round,a=e(window.devicePixelRatio||1),r=80*a,f=48*a,t=3*a,u=2*a,d=3*a,m=15*a,n=74*a,p=30*a,q=document.createElement("canvas");q.width=r;q.height=f;q.style.cssText="width:80px;height:48px";var b=q.getContext("2d");b.font="bold "+9*a+"px Helvetica,Arial,sans-serif";b.textBaseline="top";b.fillStyle=l;b.fillRect(0,0,r,f);b.fillStyle=k;b.fillText(h,t,u);b.fillRect(d,m,n,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d,m,n,p);return{dom:q,update:function(f, 5 | v){c=Math.min(c,f);g=Math.max(g,f);b.fillStyle=l;b.globalAlpha=1;b.fillRect(0,0,r,m);b.fillStyle=k;b.fillText(e(f)+" "+h+" ("+e(c)+"-"+e(g)+")",t,u);b.drawImage(q,d+a,m,n-a,p,d,m,n-a,p);b.fillRect(d+n-a,m,a,p);b.fillStyle=l;b.globalAlpha=.9;b.fillRect(d+n-a,m,a,e((1-f/v)*p))}}};"object"===typeof module&&(module.exports=Stats); 6 | -------------------------------------------------------------------------------- /web/secondtemple/js/libs/system.min.js: -------------------------------------------------------------------------------- 1 | // system.js - http://github.com/mrdoob/system.js 2 | 'use strict';var System={browser:function(){var a=navigator.userAgent;return/Arora/i.test(a)?"Arora":/Chrome/i.test(a)?"Chrome":/Epiphany/i.test(a)?"Epiphany":/Firefox/i.test(a)?"Firefox":/Mobile(\/.*)? Safari/i.test(a)?"Mobile Safari":/MSIE/i.test(a)?"Internet Explorer":/Midori/i.test(a)?"Midori":/Opera/.test(a)?"Opera":/Safari/i.test(a)?"Safari":!1}(),os:function(){var a=navigator.userAgent;return/Android/i.test(a)?"Android":/CrOS/i.test(a)?"Chrome OS":/iP[ao]d|iPhone/i.test(a)?"iOS":/Linux/i.test(a)? 3 | "Linux":/Mac OS/i.test(a)?"Mac OS":/windows/i.test(a)?"Windows":!1}(),support:{canvas:!!window.CanvasRenderingContext2D,localStorage:function(){try{return!!window.localStorage.getItem}catch(a){return!1}}(),file:!!window.File&&!!window.FileReader&&!!window.FileList&&!!window.Blob,fileSystem:!!window.requestFileSystem||!!window.webkitRequestFileSystem,getUserMedia:!!window.navigator.getUserMedia||!!window.navigator.webkitGetUserMedia||!!window.navigator.mozGetUserMedia||!!window.navigator.msGetUserMedia, 4 | requestAnimationFrame:!!window.mozRequestAnimationFrame||!!window.webkitRequestAnimationFrame||!!window.oRequestAnimationFrame||!!window.msRequestAnimationFrame,sessionStorage:function(){try{return!!window.sessionStorage.getItem}catch(a){return!1}}(),webgl:function(){try{return!!window.WebGLRenderingContext&&!!document.createElement("canvas").getContext("experimental-webgl")}catch(a){return!1}}(),worker:!!window.Worker}}; 5 | -------------------------------------------------------------------------------- /web/secondtemple/js/loaders/KMZLoader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.KMZLoader = function ( manager ) { 6 | 7 | this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; 8 | 9 | }; 10 | 11 | THREE.KMZLoader.prototype = { 12 | 13 | constructor: THREE.KMZLoader, 14 | 15 | load: function ( url, onLoad, onProgress, onError ) { 16 | 17 | var scope = this; 18 | 19 | var loader = new THREE.XHRLoader( scope.manager ); 20 | loader.setResponseType( 'arraybuffer' ); 21 | loader.load( url, function ( text ) { 22 | 23 | onLoad( scope.parse( text ) ); 24 | 25 | }, onProgress, onError ); 26 | 27 | }, 28 | 29 | parse: function ( data ) { 30 | 31 | var zip = new JSZip( data ); 32 | 33 | // console.log( zip ); 34 | 35 | for ( var name in zip.files ) { 36 | 37 | if ( name.toLowerCase().substr( - 4 ) === '.dae' ) { 38 | 39 | return new THREE.ColladaLoader().parse( zip.file( name ).asText() ); 40 | 41 | } 42 | 43 | } 44 | 45 | console.error( 'KZMLoader: Couldn\'t find .dae file.' ); 46 | 47 | return { 48 | scene: new THREE.Group() 49 | } 50 | 51 | } 52 | 53 | }; 54 | -------------------------------------------------------------------------------- /web/secondtemple/js/loaders/SVGLoader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | * @author zz85 / http://joshuakoo.com/ 4 | */ 5 | 6 | THREE.SVGLoader = function ( manager ) { 7 | 8 | this.manager = ( manager !== undefined ) ? manager : THREE.DefaultLoadingManager; 9 | 10 | }; 11 | 12 | THREE.SVGLoader.prototype = { 13 | 14 | constructor: THREE.SVGLoader, 15 | 16 | load: function ( url, onLoad, onProgress, onError ) { 17 | 18 | var scope = this; 19 | 20 | var parser = new DOMParser(); 21 | 22 | var loader = new THREE.XHRLoader( scope.manager ); 23 | loader.load( url, function ( svgString ) { 24 | 25 | var doc = parser.parseFromString( svgString, 'image/svg+xml' ); // application/xml 26 | 27 | onLoad( doc.documentElement ); 28 | 29 | }, onProgress, onError ); 30 | 31 | } 32 | 33 | }; 34 | -------------------------------------------------------------------------------- /web/secondtemple/js/loaders/ctm/CTMWorker.js: -------------------------------------------------------------------------------- 1 | importScripts( "lzma.js", "ctm.js" ); 2 | 3 | self.onmessage = function( event ) { 4 | 5 | var files = []; 6 | 7 | for ( var i = 0; i < event.data.offsets.length; i ++ ) { 8 | 9 | var stream = new CTM.Stream( event.data.data ); 10 | stream.offset = event.data.offsets[ i ]; 11 | 12 | files[ i ] = new CTM.File( stream ); 13 | 14 | } 15 | 16 | self.postMessage( files ); 17 | self.close(); 18 | 19 | }; 20 | -------------------------------------------------------------------------------- /web/secondtemple/js/loaders/ctm/license/OpenCTM.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2009-2010 Marcus Geelnard 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 16 | 2. Altered source versions must be plainly marked as such, and must not 17 | be misrepresented as being the original software. 18 | 19 | 3. This notice may not be removed or altered from any source 20 | distribution. 21 | -------------------------------------------------------------------------------- /web/secondtemple/js/loaders/ctm/license/js-lzma.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Juan Mellado 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /web/secondtemple/js/loaders/ctm/license/js-openctm.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2011 Juan Mellado 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /web/secondtemple/js/math/ColorConverter.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author bhouston / http://exocortex.com/ 3 | * @author zz85 / http://github.com/zz85 4 | */ 5 | 6 | THREE.ColorConverter = { 7 | 8 | setHSV: function ( color, h, s, v ) { 9 | 10 | // https://gist.github.com/xpansive/1337890#file-index-js 11 | 12 | h = THREE.Math.euclideanModulo( h, 1 ); 13 | s = THREE.Math.clamp( s, 0, 1 ); 14 | v = THREE.Math.clamp( v, 0, 1 ); 15 | 16 | return color.setHSL( h, ( s * v ) / ( ( h = ( 2 - s ) * v ) < 1 ? h : ( 2 - h ) ), h * 0.5 ); 17 | 18 | }, 19 | 20 | getHSV: function( color ) { 21 | 22 | var hsl = color.getHSL(); 23 | 24 | // based on https://gist.github.com/xpansive/1337890#file-index-js 25 | hsl.s *= ( hsl.l < 0.5 ) ? hsl.l : ( 1 - hsl.l ); 26 | 27 | return { 28 | h: hsl.h, 29 | s: 2 * hsl.s / ( hsl.l + hsl.s ), 30 | v: hsl.l + hsl.s 31 | }; 32 | 33 | }, 34 | 35 | // where c, m, y, k is between 0 and 1 36 | 37 | setCMYK: function ( color, c, m, y, k ) { 38 | 39 | var r = ( 1 - c ) * ( 1 - k ); 40 | var g = ( 1 - m ) * ( 1 - k ); 41 | var b = ( 1 - y ) * ( 1 - k ); 42 | 43 | return color.setRGB( r, g, b ); 44 | 45 | }, 46 | 47 | getCMYK: function ( color ) { 48 | 49 | var r = color.r; 50 | var g = color.g; 51 | var b = color.b; 52 | var k = 1 - Math.max( r, g, b ); 53 | var c = ( 1 - r - k ) / ( 1 - k ); 54 | var m = ( 1 - g - k ) / ( 1 - k ); 55 | var y = ( 1 - b - k ) / ( 1 - k ); 56 | 57 | return { 58 | c: c, m: m, y: y, k: k 59 | }; 60 | 61 | } 62 | 63 | 64 | }; 65 | -------------------------------------------------------------------------------- /web/secondtemple/js/modifiers/ExplodeModifier.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Make all faces use unique vertices 3 | * so that each face can be separated from others 4 | * 5 | * @author alteredq / http://alteredqualia.com/ 6 | */ 7 | 8 | THREE.ExplodeModifier = function () { 9 | 10 | }; 11 | 12 | THREE.ExplodeModifier.prototype.modify = function ( geometry ) { 13 | 14 | var vertices = []; 15 | 16 | for ( var i = 0, il = geometry.faces.length; i < il; i ++ ) { 17 | 18 | var n = vertices.length; 19 | 20 | var face = geometry.faces[ i ]; 21 | 22 | var a = face.a; 23 | var b = face.b; 24 | var c = face.c; 25 | 26 | var va = geometry.vertices[ a ]; 27 | var vb = geometry.vertices[ b ]; 28 | var vc = geometry.vertices[ c ]; 29 | 30 | vertices.push( va.clone() ); 31 | vertices.push( vb.clone() ); 32 | vertices.push( vc.clone() ); 33 | 34 | face.a = n; 35 | face.b = n + 1; 36 | face.c = n + 2; 37 | 38 | } 39 | 40 | geometry.vertices = vertices; 41 | 42 | }; 43 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/ConstNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.ConstNode = function( name, useDefine ) { 6 | 7 | THREE.TempNode.call( this ); 8 | 9 | this.parse( name || THREE.ConstNode.PI, useDefine ); 10 | 11 | }; 12 | 13 | THREE.ConstNode.PI = 'PI'; 14 | THREE.ConstNode.PI2 = 'PI2'; 15 | THREE.ConstNode.RECIPROCAL_PI = 'RECIPROCAL_PI'; 16 | THREE.ConstNode.RECIPROCAL_PI2 = 'RECIPROCAL_PI2'; 17 | THREE.ConstNode.LOG2 = 'LOG2'; 18 | THREE.ConstNode.EPSILON = 'EPSILON'; 19 | 20 | THREE.ConstNode.prototype = Object.create( THREE.TempNode.prototype ); 21 | THREE.ConstNode.prototype.constructor = THREE.ConstNode; 22 | 23 | THREE.ConstNode.prototype.parse = function( src, useDefine ) { 24 | 25 | var name, type; 26 | 27 | var rDeclaration = /^([a-z_0-9]+)\s([a-z_0-9]+)\s?\=(.*?)\;/i; 28 | var match = src.match( rDeclaration ); 29 | 30 | if ( match && match.length > 1 ) { 31 | 32 | type = match[ 1 ]; 33 | name = match[ 2 ]; 34 | 35 | if ( useDefine ) { 36 | 37 | this.src = '#define ' + name + ' ' + match[ 3 ]; 38 | 39 | } 40 | else { 41 | 42 | this.src = 'const ' + type + ' ' + name + ' = ' + match[ 3 ] + ';'; 43 | 44 | } 45 | 46 | } 47 | else { 48 | 49 | name = src; 50 | type = 'fv1'; 51 | 52 | } 53 | 54 | this.name = name; 55 | this.type = type; 56 | 57 | }; 58 | 59 | THREE.ConstNode.prototype.generate = function( builder, output ) { 60 | 61 | return builder.format( this.name, this.getType( builder ), output ); 62 | 63 | }; 64 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/FunctionCallNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.FunctionCallNode = function( value ) { 6 | 7 | THREE.TempNode.call( this ); 8 | 9 | this.setFunction( value ); 10 | 11 | }; 12 | 13 | THREE.FunctionCallNode.prototype = Object.create( THREE.TempNode.prototype ); 14 | THREE.FunctionCallNode.prototype.constructor = THREE.FunctionCallNode; 15 | 16 | THREE.FunctionCallNode.prototype.setFunction = function( val ) { 17 | 18 | this.inputs = []; 19 | this.value = val; 20 | 21 | }; 22 | 23 | THREE.FunctionCallNode.prototype.getFunction = function() { 24 | 25 | return this.value; 26 | 27 | }; 28 | 29 | THREE.FunctionCallNode.prototype.getType = function( builder ) { 30 | 31 | return this.value.getType( builder ); 32 | 33 | }; 34 | 35 | THREE.FunctionCallNode.prototype.generate = function( builder, output ) { 36 | 37 | var material = builder.material; 38 | 39 | var type = this.getType( builder ); 40 | var func = this.value; 41 | 42 | builder.include( func ); 43 | 44 | var code = func.name + '('; 45 | var params = []; 46 | 47 | for ( var i = 0; i < func.inputs.length; i ++ ) { 48 | 49 | var inpt = func.inputs[ i ]; 50 | var param = this.inputs[ i ] || this.inputs[ inpt.name ]; 51 | 52 | params.push( param.build( builder, builder.getTypeByFormat( inpt.type ) ) ); 53 | 54 | } 55 | 56 | code += params.join( ',' ) + ')'; 57 | 58 | return builder.format( code, type, output ); 59 | 60 | }; 61 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/GLNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.GLNode = function( type ) { 6 | 7 | this.uuid = THREE.Math.generateUUID(); 8 | 9 | this.allow = {}; 10 | this.requestUpdate = false; 11 | 12 | this.type = type; 13 | 14 | }; 15 | 16 | THREE.GLNode.prototype.parse = function( builder, cache, requires ) { 17 | 18 | builder.parsing = true; 19 | 20 | var material = builder.material; 21 | 22 | this.build( builder.addCache( cache, requires ), 'v4' ); 23 | 24 | material.clearVertexNode(); 25 | material.clearFragmentNode(); 26 | 27 | builder.removeCache(); 28 | 29 | builder.parsing = false; 30 | 31 | }; 32 | 33 | THREE.GLNode.prototype.parseAndBuildCode = function( builder, output, cache, requires ) { 34 | 35 | this.parse( builder, cache, requires ); 36 | 37 | return this.buildCode( builder, output, cache, requires ); 38 | 39 | }; 40 | 41 | THREE.GLNode.prototype.buildCode = function( builder, output, cache, requires ) { 42 | 43 | var material = builder.material; 44 | 45 | var data = { result : this.build( builder.addCache( cache, requires ), output ) }; 46 | 47 | if ( builder.isShader( 'vertex' ) ) data.code = material.clearVertexNode(); 48 | else data.code = material.clearFragmentNode(); 49 | 50 | builder.removeCache(); 51 | 52 | return data; 53 | 54 | }; 55 | 56 | THREE.GLNode.prototype.build = function( builder, output, uuid ) { 57 | 58 | var material = builder.material; 59 | var data = material.getDataNode( uuid || this.uuid ); 60 | 61 | if ( builder.parsing ) this.appendDepsNode( builder, data, output ); 62 | 63 | if ( this.allow[ builder.shader ] === false ) { 64 | 65 | throw new Error( 'Shader ' + shader + ' is not compatible with this node.' ); 66 | 67 | } 68 | 69 | if ( this.requestUpdate && ! data.requestUpdate ) { 70 | 71 | material.requestUpdate.push( this ); 72 | data.requestUpdate = true; 73 | 74 | } 75 | 76 | return this.generate( builder, output, uuid ); 77 | 78 | }; 79 | 80 | THREE.GLNode.prototype.appendDepsNode = function( builder, data, output ) { 81 | 82 | data.deps = ( data.deps || 0 ) + 1; 83 | 84 | var outputLen = builder.getFormatLength( output ); 85 | 86 | if ( outputLen > ( data.outputMax || 0 ) || this.getType( builder ) ) { 87 | 88 | data.outputMax = outputLen; 89 | data.output = output; 90 | 91 | } 92 | 93 | }; 94 | 95 | THREE.GLNode.prototype.getType = function( builder ) { 96 | 97 | return this.type; 98 | 99 | }; 100 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/InputNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.InputNode = function( type, params ) { 6 | 7 | THREE.TempNode.call( this, type, params ); 8 | 9 | }; 10 | 11 | THREE.InputNode.prototype = Object.create( THREE.TempNode.prototype ); 12 | THREE.InputNode.prototype.constructor = THREE.InputNode; 13 | 14 | THREE.InputNode.prototype.generate = function( builder, output, uuid, type, ns, needsUpdate ) { 15 | 16 | var material = builder.material; 17 | 18 | uuid = builder.getUuid( uuid || this.getUuid() ); 19 | type = type || this.getType( builder ); 20 | 21 | var data = material.getDataNode( uuid ); 22 | 23 | if ( builder.isShader( 'vertex' ) ) { 24 | 25 | if ( ! data.vertex ) { 26 | 27 | data.vertex = material.createVertexUniform( type, this.value, ns, needsUpdate ); 28 | 29 | } 30 | 31 | return builder.format( data.vertex.name, type, output ); 32 | 33 | } 34 | else { 35 | 36 | if ( ! data.fragment ) { 37 | 38 | data.fragment = material.createFragmentUniform( type, this.value, ns, needsUpdate ); 39 | 40 | } 41 | 42 | return builder.format( data.fragment.name, type, output ); 43 | 44 | } 45 | 46 | }; 47 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/RawNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.RawNode = function( value ) { 6 | 7 | THREE.GLNode.call( this, 'v4' ); 8 | 9 | this.value = value; 10 | 11 | }; 12 | 13 | THREE.RawNode.prototype = Object.create( THREE.GLNode.prototype ); 14 | THREE.RawNode.prototype.constructor = THREE.RawNode; 15 | 16 | THREE.GLNode.prototype.generate = function( builder ) { 17 | 18 | var material = builder.material; 19 | 20 | var data = this.value.parseAndBuildCode( builder, this.type ); 21 | 22 | var code = data.code + '\n'; 23 | 24 | if ( builder.shader == 'vertex' ) { 25 | 26 | code += 'gl_Position = ' + data.result + ';'; 27 | 28 | } 29 | else { 30 | 31 | code += 'gl_FragColor = ' + data.result + ';'; 32 | 33 | } 34 | 35 | return code; 36 | 37 | }; 38 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/accessors/ColorsNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.ColorsNode = function( index ) { 6 | 7 | THREE.TempNode.call( this, 'v4', { share: false } ); 8 | 9 | this.index = index || 0; 10 | 11 | }; 12 | 13 | THREE.ColorsNode.vertexDict = [ 'color', 'color2' ]; 14 | THREE.ColorsNode.fragmentDict = [ 'vColor', 'vColor2' ]; 15 | 16 | THREE.ColorsNode.prototype = Object.create( THREE.TempNode.prototype ); 17 | THREE.ColorsNode.prototype.constructor = THREE.ColorsNode; 18 | 19 | THREE.ColorsNode.prototype.generate = function( builder, output ) { 20 | 21 | var material = builder.material; 22 | var result; 23 | 24 | material.requestAttrib.color[ this.index ] = true; 25 | 26 | if ( builder.isShader( 'vertex' ) ) result = THREE.ColorsNode.vertexDict[ this.index ]; 27 | else result = THREE.ColorsNode.fragmentDict[ this.index ]; 28 | 29 | return builder.format( result, this.getType( builder ), output ); 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/accessors/LightNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.LightNode = function() { 6 | 7 | THREE.TempNode.call( this, 'v3', { shared: false } ); 8 | 9 | }; 10 | 11 | THREE.LightNode.prototype = Object.create( THREE.TempNode.prototype ); 12 | THREE.LightNode.prototype.constructor = THREE.LightNode; 13 | 14 | THREE.LightNode.prototype.generate = function( builder, output ) { 15 | 16 | if ( builder.isCache( 'light' ) ) { 17 | 18 | return builder.format( 'reflectedLight.directDiffuse', this.getType( builder ), output ) 19 | 20 | } 21 | else { 22 | 23 | console.warn( "THREE.LightNode is only compatible in \"light\" channel." ); 24 | 25 | return builder.format( 'vec3( 0.0 )', this.getType( builder ), output ); 26 | 27 | } 28 | 29 | }; 30 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/accessors/NormalNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.NormalNode = function( scope ) { 6 | 7 | THREE.TempNode.call( this, 'v3' ); 8 | 9 | this.scope = scope || THREE.NormalNode.LOCAL; 10 | 11 | }; 12 | 13 | THREE.NormalNode.LOCAL = 'local'; 14 | THREE.NormalNode.WORLD = 'world'; 15 | THREE.NormalNode.VIEW = 'view'; 16 | 17 | THREE.NormalNode.prototype = Object.create( THREE.TempNode.prototype ); 18 | THREE.NormalNode.prototype.constructor = THREE.NormalNode; 19 | 20 | THREE.NormalNode.prototype.isShared = function( builder ) { 21 | 22 | switch ( this.scope ) { 23 | case THREE.NormalNode.WORLD: 24 | return true; 25 | } 26 | 27 | return false; 28 | 29 | }; 30 | 31 | THREE.NormalNode.prototype.generate = function( builder, output ) { 32 | 33 | var material = builder.material; 34 | var result; 35 | 36 | switch ( this.scope ) { 37 | 38 | case THREE.NormalNode.LOCAL: 39 | 40 | material.requestAttrib.normal = true; 41 | 42 | if ( builder.isShader( 'vertex' ) ) result = 'normal'; 43 | else result = 'vObjectNormal'; 44 | 45 | break; 46 | 47 | case THREE.NormalNode.WORLD: 48 | 49 | material.requestAttrib.worldNormal = true; 50 | 51 | if ( builder.isShader( 'vertex' ) ) result = '( modelMatrix * vec4( objectNormal, 0.0 ) ).xyz'; 52 | else result = 'vWNormal'; 53 | 54 | break; 55 | 56 | case THREE.NormalNode.VIEW: 57 | 58 | result = 'vNormal'; 59 | 60 | break; 61 | 62 | } 63 | 64 | return builder.format( result, this.getType( builder ), output ); 65 | 66 | }; 67 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/accessors/PositionNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.PositionNode = function( scope ) { 6 | 7 | THREE.TempNode.call( this, 'v3' ); 8 | 9 | this.scope = scope || THREE.PositionNode.LOCAL; 10 | 11 | }; 12 | 13 | THREE.PositionNode.LOCAL = 'local'; 14 | THREE.PositionNode.WORLD = 'world'; 15 | THREE.PositionNode.VIEW = 'view'; 16 | THREE.PositionNode.PROJECTION = 'projection'; 17 | 18 | THREE.PositionNode.prototype = Object.create( THREE.TempNode.prototype ); 19 | THREE.PositionNode.prototype.constructor = THREE.PositionNode; 20 | 21 | THREE.PositionNode.prototype.getType = function( builder ) { 22 | 23 | switch ( this.scope ) { 24 | case THREE.PositionNode.PROJECTION: 25 | return 'v4'; 26 | } 27 | 28 | return this.type; 29 | 30 | }; 31 | 32 | THREE.PositionNode.prototype.isShared = function( builder ) { 33 | 34 | switch ( this.scope ) { 35 | case THREE.PositionNode.LOCAL: 36 | case THREE.PositionNode.WORLD: 37 | return false; 38 | } 39 | 40 | return true; 41 | 42 | }; 43 | 44 | THREE.PositionNode.prototype.generate = function( builder, output ) { 45 | 46 | var material = builder.material; 47 | var result; 48 | 49 | switch ( this.scope ) { 50 | 51 | case THREE.PositionNode.LOCAL: 52 | 53 | material.requestAttrib.position = true; 54 | 55 | if ( builder.isShader( 'vertex' ) ) result = 'transformed'; 56 | else result = 'vPosition'; 57 | 58 | break; 59 | 60 | case THREE.PositionNode.WORLD: 61 | 62 | material.requestAttrib.worldPosition = true; 63 | 64 | if ( builder.isShader( 'vertex' ) ) result = 'vWPosition'; 65 | else result = 'vWPosition'; 66 | 67 | break; 68 | 69 | case THREE.PositionNode.VIEW: 70 | 71 | if ( builder.isShader( 'vertex' ) ) result = '-mvPosition.xyz'; 72 | else result = 'vViewPosition'; 73 | 74 | break; 75 | 76 | case THREE.PositionNode.PROJECTION: 77 | 78 | if ( builder.isShader( 'vertex' ) ) result = '(projectionMatrix * modelViewMatrix * vec4( position, 1.0 ))'; 79 | else result = 'vec4( 0.0 )'; 80 | 81 | break; 82 | 83 | } 84 | 85 | return builder.format( result, this.getType( builder ), output ); 86 | 87 | }; 88 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/accessors/ReflectNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.ReflectNode = function( scope ) { 6 | 7 | THREE.TempNode.call( this, 'v3', { unique: true } ); 8 | 9 | this.scope = scope || THREE.ReflectNode.CUBE; 10 | 11 | }; 12 | 13 | THREE.ReflectNode.CUBE = 'cube'; 14 | THREE.ReflectNode.SPHERE = 'sphere'; 15 | THREE.ReflectNode.VECTOR = 'vector'; 16 | 17 | THREE.ReflectNode.prototype = Object.create( THREE.TempNode.prototype ); 18 | THREE.ReflectNode.prototype.constructor = THREE.ReflectNode; 19 | 20 | THREE.ReflectNode.prototype.getType = function( builder ) { 21 | 22 | switch ( this.scope ) { 23 | case THREE.CameraNode.SPHERE: 24 | return 'v2'; 25 | } 26 | 27 | return this.type; 28 | 29 | }; 30 | 31 | THREE.ReflectNode.prototype.generate = function( builder, output ) { 32 | 33 | var result; 34 | 35 | switch ( this.scope ) { 36 | 37 | case THREE.ReflectNode.VECTOR: 38 | 39 | builder.material.addFragmentNode( 'vec3 reflectVec = inverseTransformDirection( reflect( -geometry.viewDir, geometry.normal ), viewMatrix );' ); 40 | 41 | result = 'reflectVec'; 42 | 43 | break; 44 | 45 | case THREE.ReflectNode.CUBE: 46 | 47 | var reflectVec = new THREE.ReflectNode( THREE.ReflectNode.VECTOR ).build( builder, 'v3' ); 48 | 49 | builder.material.addFragmentNode( 'vec3 reflectCubeVec = vec3( -1.0 * ' + reflectVec + '.x, ' + reflectVec + '.yz );' ); 50 | 51 | result = 'reflectCubeVec'; 52 | 53 | break; 54 | 55 | case THREE.ReflectNode.SPHERE: 56 | 57 | var reflectVec = new THREE.ReflectNode( THREE.ReflectNode.VECTOR ).build( builder, 'v3' ); 58 | 59 | builder.material.addFragmentNode( 'vec3 reflectSphereVec = normalize((viewMatrix * vec4(' + reflectVec + ', 0.0 )).xyz + vec3(0.0,0.0,1.0)).xy * 0.5 + 0.5;' ); 60 | 61 | result = 'reflectSphereVec'; 62 | 63 | break; 64 | } 65 | 66 | return builder.format( result, this.getType( this.type ), output ); 67 | 68 | }; 69 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/accessors/ScreenUVNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.ScreenUVNode = function( resolution ) { 6 | 7 | THREE.TempNode.call( this, 'v2' ); 8 | 9 | this.resolution = resolution; 10 | 11 | }; 12 | 13 | THREE.ScreenUVNode.prototype = Object.create( THREE.TempNode.prototype ); 14 | THREE.ScreenUVNode.prototype.constructor = THREE.ScreenUVNode; 15 | 16 | THREE.ScreenUVNode.prototype.generate = function( builder, output ) { 17 | 18 | var material = builder.material; 19 | var result; 20 | 21 | if ( builder.isShader( 'fragment' ) ) { 22 | 23 | result = '(gl_FragCoord.xy/' + this.resolution.build( builder, 'v2' ) + ')'; 24 | 25 | } 26 | else { 27 | 28 | console.warn( "THREE.ScreenUVNode is not compatible with " + builder.shader + " shader." ); 29 | 30 | result = 'vec2( 0.0 )'; 31 | 32 | } 33 | 34 | return builder.format( result, this.getType( builder ), output ); 35 | 36 | }; 37 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/accessors/UVNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.UVNode = function( index ) { 6 | 7 | THREE.TempNode.call( this, 'v2', { shared: false } ); 8 | 9 | this.index = index || 0; 10 | 11 | }; 12 | 13 | THREE.UVNode.vertexDict = [ 'uv', 'uv2' ]; 14 | THREE.UVNode.fragmentDict = [ 'vUv', 'vUv2' ]; 15 | 16 | THREE.UVNode.prototype = Object.create( THREE.TempNode.prototype ); 17 | THREE.UVNode.prototype.constructor = THREE.UVNode; 18 | 19 | THREE.UVNode.prototype.generate = function( builder, output ) { 20 | 21 | var material = builder.material; 22 | var result; 23 | 24 | material.requestAttrib.uv[ this.index ] = true; 25 | 26 | if ( builder.isShader( 'vertex' ) ) result = THREE.UVNode.vertexDict[ this.index ]; 27 | else result = THREE.UVNode.fragmentDict[ this.index ]; 28 | 29 | return builder.format( result, this.getType( builder ), output ); 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/inputs/ColorNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.ColorNode = function( color ) { 6 | 7 | THREE.InputNode.call( this, 'c', { share: false } ); 8 | 9 | this.value = new THREE.Color( color || 0 ); 10 | 11 | }; 12 | 13 | THREE.ColorNode.prototype = Object.create( THREE.InputNode.prototype ); 14 | THREE.ColorNode.prototype.constructor = THREE.ColorNode; 15 | 16 | THREE.NodeMaterial.addShortcuts( THREE.ColorNode.prototype, 'value', [ 'r', 'g', 'b' ] ); 17 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/inputs/CubeTextureNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.CubeTextureNode = function( value, coord, bias ) { 6 | 7 | THREE.InputNode.call( this, 'v4' ); 8 | 9 | this.value = value; 10 | this.coord = coord || new THREE.ReflectNode(); 11 | this.bias = bias; 12 | 13 | }; 14 | 15 | THREE.CubeTextureNode.prototype = Object.create( THREE.InputNode.prototype ); 16 | THREE.CubeTextureNode.prototype.constructor = THREE.CubeTextureNode; 17 | 18 | THREE.CubeTextureNode.prototype.getTexture = function( builder, output ) { 19 | 20 | return THREE.InputNode.prototype.generate.call( this, builder, output, this.value.uuid, 't' ); 21 | 22 | }; 23 | 24 | THREE.CubeTextureNode.prototype.generate = function( builder, output ) { 25 | 26 | var cubetex = this.getTexture( builder, output ); 27 | var coord = this.coord.build( builder, 'v3' ); 28 | var bias = this.bias ? this.bias.build( builder, 'fv1' ) : undefined; 29 | 30 | if ( bias == undefined && builder.requires.bias ) { 31 | 32 | bias = builder.requires.bias.build( builder, 'fv1' ); 33 | 34 | } 35 | 36 | var code; 37 | 38 | if ( bias ) code = 'texCubeBias(' + cubetex + ',' + coord + ',' + bias + ')'; 39 | else code = 'texCube(' + cubetex + ',' + coord + ')'; 40 | 41 | return builder.format( code, this.type, output ); 42 | 43 | }; 44 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/inputs/FloatNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.FloatNode = function( value ) { 6 | 7 | THREE.InputNode.call( this, 'fv1', { share: false } ); 8 | 9 | this.value = [ value || 0 ]; 10 | 11 | }; 12 | 13 | THREE.FloatNode.prototype = Object.create( THREE.InputNode.prototype ); 14 | THREE.FloatNode.prototype.constructor = THREE.FloatNode; 15 | 16 | Object.defineProperties( THREE.FloatNode.prototype, { 17 | number: { 18 | get: function() { 19 | 20 | return this.value[ 0 ]; 21 | 22 | }, 23 | set: function( val ) { 24 | 25 | this.value[ 0 ] = val; 26 | 27 | } 28 | } 29 | } ); 30 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/inputs/IntNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.IntNode = function( value ) { 6 | 7 | THREE.InputNode.call( this, 'fv1', { share: false } ); 8 | 9 | this.value = [ Math.floor( value || 0 ) ]; 10 | 11 | }; 12 | 13 | THREE.IntNode.prototype = Object.create( THREE.InputNode.prototype ); 14 | THREE.IntNode.prototype.constructor = THREE.IntNode; 15 | 16 | Object.defineProperties( THREE.IntNode.prototype, { 17 | number: { 18 | get: function() { 19 | 20 | return this.value[ 0 ]; 21 | 22 | }, 23 | set: function( val ) { 24 | 25 | this.value[ 0 ] = Math.floor( val ); 26 | 27 | } 28 | } 29 | } ); 30 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/inputs/Matrix4Node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.Matrix4Node = function( matrix ) { 6 | 7 | THREE.InputNode.call( this, 'm4', { share: false } ); 8 | 9 | this.value = matrix || new THREE.Matrix4(); 10 | 11 | }; 12 | 13 | THREE.Matrix4Node.prototype = Object.create( THREE.InputNode.prototype ); 14 | THREE.Matrix4Node.prototype.constructor = THREE.Matrix4Node; 15 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/inputs/MirrorNode.js: -------------------------------------------------------------------------------- 1 | THREE.MirrorNode = function( renderer, camera, options ) { 2 | 3 | THREE.TempNode.call( this, 'v4' ); 4 | 5 | this.mirror = renderer instanceof THREE.Mirror ? renderer : new THREE.Mirror( renderer, camera, options ); 6 | 7 | this.textureMatrix = new THREE.Matrix4Node( this.mirror.textureMatrix ); 8 | 9 | this.worldPosition = new THREE.PositionNode( THREE.PositionNode.WORLD ); 10 | 11 | this.coord = new THREE.OperatorNode( this.textureMatrix, this.worldPosition, THREE.OperatorNode.MUL ); 12 | this.coordResult = new THREE.OperatorNode( null, this.coord, THREE.OperatorNode.ADD ); 13 | 14 | this.texture = new THREE.TextureNode( this.mirror.renderTarget.texture, this.coord, null, true ); 15 | 16 | }; 17 | 18 | THREE.MirrorNode.prototype = Object.create( THREE.TempNode.prototype ); 19 | THREE.MirrorNode.prototype.constructor = THREE.MirrorNode; 20 | 21 | THREE.MirrorNode.prototype.generate = function( builder, output ) { 22 | 23 | var material = builder.material; 24 | 25 | if ( builder.isShader( 'fragment' ) ) { 26 | 27 | this.coordResult.a = this.offset; 28 | this.texture.coord = this.offset ? this.coordResult : this.coord; 29 | 30 | var coord = this.texture.build( builder, this.type ); 31 | 32 | return builder.format( coord, this.type, output ); 33 | 34 | } 35 | else { 36 | 37 | console.warn( "THREE.MirrorNode is not compatible with " + builder.shader + " shader." ); 38 | 39 | return builder.format( 'vec4(0.0)', this.type, output ); 40 | 41 | } 42 | 43 | }; 44 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/inputs/ScreenNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.ScreenNode = function( coord ) { 6 | 7 | THREE.TextureNode.call( this, undefined, coord ); 8 | 9 | }; 10 | 11 | THREE.ScreenNode.prototype = Object.create( THREE.TextureNode.prototype ); 12 | THREE.ScreenNode.prototype.constructor = THREE.ScreenNode; 13 | 14 | THREE.ScreenNode.prototype.isUnique = function() { 15 | 16 | return true; 17 | 18 | }; 19 | 20 | THREE.ScreenNode.prototype.getTexture = function( builder, output ) { 21 | 22 | return THREE.InputNode.prototype.generate.call( this, builder, output, this.getUuid(), 't', 'renderTexture' ); 23 | 24 | }; 25 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/inputs/TextureNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.TextureNode = function( value, coord, bias, project ) { 6 | 7 | THREE.InputNode.call( this, 'v4' ); 8 | 9 | this.value = value; 10 | this.coord = coord || new THREE.UVNode(); 11 | this.bias = bias; 12 | this.project = project !== undefined ? project : false; 13 | 14 | }; 15 | 16 | THREE.TextureNode.prototype = Object.create( THREE.InputNode.prototype ); 17 | THREE.TextureNode.prototype.constructor = THREE.TextureNode; 18 | 19 | THREE.TextureNode.prototype.getTexture = function( builder, output ) { 20 | 21 | return THREE.InputNode.prototype.generate.call( this, builder, output, this.value.uuid, 't' ); 22 | 23 | }; 24 | 25 | THREE.TextureNode.prototype.generate = function( builder, output ) { 26 | 27 | var tex = this.getTexture( builder, output ); 28 | var coord = this.coord.build( builder, this.project ? 'v4' : 'v2' ); 29 | var bias = this.bias ? this.bias.build( builder, 'fv1' ) : undefined; 30 | 31 | if ( bias == undefined && builder.requires.bias ) { 32 | 33 | bias = builder.requires.bias.build( builder, 'fv1' ); 34 | 35 | } 36 | 37 | var method, code; 38 | 39 | if ( this.project ) method = 'texture2DProj'; 40 | else method = bias ? 'tex2DBias' : 'tex2D'; 41 | 42 | if ( bias ) code = method + '(' + tex + ',' + coord + ',' + bias + ')'; 43 | else code = method + '(' + tex + ',' + coord + ')'; 44 | 45 | return builder.format( code, this.type, output ); 46 | 47 | }; 48 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/inputs/Vector2Node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.Vector2Node = function( x, y ) { 6 | 7 | THREE.InputNode.call( this, 'v2', { share: false } ); 8 | 9 | this.value = new THREE.Vector2( x, y ); 10 | 11 | }; 12 | 13 | THREE.Vector2Node.prototype = Object.create( THREE.InputNode.prototype ); 14 | THREE.Vector2Node.prototype.constructor = THREE.Vector2Node; 15 | 16 | THREE.NodeMaterial.addShortcuts( THREE.Vector2Node.prototype, 'value', [ 'x', 'y' ] ); 17 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/inputs/Vector3Node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.Vector3Node = function( x, y, z ) { 6 | 7 | THREE.InputNode.call( this, 'v3', { share: false } ); 8 | 9 | this.type = 'v3'; 10 | this.value = new THREE.Vector3( x, y, z ); 11 | 12 | }; 13 | 14 | THREE.Vector3Node.prototype = Object.create( THREE.InputNode.prototype ); 15 | THREE.Vector3Node.prototype.constructor = THREE.Vector3Node; 16 | 17 | THREE.NodeMaterial.addShortcuts( THREE.Vector3Node.prototype, 'value', [ 'x', 'y', 'z' ] ); 18 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/inputs/Vector4Node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.Vector4Node = function( x, y, z, w ) { 6 | 7 | THREE.InputNode.call( this, 'v4', { share: false } ); 8 | 9 | this.value = new THREE.Vector4( x, y, z, w ); 10 | 11 | }; 12 | 13 | THREE.Vector4Node.prototype = Object.create( THREE.InputNode.prototype ); 14 | THREE.Vector4Node.prototype.constructor = THREE.Vector4Node; 15 | 16 | THREE.NodeMaterial.addShortcuts( THREE.Vector4Node.prototype, 'value', [ 'x', 'y', 'z', 'w' ] ); 17 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/materials/PhongNodeMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.PhongNodeMaterial = function() { 6 | 7 | this.node = new THREE.PhongNode(); 8 | 9 | THREE.NodeMaterial.call( this, this.node, this.node ); 10 | 11 | }; 12 | 13 | THREE.PhongNodeMaterial.prototype = Object.create( THREE.NodeMaterial.prototype ); 14 | THREE.PhongNodeMaterial.prototype.constructor = THREE.PhongNodeMaterial; 15 | 16 | THREE.NodeMaterial.addShortcuts( THREE.PhongNodeMaterial.prototype, 'node', 17 | [ 'color', 'alpha', 'specular', 'shininess', 'normal', 'normalScale', 'emissive', 'ambient', 'light', 'shadow', 'ao', 'environment', 'environmentAlpha', 'transform' ] ); 18 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/materials/StandardNodeMaterial.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.StandardNodeMaterial = function() { 6 | 7 | this.node = new THREE.StandardNode(); 8 | 9 | THREE.NodeMaterial.call( this, this.node, this.node ); 10 | 11 | }; 12 | 13 | THREE.StandardNodeMaterial.prototype = Object.create( THREE.NodeMaterial.prototype ); 14 | THREE.StandardNodeMaterial.prototype.constructor = THREE.StandardNodeMaterial; 15 | 16 | THREE.NodeMaterial.addShortcuts( THREE.StandardNodeMaterial.prototype, 'node', 17 | [ 'color', 'alpha', 'roughness', 'metalness', 'normal', 'normalScale', 'emissive', 'ambient', 'light', 'shadow', 'ao', 'environment', 'transform' ] ); 18 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/math/Math1Node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.Math1Node = function( a, method ) { 6 | 7 | THREE.TempNode.call( this ); 8 | 9 | this.a = a; 10 | 11 | this.method = method || THREE.Math1Node.SIN; 12 | 13 | }; 14 | 15 | THREE.Math1Node.RAD = 'radians'; 16 | THREE.Math1Node.DEG = 'degrees'; 17 | THREE.Math1Node.EXP = 'exp'; 18 | THREE.Math1Node.EXP2 = 'exp2'; 19 | THREE.Math1Node.LOG = 'log'; 20 | THREE.Math1Node.LOG2 = 'log2'; 21 | THREE.Math1Node.SQRT = 'sqrt'; 22 | THREE.Math1Node.INV_SQRT = 'inversesqrt'; 23 | THREE.Math1Node.FLOOR = 'floor'; 24 | THREE.Math1Node.CEIL = 'ceil'; 25 | THREE.Math1Node.NORMALIZE = 'normalize'; 26 | THREE.Math1Node.FRACT = 'fract'; 27 | THREE.Math1Node.SAT = 'saturate'; 28 | THREE.Math1Node.SIN = 'sin'; 29 | THREE.Math1Node.COS = 'cos'; 30 | THREE.Math1Node.TAN = 'tan'; 31 | THREE.Math1Node.ASIN = 'asin'; 32 | THREE.Math1Node.ACOS = 'acos'; 33 | THREE.Math1Node.ARCTAN = 'atan'; 34 | THREE.Math1Node.ABS = 'abs'; 35 | THREE.Math1Node.SIGN = 'sign'; 36 | THREE.Math1Node.LENGTH = 'length'; 37 | THREE.Math1Node.NEGATE = 'negate'; 38 | THREE.Math1Node.INVERT = 'invert'; 39 | 40 | THREE.Math1Node.prototype = Object.create( THREE.TempNode.prototype ); 41 | THREE.Math1Node.prototype.constructor = THREE.Math1Node; 42 | 43 | THREE.Math1Node.prototype.getType = function( builder ) { 44 | 45 | switch ( this.method ) { 46 | case THREE.Math1Node.LENGTH: 47 | return 'fv1'; 48 | } 49 | 50 | return this.a.getType( builder ); 51 | 52 | }; 53 | 54 | THREE.Math1Node.prototype.generate = function( builder, output ) { 55 | 56 | var material = builder.material; 57 | 58 | var type = this.getType( builder ); 59 | 60 | var result = this.a.build( builder, type ); 61 | 62 | switch ( this.method ) { 63 | 64 | case THREE.Math1Node.NEGATE: 65 | result = '(-' + result + ')'; 66 | break; 67 | 68 | case THREE.Math1Node.INVERT: 69 | result = '(1.0-' + result + ')'; 70 | break; 71 | 72 | default: 73 | result = this.method + '(' + result + ')'; 74 | break; 75 | } 76 | 77 | return builder.format( result, type, output ); 78 | 79 | }; 80 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/math/Math2Node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.Math2Node = function( a, b, method ) { 6 | 7 | THREE.TempNode.call( this ); 8 | 9 | this.a = a; 10 | this.b = b; 11 | 12 | this.method = method || THREE.Math2Node.DISTANCE; 13 | 14 | }; 15 | 16 | THREE.Math2Node.MIN = 'min'; 17 | THREE.Math2Node.MAX = 'max'; 18 | THREE.Math2Node.MOD = 'mod'; 19 | THREE.Math2Node.STEP = 'step'; 20 | THREE.Math2Node.REFLECT = 'reflect'; 21 | THREE.Math2Node.DISTANCE = 'distance'; 22 | THREE.Math2Node.DOT = 'dot'; 23 | THREE.Math2Node.CROSS = 'cross'; 24 | THREE.Math2Node.POW = 'pow'; 25 | 26 | THREE.Math2Node.prototype = Object.create( THREE.TempNode.prototype ); 27 | THREE.Math2Node.prototype.constructor = THREE.Math2Node; 28 | 29 | THREE.Math2Node.prototype.getInputType = function( builder ) { 30 | 31 | // use the greater length vector 32 | if ( builder.getFormatLength( this.b.getType( builder ) ) > builder.getFormatLength( this.a.getType( builder ) ) ) { 33 | 34 | return this.b.getType( builder ); 35 | 36 | } 37 | 38 | return this.a.getType( builder ); 39 | 40 | }; 41 | 42 | THREE.Math2Node.prototype.getType = function( builder ) { 43 | 44 | switch ( this.method ) { 45 | case THREE.Math2Node.DISTANCE: 46 | case THREE.Math2Node.DOT: 47 | return 'fv1'; 48 | 49 | case THREE.Math2Node.CROSS: 50 | return 'v3'; 51 | } 52 | 53 | return this.getInputType( builder ); 54 | 55 | }; 56 | 57 | THREE.Math2Node.prototype.generate = function( builder, output ) { 58 | 59 | var material = builder.material; 60 | 61 | var type = this.getInputType( builder ); 62 | 63 | var a, b, 64 | al = builder.getFormatLength( this.a.getType( builder ) ), 65 | bl = builder.getFormatLength( this.b.getType( builder ) ); 66 | 67 | // optimzer 68 | 69 | switch ( this.method ) { 70 | case THREE.Math2Node.CROSS: 71 | a = this.a.build( builder, 'v3' ); 72 | b = this.b.build( builder, 'v3' ); 73 | break; 74 | 75 | case THREE.Math2Node.STEP: 76 | a = this.a.build( builder, al == 1 ? 'fv1' : type ); 77 | b = this.b.build( builder, type ); 78 | break; 79 | 80 | case THREE.Math2Node.MIN: 81 | case THREE.Math2Node.MAX: 82 | case THREE.Math2Node.MOD: 83 | a = this.a.build( builder, type ); 84 | b = this.b.build( builder, bl == 1 ? 'fv1' : type ); 85 | break; 86 | 87 | default: 88 | a = this.a.build( builder, type ); 89 | b = this.b.build( builder, type ); 90 | break; 91 | 92 | } 93 | 94 | return builder.format( this.method + '(' + a + ',' + b + ')', this.getType( builder ), output ); 95 | 96 | }; 97 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/math/Math3Node.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.Math3Node = function( a, b, c, method ) { 6 | 7 | THREE.TempNode.call( this ); 8 | 9 | this.a = a; 10 | this.b = b; 11 | this.c = c; 12 | 13 | this.method = method || THREE.Math3Node.MIX; 14 | 15 | }; 16 | 17 | THREE.Math3Node.MIX = 'mix'; 18 | THREE.Math3Node.REFRACT = 'refract'; 19 | THREE.Math3Node.SMOOTHSTEP = 'smoothstep'; 20 | THREE.Math3Node.FACEFORWARD = 'faceforward'; 21 | 22 | THREE.Math3Node.prototype = Object.create( THREE.TempNode.prototype ); 23 | THREE.Math3Node.prototype.constructor = THREE.Math3Node; 24 | 25 | THREE.Math3Node.prototype.getType = function( builder ) { 26 | 27 | var a = builder.getFormatLength( this.a.getType( builder ) ); 28 | var b = builder.getFormatLength( this.b.getType( builder ) ); 29 | var c = builder.getFormatLength( this.c.getType( builder ) ); 30 | 31 | if ( a > b && a > c ) return this.a.getType( builder ); 32 | else if ( b > c ) return this.b.getType( builder ); 33 | 34 | return this.c.getType( builder ); 35 | 36 | }; 37 | 38 | THREE.Math3Node.prototype.generate = function( builder, output ) { 39 | 40 | var material = builder.material; 41 | 42 | var type = this.getType( builder ); 43 | 44 | var a, b, c, 45 | al = builder.getFormatLength( this.a.getType( builder ) ), 46 | bl = builder.getFormatLength( this.b.getType( builder ) ), 47 | cl = builder.getFormatLength( this.c.getType( builder ) ) 48 | 49 | // optimzer 50 | 51 | switch ( this.method ) { 52 | case THREE.Math3Node.REFRACT: 53 | a = this.a.build( builder, type ); 54 | b = this.b.build( builder, type ); 55 | c = this.c.build( builder, 'fv1' ); 56 | break; 57 | 58 | case THREE.Math3Node.MIX: 59 | a = this.a.build( builder, type ); 60 | b = this.b.build( builder, type ); 61 | c = this.c.build( builder, cl == 1 ? 'fv1' : type ); 62 | break; 63 | 64 | default: 65 | a = this.a.build( builder, type ); 66 | b = this.b.build( builder, type ); 67 | c = this.c.build( builder, type ); 68 | break; 69 | 70 | } 71 | 72 | return builder.format( this.method + '(' + a + ',' + b + ',' + c + ')', type, output ); 73 | 74 | }; 75 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/math/OperatorNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.OperatorNode = function( a, b, op ) { 6 | 7 | THREE.TempNode.call( this ); 8 | 9 | this.a = a; 10 | this.b = b; 11 | this.op = op || THREE.OperatorNode.ADD; 12 | 13 | }; 14 | 15 | THREE.OperatorNode.ADD = '+'; 16 | THREE.OperatorNode.SUB = '-'; 17 | THREE.OperatorNode.MUL = '*'; 18 | THREE.OperatorNode.DIV = '/'; 19 | 20 | THREE.OperatorNode.prototype = Object.create( THREE.TempNode.prototype ); 21 | THREE.OperatorNode.prototype.constructor = THREE.OperatorNode; 22 | 23 | THREE.OperatorNode.prototype.getType = function( builder ) { 24 | 25 | var a = this.a.getType( builder ); 26 | var b = this.b.getType( builder ); 27 | 28 | if ( builder.isFormatMatrix( a ) ) { 29 | 30 | return 'v4'; 31 | 32 | } 33 | // use the greater length vector 34 | else if ( builder.getFormatLength( b ) > builder.getFormatLength( a ) ) { 35 | 36 | return b; 37 | 38 | } 39 | 40 | return a; 41 | 42 | }; 43 | 44 | THREE.OperatorNode.prototype.generate = function( builder, output ) { 45 | 46 | var material = builder.material, 47 | data = material.getDataNode( this.uuid ); 48 | 49 | var type = this.getType( builder ); 50 | 51 | var a = this.a.build( builder, type ); 52 | var b = this.b.build( builder, type ); 53 | 54 | return builder.format( '(' + a + this.op + b + ')', type, output ); 55 | 56 | }; 57 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/postprocessing/NodePass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.NodePass = function() { 6 | 7 | THREE.ShaderPass.call( this ); 8 | 9 | this.textureID = 'renderTexture'; 10 | 11 | this.fragment = new THREE.RawNode( new THREE.ScreenNode() ); 12 | 13 | this.node = new THREE.NodeMaterial(); 14 | this.node.fragment = this.fragment; 15 | 16 | this.build(); 17 | 18 | }; 19 | 20 | THREE.NodePass.prototype = Object.create( THREE.ShaderPass.prototype ); 21 | THREE.NodePass.prototype.constructor = THREE.NodePass; 22 | 23 | THREE.NodeMaterial.addShortcuts( THREE.NodePass.prototype, 'fragment', [ 'value' ] ); 24 | 25 | THREE.NodePass.prototype.build = function() { 26 | 27 | this.node.build(); 28 | 29 | this.uniforms = this.node.uniforms; 30 | this.material = this.node; 31 | 32 | }; 33 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/utils/ColorAdjustmentNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.ColorAdjustmentNode = function( rgb, adjustment, method ) { 6 | 7 | THREE.TempNode.call( this, 'v3' ); 8 | 9 | this.rgb = rgb; 10 | this.adjustment = adjustment; 11 | 12 | this.method = method || THREE.ColorAdjustmentNode.SATURATION; 13 | 14 | }; 15 | 16 | THREE.ColorAdjustmentNode.SATURATION = 'saturation'; 17 | THREE.ColorAdjustmentNode.HUE = 'hue'; 18 | THREE.ColorAdjustmentNode.VIBRANCE = 'vibrance'; 19 | THREE.ColorAdjustmentNode.BRIGHTNESS = 'brightness'; 20 | THREE.ColorAdjustmentNode.CONTRAST = 'contrast'; 21 | 22 | THREE.ColorAdjustmentNode.prototype = Object.create( THREE.TempNode.prototype ); 23 | THREE.ColorAdjustmentNode.prototype.constructor = THREE.ColorAdjustmentNode; 24 | 25 | THREE.ColorAdjustmentNode.prototype.generate = function( builder, output ) { 26 | 27 | var rgb = this.rgb.build( builder, 'v3' ); 28 | var adjustment = this.adjustment.build( builder, 'fv1' ); 29 | 30 | var name; 31 | 32 | switch ( this.method ) { 33 | 34 | case THREE.ColorAdjustmentNode.SATURATION: 35 | 36 | name = 'saturation_rgb'; 37 | 38 | break; 39 | 40 | case THREE.ColorAdjustmentNode.HUE: 41 | 42 | name = 'hue_rgb'; 43 | 44 | break; 45 | 46 | case THREE.ColorAdjustmentNode.VIBRANCE: 47 | 48 | name = 'vibrance_rgb'; 49 | 50 | break; 51 | 52 | case THREE.ColorAdjustmentNode.BRIGHTNESS: 53 | 54 | return builder.format( '(' + rgb + '+' + adjustment + ')', this.getType( builder ), output ); 55 | 56 | break; 57 | 58 | case THREE.ColorAdjustmentNode.CONTRAST: 59 | 60 | return builder.format( '(' + rgb + '*' + adjustment + ')', this.getType( builder ), output ); 61 | 62 | break; 63 | 64 | } 65 | 66 | builder.include( name ); 67 | 68 | return builder.format( name + '(' + rgb + ',' + adjustment + ')', this.getType( builder ), output ); 69 | 70 | }; 71 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/utils/JoinNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.JoinNode = function( x, y, z, w ) { 6 | 7 | THREE.TempNode.call( this, 'fv1' ); 8 | 9 | this.x = x; 10 | this.y = y; 11 | this.z = z; 12 | this.w = w; 13 | 14 | }; 15 | 16 | THREE.JoinNode.inputs = [ 'x', 'y', 'z', 'w' ]; 17 | 18 | THREE.JoinNode.prototype = Object.create( THREE.TempNode.prototype ); 19 | THREE.JoinNode.prototype.constructor = THREE.JoinNode; 20 | 21 | THREE.JoinNode.prototype.getNumElements = function() { 22 | 23 | var inputs = THREE.JoinNode.inputs; 24 | var i = inputs.length; 25 | 26 | while ( i -- ) { 27 | 28 | if ( this[ inputs[ i ] ] !== undefined ) { 29 | 30 | ++ i; 31 | break; 32 | 33 | } 34 | 35 | } 36 | 37 | return Math.max( i, 2 ); 38 | 39 | }; 40 | 41 | THREE.JoinNode.prototype.getType = function( builder ) { 42 | 43 | return builder.getFormatByLength( this.getNumElements() ); 44 | 45 | }; 46 | 47 | THREE.JoinNode.prototype.generate = function( builder, output ) { 48 | 49 | var material = builder.material; 50 | 51 | var type = this.getType( builder ); 52 | var length = this.getNumElements(); 53 | 54 | var inputs = THREE.JoinNode.inputs; 55 | var outputs = []; 56 | 57 | for ( var i = 0; i < length; i ++ ) { 58 | 59 | var elm = this[ inputs[ i ]]; 60 | 61 | outputs.push( elm ? elm.build( builder, 'fv1' ) : '0.' ); 62 | 63 | } 64 | 65 | var code = builder.getFormatConstructor( length ) + '(' + outputs.join( ',' ) + ')'; 66 | 67 | return builder.format( code, type, output ); 68 | 69 | }; 70 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/utils/LuminanceNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.LuminanceNode = function( rgb ) { 6 | 7 | THREE.TempNode.call( this, 'fv1' ); 8 | 9 | this.rgb = rgb; 10 | 11 | }; 12 | 13 | THREE.LuminanceNode.prototype = Object.create( THREE.TempNode.prototype ); 14 | THREE.LuminanceNode.prototype.constructor = THREE.LuminanceNode; 15 | 16 | THREE.LuminanceNode.prototype.generate = function( builder, output ) { 17 | 18 | builder.include( 'luminance_rgb' ); 19 | 20 | return builder.format( 'luminance_rgb(' + this.rgb.build( builder, 'v3' ) + ')', this.getType( builder ), output ); 21 | 22 | }; 23 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/utils/NoiseNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.NoiseNode = function( coord ) { 6 | 7 | THREE.TempNode.call( this, 'fv1' ); 8 | 9 | this.coord = coord; 10 | 11 | }; 12 | 13 | THREE.NoiseNode.prototype = Object.create( THREE.TempNode.prototype ); 14 | THREE.NoiseNode.prototype.constructor = THREE.NoiseNode; 15 | 16 | THREE.NoiseNode.prototype.generate = function( builder, output ) { 17 | 18 | builder.include( 'snoise' ); 19 | 20 | return builder.format( 'snoise(' + this.coord.build( builder, 'v2' ) + ')', this.getType( builder ), output ); 21 | 22 | }; 23 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/utils/NormalMapNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.NormalMapNode = function( value, uv, scale, normal, position ) { 6 | 7 | THREE.TempNode.call( this, 'v3' ); 8 | 9 | this.value = value; 10 | this.scale = scale || new THREE.FloatNode( 1 ); 11 | 12 | this.normal = normal || new THREE.NormalNode( THREE.NormalNode.LOCAL ); 13 | this.position = position || new THREE.PositionNode( THREE.NormalNode.VIEW ); 14 | 15 | }; 16 | 17 | THREE.NormalMapNode.prototype = Object.create( THREE.TempNode.prototype ); 18 | THREE.NormalMapNode.prototype.constructor = THREE.NormalMapNode; 19 | 20 | THREE.NormalMapNode.prototype.generate = function( builder, output ) { 21 | 22 | var material = builder.material; 23 | 24 | builder.include( 'perturbNormal2Arb' ); 25 | 26 | if ( builder.isShader( 'fragment' ) ) { 27 | 28 | return builder.format( 'perturbNormal2Arb(-' + this.position.build( builder, 'v3' ) + ',' + 29 | this.normal.build( builder, 'v3' ) + ',' + 30 | this.value.build( builder, 'v3' ) + ',' + 31 | this.value.coord.build( builder, 'v2' ) + ',' + 32 | this.scale.build( builder, 'v2' ) + ')', this.getType( builder ), output ); 33 | 34 | } 35 | else { 36 | 37 | console.warn( "THREE.NormalMapNode is not compatible with " + builder.shader + " shader." ); 38 | 39 | return builder.format( 'vec3( 0.0 )', this.getType( builder ), output ); 40 | 41 | } 42 | 43 | }; 44 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/utils/ResolutionNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.ResolutionNode = function( renderer ) { 6 | 7 | THREE.Vector2Node.call( this ); 8 | 9 | this.requestUpdate = true; 10 | 11 | this.renderer = renderer; 12 | 13 | }; 14 | 15 | THREE.ResolutionNode.prototype = Object.create( THREE.Vector2Node.prototype ); 16 | THREE.ResolutionNode.prototype.constructor = THREE.ResolutionNode; 17 | 18 | THREE.ResolutionNode.prototype.updateAnimation = function( delta ) { 19 | 20 | var size = this.renderer.getSize(); 21 | 22 | this.x = size.width; 23 | this.y = size.height; 24 | 25 | }; 26 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/utils/RoughnessToBlinnExponentNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.RoughnessToBlinnExponentNode = function() { 6 | 7 | THREE.TempNode.call( this, 'fv1' ); 8 | 9 | }; 10 | 11 | THREE.RoughnessToBlinnExponentNode.getSpecularMIPLevel = new THREE.FunctionNode( [ 12 | // taken from here: http://casual-effects.blogspot.ca/2011/08/plausible-environment-lighting-in-two.html 13 | "float getSpecularMIPLevel( const in float blinnShininessExponent, const in int maxMIPLevel ) {", 14 | 15 | //float envMapWidth = pow( 2.0, maxMIPLevelScalar ); 16 | //float desiredMIPLevel = log2( envMapWidth * sqrt( 3.0 ) ) - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 ); 17 | "float maxMIPLevelScalar = float( maxMIPLevel );", 18 | "float desiredMIPLevel = maxMIPLevelScalar - 0.79248 - 0.5 * log2( pow2( blinnShininessExponent ) + 1.0 );", 19 | 20 | // clamp to allowable LOD ranges. 21 | "return clamp( desiredMIPLevel, 0.0, maxMIPLevelScalar );", 22 | "}" 23 | ].join( "\n" ) ); 24 | 25 | THREE.RoughnessToBlinnExponentNode.prototype = Object.create( THREE.TempNode.prototype ); 26 | THREE.RoughnessToBlinnExponentNode.prototype.constructor = THREE.RoughnessToBlinnExponentNode; 27 | 28 | THREE.RoughnessToBlinnExponentNode.prototype.generate = function( builder, output ) { 29 | 30 | var material = builder.material; 31 | 32 | if ( builder.isShader( 'fragment' ) ) { 33 | 34 | if ( material.isDefined( 'PHYSICAL' ) ) { 35 | 36 | builder.include( THREE.RoughnessToBlinnExponentNode.getSpecularMIPLevel ); 37 | 38 | return builder.format( 'getSpecularMIPLevel( Material_BlinnShininessExponent( material ), 8 )', this.type, output ); 39 | 40 | } 41 | else { 42 | 43 | console.warn( "THREE.RoughnessToBlinnExponentNode is only compatible with PhysicalMaterial." ); 44 | 45 | return builder.format( '0.0', this.type, output ); 46 | 47 | } 48 | 49 | } 50 | else { 51 | 52 | console.warn( "THREE.RoughnessToBlinnExponentNode is not compatible with " + builder.shader + " shader." ); 53 | 54 | return builder.format( '0.0', this.type, output ); 55 | 56 | } 57 | 58 | }; 59 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/utils/SwitchNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.SwitchNode = function( node, components ) { 6 | 7 | THREE.GLNode.call( this ); 8 | 9 | this.node = node; 10 | this.components = components || 'x'; 11 | 12 | }; 13 | 14 | THREE.SwitchNode.prototype = Object.create( THREE.GLNode.prototype ); 15 | THREE.SwitchNode.prototype.constructor = THREE.SwitchNode; 16 | 17 | THREE.SwitchNode.prototype.getType = function( builder ) { 18 | 19 | return builder.getFormatByLength( this.components.length ); 20 | 21 | }; 22 | 23 | THREE.SwitchNode.prototype.generate = function( builder, output ) { 24 | 25 | var type = this.node.getType( builder ); 26 | var inputLength = builder.getFormatLength( type ) - 1; 27 | 28 | var node = this.node.build( builder, type ); 29 | 30 | if ( inputLength > 0 ) { 31 | 32 | // get max length 33 | 34 | var outputLength = 0; 35 | var components = builder.colorToVector( this.components ); 36 | 37 | var i, len = components.length; 38 | 39 | for ( i = 0; i < len; i ++ ) { 40 | 41 | outputLength = Math.max( outputLength, builder.getIndexByElement( components.charAt( i ) ) ); 42 | 43 | } 44 | 45 | if ( outputLength > inputLength ) outputLength = inputLength; 46 | 47 | // split 48 | 49 | node += '.'; 50 | 51 | for ( i = 0; i < len; i ++ ) { 52 | 53 | var elm = components.charAt( i ); 54 | var idx = builder.getIndexByElement( components.charAt( i ) ); 55 | 56 | if ( idx > outputLength ) idx = outputLength; 57 | 58 | node += builder.getElementByIndex( idx ); 59 | 60 | } 61 | 62 | return builder.format( node, this.getType( builder ), output ); 63 | 64 | } else { 65 | 66 | // join 67 | 68 | return builder.format( node, type, output ) 69 | 70 | } 71 | 72 | }; 73 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/utils/TimerNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.TimerNode = function( value, scale ) { 6 | 7 | THREE.FloatNode.call( this, value ); 8 | 9 | this.requestUpdate = true; 10 | 11 | this.scale = scale !== undefined ? scale : 1; 12 | 13 | }; 14 | 15 | THREE.TimerNode.prototype = Object.create( THREE.FloatNode.prototype ); 16 | THREE.TimerNode.prototype.constructor = THREE.TimerNode; 17 | 18 | THREE.TimerNode.prototype.updateAnimation = function( delta ) { 19 | 20 | this.number += delta * this.scale; 21 | 22 | }; 23 | -------------------------------------------------------------------------------- /web/secondtemple/js/nodes/utils/VelocityNode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author sunag / http://www.sunag.com.br/ 3 | */ 4 | 5 | THREE.VelocityNode = function( target, params ) { 6 | 7 | THREE.Vector3Node.call( this ); 8 | 9 | this.requestUpdate = true; 10 | 11 | this.target = target; 12 | 13 | this.position = this.target.position.clone(); 14 | this.velocity = new THREE.Vector3(); 15 | this.moment = new THREE.Vector3(); 16 | 17 | this.params = params || {}; 18 | 19 | }; 20 | 21 | THREE.VelocityNode.prototype = Object.create( THREE.Vector3Node.prototype ); 22 | THREE.VelocityNode.prototype.constructor = THREE.VelocityNode; 23 | 24 | THREE.VelocityNode.prototype.updateAnimation = function( delta ) { 25 | 26 | this.velocity.subVectors( this.target.position, this.position ); 27 | this.position.copy( this.target.position ); 28 | 29 | switch ( this.params.type ) { 30 | 31 | case "elastic": 32 | 33 | delta *= this.params.fps || 60; 34 | 35 | var spring = Math.pow( this.params.spring, delta ); 36 | var friction = Math.pow( this.params.friction, delta ); 37 | 38 | // spring 39 | this.moment.x += this.velocity.x * spring; 40 | this.moment.y += this.velocity.y * spring; 41 | this.moment.z += this.velocity.z * spring; 42 | 43 | // friction 44 | this.moment.x *= friction; 45 | this.moment.y *= friction; 46 | this.moment.z *= friction; 47 | 48 | this.value.copy( this.moment ); 49 | 50 | break; 51 | 52 | default: 53 | 54 | this.value.copy( this.velocity ); 55 | 56 | break; 57 | } 58 | 59 | }; 60 | -------------------------------------------------------------------------------- /web/secondtemple/js/objects/ShadowMesh.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author erichlof / http://github.com/erichlof 3 | * 4 | * A shadow Mesh that follows a shadow-casting Mesh in the scene, but is confined to a single plane. 5 | */ 6 | 7 | THREE.ShadowMesh = function ( mesh ) { 8 | 9 | var shadowMaterial = new THREE.MeshBasicMaterial( { 10 | 11 | color: 0x000000, 12 | transparent: true, 13 | opacity: 0.6, 14 | depthWrite: false 15 | 16 | } ); 17 | 18 | THREE.Mesh.call( this, mesh.geometry, shadowMaterial ); 19 | 20 | this.meshMatrix = mesh.matrixWorld; 21 | 22 | this.frustumCulled = false; 23 | this.matrixAutoUpdate = false; 24 | 25 | }; 26 | 27 | THREE.ShadowMesh.prototype = Object.create( THREE.Mesh.prototype ); 28 | THREE.ShadowMesh.prototype.constructor = THREE.ShadowMesh; 29 | 30 | THREE.ShadowMesh.prototype.update = function () { 31 | 32 | var shadowMatrix = new THREE.Matrix4(); 33 | 34 | return function ( plane, lightPosition4D ) { 35 | 36 | // based on https://www.opengl.org/archives/resources/features/StencilTalk/tsld021.htm 37 | 38 | var dot = plane.normal.x * lightPosition4D.x + 39 | plane.normal.y * lightPosition4D.y + 40 | plane.normal.z * lightPosition4D.z + 41 | - plane.constant * lightPosition4D.w; 42 | 43 | var sme = shadowMatrix.elements; 44 | 45 | sme[ 0 ] = dot - lightPosition4D.x * plane.normal.x; 46 | sme[ 4 ] = - lightPosition4D.x * plane.normal.y; 47 | sme[ 8 ] = - lightPosition4D.x * plane.normal.z; 48 | sme[ 12 ] = - lightPosition4D.x * - plane.constant; 49 | 50 | sme[ 1 ] = - lightPosition4D.y * plane.normal.x; 51 | sme[ 5 ] = dot - lightPosition4D.y * plane.normal.y; 52 | sme[ 9 ] = - lightPosition4D.y * plane.normal.z; 53 | sme[ 13 ] = - lightPosition4D.y * - plane.constant; 54 | 55 | sme[ 2 ] = - lightPosition4D.z * plane.normal.x; 56 | sme[ 6 ] = - lightPosition4D.z * plane.normal.y; 57 | sme[ 10 ] = dot - lightPosition4D.z * plane.normal.z; 58 | sme[ 14 ] = - lightPosition4D.z * - plane.constant; 59 | 60 | sme[ 3 ] = - lightPosition4D.w * plane.normal.x; 61 | sme[ 7 ] = - lightPosition4D.w * plane.normal.y; 62 | sme[ 11 ] = - lightPosition4D.w * plane.normal.z; 63 | sme[ 15 ] = dot - lightPosition4D.w * - plane.constant; 64 | 65 | this.matrix.multiplyMatrices( shadowMatrix, this.meshMatrix ); 66 | 67 | }; 68 | 69 | }(); 70 | -------------------------------------------------------------------------------- /web/secondtemple/js/postprocessing/ClearPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.ClearPass = function () { 6 | 7 | THREE.Pass.call( this ); 8 | 9 | this.needsSwap = false; 10 | 11 | }; 12 | 13 | THREE.ClearPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), { 14 | 15 | constructor: THREE.ClearPass, 16 | 17 | render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { 18 | 19 | renderer.setRenderTarget( readBuffer ); 20 | renderer.clear(); 21 | 22 | } 23 | 24 | } ); 25 | -------------------------------------------------------------------------------- /web/secondtemple/js/postprocessing/DotScreenPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.DotScreenPass = function ( center, angle, scale ) { 6 | 7 | THREE.Pass.call( this ); 8 | 9 | if ( THREE.DotScreenShader === undefined ) 10 | console.error( "THREE.DotScreenPass relies on THREE.DotScreenShader" ); 11 | 12 | var shader = THREE.DotScreenShader; 13 | 14 | this.uniforms = THREE.UniformsUtils.clone( shader.uniforms ); 15 | 16 | if ( center !== undefined ) this.uniforms[ "center" ].value.copy( center ); 17 | if ( angle !== undefined ) this.uniforms[ "angle" ].value = angle; 18 | if ( scale !== undefined ) this.uniforms[ "scale" ].value = scale; 19 | 20 | this.material = new THREE.ShaderMaterial( { 21 | 22 | uniforms: this.uniforms, 23 | vertexShader: shader.vertexShader, 24 | fragmentShader: shader.fragmentShader 25 | 26 | } ); 27 | 28 | this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); 29 | this.scene = new THREE.Scene(); 30 | 31 | this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null ); 32 | this.scene.add( this.quad ); 33 | 34 | }; 35 | 36 | THREE.DotScreenPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), { 37 | 38 | constructor: THREE.DotScreenPass, 39 | 40 | render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { 41 | 42 | this.uniforms[ "tDiffuse" ].value = readBuffer.texture; 43 | this.uniforms[ "tSize" ].value.set( readBuffer.width, readBuffer.height ); 44 | 45 | this.quad.material = this.material; 46 | 47 | if ( this.renderToScreen ) { 48 | 49 | renderer.render( this.scene, this.camera ); 50 | 51 | } else { 52 | 53 | renderer.render( this.scene, this.camera, writeBuffer, this.clear ); 54 | 55 | } 56 | 57 | } 58 | 59 | } ); 60 | -------------------------------------------------------------------------------- /web/secondtemple/js/postprocessing/FilmPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.FilmPass = function ( noiseIntensity, scanlinesIntensity, scanlinesCount, grayscale ) { 6 | 7 | THREE.Pass.call( this ); 8 | 9 | if ( THREE.FilmShader === undefined ) 10 | console.error( "THREE.FilmPass relies on THREE.FilmShader" ); 11 | 12 | var shader = THREE.FilmShader; 13 | 14 | this.uniforms = THREE.UniformsUtils.clone( shader.uniforms ); 15 | 16 | this.material = new THREE.ShaderMaterial( { 17 | 18 | uniforms: this.uniforms, 19 | vertexShader: shader.vertexShader, 20 | fragmentShader: shader.fragmentShader 21 | 22 | } ); 23 | 24 | if ( grayscale !== undefined ) this.uniforms.grayscale.value = grayscale; 25 | if ( noiseIntensity !== undefined ) this.uniforms.nIntensity.value = noiseIntensity; 26 | if ( scanlinesIntensity !== undefined ) this.uniforms.sIntensity.value = scanlinesIntensity; 27 | if ( scanlinesCount !== undefined ) this.uniforms.sCount.value = scanlinesCount; 28 | 29 | this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); 30 | this.scene = new THREE.Scene(); 31 | 32 | this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null ); 33 | this.scene.add( this.quad ); 34 | 35 | }; 36 | 37 | THREE.FilmPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), { 38 | 39 | constructor: THREE.FilmPass, 40 | 41 | render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { 42 | 43 | this.uniforms[ "tDiffuse" ].value = readBuffer.texture; 44 | this.uniforms[ "time" ].value += delta; 45 | 46 | this.quad.material = this.material; 47 | 48 | if ( this.renderToScreen ) { 49 | 50 | renderer.render( this.scene, this.camera ); 51 | 52 | } else { 53 | 54 | renderer.render( this.scene, this.camera, writeBuffer, this.clear ); 55 | 56 | } 57 | 58 | } 59 | 60 | } ); 61 | -------------------------------------------------------------------------------- /web/secondtemple/js/postprocessing/MaskPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.MaskPass = function ( scene, camera ) { 6 | 7 | THREE.Pass.call( this ); 8 | 9 | this.scene = scene; 10 | this.camera = camera; 11 | 12 | this.clear = true; 13 | this.needsSwap = false; 14 | 15 | this.inverse = false; 16 | 17 | }; 18 | 19 | THREE.MaskPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), { 20 | 21 | constructor: THREE.MaskPass, 22 | 23 | render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { 24 | 25 | var context = renderer.context; 26 | var state = renderer.state; 27 | 28 | // don't update color or depth 29 | 30 | state.buffers.color.setMask( false ); 31 | state.buffers.depth.setMask( false ); 32 | 33 | // lock buffers 34 | 35 | state.buffers.color.setLocked( true ); 36 | state.buffers.depth.setLocked( true ); 37 | 38 | // set up stencil 39 | 40 | var writeValue, clearValue; 41 | 42 | if ( this.inverse ) { 43 | 44 | writeValue = 0; 45 | clearValue = 1; 46 | 47 | } else { 48 | 49 | writeValue = 1; 50 | clearValue = 0; 51 | 52 | } 53 | 54 | state.buffers.stencil.setTest( true ); 55 | state.buffers.stencil.setOp( context.REPLACE, context.REPLACE, context.REPLACE ); 56 | state.buffers.stencil.setFunc( context.ALWAYS, writeValue, 0xffffffff ); 57 | state.buffers.stencil.setClear( clearValue ); 58 | 59 | // draw into the stencil buffer 60 | 61 | renderer.render( this.scene, this.camera, readBuffer, this.clear ); 62 | renderer.render( this.scene, this.camera, writeBuffer, this.clear ); 63 | 64 | // unlock color and depth buffer for subsequent rendering 65 | 66 | state.buffers.color.setLocked( false ); 67 | state.buffers.depth.setLocked( false ); 68 | 69 | // only render where stencil is set to 1 70 | 71 | state.buffers.stencil.setFunc( context.EQUAL, 1, 0xffffffff ); // draw if == 1 72 | state.buffers.stencil.setOp( context.KEEP, context.KEEP, context.KEEP ); 73 | 74 | } 75 | 76 | } ); 77 | 78 | 79 | THREE.ClearMaskPass = function () { 80 | 81 | THREE.Pass.call( this ); 82 | 83 | this.needsSwap = false; 84 | 85 | }; 86 | 87 | THREE.ClearMaskPass.prototype = Object.create( THREE.Pass.prototype ); 88 | 89 | Object.assign( THREE.ClearMaskPass.prototype, { 90 | 91 | render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { 92 | 93 | renderer.state.buffers.stencil.setTest( false ); 94 | 95 | } 96 | 97 | } ); 98 | -------------------------------------------------------------------------------- /web/secondtemple/js/postprocessing/RenderPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.RenderPass = function ( scene, camera, overrideMaterial, clearColor, clearAlpha ) { 6 | 7 | THREE.Pass.call( this ); 8 | 9 | this.scene = scene; 10 | this.camera = camera; 11 | 12 | this.overrideMaterial = overrideMaterial; 13 | 14 | this.clearColor = clearColor; 15 | this.clearAlpha = ( clearAlpha !== undefined ) ? clearAlpha : 0; 16 | 17 | this.clear = true; 18 | this.needsSwap = false; 19 | 20 | }; 21 | 22 | THREE.RenderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), { 23 | 24 | constructor: THREE.RenderPass, 25 | 26 | render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { 27 | 28 | this.scene.overrideMaterial = this.overrideMaterial; 29 | 30 | var oldClearColor, oldClearAlpha; 31 | 32 | if ( this.clearColor ) { 33 | 34 | oldClearColor = renderer.getClearColor().getHex(); 35 | oldClearAlpha = renderer.getClearAlpha(); 36 | 37 | renderer.setClearColor( this.clearColor, this.clearAlpha ); 38 | 39 | } 40 | 41 | renderer.render( this.scene, this.camera, this.renderToScreen ? null : readBuffer, this.clear ); 42 | 43 | if ( this.clearColor ) { 44 | 45 | renderer.setClearColor( oldClearColor, oldClearAlpha ); 46 | 47 | } 48 | 49 | this.scene.overrideMaterial = null; 50 | 51 | } 52 | 53 | } ); 54 | -------------------------------------------------------------------------------- /web/secondtemple/js/postprocessing/SavePass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.SavePass = function ( renderTarget ) { 6 | 7 | THREE.Pass.call( this ); 8 | 9 | if ( THREE.CopyShader === undefined ) 10 | console.error( "THREE.SavePass relies on THREE.CopyShader" ); 11 | 12 | var shader = THREE.CopyShader; 13 | 14 | this.textureID = "tDiffuse"; 15 | 16 | this.uniforms = THREE.UniformsUtils.clone( shader.uniforms ); 17 | 18 | this.material = new THREE.ShaderMaterial( { 19 | 20 | uniforms: this.uniforms, 21 | vertexShader: shader.vertexShader, 22 | fragmentShader: shader.fragmentShader 23 | 24 | } ); 25 | 26 | this.renderTarget = renderTarget; 27 | 28 | if ( this.renderTarget === undefined ) { 29 | 30 | this.renderTargetParameters = { minFilter: THREE.LinearFilter, magFilter: THREE.LinearFilter, format: THREE.RGBFormat, stencilBuffer: false }; 31 | this.renderTarget = new THREE.WebGLRenderTarget( window.innerWidth, window.innerHeight, this.renderTargetParameters ); 32 | 33 | } 34 | 35 | this.needsSwap = false; 36 | 37 | this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); 38 | this.scene = new THREE.Scene(); 39 | 40 | this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null ); 41 | this.scene.add( this.quad ); 42 | 43 | }; 44 | 45 | THREE.SavePass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), { 46 | 47 | constructor: THREE.SavePass, 48 | 49 | render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { 50 | 51 | if ( this.uniforms[ this.textureID ] ) { 52 | 53 | this.uniforms[ this.textureID ].value = readBuffer.texture; 54 | 55 | } 56 | 57 | this.quad.material = this.material; 58 | 59 | renderer.render( this.scene, this.camera, this.renderTarget, this.clear ); 60 | 61 | } 62 | 63 | } ); 64 | -------------------------------------------------------------------------------- /web/secondtemple/js/postprocessing/ShaderPass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.ShaderPass = function ( shader, textureID ) { 6 | 7 | THREE.Pass.call( this ); 8 | 9 | this.textureID = ( textureID !== undefined ) ? textureID : "tDiffuse"; 10 | 11 | if ( shader instanceof THREE.ShaderMaterial ) { 12 | 13 | this.uniforms = shader.uniforms; 14 | 15 | this.material = shader; 16 | 17 | } else if ( shader ) { 18 | 19 | this.uniforms = THREE.UniformsUtils.clone( shader.uniforms ); 20 | 21 | this.material = new THREE.ShaderMaterial( { 22 | 23 | defines: shader.defines || {}, 24 | uniforms: this.uniforms, 25 | vertexShader: shader.vertexShader, 26 | fragmentShader: shader.fragmentShader 27 | 28 | } ); 29 | 30 | } 31 | 32 | this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); 33 | this.scene = new THREE.Scene(); 34 | 35 | this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null ); 36 | this.scene.add( this.quad ); 37 | 38 | }; 39 | 40 | THREE.ShaderPass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), { 41 | 42 | constructor: THREE.ShaderPass, 43 | 44 | render: function( renderer, writeBuffer, readBuffer, delta, maskActive ) { 45 | 46 | if ( this.uniforms[ this.textureID ] ) { 47 | 48 | this.uniforms[ this.textureID ].value = readBuffer.texture; 49 | 50 | } 51 | 52 | this.quad.material = this.material; 53 | 54 | if ( this.renderToScreen ) { 55 | 56 | renderer.render( this.scene, this.camera ); 57 | 58 | } else { 59 | 60 | renderer.render( this.scene, this.camera, writeBuffer, this.clear ); 61 | 62 | } 63 | 64 | } 65 | 66 | } ); 67 | -------------------------------------------------------------------------------- /web/secondtemple/js/postprocessing/TexturePass.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | */ 4 | 5 | THREE.TexturePass = function ( texture, opacity ) { 6 | 7 | THREE.Pass.call( this ); 8 | 9 | if ( THREE.CopyShader === undefined ) 10 | console.error( "THREE.TexturePass relies on THREE.CopyShader" ); 11 | 12 | var shader = THREE.CopyShader; 13 | 14 | this.uniforms = THREE.UniformsUtils.clone( shader.uniforms ); 15 | 16 | this.uniforms[ "opacity" ].value = ( opacity !== undefined ) ? opacity : 1.0; 17 | this.uniforms[ "tDiffuse" ].value = texture; 18 | 19 | this.material = new THREE.ShaderMaterial( { 20 | 21 | uniforms: this.uniforms, 22 | vertexShader: shader.vertexShader, 23 | fragmentShader: shader.fragmentShader 24 | 25 | } ); 26 | 27 | this.needsSwap = false; 28 | 29 | this.camera = new THREE.OrthographicCamera( - 1, 1, 1, - 1, 0, 1 ); 30 | this.scene = new THREE.Scene(); 31 | 32 | this.quad = new THREE.Mesh( new THREE.PlaneBufferGeometry( 2, 2 ), null ); 33 | this.scene.add( this.quad ); 34 | 35 | }; 36 | 37 | THREE.TexturePass.prototype = Object.assign( Object.create( THREE.Pass.prototype ), { 38 | 39 | constructor: THREE.TexturePass, 40 | 41 | render: function ( renderer, writeBuffer, readBuffer, delta, maskActive ) { 42 | 43 | this.quad.material = this.material; 44 | 45 | renderer.render( this.scene, this.camera, readBuffer, this.clear ); 46 | 47 | } 48 | 49 | } ); 50 | -------------------------------------------------------------------------------- /web/secondtemple/js/renderers/CSS2DRenderer.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://mrdoob.com/ 3 | */ 4 | 5 | THREE.CSS2DObject = function ( element ) { 6 | 7 | THREE.Object3D.call( this ); 8 | 9 | this.element = element; 10 | this.element.style.position = 'absolute'; 11 | 12 | this.addEventListener( 'removed', function ( event ) { 13 | 14 | if ( this.element.parentNode !== null ) { 15 | 16 | this.element.parentNode.removeChild( this.element ); 17 | 18 | } 19 | 20 | } ); 21 | 22 | }; 23 | 24 | THREE.CSS2DObject.prototype = Object.create( THREE.Object3D.prototype ); 25 | THREE.CSS2DObject.prototype.constructor = THREE.CSS2DObject; 26 | 27 | // 28 | 29 | THREE.CSS2DRenderer = function () { 30 | 31 | console.log( 'THREE.CSS2DRenderer', THREE.REVISION ); 32 | 33 | var _width, _height; 34 | var _widthHalf, _heightHalf; 35 | 36 | var vector = new THREE.Vector3(); 37 | var viewMatrix = new THREE.Matrix4(); 38 | var viewProjectionMatrix = new THREE.Matrix4(); 39 | 40 | var domElement = document.createElement( 'div' ); 41 | domElement.style.overflow = 'hidden'; 42 | 43 | this.domElement = domElement; 44 | 45 | this.setSize = function ( width, height ) { 46 | 47 | _width = width; 48 | _height = height; 49 | 50 | _widthHalf = _width / 2; 51 | _heightHalf = _height / 2; 52 | 53 | domElement.style.width = width + 'px'; 54 | domElement.style.height = height + 'px'; 55 | 56 | }; 57 | 58 | var renderObject = function ( object, camera ) { 59 | 60 | if ( object instanceof THREE.CSS2DObject ) { 61 | 62 | vector.setFromMatrixPosition( object.matrixWorld ); 63 | vector.applyProjection( viewProjectionMatrix ); 64 | 65 | var element = object.element; 66 | var style = 'translate(-50%,-50%) translate(' + ( vector.x * _widthHalf + _widthHalf ) + 'px,' + ( - vector.y * _heightHalf + _heightHalf ) + 'px)'; 67 | 68 | element.style.WebkitTransform = style; 69 | element.style.MozTransform = style; 70 | element.style.oTransform = style; 71 | element.style.transform = style; 72 | 73 | if ( element.parentNode !== domElement ) { 74 | 75 | domElement.appendChild( element ); 76 | 77 | } 78 | 79 | } 80 | 81 | for ( var i = 0, l = object.children.length; i < l; i ++ ) { 82 | 83 | renderObject( object.children[ i ], camera ); 84 | 85 | } 86 | 87 | }; 88 | 89 | this.render = function ( scene, camera ) { 90 | 91 | scene.updateMatrixWorld(); 92 | 93 | if ( camera.parent === null ) camera.updateMatrixWorld(); 94 | 95 | camera.matrixWorldInverse.getInverse( camera.matrixWorld ); 96 | 97 | viewMatrix.copy( camera.matrixWorldInverse.getInverse( camera.matrixWorld ) ); 98 | viewProjectionMatrix.multiplyMatrices( camera.projectionMatrix, viewMatrix ); 99 | 100 | renderObject( scene, camera ); 101 | 102 | }; 103 | 104 | }; 105 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/BasicShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author mrdoob / http://www.mrdoob.com 3 | * 4 | * Simple test shader 5 | */ 6 | 7 | THREE.BasicShader = { 8 | 9 | uniforms: {}, 10 | 11 | vertexShader: [ 12 | 13 | "void main() {", 14 | 15 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 16 | 17 | "}" 18 | 19 | ].join( "\n" ), 20 | 21 | fragmentShader: [ 22 | 23 | "void main() {", 24 | 25 | "gl_FragColor = vec4( 1.0, 0.0, 0.0, 0.5 );", 26 | 27 | "}" 28 | 29 | ].join( "\n" ) 30 | 31 | }; 32 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/BleachBypassShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Bleach bypass shader [http://en.wikipedia.org/wiki/Bleach_bypass] 5 | * - based on Nvidia example 6 | * http://developer.download.nvidia.com/shaderlibrary/webpages/shader_library.html#post_bleach_bypass 7 | */ 8 | 9 | THREE.BleachBypassShader = { 10 | 11 | uniforms: { 12 | 13 | "tDiffuse": { value: null }, 14 | "opacity": { value: 1.0 } 15 | 16 | }, 17 | 18 | vertexShader: [ 19 | 20 | "varying vec2 vUv;", 21 | 22 | "void main() {", 23 | 24 | "vUv = uv;", 25 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 26 | 27 | "}" 28 | 29 | ].join( "\n" ), 30 | 31 | fragmentShader: [ 32 | 33 | "uniform float opacity;", 34 | 35 | "uniform sampler2D tDiffuse;", 36 | 37 | "varying vec2 vUv;", 38 | 39 | "void main() {", 40 | 41 | "vec4 base = texture2D( tDiffuse, vUv );", 42 | 43 | "vec3 lumCoeff = vec3( 0.25, 0.65, 0.1 );", 44 | "float lum = dot( lumCoeff, base.rgb );", 45 | "vec3 blend = vec3( lum );", 46 | 47 | "float L = min( 1.0, max( 0.0, 10.0 * ( lum - 0.45 ) ) );", 48 | 49 | "vec3 result1 = 2.0 * base.rgb * blend;", 50 | "vec3 result2 = 1.0 - 2.0 * ( 1.0 - blend ) * ( 1.0 - base.rgb );", 51 | 52 | "vec3 newColor = mix( result1, result2, L );", 53 | 54 | "float A2 = opacity * base.a;", 55 | "vec3 mixRGB = A2 * newColor.rgb;", 56 | "mixRGB += ( ( 1.0 - A2 ) * base.rgb );", 57 | 58 | "gl_FragColor = vec4( mixRGB, base.a );", 59 | 60 | "}" 61 | 62 | ].join( "\n" ) 63 | 64 | }; 65 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/BlendShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Blend two textures 5 | */ 6 | 7 | THREE.BlendShader = { 8 | 9 | uniforms: { 10 | 11 | "tDiffuse1": { value: null }, 12 | "tDiffuse2": { value: null }, 13 | "mixRatio": { value: 0.5 }, 14 | "opacity": { value: 1.0 } 15 | 16 | }, 17 | 18 | vertexShader: [ 19 | 20 | "varying vec2 vUv;", 21 | 22 | "void main() {", 23 | 24 | "vUv = uv;", 25 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 26 | 27 | "}" 28 | 29 | ].join( "\n" ), 30 | 31 | fragmentShader: [ 32 | 33 | "uniform float opacity;", 34 | "uniform float mixRatio;", 35 | 36 | "uniform sampler2D tDiffuse1;", 37 | "uniform sampler2D tDiffuse2;", 38 | 39 | "varying vec2 vUv;", 40 | 41 | "void main() {", 42 | 43 | "vec4 texel1 = texture2D( tDiffuse1, vUv );", 44 | "vec4 texel2 = texture2D( tDiffuse2, vUv );", 45 | "gl_FragColor = opacity * mix( texel1, texel2, mixRatio );", 46 | 47 | "}" 48 | 49 | ].join( "\n" ) 50 | 51 | }; 52 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/BrightnessContrastShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author tapio / http://tapio.github.com/ 3 | * 4 | * Brightness and contrast adjustment 5 | * https://github.com/evanw/glfx.js 6 | * brightness: -1 to 1 (-1 is solid black, 0 is no change, and 1 is solid white) 7 | * contrast: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) 8 | */ 9 | 10 | THREE.BrightnessContrastShader = { 11 | 12 | uniforms: { 13 | 14 | "tDiffuse": { value: null }, 15 | "brightness": { value: 0 }, 16 | "contrast": { value: 0 } 17 | 18 | }, 19 | 20 | vertexShader: [ 21 | 22 | "varying vec2 vUv;", 23 | 24 | "void main() {", 25 | 26 | "vUv = uv;", 27 | 28 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 29 | 30 | "}" 31 | 32 | ].join( "\n" ), 33 | 34 | fragmentShader: [ 35 | 36 | "uniform sampler2D tDiffuse;", 37 | "uniform float brightness;", 38 | "uniform float contrast;", 39 | 40 | "varying vec2 vUv;", 41 | 42 | "void main() {", 43 | 44 | "gl_FragColor = texture2D( tDiffuse, vUv );", 45 | 46 | "gl_FragColor.rgb += brightness;", 47 | 48 | "if (contrast > 0.0) {", 49 | "gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) / (1.0 - contrast) + 0.5;", 50 | "} else {", 51 | "gl_FragColor.rgb = (gl_FragColor.rgb - 0.5) * (1.0 + contrast) + 0.5;", 52 | "}", 53 | 54 | "}" 55 | 56 | ].join( "\n" ) 57 | 58 | }; 59 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/ColorCorrectionShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Color correction 5 | */ 6 | 7 | THREE.ColorCorrectionShader = { 8 | 9 | uniforms: { 10 | 11 | "tDiffuse": { value: null }, 12 | "powRGB": { value: new THREE.Vector3( 2, 2, 2 ) }, 13 | "mulRGB": { value: new THREE.Vector3( 1, 1, 1 ) }, 14 | "addRGB": { value: new THREE.Vector3( 0, 0, 0 ) } 15 | 16 | }, 17 | 18 | vertexShader: [ 19 | 20 | "varying vec2 vUv;", 21 | 22 | "void main() {", 23 | 24 | "vUv = uv;", 25 | 26 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 27 | 28 | "}" 29 | 30 | ].join( "\n" ), 31 | 32 | fragmentShader: [ 33 | 34 | "uniform sampler2D tDiffuse;", 35 | "uniform vec3 powRGB;", 36 | "uniform vec3 mulRGB;", 37 | "uniform vec3 addRGB;", 38 | 39 | "varying vec2 vUv;", 40 | 41 | "void main() {", 42 | 43 | "gl_FragColor = texture2D( tDiffuse, vUv );", 44 | "gl_FragColor.rgb = mulRGB * pow( ( gl_FragColor.rgb + addRGB ), powRGB );", 45 | 46 | "}" 47 | 48 | ].join( "\n" ) 49 | 50 | }; 51 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/ColorifyShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Colorify shader 5 | */ 6 | 7 | THREE.ColorifyShader = { 8 | 9 | uniforms: { 10 | 11 | "tDiffuse": { value: null }, 12 | "color": { value: new THREE.Color( 0xffffff ) } 13 | 14 | }, 15 | 16 | vertexShader: [ 17 | 18 | "varying vec2 vUv;", 19 | 20 | "void main() {", 21 | 22 | "vUv = uv;", 23 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 24 | 25 | "}" 26 | 27 | ].join( "\n" ), 28 | 29 | fragmentShader: [ 30 | 31 | "uniform vec3 color;", 32 | "uniform sampler2D tDiffuse;", 33 | 34 | "varying vec2 vUv;", 35 | 36 | "void main() {", 37 | 38 | "vec4 texel = texture2D( tDiffuse, vUv );", 39 | 40 | "vec3 luma = vec3( 0.299, 0.587, 0.114 );", 41 | "float v = dot( texel.xyz, luma );", 42 | 43 | "gl_FragColor = vec4( v * color, texel.w );", 44 | 45 | "}" 46 | 47 | ].join( "\n" ) 48 | 49 | }; 50 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/ConvolutionShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Convolution shader 5 | * ported from o3d sample to WebGL / GLSL 6 | * http://o3d.googlecode.com/svn/trunk/samples/convolution.html 7 | */ 8 | 9 | THREE.ConvolutionShader = { 10 | 11 | defines: { 12 | 13 | "KERNEL_SIZE_FLOAT": "25.0", 14 | "KERNEL_SIZE_INT": "25", 15 | 16 | }, 17 | 18 | uniforms: { 19 | 20 | "tDiffuse": { value: null }, 21 | "uImageIncrement": { value: new THREE.Vector2( 0.001953125, 0.0 ) }, 22 | "cKernel": { value: [] } 23 | 24 | }, 25 | 26 | vertexShader: [ 27 | 28 | "uniform vec2 uImageIncrement;", 29 | 30 | "varying vec2 vUv;", 31 | 32 | "void main() {", 33 | 34 | "vUv = uv - ( ( KERNEL_SIZE_FLOAT - 1.0 ) / 2.0 ) * uImageIncrement;", 35 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 36 | 37 | "}" 38 | 39 | ].join( "\n" ), 40 | 41 | fragmentShader: [ 42 | 43 | "uniform float cKernel[ KERNEL_SIZE_INT ];", 44 | 45 | "uniform sampler2D tDiffuse;", 46 | "uniform vec2 uImageIncrement;", 47 | 48 | "varying vec2 vUv;", 49 | 50 | "void main() {", 51 | 52 | "vec2 imageCoord = vUv;", 53 | "vec4 sum = vec4( 0.0, 0.0, 0.0, 0.0 );", 54 | 55 | "for( int i = 0; i < KERNEL_SIZE_INT; i ++ ) {", 56 | 57 | "sum += texture2D( tDiffuse, imageCoord ) * cKernel[ i ];", 58 | "imageCoord += uImageIncrement;", 59 | 60 | "}", 61 | 62 | "gl_FragColor = sum;", 63 | 64 | "}" 65 | 66 | 67 | ].join( "\n" ), 68 | 69 | buildKernel: function ( sigma ) { 70 | 71 | // We lop off the sqrt(2 * pi) * sigma term, since we're going to normalize anyway. 72 | 73 | function gauss( x, sigma ) { 74 | 75 | return Math.exp( - ( x * x ) / ( 2.0 * sigma * sigma ) ); 76 | 77 | } 78 | 79 | var i, values, sum, halfWidth, kMaxKernelSize = 25, kernelSize = 2 * Math.ceil( sigma * 3.0 ) + 1; 80 | 81 | if ( kernelSize > kMaxKernelSize ) kernelSize = kMaxKernelSize; 82 | halfWidth = ( kernelSize - 1 ) * 0.5; 83 | 84 | values = new Array( kernelSize ); 85 | sum = 0.0; 86 | for ( i = 0; i < kernelSize; ++ i ) { 87 | 88 | values[ i ] = gauss( i - halfWidth, sigma ); 89 | sum += values[ i ]; 90 | 91 | } 92 | 93 | // normalize the kernel 94 | 95 | for ( i = 0; i < kernelSize; ++ i ) values[ i ] /= sum; 96 | 97 | return values; 98 | 99 | } 100 | 101 | }; 102 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/CopyShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Full-screen textured quad shader 5 | */ 6 | 7 | THREE.CopyShader = { 8 | 9 | uniforms: { 10 | 11 | "tDiffuse": { value: null }, 12 | "opacity": { value: 1.0 } 13 | 14 | }, 15 | 16 | vertexShader: [ 17 | 18 | "varying vec2 vUv;", 19 | 20 | "void main() {", 21 | 22 | "vUv = uv;", 23 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 24 | 25 | "}" 26 | 27 | ].join( "\n" ), 28 | 29 | fragmentShader: [ 30 | 31 | "uniform float opacity;", 32 | 33 | "uniform sampler2D tDiffuse;", 34 | 35 | "varying vec2 vUv;", 36 | 37 | "void main() {", 38 | 39 | "vec4 texel = texture2D( tDiffuse, vUv );", 40 | "gl_FragColor = opacity * texel;", 41 | 42 | "}" 43 | 44 | ].join( "\n" ) 45 | 46 | }; 47 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/DOFMipMapShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Depth-of-field shader using mipmaps 5 | * - from Matt Handley @applmak 6 | * - requires power-of-2 sized render target with enabled mipmaps 7 | */ 8 | 9 | THREE.DOFMipMapShader = { 10 | 11 | uniforms: { 12 | 13 | "tColor": { value: null }, 14 | "tDepth": { value: null }, 15 | "focus": { value: 1.0 }, 16 | "maxblur": { value: 1.0 } 17 | 18 | }, 19 | 20 | vertexShader: [ 21 | 22 | "varying vec2 vUv;", 23 | 24 | "void main() {", 25 | 26 | "vUv = uv;", 27 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 28 | 29 | "}" 30 | 31 | ].join( "\n" ), 32 | 33 | fragmentShader: [ 34 | 35 | "uniform float focus;", 36 | "uniform float maxblur;", 37 | 38 | "uniform sampler2D tColor;", 39 | "uniform sampler2D tDepth;", 40 | 41 | "varying vec2 vUv;", 42 | 43 | "void main() {", 44 | 45 | "vec4 depth = texture2D( tDepth, vUv );", 46 | 47 | "float factor = depth.x - focus;", 48 | 49 | "vec4 col = texture2D( tColor, vUv, 2.0 * maxblur * abs( focus - depth.x ) );", 50 | 51 | "gl_FragColor = col;", 52 | "gl_FragColor.a = 1.0;", 53 | 54 | "}" 55 | 56 | ].join( "\n" ) 57 | 58 | }; 59 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/DotScreenShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Dot screen shader 5 | * based on glfx.js sepia shader 6 | * https://github.com/evanw/glfx.js 7 | */ 8 | 9 | THREE.DotScreenShader = { 10 | 11 | uniforms: { 12 | 13 | "tDiffuse": { value: null }, 14 | "tSize": { value: new THREE.Vector2( 256, 256 ) }, 15 | "center": { value: new THREE.Vector2( 0.5, 0.5 ) }, 16 | "angle": { value: 1.57 }, 17 | "scale": { value: 1.0 } 18 | 19 | }, 20 | 21 | vertexShader: [ 22 | 23 | "varying vec2 vUv;", 24 | 25 | "void main() {", 26 | 27 | "vUv = uv;", 28 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 29 | 30 | "}" 31 | 32 | ].join( "\n" ), 33 | 34 | fragmentShader: [ 35 | 36 | "uniform vec2 center;", 37 | "uniform float angle;", 38 | "uniform float scale;", 39 | "uniform vec2 tSize;", 40 | 41 | "uniform sampler2D tDiffuse;", 42 | 43 | "varying vec2 vUv;", 44 | 45 | "float pattern() {", 46 | 47 | "float s = sin( angle ), c = cos( angle );", 48 | 49 | "vec2 tex = vUv * tSize - center;", 50 | "vec2 point = vec2( c * tex.x - s * tex.y, s * tex.x + c * tex.y ) * scale;", 51 | 52 | "return ( sin( point.x ) * sin( point.y ) ) * 4.0;", 53 | 54 | "}", 55 | 56 | "void main() {", 57 | 58 | "vec4 color = texture2D( tDiffuse, vUv );", 59 | 60 | "float average = ( color.r + color.g + color.b ) / 3.0;", 61 | 62 | "gl_FragColor = vec4( vec3( average * 10.0 - 5.0 + pattern() ), color.a );", 63 | 64 | "}" 65 | 66 | ].join( "\n" ) 67 | 68 | }; 69 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/EdgeShader2.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author zz85 / https://github.com/zz85 | https://www.lab4games.net/zz85/blog 3 | * 4 | * Edge Detection Shader using Sobel filter 5 | * Based on http://rastergrid.com/blog/2011/01/frei-chen-edge-detector 6 | * 7 | * aspect: vec2 of (1/width, 1/height) 8 | */ 9 | 10 | THREE.EdgeShader2 = { 11 | 12 | uniforms: { 13 | 14 | "tDiffuse": { value: null }, 15 | "aspect": { value: new THREE.Vector2( 512, 512 ) }, 16 | }, 17 | 18 | vertexShader: [ 19 | 20 | "varying vec2 vUv;", 21 | 22 | "void main() {", 23 | 24 | "vUv = uv;", 25 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 26 | 27 | "}" 28 | 29 | ].join( "\n" ), 30 | 31 | fragmentShader: [ 32 | 33 | "uniform sampler2D tDiffuse;", 34 | "varying vec2 vUv;", 35 | "uniform vec2 aspect;", 36 | 37 | 38 | "vec2 texel = vec2(1.0 / aspect.x, 1.0 / aspect.y);", 39 | 40 | "mat3 G[2];", 41 | 42 | "const mat3 g0 = mat3( 1.0, 2.0, 1.0, 0.0, 0.0, 0.0, -1.0, -2.0, -1.0 );", 43 | "const mat3 g1 = mat3( 1.0, 0.0, -1.0, 2.0, 0.0, -2.0, 1.0, 0.0, -1.0 );", 44 | 45 | 46 | "void main(void)", 47 | "{", 48 | "mat3 I;", 49 | "float cnv[2];", 50 | "vec3 sample;", 51 | 52 | "G[0] = g0;", 53 | "G[1] = g1;", 54 | 55 | /* fetch the 3x3 neighbourhood and use the RGB vector's length as intensity value */ 56 | "for (float i=0.0; i<3.0; i++)", 57 | "for (float j=0.0; j<3.0; j++) {", 58 | "sample = texture2D( tDiffuse, vUv + texel * vec2(i-1.0,j-1.0) ).rgb;", 59 | "I[int(i)][int(j)] = length(sample);", 60 | "}", 61 | 62 | /* calculate the convolution values for all the masks */ 63 | "for (int i=0; i<2; i++) {", 64 | "float dp3 = dot(G[i][0], I[0]) + dot(G[i][1], I[1]) + dot(G[i][2], I[2]);", 65 | "cnv[i] = dp3 * dp3; ", 66 | "}", 67 | 68 | "gl_FragColor = vec4(0.5 * sqrt(cnv[0]*cnv[0]+cnv[1]*cnv[1]));", 69 | "} ", 70 | 71 | ].join( "\n" ) 72 | 73 | }; 74 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/FilmShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Film grain & scanlines shader 5 | * 6 | * - ported from HLSL to WebGL / GLSL 7 | * http://www.truevision3d.com/forums/showcase/staticnoise_colorblackwhite_scanline_shaders-t18698.0.html 8 | * 9 | * Screen Space Static Postprocessor 10 | * 11 | * Produces an analogue noise overlay similar to a film grain / TV static 12 | * 13 | * Original implementation and noise algorithm 14 | * Pat 'Hawthorne' Shearon 15 | * 16 | * Optimized scanlines + noise version with intensity scaling 17 | * Georg 'Leviathan' Steinrohder 18 | * 19 | * This version is provided under a Creative Commons Attribution 3.0 License 20 | * http://creativecommons.org/licenses/by/3.0/ 21 | */ 22 | 23 | THREE.FilmShader = { 24 | 25 | uniforms: { 26 | 27 | "tDiffuse": { value: null }, 28 | "time": { value: 0.0 }, 29 | "nIntensity": { value: 0.5 }, 30 | "sIntensity": { value: 0.05 }, 31 | "sCount": { value: 4096 }, 32 | "grayscale": { value: 1 } 33 | 34 | }, 35 | 36 | vertexShader: [ 37 | 38 | "varying vec2 vUv;", 39 | 40 | "void main() {", 41 | 42 | "vUv = uv;", 43 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 44 | 45 | "}" 46 | 47 | ].join( "\n" ), 48 | 49 | fragmentShader: [ 50 | 51 | "#include ", 52 | 53 | // control parameter 54 | "uniform float time;", 55 | 56 | "uniform bool grayscale;", 57 | 58 | // noise effect intensity value (0 = no effect, 1 = full effect) 59 | "uniform float nIntensity;", 60 | 61 | // scanlines effect intensity value (0 = no effect, 1 = full effect) 62 | "uniform float sIntensity;", 63 | 64 | // scanlines effect count value (0 = no effect, 4096 = full effect) 65 | "uniform float sCount;", 66 | 67 | "uniform sampler2D tDiffuse;", 68 | 69 | "varying vec2 vUv;", 70 | 71 | "void main() {", 72 | 73 | // sample the source 74 | "vec4 cTextureScreen = texture2D( tDiffuse, vUv );", 75 | 76 | // make some noise 77 | "float dx = rand( vUv + time );", 78 | 79 | // add noise 80 | "vec3 cResult = cTextureScreen.rgb + cTextureScreen.rgb * clamp( 0.1 + dx, 0.0, 1.0 );", 81 | 82 | // get us a sine and cosine 83 | "vec2 sc = vec2( sin( vUv.y * sCount ), cos( vUv.y * sCount ) );", 84 | 85 | // add scanlines 86 | "cResult += cTextureScreen.rgb * vec3( sc.x, sc.y, sc.x ) * sIntensity;", 87 | 88 | // interpolate between source and result by intensity 89 | "cResult = cTextureScreen.rgb + clamp( nIntensity, 0.0,1.0 ) * ( cResult - cTextureScreen.rgb );", 90 | 91 | // convert to grayscale if desired 92 | "if( grayscale ) {", 93 | 94 | "cResult = vec3( cResult.r * 0.3 + cResult.g * 0.59 + cResult.b * 0.11 );", 95 | 96 | "}", 97 | 98 | "gl_FragColor = vec4( cResult, cTextureScreen.a );", 99 | 100 | "}" 101 | 102 | ].join( "\n" ) 103 | 104 | }; 105 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/FocusShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Focus shader 5 | * based on PaintEffect postprocess from ro.me 6 | * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js 7 | */ 8 | 9 | THREE.FocusShader = { 10 | 11 | uniforms : { 12 | 13 | "tDiffuse": { value: null }, 14 | "screenWidth": { value: 1024 }, 15 | "screenHeight": { value: 1024 }, 16 | "sampleDistance": { value: 0.94 }, 17 | "waveFactor": { value: 0.00125 } 18 | 19 | }, 20 | 21 | vertexShader: [ 22 | 23 | "varying vec2 vUv;", 24 | 25 | "void main() {", 26 | 27 | "vUv = uv;", 28 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 29 | 30 | "}" 31 | 32 | ].join( "\n" ), 33 | 34 | fragmentShader: [ 35 | 36 | "uniform float screenWidth;", 37 | "uniform float screenHeight;", 38 | "uniform float sampleDistance;", 39 | "uniform float waveFactor;", 40 | 41 | "uniform sampler2D tDiffuse;", 42 | 43 | "varying vec2 vUv;", 44 | 45 | "void main() {", 46 | 47 | "vec4 color, org, tmp, add;", 48 | "float sample_dist, f;", 49 | "vec2 vin;", 50 | "vec2 uv = vUv;", 51 | 52 | "add = color = org = texture2D( tDiffuse, uv );", 53 | 54 | "vin = ( uv - vec2( 0.5 ) ) * vec2( 1.4 );", 55 | "sample_dist = dot( vin, vin ) * 2.0;", 56 | 57 | "f = ( waveFactor * 100.0 + sample_dist ) * sampleDistance * 4.0;", 58 | 59 | "vec2 sampleSize = vec2( 1.0 / screenWidth, 1.0 / screenHeight ) * vec2( f );", 60 | 61 | "add += tmp = texture2D( tDiffuse, uv + vec2( 0.111964, 0.993712 ) * sampleSize );", 62 | "if( tmp.b < color.b ) color = tmp;", 63 | 64 | "add += tmp = texture2D( tDiffuse, uv + vec2( 0.846724, 0.532032 ) * sampleSize );", 65 | "if( tmp.b < color.b ) color = tmp;", 66 | 67 | "add += tmp = texture2D( tDiffuse, uv + vec2( 0.943883, -0.330279 ) * sampleSize );", 68 | "if( tmp.b < color.b ) color = tmp;", 69 | 70 | "add += tmp = texture2D( tDiffuse, uv + vec2( 0.330279, -0.943883 ) * sampleSize );", 71 | "if( tmp.b < color.b ) color = tmp;", 72 | 73 | "add += tmp = texture2D( tDiffuse, uv + vec2( -0.532032, -0.846724 ) * sampleSize );", 74 | "if( tmp.b < color.b ) color = tmp;", 75 | 76 | "add += tmp = texture2D( tDiffuse, uv + vec2( -0.993712, -0.111964 ) * sampleSize );", 77 | "if( tmp.b < color.b ) color = tmp;", 78 | 79 | "add += tmp = texture2D( tDiffuse, uv + vec2( -0.707107, 0.707107 ) * sampleSize );", 80 | "if( tmp.b < color.b ) color = tmp;", 81 | 82 | "color = color * vec4( 2.0 ) - ( add / vec4( 8.0 ) );", 83 | "color = color + ( add / vec4( 8.0 ) - color ) * ( vec4( 1.0 ) - vec4( sample_dist * 0.5 ) );", 84 | 85 | "gl_FragColor = vec4( color.rgb * color.rgb * vec3( 0.95 ) + color.rgb, 1.0 );", 86 | 87 | "}" 88 | 89 | 90 | ].join( "\n" ) 91 | }; 92 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/FresnelShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Based on Nvidia Cg tutorial 5 | */ 6 | 7 | THREE.FresnelShader = { 8 | 9 | uniforms: { 10 | 11 | "mRefractionRatio": { value: 1.02 }, 12 | "mFresnelBias": { value: 0.1 }, 13 | "mFresnelPower": { value: 2.0 }, 14 | "mFresnelScale": { value: 1.0 }, 15 | "tCube": { value: null } 16 | 17 | }, 18 | 19 | vertexShader: [ 20 | 21 | "uniform float mRefractionRatio;", 22 | "uniform float mFresnelBias;", 23 | "uniform float mFresnelScale;", 24 | "uniform float mFresnelPower;", 25 | 26 | "varying vec3 vReflect;", 27 | "varying vec3 vRefract[3];", 28 | "varying float vReflectionFactor;", 29 | 30 | "void main() {", 31 | 32 | "vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );", 33 | "vec4 worldPosition = modelMatrix * vec4( position, 1.0 );", 34 | 35 | "vec3 worldNormal = normalize( mat3( modelMatrix[0].xyz, modelMatrix[1].xyz, modelMatrix[2].xyz ) * normal );", 36 | 37 | "vec3 I = worldPosition.xyz - cameraPosition;", 38 | 39 | "vReflect = reflect( I, worldNormal );", 40 | "vRefract[0] = refract( normalize( I ), worldNormal, mRefractionRatio );", 41 | "vRefract[1] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.99 );", 42 | "vRefract[2] = refract( normalize( I ), worldNormal, mRefractionRatio * 0.98 );", 43 | "vReflectionFactor = mFresnelBias + mFresnelScale * pow( 1.0 + dot( normalize( I ), worldNormal ), mFresnelPower );", 44 | 45 | "gl_Position = projectionMatrix * mvPosition;", 46 | 47 | "}" 48 | 49 | ].join( "\n" ), 50 | 51 | fragmentShader: [ 52 | 53 | "uniform samplerCube tCube;", 54 | 55 | "varying vec3 vReflect;", 56 | "varying vec3 vRefract[3];", 57 | "varying float vReflectionFactor;", 58 | 59 | "void main() {", 60 | 61 | "vec4 reflectedColor = textureCube( tCube, vec3( -vReflect.x, vReflect.yz ) );", 62 | "vec4 refractedColor = vec4( 1.0 );", 63 | 64 | "refractedColor.r = textureCube( tCube, vec3( -vRefract[0].x, vRefract[0].yz ) ).r;", 65 | "refractedColor.g = textureCube( tCube, vec3( -vRefract[1].x, vRefract[1].yz ) ).g;", 66 | "refractedColor.b = textureCube( tCube, vec3( -vRefract[2].x, vRefract[2].yz ) ).b;", 67 | 68 | "gl_FragColor = mix( refractedColor, reflectedColor, clamp( vReflectionFactor, 0.0, 1.0 ) );", 69 | 70 | "}" 71 | 72 | ].join( "\n" ) 73 | 74 | }; 75 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/GammaCorrectionShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author WestLangley / http://github.com/WestLangley 3 | * 4 | * Gamma Correction Shader 5 | * http://en.wikipedia.org/wiki/gamma_correction 6 | */ 7 | 8 | THREE.GammaCorrectionShader = { 9 | 10 | uniforms: { 11 | 12 | "tDiffuse": { value: null }, 13 | 14 | }, 15 | 16 | vertexShader: [ 17 | 18 | "varying vec2 vUv;", 19 | 20 | "void main() {", 21 | 22 | "vUv = uv;", 23 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 24 | 25 | "}" 26 | 27 | ].join( "\n" ), 28 | 29 | fragmentShader: [ 30 | 31 | "uniform sampler2D tDiffuse;", 32 | 33 | "varying vec2 vUv;", 34 | 35 | "void main() {", 36 | 37 | "vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );", 38 | 39 | "gl_FragColor = LinearToGamma( tex, float( GAMMA_FACTOR ) );", 40 | 41 | "}" 42 | 43 | ].join( "\n" ) 44 | 45 | }; 46 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/HorizontalBlurShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author zz85 / http://www.lab4games.net/zz85/blog 3 | * 4 | * Two pass Gaussian blur filter (horizontal and vertical blur shaders) 5 | * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/ 6 | * and used in http://www.cake23.de/traveling-wavefronts-lit-up.html 7 | * 8 | * - 9 samples per pass 9 | * - standard deviation 2.7 10 | * - "h" and "v" parameters should be set to "1 / width" and "1 / height" 11 | */ 12 | 13 | THREE.HorizontalBlurShader = { 14 | 15 | uniforms: { 16 | 17 | "tDiffuse": { value: null }, 18 | "h": { value: 1.0 / 512.0 } 19 | 20 | }, 21 | 22 | vertexShader: [ 23 | 24 | "varying vec2 vUv;", 25 | 26 | "void main() {", 27 | 28 | "vUv = uv;", 29 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 30 | 31 | "}" 32 | 33 | ].join( "\n" ), 34 | 35 | fragmentShader: [ 36 | 37 | "uniform sampler2D tDiffuse;", 38 | "uniform float h;", 39 | 40 | "varying vec2 vUv;", 41 | 42 | "void main() {", 43 | 44 | "vec4 sum = vec4( 0.0 );", 45 | 46 | "sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * h, vUv.y ) ) * 0.051;", 47 | "sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * h, vUv.y ) ) * 0.0918;", 48 | "sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * h, vUv.y ) ) * 0.12245;", 49 | "sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * h, vUv.y ) ) * 0.1531;", 50 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;", 51 | "sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * h, vUv.y ) ) * 0.1531;", 52 | "sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * h, vUv.y ) ) * 0.12245;", 53 | "sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * h, vUv.y ) ) * 0.0918;", 54 | "sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * h, vUv.y ) ) * 0.051;", 55 | 56 | "gl_FragColor = sum;", 57 | 58 | "}" 59 | 60 | ].join( "\n" ) 61 | 62 | }; 63 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/HorizontalTiltShiftShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position 5 | * 6 | * - 9 samples per pass 7 | * - standard deviation 2.7 8 | * - "h" and "v" parameters should be set to "1 / width" and "1 / height" 9 | * - "r" parameter control where "focused" horizontal line lies 10 | */ 11 | 12 | THREE.HorizontalTiltShiftShader = { 13 | 14 | uniforms: { 15 | 16 | "tDiffuse": { value: null }, 17 | "h": { value: 1.0 / 512.0 }, 18 | "r": { value: 0.35 } 19 | 20 | }, 21 | 22 | vertexShader: [ 23 | 24 | "varying vec2 vUv;", 25 | 26 | "void main() {", 27 | 28 | "vUv = uv;", 29 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 30 | 31 | "}" 32 | 33 | ].join( "\n" ), 34 | 35 | fragmentShader: [ 36 | 37 | "uniform sampler2D tDiffuse;", 38 | "uniform float h;", 39 | "uniform float r;", 40 | 41 | "varying vec2 vUv;", 42 | 43 | "void main() {", 44 | 45 | "vec4 sum = vec4( 0.0 );", 46 | 47 | "float hh = h * abs( r - vUv.y );", 48 | 49 | "sum += texture2D( tDiffuse, vec2( vUv.x - 4.0 * hh, vUv.y ) ) * 0.051;", 50 | "sum += texture2D( tDiffuse, vec2( vUv.x - 3.0 * hh, vUv.y ) ) * 0.0918;", 51 | "sum += texture2D( tDiffuse, vec2( vUv.x - 2.0 * hh, vUv.y ) ) * 0.12245;", 52 | "sum += texture2D( tDiffuse, vec2( vUv.x - 1.0 * hh, vUv.y ) ) * 0.1531;", 53 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;", 54 | "sum += texture2D( tDiffuse, vec2( vUv.x + 1.0 * hh, vUv.y ) ) * 0.1531;", 55 | "sum += texture2D( tDiffuse, vec2( vUv.x + 2.0 * hh, vUv.y ) ) * 0.12245;", 56 | "sum += texture2D( tDiffuse, vec2( vUv.x + 3.0 * hh, vUv.y ) ) * 0.0918;", 57 | "sum += texture2D( tDiffuse, vec2( vUv.x + 4.0 * hh, vUv.y ) ) * 0.051;", 58 | 59 | "gl_FragColor = sum;", 60 | 61 | "}" 62 | 63 | ].join( "\n" ) 64 | 65 | }; 66 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/HueSaturationShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author tapio / http://tapio.github.com/ 3 | * 4 | * Hue and saturation adjustment 5 | * https://github.com/evanw/glfx.js 6 | * hue: -1 to 1 (-1 is 180 degrees in the negative direction, 0 is no change, etc. 7 | * saturation: -1 to 1 (-1 is solid gray, 0 is no change, and 1 is maximum contrast) 8 | */ 9 | 10 | THREE.HueSaturationShader = { 11 | 12 | uniforms: { 13 | 14 | "tDiffuse": { value: null }, 15 | "hue": { value: 0 }, 16 | "saturation": { value: 0 } 17 | 18 | }, 19 | 20 | vertexShader: [ 21 | 22 | "varying vec2 vUv;", 23 | 24 | "void main() {", 25 | 26 | "vUv = uv;", 27 | 28 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 29 | 30 | "}" 31 | 32 | ].join( "\n" ), 33 | 34 | fragmentShader: [ 35 | 36 | "uniform sampler2D tDiffuse;", 37 | "uniform float hue;", 38 | "uniform float saturation;", 39 | 40 | "varying vec2 vUv;", 41 | 42 | "void main() {", 43 | 44 | "gl_FragColor = texture2D( tDiffuse, vUv );", 45 | 46 | // hue 47 | "float angle = hue * 3.14159265;", 48 | "float s = sin(angle), c = cos(angle);", 49 | "vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;", 50 | "float len = length(gl_FragColor.rgb);", 51 | "gl_FragColor.rgb = vec3(", 52 | "dot(gl_FragColor.rgb, weights.xyz),", 53 | "dot(gl_FragColor.rgb, weights.zxy),", 54 | "dot(gl_FragColor.rgb, weights.yzx)", 55 | ");", 56 | 57 | // saturation 58 | "float average = (gl_FragColor.r + gl_FragColor.g + gl_FragColor.b) / 3.0;", 59 | "if (saturation > 0.0) {", 60 | "gl_FragColor.rgb += (average - gl_FragColor.rgb) * (1.0 - 1.0 / (1.001 - saturation));", 61 | "} else {", 62 | "gl_FragColor.rgb += (average - gl_FragColor.rgb) * (-saturation);", 63 | "}", 64 | 65 | "}" 66 | 67 | ].join( "\n" ) 68 | 69 | }; 70 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/KaleidoShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author felixturner / http://airtight.cc/ 3 | * 4 | * Kaleidoscope Shader 5 | * Radial reflection around center point 6 | * Ported from: http://pixelshaders.com/editor/ 7 | * by Toby Schachman / http://tobyschachman.com/ 8 | * 9 | * sides: number of reflections 10 | * angle: initial angle in radians 11 | */ 12 | 13 | THREE.KaleidoShader = { 14 | 15 | uniforms: { 16 | 17 | "tDiffuse": { value: null }, 18 | "sides": { value: 6.0 }, 19 | "angle": { value: 0.0 } 20 | 21 | }, 22 | 23 | vertexShader: [ 24 | 25 | "varying vec2 vUv;", 26 | 27 | "void main() {", 28 | 29 | "vUv = uv;", 30 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 31 | 32 | "}" 33 | 34 | ].join( "\n" ), 35 | 36 | fragmentShader: [ 37 | 38 | "uniform sampler2D tDiffuse;", 39 | "uniform float sides;", 40 | "uniform float angle;", 41 | 42 | "varying vec2 vUv;", 43 | 44 | "void main() {", 45 | 46 | "vec2 p = vUv - 0.5;", 47 | "float r = length(p);", 48 | "float a = atan(p.y, p.x) + angle;", 49 | "float tau = 2. * 3.1416 ;", 50 | "a = mod(a, tau/sides);", 51 | "a = abs(a - tau/sides/2.) ;", 52 | "p = r * vec2(cos(a), sin(a));", 53 | "vec4 color = texture2D(tDiffuse, p + 0.5);", 54 | "gl_FragColor = color;", 55 | 56 | "}" 57 | 58 | ].join( "\n" ) 59 | 60 | }; 61 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/LuminosityShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Luminosity 5 | * http://en.wikipedia.org/wiki/Luminosity 6 | */ 7 | 8 | THREE.LuminosityShader = { 9 | 10 | uniforms: { 11 | 12 | "tDiffuse": { value: null } 13 | 14 | }, 15 | 16 | vertexShader: [ 17 | 18 | "varying vec2 vUv;", 19 | 20 | "void main() {", 21 | 22 | "vUv = uv;", 23 | 24 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 25 | 26 | "}" 27 | 28 | ].join( "\n" ), 29 | 30 | fragmentShader: [ 31 | 32 | "uniform sampler2D tDiffuse;", 33 | 34 | "varying vec2 vUv;", 35 | 36 | "void main() {", 37 | 38 | "vec4 texel = texture2D( tDiffuse, vUv );", 39 | 40 | "vec3 luma = vec3( 0.299, 0.587, 0.114 );", 41 | 42 | "float v = dot( texel.xyz, luma );", 43 | 44 | "gl_FragColor = vec4( v, v, v, texel.w );", 45 | 46 | "}" 47 | 48 | ].join( "\n" ) 49 | 50 | }; 51 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/MirrorShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author felixturner / http://airtight.cc/ 3 | * 4 | * Mirror Shader 5 | * Copies half the input to the other half 6 | * 7 | * side: side of input to mirror (0 = left, 1 = right, 2 = top, 3 = bottom) 8 | */ 9 | 10 | THREE.MirrorShader = { 11 | 12 | uniforms: { 13 | 14 | "tDiffuse": { value: null }, 15 | "side": { value: 1 } 16 | 17 | }, 18 | 19 | vertexShader: [ 20 | 21 | "varying vec2 vUv;", 22 | 23 | "void main() {", 24 | 25 | "vUv = uv;", 26 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 27 | 28 | "}" 29 | 30 | ].join( "\n" ), 31 | 32 | fragmentShader: [ 33 | 34 | "uniform sampler2D tDiffuse;", 35 | "uniform int side;", 36 | 37 | "varying vec2 vUv;", 38 | 39 | "void main() {", 40 | 41 | "vec2 p = vUv;", 42 | "if (side == 0){", 43 | "if (p.x > 0.5) p.x = 1.0 - p.x;", 44 | "}else if (side == 1){", 45 | "if (p.x < 0.5) p.x = 1.0 - p.x;", 46 | "}else if (side == 2){", 47 | "if (p.y < 0.5) p.y = 1.0 - p.y;", 48 | "}else if (side == 3){", 49 | "if (p.y > 0.5) p.y = 1.0 - p.y;", 50 | "} ", 51 | "vec4 color = texture2D(tDiffuse, p);", 52 | "gl_FragColor = color;", 53 | 54 | "}" 55 | 56 | ].join( "\n" ) 57 | 58 | }; 59 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/NormalMapShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Normal map shader 5 | * - compute normals from heightmap 6 | */ 7 | 8 | THREE.NormalMapShader = { 9 | 10 | uniforms: { 11 | 12 | "heightMap": { value: null }, 13 | "resolution": { value: new THREE.Vector2( 512, 512 ) }, 14 | "scale": { value: new THREE.Vector2( 1, 1 ) }, 15 | "height": { value: 0.05 } 16 | 17 | }, 18 | 19 | vertexShader: [ 20 | 21 | "varying vec2 vUv;", 22 | 23 | "void main() {", 24 | 25 | "vUv = uv;", 26 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 27 | 28 | "}" 29 | 30 | ].join( "\n" ), 31 | 32 | fragmentShader: [ 33 | 34 | "uniform float height;", 35 | "uniform vec2 resolution;", 36 | "uniform sampler2D heightMap;", 37 | 38 | "varying vec2 vUv;", 39 | 40 | "void main() {", 41 | 42 | "float val = texture2D( heightMap, vUv ).x;", 43 | 44 | "float valU = texture2D( heightMap, vUv + vec2( 1.0 / resolution.x, 0.0 ) ).x;", 45 | "float valV = texture2D( heightMap, vUv + vec2( 0.0, 1.0 / resolution.y ) ).x;", 46 | 47 | "gl_FragColor = vec4( ( 0.5 * normalize( vec3( val - valU, val - valV, height ) ) + 0.5 ), 1.0 );", 48 | 49 | "}" 50 | 51 | ].join( "\n" ) 52 | 53 | }; 54 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/RGBShiftShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author felixturner / http://airtight.cc/ 3 | * 4 | * RGB Shift Shader 5 | * Shifts red and blue channels from center in opposite directions 6 | * Ported from http://kriss.cx/tom/2009/05/rgb-shift/ 7 | * by Tom Butterworth / http://kriss.cx/tom/ 8 | * 9 | * amount: shift distance (1 is width of input) 10 | * angle: shift angle in radians 11 | */ 12 | 13 | THREE.RGBShiftShader = { 14 | 15 | uniforms: { 16 | 17 | "tDiffuse": { value: null }, 18 | "amount": { value: 0.005 }, 19 | "angle": { value: 0.0 } 20 | 21 | }, 22 | 23 | vertexShader: [ 24 | 25 | "varying vec2 vUv;", 26 | 27 | "void main() {", 28 | 29 | "vUv = uv;", 30 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 31 | 32 | "}" 33 | 34 | ].join( "\n" ), 35 | 36 | fragmentShader: [ 37 | 38 | "uniform sampler2D tDiffuse;", 39 | "uniform float amount;", 40 | "uniform float angle;", 41 | 42 | "varying vec2 vUv;", 43 | 44 | "void main() {", 45 | 46 | "vec2 offset = amount * vec2( cos(angle), sin(angle));", 47 | "vec4 cr = texture2D(tDiffuse, vUv + offset);", 48 | "vec4 cga = texture2D(tDiffuse, vUv);", 49 | "vec4 cb = texture2D(tDiffuse, vUv - offset);", 50 | "gl_FragColor = vec4(cr.r, cga.g, cb.b, cga.a);", 51 | 52 | "}" 53 | 54 | ].join( "\n" ) 55 | 56 | }; 57 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/SepiaShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Sepia tone shader 5 | * based on glfx.js sepia shader 6 | * https://github.com/evanw/glfx.js 7 | */ 8 | 9 | THREE.SepiaShader = { 10 | 11 | uniforms: { 12 | 13 | "tDiffuse": { value: null }, 14 | "amount": { value: 1.0 } 15 | 16 | }, 17 | 18 | vertexShader: [ 19 | 20 | "varying vec2 vUv;", 21 | 22 | "void main() {", 23 | 24 | "vUv = uv;", 25 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 26 | 27 | "}" 28 | 29 | ].join( "\n" ), 30 | 31 | fragmentShader: [ 32 | 33 | "uniform float amount;", 34 | 35 | "uniform sampler2D tDiffuse;", 36 | 37 | "varying vec2 vUv;", 38 | 39 | "void main() {", 40 | 41 | "vec4 color = texture2D( tDiffuse, vUv );", 42 | "vec3 c = color.rgb;", 43 | 44 | "color.r = dot( c, vec3( 1.0 - 0.607 * amount, 0.769 * amount, 0.189 * amount ) );", 45 | "color.g = dot( c, vec3( 0.349 * amount, 1.0 - 0.314 * amount, 0.168 * amount ) );", 46 | "color.b = dot( c, vec3( 0.272 * amount, 0.534 * amount, 1.0 - 0.869 * amount ) );", 47 | 48 | "gl_FragColor = vec4( min( vec3( 1.0 ), color.rgb ), color.a );", 49 | 50 | "}" 51 | 52 | ].join( "\n" ) 53 | 54 | }; 55 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/TechnicolorShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author flimshaw / http://charliehoey.com 3 | * 4 | * Technicolor Shader 5 | * Simulates the look of the two-strip technicolor process popular in early 20th century films. 6 | * More historical info here: http://www.widescreenmuseum.com/oldcolor/technicolor1.htm 7 | * Demo here: http://charliehoey.com/technicolor_shader/shader_test.html 8 | */ 9 | 10 | THREE.TechnicolorShader = { 11 | 12 | uniforms: { 13 | 14 | "tDiffuse": { value: null }, 15 | 16 | }, 17 | 18 | vertexShader: [ 19 | 20 | "varying vec2 vUv;", 21 | 22 | "void main() {", 23 | 24 | "vUv = uv;", 25 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 26 | 27 | "}" 28 | 29 | ].join( "\n" ), 30 | 31 | fragmentShader: [ 32 | 33 | "uniform sampler2D tDiffuse;", 34 | "varying vec2 vUv;", 35 | 36 | "void main() {", 37 | 38 | "vec4 tex = texture2D( tDiffuse, vec2( vUv.x, vUv.y ) );", 39 | "vec4 newTex = vec4(tex.r, (tex.g + tex.b) * .5, (tex.g + tex.b) * .5, 1.0);", 40 | 41 | "gl_FragColor = newTex;", 42 | 43 | "}" 44 | 45 | ].join( "\n" ) 46 | 47 | }; 48 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/ToneMapShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author miibond 3 | * 4 | * Full-screen tone-mapping shader based on http://www.graphics.cornell.edu/~jaf/publications/sig02_paper.pdf 5 | */ 6 | 7 | THREE.ToneMapShader = { 8 | 9 | uniforms: { 10 | 11 | "tDiffuse": { value: null }, 12 | "averageLuminance": { value: 1.0 }, 13 | "luminanceMap": { value: null }, 14 | "maxLuminance": { value: 16.0 }, 15 | "middleGrey": { value: 0.6 } 16 | }, 17 | 18 | vertexShader: [ 19 | 20 | "varying vec2 vUv;", 21 | 22 | "void main() {", 23 | 24 | "vUv = uv;", 25 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 26 | 27 | "}" 28 | 29 | ].join( "\n" ), 30 | 31 | fragmentShader: [ 32 | 33 | "uniform sampler2D tDiffuse;", 34 | 35 | "varying vec2 vUv;", 36 | 37 | "uniform float middleGrey;", 38 | "uniform float maxLuminance;", 39 | "#ifdef ADAPTED_LUMINANCE", 40 | "uniform sampler2D luminanceMap;", 41 | "#else", 42 | "uniform float averageLuminance;", 43 | "#endif", 44 | 45 | "const vec3 LUM_CONVERT = vec3(0.299, 0.587, 0.114);", 46 | 47 | "vec3 ToneMap( vec3 vColor ) {", 48 | "#ifdef ADAPTED_LUMINANCE", 49 | // Get the calculated average luminance 50 | "float fLumAvg = texture2D(luminanceMap, vec2(0.5, 0.5)).r;", 51 | "#else", 52 | "float fLumAvg = averageLuminance;", 53 | "#endif", 54 | 55 | // Calculate the luminance of the current pixel 56 | "float fLumPixel = dot(vColor, LUM_CONVERT);", 57 | 58 | // Apply the modified operator (Eq. 4) 59 | "float fLumScaled = (fLumPixel * middleGrey) / fLumAvg;", 60 | 61 | "float fLumCompressed = (fLumScaled * (1.0 + (fLumScaled / (maxLuminance * maxLuminance)))) / (1.0 + fLumScaled);", 62 | "return fLumCompressed * vColor;", 63 | "}", 64 | 65 | "void main() {", 66 | 67 | "vec4 texel = texture2D( tDiffuse, vUv );", 68 | 69 | "gl_FragColor = vec4( ToneMap( texel.xyz ), texel.w );", 70 | 71 | "}" 72 | 73 | ].join( "\n" ) 74 | 75 | }; 76 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/TriangleBlurShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author zz85 / http://www.lab4games.net/zz85/blog 3 | * 4 | * Triangle blur shader 5 | * based on glfx.js triangle blur shader 6 | * https://github.com/evanw/glfx.js 7 | * 8 | * A basic blur filter, which convolves the image with a 9 | * pyramid filter. The pyramid filter is separable and is applied as two 10 | * perpendicular triangle filters. 11 | */ 12 | 13 | THREE.TriangleBlurShader = { 14 | 15 | uniforms : { 16 | 17 | "texture": { value: null }, 18 | "delta": { value: new THREE.Vector2( 1, 1 ) } 19 | 20 | }, 21 | 22 | vertexShader: [ 23 | 24 | "varying vec2 vUv;", 25 | 26 | "void main() {", 27 | 28 | "vUv = uv;", 29 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 30 | 31 | "}" 32 | 33 | ].join( "\n" ), 34 | 35 | fragmentShader: [ 36 | 37 | "#include ", 38 | 39 | "#define ITERATIONS 10.0", 40 | 41 | "uniform sampler2D texture;", 42 | "uniform vec2 delta;", 43 | 44 | "varying vec2 vUv;", 45 | 46 | "void main() {", 47 | 48 | "vec4 color = vec4( 0.0 );", 49 | 50 | "float total = 0.0;", 51 | 52 | // randomize the lookup values to hide the fixed number of samples 53 | 54 | "float offset = rand( vUv );", 55 | 56 | "for ( float t = -ITERATIONS; t <= ITERATIONS; t ++ ) {", 57 | 58 | "float percent = ( t + offset - 0.5 ) / ITERATIONS;", 59 | "float weight = 1.0 - abs( percent );", 60 | 61 | "color += texture2D( texture, vUv + delta * percent ) * weight;", 62 | "total += weight;", 63 | 64 | "}", 65 | 66 | "gl_FragColor = color / total;", 67 | 68 | "}" 69 | 70 | ].join( "\n" ) 71 | 72 | }; 73 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/UnpackDepthRGBAShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Unpack RGBA depth shader 5 | * - show RGBA encoded depth as monochrome color 6 | */ 7 | 8 | THREE.UnpackDepthRGBAShader = { 9 | 10 | uniforms: { 11 | 12 | "tDiffuse": { value: null }, 13 | "opacity": { value: 1.0 } 14 | 15 | }, 16 | 17 | vertexShader: [ 18 | 19 | "varying vec2 vUv;", 20 | 21 | "void main() {", 22 | 23 | "vUv = uv;", 24 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 25 | 26 | "}" 27 | 28 | ].join( "\n" ), 29 | 30 | fragmentShader: [ 31 | 32 | "uniform float opacity;", 33 | 34 | "uniform sampler2D tDiffuse;", 35 | 36 | "varying vec2 vUv;", 37 | 38 | "#include ", 39 | 40 | "void main() {", 41 | 42 | "float depth = 1.0 - unpackRGBAToDepth( texture2D( tDiffuse, vUv ) );", 43 | "gl_FragColor = opacity * vec4( vec3( depth ), 1.0 );", 44 | 45 | "}" 46 | 47 | ].join( "\n" ) 48 | 49 | }; 50 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/VerticalBlurShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author zz85 / http://www.lab4games.net/zz85/blog 3 | * 4 | * Two pass Gaussian blur filter (horizontal and vertical blur shaders) 5 | * - described in http://www.gamerendering.com/2008/10/11/gaussian-blur-filter-shader/ 6 | * and used in http://www.cake23.de/traveling-wavefronts-lit-up.html 7 | * 8 | * - 9 samples per pass 9 | * - standard deviation 2.7 10 | * - "h" and "v" parameters should be set to "1 / width" and "1 / height" 11 | */ 12 | 13 | THREE.VerticalBlurShader = { 14 | 15 | uniforms: { 16 | 17 | "tDiffuse": { value: null }, 18 | "v": { value: 1.0 / 512.0 } 19 | 20 | }, 21 | 22 | vertexShader: [ 23 | 24 | "varying vec2 vUv;", 25 | 26 | "void main() {", 27 | 28 | "vUv = uv;", 29 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 30 | 31 | "}" 32 | 33 | ].join( "\n" ), 34 | 35 | fragmentShader: [ 36 | 37 | "uniform sampler2D tDiffuse;", 38 | "uniform float v;", 39 | 40 | "varying vec2 vUv;", 41 | 42 | "void main() {", 43 | 44 | "vec4 sum = vec4( 0.0 );", 45 | 46 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * v ) ) * 0.051;", 47 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * v ) ) * 0.0918;", 48 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * v ) ) * 0.12245;", 49 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * v ) ) * 0.1531;", 50 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;", 51 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * v ) ) * 0.1531;", 52 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * v ) ) * 0.12245;", 53 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * v ) ) * 0.0918;", 54 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * v ) ) * 0.051;", 55 | 56 | "gl_FragColor = sum;", 57 | 58 | "}" 59 | 60 | ].join( "\n" ) 61 | 62 | }; 63 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/VerticalTiltShiftShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Simple fake tilt-shift effect, modulating two pass Gaussian blur (see above) by vertical position 5 | * 6 | * - 9 samples per pass 7 | * - standard deviation 2.7 8 | * - "h" and "v" parameters should be set to "1 / width" and "1 / height" 9 | * - "r" parameter control where "focused" horizontal line lies 10 | */ 11 | 12 | THREE.VerticalTiltShiftShader = { 13 | 14 | uniforms: { 15 | 16 | "tDiffuse": { value: null }, 17 | "v": { value: 1.0 / 512.0 }, 18 | "r": { value: 0.35 } 19 | 20 | }, 21 | 22 | vertexShader: [ 23 | 24 | "varying vec2 vUv;", 25 | 26 | "void main() {", 27 | 28 | "vUv = uv;", 29 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 30 | 31 | "}" 32 | 33 | ].join( "\n" ), 34 | 35 | fragmentShader: [ 36 | 37 | "uniform sampler2D tDiffuse;", 38 | "uniform float v;", 39 | "uniform float r;", 40 | 41 | "varying vec2 vUv;", 42 | 43 | "void main() {", 44 | 45 | "vec4 sum = vec4( 0.0 );", 46 | 47 | "float vv = v * abs( r - vUv.y );", 48 | 49 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 4.0 * vv ) ) * 0.051;", 50 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 3.0 * vv ) ) * 0.0918;", 51 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 2.0 * vv ) ) * 0.12245;", 52 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y - 1.0 * vv ) ) * 0.1531;", 53 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y ) ) * 0.1633;", 54 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 1.0 * vv ) ) * 0.1531;", 55 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 2.0 * vv ) ) * 0.12245;", 56 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 3.0 * vv ) ) * 0.0918;", 57 | "sum += texture2D( tDiffuse, vec2( vUv.x, vUv.y + 4.0 * vv ) ) * 0.051;", 58 | 59 | "gl_FragColor = sum;", 60 | 61 | "}" 62 | 63 | ].join( "\n" ) 64 | 65 | }; 66 | -------------------------------------------------------------------------------- /web/secondtemple/js/shaders/VignetteShader.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @author alteredq / http://alteredqualia.com/ 3 | * 4 | * Vignette shader 5 | * based on PaintEffect postprocess from ro.me 6 | * http://code.google.com/p/3-dreams-of-black/source/browse/deploy/js/effects/PaintEffect.js 7 | */ 8 | 9 | THREE.VignetteShader = { 10 | 11 | uniforms: { 12 | 13 | "tDiffuse": { value: null }, 14 | "offset": { value: 1.0 }, 15 | "darkness": { value: 1.0 } 16 | 17 | }, 18 | 19 | vertexShader: [ 20 | 21 | "varying vec2 vUv;", 22 | 23 | "void main() {", 24 | 25 | "vUv = uv;", 26 | "gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );", 27 | 28 | "}" 29 | 30 | ].join( "\n" ), 31 | 32 | fragmentShader: [ 33 | 34 | "uniform float offset;", 35 | "uniform float darkness;", 36 | 37 | "uniform sampler2D tDiffuse;", 38 | 39 | "varying vec2 vUv;", 40 | 41 | "void main() {", 42 | 43 | // Eskil's vignette 44 | 45 | "vec4 texel = texture2D( tDiffuse, vUv );", 46 | "vec2 uv = ( vUv - vec2( 0.5 ) ) * vec2( offset );", 47 | "gl_FragColor = vec4( mix( texel.rgb, vec3( 1.0 - darkness ), dot( uv, uv ) ), texel.a );", 48 | 49 | /* 50 | // alternative version from glfx.js 51 | // this one makes more "dusty" look (as opposed to "burned") 52 | 53 | "vec4 color = texture2D( tDiffuse, vUv );", 54 | "float dist = distance( vUv, vec2( 0.5 ) );", 55 | "color.rgb *= smoothstep( 0.8, offset * 0.799, dist *( darkness + offset ) );", 56 | "gl_FragColor = color;", 57 | */ 58 | 59 | "}" 60 | 61 | ].join( "\n" ) 62 | 63 | }; 64 | -------------------------------------------------------------------------------- /web/secondtemple/js/utils/UVsDebug.js: -------------------------------------------------------------------------------- 1 | /* 2 | * @author zz85 / http://github.com/zz85 3 | * @author WestLangley / http://github.com/WestLangley 4 | * 5 | * tool for "unwrapping" and debugging three.js 6 | * geometries UV mapping 7 | * 8 | * Sample usage: 9 | * document.body.appendChild( THREE.UVsDebug( new THREE.SphereGeometry( 10, 10, 10, 10 ) ); 10 | * 11 | */ 12 | 13 | THREE.UVsDebug = function( geometry, size ) { 14 | 15 | // handles wrapping of uv.x > 1 only 16 | 17 | var abc = 'abc'; 18 | 19 | var uv, u, ax, ay; 20 | var i, il, j, jl; 21 | var vnum; 22 | 23 | var a = new THREE.Vector2(); 24 | var b = new THREE.Vector2(); 25 | 26 | var geo = ( geometry instanceof THREE.BufferGeometry ) ? new THREE.Geometry().fromBufferGeometry( geometry ) : geometry; 27 | 28 | var faces = geo.faces; 29 | var uvs = geo.faceVertexUvs[ 0 ]; 30 | 31 | var canvas = document.createElement( 'canvas' ); 32 | var width = size || 1024; // power of 2 required for wrapping 33 | var height = size || 1024; 34 | canvas.width = width; 35 | canvas.height = height; 36 | 37 | var ctx = canvas.getContext( '2d' ); 38 | ctx.lineWidth = 2; 39 | ctx.strokeStyle = 'rgba( 0, 0, 0, 1.0 )'; 40 | ctx.textAlign = 'center'; 41 | 42 | // paint background white 43 | 44 | ctx.fillStyle = 'rgba( 255, 255, 255, 1.0 )'; 45 | ctx.fillRect( 0, 0, width, height ); 46 | 47 | for ( i = 0, il = uvs.length; i < il; i ++ ) { 48 | 49 | uv = uvs[ i ]; 50 | 51 | // draw lines 52 | 53 | ctx.beginPath(); 54 | 55 | a.set( 0, 0 ); 56 | 57 | for ( j = 0, jl = uv.length; j < jl; j ++ ) { 58 | 59 | u = uv[ j ]; 60 | 61 | a.x += u.x; 62 | a.y += u.y; 63 | 64 | if ( j == 0 ) { 65 | 66 | ctx.moveTo( u.x * width, ( 1 - u.y ) * height ); 67 | 68 | } else { 69 | 70 | ctx.lineTo( u.x * width, ( 1 - u.y ) * height ); 71 | 72 | } 73 | 74 | } 75 | 76 | ctx.closePath(); 77 | ctx.stroke(); 78 | 79 | a.divideScalar( jl ); 80 | 81 | // label the face number 82 | 83 | ctx.font = "12pt Arial bold"; 84 | ctx.fillStyle = 'rgba( 0, 0, 0, 1.0 )'; 85 | ctx.fillText( i, a.x * width, ( 1 - a.y ) * height ); 86 | 87 | if ( a.x > 0.95 ) { 88 | 89 | // wrap x // 0.95 is arbitrary 90 | 91 | ctx.fillText( i, ( a.x % 1 ) * width, ( 1 - a.y ) * height ); 92 | 93 | } 94 | 95 | ctx.font = "8pt Arial bold"; 96 | ctx.fillStyle = 'rgba( 0, 0, 0, 1.0 )'; 97 | 98 | // label uv edge orders 99 | 100 | for ( j = 0, jl = uv.length; j < jl; j ++ ) { 101 | 102 | u = uv[ j ]; 103 | b.addVectors( a, u ).divideScalar( 2 ); 104 | 105 | vnum = faces[ i ][ abc[ j ] ]; 106 | ctx.fillText( abc[ j ] + vnum, b.x * width, ( 1 - b.y ) * height ); 107 | 108 | if ( b.x > 0.95 ) { 109 | 110 | // wrap x 111 | 112 | ctx.fillText( abc[ j ] + vnum, ( b.x % 1 ) * width, ( 1 - b.y ) * height ); 113 | 114 | } 115 | 116 | } 117 | 118 | } 119 | 120 | return canvas; 121 | 122 | }; 123 | 124 | -------------------------------------------------------------------------------- /web/secondtemple/models/ark/lensflare0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/ark/lensflare0.png -------------------------------------------------------------------------------- /web/secondtemple/models/ark/lensflare2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/ark/lensflare2.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/aerial2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/aerial2.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/aerial3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/aerial3.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/altar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/altar.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/arch.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/archeast.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/archeast.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/archtop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/archtop.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/archtop2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/archtop2.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/ark.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/ark.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/box.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/box.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/cemetary.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/cemetary.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/clouds.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/clouds.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/cobblestones.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/cobblestones.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/column.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/column.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/column2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/column2.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/columntop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/columntop.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/curtain.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/curtain.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/cyprus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/cyprus.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/dan.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/dan.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/door.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/door.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/dooreast.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/dooreast.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/god.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/god.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/ground.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/ground.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/ground2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/ground2.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/ground3.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/ground3.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/house.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/house.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/insidefloor.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/insidefloor.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/insidewall.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/insidewall.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/insidewall2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/insidewall2.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/minorah.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/minorah.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/olive.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/olive.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/panorama.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/panorama.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/path.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/path.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/pool.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/pool.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/roof.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/roof.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/rooftop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/rooftop.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/showbreadbase.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/showbreadbase.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/showbreadtop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/showbreadtop.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/sign.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/sign.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/skydomeday.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/skydomeday.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/skydomesunset.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/skydomesunset.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/steps.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/steps.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/steps2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/steps2.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/temple.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/temple.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/templefront.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/templefront.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/templetop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/templetop.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/towernorth2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/towernorth2.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/towernorthi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/towernorthi.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/wall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/wall.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/wallback.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/wallback.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/wallside.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/wallside.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/wallsidetop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/wallsidetop.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/westernwall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/westernwall.png -------------------------------------------------------------------------------- /web/secondtemple/models/temple/windowtop.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/windowtop.jpg -------------------------------------------------------------------------------- /web/secondtemple/models/temple/wood.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/models/temple/wood.jpg -------------------------------------------------------------------------------- /web/secondtemple/openworldjs/VolumetricFireTextures/firetex.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/openworldjs/VolumetricFireTextures/firetex.png -------------------------------------------------------------------------------- /web/secondtemple/openworldjs/VolumetricFireTextures/nzw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/openworldjs/VolumetricFireTextures/nzw.png -------------------------------------------------------------------------------- /web/secondtemple/sounds/blessing.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/sounds/blessing.mp3 -------------------------------------------------------------------------------- /web/secondtemple/sounds/flap1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/sounds/flap1.mp3 -------------------------------------------------------------------------------- /web/secondtemple/sounds/flap2.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/sounds/flap2.mp3 -------------------------------------------------------------------------------- /web/secondtemple/sounds/flap3.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/sounds/flap3.mp3 -------------------------------------------------------------------------------- /web/secondtemple/sounds/moo1.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/sounds/moo1.mp3 -------------------------------------------------------------------------------- /web/secondtemple/sounds/moo2.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/sounds/moo2.mp3 -------------------------------------------------------------------------------- /web/secondtemple/sounds/moo3.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/sounds/moo3.mp3 -------------------------------------------------------------------------------- /web/secondtemple/sounds/shofar.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/forthtemple/openworldthreejs/132beb45bd000f5ec90b76d5861322a176567d07/web/secondtemple/sounds/shofar.mp3 --------------------------------------------------------------------------------