From f2f1d9a7a62757fc885c96eb8fad0e52a150aa6f Mon Sep 17 00:00:00 2001 From: codeanticode Date: Wed, 5 Sep 2012 23:50:25 +0000 Subject: [PATCH] Sync android examples --- .../Camera/MoveEye/MoveEye.pde | 2 +- .../Camera/Perspective/Perspective.pde | 4 +- .../Form/Primitives3D/Primitives3D.pde | 2 +- .../Lights/Directional/Directional.pde | 4 +- .../Lights/Mixture/Mixture.pde} | 10 +- .../Lights/MixtureGrid/MixtureGrid.pde} | 18 +- .../Lights/OnOff/OnOff.pde} | 21 +- .../Lights/Reflection/Reflection.pde | 2 +- .../{OpenGL => Basics}/Lights/Spot/Spot.pde | 8 +- .../Shape/LoadDisplayOBJ/LoadDisplayOBJ.pde | 31 ++ .../Shape/LoadDisplayOBJ}/data/rocket.mtl | 0 .../Shape/LoadDisplayOBJ}/data/rocket.obj | 0 .../Shape/LoadDisplaySVG/LoadDisplaySVG.pde | 26 ++ .../data/bot1.svg | 0 .../LoadDisplayShape/LoadDisplayShape.pde | 26 -- .../CreateGraphics/CreateGraphics.pde | 2 +- .../RotatePushPop/RotatePushPop.pde} | 4 +- .../Transform/RotateXY/RotateXY.pde} | 8 +- .../Graphics}/Particles/Particle.pde | 0 .../Graphics}/Particles/ParticleSystem.pde | 0 .../Graphics}/Particles/Particles.pde | 7 +- .../Graphics}/Patch/Patch.pde | 4 +- .../Graphics}/Planets/Perlin.pde | 0 .../Graphics}/Planets/Planets.pde | 0 .../Graphics}/Ribbons/ArcBall.pde | 0 .../Graphics}/Ribbons/BSpline.pde | 0 .../Graphics}/Ribbons/Geometry.pde | 0 .../Graphics}/Ribbons/PDB.pde | 0 .../Graphics}/Ribbons/Ribbons.pde | 11 +- .../Graphics}/Ribbons/data/1CBS.pdb | 0 .../Graphics}/Ribbons/data/2POR.pdb | 0 .../Graphics}/Ribbons/data/4HHB.pdb | 0 .../Graphics/RotatingArcs/RotatingArcs.pde} | 0 .../Graphics}/Trefoil/Surface.pde | 0 .../Graphics}/Trefoil/Trefoil.pde | 0 .../Graphics}/Wiggling/Wiggling.pde | 0 .../Graphics}/Yellowtail/Gesture.pde | 0 .../Graphics}/Yellowtail/Polygon.pde | 0 .../Graphics}/Yellowtail/Vec3f.pde | 0 .../Graphics}/Yellowtail/Yellowtail.pde | 0 .../CubicGridImmediate/CubicGridImmediate.pde | 0 .../CubicGridRetained/CubicGridRetained.pde | 0 .../DynamicParticlesImmediate.pde | 0 .../DynamicParticlesRetained.pde | 0 .../Performance/Esfera/Esfera.pde | 0 .../LineRendering/LineRendering.pde | 0 .../QuadRendering/QuadRendering.pde | 0 .../StaticParticlesImmediate.pde | 0 .../StaticParticlesRetained.pde | 0 .../TextRendering/TextRendering.pde | 0 .../Tests/OffscreenTest/OffscreenTest.pde | 0 .../Tests/RedrawTest/RedrawTest.pde | 0 .../OpenGL/Camera/NearFar/NearFar.pde | 119 ------ .../OrthoVSPerspective/OrthoVSPerspective.pde | 40 -- .../OpenGL/Form/BrickTower/BrickTower.pde | 59 --- .../examples/OpenGL/Form/BrickTower/Cube.pde | 68 ---- .../OpenGL/Form/CubicGrid/CubicGrid.pde | 49 --- .../examples/OpenGL/Form/RunAmuck/Legs.pde | 162 -------- .../OpenGL/Form/RunAmuck/RunAmuck.pde | 46 --- .../Form/TexturedSphere/TexturedSphere.pde | 61 ---- .../examples/OpenGL/IO/LoadOBJ/LoadOBJ.pde | 19 - .../examples/OpenGL/IO/LoadSVG/LoadSVG.pde | 35 -- .../IO/LoadSVG/data/World_map-lowres.svg | 345 ------------------ .../OpenGL/Image/Blending/Blending.pde | 81 ---- .../examples/OpenGL/Image/Explode/Explode.pde | 47 --- .../OpenGL/Image/Extrusion/Extrusion.pde | 47 --- .../OpenGL/Image/ExtrusionGL/ExtrusionGL.pde | 51 --- android/examples/OpenGL/Image/Zoom/Zoom.pde | 90 ----- .../OpenGL/Immediate/Bezier/Bezier.pde | 23 -- .../Immediate/Robot1_Draw/Robot1_Draw.pde | 41 --- .../ShapePrimitives/ShapePrimitives.pde | 33 -- .../Immediate/TriangleStrip/TriangleStrip.pde | 45 --- .../OpenGL/Lights/CameraLight/CameraLight.pde | 39 -- .../OpenGL/Lights/Spot/AndroidManifest.xml | 17 - .../OpenGL/Pixels/GetPixels/GetPixels.pde | 30 -- .../OpenGL/Pixels/SetPixels/SetPixels.pde | 16 - .../Pixels/UpdatePixels/UpdatePixels.pde | 15 - .../Retained/PolyImmediate/PolyImmediate.pde | 21 -- .../OpenGL/Retained/PolyRetain/PolyRetain.pde | 22 -- .../OpenGL/Retained/Primitive/Primitive.pde | 43 --- .../OpenGL/Retained/Shape2_18/Shape2_18.pde | 16 - .../OpenGL/Shaders/BlurFilter/BlurFilter.pde | 14 - .../OpenGL/Shaders/EdgeDetect/EdgeDetect.pde | 32 -- .../OpenGL/Shaders/EdgeDetect/data/edges.glsl | 43 --- android/examples/OpenGL/Shaders/FXAA/FXAA.pde | 93 ----- .../OpenGL/Shaders/FXAA/data/fxaa.glsl | 69 ---- .../OpenGL/Shaders/FishEye/FishEye.pde | 37 -- .../OpenGL/Shaders/FishEye/data/FishEye.glsl | 57 --- .../Shaders/GlossyFishEye/GlossyFishEye.pde | 70 ---- .../Shaders/GlossyFishEye/data/FishEye.glsl | 57 --- .../GlossyFishEye/data/GlossyFrag.glsl | 45 --- .../GlossyFishEye/data/GlossyVert.glsl | 31 -- .../Shaders/ToonShading/ToonShading.pde | 41 --- .../examples/OpenGL/Transform/Bird/Bird.pde | 66 ---- .../examples/OpenGL/Transform/Birds/Bird.pde | 99 ----- .../examples/OpenGL/Transform/Birds/Birds.pde | 56 --- .../OpenGL/Transform/CubesWithinCube/Cube.pde | 72 ---- .../CubesWithinCube/CubesWithinCube.pde | 118 ------ .../Transform/PushPopCubes/PushPopCubes.pde | 149 -------- .../Typography/KineticType/KineticType.pde | 68 ---- .../OpenGL/Typography/KineticType/Letter.pde | 13 - .../OpenGL/Typography/KineticType/Line.pde | 28 -- .../OpenGL/Typography/KineticType/Word.pde | 10 - .../KineticType/data/Univers-66.vlw | Bin 116537 -> 0 bytes .../OpenGL/Typography/LetterK/LetterK.pde | 126 ------- .../OpenGL/Typography/Typing/Typing.pde | 83 ----- .../Typography/Typing/data/Univers45.vlw | Bin 95193 -> 0 bytes .../BeginEndContour/BeginEndContour.pde | 48 +++ .../Create Shapes/GroupPShape/GroupPShape.pde | 69 ++++ .../ParticleSystemPShape/Particle.pde | 81 ++++ .../ParticleSystemPShape/ParticleSystem.pde | 43 +++ .../ParticleSystemPShape.pde | 42 +++ .../Create Shapes/PathPShape/PathPShape.pde | 37 ++ .../PolygonPShape/PolygonPShape.pde | 41 +++ .../PolygonPShapeOOP/PolygonPShapeOOP.pde | 26 ++ .../Create Shapes/PolygonPShapeOOP/Star.pde | 50 +++ .../PolygonPShapeOOP2/Polygon.pde | 34 ++ .../PolygonPShapeOOP2/PolygonPShapeOOP2.pde | 52 +++ .../PolygonPShapeOOP3/Polygon.pde | 34 ++ .../PolygonPShapeOOP3/PolygonPShapeOOP3.pde | 63 ++++ .../PrimitivePShape/PrimitivePShape.pde | 30 ++ .../WigglePShape/WigglePShape.pde | 23 ++ .../Create Shapes/WigglePShape/Wiggler.pde | 66 ++++ .../Geometry}/Icosahedra/Dimension3D.pde | 0 .../Geometry}/Icosahedra/Icosahedra.pde | 2 +- .../Geometry}/Icosahedra/Icosahedron.pde | 0 .../Geometry}/Icosahedra/Shape3D.pde | 0 .../Geometry/NoiseSphere/NoiseSphere.pde | 83 +++++ .../Geometry}/RGBCube/RGBCube.pde | 2 +- .../ShapeTransform/ShapeTransform.pde | 41 +-- .../Geometry}/SpaceJunk/Cube.pde | 8 +- .../Geometry}/SpaceJunk/SpaceJunk.pde | 14 +- .../Geometry}/Toroid/Toroid.pde | 5 +- .../Geometry}/Vertices/Vertices.pde | 2 +- .../Topics/Shaders/BlurFilter/BlurFilter.pde | 26 ++ .../Shaders/BlurFilter/data/blur.glsl | 0 .../Topics/Shaders/EdgeDetect/EdgeDetect.pde | 32 ++ .../Shaders/EdgeDetect}/data/edges.glsl | 0 .../Shaders/EdgeFilter/EdgeFilter.pde | 21 +- .../Topics/Shaders/EdgeFilter/data/edges.glsl | 48 +++ .../Shaders/LowLevelGL/LowLevelGL.pde | 42 +-- .../Topics/Shaders/LowLevelGL/data/frag.glsl | 30 ++ .../Topics/Shaders/LowLevelGL/data/vert.glsl | 32 ++ .../Shaders/SepBlur/SepBlur.pde | 15 +- .../Shaders/SepBlur/data/blur.glsl | 0 .../Shaders/ToonShading/ToonShading.pde | 44 +++ .../Shaders/ToonShading/data/ToonFrag.glsl | 0 .../Shaders/ToonShading/data/ToonVert.glsl | 0 .../examples/Topics/Simulate/Fluid/Fluid.pde | 208 ----------- .../ForcesWithVectors/ForcesWithVectors.pde | 77 ++++ .../Simulate/ForcesWithVectors/Liquid.pde | 60 +++ .../Simulate/ForcesWithVectors/Mover.pde | 64 ++++ .../GravitationalAttraction3D.pde | 71 ++++ .../GravitationalAttraction3D/Planet.pde | 45 +++ .../GravitationalAttraction3D/Sun.pde | 39 ++ .../examples/Topics/Simulate/Smoke/Smoke.pde | 264 -------------- .../Textures/TextureCube/TextureCube.pde | 15 +- .../TextureCylinder/TextureCylinder.pde} | 6 +- .../Textures/TextureQuad/TextureQuad.pde} | 13 +- .../Textures/TextureSphere/TextureSphere.pde | 175 +++++++++ .../TextureTriangle/TextureTriangle.pde} | 12 +- .../AccelerationWithVectors.pde | 30 ++ .../Vectors/AccelerationWithVectors/Mover.pde | 53 +++ .../Vectors/BouncingBall/BouncingBall.pde | 49 +++ .../Topics/Vectors/Normalize/Normalize.pde | 37 ++ .../Topics/Vectors/VectorMath/VectorMath.pde | 37 ++ 166 files changed, 1983 insertions(+), 3805 deletions(-) rename android/examples/{OpenGL => Basics}/Camera/MoveEye/MoveEye.pde (99%) rename android/examples/{OpenGL => Basics}/Camera/Perspective/Perspective.pde (96%) rename android/examples/{OpenGL => Basics}/Form/Primitives3D/Primitives3D.pde (99%) rename android/examples/{OpenGL => Basics}/Lights/Directional/Directional.pde (92%) rename android/examples/{OpenGL/Lights/Lights2/Lights2.pde => Basics/Lights/Mixture/Mixture.pde} (94%) rename android/examples/{OpenGL/Lights/LightsGL/LightsGL.pde => Basics/Lights/MixtureGrid/MixtureGrid.pde} (75%) rename android/examples/{OpenGL/Lights/Lights1/Lights1.pde => Basics/Lights/OnOff/OnOff.pde} (60%) rename android/examples/{OpenGL => Basics}/Lights/Reflection/Reflection.pde (99%) rename android/examples/{OpenGL => Basics}/Lights/Spot/Spot.pde (88%) create mode 100644 android/examples/Basics/Shape/LoadDisplayOBJ/LoadDisplayOBJ.pde rename android/examples/{OpenGL/IO/LoadOBJ => Basics/Shape/LoadDisplayOBJ}/data/rocket.mtl (100%) rename android/examples/{OpenGL/IO/LoadOBJ => Basics/Shape/LoadDisplayOBJ}/data/rocket.obj (100%) create mode 100644 android/examples/Basics/Shape/LoadDisplaySVG/LoadDisplaySVG.pde rename android/examples/Basics/Shape/{LoadDisplayShape => LoadDisplaySVG}/data/bot1.svg (100%) delete mode 100644 android/examples/Basics/Shape/LoadDisplayShape/LoadDisplayShape.pde rename android/examples/{OpenGL/Transform/Rotate2/Rotate2.pde => Basics/Transform/RotatePushPop/RotatePushPop.pde} (97%) rename android/examples/{OpenGL/Transform/Rotate1/Rotate1.pde => Basics/Transform/RotateXY/RotateXY.pde} (91%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Particles/Particle.pde (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Particles/ParticleSystem.pde (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Particles/Particles.pde (87%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Patch/Patch.pde (98%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Planets/Perlin.pde (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Planets/Planets.pde (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Ribbons/ArcBall.pde (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Ribbons/BSpline.pde (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Ribbons/Geometry.pde (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Ribbons/PDB.pde (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Ribbons/Ribbons.pde (94%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Ribbons/data/1CBS.pdb (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Ribbons/data/2POR.pdb (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Ribbons/data/4HHB.pdb (100%) rename android/examples/{OpenGL/Form/Geometry/Geometry.pde => Demos/Graphics/RotatingArcs/RotatingArcs.pde} (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Trefoil/Surface.pde (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Trefoil/Trefoil.pde (100%) rename android/examples/{OpenGL/Advanced => Demos/Graphics}/Wiggling/Wiggling.pde (100%) rename android/examples/{OpenGL/Animation => Demos/Graphics}/Yellowtail/Gesture.pde (100%) rename android/examples/{OpenGL/Animation => Demos/Graphics}/Yellowtail/Polygon.pde (100%) rename android/examples/{OpenGL/Animation => Demos/Graphics}/Yellowtail/Vec3f.pde (100%) rename android/examples/{OpenGL/Animation => Demos/Graphics}/Yellowtail/Yellowtail.pde (100%) rename android/examples/{OpenGL => Demos}/Performance/CubicGridImmediate/CubicGridImmediate.pde (100%) rename android/examples/{OpenGL => Demos}/Performance/CubicGridRetained/CubicGridRetained.pde (100%) rename android/examples/{OpenGL => Demos}/Performance/DynamicParticlesImmediate/DynamicParticlesImmediate.pde (100%) rename android/examples/{OpenGL => Demos}/Performance/DynamicParticlesRetained/DynamicParticlesRetained.pde (100%) rename android/examples/{OpenGL => Demos}/Performance/Esfera/Esfera.pde (100%) rename android/examples/{OpenGL => Demos}/Performance/LineRendering/LineRendering.pde (100%) rename android/examples/{OpenGL => Demos}/Performance/QuadRendering/QuadRendering.pde (100%) rename android/examples/{OpenGL => Demos}/Performance/StaticParticlesImmediate/StaticParticlesImmediate.pde (100%) rename android/examples/{OpenGL => Demos}/Performance/StaticParticlesRetained/StaticParticlesRetained.pde (100%) rename android/examples/{OpenGL => Demos}/Performance/TextRendering/TextRendering.pde (100%) rename android/examples/{OpenGL => Demos}/Tests/OffscreenTest/OffscreenTest.pde (100%) rename android/examples/{OpenGL => Demos}/Tests/RedrawTest/RedrawTest.pde (100%) delete mode 100644 android/examples/OpenGL/Camera/NearFar/NearFar.pde delete mode 100644 android/examples/OpenGL/Camera/OrthoVSPerspective/OrthoVSPerspective.pde delete mode 100644 android/examples/OpenGL/Form/BrickTower/BrickTower.pde delete mode 100644 android/examples/OpenGL/Form/BrickTower/Cube.pde delete mode 100644 android/examples/OpenGL/Form/CubicGrid/CubicGrid.pde delete mode 100644 android/examples/OpenGL/Form/RunAmuck/Legs.pde delete mode 100644 android/examples/OpenGL/Form/RunAmuck/RunAmuck.pde delete mode 100644 android/examples/OpenGL/Form/TexturedSphere/TexturedSphere.pde delete mode 100644 android/examples/OpenGL/IO/LoadOBJ/LoadOBJ.pde delete mode 100644 android/examples/OpenGL/IO/LoadSVG/LoadSVG.pde delete mode 100644 android/examples/OpenGL/IO/LoadSVG/data/World_map-lowres.svg delete mode 100644 android/examples/OpenGL/Image/Blending/Blending.pde delete mode 100644 android/examples/OpenGL/Image/Explode/Explode.pde delete mode 100644 android/examples/OpenGL/Image/Extrusion/Extrusion.pde delete mode 100644 android/examples/OpenGL/Image/ExtrusionGL/ExtrusionGL.pde delete mode 100644 android/examples/OpenGL/Image/Zoom/Zoom.pde delete mode 100644 android/examples/OpenGL/Immediate/Bezier/Bezier.pde delete mode 100644 android/examples/OpenGL/Immediate/Robot1_Draw/Robot1_Draw.pde delete mode 100644 android/examples/OpenGL/Immediate/ShapePrimitives/ShapePrimitives.pde delete mode 100644 android/examples/OpenGL/Immediate/TriangleStrip/TriangleStrip.pde delete mode 100644 android/examples/OpenGL/Lights/CameraLight/CameraLight.pde delete mode 100644 android/examples/OpenGL/Lights/Spot/AndroidManifest.xml delete mode 100644 android/examples/OpenGL/Pixels/GetPixels/GetPixels.pde delete mode 100644 android/examples/OpenGL/Pixels/SetPixels/SetPixels.pde delete mode 100644 android/examples/OpenGL/Pixels/UpdatePixels/UpdatePixels.pde delete mode 100644 android/examples/OpenGL/Retained/PolyImmediate/PolyImmediate.pde delete mode 100644 android/examples/OpenGL/Retained/PolyRetain/PolyRetain.pde delete mode 100644 android/examples/OpenGL/Retained/Primitive/Primitive.pde delete mode 100644 android/examples/OpenGL/Retained/Shape2_18/Shape2_18.pde delete mode 100644 android/examples/OpenGL/Shaders/BlurFilter/BlurFilter.pde delete mode 100644 android/examples/OpenGL/Shaders/EdgeDetect/EdgeDetect.pde delete mode 100644 android/examples/OpenGL/Shaders/EdgeDetect/data/edges.glsl delete mode 100644 android/examples/OpenGL/Shaders/FXAA/FXAA.pde delete mode 100644 android/examples/OpenGL/Shaders/FXAA/data/fxaa.glsl delete mode 100644 android/examples/OpenGL/Shaders/FishEye/FishEye.pde delete mode 100644 android/examples/OpenGL/Shaders/FishEye/data/FishEye.glsl delete mode 100644 android/examples/OpenGL/Shaders/GlossyFishEye/GlossyFishEye.pde delete mode 100644 android/examples/OpenGL/Shaders/GlossyFishEye/data/FishEye.glsl delete mode 100644 android/examples/OpenGL/Shaders/GlossyFishEye/data/GlossyFrag.glsl delete mode 100644 android/examples/OpenGL/Shaders/GlossyFishEye/data/GlossyVert.glsl delete mode 100644 android/examples/OpenGL/Shaders/ToonShading/ToonShading.pde delete mode 100644 android/examples/OpenGL/Transform/Bird/Bird.pde delete mode 100644 android/examples/OpenGL/Transform/Birds/Bird.pde delete mode 100644 android/examples/OpenGL/Transform/Birds/Birds.pde delete mode 100644 android/examples/OpenGL/Transform/CubesWithinCube/Cube.pde delete mode 100644 android/examples/OpenGL/Transform/CubesWithinCube/CubesWithinCube.pde delete mode 100644 android/examples/OpenGL/Transform/PushPopCubes/PushPopCubes.pde delete mode 100644 android/examples/OpenGL/Typography/KineticType/KineticType.pde delete mode 100644 android/examples/OpenGL/Typography/KineticType/Letter.pde delete mode 100644 android/examples/OpenGL/Typography/KineticType/Line.pde delete mode 100644 android/examples/OpenGL/Typography/KineticType/Word.pde delete mode 100644 android/examples/OpenGL/Typography/KineticType/data/Univers-66.vlw delete mode 100644 android/examples/OpenGL/Typography/LetterK/LetterK.pde delete mode 100644 android/examples/OpenGL/Typography/Typing/Typing.pde delete mode 100644 android/examples/OpenGL/Typography/Typing/data/Univers45.vlw create mode 100644 android/examples/Topics/Create Shapes/BeginEndContour/BeginEndContour.pde create mode 100644 android/examples/Topics/Create Shapes/GroupPShape/GroupPShape.pde create mode 100644 android/examples/Topics/Create Shapes/ParticleSystemPShape/Particle.pde create mode 100644 android/examples/Topics/Create Shapes/ParticleSystemPShape/ParticleSystem.pde create mode 100644 android/examples/Topics/Create Shapes/ParticleSystemPShape/ParticleSystemPShape.pde create mode 100644 android/examples/Topics/Create Shapes/PathPShape/PathPShape.pde create mode 100644 android/examples/Topics/Create Shapes/PolygonPShape/PolygonPShape.pde create mode 100644 android/examples/Topics/Create Shapes/PolygonPShapeOOP/PolygonPShapeOOP.pde create mode 100644 android/examples/Topics/Create Shapes/PolygonPShapeOOP/Star.pde create mode 100644 android/examples/Topics/Create Shapes/PolygonPShapeOOP2/Polygon.pde create mode 100644 android/examples/Topics/Create Shapes/PolygonPShapeOOP2/PolygonPShapeOOP2.pde create mode 100644 android/examples/Topics/Create Shapes/PolygonPShapeOOP3/Polygon.pde create mode 100644 android/examples/Topics/Create Shapes/PolygonPShapeOOP3/PolygonPShapeOOP3.pde create mode 100644 android/examples/Topics/Create Shapes/PrimitivePShape/PrimitivePShape.pde create mode 100644 android/examples/Topics/Create Shapes/WigglePShape/WigglePShape.pde create mode 100644 android/examples/Topics/Create Shapes/WigglePShape/Wiggler.pde rename android/examples/{OpenGL/Form => Topics/Geometry}/Icosahedra/Dimension3D.pde (100%) rename android/examples/{OpenGL/Form => Topics/Geometry}/Icosahedra/Icosahedra.pde (99%) rename android/examples/{OpenGL/Form => Topics/Geometry}/Icosahedra/Icosahedron.pde (100%) rename android/examples/{OpenGL/Form => Topics/Geometry}/Icosahedra/Shape3D.pde (100%) create mode 100644 android/examples/Topics/Geometry/NoiseSphere/NoiseSphere.pde rename android/examples/{OpenGL/Form => Topics/Geometry}/RGBCube/RGBCube.pde (99%) rename android/examples/{OpenGL/Form => Topics/Geometry}/ShapeTransform/ShapeTransform.pde (80%) rename android/examples/{OpenGL/Form => Topics/Geometry}/SpaceJunk/Cube.pde (91%) rename android/examples/{OpenGL/Form => Topics/Geometry}/SpaceJunk/SpaceJunk.pde (81%) rename android/examples/{OpenGL/Form => Topics/Geometry}/Toroid/Toroid.pde (95%) rename android/examples/{OpenGL/Form => Topics/Geometry}/Vertices/Vertices.pde (99%) create mode 100644 android/examples/Topics/Shaders/BlurFilter/BlurFilter.pde rename android/examples/{OpenGL => Topics}/Shaders/BlurFilter/data/blur.glsl (100%) create mode 100644 android/examples/Topics/Shaders/EdgeDetect/EdgeDetect.pde rename android/examples/{OpenGL/Shaders/EdgeFilter => Topics/Shaders/EdgeDetect}/data/edges.glsl (100%) rename android/examples/{OpenGL => Topics}/Shaders/EdgeFilter/EdgeFilter.pde (64%) create mode 100644 android/examples/Topics/Shaders/EdgeFilter/data/edges.glsl rename android/examples/{OpenGL => Topics}/Shaders/LowLevelGL/LowLevelGL.pde (62%) create mode 100644 android/examples/Topics/Shaders/LowLevelGL/data/frag.glsl create mode 100644 android/examples/Topics/Shaders/LowLevelGL/data/vert.glsl rename android/examples/{OpenGL => Topics}/Shaders/SepBlur/SepBlur.pde (81%) rename android/examples/{OpenGL => Topics}/Shaders/SepBlur/data/blur.glsl (100%) create mode 100644 android/examples/Topics/Shaders/ToonShading/ToonShading.pde rename android/examples/{OpenGL => Topics}/Shaders/ToonShading/data/ToonFrag.glsl (100%) rename android/examples/{OpenGL => Topics}/Shaders/ToonShading/data/ToonVert.glsl (100%) delete mode 100644 android/examples/Topics/Simulate/Fluid/Fluid.pde create mode 100644 android/examples/Topics/Simulate/ForcesWithVectors/ForcesWithVectors.pde create mode 100644 android/examples/Topics/Simulate/ForcesWithVectors/Liquid.pde create mode 100644 android/examples/Topics/Simulate/ForcesWithVectors/Mover.pde create mode 100644 android/examples/Topics/Simulate/GravitationalAttraction3D/GravitationalAttraction3D.pde create mode 100644 android/examples/Topics/Simulate/GravitationalAttraction3D/Planet.pde create mode 100644 android/examples/Topics/Simulate/GravitationalAttraction3D/Sun.pde delete mode 100644 android/examples/Topics/Simulate/Smoke/Smoke.pde rename android/examples/{OpenGL => Topics}/Textures/TextureCube/TextureCube.pde (87%) rename android/examples/{OpenGL/Textures/Texture3/Texture3.pde => Topics/Textures/TextureCylinder/TextureCylinder.pde} (88%) rename android/examples/{OpenGL/Textures/Texture1/Texture1.pde => Topics/Textures/TextureQuad/TextureQuad.pde} (65%) create mode 100644 android/examples/Topics/Textures/TextureSphere/TextureSphere.pde rename android/examples/{OpenGL/Textures/Texture2/Texture2.pde => Topics/Textures/TextureTriangle/TextureTriangle.pde} (65%) create mode 100644 android/examples/Topics/Vectors/AccelerationWithVectors/AccelerationWithVectors.pde create mode 100644 android/examples/Topics/Vectors/AccelerationWithVectors/Mover.pde create mode 100644 android/examples/Topics/Vectors/BouncingBall/BouncingBall.pde create mode 100644 android/examples/Topics/Vectors/Normalize/Normalize.pde create mode 100644 android/examples/Topics/Vectors/VectorMath/VectorMath.pde diff --git a/android/examples/OpenGL/Camera/MoveEye/MoveEye.pde b/android/examples/Basics/Camera/MoveEye/MoveEye.pde similarity index 99% rename from android/examples/OpenGL/Camera/MoveEye/MoveEye.pde rename to android/examples/Basics/Camera/MoveEye/MoveEye.pde index 6e1fc472c..0e305f592 100644 --- a/android/examples/OpenGL/Camera/MoveEye/MoveEye.pde +++ b/android/examples/Basics/Camera/MoveEye/MoveEye.pde @@ -26,4 +26,4 @@ void draw() { line(-100, 0, 0, 100, 0, 0); line(0, -100, 0, 0, 100, 0); line(0, 0, -100, 0, 0, 100); -} +} diff --git a/android/examples/OpenGL/Camera/Perspective/Perspective.pde b/android/examples/Basics/Camera/Perspective/Perspective.pde similarity index 96% rename from android/examples/OpenGL/Camera/Perspective/Perspective.pde rename to android/examples/Basics/Camera/Perspective/Perspective.pde index c2d53e42d..819248d05 100644 --- a/android/examples/OpenGL/Camera/Perspective/Perspective.pde +++ b/android/examples/Basics/Camera/Perspective/Perspective.pde @@ -15,7 +15,7 @@ */ void setup() { - size(640, 360, P3D); + size(displayWidth, displayHeight, P3D); orientation(LANDSCAPE); noStroke(); } @@ -39,4 +39,4 @@ void draw() { translate(0, 0, -50); box(30); } - + diff --git a/android/examples/OpenGL/Form/Primitives3D/Primitives3D.pde b/android/examples/Basics/Form/Primitives3D/Primitives3D.pde similarity index 99% rename from android/examples/OpenGL/Form/Primitives3D/Primitives3D.pde rename to android/examples/Basics/Form/Primitives3D/Primitives3D.pde index ff18fc85b..2db5ec81d 100644 --- a/android/examples/OpenGL/Form/Primitives3D/Primitives3D.pde +++ b/android/examples/Basics/Form/Primitives3D/Primitives3D.pde @@ -28,4 +28,4 @@ translate(500, height*0.35, -200); sphere(280); popMatrix(); - + diff --git a/android/examples/OpenGL/Lights/Directional/Directional.pde b/android/examples/Basics/Lights/Directional/Directional.pde similarity index 92% rename from android/examples/OpenGL/Lights/Directional/Directional.pde rename to android/examples/Basics/Lights/Directional/Directional.pde index 8613d8ac8..690a1bf97 100644 --- a/android/examples/OpenGL/Lights/Directional/Directional.pde +++ b/android/examples/Basics/Lights/Directional/Directional.pde @@ -20,10 +20,10 @@ void draw() { background(0); float dirY = (mouseY / float(height) - 0.5) * 2; float dirX = (mouseX / float(width) - 0.5) * 2; - directionalLight(204, 204, 204, -dirX, -dirY, -1); + directionalLight(204, 204, 204, -dirX, -dirY, -1); translate(width/2 - 100, height/2, 0); sphere(80); translate(200, 0, 0); sphere(80); } - + diff --git a/android/examples/OpenGL/Lights/Lights2/Lights2.pde b/android/examples/Basics/Lights/Mixture/Mixture.pde similarity index 94% rename from android/examples/OpenGL/Lights/Lights2/Lights2.pde rename to android/examples/Basics/Lights/Mixture/Mixture.pde index 8567b0564..c00a44a23 100644 --- a/android/examples/OpenGL/Lights/Lights2/Lights2.pde +++ b/android/examples/Basics/Lights/Mixture/Mixture.pde @@ -1,19 +1,17 @@ /** - * Lights 2 + * Mixture * by Simon Greenwold. * * Display a box with three different kinds of lights. */ -void setup() -{ +void setup() { size(640, 360, P3D); orientation(LANDSCAPE); noStroke(); } -void draw() -{ +void draw() { background(0); translate(width / 2, height / 2); @@ -34,4 +32,4 @@ void draw() rotateY(map(mouseX, 0, width, 0, PI)); rotateX(map(mouseY, 0, height, 0, PI)); box(150); -} +} diff --git a/android/examples/OpenGL/Lights/LightsGL/LightsGL.pde b/android/examples/Basics/Lights/MixtureGrid/MixtureGrid.pde similarity index 75% rename from android/examples/OpenGL/Lights/LightsGL/LightsGL.pde rename to android/examples/Basics/Lights/MixtureGrid/MixtureGrid.pde index f1f879342..3a6467ca5 100644 --- a/android/examples/OpenGL/Lights/LightsGL/LightsGL.pde +++ b/android/examples/Basics/Lights/MixtureGrid/MixtureGrid.pde @@ -1,23 +1,21 @@ /** - * LightsGL. - * Modified from an example by Simon Greenwold. + * Mixture Grid + * modified from an example by Simon Greenwold. * - * Display a box with three different kinds of lights. + * Display a 2D grid of boxes with three different kinds of lights. */ -void setup() -{ +void setup() { size(displayWidth, displayHeight, P3D); noStroke(); } -void draw() -{ +void draw() { defineLights(); background(0); - for (int x = 0; x <= width; x += 100) { - for (int y = 0; y <= height; y += 100) { + for (int x = 0; x <= width; x += 60) { + for (int y = 0; y <= height; y += 60) { pushMatrix(); translate(x, y); rotateY(map(mouseX, 0, width, 0, PI)); @@ -42,4 +40,4 @@ void defineLights() { 0, 40, 200, // Position 0, -0.5, -0.5, // Direction PI / 2, 2); // Angle, concentration -} +} diff --git a/android/examples/OpenGL/Lights/Lights1/Lights1.pde b/android/examples/Basics/Lights/OnOff/OnOff.pde similarity index 60% rename from android/examples/OpenGL/Lights/Lights1/Lights1.pde rename to android/examples/Basics/Lights/OnOff/OnOff.pde index 3a92fa736..0ec4f27e5 100644 --- a/android/examples/OpenGL/Lights/Lights1/Lights1.pde +++ b/android/examples/Basics/Lights/OnOff/OnOff.pde @@ -1,23 +1,26 @@ /** - * Lights 1. + * On/Off. * * Uses the default lights to show a simple box. The lights() function - * is used to turn on the default lighting. + * is used to turn on the default lighting. Click the mouse to turn the + * lights off. */ float spin = 0.0; +boolean on = true; -void setup() -{ +void setup() { size(640, 360, P3D); orientation(LANDSCAPE); noStroke(); } -void draw() -{ +void draw() { background(51); - lights(); + + if (on) { + lights(); + } spin += 0.01; @@ -28,3 +31,7 @@ void draw() box(150); popMatrix(); } + +void mousePressed() { + on = !on; +} diff --git a/android/examples/OpenGL/Lights/Reflection/Reflection.pde b/android/examples/Basics/Lights/Reflection/Reflection.pde similarity index 99% rename from android/examples/OpenGL/Lights/Reflection/Reflection.pde rename to android/examples/Basics/Lights/Reflection/Reflection.pde index efcf4639e..2349b4b83 100644 --- a/android/examples/OpenGL/Lights/Reflection/Reflection.pde +++ b/android/examples/Basics/Lights/Reflection/Reflection.pde @@ -23,4 +23,4 @@ void draw() { float s = mouseX / float(width); specular(s, s, s); sphere(120); -} +} diff --git a/android/examples/OpenGL/Lights/Spot/Spot.pde b/android/examples/Basics/Lights/Spot/Spot.pde similarity index 88% rename from android/examples/OpenGL/Lights/Spot/Spot.pde rename to android/examples/Basics/Lights/Spot/Spot.pde index 6f4a860ed..a03ad8aaa 100644 --- a/android/examples/OpenGL/Lights/Spot/Spot.pde +++ b/android/examples/Basics/Lights/Spot/Spot.pde @@ -6,7 +6,6 @@ */ int concentration = 600; // Try values 1 -> 10000 -PShape ball; void setup() { @@ -14,8 +13,7 @@ void setup() orientation(LANDSCAPE); noStroke(); fill(204); - sphereDetail(60); - ball = createShape(SPHERE, 120); + sphereDetail(30); } void draw() @@ -32,6 +30,6 @@ void draw() spotLight(102, 153, 204, 360, mouseY, 600, 0, 0, -1, PI/2, 600); translate(width/2, height/2, 0); - shape(ball); + sphere(120); } - + diff --git a/android/examples/Basics/Shape/LoadDisplayOBJ/LoadDisplayOBJ.pde b/android/examples/Basics/Shape/LoadDisplayOBJ/LoadDisplayOBJ.pde new file mode 100644 index 000000000..154eeb4f0 --- /dev/null +++ b/android/examples/Basics/Shape/LoadDisplayOBJ/LoadDisplayOBJ.pde @@ -0,0 +1,31 @@ +/** + * Load and Display an OBJ Shape. + * + * The loadShape() command is used to read simple SVG (Scalable Vector Graphics) + * files and OBJ (Object) files into a Processing sketch. This example loads an + * OBJ file of a rocket and displays it to the screen. + */ + + +PShape rocket; + +float ry; + +public void setup() { + size(640, 360, P3D); + orientation(LANDSCAPE); + + rocket = loadShape("rocket.obj"); +} + +public void draw() { + background(0); + lights(); + + translate(width/2, height/2 + 100, -200); + rotateZ(PI); + rotateY(ry); + shape(rocket); + + ry += 0.02; +} diff --git a/android/examples/OpenGL/IO/LoadOBJ/data/rocket.mtl b/android/examples/Basics/Shape/LoadDisplayOBJ/data/rocket.mtl similarity index 100% rename from android/examples/OpenGL/IO/LoadOBJ/data/rocket.mtl rename to android/examples/Basics/Shape/LoadDisplayOBJ/data/rocket.mtl diff --git a/android/examples/OpenGL/IO/LoadOBJ/data/rocket.obj b/android/examples/Basics/Shape/LoadDisplayOBJ/data/rocket.obj similarity index 100% rename from android/examples/OpenGL/IO/LoadOBJ/data/rocket.obj rename to android/examples/Basics/Shape/LoadDisplayOBJ/data/rocket.obj diff --git a/android/examples/Basics/Shape/LoadDisplaySVG/LoadDisplaySVG.pde b/android/examples/Basics/Shape/LoadDisplaySVG/LoadDisplaySVG.pde new file mode 100644 index 000000000..5cb9c91d4 --- /dev/null +++ b/android/examples/Basics/Shape/LoadDisplaySVG/LoadDisplaySVG.pde @@ -0,0 +1,26 @@ +/** + * Load and Display a Shape. + * Illustration by George Brower. + * + * The loadShape() command is used to read simple SVG (Scalable Vector Graphics) + * files and OBJ (Object) files into a Processing sketch. This example loads an + * SVG file of a monster robot face and displays it to the screen. + */ + +// The next line is needed if running in JavaScript Mode with Processing.js +/* @pjs preload="bot1.svg"; */ + +PShape bot; + +void setup() { + size(640, 360); + // The file "bot1.svg" must be in the data folder + // of the current sketch to load successfully + bot = loadShape("bot1.svg"); +} + +void draw(){ + background(102); + shape(bot, 110, 90, 100, 100); // Draw at coordinate (110, 90) at size 100 x 100 + shape(bot, 280, 40); // Draw at coordinate (280, 40) at the default size +} diff --git a/android/examples/Basics/Shape/LoadDisplayShape/data/bot1.svg b/android/examples/Basics/Shape/LoadDisplaySVG/data/bot1.svg similarity index 100% rename from android/examples/Basics/Shape/LoadDisplayShape/data/bot1.svg rename to android/examples/Basics/Shape/LoadDisplaySVG/data/bot1.svg diff --git a/android/examples/Basics/Shape/LoadDisplayShape/LoadDisplayShape.pde b/android/examples/Basics/Shape/LoadDisplayShape/LoadDisplayShape.pde deleted file mode 100644 index 3d18b4b4a..000000000 --- a/android/examples/Basics/Shape/LoadDisplayShape/LoadDisplayShape.pde +++ /dev/null @@ -1,26 +0,0 @@ -/** - * Load and Display a Shape. - * Illustration by George Brower. - * - * The loadShape() command is used to read simple SVG (Scalable Vector Graphics) - * files into a Processing sketch. This library was specifically tested under - * SVG files created from Adobe Illustrator. For now, we can't guarantee that - * it'll work for SVGs created with anything else. - */ - -PShape bot; - -void setup() { - size(640, 360); - smooth(); - // The file "bot1.svg" must be in the data folder - // of the current sketch to load successfully - bot = loadShape("bot1.svg"); - noLoop(); // Only run draw() once -} - -void draw(){ - background(102); - shape(bot, 110, 90, 100, 100); // Draw at coordinate (10, 10) at size 100 x 100 - shape(bot, 280, 40); // Draw at coordinate (70, 60) at the default size -} diff --git a/android/examples/Basics/Structure/CreateGraphics/CreateGraphics.pde b/android/examples/Basics/Structure/CreateGraphics/CreateGraphics.pde index 7f1b1d0eb..af137112e 100644 --- a/android/examples/Basics/Structure/CreateGraphics/CreateGraphics.pde +++ b/android/examples/Basics/Structure/CreateGraphics/CreateGraphics.pde @@ -12,7 +12,7 @@ PGraphics pg; void setup() { size(200, 200); - pg = createGraphics(80, 80, P2D); + pg = createGraphics(80, 80); } void draw() { diff --git a/android/examples/OpenGL/Transform/Rotate2/Rotate2.pde b/android/examples/Basics/Transform/RotatePushPop/RotatePushPop.pde similarity index 97% rename from android/examples/OpenGL/Transform/Rotate2/Rotate2.pde rename to android/examples/Basics/Transform/RotatePushPop/RotatePushPop.pde index a055564fa..0a948ff25 100644 --- a/android/examples/OpenGL/Transform/Rotate2/Rotate2.pde +++ b/android/examples/Basics/Transform/RotatePushPop/RotatePushPop.pde @@ -1,5 +1,5 @@ /** - * Rotate 2. + * Rotate Push Pop. * * The push() and pop() functions allow for more control over transformations. * The push function saves the current coordinate system to the stack @@ -40,4 +40,4 @@ void draw() box(200); popMatrix(); } -} +} diff --git a/android/examples/OpenGL/Transform/Rotate1/Rotate1.pde b/android/examples/Basics/Transform/RotateXY/RotateXY.pde similarity index 91% rename from android/examples/OpenGL/Transform/Rotate1/Rotate1.pde rename to android/examples/Basics/Transform/RotateXY/RotateXY.pde index a497aa394..800d736a7 100644 --- a/android/examples/OpenGL/Transform/Rotate1/Rotate1.pde +++ b/android/examples/Basics/Transform/RotateXY/RotateXY.pde @@ -18,8 +18,8 @@ void setup() { fill(204, 204); } -void draw() { - background(0); +void draw() { + background(126); a += 0.005; if(a > TWO_PI) { @@ -30,10 +30,12 @@ void draw() { rotateX(a); rotateY(a * 2.0); + fill(255); rect(-rSize, -rSize, rSize*2, rSize*2); rotateX(a * 1.001); rotateY(a * 2.002); + fill(0); rect(-rSize, -rSize, rSize*2, rSize*2); -} +} diff --git a/android/examples/OpenGL/Advanced/Particles/Particle.pde b/android/examples/Demos/Graphics/Particles/Particle.pde similarity index 100% rename from android/examples/OpenGL/Advanced/Particles/Particle.pde rename to android/examples/Demos/Graphics/Particles/Particle.pde diff --git a/android/examples/OpenGL/Advanced/Particles/ParticleSystem.pde b/android/examples/Demos/Graphics/Particles/ParticleSystem.pde similarity index 100% rename from android/examples/OpenGL/Advanced/Particles/ParticleSystem.pde rename to android/examples/Demos/Graphics/Particles/ParticleSystem.pde diff --git a/android/examples/OpenGL/Advanced/Particles/Particles.pde b/android/examples/Demos/Graphics/Particles/Particles.pde similarity index 87% rename from android/examples/OpenGL/Advanced/Particles/Particles.pde rename to android/examples/Demos/Graphics/Particles/Particles.pde index aad1a1bfb..4d9cd03e6 100644 --- a/android/examples/OpenGL/Advanced/Particles/Particles.pde +++ b/android/examples/Demos/Graphics/Particles/Particles.pde @@ -4,10 +4,10 @@ ParticleSystem ps; PImage sprite; void setup() { - size(640, 400, P3D); + size(displayWidth, displayHeight, P2D); orientation(LANDSCAPE); sprite = loadImage("sprite.png"); - ps = new ParticleSystem(1000); + ps = new ParticleSystem(2000); // Writing to the depth buffer is disabled to avoid rendering // artifacts due to the fact that the particles are semi-transparent @@ -25,7 +25,6 @@ void draw () { fill(255); textSize(16); text("Frame rate: " + int(frameRate),10,20); - } - + diff --git a/android/examples/OpenGL/Advanced/Patch/Patch.pde b/android/examples/Demos/Graphics/Patch/Patch.pde similarity index 98% rename from android/examples/OpenGL/Advanced/Patch/Patch.pde rename to android/examples/Demos/Graphics/Patch/Patch.pde index 5ac82ff4f..2b11d6f3a 100644 --- a/android/examples/OpenGL/Advanced/Patch/Patch.pde +++ b/android/examples/Demos/Graphics/Patch/Patch.pde @@ -10,7 +10,7 @@ PVector normp[][]; boolean autoNormals = false; void setup() { - size(600, 600, P3D); + size(displayWidth, displayHeight, P3D); orientation(LANDSCAPE); build(); } @@ -159,4 +159,4 @@ double DBezierBlend(int k, double mu, int n) { dblendf *= (dk * fnk + fk * dnk); return(dblendf); -} +} diff --git a/android/examples/OpenGL/Advanced/Planets/Perlin.pde b/android/examples/Demos/Graphics/Planets/Perlin.pde similarity index 100% rename from android/examples/OpenGL/Advanced/Planets/Perlin.pde rename to android/examples/Demos/Graphics/Planets/Perlin.pde diff --git a/android/examples/OpenGL/Advanced/Planets/Planets.pde b/android/examples/Demos/Graphics/Planets/Planets.pde similarity index 100% rename from android/examples/OpenGL/Advanced/Planets/Planets.pde rename to android/examples/Demos/Graphics/Planets/Planets.pde diff --git a/android/examples/OpenGL/Advanced/Ribbons/ArcBall.pde b/android/examples/Demos/Graphics/Ribbons/ArcBall.pde similarity index 100% rename from android/examples/OpenGL/Advanced/Ribbons/ArcBall.pde rename to android/examples/Demos/Graphics/Ribbons/ArcBall.pde diff --git a/android/examples/OpenGL/Advanced/Ribbons/BSpline.pde b/android/examples/Demos/Graphics/Ribbons/BSpline.pde similarity index 100% rename from android/examples/OpenGL/Advanced/Ribbons/BSpline.pde rename to android/examples/Demos/Graphics/Ribbons/BSpline.pde diff --git a/android/examples/OpenGL/Advanced/Ribbons/Geometry.pde b/android/examples/Demos/Graphics/Ribbons/Geometry.pde similarity index 100% rename from android/examples/OpenGL/Advanced/Ribbons/Geometry.pde rename to android/examples/Demos/Graphics/Ribbons/Geometry.pde diff --git a/android/examples/OpenGL/Advanced/Ribbons/PDB.pde b/android/examples/Demos/Graphics/Ribbons/PDB.pde similarity index 100% rename from android/examples/OpenGL/Advanced/Ribbons/PDB.pde rename to android/examples/Demos/Graphics/Ribbons/PDB.pde diff --git a/android/examples/OpenGL/Advanced/Ribbons/Ribbons.pde b/android/examples/Demos/Graphics/Ribbons/Ribbons.pde similarity index 94% rename from android/examples/OpenGL/Advanced/Ribbons/Ribbons.pde rename to android/examples/Demos/Graphics/Ribbons/Ribbons.pde index 84f1e513c..0a0f7cc23 100644 --- a/android/examples/OpenGL/Advanced/Ribbons/Ribbons.pde +++ b/android/examples/Demos/Graphics/Ribbons/Ribbons.pde @@ -22,7 +22,7 @@ ArrayList models; Arcball arcball; void setup() { - size(800, 600, P3D); + size(displayWidth, displayHeight, P3D); orientation(LANDSCAPE); arcball = new Arcball(width/2, height/2, 600); @@ -31,9 +31,10 @@ void setup() { void draw() { background(0); - - lights(); - + + ambient(80); + lights(); + translate(width/2, height/2, 200); arcball.run(); @@ -48,4 +49,4 @@ void mousePressed(){ void mouseDragged(){ arcball.mouseDragged(); -} +} diff --git a/android/examples/OpenGL/Advanced/Ribbons/data/1CBS.pdb b/android/examples/Demos/Graphics/Ribbons/data/1CBS.pdb similarity index 100% rename from android/examples/OpenGL/Advanced/Ribbons/data/1CBS.pdb rename to android/examples/Demos/Graphics/Ribbons/data/1CBS.pdb diff --git a/android/examples/OpenGL/Advanced/Ribbons/data/2POR.pdb b/android/examples/Demos/Graphics/Ribbons/data/2POR.pdb similarity index 100% rename from android/examples/OpenGL/Advanced/Ribbons/data/2POR.pdb rename to android/examples/Demos/Graphics/Ribbons/data/2POR.pdb diff --git a/android/examples/OpenGL/Advanced/Ribbons/data/4HHB.pdb b/android/examples/Demos/Graphics/Ribbons/data/4HHB.pdb similarity index 100% rename from android/examples/OpenGL/Advanced/Ribbons/data/4HHB.pdb rename to android/examples/Demos/Graphics/Ribbons/data/4HHB.pdb diff --git a/android/examples/OpenGL/Form/Geometry/Geometry.pde b/android/examples/Demos/Graphics/RotatingArcs/RotatingArcs.pde similarity index 100% rename from android/examples/OpenGL/Form/Geometry/Geometry.pde rename to android/examples/Demos/Graphics/RotatingArcs/RotatingArcs.pde diff --git a/android/examples/OpenGL/Advanced/Trefoil/Surface.pde b/android/examples/Demos/Graphics/Trefoil/Surface.pde similarity index 100% rename from android/examples/OpenGL/Advanced/Trefoil/Surface.pde rename to android/examples/Demos/Graphics/Trefoil/Surface.pde diff --git a/android/examples/OpenGL/Advanced/Trefoil/Trefoil.pde b/android/examples/Demos/Graphics/Trefoil/Trefoil.pde similarity index 100% rename from android/examples/OpenGL/Advanced/Trefoil/Trefoil.pde rename to android/examples/Demos/Graphics/Trefoil/Trefoil.pde diff --git a/android/examples/OpenGL/Advanced/Wiggling/Wiggling.pde b/android/examples/Demos/Graphics/Wiggling/Wiggling.pde similarity index 100% rename from android/examples/OpenGL/Advanced/Wiggling/Wiggling.pde rename to android/examples/Demos/Graphics/Wiggling/Wiggling.pde diff --git a/android/examples/OpenGL/Animation/Yellowtail/Gesture.pde b/android/examples/Demos/Graphics/Yellowtail/Gesture.pde similarity index 100% rename from android/examples/OpenGL/Animation/Yellowtail/Gesture.pde rename to android/examples/Demos/Graphics/Yellowtail/Gesture.pde diff --git a/android/examples/OpenGL/Animation/Yellowtail/Polygon.pde b/android/examples/Demos/Graphics/Yellowtail/Polygon.pde similarity index 100% rename from android/examples/OpenGL/Animation/Yellowtail/Polygon.pde rename to android/examples/Demos/Graphics/Yellowtail/Polygon.pde diff --git a/android/examples/OpenGL/Animation/Yellowtail/Vec3f.pde b/android/examples/Demos/Graphics/Yellowtail/Vec3f.pde similarity index 100% rename from android/examples/OpenGL/Animation/Yellowtail/Vec3f.pde rename to android/examples/Demos/Graphics/Yellowtail/Vec3f.pde diff --git a/android/examples/OpenGL/Animation/Yellowtail/Yellowtail.pde b/android/examples/Demos/Graphics/Yellowtail/Yellowtail.pde similarity index 100% rename from android/examples/OpenGL/Animation/Yellowtail/Yellowtail.pde rename to android/examples/Demos/Graphics/Yellowtail/Yellowtail.pde diff --git a/android/examples/OpenGL/Performance/CubicGridImmediate/CubicGridImmediate.pde b/android/examples/Demos/Performance/CubicGridImmediate/CubicGridImmediate.pde similarity index 100% rename from android/examples/OpenGL/Performance/CubicGridImmediate/CubicGridImmediate.pde rename to android/examples/Demos/Performance/CubicGridImmediate/CubicGridImmediate.pde diff --git a/android/examples/OpenGL/Performance/CubicGridRetained/CubicGridRetained.pde b/android/examples/Demos/Performance/CubicGridRetained/CubicGridRetained.pde similarity index 100% rename from android/examples/OpenGL/Performance/CubicGridRetained/CubicGridRetained.pde rename to android/examples/Demos/Performance/CubicGridRetained/CubicGridRetained.pde diff --git a/android/examples/OpenGL/Performance/DynamicParticlesImmediate/DynamicParticlesImmediate.pde b/android/examples/Demos/Performance/DynamicParticlesImmediate/DynamicParticlesImmediate.pde similarity index 100% rename from android/examples/OpenGL/Performance/DynamicParticlesImmediate/DynamicParticlesImmediate.pde rename to android/examples/Demos/Performance/DynamicParticlesImmediate/DynamicParticlesImmediate.pde diff --git a/android/examples/OpenGL/Performance/DynamicParticlesRetained/DynamicParticlesRetained.pde b/android/examples/Demos/Performance/DynamicParticlesRetained/DynamicParticlesRetained.pde similarity index 100% rename from android/examples/OpenGL/Performance/DynamicParticlesRetained/DynamicParticlesRetained.pde rename to android/examples/Demos/Performance/DynamicParticlesRetained/DynamicParticlesRetained.pde diff --git a/android/examples/OpenGL/Performance/Esfera/Esfera.pde b/android/examples/Demos/Performance/Esfera/Esfera.pde similarity index 100% rename from android/examples/OpenGL/Performance/Esfera/Esfera.pde rename to android/examples/Demos/Performance/Esfera/Esfera.pde diff --git a/android/examples/OpenGL/Performance/LineRendering/LineRendering.pde b/android/examples/Demos/Performance/LineRendering/LineRendering.pde similarity index 100% rename from android/examples/OpenGL/Performance/LineRendering/LineRendering.pde rename to android/examples/Demos/Performance/LineRendering/LineRendering.pde diff --git a/android/examples/OpenGL/Performance/QuadRendering/QuadRendering.pde b/android/examples/Demos/Performance/QuadRendering/QuadRendering.pde similarity index 100% rename from android/examples/OpenGL/Performance/QuadRendering/QuadRendering.pde rename to android/examples/Demos/Performance/QuadRendering/QuadRendering.pde diff --git a/android/examples/OpenGL/Performance/StaticParticlesImmediate/StaticParticlesImmediate.pde b/android/examples/Demos/Performance/StaticParticlesImmediate/StaticParticlesImmediate.pde similarity index 100% rename from android/examples/OpenGL/Performance/StaticParticlesImmediate/StaticParticlesImmediate.pde rename to android/examples/Demos/Performance/StaticParticlesImmediate/StaticParticlesImmediate.pde diff --git a/android/examples/OpenGL/Performance/StaticParticlesRetained/StaticParticlesRetained.pde b/android/examples/Demos/Performance/StaticParticlesRetained/StaticParticlesRetained.pde similarity index 100% rename from android/examples/OpenGL/Performance/StaticParticlesRetained/StaticParticlesRetained.pde rename to android/examples/Demos/Performance/StaticParticlesRetained/StaticParticlesRetained.pde diff --git a/android/examples/OpenGL/Performance/TextRendering/TextRendering.pde b/android/examples/Demos/Performance/TextRendering/TextRendering.pde similarity index 100% rename from android/examples/OpenGL/Performance/TextRendering/TextRendering.pde rename to android/examples/Demos/Performance/TextRendering/TextRendering.pde diff --git a/android/examples/OpenGL/Tests/OffscreenTest/OffscreenTest.pde b/android/examples/Demos/Tests/OffscreenTest/OffscreenTest.pde similarity index 100% rename from android/examples/OpenGL/Tests/OffscreenTest/OffscreenTest.pde rename to android/examples/Demos/Tests/OffscreenTest/OffscreenTest.pde diff --git a/android/examples/OpenGL/Tests/RedrawTest/RedrawTest.pde b/android/examples/Demos/Tests/RedrawTest/RedrawTest.pde similarity index 100% rename from android/examples/OpenGL/Tests/RedrawTest/RedrawTest.pde rename to android/examples/Demos/Tests/RedrawTest/RedrawTest.pde diff --git a/android/examples/OpenGL/Camera/NearFar/NearFar.pde b/android/examples/OpenGL/Camera/NearFar/NearFar.pde deleted file mode 100644 index eb17f146a..000000000 --- a/android/examples/OpenGL/Camera/NearFar/NearFar.pde +++ /dev/null @@ -1,119 +0,0 @@ -// Issues: The interaction is terrible on Android, and the visual cues are not -// visible. - -/** - * Near and Far example - * - * This example shows the effect of setting the near and far values - * in the ortho() and perspective() functions. Both values are always - * measured from the camera eye position and along the eye-center - * vector. - * - * The spacebar switches between perspective and orthographic - * projections, to set the near value press 'n' and 'f' for far. - * A mouse click switches the near/far setting on and off. - * 'r' enables/disables rotating the object with the mouse. - */ - -boolean usingPerspective = true; -boolean settingFar = true; -boolean settingEnabled = true; -boolean rotating = false; - -float cameraFOV; -float cameraZ; -float cameraMaxFar; -float cameraNear; -float cameraFar; - -float angleX = -PI/6; -float angleY = PI/3; - -void setup() { - size(640, 360, P3D); - orientation(LANDSCAPE); - - cameraFOV = PI/3.0; - cameraZ = (height/2.0) / tan(cameraFOV/2.0); - cameraMaxFar = cameraZ * 2.0; - - cameraNear = cameraZ / 2.0; - cameraFar = cameraZ * 2.0; -} - -void draw() { - background(0); - lights(); - - if (settingEnabled) { - if (settingFar) { - float minx = map(cameraNear, 0, cameraMaxFar, 0, width); - cameraFar = map(mouseX, minx, width, cameraNear, cameraMaxFar); - } else { - float maxx = map(cameraFar, 0, cameraMaxFar, 0, width); - cameraNear = map(mouseX, 0, maxx, 0, cameraFar); - } - } - - if (usingPerspective) { - perspective(cameraFOV, float(width)/float(height), cameraNear, cameraFar); - } else { - ortho(-width/2, width/2, -height/2, height/2, cameraNear, cameraFar); - } - - pushMatrix(); - - translate(width/2, height/2, 0); - - if (rotating) { - angleX = map(mouseX, 0, width, -PI, PI); - angleY = map(mouseY, 0, width, -PI, PI); - } - rotateX(angleX); - rotateY(angleY); - - stroke(50); - fill(204); - box(160); - - popMatrix(); - - // Drawing visual clues for the near and far values. - perspective(); // Restoring to the default perspective matrix. - noStroke(); - float near = map(cameraNear, 0, cameraMaxFar, 0, width); - float far = map(cameraFar, 0, cameraMaxFar, 0, width); - fill(204); - rect(0, 0, near, 20); - rect(far, 0, width - far, 20); - if (near <= far) { - fill(160); - } else { - fill(200, 50, 50); - } - rect(near, 0, far - near, 20); -} - -void keyPressed() { - if (key == ' ') { - usingPerspective = !usingPerspective; - } else if (key == 'f' || key == 'F') { - settingFar = true; - } else if (key == 'n' || key == 'N') { - settingFar = false; - } else if (key == 'r' || key == 'R') { - if (rotating) { - rotating = false; - } else { - rotating = true; - settingEnabled = false; - } - } -} - -void mousePressed() { - if (!rotating) { - settingEnabled = !settingEnabled; - } -} - diff --git a/android/examples/OpenGL/Camera/OrthoVSPerspective/OrthoVSPerspective.pde b/android/examples/OpenGL/Camera/OrthoVSPerspective/OrthoVSPerspective.pde deleted file mode 100644 index 01e67a06b..000000000 --- a/android/examples/OpenGL/Camera/OrthoVSPerspective/OrthoVSPerspective.pde +++ /dev/null @@ -1,40 +0,0 @@ -/** - * Ortho vs Perspective. - * - * Click to see the difference between orthographic projection - * and perspective projection as applied to a simple box. - * The ortho() function sets an orthographic projection and - * defines a parallel clipping volume. All objects with the - * same dimension appear the same size, regardless of whether - * they are near or far from the camera. The parameters to this - * function specify the clipping volume where left and right - * are the minimum and maximum x values, top and bottom are the - * minimum and maximum y values, and near and far are the minimum - * and maximum z values. - */ - -void setup() { - size(640, 360, P3D); - orientation(LANDSCAPE); - noStroke(); - fill(204); -} - -void draw() { - background(0); - lights(); - - if(mousePressed) { - float fov = PI/3.0; - float cameraZ = (height/2.0) / tan(fov/2.0); - perspective(fov, float(width)/float(height), - cameraZ/2.0, cameraZ*2.0); - } else { - ortho(-width/2, width/2, -height/2, height/2, 0, 400); - } - - translate(width/2, height/2, 0); - rotateX(-PI/6); - rotateY(PI/3); - box(160); -} diff --git a/android/examples/OpenGL/Form/BrickTower/BrickTower.pde b/android/examples/OpenGL/Form/BrickTower/BrickTower.pde deleted file mode 100644 index 88f25d63e..000000000 --- a/android/examples/OpenGL/Form/BrickTower/BrickTower.pde +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Brick Tower - * by Ira Greenberg. - * - * 3D castle tower constructed out of individual bricks. - * Uses the PVector and Cube classes. - */ - -float bricksPerLayer = 16.0; -float brickLayers = 18.0; -Cube brick; -float brickWidth = 60, brickHeight = 25, brickDepth = 25; -float radius = 175.0; -float angle = 0; - -void setup(){ - size(640, 360, P3D); - orientation(LANDSCAPE); - brick = new Cube(brickWidth, brickHeight, brickDepth); -} - -void draw(){ - background(0); - float tempX = 0, tempY = 0, tempZ = 0; - fill(182, 62, 29); - noStroke(); - // Add basic light setup - lights(); - translate(width/2, height*1.2, -380); - // Tip tower to see inside - rotateX(radians(-45)); - // Slowly rotate tower - rotateY(frameCount * PI/600); - for (int i = 0; i < brickLayers; i++){ - // Increment rows - tempY-=brickHeight; - // Alternate brick seams - angle = 360.0 / bricksPerLayer * i/2; - for (int j = 0; j < bricksPerLayer; j++){ - tempZ = cos(radians(angle))*radius; - tempX = sin(radians(angle))*radius; - pushMatrix(); - translate(tempX, tempY, tempZ); - rotateY(radians(angle)); - // Add crenelation - if (i==brickLayers-1){ - if (j%2 == 0){ - brick.create(); - } - } - // Create main tower - else { - brick.create(); - } - popMatrix(); - angle += 360.0/bricksPerLayer; - } - } -} diff --git a/android/examples/OpenGL/Form/BrickTower/Cube.pde b/android/examples/OpenGL/Form/BrickTower/Cube.pde deleted file mode 100644 index df772c0cf..000000000 --- a/android/examples/OpenGL/Form/BrickTower/Cube.pde +++ /dev/null @@ -1,68 +0,0 @@ -class Cube { - - PVector[] vertices = new PVector[24]; - PVector[] normals = new PVector[6]; - float w, h, d; - - Cube(){ } - - Cube(float w, float h, float d){ - this.w = w; - this.h = h; - this.d = d; - - // Cube composed of 6 quads - // Front - normals[0] = new PVector(0, 0, 1); - vertices[0] = new PVector(-w/2, -h/2, d/2); - vertices[1] = new PVector(w/2, -h/2, d/2); - vertices[2] = new PVector(w/2, h/2, d/2); - vertices[3] = new PVector(-w/2, h/2, d/2); - - // Left - normals[1] = new PVector(-1, 0, 0); - vertices[4] = new PVector(-w/2, -h/2, d/2); - vertices[5] = new PVector(-w/2, -h/2, -d/2); - vertices[6] = new PVector(-w/2, h/2, -d/2); - vertices[7] = new PVector(-w/2, h/2, d/2); - - // Right - normals[2] = new PVector(1, 0, 0); - vertices[8] = new PVector(w/2, -h/2, d/2); - vertices[9] = new PVector(w/2, -h/2, -d/2); - vertices[10] = new PVector(w/2, h/2, -d/2); - vertices[11] = new PVector(w/2, h/2, d/2); - - // Back - normals[3] = new PVector(0, 0, -1); - vertices[12] = new PVector(-w/2, -h/2, -d/2); - vertices[13] = new PVector(w/2, -h/2, -d/2); - vertices[14] = new PVector(w/2, h/2, -d/2); - vertices[15] = new PVector(-w/2, h/2, -d/2); - - // Top - normals[4] = new PVector(0, 1, 0); - vertices[16] = new PVector(-w/2, -h/2, d/2); - vertices[17] = new PVector(-w/2, -h/2, -d/2); - vertices[18] = new PVector(w/2, -h/2, -d/2); - vertices[19] = new PVector(w/2, -h/2, d/2); - - // Bottom - normals[5] = new PVector(0, 1, 0); - vertices[20] = new PVector(-w/2, h/2, d/2); - vertices[21] = new PVector(-w/2, h/2, -d/2); - vertices[22] = new PVector(w/2, h/2, -d/2); - vertices[23] = new PVector(w/2, h/2, d/2); - } - - void create(){ - for (int i=0; i<6; i++){ - beginShape(QUADS); - normal(normals[i].x, normals[i].y, normals[i].z); - for (int j = 0; j < 4; j++){ - vertex(vertices[j+4*i].x, vertices[j+4*i].y, vertices[j+4*i].z); - } - endShape(); - } - } -} \ No newline at end of file diff --git a/android/examples/OpenGL/Form/CubicGrid/CubicGrid.pde b/android/examples/OpenGL/Form/CubicGrid/CubicGrid.pde deleted file mode 100644 index 069550266..000000000 --- a/android/examples/OpenGL/Form/CubicGrid/CubicGrid.pde +++ /dev/null @@ -1,49 +0,0 @@ -/** - * Cubic Grid - * by Ira Greenberg. - * - * 3D translucent colored grid uses nested pushMatrix() - * and popMatrix() functions. - */ - -float boxSize = 80; -float margin = boxSize*2; -float depth = 400; -color boxFill; - -void setup() { - size(640, 360, P3D); - orientation(LANDSCAPE); - noStroke(); - hint(DISABLE_DEPTH_TEST); -} - -void draw() { - background(255); - - // Center and spin grid - translate(width/2, height/2, -depth); - rotateY(frameCount * 0.01); - rotateX(frameCount * 0.01); - - // Build grid using multiple translations - for (float i =- depth/2+margin; i <= depth/2-margin; i += boxSize){ - pushMatrix(); - for (float j =- height+margin; j <= height-margin; j += boxSize){ - pushMatrix(); - for (float k =- width+margin; k <= width-margin; k += boxSize){ - // Base fill color on counter values, abs function - // ensures values stay within legal range - boxFill = color(abs(i), abs(j), abs(k), 50); - pushMatrix(); - translate(k, j, i); - fill(boxFill); - box(boxSize, boxSize, boxSize); - popMatrix(); - } - popMatrix(); - } - popMatrix(); - } -} - diff --git a/android/examples/OpenGL/Form/RunAmuck/Legs.pde b/android/examples/OpenGL/Form/RunAmuck/Legs.pde deleted file mode 100644 index eb74d7859..000000000 --- a/android/examples/OpenGL/Form/RunAmuck/Legs.pde +++ /dev/null @@ -1,162 +0,0 @@ -/** - * Legs class - * By Ira Greenberg
- * Processing for Flash Developers, - * Friends of ED, 2009 - */ - -class Legs { - // Instance properties with default values - float x = 0, y = 0, z = 0, w = 150, ht = 125; - color col = #77AA22; - // Advanced properties - float detailW = w/6.0; - float detailHt = ht/8.0; - float shoeBulge = detailHt*2.0; - float legGap = w/7.0; - - // Dynamics properties - float velocity = .02, stepL, stepR, stepRate = random(10, 50); - float speedX = 1.0, speedZ, spring, damping = .5, theta; - - // Default constructor - Legs() { - } - - // Standard constructor - Legs(float x, float z, float w, float ht, color col) { - this.x = x; - this.z = z; - this.w = w; - this.ht = ht; - this.col = col; - fill(col); - detailW = w/6.0; - detailHt = ht/8.0; - shoeBulge = detailHt*2.0; - legGap = w/7.0; - speedX = random(-speedX, speedX); - } - - // Advanced constructor - Legs(float x, float z, float w, float ht, color col, float detailW, - float detailHt, float shoeBulge, float legGap) { - this.x = x; - this.z = z; - this.w = w; - this.ht = ht; - this.col = col; - this.detailW = detailW; - this.detailHt = detailHt; - this.shoeBulge = shoeBulge; - this.legGap = legGap; - speedX = random(-speedX, speedX); - } - - // Draw legs - void create() { - fill(col); - float footWidth = (w - legGap)/2; - beginShape(); - vertex(x - w/2, y - ht, z); - vertex(x - w/2, y - ht + detailHt, z); - vertex(x - w/2 + detailW, y - ht + detailHt, z); - // left foot - vertex(x - w/2 + detailW, y + stepL, z); - curveVertex(x - w/2 + detailW, y + stepL, z); - curveVertex(x - w/2 + detailW, y + stepL, z); - curveVertex(x - w/2 + detailW - shoeBulge, y + detailHt/2 + stepL, z); - curveVertex(x - w/2, y + detailHt + stepL, z); - curveVertex(x - w/2, y + detailHt + stepL, z); - vertex(x - w/2 + footWidth, y + detailHt + stepL*.9, z); - // end left foot - vertex(x - w/2 + footWidth + legGap/2, y - ht + detailHt, z); - vertex(x - w/2 + footWidth + legGap/2, y - ht + detailHt, z); - // right foot - vertex(x - w/2 + footWidth + legGap, y + detailHt + stepR*.9, z); - vertex(x + w/2, y + detailHt + stepR, z); - curveVertex(x + w/2, y + detailHt + stepR, z); - curveVertex(x + w/2, y + detailHt + stepR, z); - curveVertex(x + w/2 - detailW + shoeBulge, y + detailHt/2 + stepR, z); - curveVertex(x + w/2 - detailW, y + stepR, z); - vertex(x + w/2 - detailW, y + stepR, z); - // end right foot - vertex(x + w/2 - detailW, y - ht + detailHt, z); - vertex(x + w/2, y - ht + detailHt, z); - vertex(x + w/2, y - ht, z); - endShape(CLOSE); - } - - // Set advanced property values - void setDetails(float detailW, float detailHt, float shoeBulge, float legGap) { - this.detailW = detailW; - this.detailHt = detailHt; - this.shoeBulge = shoeBulge; - this.legGap = legGap; - } - - // Make the legs step - void step(float stepRate) { - this.stepRate = stepRate; - spring = ht/2.0; - stepL = sin(theta)*spring; - stepR = cos(theta)*spring; - theta += radians(stepRate); - } - - // Alternative overloaded step method - void step() { - spring = ht/2.0; - stepL = sin(theta)*spring; - stepR = cos(theta)*spring; - theta += radians(stepRate); - } - - - // Moves legs along x, y, z axes - void move() { - // Move legs along y-axis - y = stepR*damping; - - // Move legs along x-axis and - // check for collision against frame edge - x += speedX; - if (screenX(x, y, z) > width) { - speedX *= -1; - } - if (screenX(x, y, z) < 0) { - speedX *= -1; - } - - // Move legs along z-axis based on speed of stepping - // and check for collision against extremes - speedZ = (stepRate*velocity); - z += speedZ; - if (z > 400) { - z = 400; - velocity *= -1; - } - if (z < -100) { - z = -100; - velocity *= -1; - } - } - - void setDynamics(float speedX, float spring, float damping) { - this.speedX = speedX; - this.spring = spring; - this.damping = damping; - } -} - - - - - - - - - - - - diff --git a/android/examples/OpenGL/Form/RunAmuck/RunAmuck.pde b/android/examples/OpenGL/Form/RunAmuck/RunAmuck.pde deleted file mode 100644 index 555301537..000000000 --- a/android/examples/OpenGL/Form/RunAmuck/RunAmuck.pde +++ /dev/null @@ -1,46 +0,0 @@ -/** - * Run-Amuck - * By Ira Greenberg
- * Processing for Flash Developers, - * Friends of ED, 2009 - */ - -int count = 10; -Legs[] legs = new Legs[count]; - -void setup() { - size(640, 360, P3D); - orientation(LANDSCAPE); - noStroke(); - for (int i = 0; i < legs.length; i++) { - legs[i] = new Legs(random(-10, 10), random(-50, 150), random(.5, 5), - random(.5, 5), color(random(255), random(255), random(255))); - } -} - -void draw() { - background(0); - translate(width/2, height/2); - noStroke(); - fill(35); - - // Draw ground plane - beginShape(); - vertex(-width*2, 0, -1000); - vertex(width*2, 0, -1000); - vertex(width/2, height/2, 400); - vertex(-width/2, height/2, 400); - endShape(CLOSE); - - // Update and draw the legs - for (int i = 0; i < legs.length; i++) { - legs[i].create(); - // Set foot step rate - legs[i].step(random(10, 50)); - // Move legs along x, y, z axes - // z-movement dependent upon step rate - legs[i].move(); - } -} - - diff --git a/android/examples/OpenGL/Form/TexturedSphere/TexturedSphere.pde b/android/examples/OpenGL/Form/TexturedSphere/TexturedSphere.pde deleted file mode 100644 index 917eee34b..000000000 --- a/android/examples/OpenGL/Form/TexturedSphere/TexturedSphere.pde +++ /dev/null @@ -1,61 +0,0 @@ -/** - * Textured Sphere - * by Mike 'Flux' Chang (cleaned up by Aaron Koblin). - * Based on code by Toxi. - * - * A 3D textured sphere with simple rotation control. - * Note: Controls will be inverted when sphere is upside down. - * Use an "arc ball" to deal with this appropriately. - */ - -PShape globe; -PImage texmap; - -int sDetail = 30; // Sphere detail setting -float rotationX = 0; -float rotationY = 0; -float velocityX = 0; -float velocityY = 0; -float globeRadius = 350; -float pushBack = -300; - -float[] cx, cz, sphereX, sphereY, sphereZ; -float sinLUT[]; -float cosLUT[]; -float SINCOS_PRECISION = 0.5; -int SINCOS_LENGTH = int(360.0 / SINCOS_PRECISION); - - -void setup() { - size(displayWidth, displayHeight, P3D); - - sphereDetail(sDetail); - texmap = loadImage("world32k.jpg"); - globe = createShape(SPHERE, globeRadius); - globe.noStroke(); - globe.texture(texmap); -} - -void draw() { - background(0); - renderGlobe(); -} - -void renderGlobe() { - translate(width/2.0, height/2.0, pushBack); - lights(); - rotateX(radians(-rotationX)); - rotateY(radians(-rotationY)); - shape(globe); - - rotationX += velocityX; - rotationY += velocityY; - velocityX *= 0.95; - velocityY *= 0.95; - - // Implements mouse control (interaction will be inverse when sphere is upside down) - if(mousePressed){ - velocityX += (mouseY-pmouseY) * 0.01; - velocityY -= (mouseX-pmouseX) * 0.01; - } -} diff --git a/android/examples/OpenGL/IO/LoadOBJ/LoadOBJ.pde b/android/examples/OpenGL/IO/LoadOBJ/LoadOBJ.pde deleted file mode 100644 index 637ddd273..000000000 --- a/android/examples/OpenGL/IO/LoadOBJ/LoadOBJ.pde +++ /dev/null @@ -1,19 +0,0 @@ -PShape rocket; - -public void setup() { - size(640, 360, P3D); - orientation(LANDSCAPE); - - rocket = loadShape("rocket.obj"); -} - -public void draw() { - background(0); - - lights(); - - translate(width/2, height/2 + 100, -200); - rotateX(PI); - rotateY(frameCount * 0.01f); - shape(rocket); -} diff --git a/android/examples/OpenGL/IO/LoadSVG/LoadSVG.pde b/android/examples/OpenGL/IO/LoadSVG/LoadSVG.pde deleted file mode 100644 index 3dcaf6c63..000000000 --- a/android/examples/OpenGL/IO/LoadSVG/LoadSVG.pde +++ /dev/null @@ -1,35 +0,0 @@ -PShape world; -float resizeFactor; -float offsetX, offsetY; - -void setup() { - size(displayWidth, displayWidth, P2D); - orientation(LANDSCAPE); - - world = loadShape("World_map-lowres.svg"); - - PVector top = world.getTop(); - world.translate(-top.x, -top.y); - - - float r = world.getWidth() / world.getHeight(); - float w = width; - float h = width / r; - if (height < h) { - h = height; - w = r * h; - offsetX = (width - w) / 2; - offsetY = 0; - } else { - offsetX = 0; - offsetY = (height - h) / 2; - } - resizeFactor = w / world.getWidth(); - - world.scale(resizeFactor); -} - -public void draw() { - shape(world); -} - diff --git a/android/examples/OpenGL/IO/LoadSVG/data/World_map-lowres.svg b/android/examples/OpenGL/IO/LoadSVG/data/World_map-lowres.svg deleted file mode 100644 index b587dd669..000000000 --- a/android/examples/OpenGL/IO/LoadSVG/data/World_map-lowres.svg +++ /dev/null @@ -1,345 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/android/examples/OpenGL/Image/Blending/Blending.pde b/android/examples/OpenGL/Image/Blending/Blending.pde deleted file mode 100644 index 87e88b83e..000000000 --- a/android/examples/OpenGL/Image/Blending/Blending.pde +++ /dev/null @@ -1,81 +0,0 @@ -// Blending, by Andres Colubri -// Images can be blended using one of the 10 blending modes -// available in P3D. -// Images by Kevin Bjorke. - -PImage pic1, pic2; -int selMode = REPLACE; -String name = "replace"; -int picAlpha = 255; - -void setup() { - size(800, 480, P3D); - orientation(LANDSCAPE); - - PFont font = createFont(PFont.list()[0], 20); - textFont(font, 20); - - pic1 = loadImage("bjorke1.jpg"); - pic2 = loadImage("bjorke2.jpg"); -} - -void draw() { - background(0); - - tint(255, 255); - image(pic1, 0, 0, pic1.width, pic1.height); - - blendMode(selMode); - tint(255, picAlpha); - image(pic2, 0, 0, pic2.width, pic2.height); - - blendMode(REPLACE); - fill(200, 50, 50); - rect(0, height - 50, map(picAlpha, 0, 255, 0, width), 50); - fill(255); - - text("Selected blend mode: " + name + ". Click to move to next", 10, pic1.height + 30); - text("Drag this bar to change alpha of image", 10, height - 18); -} - -void mousePressed() { - if (height - 50 < mouseY) return; - - if (selMode == REPLACE) { - selMode = BLEND; - name = "blend"; - } else if (selMode == BLEND) { - selMode = ADD; - name = "add"; - } else if (selMode == ADD) { - selMode = SUBTRACT; - name = "subtract"; - } else if (selMode == SUBTRACT) { - selMode = LIGHTEST; - name = "lightest"; - } else if (selMode == LIGHTEST) { - selMode = DARKEST; - name = "darkest"; - } else if (selMode == DARKEST) { - selMode = DIFFERENCE; - name = "difference"; - } else if (selMode == DIFFERENCE) { - selMode = EXCLUSION; - name = "exclusion"; - } else if (selMode == EXCLUSION) { - selMode = MULTIPLY; - name = "multiply"; - } else if (selMode == MULTIPLY) { - selMode = SCREEN; - name = "screen"; - } else if (selMode == SCREEN) { - selMode = REPLACE; - name = "replace"; - } -} - -void mouseDragged() { - if (height - 50 < mouseY) { - picAlpha = int(map(mouseX, 0, width, 0, 255)); - } -} diff --git a/android/examples/OpenGL/Image/Explode/Explode.pde b/android/examples/OpenGL/Image/Explode/Explode.pde deleted file mode 100644 index 259f5f368..000000000 --- a/android/examples/OpenGL/Image/Explode/Explode.pde +++ /dev/null @@ -1,47 +0,0 @@ -// Issues: the image appears corrupted... - -/** - * Explode - * by Daniel Shiffman. - * - * Mouse horizontal location controls breaking apart of image and - * Maps pixels from a 2D image into 3D space. Pixel brightness controls - * translation along z axis. - */ - -PImage img; // The source image -int cellsize = 2; // Dimensions of each cell in the grid -int columns, rows; // Number of columns and rows in our system - -void setup() { - size(640, 360, P3D); - orientation(LANDSCAPE); - img = loadImage("eames.jpg"); // Load the image - columns = img.width / cellsize; // Calculate # of columns - rows = img.height / cellsize; // Calculate # of rows - img.loadPixels(); -} - -void draw() { - background(0); - // Begin loop for columns - for ( int i = 0; i < columns; i++) { - // Begin loop for rows - for ( int j = 0; j < rows; j++) { - int x = i*cellsize + cellsize/2; // x position - int y = j*cellsize + cellsize/2; // y position - int loc = x + y*img.width; // Pixel array location - color c = img.pixels[loc]; // Grab the color - // Calculate a z position as a function of mouseX and pixel brightness - float z = (mouseX / float(width)) * brightness(img.pixels[loc]) - 20.0; - // Translate to the location, set fill and stroke, and draw the rect - pushMatrix(); - translate(x + 200, y + 100, z); - fill(c, 204); - noStroke(); - rectMode(CENTER); - rect(0, 0, cellsize, cellsize); - popMatrix(); - } - } -} diff --git a/android/examples/OpenGL/Image/Extrusion/Extrusion.pde b/android/examples/OpenGL/Image/Extrusion/Extrusion.pde deleted file mode 100644 index 2c5eacaa0..000000000 --- a/android/examples/OpenGL/Image/Extrusion/Extrusion.pde +++ /dev/null @@ -1,47 +0,0 @@ -/** - * Extrusion. - * - * Converts a flat image into spatial data points and rotates the points - * around the center. - */ - -PImage extrude; -int[][] values; -float angle = 0; - -void setup() { - size(640, 360, P3D); - orientation(LANDSCAPE); - - // Load the image into a new array - extrude = loadImage("ystone08.jpg"); - extrude.loadPixels(); - values = new int[extrude.width][extrude.height]; - for (int y = 0; y < extrude.height; y++) { - for (int x = 0; x < extrude.width; x++) { - color pixel = extrude.get(x, y); - values[x][y] = int(brightness(pixel)); - } - } -} - -void draw() { - background(0); - - // Update the angle - angle += 0.005; - - // Rotate around the center axis - translate(width/2, 0, +128); - rotateY(angle); - translate(-extrude.width/2, 100, +128); - - // Display the image mass - for (int y = 0; y < extrude.height; y++) { - for (int x = 0; x < extrude.width; x++) { - stroke(values[x][y]); - point(x, y, -values[x][y]); - } - } - -} diff --git a/android/examples/OpenGL/Image/ExtrusionGL/ExtrusionGL.pde b/android/examples/OpenGL/Image/ExtrusionGL/ExtrusionGL.pde deleted file mode 100644 index 850d88891..000000000 --- a/android/examples/OpenGL/Image/ExtrusionGL/ExtrusionGL.pde +++ /dev/null @@ -1,51 +0,0 @@ -// Lines appear repeated along horizontal strips (similar to Explode) - -/** - * Extrusion. - * - * Converts a flat image into spatial data points and rotates the points - * around the center. - */ - -PImage a; -boolean onetime = true; -int[][] aPixels; -int[][] values; -float angle; - -void setup() { - size(displayWidth, displayHeight, P3D); - - aPixels = new int[width][height]; - values = new int[width][height]; - noFill(); - - // Load the image into a new array - // Extract the values and store in an array - a = loadImage("ystone08.jpg"); - a.loadPixels(); - for (int i = 0; i < a.height; i++) { - for (int j = 0; j < a.width; j++) { - aPixels[j][i] = a.pixels[i*a.width + j]; - values[j][i] = int(blue(aPixels[j][i])); - } - } -} - -void draw() { - background(255); - translate(width/2, height/2, 0); - scale(2.0); - - // Update and constrain the angle - angle += 0.005; - rotateY(angle); - - // Display the image mass - for (int i = 0; i < a.height; i += 2) { - for (int j = 0; j < a.width; j += 2) { - stroke(values[j][i], 153); - line(j-a.width/2, i-a.height/2, -values[j][i], j-a.width/2, i-a.height/2, -values[j][i]-10); - } - } -} diff --git a/android/examples/OpenGL/Image/Zoom/Zoom.pde b/android/examples/OpenGL/Image/Zoom/Zoom.pde deleted file mode 100644 index 8c5c058b7..000000000 --- a/android/examples/OpenGL/Image/Zoom/Zoom.pde +++ /dev/null @@ -1,90 +0,0 @@ -/** - * Zoom. - * - * Move the cursor over the image to alter its position. Click and press - * the mouse to zoom and set the density of the matrix by typing numbers 1-5. - * This program displays a series of lines with their heights corresponding to - * a color value read from an image. - */ - -PImage img; -//boolean onetime = true; -int[][] imgPixels; -float sval = 1.0; -float nmx, nmy; -int res = 5; - -void setup() -{ - size(640, 360, P3D); - orientation(LANDSCAPE); - noFill(); - stroke(255); - img = loadImage("ystone08.jpg"); - imgPixels = new int[img.width][img.height]; - for (int i = 0; i < img.height; i++) { - for (int j = 0; j < img.width; j++) { - imgPixels[j][i] = img.get(j, i); - } - } -} - -void draw() -{ - background(0); - - nmx = nmx + (mouseX-nmx)/20; - nmy += (mouseY-nmy)/20; - - if(mousePressed) { - sval += 0.005; - } - else { - sval -= 0.01; - } - - sval = constrain(sval, 1.0, 2.5); - - translate(width/2 + nmx * sval-100, height/2 + nmy*sval - 200, -50); - scale(sval); - rotateZ(PI/9 - sval + 1.0); - rotateX(PI/sval/8 - 0.125); - rotateY(sval/8 - 0.125); - - translate(-width/2, -height/2, 0); - - for (int i = 0; i < img.height; i += res) { - for (int j = 0; j < img.width; j += res) { - float rr = red(imgPixels[j][i]); - float gg = green(imgPixels[j][i]); - float bb = blue(imgPixels[j][i]); - float tt = rr+gg+bb; - stroke(rr, gg, gg); - line(i, j, tt/10-20, i, j, tt/10 ); - } - } -} - -void keyPressed() { - if(key == '1') { - res = 1; - } - else if (key == '2') { - res = 2; - } - else if (key == '3') { - res = 3; - } - else if (key == '4') { - res = 4; - } - else if (key == '5') { - res = 5; - } -} - - - - - - diff --git a/android/examples/OpenGL/Immediate/Bezier/Bezier.pde b/android/examples/OpenGL/Immediate/Bezier/Bezier.pde deleted file mode 100644 index 3e81819cf..000000000 --- a/android/examples/OpenGL/Immediate/Bezier/Bezier.pde +++ /dev/null @@ -1,23 +0,0 @@ -/** - * Bezier. - * - * The first two parameters for the bezier() function specify the - * first point in the curve and the last two parameters specify - * the last point. The middle parameters set the control points - * that define the shape of the curve. - */ - -void setup() { - size(640, 360, P3D); - orientation(LANDSCAPE); - stroke(255); - noFill(); -} - -void draw() { - background(0); - for (int i = 0; i < 200; i += 20) { - bezier(mouseX-(i/2.0), 40+i, 410, 20, 440, 300, 240-(i/16.0), 300+(i/8.0)); - } -} - diff --git a/android/examples/OpenGL/Immediate/Robot1_Draw/Robot1_Draw.pde b/android/examples/OpenGL/Immediate/Robot1_Draw/Robot1_Draw.pde deleted file mode 100644 index 2238778c6..000000000 --- a/android/examples/OpenGL/Immediate/Robot1_Draw/Robot1_Draw.pde +++ /dev/null @@ -1,41 +0,0 @@ -// Robot 1: Draw from "Getting Started with Processing" -// by Reas & Fry. O'Reilly / Make 2010 - -size(720, 480, P2D); -orientation(LANDSCAPE); -strokeWeight(2); -background(204); -ellipseMode(RADIUS); - -// Neck -stroke(102); // Set stroke to gray -line(266, 257, 266, 162); // Left -line(276, 257, 276, 162); // Middle -line(286, 257, 286, 162); // Right - -// Antennae -line(276, 155, 246, 112); // Small -line(276, 155, 306, 56); // Tall -line(276, 155, 342, 170); // Medium - -// Body -noStroke(); // Disable stroke -fill(102); // Set fill to gray -ellipse(264, 377, 33, 33); // Antigravity orb -fill(0); // Set fill to black -rect(219, 257, 90, 120); // Main body -fill(102); // Set fill to gray -rect(219, 274, 90, 6); // Gray stripe - -// Head -fill(0); // Set fill to black -ellipse(276, 155, 45, 45); // Head -fill(255); // Set fill to white -ellipse(288, 150, 14, 14); // Large eye -fill(0); // Set fill to black -ellipse(288, 150, 3, 3); // Pupil -fill(153); // Set fill to light gray -ellipse(263, 148, 5, 5); // Small eye 1 -ellipse(296, 130, 4, 4); // Small eye 2 -ellipse(305, 162, 3, 3); // Small eye 3 - diff --git a/android/examples/OpenGL/Immediate/ShapePrimitives/ShapePrimitives.pde b/android/examples/OpenGL/Immediate/ShapePrimitives/ShapePrimitives.pde deleted file mode 100644 index 20e0d5f74..000000000 --- a/android/examples/OpenGL/Immediate/ShapePrimitives/ShapePrimitives.pde +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Shape Primitives. - * - * The basic shape primitive functions are triangle(), - * rect(), quad(), ellipse(), and arc(). Squares are made - * with rect() and circles are made with ellipse(). Each - * of these functions requires a number of parameters to - * determine the shape's position and size. - */ - -size(640, 360, P3D); -orientation(LANDSCAPE); -background(0); -noStroke(); - -fill(204); -triangle(18, 18, 18, 360, 81, 360); - -fill(102); -rect(81, 81, 63, 63); - -fill(204); -quad(189, 18, 216, 18, 216, 360, 144, 360); - -fill(255); -ellipse(252, 144, 72, 72); - -fill(204); -triangle(288, 18, 351, 360, 288, 360); - -fill(255); -arc(479, 300, 280, 280, PI, TWO_PI); - diff --git a/android/examples/OpenGL/Immediate/TriangleStrip/TriangleStrip.pde b/android/examples/OpenGL/Immediate/TriangleStrip/TriangleStrip.pde deleted file mode 100644 index 7c183c937..000000000 --- a/android/examples/OpenGL/Immediate/TriangleStrip/TriangleStrip.pde +++ /dev/null @@ -1,45 +0,0 @@ -/** - * TRIANGLE_STRIP Mode - * by Ira Greenberg. - * - * Generate a closed ring using the vertex() function and - * beginShape(TRIANGLE_STRIP) mode. The outerRad and innerRad - * variables control ring's radii respectively. - */ - -int x; -int y; -float outerRad; -float innerRad; - -void setup() { - size(640, 360, P2D); - orientation(LANDSCAPE); - background(204); - x = width/2; - y = height/2; - outerRad = min(width, height) * 0.4; - innerRad = outerRad * 0.6; -} - -void draw() { - background(204); - - int pts = int(map(mouseX, 0, width, 6, 60)); - float rot = 180.0/pts; - float angle = 0; - - beginShape(TRIANGLE_STRIP); - for (int i = 0; i <= pts; i++) { - float px = x + cos(radians(angle)) * outerRad; - float py = y + sin(radians(angle)) * outerRad; - angle += rot; - vertex(px, py); - px = x + cos(radians(angle)) * innerRad; - py = y + sin(radians(angle)) * innerRad; - vertex(px, py); - angle += rot; - } - endShape(); -} - diff --git a/android/examples/OpenGL/Lights/CameraLight/CameraLight.pde b/android/examples/OpenGL/Lights/CameraLight/CameraLight.pde deleted file mode 100644 index 4d99aa00e..000000000 --- a/android/examples/OpenGL/Lights/CameraLight/CameraLight.pde +++ /dev/null @@ -1,39 +0,0 @@ -// CameraLight, by Andres Colubri -// Simple example showing a lit rotating cube. The projection -// is set to orthographic if the mouse is pressed. - -float spin = 0.0; - -void setup() { - size(400, 400, P3D); - - noStroke(); -} - -void draw() { - background(51); - - lights(); - - if (mousePressed) { - ortho(-width/2, width/2, -height/2, height/2); - } else { - float fov = PI/3.0; - float cameraZ = (height/2.0) / tan(fov/2.0); - perspective(fov, float(width)/float(height), - cameraZ/2.0, cameraZ*2.0); - } - - spin += 0.01; - - pushMatrix(); - translate(width/2, height/2, 0); - rotateX(PI/9); - rotateY(PI/5 + spin); - box(100); - popMatrix(); -} - - - - diff --git a/android/examples/OpenGL/Lights/Spot/AndroidManifest.xml b/android/examples/OpenGL/Lights/Spot/AndroidManifest.xml deleted file mode 100644 index 95459da70..000000000 --- a/android/examples/OpenGL/Lights/Spot/AndroidManifest.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - diff --git a/android/examples/OpenGL/Pixels/GetPixels/GetPixels.pde b/android/examples/OpenGL/Pixels/GetPixels/GetPixels.pde deleted file mode 100644 index a40c2a08f..000000000 --- a/android/examples/OpenGL/Pixels/GetPixels/GetPixels.pde +++ /dev/null @@ -1,30 +0,0 @@ -void setup() { - size(255, 255, P3D); - -// for (int x = 0; x < width; x++) { -// for (int y = 0; y < height; y++) { -// int c = color(x, y, 0); -// set(x, y, c); -// } -// } - - loadPixels(); - for (int i = 0; i < pixels.length; i++) { - int x = i % width; - int y = i / height; - int c = color(x, y, 0); - set(x, y, c); - } - updatePixels(); -} - -void draw() { - for (int x = 0; x < width; x++) { - for (int y = 0; y < height; y++) { - int c = get(x, y); - set(x, y, c); - } - } - - println(frameRate); -} diff --git a/android/examples/OpenGL/Pixels/SetPixels/SetPixels.pde b/android/examples/OpenGL/Pixels/SetPixels/SetPixels.pde deleted file mode 100644 index e7be75708..000000000 --- a/android/examples/OpenGL/Pixels/SetPixels/SetPixels.pde +++ /dev/null @@ -1,16 +0,0 @@ -void setup() { - size(400, 400, P3D); - - background(0); -} - -void draw() { - for (int x = 0; x < width; x++) { - for (int y = 0; y < height; y++) { - int c = color(random(255), random(255), random(255)); - set(x, y, c); - } - } - - println(frameRate); -} diff --git a/android/examples/OpenGL/Pixels/UpdatePixels/UpdatePixels.pde b/android/examples/OpenGL/Pixels/UpdatePixels/UpdatePixels.pde deleted file mode 100644 index 211bc320e..000000000 --- a/android/examples/OpenGL/Pixels/UpdatePixels/UpdatePixels.pde +++ /dev/null @@ -1,15 +0,0 @@ -void setup() { - size(400, 400, P3D); - - background(0); - loadPixels(); -} - -void draw() { - for (int i = 0; i < pixels.length; i++) { - pixels[i] = color(random(255), random(255), random(255)); - } - updatePixels(); - - println(frameRate); -} diff --git a/android/examples/OpenGL/Retained/PolyImmediate/PolyImmediate.pde b/android/examples/OpenGL/Retained/PolyImmediate/PolyImmediate.pde deleted file mode 100644 index d7ecc3e59..000000000 --- a/android/examples/OpenGL/Retained/PolyImmediate/PolyImmediate.pde +++ /dev/null @@ -1,21 +0,0 @@ -size(100, 100, P2D); - -beginShape(POLYGON); -fill(0, 255, 0, 255); -stroke(0, 0, 255, 255); -strokeWeight(5); -strokeJoin(ROUND); -beginContour(); -vertex(10, 10); -vertex(10, 90); -vertex(90, 90); -vertex(90, 10); -endContour(); -beginContour(); -vertex(40, 40); -vertex(70, 40); -vertex(70, 70); -vertex(40, 70); -endContour(); -endShape(CLOSE); - diff --git a/android/examples/OpenGL/Retained/PolyRetain/PolyRetain.pde b/android/examples/OpenGL/Retained/PolyRetain/PolyRetain.pde deleted file mode 100644 index 97e0a6311..000000000 --- a/android/examples/OpenGL/Retained/PolyRetain/PolyRetain.pde +++ /dev/null @@ -1,22 +0,0 @@ -size(100, 100, P2D); - -PShape obj = createShape(POLYGON); -obj.fill(0, 255, 0, 255); -obj.stroke(0, 0, 255, 255); -obj.strokeWeight(5); -obj.strokeJoin(ROUND); -obj.beginContour(); -obj.vertex(10, 10); -obj.vertex(10, 90); -obj.vertex(90, 90); -obj.vertex(90, 10); -obj.endContour(); -obj.beginContour(); -obj.vertex(40, 40); -obj.vertex(70, 40); -obj.vertex(70, 70); -obj.vertex(40, 70); -obj.endContour(); -obj.end(CLOSE); - -shape(obj); diff --git a/android/examples/OpenGL/Retained/Primitive/Primitive.pde b/android/examples/OpenGL/Retained/Primitive/Primitive.pde deleted file mode 100644 index 47854d798..000000000 --- a/android/examples/OpenGL/Retained/Primitive/Primitive.pde +++ /dev/null @@ -1,43 +0,0 @@ -PShape circle; -boolean filled = true; -boolean stroked = true; - -public void setup() { - size(400, 400, P2D); - frameRate(60); - - fill(255, 0, 0); - stroke(0, 0, 255); - strokeWeight(3); - circle = createShape(ELLIPSE, 0, 0, 100, 100); -} - -public void draw () { - background(0); - - if (5000 < millis()) { - if (filled) circle.fill(map(mouseX, 0, width, 255, 0), 0, 0); - if (stroked) circle.stroke(0, 0, map(mouseY, 0, height, 255, 0)); - } - - translate(mouseX, mouseY); - shape(circle); -} - -void keyPressed() { - if (key == 's') { - if (stroked) { - circle.noStroke(); - stroked = false; - } else { - stroked = true; - } - } else if (key == 'f') { - if (filled) { - circle.noFill(); - filled = false; - } else { - filled = true; - } - } -} diff --git a/android/examples/OpenGL/Retained/Shape2_18/Shape2_18.pde b/android/examples/OpenGL/Retained/Shape2_18/Shape2_18.pde deleted file mode 100644 index 854aa8060..000000000 --- a/android/examples/OpenGL/Retained/Shape2_18/Shape2_18.pde +++ /dev/null @@ -1,16 +0,0 @@ -size(100, 100, P2D); -smooth(); - -PShape obj = createShape(); -obj.noFill(); -obj.stroke(0); -obj.strokeWeight(1); -obj.vertex(15, 40); // V1 (see p.76) -obj.bezierVertex(5, 0, 80, 0, 50, 55); // C1, C2, V2 -obj.vertex(30, 45); // V3 -obj.vertex(25, 75); // V4 -obj.bezierVertex(50, 70, 75, 90, 80, 70); // C3, C4, V5 -obj.end(); - -background(150); -shape(obj); diff --git a/android/examples/OpenGL/Shaders/BlurFilter/BlurFilter.pde b/android/examples/OpenGL/Shaders/BlurFilter/BlurFilter.pde deleted file mode 100644 index 9914df206..000000000 --- a/android/examples/OpenGL/Shaders/BlurFilter/BlurFilter.pde +++ /dev/null @@ -1,14 +0,0 @@ -PShader blur; - -void setup() { - size(400, 400, P2D); - blur = loadShader("blur.glsl"); -} - -void draw() { - rect(mouseX, mouseY, 50, 50); - filter(blur); -} - - - diff --git a/android/examples/OpenGL/Shaders/EdgeDetect/EdgeDetect.pde b/android/examples/OpenGL/Shaders/EdgeDetect/EdgeDetect.pde deleted file mode 100644 index 6840399ea..000000000 --- a/android/examples/OpenGL/Shaders/EdgeDetect/EdgeDetect.pde +++ /dev/null @@ -1,32 +0,0 @@ -// This example shows how to change the default fragment shader used -// in P2D to render textures, by a custom one that applies a simple -// edge detection filter. -// -// Press any key to switch between the custom and the default shader. - -PImage img; -PShader edges; -boolean customShader; - -void setup() { - size(400, 400, P2D); - img = loadImage("berlin-1.jpg"); - - edges = loadShader(PShader.TEXTURED, "edges.glsl"); - shader(edges); - customShader = true; -} - -public void draw() { - image(img, 0, 0, width, height); -} - -public void mousePressed() { - if (customShader) { - resetShader(PShader.TEXTURED); - customShader = false; - } else { - shader(edges); - customShader = true; - } -} diff --git a/android/examples/OpenGL/Shaders/EdgeDetect/data/edges.glsl b/android/examples/OpenGL/Shaders/EdgeDetect/data/edges.glsl deleted file mode 100644 index 56e0a8b3f..000000000 --- a/android/examples/OpenGL/Shaders/EdgeDetect/data/edges.glsl +++ /dev/null @@ -1,43 +0,0 @@ -// Edge detection shader - -#ifdef GL_ES -precision mediump float; -precision mediump int; -#endif - -uniform sampler2D textureSampler; - -// The inverse of the texture dimensions along X and Y -uniform vec2 texcoordOffset; - -varying vec4 vertColor; -varying vec4 vertTexcoord; - -void main() { - vec4 sum = vec4(0); - - float kernel[9]; - kernel[0] = -1.0; kernel[1] = -1.0; kernel[2] = -1.0; - kernel[3] = -1.0; kernel[4] = +8.0; kernel[5] = -1.0; - kernel[6] = -1.0; kernel[7] = -1.0; kernel[8] = -1.0; - - vec2 offset[9]; - offset[0] = vec2(-texcoordOffset.s, -texcoordOffset.t); - offset[1] = vec2( 0.0, -texcoordOffset.t); - offset[2] = vec2(+texcoordOffset.s, -texcoordOffset.t); - - offset[3] = vec2(-texcoordOffset.s, 0.0); - offset[4] = vec2( 0.0, 0.0); - offset[5] = vec2(+texcoordOffset.s, 0.0); - - offset[6] = vec2(-texcoordOffset.s, +texcoordOffset.t); - offset[7] = vec2( 0.0, +texcoordOffset.t); - offset[8] = vec2(+texcoordOffset.s, +texcoordOffset.t); - - for (int i = 0; i < 9; i++) { - vec4 tmp = texture2D(textureSampler, vertTexcoord.st + offset[i]); - sum += tmp * kernel[i]; - } - - gl_FragColor = vec4(sum.rgb, 1.0); -} \ No newline at end of file diff --git a/android/examples/OpenGL/Shaders/FXAA/FXAA.pde b/android/examples/OpenGL/Shaders/FXAA/FXAA.pde deleted file mode 100644 index 92c10cd0a..000000000 --- a/android/examples/OpenGL/Shaders/FXAA/FXAA.pde +++ /dev/null @@ -1,93 +0,0 @@ -// This example uses a FxAA post-processing filter for fast -// fullscreen antialiasing: -// http://www.kotaku.com.au/2011/12/what-is-fxaa/ -// -// Press any key to enable/disable the shader. - -PGraphics canvas; -boolean drawing = false; -PShader fxaa; -boolean usingShader; -String message; -float msgLen; - -void setup() { - size(displayWidth, displayHeight, P2D); - orientation(LANDSCAPE); - noSmooth(); // doesn't realy matter, as mobile devices don't have anti-aliasing anyways - - canvas = createGraphics(width, height, P2D); - canvas.noSmooth(); - - fxaa = loadShader(PShader.TEXTURED, "fxaa.glsl"); - shader(fxaa); - usingShader = true; - - canvas.beginDraw(); - canvas.background(255); - canvas.stroke(0); - canvas.strokeWeight(15); - canvas.strokeCap(ROUND); - canvas.endDraw(); - - PFont font = createFont("Arial", 18); - textFont(font); - updateMessage(); - - drawing = false; -} - -public void draw() { - if (drawing) { - canvas.beginDraw(); - if (1 < dist(mouseX, mouseY, pmouseX, pmouseY)) { - canvas.line(pmouseX, pmouseY, mouseX, mouseY); - } - canvas.endDraw(); - } - - image(canvas, 0, 0); - - drawMessage(); -} - -public void mousePressed() { - if (!drawing && width - msgLen < mouseX && height - 23 < mouseY) { - if (usingShader) { - resetShader(PShader.TEXTURED); - usingShader = false; - } else { - shader(fxaa); - usingShader = true; - } - updateMessage(); - } else { - drawing = true; - } -} - -void mouseReleased() { - drawing = false; -} - -void updateMessage() { - if (usingShader) { - message = "Anti-aliasing enabled"; - } else { - message = "Anti-aliasing disabled"; - } - msgLen = textWidth(message); -} - -void drawMessage() { - if (usingShader) { - // We need the default texture shader to - // render text. - resetShader(PShader.TEXTURED); - } - fill(0); - text(message, width - msgLen, height - 5); - if (usingShader) { - shader(fxaa); - } -} diff --git a/android/examples/OpenGL/Shaders/FXAA/data/fxaa.glsl b/android/examples/OpenGL/Shaders/FXAA/data/fxaa.glsl deleted file mode 100644 index 693db482b..000000000 --- a/android/examples/OpenGL/Shaders/FXAA/data/fxaa.glsl +++ /dev/null @@ -1,69 +0,0 @@ -// FXAA shader, GLSL code adapted from: -// http://horde3d.org/wiki/index.php5?title=Shading_Technique_-_FXAA -// Whitepaper describing the technique: -// http://developer.download.nvidia.com/assets/gamedev/files/sdk/11/FXAA_WhitePaper.pdf - -#ifdef GL_ES -precision mediump float; -precision mediump int; -#endif - -uniform sampler2D textureSampler; - -// The inverse of the texture dimensions along X and Y -uniform vec2 texcoordOffset; - -varying vec4 vertColor; -varying vec4 vertTexcoord; - -void main() { - // The parameters are hardcoded for now, but could be - // made into uniforms to control fromt he program. - float FXAA_SPAN_MAX = 8.0; - float FXAA_REDUCE_MUL = 1.0/8.0; - float FXAA_REDUCE_MIN = (1.0/128.0); - - vec3 rgbNW = texture2D(textureSampler, vertTexcoord.xy + (vec2(-1.0, -1.0) * texcoordOffset)).xyz; - vec3 rgbNE = texture2D(textureSampler, vertTexcoord.xy + (vec2(+1.0, -1.0) * texcoordOffset)).xyz; - vec3 rgbSW = texture2D(textureSampler, vertTexcoord.xy + (vec2(-1.0, +1.0) * texcoordOffset)).xyz; - vec3 rgbSE = texture2D(textureSampler, vertTexcoord.xy + (vec2(+1.0, +1.0) * texcoordOffset)).xyz; - vec3 rgbM = texture2D(textureSampler, vertTexcoord.xy).xyz; - - vec3 luma = vec3(0.299, 0.587, 0.114); - float lumaNW = dot(rgbNW, luma); - float lumaNE = dot(rgbNE, luma); - float lumaSW = dot(rgbSW, luma); - float lumaSE = dot(rgbSE, luma); - float lumaM = dot( rgbM, luma); - - float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE))); - float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE))); - - vec2 dir; - dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE)); - dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE)); - - float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) * (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN); - - float rcpDirMin = 1.0/(min(abs(dir.x), abs(dir.y)) + dirReduce); - - dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX), - max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX), dir * rcpDirMin)) * texcoordOffset; - - vec3 rgbA = (1.0/2.0) * ( - texture2D(textureSampler, vertTexcoord.xy + dir * (1.0/3.0 - 0.5)).xyz + - texture2D(textureSampler, vertTexcoord.xy + dir * (2.0/3.0 - 0.5)).xyz); - vec3 rgbB = rgbA * (1.0/2.0) + (1.0/4.0) * ( - texture2D(textureSampler, vertTexcoord.xy + dir * (0.0/3.0 - 0.5)).xyz + - texture2D(textureSampler, vertTexcoord.xy + dir * (3.0/3.0 - 0.5)).xyz); - float lumaB = dot(rgbB, luma); - - if((lumaB < lumaMin) || (lumaB > lumaMax)){ - gl_FragColor.xyz=rgbA; - } else { - gl_FragColor.xyz=rgbB; - } - gl_FragColor.a = 1.0; - - gl_FragColor *= vertColor; -} diff --git a/android/examples/OpenGL/Shaders/FishEye/FishEye.pde b/android/examples/OpenGL/Shaders/FishEye/FishEye.pde deleted file mode 100644 index cc536f128..000000000 --- a/android/examples/OpenGL/Shaders/FishEye/FishEye.pde +++ /dev/null @@ -1,37 +0,0 @@ -// Fish-eye shader, useful for dome projection - -PGraphics canvas; -PShader fisheye; -PImage img; - -void setup() { - size(400, 400, P3D); - canvas = createGraphics(400, 400, P3D); - - fisheye = loadShader(PShader.TEXTURED, "FishEye.glsl"); - fisheye.set("aperture", 180.0); - shader(fisheye); -} - -void draw() { - canvas.beginDraw(); - canvas.background(0); - canvas.stroke(255, 0, 0); - for (int i = 0; i < width; i += 10) { - canvas.line(i, 0, i, height); - } - for (int i = 0; i < height; i += 10) { - canvas.line(0, i, width, i); - } - canvas.lights(); - canvas.noStroke(); - canvas.translate(mouseX, mouseY, 100); - canvas.rotateX(frameCount * 0.01f); - canvas.rotateY(frameCount * 0.01f); - canvas.box(50); - canvas.endDraw(); - - // The rendering of this image will be done through the fisheye shader, since - // it was set as the PShader.TEXTURED shader of the main surface. - image(canvas, 0, 0, width, height); -} diff --git a/android/examples/OpenGL/Shaders/FishEye/data/FishEye.glsl b/android/examples/OpenGL/Shaders/FishEye/data/FishEye.glsl deleted file mode 100644 index 65d005e0a..000000000 --- a/android/examples/OpenGL/Shaders/FishEye/data/FishEye.glsl +++ /dev/null @@ -1,57 +0,0 @@ -// Inspired by the "Angular Fisheye à la Bourke" sketch from -// Jonathan Cremieux, as shown in the OpenProcessing website: -// http://openprocessing.org/visuals/?visualID=12140 -// Using the inverse transform of the angular fisheye as -// explained in Paul Bourke's website: -// http://paulbourke.net/miscellaneous/domefisheye/fisheye/ - -#ifdef GL_ES -precision mediump float; -precision mediump int; -#endif - -uniform sampler2D textureSampler; -uniform mat4 texcoordMatrix; - -varying vec4 vertColor; -varying vec4 vertTexcoord; - -uniform float aperture; - -const float PI = 3.1415926535; - -void main(void) { - float apertureHalf = 0.5 * aperture * (PI / 180.0); - - // This factor ajusts the coordinates in the case that - // the aperture angle is less than 180 degrees, in which - // case the area displayed is not the entire half-sphere. - float maxFactor = sin(apertureHalf); - - // The st factor takes into account the situation when non-pot - // textures are not supported, so that the maximum texture - // coordinate to cover the entire image might not be 1. - vec2 stFactor = vec2(1.0 / abs(texcoordMatrix[0][0]), 1.0 / abs(texcoordMatrix[1][1])); - vec2 pos = (2.0 * vertTexcoord.st * stFactor - 1.0); - - float l = length(pos); - if (l > 1.0) { - gl_FragColor = vec4(0, 0, 0, 1); - } else { - float x = maxFactor * pos.x; - float y = maxFactor * pos.y; - - float n = length(vec2(x, y)); - - float z = sqrt(1.0 - n * n); - - float r = atan(n, z) / PI; - - float phi = atan(y, x); - - float u = r * cos(phi) + 0.5; - float v = r * sin(phi) + 0.5; - - gl_FragColor = texture2D(textureSampler, vec2(u, v) / stFactor) * vertColor; - } -} \ No newline at end of file diff --git a/android/examples/OpenGL/Shaders/GlossyFishEye/GlossyFishEye.pde b/android/examples/OpenGL/Shaders/GlossyFishEye/GlossyFishEye.pde deleted file mode 100644 index e2a060541..000000000 --- a/android/examples/OpenGL/Shaders/GlossyFishEye/GlossyFishEye.pde +++ /dev/null @@ -1,70 +0,0 @@ -// Fish-eye shader on the main surface, glossy specular reflection shader -// on the offscreen canvas. - -PGraphics canvas; -PShader fisheye; -PShader glossy; -PImage img; -PShape ball; - -boolean usingFishEye; - -void setup() { - size(400, 400, P3D); - canvas = createGraphics(400, 400, P3D); - - fisheye = loadShader(PShader.TEXTURED, "FishEye.glsl"); - fisheye.set("aperture", 180.0); - shader(fisheye); - usingFishEye = true; - - glossy = loadShader(PShader.LIT, "GlossyFrag.glsl", "GlossyVert.glsl"); - glossy.set("AmbientColour", 0, 0, 0); - glossy.set("DiffuseColour", 0.9, 0.2, 0.2); - glossy.set("SpecularColour", 1.0, 1.0, 1.0); - glossy.set("AmbientIntensity", 1.0); - glossy.set("DiffuseIntensity", 1.0); - glossy.set("SpecularIntensity", 0.7); - glossy.set("Roughness", 0.7); - glossy.set("Sharpness", 0.0); - canvas.shader(glossy); - - ball = createShape(SPHERE, 50); - //ball.fill(200, 50, 50); - ball.noStroke(); -} - -void draw() { - canvas.beginDraw(); - canvas.noStroke(); - canvas.background(0); - canvas.pushMatrix(); - canvas.rotateY(frameCount * 0.01); - canvas.pointLight(204, 204, 204, 1000, 1000, 1000); - canvas.popMatrix(); - for (float x = 0; x < canvas.width + 100; x += 100) { - for (float y = 0; y < canvas.height + 100; y += 100) { - for (float z = 0; z < 200; z += 100) { - canvas.pushMatrix(); - canvas.translate(x, y, -z); - canvas.shape(ball); - canvas.popMatrix(); - } - } - } - canvas.endDraw(); - - image(canvas, 0, 0, width, height); - - println(frameRate); -} - -public void mousePressed() { - if (usingFishEye) { - resetShader(PShader.TEXTURED); - usingFishEye = false; - } else { - shader(fisheye); - usingFishEye = true; - } -} diff --git a/android/examples/OpenGL/Shaders/GlossyFishEye/data/FishEye.glsl b/android/examples/OpenGL/Shaders/GlossyFishEye/data/FishEye.glsl deleted file mode 100644 index 65d005e0a..000000000 --- a/android/examples/OpenGL/Shaders/GlossyFishEye/data/FishEye.glsl +++ /dev/null @@ -1,57 +0,0 @@ -// Inspired by the "Angular Fisheye à la Bourke" sketch from -// Jonathan Cremieux, as shown in the OpenProcessing website: -// http://openprocessing.org/visuals/?visualID=12140 -// Using the inverse transform of the angular fisheye as -// explained in Paul Bourke's website: -// http://paulbourke.net/miscellaneous/domefisheye/fisheye/ - -#ifdef GL_ES -precision mediump float; -precision mediump int; -#endif - -uniform sampler2D textureSampler; -uniform mat4 texcoordMatrix; - -varying vec4 vertColor; -varying vec4 vertTexcoord; - -uniform float aperture; - -const float PI = 3.1415926535; - -void main(void) { - float apertureHalf = 0.5 * aperture * (PI / 180.0); - - // This factor ajusts the coordinates in the case that - // the aperture angle is less than 180 degrees, in which - // case the area displayed is not the entire half-sphere. - float maxFactor = sin(apertureHalf); - - // The st factor takes into account the situation when non-pot - // textures are not supported, so that the maximum texture - // coordinate to cover the entire image might not be 1. - vec2 stFactor = vec2(1.0 / abs(texcoordMatrix[0][0]), 1.0 / abs(texcoordMatrix[1][1])); - vec2 pos = (2.0 * vertTexcoord.st * stFactor - 1.0); - - float l = length(pos); - if (l > 1.0) { - gl_FragColor = vec4(0, 0, 0, 1); - } else { - float x = maxFactor * pos.x; - float y = maxFactor * pos.y; - - float n = length(vec2(x, y)); - - float z = sqrt(1.0 - n * n); - - float r = atan(n, z) / PI; - - float phi = atan(y, x); - - float u = r * cos(phi) + 0.5; - float v = r * sin(phi) + 0.5; - - gl_FragColor = texture2D(textureSampler, vec2(u, v) / stFactor) * vertColor; - } -} \ No newline at end of file diff --git a/android/examples/OpenGL/Shaders/GlossyFishEye/data/GlossyFrag.glsl b/android/examples/OpenGL/Shaders/GlossyFishEye/data/GlossyFrag.glsl deleted file mode 100644 index 4f96b6f6d..000000000 --- a/android/examples/OpenGL/Shaders/GlossyFishEye/data/GlossyFrag.glsl +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (C) 2007 Dave Griffiths -// Copyright (C) 2007 Dave Griffiths -// Licence: GPLv2 (see COPYING) -// Fluxus Shader Library -// --------------------- -// Glossy Specular Reflection Shader -// A more controllable version of blinn shading, -// Useful for ceramic or fluids - from Advanced -// Renderman, thanks to Larry Gritz - -#ifdef GL_ES -precision mediump float; -precision mediump int; -#endif - -uniform vec3 AmbientColour; -uniform vec3 DiffuseColour; -uniform vec3 SpecularColour; -uniform float AmbientIntensity; -uniform float DiffuseIntensity; -uniform float SpecularIntensity; -uniform float Roughness; -uniform float Sharpness; - -varying vec3 N; -varying vec3 P; -varying vec3 V; -varying vec3 L; - -void main() -{ - float w = 0.18*(1.0-Sharpness); - - vec3 l = normalize(L); - vec3 n = normalize(N); - vec3 v = normalize(V); - vec3 h = normalize(l+v); - - float diffuse = dot(l,n); - float specular = smoothstep(0.72-w,0.72+w,pow(max(0.0,dot(n,h)),1.0/Roughness)); - - gl_FragColor = vec4(AmbientColour*AmbientIntensity + - DiffuseColour*diffuse*DiffuseIntensity + - SpecularColour*specular*SpecularIntensity,1); -} diff --git a/android/examples/OpenGL/Shaders/GlossyFishEye/data/GlossyVert.glsl b/android/examples/OpenGL/Shaders/GlossyFishEye/data/GlossyVert.glsl deleted file mode 100644 index fa0c29590..000000000 --- a/android/examples/OpenGL/Shaders/GlossyFishEye/data/GlossyVert.glsl +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (C) 2007 Dave Griffiths -// Licence: GPLv2 (see COPYING) -// Fluxus Shader Library -// --------------------- -// Glossy Specular Reflection Shader -// A more controllable version of blinn shading, -// Useful for ceramic or fluids - from Advanced -// Renderman, thanks to Larry Gritz - -uniform mat4 modelviewMatrix; -uniform mat4 projmodelviewMatrix; -uniform mat3 normalMatrix; - -uniform vec4 lightPosition[8]; - -attribute vec4 inVertex; -attribute vec3 inNormal; - -varying vec3 N; -varying vec3 P; -varying vec3 V; -varying vec3 L; - -void main() { - N = normalize(normalMatrix * inNormal); - P = inVertex.xyz; - V = -vec3(modelviewMatrix * inVertex); - L = vec3(modelviewMatrix * (lightPosition[0] - inVertex)); - gl_Position = projmodelviewMatrix * inVertex; -} - diff --git a/android/examples/OpenGL/Shaders/ToonShading/ToonShading.pde b/android/examples/OpenGL/Shaders/ToonShading/ToonShading.pde deleted file mode 100644 index c5cb11350..000000000 --- a/android/examples/OpenGL/Shaders/ToonShading/ToonShading.pde +++ /dev/null @@ -1,41 +0,0 @@ -// Example showing the use of a custom lighting shader in order -// to apply a toon effect on the scene. -// Based on the glsl tutorial from lighthouse 3D: -// http://www.lighthouse3d.com/tutorials/glsl-tutorial/toon-shader-version-ii/ - -PShader toon; -boolean customShader; - -public void setup() { - size(400, 400, P3D); - noStroke(); - fill(204); - - toon = loadShader(PShader.LIT, "ToonFrag.glsl", "ToonVert.glsl"); - shader(toon); - customShader = true; -} - -public void draw() { - noStroke(); - background(0); - float dirY = (mouseY / float(height) - 0.5) * 2; - float dirX = (mouseX / float(width) - 0.5) * 2; - directionalLight(204, 204, 204, -dirX, -dirY, -1); - translate(width/2, height/2); - sphere(80); -} - -public void mousePressed() { - if (dist(mouseX, mouseY, width/2, height/2) < 80) { - if (customShader) { - resetShader(PShader.LIT); - customShader = false; - } - else { - shader(toon); - customShader = true; - } - } -} - diff --git a/android/examples/OpenGL/Transform/Bird/Bird.pde b/android/examples/OpenGL/Transform/Bird/Bird.pde deleted file mode 100644 index 686c08c63..000000000 --- a/android/examples/OpenGL/Transform/Bird/Bird.pde +++ /dev/null @@ -1,66 +0,0 @@ -// Issues: the entire screen is white for a second at the beginning, then -// the wings of the bird are black - -/** - * Simple 3D Bird - * by Ira Greenberg. - * - * Using a box and 2 rects to simulate a flying bird. - * Trig functions handle the flapping and sinuous movement. - */ - -float ang = 0, ang2 = 0, ang3 = 0, ang4 = 0; -float px = 0, py = 0, pz = 0; -float flapSpeed = 0.2; - -void setup(){ - size(displayWidth, displayHeight, P3D); - noStroke(); -} - -void draw(){ - background(0); - lights(); - - // Flight - px = sin(radians(ang3)) * 170; - py = cos(radians(ang3)) * 300; - pz = sin(radians(ang4)) * 500; - translate(width/2 + px, height/2 + py, -700+pz); - rotateX(sin(radians(ang2)) * 120); - rotateY(sin(radians(ang2)) * 50); - rotateZ(sin(radians(ang2)) * 65); - - // Body - fill(153); - box(20, 100, 20); - - - // Left wing - fill(204); - pushMatrix(); - rotateY(sin(radians(ang)) * -20); - rect(-75, -50, 75, 100); - popMatrix(); - - // Right wing - pushMatrix(); - rotateY(sin(radians(ang)) * 20); - rect(0, -50, 75, 100); - popMatrix(); - - // Wing flap - ang += flapSpeed; - if (ang > 3) { - flapSpeed *= -1; - } - if (ang < -3) { - flapSpeed *= -1; - } - - // Increment angles - ang2 += 0.01; - ang3 += 2.0; - ang4 += 0.75; -} - diff --git a/android/examples/OpenGL/Transform/Birds/Bird.pde b/android/examples/OpenGL/Transform/Birds/Bird.pde deleted file mode 100644 index 84ada2603..000000000 --- a/android/examples/OpenGL/Transform/Birds/Bird.pde +++ /dev/null @@ -1,99 +0,0 @@ -class Bird { - - // Properties - float offsetX, offsetY, offsetZ; - float w, h; - int bodyFill; - int wingFill; - float ang = 0, ang2 = 0, ang3 = 0, ang4 = 0; - float radiusX = 120, radiusY = 200, radiusZ = 700; - float rotX = 15, rotY = 10, rotZ = 5; - float flapSpeed = 0.4; - float rotSpeed = 0.1; - - // Constructors - Bird(){ - this(0, 0, 0, 60, 80); - } - - Bird(float offsetX, float offsetY, float offsetZ, - float w, float h){ - this.offsetX = offsetX; - this.offsetY = offsetY; - this.offsetZ = offsetZ; - this.h = h; - this.w = w; - bodyFill = color(153); - wingFill = color(204); - } - - void setFlight(float radiusX, float radiusY, float radiusZ, - float rotX, float rotY, float rotZ){ - this.radiusX = radiusX; - this.radiusY = radiusY; - this.radiusZ = radiusZ; - - this.rotX = rotX; - this.rotY = rotY; - this.rotZ = rotZ; - } - - void setWingSpeed(float flapSpeed){ - this.flapSpeed = flapSpeed; - } - - void setRotSpeed(float rotSpeed){ - this.rotSpeed = rotSpeed; - } - - void fly() { - pushMatrix(); - float px, py, pz; - - // Flight - px = sin(radians(ang3)) * radiusX; - py = cos(radians(ang3)) * radiusY; - pz = sin(radians(ang4)) * radiusZ; - - translate(width/2 + offsetX + px, height/2 + offsetY+py, -700 + offsetZ+pz); - - rotateX(sin(radians(ang2)) * rotX); - rotateY(sin(radians(ang2)) * rotY); - rotateZ(sin(radians(ang2)) * rotZ); - - // Body - fill(bodyFill); - box(w/5, h, w/5); - - // Left wing - fill(wingFill); - pushMatrix(); - rotateY(sin(radians(ang)) * 20); - rect(0, -h/2, w, h); - popMatrix(); - - // Right wing - pushMatrix(); - rotateY(sin(radians(ang)) * -20); - rect(-w, -h/2, w, h); - popMatrix(); - - // Wing flap - ang += flapSpeed; - if (ang > 3) { - flapSpeed*=-1; - } - if (ang < -3) { - flapSpeed*=-1; - } - - // Ang's run trig functions - ang2 += rotSpeed; - ang3 += 1.25; - ang4 += 0.55; - popMatrix(); - } -} - - - diff --git a/android/examples/OpenGL/Transform/Birds/Birds.pde b/android/examples/OpenGL/Transform/Birds/Birds.pde deleted file mode 100644 index f4088489c..000000000 --- a/android/examples/OpenGL/Transform/Birds/Birds.pde +++ /dev/null @@ -1,56 +0,0 @@ -// Issues: the entire screen is white for a second at the beginning, then -// the wings of the birds are black - -/** - * Crazy Flocking 3D Birds - * by Ira Greenberg. - * - * Simulates a flock of birds using a Bird class and nested - * pushMatrix() / popMatrix() functions. - * Trigonometry functions handle the flapping and sinuous movement. - */ - -// Flock array -int birdCount = 200; -Bird[]birds = new Bird[birdCount]; -float[]x = new float[birdCount]; -float[]y = new float[birdCount]; -float[]z = new float[birdCount]; -float[]rx = new float[birdCount]; -float[]ry = new float[birdCount]; -float[]rz = new float[birdCount]; -float[]spd = new float[birdCount]; -float[]rot = new float[birdCount]; - -void setup() { - size(displayWidth, displayHeight, P3D); - noStroke(); - - // Initialize arrays with random values - for (int i = 0; i < birdCount; i++){ - birds[i] = new Bird(random(-300, 300), random(-300, 300), - random(-500, -2500), random(5, 30), random(5, 30)); - - x[i] = random(20, 340); - y[i] = random(30, 350); - z[i] = random(1000, 4800); - rx[i] = random(-160, 160); - ry[i] = random(-55, 55); - rz[i] = random(-20, 20); - spd[i] = random(.1, 3.75); - rot[i] = random(.025, .15); - } -} - -void draw() { - background(0); - lights(); - for (int i = 0; i < birdCount; i++){ - birds[i].setFlight(x[i], y[i], z[i], rx[i], ry[i], rz[i]); - birds[i].setWingSpeed(spd[i]); - birds[i].setRotSpeed(rot[i]); - birds[i].fly(); - } -} - - diff --git a/android/examples/OpenGL/Transform/CubesWithinCube/Cube.pde b/android/examples/OpenGL/Transform/CubesWithinCube/Cube.pde deleted file mode 100644 index 271792623..000000000 --- a/android/examples/OpenGL/Transform/CubesWithinCube/Cube.pde +++ /dev/null @@ -1,72 +0,0 @@ - -// Custom Cube Class - -class Cube{ - PVector[] vertices = new PVector[24]; - float w, h, d; - - // Default constructor - Cube(){ } - - // Constructor 2 - Cube(float w, float h, float d) { - this.w = w; - this.h = h; - this.d = d; - - // cube composed of 6 quads - //front - vertices[0] = new PVector(-w/2,-h/2,d/2); - vertices[1] = new PVector(w/2,-h/2,d/2); - vertices[2] = new PVector(w/2,h/2,d/2); - vertices[3] = new PVector(-w/2,h/2,d/2); - //left - vertices[4] = new PVector(-w/2,-h/2,d/2); - vertices[5] = new PVector(-w/2,-h/2,-d/2); - vertices[6] = new PVector(-w/2,h/2,-d/2); - vertices[7] = new PVector(-w/2,h/2,d/2); - //right - vertices[8] = new PVector(w/2,-h/2,d/2); - vertices[9] = new PVector(w/2,-h/2,-d/2); - vertices[10] = new PVector(w/2,h/2,-d/2); - vertices[11] = new PVector(w/2,h/2,d/2); - //back - vertices[12] = new PVector(-w/2,-h/2,-d/2); - vertices[13] = new PVector(w/2,-h/2,-d/2); - vertices[14] = new PVector(w/2,h/2,-d/2); - vertices[15] = new PVector(-w/2,h/2,-d/2); - //top - vertices[16] = new PVector(-w/2,-h/2,d/2); - vertices[17] = new PVector(-w/2,-h/2,-d/2); - vertices[18] = new PVector(w/2,-h/2,-d/2); - vertices[19] = new PVector(w/2,-h/2,d/2); - //bottom - vertices[20] = new PVector(-w/2,h/2,d/2); - vertices[21] = new PVector(-w/2,h/2,-d/2); - vertices[22] = new PVector(w/2,h/2,-d/2); - vertices[23] = new PVector(w/2,h/2,d/2); - } - void create(){ - // Draw cube - for (int i=0; i<6; i++){ - beginShape(QUADS); - for (int j=0; j<4; j++){ - vertex(vertices[j+4*i].x, vertices[j+4*i].y, vertices[j+4*i].z); - } - endShape(); - } - } - void create(color[]quadBG){ - // Draw cube - for (int i=0; i<6; i++){ - fill(quadBG[i]); - beginShape(QUADS); - for (int j=0; j<4; j++){ - vertex(vertices[j+4*i].x, vertices[j+4*i].y, vertices[j+4*i].z); - } - endShape(); - } - } -} - - diff --git a/android/examples/OpenGL/Transform/CubesWithinCube/CubesWithinCube.pde b/android/examples/OpenGL/Transform/CubesWithinCube/CubesWithinCube.pde deleted file mode 100644 index 9a07dbc12..000000000 --- a/android/examples/OpenGL/Transform/CubesWithinCube/CubesWithinCube.pde +++ /dev/null @@ -1,118 +0,0 @@ -/** - * Cubes Contained Within a Cube - * by Ira Greenberg. - * - * Collision detection against all - * outer cube's surfaces. - * Uses the Point3D and Cube classes. - */ - -Cube stage; // external large cube -int cubies = 20; -Cube[]c = new Cube[cubies]; // internal little cubes -color[][]quadBG = new color[cubies][6]; - -// Controls cubie's movement -float[]x = new float[cubies]; -float[]y = new float[cubies]; -float[]z = new float[cubies]; -float[]xSpeed = new float[cubies]; -float[]ySpeed = new float[cubies]; -float[]zSpeed = new float[cubies]; - -// Controls cubie's rotation -float[]xRot = new float[cubies]; -float[]yRot = new float[cubies]; -float[]zRot = new float[cubies]; - -// Size of external cube -float bounds = 300; - -void setup() { - size(640, 360, P3D); - orientation(LANDSCAPE); - - for (int i = 0; i < cubies; i++){ - // Each cube face has a random color component - float colorShift = random(-75, 75); - quadBG[i][0] = color(0); - quadBG[i][1] = color(51); - quadBG[i][2] = color(102); - quadBG[i][3] = color(153); - quadBG[i][4] = color(204); - quadBG[i][5] = color(255); - - // Cubies are randomly sized - float cubieSize = random(5, 15); - c[i] = new Cube(cubieSize, cubieSize, cubieSize); - - // Initialize cubie's position, speed and rotation - x[i] = 0; - y[i] = 0; - z[i] = 0; - - xSpeed[i] = random(-1, 1); - ySpeed[i] = random(-1, 1); - zSpeed[i] = random(-1, 1); - - xRot[i] = random(40, 100); - yRot[i] = random(40, 100); - zRot[i] = random(40, 100); - } - - // Instantiate external large cube - stage = new Cube(bounds, bounds, bounds); -} - -void draw(){ - background(50); - lights(); - - // Center in display window - translate(width/2, height/2, -130); - - // Outer transparent cube - noFill(); - - // Rotate everything, including external large cube - rotateX(frameCount * 0.001); - rotateY(frameCount * 0.002); - rotateZ(frameCount * 0.001); - stroke(255); - - // Draw external large cube - stage.create(); - - // Move and rotate cubies - for (int i = 0; i < cubies; i++){ - pushMatrix(); - translate(x[i], y[i], z[i]); - rotateX(frameCount*PI/xRot[i]); - rotateY(frameCount*PI/yRot[i]); - rotateX(frameCount*PI/zRot[i]); - noStroke(); - c[i].create(quadBG[i]); - x[i] += xSpeed[i]; - y[i] += ySpeed[i]; - z[i] += zSpeed[i]; - popMatrix(); - - // Draw lines connecting cubbies - stroke(0); - if (i < cubies-1){ - line(x[i], y[i], z[i], x[i+1], y[i+1], z[i+1]); - } - - // Check wall collisions - if (x[i] > bounds/2 || x[i] < -bounds/2){ - xSpeed[i]*=-1; - } - if (y[i] > bounds/2 || y[i] < -bounds/2){ - ySpeed[i]*=-1; - } - if (z[i] > bounds/2 || z[i] < -bounds/2){ - zSpeed[i]*=-1; - } - } -} - diff --git a/android/examples/OpenGL/Transform/PushPopCubes/PushPopCubes.pde b/android/examples/OpenGL/Transform/PushPopCubes/PushPopCubes.pde deleted file mode 100644 index 21b252b74..000000000 --- a/android/examples/OpenGL/Transform/PushPopCubes/PushPopCubes.pde +++ /dev/null @@ -1,149 +0,0 @@ -/** - * PushPop Cubes - * by Ira Greenberg. - * - * Array of rotating cubes creates - * dynamic field patterns. Color - * controlled by light sources. Example - * of pushMatrix() and popMatrix(). - */ - -// Cube class required -float ang; -int rows = 21; -int cols = 21; -int cubeCount = rows*cols; -int colSpan, rowSpan; -float rotspd = 2.0; -Cube[] cubes = new Cube[cubeCount]; -float[] angs = new float[cubeCount]; -float[] rotvals = new float[cubeCount]; - -void setup(){ - size(displayWidth, displayHeight, P3D); - - colSpan = width/(cols-1); - rowSpan = height/(rows-1); - noStroke(); - - // instantiate cubes - for (int i = 0; i < cubeCount; i++){ - cubes[i] = new Cube(24, 20, 10, 0, 0, 0); - /* 3 different rotation options - - 1st option: cubes each rotate uniformly - - 2nd option: cubes each rotate randomly - - 3rd option: cube columns rotate as waves - To try the different rotations, leave one - of the rotVals[i] lines uncommented below - and the other 2 commented out. */ - - //rotvals[i] = rotspd; - //rotvals[i] = random(-rotspd * 2, rotspd * 2); - rotvals[i] = rotspd += .01; - } -} - -void draw(){ - int cubeCounter = 0; - background(0); - fill(200); - - // Set up some different colored lights - pointLight(51, 102, 255, width/3, height/2, 100); - pointLight(200, 40, 60, width/1.5, height/2, -150); - - // Raise overall light in scene - ambientLight(170, 170, 100); - - // Translate, rotate and draw cubes - for (int i = 0; i < cols; i++){ - for (int j = 0; j < rows; j++){ - pushMatrix(); - /* Translate each block. - pushmatix and popmatrix add each cube - translation to matrix, but restore - original, so each cube rotates around its - owns center */ - translate(i * colSpan, j * rowSpan, -20); - //rotate each cube around y and x axes - rotateY(radians(angs[cubeCounter])); - rotateX(radians(angs[cubeCounter])); - cubes[cubeCounter].drawCube(); - popMatrix(); - cubeCounter++; - } - } - // Angs used in rotate function calls above - for (int i = 0; i < cubeCount; i++){ - angs[i] += rotvals[i]; - } -} - -// Simple Cube class, based on Quads -class Cube { - - // Properties - int w, h, d; - int shiftX, shiftY, shiftZ; - - // Constructor - Cube(int w, int h, int d, int shiftX, int shiftY, int shiftZ){ - this.w = w; - this.h = h; - this.d = d; - this.shiftX = shiftX; - this.shiftY = shiftY; - this.shiftZ = shiftZ; - } - - /* Main cube drawing method, which looks - more confusing than it really is. It's - just a bunch of rectangles drawn for - each cube face */ - void drawCube(){ - - // Front face - beginShape(QUADS); - normal(1, 0, 0); - vertex(-w/2 + shiftX, -h/2 + shiftY, -d/2 + shiftZ); - vertex(w + shiftX, -h/2 + shiftY, -d/2 + shiftZ); - vertex(w + shiftX, h + shiftY, -d/2 + shiftZ); - vertex(-w/2 + shiftX, h + shiftY, -d/2 + shiftZ); - - // Back face - normal(-1, 0, 0); - vertex(-w/2 + shiftX, -h/2 + shiftY, d + shiftZ); - vertex(w + shiftX, -h/2 + shiftY, d + shiftZ); - vertex(w + shiftX, h + shiftY, d + shiftZ); - vertex(-w/2 + shiftX, h + shiftY, d + shiftZ); - - // Left face - normal(0, -1, 0); - vertex(-w/2 + shiftX, -h/2 + shiftY, -d/2 + shiftZ); - vertex(-w/2 + shiftX, -h/2 + shiftY, d + shiftZ); - vertex(-w/2 + shiftX, h + shiftY, d + shiftZ); - vertex(-w/2 + shiftX, h + shiftY, -d/2 + shiftZ); - - // Right face - normal(0, 1, 0); - vertex(w + shiftX, -h/2 + shiftY, -d/2 + shiftZ); - vertex(w + shiftX, -h/2 + shiftY, d + shiftZ); - vertex(w + shiftX, h + shiftY, d + shiftZ); - vertex(w + shiftX, h + shiftY, -d/2 + shiftZ); - - // Top face - normal(0, 0, 1); - vertex(-w/2 + shiftX, -h/2 + shiftY, -d/2 + shiftZ); - vertex(w + shiftX, -h/2 + shiftY, -d/2 + shiftZ); - vertex(w + shiftX, -h/2 + shiftY, d + shiftZ); - vertex(-w/2 + shiftX, -h/2 + shiftY, d + shiftZ); - - // Bottom face - normal(0, 0, -1); - vertex(-w/2 + shiftX, h + shiftY, -d/2 + shiftZ); - vertex(w + shiftX, h + shiftY, -d/2 + shiftZ); - vertex(w + shiftX, h + shiftY, d + shiftZ); - vertex(-w/2 + shiftX, h + shiftY, d + shiftZ); - endShape(); - } -} diff --git a/android/examples/OpenGL/Typography/KineticType/KineticType.pde b/android/examples/OpenGL/Typography/KineticType/KineticType.pde deleted file mode 100644 index e2f694dcd..000000000 --- a/android/examples/OpenGL/Typography/KineticType/KineticType.pde +++ /dev/null @@ -1,68 +0,0 @@ -/** - * Kinetic Type - * by Zach Lieberman. - * - * Using push() and pop() to define the curves of the lines of type. - */ - -Line ln; -Line lns[]; - -String words[] = { - "sometimes it's like", "the lines of text", "are so happy", "that they want to dance", - "or leave the page or jump", "can you blame them?", "living on the page like that", - "waiting to be read..." -}; - -void setup() { - size(displayWidth, displayHeight, P3D); - orientation(LANDSCAPE); - - // Array of line objects - lns = new Line[8]; - - // Load the font from the sketch's data directory - textFont(loadFont("Univers-66.vlw"), 1.0); - - // White type - fill(255); - - // Creating the line objects - for(int i = 0; i < 8; i++) { - // For every line in the array, create a Line object to animate - // i * 70 is the spacing - ln = new Line(words[i], 0, i * 70); - lns[i] = ln; - } - - // To avoid letter occluding each other on the edges - hint(DISABLE_DEPTH_TEST); -} - -void draw() { - background(0); - - translate(-200, -50, -450); - rotateY(0.3); - - // Now animate every line object & draw it... - for(int i = 0; i < 8; i++) { - float f1 = sin((i + 1.0) * (millis() / 10000.0) * TWO_PI); - float f2 = sin((8.0 - i) * (millis() / 10000.0) * TWO_PI); - Line line = lns[i]; - pushMatrix(); - translate(0.0, line.yPosition, 0.0); - for(int j = 0; j < line.myLetters.length; j++) { - if(j != 0) { - translate(textWidth(line.myLetters[j - 1].myChar) * 75, 0.0, 0.0); - } - rotateY(f1 * 0.005 * f2); - pushMatrix(); - scale(75.0); - text(line.myLetters[j].myChar, 0.0, 0.0); - popMatrix(); - } - popMatrix(); - } -} - diff --git a/android/examples/OpenGL/Typography/KineticType/Letter.pde b/android/examples/OpenGL/Typography/KineticType/Letter.pde deleted file mode 100644 index d12a9a78d..000000000 --- a/android/examples/OpenGL/Typography/KineticType/Letter.pde +++ /dev/null @@ -1,13 +0,0 @@ -class Letter -{ - char myChar; - float x; - float y; - - Letter(char c, float f, float f1) - { - myChar = c; - x = f; - y = f1; - } -} diff --git a/android/examples/OpenGL/Typography/KineticType/Line.pde b/android/examples/OpenGL/Typography/KineticType/Line.pde deleted file mode 100644 index f01b9cdc8..000000000 --- a/android/examples/OpenGL/Typography/KineticType/Line.pde +++ /dev/null @@ -1,28 +0,0 @@ -class Line -{ - String myString; - int xPosition; - int yPosition; - int highlightNum; - float speed; - float curlInX; - Letter myLetters[]; - - Line(String s, int i, int j) - { - myString = s; - xPosition = i; - yPosition = j; - myLetters = new Letter[s.length()]; - float f1 = 0.0; - for(int k = 0; k < s.length(); k++) - { - char c = s.charAt(k); - f1 += textWidth(c); - Letter letter = new Letter(c, f1, 0.0); - myLetters[k] = letter; - } - - curlInX = 0.1; - } -} diff --git a/android/examples/OpenGL/Typography/KineticType/Word.pde b/android/examples/OpenGL/Typography/KineticType/Word.pde deleted file mode 100644 index 6bc2f2deb..000000000 --- a/android/examples/OpenGL/Typography/KineticType/Word.pde +++ /dev/null @@ -1,10 +0,0 @@ -class Word -{ - String myName; - int x; - - Word(String s) - { - myName = s; - } -} diff --git a/android/examples/OpenGL/Typography/KineticType/data/Univers-66.vlw b/android/examples/OpenGL/Typography/KineticType/data/Univers-66.vlw deleted file mode 100644 index d2d08c24749c2e3da957da256b80585a31514ddf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 116537 zcmeHwZK!TrTh?~_78+%))OgE}PCGx-{AgKPmYFThGRw+sWoBx+Gb_uo_Iuur5EZeg zei%r&gQy=uv5<%gl9mQVgg=%b6=dN0QS?JX76pP*=<5EsuKR0@x%N8mdwS2=XYU8* zGv^%R9{0FEuKONijya$CJb3Wnk3D$s;3H)FTx<^>zW+16M~;8BY`<2vUnbkf%Jylp zz31WkKlOdGe0bBVzaht;BHL%lrhV%EGh~zgPL$WD%J!Mq^c?Lz@<-%Y`&L;#TDD(|bCKmE zzDtgk_OoSE`L!N$zUK$!Sov$+$H``OBFoP|eE)+hIae8eg=`-$o64#EzvtoWKmQ)t zs~n$HHl_Knhp+#iua~{bt@hIGqh$L`IzW%d6Eyt?2%12psFYSKjr(~~k{1R-| z4t3i1=g6k@ze=`WF59P>oUi}yZ;|8Al}%;UI?5?Le@gZKJlS-w{`r-%seOOp!`FZE zO!mKCHq~E!W$j$f|E_*Gl}&l7|5JM#QgkyB*(ci$&vzX^3i z&L92=DgVu~s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Dx6@7OApbUtN;M}oyDM02j#R~f(W3fc05CvmogM=;5ip~k@ijmdRB&qvn5fbN zG(Xbq!Rff&*c!hZPI8TbC~DIH4i8ybp6v?P*V^Le1a=Y>KkA#C;{%FqfCK~&yaIx2(qdXBp8?E{7G zR+r;cI8+bPUkuX(f*fUaNs&pB9@~L5mt2^?vZWjq7%q-`u?qa}T8BP(A7)S4obaXL zR8xj<%aD%0%d<{uc3yI!*|qn?M?HFTPKT#`Ek2iV+eW1&0IahKZAZ_9w9i~-XQsoj z7K|`;aJEASzXj4609idS+}iVfrU>kk=2XC^7=ot+KKS*{gxm(Led*p{8A)!At!9|& zIYoY(cb3i!HA4&J`@MJO#K}WCyYZvFcYKgOKkGa&bdL)v7-!sO-qAxGnZqrx!ecv=5HUGS|}cIZCnFFe7iw(2Tq>gLD5t&CrbOfNo}RBe!U9d^g$6h0imC z8@Zvu&9GvvnW6Rcjyh5CZ+h)24kIvkug9R4fJFWC*#-CC+ z$eXc+)E%rs*3Ub2P~2)N(@5u z)e?bLTJmYps-@0){ - buff = buff.substring(1); - } - break; - case 13: // Avoid special keys - case 10: - case 65535: - case 127: - case 27: - break; - default: - if(textWidth(buff+k)+leftmargin < width-rightmargin){ - didntTypeYet = false; - buff=k+buff; - } - break; - } -} - diff --git a/android/examples/OpenGL/Typography/Typing/data/Univers45.vlw b/android/examples/OpenGL/Typography/Typing/data/Univers45.vlw deleted file mode 100644 index 040e02170efb50dbce4576b305e0b6b4f53de200..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 95193 zcmeHwdx&ORc2`X+I+-LxDvs}o-jvDAB#vgZ##bCQno{E{K9bg`Gdk+n8ej1-v2w3h zP!KI*z$l^?1`HxWivbY>25QhCi3nE6Kl4X~6pDxlYB7ppz&lg^e(SyV-sh{j)7`hb zy6e!V&pvytz4m(Vwa<6HulDx#KC-vB_ja5guygOhYhUr5Xn!fruf+NJINycyy*Pi| zgV)~sUAP|L+{gJ&JKuYa#fI%;Nko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HZ zi_+O^ht^E49`DtwMxm>jZZ!lb3A-C@df6+lkPcf?_GI9ld_@#cW5M}iyo zDJQ7N^pG!@K!{bX6y^b;Sdh-e!K^iBAe4Of00h|@aupexYz`&P)+S0epq}PX;%wD( z6ZNHO!M-hc<*~n6kou}F4Zn$7xOOqLIj?H1y`IdVEoSF*?o05N<|>>{LlqOHXA4nI zM>3eGIH!O(9s1}aWg=yT(@74@f<^)OpVPs6hKUr+>86PkBwwa&dQ;8KTs1 zL1vsNMY`-kE3_{lU^^vR zswo4rxNd0yZxe_2feXiW8te;Bcth7H-1IxRX>tQj()?|ADehEfr{noOIccE?yE`}F zq`NFb)VM*bxD;81dxQonCxlU{yfQ+3X1T|I&dtOL5x@eunK&Vg1HjG934xgClo@E` zgfIpG>$;H>!nlW_C7VtJfd2>>b>c8`GwH;E%uy>&2%n?hM{OiZ121)Aux(CgiY-o7 z)^T2z*0~)gi+nBvVTSb{3(&)(qvH0?#B+P4>Dyr|RqNx8_4A{dJkTF&brBH;URjFX zyU+~{v~p;KWe;MVfy5U+PU1sc6aUE&XBJoxXI5Eo&RSu`IbvzW`LiI-+{0JV@-R8r z-;Nvnp;-OdH~HIzrP6|@)O)6@Gylt2V0J9aV6|prpf{18vwMis${cuC^+oJ_N(|D+ zs&rfrDz>Z-ReC;DE#p;PR@tdm5O8gNu7=OEzPQX+2`BrH{=v1o`VWeM?q5yXCv=la zyl>gtjH1~mqm3tIq%|4D&{fGkT62|k;OK-7Rilp2Y+8^#_c4Uxv=v2=s0oA>(Q9y3 z5(c!dF39JYwPs+{6|G4zT1XD#NBZOZBY){O%FZ*sAMM-hKl+E{ width || center.x < 0 || + center.y > height || center.y < 0 || lifespan < 0) { + return true; + } + else { + return false; + } + } + + void update() { + // Decrease life + lifespan = lifespan - 1; + // Apply gravity + velocity.add(gravity); + part.tint(255, lifespan); + // Move the particle according to its velocity + part.translate(velocity.x, velocity.y); + // and also update the center + center.add(velocity); + } +} diff --git a/android/examples/Topics/Create Shapes/ParticleSystemPShape/ParticleSystem.pde b/android/examples/Topics/Create Shapes/ParticleSystemPShape/ParticleSystem.pde new file mode 100644 index 000000000..e2215046e --- /dev/null +++ b/android/examples/Topics/Create Shapes/ParticleSystemPShape/ParticleSystem.pde @@ -0,0 +1,43 @@ +// The Particle System + +class ParticleSystem { + // It's just an ArrayList of particle objects + ArrayList particles; + + // The PShape to group all the particle PShapes + PShape particleShape; + + ParticleSystem(int n) { + particles = new ArrayList(); + // The PShape is a group + particleShape = createShape(GROUP); + + // Make all the Particles + for (int i = 0; i < n; i++) { + Particle p = new Particle(); + particles.add(p); + // Each particle's PShape gets added to the System PShape + particleShape.addChild(p.getShape()); + } + } + + void update() { + for (Particle p : particles) { + p.update(); + } + } + + void setEmitter(float x, float y) { + for (Particle p : particles) { + // Each particle gets reborn at the emitter location + if (p.isDead()) { + p.rebirth(x, y); + } + } + } + + void display() { + shape(particleShape); + } +} + diff --git a/android/examples/Topics/Create Shapes/ParticleSystemPShape/ParticleSystemPShape.pde b/android/examples/Topics/Create Shapes/ParticleSystemPShape/ParticleSystemPShape.pde new file mode 100644 index 000000000..a9a30d0f5 --- /dev/null +++ b/android/examples/Topics/Create Shapes/ParticleSystemPShape/ParticleSystemPShape.pde @@ -0,0 +1,42 @@ +/** + * ParticleSystemPShape + * + * A particle system optimized for drawing using PShape + */ + +// Particle System object +ParticleSystem ps; +// A PImage for particle's texture +PImage sprite; + +void setup() { + size(640, 360, P2D); + orientation(LANDSCAPE); + // Load the image + sprite = loadImage("sprite.png"); + // A new particle system with 1,000 particles + ps = new ParticleSystem(1000); + + // Writing to the depth buffer is disabled to avoid rendering + // artifacts due to the fact that the particles are semi-transparent + // but not z-sorted. + hint(DISABLE_DEPTH_MASK); + +} + +void draw () { + background(0); + // Update and display system + ps.update(); + ps.display(); + + // Set the particle system's emitter location to the mouse + ps.setEmitter(mouseX,mouseY); + + // Display frame rate + fill(255); + textSize(16); + text("Frame rate: " + int(frameRate),10,20); + +} + diff --git a/android/examples/Topics/Create Shapes/PathPShape/PathPShape.pde b/android/examples/Topics/Create Shapes/PathPShape/PathPShape.pde new file mode 100644 index 000000000..becab8e4c --- /dev/null +++ b/android/examples/Topics/Create Shapes/PathPShape/PathPShape.pde @@ -0,0 +1,37 @@ +/** + * PathPShape + * + * A simple path using PShape + */ + +// A PShape object +PShape path; + +void setup() { + size(640, 360, P2D); + orientation(LANDSCAPE); + // Create the shape + path = createShape(); + // Set fill and stroke + path.noFill(); + path.stroke(255); + path.strokeWeight(2); + + float x = 0; + // Calculate the path as a sine wave + for (float a = 0; a < TWO_PI; a+=0.1) { + path.vertex(x,sin(a)*100); + x+= 5; + } + // The path is complete + path.end(); + +} + +void draw() { + background(51); + // Draw the path at the mouse location + translate(mouseX, mouseY); + shape(path); +} + diff --git a/android/examples/Topics/Create Shapes/PolygonPShape/PolygonPShape.pde b/android/examples/Topics/Create Shapes/PolygonPShape/PolygonPShape.pde new file mode 100644 index 000000000..c4c67340f --- /dev/null +++ b/android/examples/Topics/Create Shapes/PolygonPShape/PolygonPShape.pde @@ -0,0 +1,41 @@ + +/** + * PrimitivePShape. + * + * Using a PShape to display a custom polygon. + */ + +// The PShape object +PShape star; + +void setup() { + size(640, 360, P2D); + orientation(LANDSCAPE); + // First create the shape + star = createShape(); + // You can set fill and stroke + star.fill(102); + star.stroke(255); + star.strokeWeight(2); + // Here, we are hardcoding a series of vertices + star.vertex(0, -50); + star.vertex(14, -20); + star.vertex(47, -15); + star.vertex(23, 7); + star.vertex(29, 40); + star.vertex(0, 25); + star.vertex(-29, 40); + star.vertex(-23, 7); + star.vertex(-47, -15); + star.vertex(-14, -20); + star.end(CLOSE); +} + +void draw() { + background(51); + // We can use translate to move the PShape + translate(mouseX, mouseY); + // Display the shape + shape(star); +} + diff --git a/android/examples/Topics/Create Shapes/PolygonPShapeOOP/PolygonPShapeOOP.pde b/android/examples/Topics/Create Shapes/PolygonPShapeOOP/PolygonPShapeOOP.pde new file mode 100644 index 000000000..e20dd90fd --- /dev/null +++ b/android/examples/Topics/Create Shapes/PolygonPShapeOOP/PolygonPShapeOOP.pde @@ -0,0 +1,26 @@ +/** + * PolygonPShapeOOP. + * + * Wrapping a PShape inside a custom class + */ + + +// A Star object +Star s; + +void setup() { + size(640, 360, P2D); + orientation(LANDSCAPE); + // Make a new Star + s = new Star(); + +} + +void draw() { + background(51); + // Display the star + s.display(); + // Move the star + s.move(); +} + diff --git a/android/examples/Topics/Create Shapes/PolygonPShapeOOP/Star.pde b/android/examples/Topics/Create Shapes/PolygonPShapeOOP/Star.pde new file mode 100644 index 000000000..9899910d1 --- /dev/null +++ b/android/examples/Topics/Create Shapes/PolygonPShapeOOP/Star.pde @@ -0,0 +1,50 @@ +// A class to describe a Star shape + +class Star { + + // The PShape object + PShape s; + // The location where we will draw the shape + float x, y; + + Star() { + x = 0; + y = height/2; + // First create the shape + s = createShape(); + // You can set fill and stroke + s.fill(102); + s.stroke(255); + s.strokeWeight(2); + // Here, we are hardcoding a series of vertices + s.vertex(0, -50); + s.vertex(14, -20); + s.vertex(47, -15); + s.vertex(23, 7); + s.vertex(29, 40); + s.vertex(0, 25); + s.vertex(-29, 40); + s.vertex(-23, 7); + s.vertex(-47, -15); + s.vertex(-14, -20); + // The shape is complete + s.end(CLOSE); + } + + void move() { + // Demonstrating some simple motion + x++; + if (x > width+100) { + x = -100; + } + } + + void display() { + // Locating and drawing the shape + pushMatrix(); + translate(x, y); + shape(s); + popMatrix(); + } +} + diff --git a/android/examples/Topics/Create Shapes/PolygonPShapeOOP2/Polygon.pde b/android/examples/Topics/Create Shapes/PolygonPShapeOOP2/Polygon.pde new file mode 100644 index 000000000..e775fb436 --- /dev/null +++ b/android/examples/Topics/Create Shapes/PolygonPShapeOOP2/Polygon.pde @@ -0,0 +1,34 @@ +// A class to describe a Polygon (with a PShape) + +class Polygon { + // The PShape object + PShape s; + // The location where we will draw the shape + float x, y; + // Variable for simple motion + float speed; + + Polygon(PShape s_) { + x = random(width); + y = random(-500, -100); + s = s_; + speed = random(2, 6); + } + + // Simple motion + void move() { + y+=speed; + if (y > height+100) { + y = -100; + } + } + + // Draw the object + void display() { + pushMatrix(); + translate(x, y); + shape(s); + popMatrix(); + } +} + diff --git a/android/examples/Topics/Create Shapes/PolygonPShapeOOP2/PolygonPShapeOOP2.pde b/android/examples/Topics/Create Shapes/PolygonPShapeOOP2/PolygonPShapeOOP2.pde new file mode 100644 index 000000000..6d8cb7ed5 --- /dev/null +++ b/android/examples/Topics/Create Shapes/PolygonPShapeOOP2/PolygonPShapeOOP2.pde @@ -0,0 +1,52 @@ +/** + * PolygonPShapeOOP. + * + * Wrapping a PShape inside a custom class + * and demonstrating how we can have a multiple objects each + * using the same PShape. + */ + + +// A list of objects +ArrayList polygons; + +void setup() { + size(640, 360, P2D); + orientation(LANDSCAPE); + // Make a PShape + PShape star = createShape(); + star.fill(0,127); + star.stroke(0); + star.vertex(0, -50); + star.vertex(14, -20); + star.vertex(47, -15); + star.vertex(23, 7); + star.vertex(29, 40); + star.vertex(0, 25); + star.vertex(-29, 40); + star.vertex(-23, 7); + star.vertex(-47, -15); + star.vertex(-14, -20); + star.end(CLOSE); + + // Make an ArrayList + polygons = new ArrayList(); + + // Add a bunch of objects to the ArrayList + // Pass in reference to the PShape + // We coud make polygons with different PShapes + for (int i = 0; i < 25; i++) { + polygons.add(new Polygon(star)); + } +} + +void draw() { + background(255); + + // Display and move them all + for (Polygon poly : polygons) { + poly.display(); + poly.move(); + } +} + diff --git a/android/examples/Topics/Create Shapes/PolygonPShapeOOP3/Polygon.pde b/android/examples/Topics/Create Shapes/PolygonPShapeOOP3/Polygon.pde new file mode 100644 index 000000000..e775fb436 --- /dev/null +++ b/android/examples/Topics/Create Shapes/PolygonPShapeOOP3/Polygon.pde @@ -0,0 +1,34 @@ +// A class to describe a Polygon (with a PShape) + +class Polygon { + // The PShape object + PShape s; + // The location where we will draw the shape + float x, y; + // Variable for simple motion + float speed; + + Polygon(PShape s_) { + x = random(width); + y = random(-500, -100); + s = s_; + speed = random(2, 6); + } + + // Simple motion + void move() { + y+=speed; + if (y > height+100) { + y = -100; + } + } + + // Draw the object + void display() { + pushMatrix(); + translate(x, y); + shape(s); + popMatrix(); + } +} + diff --git a/android/examples/Topics/Create Shapes/PolygonPShapeOOP3/PolygonPShapeOOP3.pde b/android/examples/Topics/Create Shapes/PolygonPShapeOOP3/PolygonPShapeOOP3.pde new file mode 100644 index 000000000..7a5c87bb3 --- /dev/null +++ b/android/examples/Topics/Create Shapes/PolygonPShapeOOP3/PolygonPShapeOOP3.pde @@ -0,0 +1,63 @@ +/** + * PolygonPShapeOOP. + * + * Wrapping a PShape inside a custom class + * and demonstrating how we can have a multiple objects each + * using the same PShape. + */ + + +// A list of objects +ArrayList polygons; + +// Three possible shapes +PShape[] shapes = new PShape[3]; + +void setup() { + size(640, 360, P2D); + orientation(LANDSCAPE); + + shapes[0] = createShape(ELLIPSE,0,0,100,100); + shapes[0].fill(255,127); + shapes[0].stroke(0); + shapes[1] = createShape(RECT,0,0,100,100); + shapes[1].fill(255,127); + shapes[1].stroke(0); + shapes[2] = createShape(); + shapes[2].fill(0,127); + shapes[2].stroke(0); + shapes[2].vertex(0, -50); + shapes[2].vertex(14, -20); + shapes[2].vertex(47, -15); + shapes[2].vertex(23, 7); + shapes[2].vertex(29, 40); + shapes[2].vertex(0, 25); + shapes[2].vertex(-29, 40); + shapes[2].vertex(-23, 7); + shapes[2].vertex(-47, -15); + shapes[2].vertex(-14, -20); + shapes[2].end(CLOSE); + + + // Make an ArrayList + polygons = new ArrayList(); + + polygons = new ArrayList(); + + for (int i = 0; i < 25; i++) { + int selection = int(random(shapes.length)); // Pick a random index + Polygon p = new Polygon(shapes[selection]); // Use corresponding PShape to create Polygon + polygons.add(p); + } +} + +void draw() { + background(51); + + // Display and move them all + for (Polygon poly : polygons) { + poly.display(); + poly.move(); + } +} + diff --git a/android/examples/Topics/Create Shapes/PrimitivePShape/PrimitivePShape.pde b/android/examples/Topics/Create Shapes/PrimitivePShape/PrimitivePShape.pde new file mode 100644 index 000000000..c0b3f6091 --- /dev/null +++ b/android/examples/Topics/Create Shapes/PrimitivePShape/PrimitivePShape.pde @@ -0,0 +1,30 @@ +/** + * PrimitivePShape. + * + * Using a PShape to display a primitive shape (in this case, ellipse). + */ + + +// The PShape object +PShape circle; + +void setup() { + size(640, 360, P2D); + orientation(LANDSCAPE); + // Creating the PShape as an ellipse + // The corner is -50,-50 so that the center is at 0,0 + circle = createShape(RECT, -50, -25, 100, 50); +} + +void draw() { + background(51); + // We can dynamically set the stroke and fill of the shape + circle.stroke(255); + circle.strokeWeight(4); + circle.fill(map(mouseX, 0, width, 0, 255)); + // We can use translate to move the PShape + translate(mouseX, mouseY); + // Drawing the PShape + shape(circle); +} + diff --git a/android/examples/Topics/Create Shapes/WigglePShape/WigglePShape.pde b/android/examples/Topics/Create Shapes/WigglePShape/WigglePShape.pde new file mode 100644 index 000000000..7a2cc9f47 --- /dev/null +++ b/android/examples/Topics/Create Shapes/WigglePShape/WigglePShape.pde @@ -0,0 +1,23 @@ +/** + * WigglePShape. + * + * How to move the individual vertices of a PShape + */ + + +// A "Wiggler" object +Wiggler w; + +void setup() { + size(640, 360, P2D); + orientation(LANDSCAPE); + w = new Wiggler(); +} + +void draw() { + background(255); + w.display(); + w.wiggle(); +} + + diff --git a/android/examples/Topics/Create Shapes/WigglePShape/Wiggler.pde b/android/examples/Topics/Create Shapes/WigglePShape/Wiggler.pde new file mode 100644 index 000000000..bb601dccd --- /dev/null +++ b/android/examples/Topics/Create Shapes/WigglePShape/Wiggler.pde @@ -0,0 +1,66 @@ +// An object that wraps the PShape + +class Wiggler { + + // The PShape to be "wiggled" + PShape s; + // Its location + float x, y; + + // For 2D Perlin noise + float yoff = 0; + + // We are using an ArrayList to keep a duplicate copy + // of vertices original locations. + ArrayList original; + + Wiggler() { + x = width/2; + y = height/2; + + // The "original" locations of the vertices make up a circle + original = new ArrayList(); + for (float a = 0; a < TWO_PI; a+=0.2) { + PVector v = PVector.fromAngle(a); + v.mult(100); + original.add(v); + } + + // Now make the PShape with those vertices + s = createShape(); + s.fill(127); + s.stroke(0); + s.strokeWeight(2); + for (PVector v : original) { + s.vertex(v.x, v.y); + } + s.end(CLOSE); + } + + void wiggle() { + float xoff = 0; + // Apply an offset to each vertex + for (int i = 0; i < s.getVertexCount(); i++) { + // Calculate a new vertex location based on noise around "original" location + PVector pos = original.get(i); + float a = TWO_PI*noise(xoff,yoff); + PVector r = PVector.fromAngle(a); + r.mult(4); + r.add(pos); + // Set the location of each vertex to the new one + s.setVertex(i, r.x, r.y); + // increment perlin noise x value + xoff+= 0.5; + } + // Increment perlin noise y value + yoff += 0.02; + } + + void display() { + pushMatrix(); + translate(x, y); + shape(s); + popMatrix(); + } +} + diff --git a/android/examples/OpenGL/Form/Icosahedra/Dimension3D.pde b/android/examples/Topics/Geometry/Icosahedra/Dimension3D.pde similarity index 100% rename from android/examples/OpenGL/Form/Icosahedra/Dimension3D.pde rename to android/examples/Topics/Geometry/Icosahedra/Dimension3D.pde diff --git a/android/examples/OpenGL/Form/Icosahedra/Icosahedra.pde b/android/examples/Topics/Geometry/Icosahedra/Icosahedra.pde similarity index 99% rename from android/examples/OpenGL/Form/Icosahedra/Icosahedra.pde rename to android/examples/Topics/Geometry/Icosahedra/Icosahedra.pde index 94df9e73b..8d318c7ce 100644 --- a/android/examples/OpenGL/Form/Icosahedra/Icosahedra.pde +++ b/android/examples/Topics/Geometry/Icosahedra/Icosahedra.pde @@ -50,4 +50,4 @@ void draw(){ popMatrix(); } - + diff --git a/android/examples/OpenGL/Form/Icosahedra/Icosahedron.pde b/android/examples/Topics/Geometry/Icosahedra/Icosahedron.pde similarity index 100% rename from android/examples/OpenGL/Form/Icosahedra/Icosahedron.pde rename to android/examples/Topics/Geometry/Icosahedra/Icosahedron.pde diff --git a/android/examples/OpenGL/Form/Icosahedra/Shape3D.pde b/android/examples/Topics/Geometry/Icosahedra/Shape3D.pde similarity index 100% rename from android/examples/OpenGL/Form/Icosahedra/Shape3D.pde rename to android/examples/Topics/Geometry/Icosahedra/Shape3D.pde diff --git a/android/examples/Topics/Geometry/NoiseSphere/NoiseSphere.pde b/android/examples/Topics/Geometry/NoiseSphere/NoiseSphere.pde new file mode 100644 index 000000000..9c4e138f3 --- /dev/null +++ b/android/examples/Topics/Geometry/NoiseSphere/NoiseSphere.pde @@ -0,0 +1,83 @@ +/** + * Noise Sphere + * by David Pena. + * + * Uniform random distribution on the surface of a sphere. + */ + +int cuantos = 1000; +Pelo[] lista ; +float[] z = new float[cuantos]; +float[] phi = new float[cuantos]; +float[] largos = new float[cuantos]; +float radio; +float rx = 0; +float ry =0; + +void setup() { + size(displayWidth, displayHeight, P3D); + orientation(LANDSCAPE); + radio = height/3; + lista = new Pelo[cuantos]; + for (int i=0; i - * Up Arrow - increases points
- * Down Arrow - decreases points
- * 'p' key toggles between cube/pyramid
+ * tap rigth side of screen - increases points
+ * tap left side of screen - decreases points
+ * tap screen center toggles between cube/pyramid
*/ int pts = 4; @@ -24,7 +24,7 @@ boolean isPyramid = false; float angleInc; void setup(){ - size(640, 360, P3D); + size(displayWidth, displayHeight, P3D); orientation(LANDSCAPE); noStroke(); angleInc = PI/300.0; @@ -88,30 +88,25 @@ void draw(){ /* - up/down arrow keys control - polygon detail. + tapping controls polygon detail. */ -void keyPressed(){ - if(key == CODED) { - // pts - if (keyCode == UP) { - if (pts < 90){ - pts++; - } - } - else if (keyCode == DOWN) { - if (pts > 4){ - pts--; - } - } - } - if (key =='p'){ +void mousePressed(){ + if (abs(mouseX - width/2) < 50 && + abs(mouseY - height/2) < 50) { if (isPyramid){ isPyramid = false; } else { isPyramid = true; - } + } + } else if (mouseX < width/2) { + if (pts > 4){ + pts--; + } + } else if (mouseX > width/2) { + if (pts < 90){ + pts++; + } } } - + diff --git a/android/examples/OpenGL/Form/SpaceJunk/Cube.pde b/android/examples/Topics/Geometry/SpaceJunk/Cube.pde similarity index 91% rename from android/examples/OpenGL/Form/SpaceJunk/Cube.pde rename to android/examples/Topics/Geometry/SpaceJunk/Cube.pde index 168ceb5ca..121b33f9b 100644 --- a/android/examples/OpenGL/Form/SpaceJunk/Cube.pde +++ b/android/examples/Topics/Geometry/SpaceJunk/Cube.pde @@ -22,46 +22,40 @@ class Cube { void drawCube(){ beginShape(QUADS); // Front face - normal(0, 0, 1); vertex(-w/2 + shiftX, -h/2 + shiftY, -d/2 + shiftZ); vertex(w + shiftX, -h/2 + shiftY, -d/2 + shiftZ); vertex(w + shiftX, h + shiftY, -d/2 + shiftZ); vertex(-w/2 + shiftX, h + shiftY, -d/2 + shiftZ); // Back face - normal(0, 0, -1); vertex(-w/2 + shiftX, -h/2 + shiftY, d + shiftZ); vertex(w + shiftX, -h/2 + shiftY, d + shiftZ); vertex(w + shiftX, h + shiftY, d + shiftZ); vertex(-w/2 + shiftX, h + shiftY, d + shiftZ); // Left face - normal(1, 0, 0); vertex(-w/2 + shiftX, -h/2 + shiftY, -d/2 + shiftZ); vertex(-w/2 + shiftX, -h/2 + shiftY, d + shiftZ); vertex(-w/2 + shiftX, h + shiftY, d + shiftZ); vertex(-w/2 + shiftX, h + shiftY, -d/2 + shiftZ); // Right face - normal(-1, 0, 0); vertex(w + shiftX, -h/2 + shiftY, -d/2 + shiftZ); vertex(w + shiftX, -h/2 + shiftY, d + shiftZ); vertex(w + shiftX, h + shiftY, d + shiftZ); vertex(w + shiftX, h + shiftY, -d/2 + shiftZ); // Top face - normal(0, 1, 0); vertex(-w/2 + shiftX, -h/2 + shiftY, -d/2 + shiftZ); vertex(w + shiftX, -h/2 + shiftY, -d/2 + shiftZ); vertex(w + shiftX, -h/2 + shiftY, d + shiftZ); vertex(-w/2 + shiftX, -h/2 + shiftY, d + shiftZ); // Bottom face - normal(0, -1, 0); vertex(-w/2 + shiftX, h + shiftY, -d/2 + shiftZ); vertex(w + shiftX, h + shiftY, -d/2 + shiftZ); vertex(w + shiftX, h + shiftY, d + shiftZ); - vertex(-w/2 + shiftX, h + shiftY, d + shiftZ); + vertex(-w/2 + shiftX, h + shiftY, d + shiftZ); endShape(); diff --git a/android/examples/OpenGL/Form/SpaceJunk/SpaceJunk.pde b/android/examples/Topics/Geometry/SpaceJunk/SpaceJunk.pde similarity index 81% rename from android/examples/OpenGL/Form/SpaceJunk/SpaceJunk.pde rename to android/examples/Topics/Geometry/SpaceJunk/SpaceJunk.pde index af59af02a..6d8bd944d 100644 --- a/android/examples/OpenGL/Form/SpaceJunk/SpaceJunk.pde +++ b/android/examples/Topics/Geometry/SpaceJunk/SpaceJunk.pde @@ -1,8 +1,6 @@ /** * Space Junk - * by Ira Greenberg. - * Zoom suggestion - * by Danny Greenberg. + * by Ira Greenberg (zoom suggestion by Danny Greenberg). * * Rotating cubes in space using a custom Cube class. * Color controlled by light sources. Move the mouse left @@ -12,7 +10,7 @@ // Used for oveall rotation float ang; -// Cube count-lower/raise to test P3D/OPENGL performance +// Cube count-lower/raise to test performance int limit = 100; // Array for all cubes @@ -26,8 +24,8 @@ void setup() { // Instantiate cubes, passing in random vals for size and postion for (int i = 0; i< cubes.length; i++){ cubes[i] = new Cube(int(random(-10, 10)), int(random(-10, 10)), - int(random(-10, 10)), int(random(-140, 140)), int(random(-140, 140)), - int(random(-140, 140))); + int(random(-10, 10)), int(random(-140, 140)), + int(random(-140, 140)), int(random(-140, 140))); } } @@ -57,7 +55,7 @@ void draw(){ } // Used in rotate function calls above - ang++; + ang += 0.2; } - + diff --git a/android/examples/OpenGL/Form/Toroid/Toroid.pde b/android/examples/Topics/Geometry/Toroid/Toroid.pde similarity index 95% rename from android/examples/OpenGL/Form/Toroid/Toroid.pde rename to android/examples/Topics/Geometry/Toroid/Toroid.pde index 776a9cf05..a085e8159 100644 --- a/android/examples/OpenGL/Form/Toroid/Toroid.pde +++ b/android/examples/Topics/Geometry/Toroid/Toroid.pde @@ -1,6 +1,3 @@ -// Strange "lights flashing" effect, particularly noticeable at low res (pts=10, segments=20) -// ...some problem with the automatic normal calculation maybe? - /** * Interactive Toroid * by Ira Greenberg. @@ -183,4 +180,4 @@ void keyPressed(){ } } } - + diff --git a/android/examples/OpenGL/Form/Vertices/Vertices.pde b/android/examples/Topics/Geometry/Vertices/Vertices.pde similarity index 99% rename from android/examples/OpenGL/Form/Vertices/Vertices.pde rename to android/examples/Topics/Geometry/Vertices/Vertices.pde index 3d1fa1860..4aae8eb51 100644 --- a/android/examples/OpenGL/Form/Vertices/Vertices.pde +++ b/android/examples/Topics/Geometry/Vertices/Vertices.pde @@ -65,4 +65,4 @@ void drawCylinder(float topRadius, float bottomRadius, float tall, int sides) { } endShape(); } -} +} diff --git a/android/examples/Topics/Shaders/BlurFilter/BlurFilter.pde b/android/examples/Topics/Shaders/BlurFilter/BlurFilter.pde new file mode 100644 index 000000000..67b2e6ca0 --- /dev/null +++ b/android/examples/Topics/Shaders/BlurFilter/BlurFilter.pde @@ -0,0 +1,26 @@ +/** + * Blur Filter + * + * Change the default shader to apply a simple, custom blur filter. + * + * Press the mouse to switch between the custom and default shader. + */ + +PShader blur; + +void setup() { + size(640, 360, P2D); + orientation(LANDSCAPE); + blur = loadShader("blur.glsl"); + stroke(255, 0, 0); + rectMode(CENTER); +} + +void draw() { + filter(blur); + rect(mouseX, mouseY, 150, 150); + ellipse(mouseX, mouseY, 100, 100); +} + + + diff --git a/android/examples/OpenGL/Shaders/BlurFilter/data/blur.glsl b/android/examples/Topics/Shaders/BlurFilter/data/blur.glsl similarity index 100% rename from android/examples/OpenGL/Shaders/BlurFilter/data/blur.glsl rename to android/examples/Topics/Shaders/BlurFilter/data/blur.glsl diff --git a/android/examples/Topics/Shaders/EdgeDetect/EdgeDetect.pde b/android/examples/Topics/Shaders/EdgeDetect/EdgeDetect.pde new file mode 100644 index 000000000..aa3bd2695 --- /dev/null +++ b/android/examples/Topics/Shaders/EdgeDetect/EdgeDetect.pde @@ -0,0 +1,32 @@ +/** + * Edge Detection + * + * Change the default shader to apply a simple, custom edge detection filter. + * + * Press the mouse to switch between the custom and default shader. + */ + +PShader edges; +PImage img; +boolean enabled = true; + +void setup() { + size(640, 360, P2D); + orientation(LANDSCAPE); + img = loadImage("leaves.jpg"); + edges = loadShader("edges.glsl"); +} + +void draw() { + if (enabled == true) { + shader(edges); + } + image(img, 0, 0); +} + +void mousePressed() { + enabled = !enabled; + if (!enabled == true) { + resetShader(); + } +} diff --git a/android/examples/OpenGL/Shaders/EdgeFilter/data/edges.glsl b/android/examples/Topics/Shaders/EdgeDetect/data/edges.glsl similarity index 100% rename from android/examples/OpenGL/Shaders/EdgeFilter/data/edges.glsl rename to android/examples/Topics/Shaders/EdgeDetect/data/edges.glsl diff --git a/android/examples/OpenGL/Shaders/EdgeFilter/EdgeFilter.pde b/android/examples/Topics/Shaders/EdgeFilter/EdgeFilter.pde similarity index 64% rename from android/examples/OpenGL/Shaders/EdgeFilter/EdgeFilter.pde rename to android/examples/Topics/Shaders/EdgeFilter/EdgeFilter.pde index 8556b9bd2..c740f003d 100644 --- a/android/examples/OpenGL/Shaders/EdgeFilter/EdgeFilter.pde +++ b/android/examples/Topics/Shaders/EdgeFilter/EdgeFilter.pde @@ -1,8 +1,17 @@ +/** + * Edge Filter + * + * Apply a custom shader to the filter() function to affect the geometry drawn to the screen. + * + * Press the mouse to turn the filter on and off. + */ + PShader edges; boolean applyFilter = true; void setup() { - size(400, 400, P3D); + size(640, 360, P3D); + orientation(LANDSCAPE); edges = loadShader("edges.glsl"); noStroke(); } @@ -15,11 +24,13 @@ void draw() { pushMatrix(); rotateX(frameCount * 0.01); rotateY(frameCount * 0.01); - box(100); + box(120); popMatrix(); - if (applyFilter) filter(edges); - + if (applyFilter == true) { + filter(edges); + } + // The sphere doesn't have the edge detection applied // on it because it is drawn after filter() is called. rotateY(frameCount * 0.02); @@ -29,4 +40,4 @@ void draw() { void mousePressed() { applyFilter = !applyFilter; -} +} diff --git a/android/examples/Topics/Shaders/EdgeFilter/data/edges.glsl b/android/examples/Topics/Shaders/EdgeFilter/data/edges.glsl new file mode 100644 index 000000000..b032743d0 --- /dev/null +++ b/android/examples/Topics/Shaders/EdgeFilter/data/edges.glsl @@ -0,0 +1,48 @@ +#ifdef GL_ES +precision mediump float; +precision mediump int; +#endif + +uniform sampler2D textureSampler; +uniform vec2 texcoordOffset; + +varying vec4 vertColor; +varying vec4 vertTexcoord; + +#define KERNEL_SIZE 9 + +// Edge detection kernel +// -1 -1 -1 +// -1 +8 -1 +// -1 -1 -1 +float kernel[KERNEL_SIZE]; + +vec2 offset[KERNEL_SIZE]; + +void main(void) { + int i = 0; + vec4 sum = vec4(0.0); + + offset[0] = vec2(-texcoordOffset.s, -texcoordOffset.t); + offset[1] = vec2(0.0, -texcoordOffset.t); + offset[2] = vec2(texcoordOffset.s, -texcoordOffset.t); + + offset[3] = vec2(-texcoordOffset.s, 0.0); + offset[4] = vec2(0.0, 0.0); + offset[5] = vec2(texcoordOffset.s, 0.0); + + offset[6] = vec2(-texcoordOffset.s, texcoordOffset.t); + offset[7] = vec2(0.0, texcoordOffset.t); + offset[8] = vec2(texcoordOffset.s, texcoordOffset.t); + + kernel[0] = -1.0; kernel[1] = -1.0; kernel[2] = -1.0; + kernel[3] = -1.0; kernel[4] = 8.0; kernel[5] = -1.0; + kernel[6] = -1.0; kernel[7] = -1.0; kernel[8] = -1.0; + + for(i = 0; i < KERNEL_SIZE; i++) { + vec4 tmp = texture2D(textureSampler, vertTexcoord.st + offset[i]); + sum += tmp * kernel[i]; + } + + gl_FragColor = vec4(sum.rgb, 1.0) * vertColor; +} diff --git a/android/examples/OpenGL/Shaders/LowLevelGL/LowLevelGL.pde b/android/examples/Topics/Shaders/LowLevelGL/LowLevelGL.pde similarity index 62% rename from android/examples/OpenGL/Shaders/LowLevelGL/LowLevelGL.pde rename to android/examples/Topics/Shaders/LowLevelGL/LowLevelGL.pde index d046d6690..7731fe161 100644 --- a/android/examples/OpenGL/Shaders/LowLevelGL/LowLevelGL.pde +++ b/android/examples/Topics/Shaders/LowLevelGL/LowLevelGL.pde @@ -1,9 +1,7 @@ // Draws a triangle using low-level OpenGL calls. -import java.nio.FloatBuffer; +import java.nio.*; -PGraphicsOpenGL pg; PGL pgl; - PShader flatShader; int vertLoc; @@ -16,13 +14,12 @@ FloatBuffer vertData; FloatBuffer colorData; void setup() { - size(400, 400, P3D); + size(640, 360, P3D); + orientation(LANDSCAPE); - pg = (PGraphicsOpenGL)g; - - // Get the default shader that Processing uses to - // render flat geometry (w/out textures and lights). - flatShader = getShader(PShader.FLAT); + // Loads a shader to render geometry w/out + // textures and lights. + flatShader = loadShader("frag.glsl", "vert.glsl"); vertices = new float[12]; vertData = allocateDirectFloatBuffer(12); @@ -36,29 +33,30 @@ void draw() { // The geometric transformations will be automatically passed // to the shader. - rotate(frameCount * 0.01f, width, height, 0); + rotate(frameCount * 0.01, width, height, 0); updateGeometry(); - pgl = pg.beginGL(); + pgl = beginPGL(); flatShader.bind(); - vertLoc = pgl.glGetAttribLocation(flatShader.glProgram, "inVertex"); - colorLoc = pgl.glGetAttribLocation(flatShader.glProgram, "inColor"); + vertLoc = pgl.getAttribLocation(flatShader.glProgram, "inVertex"); + colorLoc = pgl.getAttribLocation(flatShader.glProgram, "inColor"); - pgl.glEnableVertexAttribArray(vertLoc); - pgl.glEnableVertexAttribArray(colorLoc); + pgl.enableVertexAttribArray(vertLoc); + pgl.enableVertexAttribArray(colorLoc); - pgl.glVertexAttribPointer(vertLoc, 4, PGL.GL_FLOAT, false, 0, vertData); - pgl.glVertexAttribPointer(colorLoc, 4, PGL.GL_FLOAT, false, 0, colorData); + pgl.vertexAttribPointer(vertLoc, 4, PGL.FLOAT, false, 0, vertData); + pgl.vertexAttribPointer(colorLoc, 4, PGL.FLOAT, false, 0, colorData); - pgl.glDrawArrays(PGL.GL_TRIANGLES, 0, 3); + pgl.drawArrays(PGL.TRIANGLES, 0, 3); - pgl.glDisableVertexAttribArray(vertLoc); - pgl.glDisableVertexAttribArray(colorLoc); + pgl.disableVertexAttribArray(vertLoc); + pgl.disableVertexAttribArray(colorLoc); flatShader.unbind(); - pg.endGL(); + + endPGL(); } void updateGeometry() { @@ -103,4 +101,4 @@ void updateGeometry() { FloatBuffer allocateDirectFloatBuffer(int n) { return ByteBuffer.allocateDirect(n * Float.SIZE/8).order(ByteOrder.nativeOrder()).asFloatBuffer(); -} +} diff --git a/android/examples/Topics/Shaders/LowLevelGL/data/frag.glsl b/android/examples/Topics/Shaders/LowLevelGL/data/frag.glsl new file mode 100644 index 000000000..16742d2bd --- /dev/null +++ b/android/examples/Topics/Shaders/LowLevelGL/data/frag.glsl @@ -0,0 +1,30 @@ +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2011-12 Ben Fry and Casey Reas + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 2.1 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + */ + +#ifdef GL_ES +precision mediump float; +precision mediump int; +#endif + +varying vec4 vertColor; + +void main() { + gl_FragColor = vertColor; +} \ No newline at end of file diff --git a/android/examples/Topics/Shaders/LowLevelGL/data/vert.glsl b/android/examples/Topics/Shaders/LowLevelGL/data/vert.glsl new file mode 100644 index 000000000..95c266a76 --- /dev/null +++ b/android/examples/Topics/Shaders/LowLevelGL/data/vert.glsl @@ -0,0 +1,32 @@ +/* + Part of the Processing project - http://processing.org + + Copyright (c) 2011-12 Ben Fry and Casey Reas + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License version 2.1 as published by the Free Software Foundation. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General + Public License along with this library; if not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, + Boston, MA 02111-1307 USA + */ + +uniform mat4 projmodelviewMatrix; + +attribute vec4 inVertex; +attribute vec4 inColor; + +varying vec4 vertColor; + +void main() { + gl_Position = projmodelviewMatrix * inVertex; + + vertColor = inColor; +} \ No newline at end of file diff --git a/android/examples/OpenGL/Shaders/SepBlur/SepBlur.pde b/android/examples/Topics/Shaders/SepBlur/SepBlur.pde similarity index 81% rename from android/examples/OpenGL/Shaders/SepBlur/SepBlur.pde rename to android/examples/Topics/Shaders/SepBlur/SepBlur.pde index 35add4abe..c08bc40ee 100644 --- a/android/examples/OpenGL/Shaders/SepBlur/SepBlur.pde +++ b/android/examples/Topics/Shaders/SepBlur/SepBlur.pde @@ -7,19 +7,18 @@ PGraphics pass1, pass2; void setup() { size(200, 200, P2D); + orientation(LANDSCAPE); - blur = loadShader(PShader.TEXTURED, "blur.glsl"); + blur = loadShader("blur.glsl"); blur.set("sigma", 5.0f); src = createGraphics(width, height, P2D); pass1 = createGraphics(width, height, P2D); - pass1.noSmooth(); - pass1.shader(blur); + pass1.noSmooth(); pass2 = createGraphics(width, height, P2D); pass2.noSmooth(); - pass2.shader(blur); } void draw() { @@ -31,16 +30,18 @@ void draw() { // Applying the blur shader along the vertical direction blur.set("horizontalPass", 0); - pass1.beginDraw(); + pass1.beginDraw(); + pass1.shader(blur); pass1.image(src, 0, 0); pass1.endDraw(); // Applying the blur shader along the horizontal direction blur.set("horizontalPass", 1); - pass2.beginDraw(); + pass2.beginDraw(); + pass2.shader(blur); pass2.image(pass1, 0, 0); pass2.endDraw(); image(pass2, 0, 0); } - + diff --git a/android/examples/OpenGL/Shaders/SepBlur/data/blur.glsl b/android/examples/Topics/Shaders/SepBlur/data/blur.glsl similarity index 100% rename from android/examples/OpenGL/Shaders/SepBlur/data/blur.glsl rename to android/examples/Topics/Shaders/SepBlur/data/blur.glsl diff --git a/android/examples/Topics/Shaders/ToonShading/ToonShading.pde b/android/examples/Topics/Shaders/ToonShading/ToonShading.pde new file mode 100644 index 000000000..fd18d24b8 --- /dev/null +++ b/android/examples/Topics/Shaders/ToonShading/ToonShading.pde @@ -0,0 +1,44 @@ +/** + * Toon Shading. + * + * Example showing the use of a custom lighting shader in order + * to apply a "toon" effect on the scene. Based on the glsl tutorial + * from lighthouse 3D: + * http://www.lighthouse3d.com/tutorials/glsl-tutorial/toon-shader-version-ii/ + */ + +PShader toon; +boolean shaderEnabled = true; + +void setup() { + size(640, 360, P3D); + orientation(LANDSCAPE); + noStroke(); + fill(204); + toon = loadShader("ToonFrag.glsl", "ToonVert.glsl"); +} + +void draw() { + if (shaderEnabled == true) { + shader(toon); + } + + noStroke(); + background(0); + float dirY = (mouseY / float(height) - 0.5) * 2; + float dirX = (mouseX / float(width) - 0.5) * 2; + directionalLight(204, 204, 204, -dirX, -dirY, -1); + translate(width/2, height/2); + sphere(120); +} + +void mousePressed() { + if (shaderEnabled) { + shaderEnabled = false; + resetShader(); + } + else { + shaderEnabled = true; + } +} + diff --git a/android/examples/OpenGL/Shaders/ToonShading/data/ToonFrag.glsl b/android/examples/Topics/Shaders/ToonShading/data/ToonFrag.glsl similarity index 100% rename from android/examples/OpenGL/Shaders/ToonShading/data/ToonFrag.glsl rename to android/examples/Topics/Shaders/ToonShading/data/ToonFrag.glsl diff --git a/android/examples/OpenGL/Shaders/ToonShading/data/ToonVert.glsl b/android/examples/Topics/Shaders/ToonShading/data/ToonVert.glsl similarity index 100% rename from android/examples/OpenGL/Shaders/ToonShading/data/ToonVert.glsl rename to android/examples/Topics/Shaders/ToonShading/data/ToonVert.glsl diff --git a/android/examples/Topics/Simulate/Fluid/Fluid.pde b/android/examples/Topics/Simulate/Fluid/Fluid.pde deleted file mode 100644 index fd5f36bf6..000000000 --- a/android/examples/Topics/Simulate/Fluid/Fluid.pde +++ /dev/null @@ -1,208 +0,0 @@ -/** - * Fluid - * by Glen Murphy. - * - * Click and drag the mouse to move the simulated fluid. - * Adjust the "res" variable below to change resolution. - * Code has not been optimised, and will run fairly slowly. - */ - -int res = 2; -int penSize = 30; -int lwidth; -int lheight; -int pnum = 30000; -vsquare[][] v; -vbuffer[][] vbuf; -particle[] p = new particle[pnum]; -int pcount = 0; -int mouseXvel = 0; -int mouseYvel = 0; - -void setup() -{ - size(200, 200); - noStroke(); - frameRate(30); - lwidth = width/res; - lheight = height/res; - v = new vsquare[lwidth+1][lheight+1]; - vbuf = new vbuffer[lwidth+1][lheight+1]; - for (int i = 0; i < pnum; i++) { - p[i] = new particle(random(res,width-res),random(res,height-res)); - } - for (int i = 0; i <= lwidth; i++) { - for (int u = 0; u <= lheight; u++) { - v[i][u] = new vsquare(i*res,u*res); - vbuf[i][u] = new vbuffer(i*res,u*res); - } - } -} - -void draw() -{ - background(#666666); - - int axvel = mouseX-pmouseX; - int ayvel = mouseY-pmouseY; - - mouseXvel = (axvel != mouseXvel) ? axvel : 0; - mouseYvel = (ayvel != mouseYvel) ? ayvel : 0; - - for (int i = 0; i < lwidth; i++) { - for (int u = 0; u < lheight; u++) { - vbuf[i][u].updatebuf(i,u); - v[i][u].col = 32; - } - } - for (int i = 0; i < pnum-1; i++) { - p[i].updatepos(); - } - for (int i = 0; i < lwidth; i++) { - for (int u = 0; u < lheight; u++) { - v[i][u].addbuffer(i, u); - v[i][u].updatevels(mouseXvel, mouseYvel); - v[i][u].display(i, u); - } - } -} - -class particle { - float x; - float y; - float xvel; - float yvel; - int pos; - particle(float xIn, float yIn) { - x = xIn; - y = yIn; - } - - void updatepos() { - float col1; - if (x > 0 && x < width && y > 0 && y < height) { - int vi = (int)(x/res); - int vu = (int)(y/res); - vsquare o = v[vi][vu]; - - float ax = (x%res)/res; - float ay = (y%res)/res; - - xvel += (1-ax)*v[vi][vu].xvel*0.05; - yvel += (1-ay)*v[vi][vu].yvel*0.05; - - xvel += ax*v[vi+1][vu].xvel*0.05; - yvel += ax*v[vi+1][vu].yvel*0.05; - - xvel += ay*v[vi][vu+1].xvel*0.05; - yvel += ay*v[vi][vu+1].yvel*0.05; - - o.col += 4; - - x += xvel; - y += yvel; - } - else { - x = random(0,width); - y = random(0,height); - xvel = 0; - yvel = 0; - } - - xvel *= 0.5; - yvel *= 0.5; - } -} - -class vbuffer { - int x; - int y; - float xvel; - float yvel; - float pressurex = 0; - float pressurey = 0; - float pressure = 0; - - vbuffer(int xIn,int yIn) { - x = xIn; - y = yIn; - pressurex = 0; - pressurey = 0; - } - - void updatebuf(int i, int u) { - if (i>0 && i0 && u0 && i0 && u 255) col = 255; - if (i>0 && i0 && u x && l.x < x + w && l.y > y && l.y < y + h) { + return true; + } + else { + return false; + } + } + + // Calculate drag force + PVector drag(Mover m) { + // Magnitude is coefficient * speed squared + float speed = m.velocity.mag(); + float dragMagnitude = c * speed * speed; + + // Direction is inverse of velocity + PVector drag = m.velocity.get(); + drag.mult(-1); + + // Scale according to magnitude + drag.setMag(dragMagnitude); + return drag; + } + + void display() { + noStroke(); + fill(127); + rect(x,y,w,h); + } + +} + diff --git a/android/examples/Topics/Simulate/ForcesWithVectors/Mover.pde b/android/examples/Topics/Simulate/ForcesWithVectors/Mover.pde new file mode 100644 index 000000000..b14754b71 --- /dev/null +++ b/android/examples/Topics/Simulate/ForcesWithVectors/Mover.pde @@ -0,0 +1,64 @@ +/** + * Forces (Gravity and Fluid Resistence) with Vectors + * by Daniel Shiffman. + * + * Demonstration of multiple force acting on bodies (Mover class) + * Bodies experience gravity continuously + * Bodies experience fluid resistance when in "water" + */ + + +class Mover { + + // location, velocity, and acceleration + PVector location; + PVector velocity; + PVector acceleration; + + // Mass is tied to size + float mass; + + Mover(float m, float x, float y) { + mass = m; + location = new PVector(x, y); + velocity = new PVector(0, 0); + acceleration = new PVector(0, 0); + } + + // Newton's 2nd law: F = M * A + // or A = F / M + void applyForce(PVector force) { + // Divide by mass + PVector f = PVector.div(force, mass); + // Accumulate all forces in acceleration + acceleration.add(f); + } + + void update() { + + // Velocity changes according to acceleration + velocity.add(acceleration); + // Location changes by velocity + location.add(velocity); + // We must clear acceleration each frame + acceleration.mult(0); + } + + // Draw Mover + void display() { + stroke(255); + strokeWeight(2); + fill(255, 200); + ellipse(location.x, location.y, mass*16, mass*16); + } + + // Bounce off bottom of window + void checkEdges() { + if (location.y > height) { + velocity.y *= -0.9; // A little dampening when hitting the bottom + location.y = height; + } + } +} + + diff --git a/android/examples/Topics/Simulate/GravitationalAttraction3D/GravitationalAttraction3D.pde b/android/examples/Topics/Simulate/GravitationalAttraction3D/GravitationalAttraction3D.pde new file mode 100644 index 000000000..87a7ed9ef --- /dev/null +++ b/android/examples/Topics/Simulate/GravitationalAttraction3D/GravitationalAttraction3D.pde @@ -0,0 +1,71 @@ +/** + * Gravitational Attraction (3D) + * by Daniel Shiffman. + * + * Simulating gravitational attraction + * G ---> universal gravitational constant + * m1 --> mass of object #1 + * m2 --> mass of object #2 + * d ---> distance between objects + * F = (G*m1*m2)/(d*d) + * + * For the basics of working with PVector, see + * http://processing.org/learning/pvector/ + * as well as examples in Topics/Vectors/ + * + */ + +// A bunch of planets +Planet[] planets = new Planet[10]; +// One sun (note sun is not attracted to planets (violation of Newton's 3rd Law) +Sun s; + +// An angle to rotate around the scene +float angle = 0; + +void setup() { + size(displayWidth, displayHeight, P3D); + orientation(LANDSCAPE); + // Some random planets + for (int i = 0; i < planets.length; i++) { + planets[i] = new Planet(random(0.1, 2), random(-width/2, width/2), random(-height/2, height/2), random(-100, 100)); + } + // A single sun + s = new Sun(); +} + +void draw() { + background(0); + // Setup the scene + sphereDetail(8); + lights(); + translate(width/2, height/2); + rotateY(angle); + + + // Display the Sun + s.display(); + + // All the Planets + for (int i = 0; i < planets.length; i++) { + // Sun attracts Planets + PVector force = s.attract(planets[i]); + planets[i].applyForce(force); + // Update and draw Planets + planets[i].update(); + planets[i].display(); + } + + // Rotate around the scene + angle += 0.003; +} + + + + + + + + + + diff --git a/android/examples/Topics/Simulate/GravitationalAttraction3D/Planet.pde b/android/examples/Topics/Simulate/GravitationalAttraction3D/Planet.pde new file mode 100644 index 000000000..ae8be2537 --- /dev/null +++ b/android/examples/Topics/Simulate/GravitationalAttraction3D/Planet.pde @@ -0,0 +1,45 @@ +// Gravitational Attraction (3D) +// Daniel Shiffman + +// A class for an orbiting Planet + +class Planet { + + // Basic physics model (location, velocity, acceleration, mass) + PVector location; + PVector velocity; + PVector acceleration; + float mass; + + Planet(float m, float x, float y, float z) { + mass = m; + location = new PVector(x,y,z); + velocity = new PVector(1,0); // Arbitrary starting velocity + acceleration = new PVector(0,0); + } + + // Newton's 2nd Law (F = M*A) applied + void applyForce(PVector force) { + PVector f = PVector.div(force,mass); + acceleration.add(f); + } + + // Our motion algorithm (aka Euler Integration) + void update() { + velocity.add(acceleration); // Velocity changes according to acceleration + location.add(velocity); // Location changes according to velocity + acceleration.mult(0); + } + + // Draw the Planet + void display() { + noStroke(); + fill(255); + pushMatrix(); + translate(location.x,location.y,location.z); + sphere(mass*8); + popMatrix(); + } +} + + diff --git a/android/examples/Topics/Simulate/GravitationalAttraction3D/Sun.pde b/android/examples/Topics/Simulate/GravitationalAttraction3D/Sun.pde new file mode 100644 index 000000000..3253bc02f --- /dev/null +++ b/android/examples/Topics/Simulate/GravitationalAttraction3D/Sun.pde @@ -0,0 +1,39 @@ +// Gravitational Attraction (3D) +// Daniel Shiffman + +// A class for an attractive body in our world + +class Sun { + float mass; // Mass, tied to size + PVector location; // Location + float G; // Universal gravitational constant (arbitrary value) + + Sun() { + location = new PVector(0,0); + mass = 20; + G = 0.4; + } + + + PVector attract(Planet m) { + PVector force = PVector.sub(location,m.location); // Calculate direction of force + float d = force.mag(); // Distance between objects + d = constrain(d,5.0,25.0); // Limiting the distance to eliminate "extreme" results for very close or very far objects + force.normalize(); // Normalize vector (distance doesn't matter here, we just want this vector for direction) + float strength = (G * mass * m.mass) / (d * d); // Calculate gravitional force magnitude + force.mult(strength); // Get force vector --> magnitude * direction + return force; + } + + // Draw Sun + void display() { + stroke(255); + noFill(); + pushMatrix(); + translate(location.x,location.y,location.z); + sphere(mass*2); + popMatrix(); + } +} + + diff --git a/android/examples/Topics/Simulate/Smoke/Smoke.pde b/android/examples/Topics/Simulate/Smoke/Smoke.pde deleted file mode 100644 index 2716209ac..000000000 --- a/android/examples/Topics/Simulate/Smoke/Smoke.pde +++ /dev/null @@ -1,264 +0,0 @@ -/** - * Smoke - * by Glen Murphy. - * - * Drag the mouse across the image to move the particles. - * Code has not been optimised and will run fairly slowly. - */ - -int res = 2; -int penSize = 30; -int lwidth; -int lheight; -int pnum = 30000; -vsquare[][] v; -vbuffer[][] vbuf; -particle[] p; -int pcount = 0; -int mouseXvel = 0; -int mouseYvel = 0; - -int randomGust = 0; -int randomGustMax; -float randomGustX; -float randomGustY; -float randomGustSize; -float randomGustXvel; -float randomGustYvel; - -void setup() -{ - size(200, 200); - lwidth = width/res; - lheight = height/res; - v = new vsquare[lwidth+1][lheight+1]; - vbuf = new vbuffer[lwidth+1][lheight+1]; - p = new particle[pnum]; - noStroke(); - for(int i = 0; i < pnum; i++) { - p[i] = new particle(random(width/2-20,width/2+20),random(height-20,height)); - } - for(int i = 0; i <= lwidth; i++) { - for(int u = 0; u <= lheight; u++) { - v[i][u] = new vsquare(i*res,u*res); - vbuf[i][u] = new vbuffer(i*res,u*res); - } - } -} - -void draw() -{ - background(#cccccc); - - int axvel = mouseX-pmouseX; - int ayvel = mouseY-pmouseY; - - mouseXvel = (axvel != mouseXvel) ? axvel : 0; - mouseYvel = (ayvel != mouseYvel) ? ayvel : 0; - - if(randomGust <= 0) { - if(random(0,10)<1) { - randomGustMax = (int)random(5,12); - randomGust = randomGustMax; - randomGustX = random(0,width); - randomGustY = random(0,height-10); - randomGustSize = random(0,50); - if(randomGustX > width/2) { - randomGustXvel = random(-8,0); - } else { - randomGustXvel = random(0,8); - } - randomGustYvel = random(-2,1); - } - randomGust--; - } - - for(int i = 0; i < lwidth; i++) { - for(int u = 0; u < lheight; u++) { - vbuf[i][u].updatebuf(i,u); - v[i][u].col = 0; - } - } - for(int i = 0; i < pnum-1; i++) { - p[i].updatepos(); - } - for(int i = 0; i < lwidth; i++) { - for(int u = 0; u < lheight; u++) { - v[i][u].addbuffer(i, u); - v[i][u].updatevels(mouseXvel, mouseYvel); - v[i][u].display(i, u); - } - } - randomGust = 0; -} - -class particle -{ - float x; - float y; - float xvel; - float yvel; - float temp; - int pos; - - particle(float xIn, float yIn) { - x = xIn; - y = yIn; - } - - void reposition() { - x = width/2+random(-20,20); - y = random(height-10,height); - - xvel = random(-1,1); - yvel = random(-1,1); - } - - void updatepos() { - int vi = (int)(x/res); - int vu = (int)(y/res); - - if(vi > 0 && vi < lwidth && vu > 0 && vu < lheight) { - v[vi][vu].addcolour(2); - - float ax = (x%res)/res; - float ay = (y%res)/res; - - xvel += (1-ax)*v[vi][vu].xvel*0.05; - yvel += (1-ay)*v[vi][vu].yvel*0.05; - - xvel += ax*v[vi+1][vu].xvel*0.05; - yvel += ax*v[vi+1][vu].yvel*0.05; - - xvel += ay*v[vi][vu+1].xvel*0.05; - yvel += ay*v[vi][vu+1].yvel*0.05; - - v[vi][vu].yvel -= (1-ay)*0.003; - v[vi+1][vu].yvel -= ax*0.003; - - if(v[vi][vu].yvel < 0) v[vi][vu].yvel *= 1.00025; - - x += xvel; - y += yvel; - } - else { - reposition(); - } - if(random(0,400) < 1) { - reposition(); - } - xvel *= 0.6; - yvel *= 0.6; - } -} - -class vbuffer -{ - int x; - int y; - float xvel; - float yvel; - float pressurex = 0; - float pressurey = 0; - float pressure = 0; - - vbuffer(int xIn,int yIn) { - x = xIn; - y = yIn; - pressurex = 0; - pressurey = 0; - } - - void updatebuf(int i, int u) { - if(i>0 && i0 && u0 && i0 && u 0) { - adj = x - randomGustX; - opp = y - randomGustY; - dist = sqrt(opp*opp + adj*adj); - if(dist < randomGustSize) { - if(dist < res*2) dist = randomGustSize; - mod = randomGustSize/dist; - xvel += (randomGustMax-randomGust)*randomGustXvel*mod; - yvel += (randomGustMax-randomGust)*randomGustYvel*mod; - } - } - xvel *= 0.99; - yvel *= 0.98; - } - - void addcolour(int amt) { - col += amt; - if(col > 196) col = 196; - } - - void display(int i, int u) { - float tcol = 0; - if(i>0 && i0 && u width) || (location.x < 0)) { + velocity.x = velocity.x * -1; + } + if (location.y > height) { + // We're reducing velocity ever so slightly + // when it hits the bottom of the window + velocity.y = velocity.y * -0.95; + location.y = height; + } + + // Display circle at location vector + stroke(255); + strokeWeight(2); + fill(127); + ellipse(location.x,location.y,48,48); +} + + diff --git a/android/examples/Topics/Vectors/Normalize/Normalize.pde b/android/examples/Topics/Vectors/Normalize/Normalize.pde new file mode 100644 index 000000000..95bd8525a --- /dev/null +++ b/android/examples/Topics/Vectors/Normalize/Normalize.pde @@ -0,0 +1,37 @@ +/** + * Normalize + * by Daniel Shiffman. + * + * Demonstration of normalizing a vector. + * Normalizing a vector sets its length to 1. + */ + +void setup() { + size(640,360); + smooth(); +} + +void draw() { + background(0); + + // A vector that points to the mouse location + PVector mouse = new PVector(mouseX,mouseY); + // A vector that points to the center of the window + PVector center = new PVector(width/2,height/2); + // Subtract center from mouse which results in a vector that points from center to mouse + mouse.sub(center); + + // Normalize the vector + mouse.normalize(); + + // Multiply its length by 50 + mouse.mult(150); + + translate(width/2,height/2); + // Draw the resulting vector + stroke(255); + line(0,0,mouse.x,mouse.y); + +} + + diff --git a/android/examples/Topics/Vectors/VectorMath/VectorMath.pde b/android/examples/Topics/Vectors/VectorMath/VectorMath.pde new file mode 100644 index 000000000..fcc609234 --- /dev/null +++ b/android/examples/Topics/Vectors/VectorMath/VectorMath.pde @@ -0,0 +1,37 @@ +/** + * Vector + * by Daniel Shiffman. + * + * Demonstration some basic vector math: subtraction, normalization, scaling + * Normalizing a vector sets its length to 1. + */ + +void setup() { + size(640,360); + smooth(); +} + +void draw() { + background(0); + + // A vector that points to the mouse location + PVector mouse = new PVector(mouseX,mouseY); + // A vector that points to the center of the window + PVector center = new PVector(width/2,height/2); + // Subtract center from mouse which results in a vector that points from center to mouse + mouse.sub(center); + + // Normalize the vector + mouse.normalize(); + + // Multiply its length by 150 (Scaling its length) + mouse.mult(150); + + translate(width/2,height/2); + // Draw the resulting vector + stroke(255); + line(0,0,mouse.x,mouse.y); + +} + +