├── README.md
└── tutorials
├── assimpImport
└── assimpImport
│ ├── Classes
│ ├── Core
│ │ ├── Tutorial.cpp
│ │ ├── Tutorial.h
│ │ └── entities
│ │ │ ├── CameraEntity.cpp
│ │ │ ├── CameraEntity.h
│ │ │ ├── MeshEntity.cpp
│ │ │ └── MeshEntity.h
│ ├── GPUManager.h
│ ├── GPUManager.mm
│ ├── vvisionAppDelegate.h
│ ├── vvisionAppDelegate.mm
│ ├── vvisionViewController.h
│ ├── vvisionViewController.mm
│ └── vvisionViewController.xib
│ ├── MainWindow.xib
│ ├── Resources
│ ├── Default-568h@2x.png
│ ├── House
│ │ ├── house_diffuse.png
│ │ ├── house_obj.mtl
│ │ └── house_obj.obj
│ ├── Shaders
│ │ ├── nolighting.fsh
│ │ └── nolighting.vsh
│ └── icon.png
│ ├── main.m
│ ├── vvision-Info.plist
│ ├── vvision.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── casper.xcuserdatad
│ │ │ ├── UserInterfaceState.xcuserstate
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcuserdata
│ │ └── casper.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints.xcbkptlist
│ │ └── xcschemes
│ │ ├── vvision.xcscheme
│ │ └── xcschememanagement.plist
│ └── vvision_Prefix.pch
├── bumpMapping
└── bumpMapping
│ ├── Classes
│ ├── Core
│ │ ├── Tutorial.cpp
│ │ ├── Tutorial.h
│ │ └── entities
│ │ │ ├── CameraEntity.cpp
│ │ │ ├── CameraEntity.h
│ │ │ ├── MeshEntity.cpp
│ │ │ └── MeshEntity.h
│ ├── GPUManager.h
│ ├── GPUManager.mm
│ ├── vvisionAppDelegate.h
│ ├── vvisionAppDelegate.mm
│ ├── vvisionViewController.h
│ ├── vvisionViewController.mm
│ └── vvisionViewController.xib
│ ├── MainWindow.xib
│ ├── Resources
│ ├── Box
│ │ ├── Crate_Fragile.mtl
│ │ ├── Crate_Fragile.obj
│ │ ├── fragile_diffuse.jpg
│ │ └── fragile_normal.jpg
│ ├── Default-568h@2x.png
│ ├── Shaders
│ │ ├── Bump.fsh
│ │ └── Bump.vsh
│ └── icon.png
│ ├── main.m
│ ├── vvision-Info.plist
│ ├── vvision.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── casper.xcuserdatad
│ │ │ ├── UserInterfaceState.xcuserstate
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcuserdata
│ │ └── casper.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints.xcbkptlist
│ │ └── xcschemes
│ │ ├── vvision.xcscheme
│ │ └── xcschememanagement.plist
│ └── vvision_Prefix.pch
├── bumpPerPixelLighting
└── bumpPerPixelLighting
│ ├── Classes
│ ├── Core
│ │ ├── Tutorial.cpp
│ │ ├── Tutorial.h
│ │ └── entities
│ │ │ ├── CameraEntity.cpp
│ │ │ ├── CameraEntity.h
│ │ │ ├── MeshEntity.cpp
│ │ │ └── MeshEntity.h
│ ├── GPUManager.h
│ ├── GPUManager.mm
│ ├── vvisionAppDelegate.h
│ ├── vvisionAppDelegate.mm
│ ├── vvisionViewController.h
│ ├── vvisionViewController.mm
│ └── vvisionViewController.xib
│ ├── MainWindow.xib
│ ├── Resources
│ ├── Default-568h@2x.png
│ ├── Shaders
│ │ ├── Bump.fsh
│ │ ├── Bump.vsh
│ │ ├── NoBump.fsh
│ │ └── NoBump.vsh
│ ├── icon.png
│ ├── icons
│ │ ├── down.png
│ │ ├── left.png
│ │ ├── right.png
│ │ └── up.png
│ └── testScene
│ │ ├── box.mtl
│ │ ├── box.obj
│ │ ├── color_map.jpg
│ │ ├── fragile_diffuse.jpg
│ │ ├── fragile_normal.jpg
│ │ ├── normal_map2.jpg
│ │ ├── rocks_diffuse.jpg
│ │ ├── rocks_normal.jpg
│ │ ├── sphere.mtl
│ │ ├── sphere.obj
│ │ ├── stones_diffuse.jpg
│ │ └── stones_normal.jpg
│ ├── main.m
│ ├── vvision-Info.plist
│ ├── vvision.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── casper.xcuserdatad
│ │ │ ├── UserInterfaceState.xcuserstate
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcuserdata
│ │ └── casper.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints.xcbkptlist
│ │ └── xcschemes
│ │ ├── vvision.xcscheme
│ │ └── xcschememanagement.plist
│ └── vvision_Prefix.pch
├── cubeMapping
└── cubeMapping
│ ├── Classes
│ ├── Core
│ │ ├── Tutorial.cpp
│ │ ├── Tutorial.h
│ │ └── entities
│ │ │ ├── CameraEntity.cpp
│ │ │ ├── CameraEntity.h
│ │ │ ├── MeshEntity.cpp
│ │ │ ├── MeshEntity.h
│ │ │ ├── SkyBoxEntity.cpp
│ │ │ └── SkyBoxEntity.h
│ ├── GPUManager.h
│ ├── GPUManager.mm
│ ├── vvisionAppDelegate.h
│ ├── vvisionAppDelegate.mm
│ ├── vvisionViewController.h
│ ├── vvisionViewController.mm
│ └── vvisionViewController.xib
│ ├── MainWindow.xib
│ ├── Resources
│ ├── Default-568h@2x.png
│ ├── Shaders
│ │ ├── SkyBox.fsh
│ │ ├── SkyBox.vsh
│ │ ├── cubeMapping.fsh
│ │ └── cubeMapping.vsh
│ ├── icon.png
│ ├── icons
│ │ ├── down.png
│ │ ├── left.png
│ │ ├── right.png
│ │ └── up.png
│ ├── models
│ │ ├── knot2880_nomap.3DS
│ │ └── teapot1024.3DS
│ └── skybox
│ │ ├── cm_xn.jpg
│ │ ├── cm_xp.jpg
│ │ ├── cm_yn.jpg
│ │ ├── cm_yp.jpg
│ │ ├── cm_zn.jpg
│ │ └── cm_zp.jpg
│ ├── main.m
│ ├── vvision-Info.plist
│ ├── vvision.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── casper.xcuserdatad
│ │ │ ├── UserInterfaceState.xcuserstate
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcuserdata
│ │ └── casper.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints.xcbkptlist
│ │ └── xcschemes
│ │ ├── vvision.xcscheme
│ │ └── xcschememanagement.plist
│ └── vvision_Prefix.pch
├── engine
└── vvision
│ ├── Math
│ ├── BoundingBox.h
│ ├── vmath.cpp
│ └── vmath.h
│ ├── MeshLoader
│ ├── AssimpMesh.cpp
│ ├── AssimpMesh.h
│ ├── Mesh.cpp
│ ├── Mesh.h
│ └── assimpMesh
│ │ ├── AssimpAnimEvaluator.cpp
│ │ ├── AssimpAnimEvaluator.h
│ │ ├── AssimpSceneAnimator.cpp
│ │ └── AssimpSceneAnimator.h
│ ├── Renderer
│ ├── FrameBufferObject.cpp
│ ├── FrameBufferObject.h
│ ├── Material.h
│ ├── MeshBuffer.cpp
│ ├── MeshBuffer.h
│ ├── OffscreenRenderTarget.cpp
│ ├── OffscreenRenderTarget.h
│ ├── RenderBuffer.cpp
│ ├── RenderBuffer.h
│ ├── Shader.cpp
│ ├── Shader.h
│ ├── Texture.cpp
│ ├── Texture.h
│ ├── TextureCubeMap.cpp
│ ├── TextureCubeMap.h
│ ├── VertexBuffer.h
│ └── renderer.h
│ ├── ResourceManager
│ ├── CacheResourceManager.cpp
│ └── CacheResourceManager.h
│ ├── Utils
│ ├── FilePath.cpp
│ ├── FilePath.h
│ ├── Helpers.h
│ ├── Singleton.h
│ ├── Utils.h
│ └── types.h
│ ├── ext
│ └── assimp
│ │ ├── include
│ │ ├── Compiler
│ │ │ ├── poppack1.h
│ │ │ └── pushpack1.h
│ │ ├── DefaultLogger.h
│ │ ├── IOStream.h
│ │ ├── IOSystem.h
│ │ ├── LogStream.h
│ │ ├── Logger.h
│ │ ├── NullLogger.h
│ │ ├── ProgressHandler.h
│ │ ├── aiAnim.h
│ │ ├── aiAssert.h
│ │ ├── aiCamera.h
│ │ ├── aiColor4D.h
│ │ ├── aiColor4D.inl
│ │ ├── aiConfig.h
│ │ ├── aiDefines.h
│ │ ├── aiFileIO.h
│ │ ├── aiLight.h
│ │ ├── aiMaterial.h
│ │ ├── aiMaterial.inl
│ │ ├── aiMatrix3x3.h
│ │ ├── aiMatrix3x3.inl
│ │ ├── aiMatrix4x4.h
│ │ ├── aiMatrix4x4.inl
│ │ ├── aiMesh.h
│ │ ├── aiPostProcess.h
│ │ ├── aiQuaternion.h
│ │ ├── aiScene.h
│ │ ├── aiTexture.h
│ │ ├── aiTypes.h
│ │ ├── aiVector2D.h
│ │ ├── aiVector3D.h
│ │ ├── aiVector3D.inl
│ │ ├── aiVersion.h
│ │ ├── assimp.h
│ │ ├── assimp.hpp
│ │ ├── export.h
│ │ └── export.hpp
│ │ └── lib
│ │ ├── ReleaseArmv7
│ │ └── libassimp.a
│ │ └── ReleaseI386
│ │ └── libassimpi386.a
│ ├── iOS
│ ├── EAGLView.h
│ └── EAGLView.m
│ └── vvision.h
├── gpuSkinning
├── Classes
│ ├── Core
│ │ ├── Tutorial.cpp
│ │ ├── Tutorial.h
│ │ └── entities
│ │ │ ├── AnimatedMeshEntity.cpp
│ │ │ ├── AnimatedMeshEntity.h
│ │ │ ├── CameraEntity.cpp
│ │ │ └── CameraEntity.h
│ ├── GPUManager.h
│ ├── GPUManager.mm
│ ├── vvisionAppDelegate.h
│ ├── vvisionAppDelegate.mm
│ ├── vvisionViewController.h
│ ├── vvisionViewController.mm
│ └── vvisionViewController.xib
├── MainWindow.xib
├── Resources
│ ├── Default-568h@2x.png
│ ├── Shaders
│ │ ├── GpuSkinnig.fsh
│ │ └── GpuSkinnig.vsh
│ ├── dwarf
│ │ ├── axe.jpg
│ │ ├── dwarf.jpg
│ │ ├── dwarf.x
│ │ └── dwarf2.jpg
│ └── icon.png
├── main.m
├── vvision-Info.plist
├── vvision.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── casper.xcuserdatad
│ │ │ ├── UserInterfaceState.xcuserstate
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcuserdata
│ │ └── casper.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints.xcbkptlist
│ │ └── xcschemes
│ │ ├── vvision.xcscheme
│ │ └── xcschememanagement.plist
└── vvision_Prefix.pch
├── quaternionCamera
└── quaternionCamera
│ ├── Classes
│ ├── Core
│ │ ├── Tutorial.cpp
│ │ ├── Tutorial.h
│ │ └── entities
│ │ │ ├── CameraEntity.cpp
│ │ │ ├── CameraEntity.h
│ │ │ ├── MeshEntity.cpp
│ │ │ └── MeshEntity.h
│ ├── GPUManager.h
│ ├── GPUManager.mm
│ ├── vvisionAppDelegate.h
│ ├── vvisionAppDelegate.mm
│ ├── vvisionViewController.h
│ ├── vvisionViewController.mm
│ └── vvisionViewController.xib
│ ├── MainWindow.xib
│ ├── Resources
│ ├── Default-568h@2x.png
│ ├── Shaders
│ │ ├── SkyBox.fsh
│ │ ├── SkyBox.vsh
│ │ ├── Terrain.fsh
│ │ └── Terrain.vsh
│ ├── Terrain
│ │ ├── detail.jpg
│ │ ├── grass.jpg
│ │ ├── grassYellow.jpg
│ │ └── terrain2.ms3d
│ ├── icon.png
│ ├── icons
│ │ ├── down.png
│ │ ├── left.png
│ │ ├── right.png
│ │ └── up.png
│ └── skybox
│ │ ├── sky_xn.jpg
│ │ ├── sky_xp.jpg
│ │ ├── sky_yn.jpg
│ │ ├── sky_yp.jpg
│ │ ├── sky_zn.jpg
│ │ └── sky_zp.jpg
│ ├── main.m
│ ├── vvision-Info.plist
│ ├── vvision.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── casper.xcuserdatad
│ │ │ ├── UserInterfaceState.xcuserstate
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcuserdata
│ │ └── casper.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints.xcbkptlist
│ │ └── xcschemes
│ │ ├── vvision.xcscheme
│ │ └── xcschememanagement.plist
│ └── vvision_Prefix.pch
├── skybox
└── skybox
│ ├── Classes
│ ├── Core
│ │ ├── Tutorial.cpp
│ │ ├── Tutorial.h
│ │ └── entities
│ │ │ ├── CameraEntity.cpp
│ │ │ ├── CameraEntity.h
│ │ │ ├── MeshEntity.cpp
│ │ │ ├── MeshEntity.h
│ │ │ ├── SkyBoxEntity.cpp
│ │ │ └── SkyBoxEntity.h
│ ├── GPUManager.h
│ ├── GPUManager.mm
│ ├── vvisionAppDelegate.h
│ ├── vvisionAppDelegate.mm
│ ├── vvisionViewController.h
│ ├── vvisionViewController.mm
│ └── vvisionViewController.xib
│ ├── MainWindow.xib
│ ├── Resources
│ ├── Default-568h@2x.png
│ ├── Shaders
│ │ ├── SkyBox.fsh
│ │ ├── SkyBox.vsh
│ │ ├── Terrain.fsh
│ │ └── Terrain.vsh
│ ├── Terrain
│ │ ├── detail.jpg
│ │ ├── grass.jpg
│ │ ├── grassYellow.jpg
│ │ └── terrain2.ms3d
│ ├── icon.png
│ ├── icons
│ │ ├── down.png
│ │ ├── left.png
│ │ ├── right.png
│ │ └── up.png
│ └── skybox
│ │ ├── sky_xn.jpg
│ │ ├── sky_xp.jpg
│ │ ├── sky_yn.jpg
│ │ ├── sky_yp.jpg
│ │ ├── sky_zn.jpg
│ │ └── sky_zp.jpg
│ ├── main.m
│ ├── vvision-Info.plist
│ ├── vvision.xcodeproj
│ ├── project.pbxproj
│ ├── project.xcworkspace
│ │ ├── contents.xcworkspacedata
│ │ └── xcuserdata
│ │ │ └── casper.xcuserdatad
│ │ │ ├── UserInterfaceState.xcuserstate
│ │ │ └── WorkspaceSettings.xcsettings
│ └── xcuserdata
│ │ └── casper.xcuserdatad
│ │ ├── xcdebugger
│ │ └── Breakpoints.xcbkptlist
│ │ └── xcschemes
│ │ ├── vvision.xcscheme
│ │ └── xcschememanagement.plist
│ └── vvision_Prefix.pch
└── waterReflection
└── waterReflection
├── Classes
├── Core
│ ├── Tutorial.cpp
│ ├── Tutorial.h
│ └── entities
│ │ ├── CameraEntity.cpp
│ │ ├── CameraEntity.h
│ │ ├── MeshEntity.cpp
│ │ ├── MeshEntity.h
│ │ ├── SkyBoxEntity.cpp
│ │ ├── SkyBoxEntity.h
│ │ ├── WaterEntity.cpp
│ │ └── WaterEntity.h
├── GPUManager.h
├── GPUManager.mm
├── vvisionAppDelegate.h
├── vvisionAppDelegate.mm
├── vvisionViewController.h
├── vvisionViewController.mm
└── vvisionViewController.xib
├── Default-568h@2x.png
├── MainWindow.xib
├── Resources
├── House
│ ├── house_diffuse.png
│ ├── house_obj.mtl
│ └── house_obj.obj
├── Shaders
│ ├── SkyBox.fsh
│ ├── SkyBox.vsh
│ ├── Terrain.fsh
│ ├── Terrain.vsh
│ ├── WaterSurface.fsh
│ └── WaterSurface.vsh
├── Terrain
│ ├── detail.jpg
│ ├── grass.jpg
│ ├── grassYellow.jpg
│ └── terrain2.ms3d
├── icon.png
├── icons
│ ├── down.png
│ ├── left.png
│ ├── right.png
│ └── up.png
├── skybox
│ ├── sky_xn.jpg
│ ├── sky_xp.jpg
│ ├── sky_yn.jpg
│ ├── sky_yp.jpg
│ ├── sky_zn.jpg
│ └── sky_zp.jpg
└── water
│ └── normal.jpg
├── main.m
├── vvision-Info.plist
├── vvision.xcodeproj
├── project.pbxproj
├── project.xcworkspace
│ ├── contents.xcworkspacedata
│ └── xcuserdata
│ │ └── casper.xcuserdatad
│ │ ├── UserInterfaceState.xcuserstate
│ │ └── WorkspaceSettings.xcsettings
└── xcuserdata
│ └── casper.xcuserdatad
│ ├── xcdebugger
│ └── Breakpoints.xcbkptlist
│ └── xcschemes
│ ├── vvision.xcscheme
│ └── xcschememanagement.plist
└── vvision_Prefix.pch
/README.md:
--------------------------------------------------------------------------------
1 | # OpengGL | ES tutorials
2 |
3 | A series of OpenGL examples that cover various OpenGL rendering techniques for iOS, written in C++, and useful for someone who wants to start graphics programming.
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 | # Description:
13 |
14 | A series of OpenGLES 2.0 tutorials for iOS.
15 |
16 | More details can be found on the following link:
17 |
18 | http://www.virtual-vision.net/4.html
19 |
20 | Version 1.0 of tutorials covers the following subjects:
21 | * Asset import using Assimp.
22 | * Gpu Skinning.
23 | * Bump Mapping.
24 | * Quaternion camera movement.
25 | * Fog.
26 | * SkyBox.
27 | * Water Reflections.
28 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Classes/Core/Tutorial.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Tutorial.cpp
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #include "Tutorial.h"
11 |
12 | //cache resource manager
13 | CCacheResourceManager& crm = CCacheResourceManager::Instance();
14 |
15 | Tutorial::Tutorial()
16 | : m_pCamera(NULL), m_pMesh(NULL), m_pShaderMesh(NULL)
17 | {
18 | }
19 |
20 | Tutorial::~Tutorial()
21 | {
22 | Cleanup();
23 | }
24 | void Tutorial::Cleanup()
25 | {
26 | //this will delete all cached resources ( textures, shaders and meshes)
27 | crm.Destroy();
28 |
29 | SAFE_DELETE(m_pCamera);
30 | SAFE_DELETE(m_pMesh);
31 | }
32 | bool Tutorial::LoadShaders()
33 | {
34 | //load shader
35 | m_pShaderMesh = crm.LoadShader("nolighting");
36 | return (m_pShaderMesh != NULL);
37 | }
38 |
39 | bool Tutorial::LoadEntities()
40 | {
41 | //static mesh
42 | IMesh* assimpMesh = IMesh::LoadMeshFromFile(("house_obj.obj"));
43 |
44 | if(assimpMesh == NULL)
45 | return false;
46 |
47 | m_pMesh = new CMeshEntity(assimpMesh);
48 |
49 | //m_pCamera
50 | m_pCamera = new CCameraEntity(vec3f(-479.7f, -935.5f, 492.7f), vec3f(-391.6f, -737.5f, 418.7f), 70.f);
51 | return true;
52 | }
53 |
54 | bool Tutorial::Deploy()
55 | {
56 | if(!LoadShaders() || !LoadEntities())
57 | {
58 | Cleanup();
59 | return false;
60 | }
61 |
62 | //setup opengl
63 | glClearColor(0.2, 0.2, 0.2, 1.f);
64 | //enable depth test an back face culling
65 | glEnable(GL_DEPTH_TEST);
66 | glEnable(GL_CULL_FACE);
67 | glCullFace(GL_BACK);
68 |
69 | return true;
70 | }
71 | void Tutorial::RenderFromPosition(const mat4f& view, const mat4f& projection)
72 | {
73 | //activate shader
74 | m_pShaderMesh->Begin();
75 | //render model
76 | m_pMesh->Render(m_pShaderMesh, view, projection);
77 | //disable shader
78 | m_pShaderMesh->End();
79 |
80 | //roate model arround vertical axis
81 | static float angle = 0.f;
82 | mat4f & model = m_pMesh->GetTransfromationMatrix();
83 | model = mat4f::createRotationAroundAxis(0, 0, angle);
84 | angle += 0.5f;
85 | }
86 | void Tutorial::Frame()
87 | {
88 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
89 | RenderFromPosition(m_pCamera->GetViewMatrix(), m_pCamera->GetProjectionMatrix());
90 | }
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Classes/Core/Tutorial.h:
--------------------------------------------------------------------------------
1 | /* Tutorial.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef vvision_Tutorial_h
21 | #define vvision_Tutorial_h
22 |
23 | #include "vvision.h"
24 | #include "CameraEntity.h"
25 | #include "MeshEntity.h"
26 |
27 |
28 | class Tutorial
29 | {
30 | public:
31 |
32 | /** constructor*/
33 | Tutorial();
34 |
35 | /** destructor*/
36 | ~Tutorial();
37 |
38 | /** deploy tutorial content*/
39 | bool Deploy();
40 |
41 | /**display frame*/
42 | void Frame();
43 |
44 | private:
45 |
46 | /** cleanup*/
47 | void Cleanup();
48 |
49 | /** load shaders*/
50 | bool LoadShaders();
51 |
52 | /** load entities*/
53 | bool LoadEntities();
54 |
55 | /**render the scene from different position*/
56 | void RenderFromPosition(const mat4f& view, const mat4f& projection);
57 |
58 | /** shaders*/
59 | CShader *m_pShaderMesh;
60 |
61 | /** m_pCamera entity*/
62 | CCameraEntity* m_pCamera;
63 |
64 | /** mesh*/
65 | CMeshEntity* m_pMesh;
66 |
67 | };
68 |
69 | #endif
70 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Classes/Core/entities/MeshEntity.h:
--------------------------------------------------------------------------------
1 | /* MeshEntity.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef VVISION_MeshEntity_h
21 | #define VVISION_MeshEntity_h
22 |
23 | #include "vvision.h"
24 |
25 | class CMeshEntity
26 | {
27 | public:
28 |
29 | /** constructor*/
30 | CMeshEntity(IMesh* mesh);
31 |
32 | /** destructor*/
33 | ~CMeshEntity();
34 |
35 | /** update mesh*/
36 | virtual void Update(float32 dt);
37 |
38 | /** render*/
39 | virtual void Render(CShader* shader, const mat4f &view, const mat4f &projection);
40 |
41 | /**reference to transformation matrix*/
42 | mat4f& GetTransfromationMatrix() {return m_mTransformationMatrix;}
43 |
44 | /** reference to the mesh buffer*/
45 | CMeshBuffer& GetMeshBuffer() {return *m_pMesh->GetMeshBuffer();}
46 |
47 | private:
48 | /** holds mesh buffer*/
49 | IMesh* m_pMesh;
50 |
51 | /** model matrix*/
52 | mat4f m_mTransformationMatrix;
53 | };
54 |
55 | #endif
56 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Classes/GPUManager.h:
--------------------------------------------------------------------------------
1 | /* GPUManager.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #import
21 |
22 | #import
23 | #import
24 | #import
25 | #import
26 | #import "EAGLView.h"
27 | #import "Tutorial.h"
28 |
29 | @interface GPUManager : NSObject {
30 |
31 | EAGLView* _glview;
32 | GLuint _contextWidth;
33 | GLuint _contextHeight;
34 | EAGLContext *_context;
35 | Tutorial* _tutorial;
36 | }
37 |
38 | @property (nonatomic, retain) EAGLContext *context;
39 | @property GLuint contextWidth;
40 | @property GLuint contextHeight;
41 |
42 | - (id) init;
43 | - (void) AttachViewToContext:(UIView*) view;
44 | - (BOOL) CreateOpenGLESContext;
45 | - (void) TearOpenGLESContext;
46 | - (void)DrawFrame;
47 | @end
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Classes/GPUManager.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * GPUManager.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "GPUManager.h"
11 | #import "CacheResourceManager.h"
12 | @implementation GPUManager
13 |
14 | @synthesize context = _context;
15 | @synthesize contextWidth = _contextWidth;
16 | @synthesize contextHeight = _contextHeight;
17 |
18 |
19 | CCacheResourceManager& crm_ = CCacheResourceManager::Instance();
20 |
21 | -(id) init
22 | {
23 | self = [super init];
24 |
25 | if(self)
26 | {
27 | _tutorial = new Tutorial();
28 | }
29 |
30 | return self;
31 | }
32 |
33 | - (BOOL) CreateOpenGLESContext
34 | {
35 | if (self.context != nil)
36 | return YES;
37 |
38 | EAGLContext * aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
39 |
40 | if (!aContext)
41 | {
42 | NSLog(@"Failed to create ES context");
43 | return FALSE;
44 | }
45 |
46 | else if (![EAGLContext setCurrentContext:aContext])
47 | {
48 | NSLog(@"Failed to set ES context current");
49 | return FALSE;
50 | }
51 |
52 | self.Context = aContext;
53 | [aContext release];
54 |
55 | return _tutorial->Deploy();
56 | }
57 |
58 | - (void) AttachViewToContext:(UIView*) view
59 | {
60 | if (view != nil)
61 | {
62 | _glview = (EAGLView*)view;
63 | [_glview setContext:self.context];
64 | [_glview setFramebuffer];
65 | self.contextWidth = [ _glview framebufferWidth ];
66 | self.contextHeight = [ _glview framebufferHeight ];
67 | }
68 | }
69 | - (void)dealloc
70 | {
71 | [self TearOpenGLESContext];
72 | self.context = nil;
73 | SAFE_DELETE(_tutorial);
74 | [super dealloc];
75 | }
76 | - (void) TearOpenGLESContext
77 | {
78 | // Tear down context.
79 | if ([EAGLContext currentContext] == self.context)
80 | [EAGLContext setCurrentContext:nil];
81 | }
82 |
83 | - (void)DrawFrame
84 | {
85 | if(self.context)
86 | {
87 | [EAGLContext setCurrentContext:self.context];
88 | [_glview setFramebuffer];
89 | }
90 |
91 | //draw frame
92 | _tutorial->Frame();
93 | [_glview presentFramebuffer];
94 | }
95 | @end
96 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Classes/vvisionAppDelegate.h:
--------------------------------------------------------------------------------
1 | /* vvisionAppDelegate.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import
10 |
11 | @class vvisionViewController;
12 |
13 | @interface vvisionAppDelegate : NSObject {
14 | UIWindow *_window;
15 | vvisionViewController *_viewController;
16 | }
17 |
18 | @property (nonatomic, retain) IBOutlet UIWindow *window;
19 | @property (nonatomic, retain) IBOutlet vvisionViewController *viewController;
20 |
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Classes/vvisionAppDelegate.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * vvisionAppDelegate.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "vvisionAppDelegate.h"
11 | #import "vvisionViewController.h"
12 |
13 | @implementation vvisionAppDelegate
14 |
15 | @synthesize window = _window;
16 | @synthesize viewController = _viewController;
17 |
18 | - (void)applicationWillResignActive:(UIApplication *)application
19 | {
20 | [self.viewController stopAnimation];
21 | }
22 |
23 | - (void)applicationDidBecomeActive:(UIApplication *)application
24 | {
25 | NSLog(@"app became active");
26 | [self.viewController startAnimation];
27 | }
28 |
29 | - (void)applicationWillTerminate:(UIApplication *)application
30 | {
31 | [self.viewController stopAnimation];
32 | }
33 |
34 | - (void)applicationDidEnterBackground:(UIApplication *)application
35 | {
36 | // Handle any background procedures not related to animation here.
37 | NSLog(@"app entered background");
38 | }
39 |
40 | - (void)applicationWillEnterForeground:(UIApplication *)application
41 | {
42 | // Handle any foreground procedures not related to animation here.
43 | }
44 |
45 | - (void)dealloc
46 | {
47 | self.viewController = nil;//this should invoke a release msg on the retained object ( if count = 0 dealloc is invoked)
48 | self.window = nil;
49 | [super dealloc];
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Classes/vvisionViewController.h:
--------------------------------------------------------------------------------
1 | /* vvisionViewController.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import "GPUManager.h"
10 |
11 | @interface vvisionViewController : UIViewController
12 | {
13 |
14 | GPUManager* _gpuManager;
15 |
16 | BOOL animating;
17 | NSInteger _animationFrameInterval;
18 | CADisplayLink *_displayLink;
19 | }
20 |
21 | @property (nonatomic, assign) CADisplayLink *displayLink;
22 |
23 | - (void)startAnimation;
24 | - (void)stopAnimation;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/assimpImport/assimpImport/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Resources/House/house_diffuse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/assimpImport/assimpImport/Resources/House/house_diffuse.png
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Resources/House/house_obj.mtl:
--------------------------------------------------------------------------------
1 | # Blender MTL File: ''
2 | # Material Count: 1
3 | newmtl blinn1SG_house_diffuse.png
4 | Ns 0.000000
5 | Ka 0.000000 0.000000 0.000000
6 | Kd 0.000000 0.000000 0.000000
7 | Ks 0.000000 0.000000 0.000000
8 | Ni 1.000000
9 | d 0.000000
10 | illum 2
11 | map_Kd house_diffuse.png
12 | map_Bump house_normal.png
13 | map_Ks house_spec.png
14 |
15 |
16 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Resources/Shaders/nolighting.fsh:
--------------------------------------------------------------------------------
1 | //
2 | // NoLighting.fsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | precision highp float;
10 |
11 | uniform sampler2D texture0;
12 | varying vec2 v_texCoord;
13 | varying vec4 v_vertex;
14 |
15 | void main()
16 | {
17 | gl_FragColor = texture2D( texture0, v_texCoord);
18 | }
19 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Resources/Shaders/nolighting.vsh:
--------------------------------------------------------------------------------
1 | //
2 | // NoLighting.vsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | attribute vec4 position;
10 | attribute vec2 texCoord0;
11 |
12 | varying vec2 v_texCoord;
13 |
14 | uniform mat4 matModel;
15 | uniform mat4 matProjViewModel;
16 |
17 | varying vec4 v_vertex;
18 | void main()
19 | {
20 | v_texCoord = texCoord0;
21 | gl_Position = matProjViewModel * position;
22 | v_vertex = matModel * position;
23 | }
24 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/assimpImport/assimpImport/Resources/icon.png
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/main.m:
--------------------------------------------------------------------------------
1 | /*
2 | * main.m
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import
11 |
12 | int main(int argc, char *argv[]) {
13 |
14 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
15 | int retVal = UIApplicationMain(argc, argv, nil, nil);
16 | [pool release];
17 | return retVal;
18 | }
19 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/vvision-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | assimpImport
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 | icon.png
13 | CFBundleIdentifier
14 | com.virtual-vision.assimpImport
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | NSMainNibFile
30 | MainWindow
31 | UIStatusBarHidden
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/vvision.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/assimpImport/assimpImport/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
18 |
19 |
31 |
32 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | vvision.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 1D6058900D05DD3D006BFB54
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/assimpImport/assimpImport/vvision_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'vvision' target in the 'vvision' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Classes/Core/Tutorial.h:
--------------------------------------------------------------------------------
1 | /* Tutorial.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef vvision_Tutorial_h
21 | #define vvision_Tutorial_h
22 |
23 | #include "vvision.h"
24 | #include "CameraEntity.h"
25 | #include "MeshEntity.h"
26 |
27 | struct CControlPad
28 | {
29 | /** this is set to true if key up is pressed*/
30 | bool keyUp;
31 |
32 | /** true if keyDown pressed*/
33 | bool keyDown;
34 |
35 | /** left*/
36 | bool keyLeft;
37 |
38 | /** right*/
39 | bool keyRight;
40 |
41 | /** key move forward is pressed*/
42 | bool keyMoveUp;
43 |
44 | /** key move backward is pressed*/
45 | bool keyMoveDown;
46 |
47 | };
48 |
49 | class Tutorial
50 | {
51 | public:
52 |
53 | /** constructor*/
54 | Tutorial();
55 |
56 | /** destructor*/
57 | ~Tutorial();
58 |
59 | /** deploy tutorial content*/
60 | bool Deploy();
61 |
62 | /**display frame*/
63 | void Frame();
64 |
65 | private:
66 |
67 | /** cleanup*/
68 | void Cleanup();
69 |
70 | /** load shaders*/
71 | bool LoadShaders();
72 |
73 | /** load entities*/
74 | bool LoadEntities();
75 |
76 | /**render the scene from different position*/
77 | void RenderFromPosition(const mat4f& view, const mat4f& projection);
78 |
79 | /** shaders*/
80 | CShader* m_pShaderBump;
81 |
82 | /** m_pCamera entity*/
83 | CCameraEntity* m_pCamera;
84 |
85 | /** bumped model*/
86 | CMeshEntity* m_pBumpModel;
87 |
88 | /** time*/
89 | float32 time;
90 | };
91 |
92 | #endif
93 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Classes/Core/entities/MeshEntity.h:
--------------------------------------------------------------------------------
1 | /* MeshEntity.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef VVISION_MeshEntity_h
21 | #define VVISION_MeshEntity_h
22 |
23 | #include "vvision.h"
24 |
25 | class CMeshEntity
26 | {
27 | public:
28 |
29 | /** constructor*/
30 | CMeshEntity(IMesh* mesh);
31 |
32 | /** destructor*/
33 | ~CMeshEntity();
34 |
35 | /** update mesh*/
36 | virtual void Update(float32 dt);
37 |
38 | /** render*/
39 | virtual void Render(CShader* shader, const mat4f &view, const mat4f &projection);
40 |
41 | /**reference to transformation matrix*/
42 | mat4f& GetTransfromationMatrix() {return m_mTransformationMatrix;}
43 |
44 | /** reference to the mesh buffer*/
45 | CMeshBuffer& GetMeshBuffer() {return *m_pMesh->GetMeshBuffer();}
46 |
47 | private:
48 | IMesh* m_pMesh;
49 |
50 | mat4f m_mTransformationMatrix;
51 | };
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Classes/GPUManager.h:
--------------------------------------------------------------------------------
1 | /* GPUManager.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #import
21 |
22 | #import
23 | #import
24 | #import
25 | #import
26 | #import "EAGLView.h"
27 | #import "Tutorial.h"
28 |
29 | @interface GPUManager : NSObject {
30 |
31 | EAGLView* _glview;
32 | GLuint _contextWidth;
33 | GLuint _contextHeight;
34 | EAGLContext *_context;
35 | Tutorial* _tutorial;
36 | }
37 |
38 | @property (nonatomic, retain) EAGLContext *context;
39 | @property GLuint contextWidth;
40 | @property GLuint contextHeight;
41 |
42 | - (id) init;
43 | - (void) AttachViewToContext:(UIView*) view;
44 | - (BOOL) CreateOpenGLESContext;
45 | - (void) TearOpenGLESContext;
46 | - (void)DrawFrame;
47 | @end
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Classes/GPUManager.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * GPUManager.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "GPUManager.h"
11 | #import "CacheResourceManager.h"
12 | @implementation GPUManager
13 |
14 | @synthesize context = _context;
15 | @synthesize contextWidth = _contextWidth;
16 | @synthesize contextHeight = _contextHeight;
17 |
18 |
19 | CCacheResourceManager& crm_ = CCacheResourceManager::Instance();
20 |
21 | -(id) init
22 | {
23 | self = [super init];
24 |
25 | if(self)
26 | {
27 | _tutorial = new Tutorial();
28 | }
29 |
30 | return self;
31 | }
32 |
33 | - (BOOL) CreateOpenGLESContext
34 | {
35 | if (self.context != nil)
36 | return YES;
37 |
38 | EAGLContext * aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
39 |
40 | if (!aContext)
41 | {
42 | NSLog(@"Failed to create ES context");
43 | return FALSE;
44 | }
45 |
46 | else if (![EAGLContext setCurrentContext:aContext])
47 | {
48 | NSLog(@"Failed to set ES context current");
49 | return FALSE;
50 | }
51 |
52 | self.Context = aContext;
53 | [aContext release];
54 |
55 | return _tutorial->Deploy();
56 | }
57 |
58 | - (void) AttachViewToContext:(UIView*) view
59 | {
60 | if (view != nil)
61 | {
62 | _glview = (EAGLView*)view;
63 | [_glview setContext:self.context];
64 | [_glview setFramebuffer];
65 | self.contextWidth = [ _glview framebufferWidth ];
66 | self.contextHeight = [ _glview framebufferHeight ];
67 | }
68 | }
69 | - (void)dealloc
70 | {
71 | [self TearOpenGLESContext];
72 | self.context = nil;
73 | SAFE_DELETE(_tutorial);
74 | [super dealloc];
75 | }
76 | - (void) TearOpenGLESContext
77 | {
78 | // Tear down context.
79 | if ([EAGLContext currentContext] == self.context)
80 | [EAGLContext setCurrentContext:nil];
81 | }
82 |
83 | - (void)DrawFrame
84 | {
85 | if(self.context)
86 | {
87 | [EAGLContext setCurrentContext:self.context];
88 | [_glview setFramebuffer];
89 | }
90 |
91 | //draw frame
92 | _tutorial->Frame();
93 | [_glview presentFramebuffer];
94 | }
95 | @end
96 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Classes/vvisionAppDelegate.h:
--------------------------------------------------------------------------------
1 | /* vvisionAppDelegate.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import
10 |
11 | @class vvisionViewController;
12 |
13 | @interface vvisionAppDelegate : NSObject {
14 | UIWindow *_window;
15 | vvisionViewController *_viewController;
16 | }
17 |
18 | @property (nonatomic, retain) IBOutlet UIWindow *window;
19 | @property (nonatomic, retain) IBOutlet vvisionViewController *viewController;
20 |
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Classes/vvisionAppDelegate.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * vvisionAppDelegate.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "vvisionAppDelegate.h"
11 | #import "vvisionViewController.h"
12 |
13 | @implementation vvisionAppDelegate
14 |
15 | @synthesize window = _window;
16 | @synthesize viewController = _viewController;
17 |
18 | - (void)applicationWillResignActive:(UIApplication *)application
19 | {
20 | [self.viewController stopAnimation];
21 | }
22 |
23 | - (void)applicationDidBecomeActive:(UIApplication *)application
24 | {
25 | NSLog(@"app became active");
26 | [self.viewController startAnimation];
27 | }
28 |
29 | - (void)applicationWillTerminate:(UIApplication *)application
30 | {
31 | [self.viewController stopAnimation];
32 | }
33 |
34 | - (void)applicationDidEnterBackground:(UIApplication *)application
35 | {
36 | // Handle any background procedures not related to animation here.
37 | NSLog(@"app entered background");
38 | }
39 |
40 | - (void)applicationWillEnterForeground:(UIApplication *)application
41 | {
42 | // Handle any foreground procedures not related to animation here.
43 | }
44 |
45 | - (void)dealloc
46 | {
47 | self.viewController = nil;//this should invoke a release msg on the retained object ( if count = 0 dealloc is invoked)
48 | self.window = nil;
49 | [super dealloc];
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Classes/vvisionViewController.h:
--------------------------------------------------------------------------------
1 | /* vvisionViewController.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import "GPUManager.h"
10 |
11 | @interface vvisionViewController : UIViewController
12 | {
13 |
14 | GPUManager* _gpuManager;
15 |
16 | BOOL animating;
17 | NSInteger _animationFrameInterval;
18 | CADisplayLink *_displayLink;
19 | }
20 |
21 | @property (nonatomic, assign) CADisplayLink *displayLink;
22 |
23 | - (void)startAnimation;
24 | - (void)stopAnimation;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Resources/Box/Crate_Fragile.mtl:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 16.03.2011 16:48:36
3 |
4 | newmtl 01___Default
5 | Ns 10.0000
6 | Ni 1.5000
7 | d 1.0000
8 | Tr 1.0000
9 | Tf 1.0000 1.0000 1.0000
10 | illum 2
11 | Ka 0.0000 0.0000 0.0000
12 | Kd 0.5882 0.5882 0.5882
13 | Ks 0.0000 0.0000 0.0000
14 | Ke 0.0000 0.0000 0.0000
15 | map_Ka fragile_diffuse.jpg
16 | map_Kd fragile_diffuse.jpg
17 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Resources/Box/Crate_Fragile.obj:
--------------------------------------------------------------------------------
1 | # 3ds Max Wavefront OBJ Exporter v0.94b - (c)2007 guruware
2 | # File Created: 16.03.2011 16:48:36
3 |
4 | mtllib Crate_Fragile.mtl
5 |
6 | #
7 | # object Crate_Fragile
8 | #
9 |
10 | v 19.6850 39.3701 19.6850
11 | v -19.6850 39.3701 19.6850
12 | v -19.6850 0.0000 19.6850
13 | v 19.6850 0.0000 19.6850
14 | v -19.6850 39.3701 -19.6850
15 | v 19.6850 39.3701 -19.6850
16 | v 19.6850 0.0000 -19.6850
17 | v -19.6850 0.0000 -19.6850
18 | # 8 vertices
19 |
20 | vt 1.0000 1.0000 0.0000
21 | vt 0.0000 1.0000 0.0000
22 | vt 0.0000 0.0000 0.0000
23 | vt 1.0000 0.0000 0.0000
24 | # 4 texture coords
25 |
26 | g Crate_Fragile
27 | usemtl 01___Default
28 | f 1/1 2/2 3/3 4/4
29 | f 5/1 6/2 7/3 8/4
30 | f 2/1 5/2 8/3 3/4
31 | f 6/1 1/2 4/3 7/4
32 | f 6/1 5/2 2/3 1/4
33 | f 4/1 3/2 8/3 7/4
34 | # 6 polygons
35 |
36 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Resources/Box/fragile_diffuse.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpMapping/bumpMapping/Resources/Box/fragile_diffuse.jpg
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Resources/Box/fragile_normal.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpMapping/bumpMapping/Resources/Box/fragile_normal.jpg
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpMapping/bumpMapping/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Resources/Shaders/Bump.fsh:
--------------------------------------------------------------------------------
1 | precision highp float;
2 |
3 | uniform sampler2D texture0;
4 | uniform sampler2D textureBump;
5 |
6 | varying vec3 v_lightVec;
7 | varying vec2 v_texCoord;
8 |
9 | void main()
10 | {
11 | // per pixel normal
12 | vec3 normal = texture2D(textureBump, v_texCoord).rgb * 2.0 - 1.0;
13 | //light intensity is the dot product of the light direction with the per pixel normal
14 | float lightIntensity = dot(v_lightVec, normal);
15 |
16 | //modulate light intensity with diffuse texture
17 | vec3 texColor = texture2D(texture0, v_texCoord).rgb;
18 | gl_FragColor = vec4(texColor * lightIntensity, 1.0);
19 | }
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Resources/Shaders/Bump.vsh:
--------------------------------------------------------------------------------
1 | precision highp float;
2 |
3 | attribute vec4 position;
4 | attribute vec3 normal;
5 | attribute vec2 texCoord0;
6 | attribute vec3 tangent;
7 |
8 | uniform mat4 matProjViewModel;
9 | uniform vec3 LightPosModel; // Light position in model space
10 |
11 | varying vec3 v_lightVec;
12 | varying vec2 v_texCoord;
13 |
14 | void main()
15 | {
16 | gl_Position = matProjViewModel * position;
17 | //light direction
18 | vec3 lightDirection = normalize(LightPosModel /*- vec3(position)*/);// for point light: light direction is equal: light pos - vertex_pos
19 | //calculate bitangent
20 | vec3 bitangent = cross(normal, tangent);
21 | //create tangent stace
22 | mat3 tangentSpaceXform = mat3(tangent, bitangent, normal);
23 |
24 | //transfrom light direction from model space to tangent space
25 | v_lightVec = lightDirection * tangentSpaceXform;
26 |
27 | //write tex coord for the current vertex so the pixel shader can interpolate tex coords on rasterized pixels
28 | v_texCoord = texCoord0;
29 | }
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpMapping/bumpMapping/Resources/icon.png
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/main.m:
--------------------------------------------------------------------------------
1 | /*
2 | * main.m
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import
11 |
12 | int main(int argc, char *argv[]) {
13 |
14 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
15 | int retVal = UIApplicationMain(argc, argv, nil, nil);
16 | [pool release];
17 | return retVal;
18 | }
19 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/vvision-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | bumpMapping
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 | icon.png
13 | CFBundleIdentifier
14 | com.virtual-vision.bumpMapping
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | NSMainNibFile
30 | MainWindow
31 | UIStatusBarHidden
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/vvision.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpMapping/bumpMapping/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | vvision.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 1D6058900D05DD3D006BFB54
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/bumpMapping/bumpMapping/vvision_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'vvision' target in the 'vvision' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Classes/Core/entities/MeshEntity.h:
--------------------------------------------------------------------------------
1 | /* MeshEntity.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef VVISION_MeshEntity_h
21 | #define VVISION_MeshEntity_h
22 |
23 | #include "vvision.h"
24 |
25 | class CMeshEntity
26 | {
27 | public:
28 |
29 | /** constructor*/
30 | CMeshEntity(IMesh* mesh);
31 |
32 | /** destructor*/
33 | ~CMeshEntity();
34 |
35 | /** update mesh*/
36 | virtual void Update(float32 dt);
37 |
38 | /** render*/
39 | virtual void Render(CShader* shader, const mat4f &view, const mat4f &projection);
40 |
41 | /**reference to transformation matrix*/
42 | mat4f& GetTransfromationMatrix() {return m_mTransformationMatrix;}
43 |
44 | /** reference to the mesh buffer*/
45 | CMeshBuffer& GetMeshBuffer() {return *m_pMesh->GetMeshBuffer();}
46 |
47 | private:
48 | IMesh* m_pMesh;
49 |
50 | mat4f m_mTransformationMatrix;
51 | };
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Classes/GPUManager.h:
--------------------------------------------------------------------------------
1 | /* GPUManager.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #import
21 |
22 | #import
23 | #import
24 | #import
25 | #import
26 | #import "EAGLView.h"
27 | #import "Tutorial.h"
28 |
29 | @interface GPUManager : NSObject {
30 |
31 | EAGLView* _glview;
32 | GLuint _contextWidth;
33 | GLuint _contextHeight;
34 | EAGLContext *_context;
35 | Tutorial* _tutorial;
36 | }
37 |
38 | @property (nonatomic, retain) EAGLContext *context;
39 | @property GLuint contextWidth;
40 | @property GLuint contextHeight;
41 |
42 | - (id) init;
43 | - (void) AttachViewToContext:(UIView*) view;
44 | - (BOOL) CreateOpenGLESContext;
45 | - (void) TearOpenGLESContext;
46 | - (void)DrawFrame;
47 | -(void) receivedControl:(CControlPad&) pad;
48 | @end
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Classes/GPUManager.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * GPUManager.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "GPUManager.h"
11 | #import "CacheResourceManager.h"
12 | @implementation GPUManager
13 |
14 | @synthesize context = _context;
15 | @synthesize contextWidth = _contextWidth;
16 | @synthesize contextHeight = _contextHeight;
17 |
18 |
19 | CCacheResourceManager& crm_ = CCacheResourceManager::Instance();
20 |
21 | -(id) init
22 | {
23 | self = [super init];
24 |
25 | if(self)
26 | {
27 | _tutorial = new Tutorial();
28 | }
29 |
30 | return self;
31 | }
32 |
33 | - (BOOL) CreateOpenGLESContext
34 | {
35 | if (self.context != nil)
36 | return YES;
37 |
38 | EAGLContext * aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
39 |
40 | if (!aContext)
41 | {
42 | NSLog(@"Failed to create ES context");
43 | return FALSE;
44 | }
45 |
46 | else if (![EAGLContext setCurrentContext:aContext])
47 | {
48 | NSLog(@"Failed to set ES context current");
49 | return FALSE;
50 | }
51 |
52 | self.Context = aContext;
53 | [aContext release];
54 |
55 |
56 | return _tutorial->Deploy();
57 | }
58 |
59 | - (void) AttachViewToContext:(UIView*) view
60 | {
61 | if (view != nil)
62 | {
63 | _glview = (EAGLView*)view;
64 | [_glview setContext:self.context];
65 | [_glview setFramebuffer];
66 | self.contextWidth = [ _glview framebufferWidth ];
67 | self.contextHeight = [ _glview framebufferHeight ];
68 | }
69 | }
70 | - (void)dealloc
71 | {
72 | [self TearOpenGLESContext];
73 | self.context = nil;
74 | SAFE_DELETE(_tutorial);
75 | [super dealloc];
76 | }
77 | - (void) TearOpenGLESContext
78 | {
79 | // Tear down context.
80 | if ([EAGLContext currentContext] == self.context)
81 | [EAGLContext setCurrentContext:nil];
82 | }
83 |
84 | - (void)DrawFrame
85 | {
86 | if(self.context)
87 | {
88 | [EAGLContext setCurrentContext:self.context];
89 | [_glview setFramebuffer];
90 | }
91 |
92 | //draw frame
93 | _tutorial->Frame();
94 | [_glview presentFramebuffer];
95 |
96 |
97 | }
98 | -(void) receivedControl:(CControlPad&) pad
99 | {
100 | _tutorial->UpdateControls(pad);
101 | }
102 | @end
103 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Classes/vvisionAppDelegate.h:
--------------------------------------------------------------------------------
1 | /* vvisionAppDelegate.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import
10 |
11 | @class vvisionViewController;
12 |
13 | @interface vvisionAppDelegate : NSObject {
14 | UIWindow *_window;
15 | vvisionViewController *_viewController;
16 | }
17 |
18 | @property (nonatomic, retain) IBOutlet UIWindow *window;
19 | @property (nonatomic, retain) IBOutlet vvisionViewController *viewController;
20 |
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Classes/vvisionAppDelegate.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * vvisionAppDelegate.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "vvisionAppDelegate.h"
11 | #import "vvisionViewController.h"
12 |
13 | @implementation vvisionAppDelegate
14 |
15 | @synthesize window = _window;
16 | @synthesize viewController = _viewController;
17 |
18 | - (void)applicationWillResignActive:(UIApplication *)application
19 | {
20 | [self.viewController stopAnimation];
21 | }
22 |
23 | - (void)applicationDidBecomeActive:(UIApplication *)application
24 | {
25 | NSLog(@"app became active");
26 | [self.viewController startAnimation];
27 | }
28 |
29 | - (void)applicationWillTerminate:(UIApplication *)application
30 | {
31 | [self.viewController stopAnimation];
32 | }
33 |
34 | - (void)applicationDidEnterBackground:(UIApplication *)application
35 | {
36 | // Handle any background procedures not related to animation here.
37 | NSLog(@"app entered background");
38 | }
39 |
40 | - (void)applicationWillEnterForeground:(UIApplication *)application
41 | {
42 | // Handle any foreground procedures not related to animation here.
43 | }
44 |
45 | - (void)dealloc
46 | {
47 | self.viewController = nil;//this should invoke a release msg on the retained object ( if count = 0 dealloc is invoked)
48 | self.window = nil;
49 | [super dealloc];
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Classes/vvisionViewController.h:
--------------------------------------------------------------------------------
1 | /* vvisionViewController.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import "GPUManager.h"
10 |
11 | @interface vvisionViewController : UIViewController
12 | {
13 |
14 | GPUManager* _gpuManager;
15 |
16 | BOOL animating;
17 | NSInteger _animationFrameInterval;
18 | CADisplayLink *_displayLink;
19 | CControlPad _controlPad;
20 | }
21 |
22 | @property (nonatomic, assign) CADisplayLink *displayLink;
23 |
24 | - (void)startAnimation;
25 | - (void)stopAnimation;
26 |
27 | -(IBAction)buttonToutchDown:(id)butID;
28 | -(IBAction)buttonToutchUp:(id)butID;
29 | -(IBAction)buttonToggleBump:(id)sender;
30 | @end
31 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/Shaders/Bump.fsh:
--------------------------------------------------------------------------------
1 |
2 | precision highp float;
3 |
4 | uniform sampler2D texture0;//diffuse texture
5 | uniform sampler2D textureBump;//bump texture
6 | //uniform sampler2D textureSpecular;//if the model has a specular texture => uncomment
7 |
8 | //lighting properties
9 | uniform vec4 lightColorAmbient;//light ambient color
10 | uniform vec4 lightColorDiffuse;//light diffuse color
11 | uniform vec4 lightColorSpecular;//light specular color
12 |
13 | //material properties
14 | uniform vec4 matColorAmbient;//mat ambient
15 | uniform vec4 matColorDiffuse;//material diffuse
16 | uniform vec4 matColorSpecular;//material specular
17 | uniform float matShininess;//material shininess
18 |
19 | //repeat tex factor
20 | uniform float repeatTexture;
21 |
22 | //varying input
23 | varying vec2 v_texCoord;// per pixel tex coordinate
24 | varying vec3 v_lightVector;// per pixel light dir vector
25 | varying vec3 v_halfVector;// per pixel half vector
26 |
27 | void main()
28 | {
29 | //tex coordinate * repeat factor
30 | vec2 texCoord = v_texCoord * repeatTexture;
31 |
32 | //fetch per vertex diffuse color
33 | vec4 color = texture2D(texture0, texCoord) ;
34 |
35 | //fetch per pixel normal
36 | vec3 bump = texture2D(textureBump, texCoord).rgb * 2.0 - 1.0;
37 | //invert normal for back faces ( if face culling is enabled this can be removed)
38 | if (!gl_FrontFacing)
39 | bump = - bump;
40 |
41 | //calculate light contribution
42 | //1- lamber or diffuse factor
43 | float lamber = max(0.0, dot(normalize(v_lightVector), bump) );
44 |
45 | //2- specular factor
46 | float specular = 0.0;
47 | if (dot(bump, v_lightVector) < 0.0)
48 | specular = 0.0;
49 | else
50 | specular = max(0.0, pow(dot(normalize(v_halfVector), bump), matShininess)) ;
51 |
52 | //get the final ambient diffuse and specular color
53 | vec4 finalAmbientContrib = lightColorAmbient * color /** matColorAmbient.xyz*/;
54 | vec4 finalDiffuseContrib = lightColorDiffuse * color * lamber * matColorDiffuse;
55 | vec4 finalSpecularContrib = lightColorSpecular * specular * matColorSpecular;
56 |
57 | //the final color is the sum of ambient dffuse and specular
58 | gl_FragColor = finalAmbientContrib + (finalDiffuseContrib + finalSpecularContrib) ;
59 |
60 | }
61 |
62 |
63 |
64 |
65 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/Shaders/Bump.vsh:
--------------------------------------------------------------------------------
1 |
2 | precision highp float;
3 |
4 | //per vertex attribute
5 | attribute vec4 position; //vertex pos
6 | attribute vec3 normal; //vertex normal
7 | attribute vec2 texCoord0; //vertex tex coord
8 | attribute vec3 tangent; // vertex tangent
9 |
10 | //shader uniform
11 | uniform mat4 matProjViewModel; //Proj * View * Model
12 | uniform vec3 lightPosModel; //light position in the model space
13 | uniform vec3 camPosModel; //camera position in the model space
14 |
15 | //shader varying output
16 | varying vec2 v_texCoord;
17 | varying vec3 v_lightVector;
18 | varying vec3 v_halfVector;
19 |
20 | void main()
21 | {
22 | // write final vertex position
23 | gl_Position = matProjViewModel * position;
24 |
25 | // write tex coordinate for interpolation
26 | v_texCoord = texCoord0.xy;
27 |
28 | //calculate bitangent ( this can be don on cpu)
29 | vec3 bitangent = cross(normal, tangent);
30 | //create tangent space
31 | mat3 tangentSpace = mat3(tangent, bitangent, normal);
32 |
33 | //get light direction for the current vertex
34 | v_lightVector = lightPosModel - position.xyz ;
35 | //transform light direction to tangent space
36 | v_lightVector = v_lightVector * tangentSpace;
37 | //normalize
38 | v_lightVector = normalize(v_lightVector);
39 |
40 | //get eye direction for the current vertex
41 | v_halfVector = camPosModel - position.xyz ;
42 | //transfrom to tangent space
43 | v_halfVector = v_halfVector * tangentSpace;
44 | //normalize
45 | v_halfVector = normalize(v_halfVector);
46 | //calculate the half vector
47 | v_halfVector = (v_halfVector + v_lightVector) /2.0;
48 | //normalize
49 | v_halfVector = normalize(v_halfVector) ;
50 | }
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/Shaders/NoBump.fsh:
--------------------------------------------------------------------------------
1 | precision highp float;
2 |
3 | //diffuse texture
4 | uniform sampler2D texture0;
5 |
6 | //lighting properties
7 | uniform vec4 lightColorAmbient;//light ambient color
8 | uniform vec4 lightColorDiffuse;//light diffuse color
9 | uniform vec4 lightColorSpecular;//light specular color
10 |
11 | //material properties
12 | uniform vec4 matColorAmbient;//mat ambient
13 | uniform vec4 matColorDiffuse;//material diffuse
14 | uniform vec4 matColorSpecular;//material specular
15 | uniform float matShininess;//material shininess
16 |
17 | //repeat tex factor
18 | uniform float repeatTexture;
19 |
20 | //varying input
21 | varying vec2 v_texCoord;
22 | varying vec3 v_lightVector;
23 | varying vec3 v_halfVector;
24 | varying vec3 v_normal;
25 |
26 | void main()
27 | {
28 | //tex coordinate * repeat factor
29 | vec2 texCoord = v_texCoord * repeatTexture;
30 |
31 | //fetch per vertex diffuse color
32 | vec4 color = texture2D(texture0, texCoord);
33 |
34 |
35 | //invert normal for back faces ( if face culling is enabled this can be removed)
36 | vec3 normal = v_normal;
37 | if (!gl_FrontFacing)
38 | normal = -normal;
39 |
40 | //calculate light contribution
41 | //1- diffuse or lamber factor
42 | float lamber = max(0.0, dot(v_lightVector, normal) );
43 |
44 | //2- specular factor
45 | float specular = 0.0;
46 | if (dot(normal, v_lightVector) < 0.0)
47 | specular = 0.0;
48 | else
49 | specular = max(0.0, pow(dot(normalize(v_halfVector), normal), matShininess)) ;
50 |
51 | //get the final ambient diffuse and specular color
52 | vec4 finalAmbientContrib = lightColorAmbient * color /** matColorAmbient.xyz*/;
53 | vec4 finalDiffuseContrib = lightColorDiffuse * color * lamber * matColorDiffuse;
54 | vec4 finalSpecularContrib = lightColorSpecular * specular * matColorSpecular;
55 |
56 | //the final color is the sum of ambient dffuse and specular
57 | gl_FragColor = vec4( finalAmbientContrib + (finalDiffuseContrib + finalSpecularContrib)) ;
58 | }
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/Shaders/NoBump.vsh:
--------------------------------------------------------------------------------
1 |
2 | precision highp float;
3 |
4 | //per vertex attributes
5 | attribute vec4 position;//vertex position
6 | attribute vec3 normal;// vertex normal
7 | attribute vec2 texCoord0;// vertex tex coordinate
8 |
9 | //shader uniforms
10 | uniform mat4 matProjViewModel; // proj * view * model
11 | uniform vec3 lightPosModel; // Light position in model space
12 | uniform vec3 camPosModel; // camera position in model space
13 |
14 |
15 | varying vec2 v_texCoord;
16 | varying vec3 v_lightVector;
17 | varying vec3 v_halfVector;
18 | varying vec3 v_normal;
19 |
20 | void main()
21 | {
22 | // write final vertex position
23 | gl_Position = matProjViewModel * position;
24 |
25 | // write tex coordinate for interpolation
26 | v_texCoord = texCoord0.xy;
27 |
28 | //write vertex normal for interpolation
29 | v_normal = normal ;
30 |
31 | //light direction in the model space
32 | v_lightVector = lightPosModel - position.xyz ;
33 | //normalize
34 | v_lightVector = normalize(v_lightVector);
35 |
36 | //half vector
37 | v_halfVector = camPosModel - position.xyz ;
38 | v_halfVector = (v_halfVector + v_lightVector) /2.0;
39 | v_halfVector = normalize(v_halfVector);
40 | }
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/icon.png
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/icons/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/icons/down.png
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/icons/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/icons/left.png
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/icons/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/icons/right.png
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/icons/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/icons/up.png
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/box.mtl:
--------------------------------------------------------------------------------
1 | #
2 | # box.mtl
3 | #
4 |
5 | newmtl boxMat
6 | illum 2
7 | Kd 0.800000 0.800000 0.800000
8 | Ka 0.200000 0.200000 0.200000
9 | Ks 0.000000 0.000000 0.000000
10 | Ke 0.000000 0.000000 0.000000
11 | Ns 0.000000
12 | map_Kd rocks_diffuse.jpg
13 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/box.obj:
--------------------------------------------------------------------------------
1 | # Wavefront OBJ exported by MilkShape 3D
2 |
3 | mtllib box.mtl
4 |
5 | v -12.973700 16.585526 -1.979043
6 | v 13.087000 16.585526 -1.979043
7 | v -12.973700 16.585527 -12.127714
8 | v 13.087000 16.585527 -12.127712
9 | v 13.087000 1.854167 -12.127713
10 | v 13.087000 16.585527 -12.127712
11 | v 13.087000 1.854167 -1.979043
12 | v 13.087000 16.585526 -1.979043
13 | v -12.973700 1.854156 -1.979043
14 | v -12.973700 16.585526 -1.979043
15 | v -12.973700 1.854167 -12.127714
16 | v -12.973700 16.585527 -12.127714
17 | v -12.973700 1.854167 -12.127714
18 | v 13.087000 1.854167 -12.127713
19 | v -12.973700 1.854156 -1.979043
20 | v 13.087000 1.854167 -1.979043
21 | # 16 vertices
22 |
23 | vt -0.849430 0.999947
24 | vt 1.849430 0.999946
25 | vt 1.849430 0.000053
26 | vt -0.849430 0.000054
27 | vt 1.262720 0.000053
28 | vt -0.262718 0.000053
29 | vt -0.262718 0.999946
30 | vt 1.262720 0.999946
31 | # 8 texture coordinates
32 |
33 | vn -0.000000 1.000000 0.000000
34 | vn 1.000000 0.000000 0.000000
35 | vn -1.000000 0.000000 0.000000
36 | vn 0.000000 -1.000000 -0.000001
37 | # 4 normals
38 |
39 | g box
40 | usemtl boxMat
41 | s 1
42 | f 1/1/1 2/2/1 4/3/1
43 | f 4/3/1 3/4/1 1/1/1
44 | f 5/5/2 6/6/2 8/7/2
45 | f 8/7/2 7/8/2 5/5/2
46 | f 9/7/3 10/8/3 12/5/3
47 | f 12/5/3 11/6/3 9/7/3
48 | f 13/3/4 14/4/4 16/1/4
49 | f 16/1/4 15/2/4 13/3/4
50 | # 8 triangles in group
51 |
52 | # 8 triangles total
53 |
54 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/color_map.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/color_map.jpg
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/fragile_diffuse.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/fragile_diffuse.jpg
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/fragile_normal.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/fragile_normal.jpg
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/normal_map2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/normal_map2.jpg
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/rocks_diffuse.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/rocks_diffuse.jpg
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/rocks_normal.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/rocks_normal.jpg
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/sphere.mtl:
--------------------------------------------------------------------------------
1 | #
2 | # sphere3.mtl
3 | #
4 |
5 | newmtl boxMat
6 | illum 2
7 | Kd 0.800000 0.800000 0.800000
8 | Ka 0.200000 0.200000 0.200000
9 | Ks 0.000000 0.000000 0.000000
10 | Ke 0.000000 0.000000 0.000000
11 | Ns 0.000000
12 | map_Kd color_map.jpg
13 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/stones_diffuse.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/stones_diffuse.jpg
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/stones_normal.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/Resources/testScene/stones_normal.jpg
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/main.m:
--------------------------------------------------------------------------------
1 | /*
2 | * main.m
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import
11 |
12 | int main(int argc, char *argv[]) {
13 |
14 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
15 | int retVal = UIApplicationMain(argc, argv, nil, nil);
16 | [pool release];
17 | return retVal;
18 | }
19 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/vvision-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | bumpPerPixelLighting
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 | icon.png
13 | CFBundleIdentifier
14 | com.virtual-vision.bumpMapping
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | NSMainNibFile
30 | MainWindow
31 | UIStatusBarHidden
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/vvision.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | vvision.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 1D6058900D05DD3D006BFB54
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/bumpPerPixelLighting/bumpPerPixelLighting/vvision_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'vvision' target in the 'vvision' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Classes/Core/entities/MeshEntity.h:
--------------------------------------------------------------------------------
1 | /* MeshEntity.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef VVISION_MeshEntity_h
21 | #define VVISION_MeshEntity_h
22 |
23 | #include "vvision.h"
24 |
25 | class CMeshEntity
26 | {
27 | public:
28 |
29 | /** constructor*/
30 | CMeshEntity(IMesh* mesh);
31 |
32 | /** destructor*/
33 | ~CMeshEntity();
34 |
35 | /** update mesh*/
36 | virtual void Update(float32 dt);
37 |
38 | /** render*/
39 | virtual void Render(CShader* shader, const mat4f &view, const mat4f &projection);
40 |
41 | /**reference to transformation matrix*/
42 | mat4f& GetTransfromationMatrix() {return m_mTransformationMatrix;}
43 |
44 | /** reference to the mesh buffer*/
45 | CMeshBuffer& GetMeshBuffer() {return *m_pMesh->GetMeshBuffer();}
46 |
47 | private:
48 | IMesh* m_pMesh;
49 |
50 | mat4f m_mTransformationMatrix;
51 | };
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Classes/Core/entities/SkyBoxEntity.h:
--------------------------------------------------------------------------------
1 | /* SkyBoxEntity.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef SKY_BOX_ENTITY_INCLUDED
21 | #define SKY_BOX_ENTITY_INCLUDED
22 |
23 | #include "vvision.h"
24 |
25 | class CSkyBoxEntity
26 | {
27 | public :
28 |
29 | /** constructor
30 | * @param size the size of the sky box
31 | */
32 | CSkyBoxEntity( float32 size, const vec3f& position = vec3f());
33 |
34 | /** destructor*/
35 | ~CSkyBoxEntity();
36 |
37 |
38 | /** create skybox from a texture_base_name and size
39 | * @param texture_cubeMap the cube map texture used for the skybox
40 | * @return true if success
41 | */
42 | bool Create(CTextureCubeMap* texture_cubeMap);
43 |
44 | /** @inherited from Entity*/
45 | virtual void Render(CShader* shader, const mat4f &view, const mat4f &projection);
46 |
47 |
48 | private:
49 |
50 | /** the mesh buffer*/
51 | CMeshBuffer *m_pMeshBuffer;
52 |
53 | /** size of the skybox*/
54 | float32 m_fSize;
55 |
56 | /** transformation matrix*/
57 | mat4f m_mTransformationMatrix;
58 |
59 | };
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Classes/GPUManager.h:
--------------------------------------------------------------------------------
1 | /* GPUManager.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #import
21 |
22 | #import
23 | #import
24 | #import
25 | #import
26 | #import "EAGLView.h"
27 | #import "Tutorial.h"
28 |
29 | @interface GPUManager : NSObject {
30 |
31 | EAGLView* _glview;
32 | GLuint _contextWidth;
33 | GLuint _contextHeight;
34 | EAGLContext *_context;
35 | Tutorial* _tutorial;
36 | }
37 |
38 | @property (nonatomic, retain) EAGLContext *context;
39 | @property GLuint contextWidth;
40 | @property GLuint contextHeight;
41 |
42 | - (id) init;
43 | - (void) AttachViewToContext:(UIView*) view;
44 | - (BOOL) CreateOpenGLESContext;
45 | - (void) TearOpenGLESContext;
46 | - (void)DrawFrame;
47 | -(void) receivedControl:(CControlPad&) pad;
48 | @end
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Classes/GPUManager.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * GPUManager.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "GPUManager.h"
11 | #import "CacheResourceManager.h"
12 | @implementation GPUManager
13 |
14 | @synthesize context = _context;
15 | @synthesize contextWidth = _contextWidth;
16 | @synthesize contextHeight = _contextHeight;
17 |
18 |
19 | CCacheResourceManager& crm_ = CCacheResourceManager::Instance();
20 |
21 | -(id) init
22 | {
23 | self = [super init];
24 |
25 | if(self)
26 | {
27 | _tutorial = new Tutorial();
28 | }
29 |
30 | return self;
31 | }
32 |
33 | - (BOOL) CreateOpenGLESContext
34 | {
35 | if (self.context != nil)
36 | return YES;
37 |
38 | EAGLContext * aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
39 |
40 | if (!aContext)
41 | {
42 | NSLog(@"Failed to create ES context");
43 | return FALSE;
44 | }
45 |
46 | else if (![EAGLContext setCurrentContext:aContext])
47 | {
48 | NSLog(@"Failed to set ES context current");
49 | return FALSE;
50 | }
51 |
52 | self.Context = aContext;
53 | [aContext release];
54 |
55 |
56 | return _tutorial->Deploy();
57 | }
58 |
59 | - (void) AttachViewToContext:(UIView*) view
60 | {
61 | if (view != nil)
62 | {
63 | _glview = (EAGLView*)view;
64 | [_glview setContext:self.context];
65 | [_glview setFramebuffer];
66 | self.contextWidth = [ _glview framebufferWidth ];
67 | self.contextHeight = [ _glview framebufferHeight ];
68 | }
69 | }
70 | - (void)dealloc
71 | {
72 | [self TearOpenGLESContext];
73 | self.context = nil;
74 | SAFE_DELETE(_tutorial);
75 | [super dealloc];
76 | }
77 | - (void) TearOpenGLESContext
78 | {
79 | // Tear down context.
80 | if ([EAGLContext currentContext] == self.context)
81 | [EAGLContext setCurrentContext:nil];
82 | }
83 |
84 | - (void)DrawFrame
85 | {
86 | if(self.context)
87 | {
88 | [EAGLContext setCurrentContext:self.context];
89 | [_glview setFramebuffer];
90 | }
91 |
92 | //draw frame
93 | _tutorial->Frame();
94 | [_glview presentFramebuffer];
95 |
96 |
97 | }
98 | -(void) receivedControl:(CControlPad&) pad
99 | {
100 | _tutorial->UpdateControls(pad);
101 | }
102 | @end
103 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Classes/vvisionAppDelegate.h:
--------------------------------------------------------------------------------
1 | /* vvisionAppDelegate.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import
10 |
11 | @class vvisionViewController;
12 |
13 | @interface vvisionAppDelegate : NSObject {
14 | UIWindow *_window;
15 | vvisionViewController *_viewController;
16 | }
17 |
18 | @property (nonatomic, retain) IBOutlet UIWindow *window;
19 | @property (nonatomic, retain) IBOutlet vvisionViewController *viewController;
20 |
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Classes/vvisionAppDelegate.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * vvisionAppDelegate.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "vvisionAppDelegate.h"
11 | #import "vvisionViewController.h"
12 |
13 | @implementation vvisionAppDelegate
14 |
15 | @synthesize window = _window;
16 | @synthesize viewController = _viewController;
17 |
18 | - (void)applicationWillResignActive:(UIApplication *)application
19 | {
20 | [self.viewController stopAnimation];
21 | }
22 |
23 | - (void)applicationDidBecomeActive:(UIApplication *)application
24 | {
25 | NSLog(@"app became active");
26 | [self.viewController startAnimation];
27 | }
28 |
29 | - (void)applicationWillTerminate:(UIApplication *)application
30 | {
31 | [self.viewController stopAnimation];
32 | }
33 |
34 | - (void)applicationDidEnterBackground:(UIApplication *)application
35 | {
36 | // Handle any background procedures not related to animation here.
37 | NSLog(@"app entered background");
38 | }
39 |
40 | - (void)applicationWillEnterForeground:(UIApplication *)application
41 | {
42 | // Handle any foreground procedures not related to animation here.
43 | }
44 |
45 | - (void)dealloc
46 | {
47 | self.viewController = nil;//this should invoke a release msg on the retained object ( if count = 0 dealloc is invoked)
48 | self.window = nil;
49 | [super dealloc];
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Classes/vvisionViewController.h:
--------------------------------------------------------------------------------
1 | /* vvisionViewController.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import "GPUManager.h"
10 |
11 | @interface vvisionViewController : UIViewController
12 | {
13 |
14 | GPUManager* _gpuManager;
15 |
16 | BOOL animating;
17 | NSInteger _animationFrameInterval;
18 | CADisplayLink *_displayLink;
19 | CControlPad _controlPad;
20 | }
21 |
22 | @property (nonatomic, assign) CADisplayLink *displayLink;
23 |
24 | - (void)startAnimation;
25 | - (void)stopAnimation;
26 |
27 | -(IBAction)buttonToutchDown:(id)butID;
28 | -(IBAction)buttonToutchUp:(id)butID;
29 | @end
30 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/Shaders/SkyBox.fsh:
--------------------------------------------------------------------------------
1 | //
2 | // SkyBox.fsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | precision mediump float;
10 | uniform samplerCube textureCubeMap;
11 | varying vec3 texCoord;
12 |
13 | void main()
14 | {
15 | gl_FragColor = vec4(textureCube(textureCubeMap, texCoord.xyz));
16 | }
17 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/Shaders/SkyBox.vsh:
--------------------------------------------------------------------------------
1 | //
2 | // SkyBox.vsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | attribute vec4 position;
10 | varying vec3 texCoord;
11 | uniform mat4 matProjViewModel;
12 |
13 | void main()
14 | {
15 | gl_Position = matProjViewModel * ( position );
16 | texCoord.xyz = position.xyz;
17 | }
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/Shaders/cubeMapping.fsh:
--------------------------------------------------------------------------------
1 | uniform samplerCube textureCubeMap;
2 | varying mediump vec3 v_reflectionVector;
3 |
4 | void main()
5 | {
6 | gl_FragColor = textureCube(textureCubeMap, v_reflectionVector);
7 | }
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/Shaders/cubeMapping.vsh:
--------------------------------------------------------------------------------
1 | //per vertex attributes
2 | attribute vec4 position;//vertex pos
3 | attribute vec3 normal;// vertex normal
4 |
5 | //shader uniforms
6 | uniform vec4 camPosModel;//camera position in the model space model
7 | uniform mat3 matModelToWorld;//rotation matrix of the model
8 | uniform mat4 matProjViewModel;
9 |
10 | //varying shader output variables
11 | varying vec3 v_reflectionVector;
12 |
13 | void main()
14 | {
15 | //get the eye direction vector in the model space
16 | vec4 eyeDir = normalize(position - camPosModel);
17 |
18 | //find the reflection vector between the eye direction and the vertex normal, multiply the reflection vector by the rotation matrix of the model ( transform to world space)
19 | v_reflectionVector = matModelToWorld * reflect(eyeDir.xyz, normal);
20 |
21 | //write final position
22 | gl_Position = matProjViewModel * position;
23 |
24 |
25 | }
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/icon.png
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/icons/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/icons/down.png
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/icons/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/icons/left.png
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/icons/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/icons/right.png
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/icons/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/icons/up.png
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/models/knot2880_nomap.3DS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/models/knot2880_nomap.3DS
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/models/teapot1024.3DS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/models/teapot1024.3DS
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_xn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_xn.jpg
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_xp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_xp.jpg
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_yn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_yn.jpg
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_yp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_yp.jpg
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_zn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_zn.jpg
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_zp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/Resources/skybox/cm_zp.jpg
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/main.m:
--------------------------------------------------------------------------------
1 | /*
2 | * main.m
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import
11 |
12 | int main(int argc, char *argv[]) {
13 |
14 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
15 | int retVal = UIApplicationMain(argc, argv, nil, nil);
16 | [pool release];
17 | return retVal;
18 | }
19 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/vvision-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | cubeMapping
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 | icon.png
13 | CFBundleIdentifier
14 | com.virtual-vision.skyBox
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | NSMainNibFile
30 | MainWindow
31 | UIStatusBarHidden
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/vvision.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/cubeMapping/cubeMapping/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | vvision.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 1D6058900D05DD3D006BFB54
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/cubeMapping/cubeMapping/vvision_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'vvision' target in the 'vvision' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/tutorials/engine/vvision/Math/vmath.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * vmath, set of classes for computer graphics mathemtics.
3 | * Copyright (c) 2005-2006, Jan Bartipan < barzto at gmail dot com >
4 | * All rights reserved.
5 | *
6 | * Redistribution and use in source and binary forms, with or without
7 | * modification, are permitted provided that the following conditions
8 | * are met:
9 | *
10 | * - Redistributions of source code must retain the above copyright
11 | * notice, this list of conditions and the following disclaimer.
12 | * - Redistributions in binary form must reproduce the above copyright
13 | * notice, this list of conditions and the following disclaimer in
14 | * the documentation and/or other materials provided with the
15 | * distribution.
16 | * - Neither the names of its contributors may be used to endorse or
17 | * promote products derived from this software without specific
18 | * prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY
30 | * WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | * POSSIBILITY OF SUCH DAMAGE.
32 | */
33 |
34 | #include "vmath.h"
35 |
36 | namespace vvision
37 | {
38 |
39 | template class vec2;
40 | template class vec2;
41 | template class vec2;
42 | template class vec3;
43 | template class vec3;
44 | template class vec3;
45 | template class vec4;
46 | template class vec4;
47 | template class vec4;
48 | template class mat3;
49 | template class mat3;
50 | template class mat3;
51 | template class mat4;
52 | template class mat4;
53 | template class mat4;
54 | template class quat;
55 | template class quat;
56 |
57 | }
58 |
--------------------------------------------------------------------------------
/tutorials/engine/vvision/MeshLoader/AssimpMesh.h:
--------------------------------------------------------------------------------
1 | /* AssimpMesh.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef ASSIMP_MESH_INCLUDED
21 | #define ASSIMP_MESH_INCLUDED
22 |
23 |
24 | #include "Mesh.h"
25 | #include "AssimpSceneAnimator.h"
26 |
27 |
28 | namespace vvision
29 | {
30 |
31 | class CAssimpMesh: public IMesh
32 | {
33 |
34 | public:
35 |
36 | /** constructor*/
37 | CAssimpMesh();
38 |
39 | /** destructor*/
40 | ~CAssimpMesh();
41 |
42 | /** clear/delete cached resources*/
43 | void DeleteCachedResources();
44 |
45 | /** get animator*/
46 | inline AssimpSceneAnimator* GetAnimator() {return m_pAnimator;}
47 | protected:
48 | /**load assimp mesh
49 | @retrun true if success
50 | */
51 | virtual bool LoadMesh(const std::string& FileName);
52 |
53 | private:
54 | /** not allowed*/
55 | CAssimpMesh(const CAssimpMesh&);
56 |
57 | /** not allowed*/
58 | CAssimpMesh& operator=(const CAssimpMesh& mesh);
59 |
60 | /** init mesh*/
61 | bool ExtractMeshGroup(uint32 Index, const aiMesh* paiMesh);
62 |
63 | /** init materials*/
64 | bool ExtractMaterials(const aiScene* pScene);
65 |
66 | aiScene* m_pAssimpScene;
67 |
68 | string m_sMeshName;
69 |
70 | /** assim mesh animator*/
71 | AssimpSceneAnimator *m_pAnimator;
72 |
73 | };
74 | }
75 | #endif
--------------------------------------------------------------------------------
/tutorials/engine/vvision/MeshLoader/Mesh.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * Mesh.cpp
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 |
11 | #include "Mesh.h"
12 | #include "AssimpMesh.h"
13 |
14 | namespace vvision
15 | {
16 | IMesh* IMesh::LoadMeshFromFile(const string& meshName)
17 | {
18 | IMesh* mesh = new CAssimpMesh();
19 |
20 | if(!mesh->LoadMesh(meshName))
21 | {
22 | delete mesh;
23 | return NULL;
24 | }
25 |
26 | return mesh;
27 | }
28 | }
--------------------------------------------------------------------------------
/tutorials/engine/vvision/MeshLoader/Mesh.h:
--------------------------------------------------------------------------------
1 | /* Mesh.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef VVISION_Mesh_h
21 | #define VVISION_Mesh_h
22 |
23 |
24 | #include "renderer.h"
25 |
26 | namespace vvision
27 | {
28 |
29 | class IMesh
30 | {
31 | public:
32 | /** constructor*/
33 | IMesh()
34 | {
35 | m_pMeshBuffer = new CMeshBuffer();
36 | }
37 |
38 | /** destructor*/
39 | virtual ~IMesh() {SAFE_DELETE(m_pMeshBuffer);}
40 |
41 | /** return the loaded mesh*/
42 | inline CMeshBuffer* GetMeshBuffer() {return m_pMeshBuffer;}
43 |
44 | /** clear/delete cached resources*/
45 | virtual void DeleteCachedResources() = 0;
46 |
47 | /** load mesh ( use this to load ur mesh)*/
48 | static IMesh* LoadMeshFromFile(const string& meshName);
49 | protected:
50 |
51 | /**load a mesh
52 | * @FileName name of the file to load
53 | * @retrun true if success
54 | */
55 | virtual bool LoadMesh(const std::string& FileName) = 0;
56 |
57 | CMeshBuffer* m_pMeshBuffer;
58 |
59 | private:
60 | /** not allowed*/
61 | IMesh(const IMesh&);
62 |
63 | /** not allowed*/
64 | IMesh& operator=(const IMesh& mesh);
65 |
66 | };
67 | }
68 | #endif
69 |
--------------------------------------------------------------------------------
/tutorials/engine/vvision/Renderer/MeshBuffer.cpp:
--------------------------------------------------------------------------------
1 | /*
2 | * MeshGroup.cpp
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #include "MeshBuffer.h"
11 | namespace vvision
12 | {
13 | CMeshGroup::~CMeshGroup()
14 | {
15 | m_vVertices.clear();
16 | m_vIndices.clear();
17 | m_iMaterialIndex = -1;
18 | m_cVboVertices.Destroy();
19 | m_cVboIndices.Destroy();
20 | }
21 |
22 | CMeshBuffer::~CMeshBuffer()
23 | {
24 | for (int32 i=0; i maxSize || height > maxSize )
35 | {
36 | std::cerr << "Renderbuffer::SetParameters() ERROR:\n\t"
37 | << "Size too big (" << width << ", " << height << ")\n";
38 |
39 | return false;
40 | }
41 | _GuardedBind();
42 | // Allocate memory for renderBuffer
43 | glRenderbufferStorage(GL_RENDERBUFFER, internalFormat, width, height );
44 | _GuardedUnbind();
45 |
46 | return true;
47 |
48 | }
49 | bool CRenderBuffer::_GuardedBind()
50 | {
51 | // Only binds if m_render buffer id is different than the currently bound to render buffer
52 | glGetIntegerv( GL_RENDERBUFFER_BINDING, &m_iSaveID );
53 | if (m_uID != (GLuint)m_iSaveID) {
54 | Bind();
55 | return true;
56 | } else return false;
57 | }
58 |
59 | bool CRenderBuffer::_GuardedUnbind()
60 | {
61 |
62 | if (m_uID != (GLuint)m_iSaveID) {
63 | glBindRenderbuffer(GL_RENDERBUFFER, (GLuint)m_iSaveID);
64 | return true;
65 | } return false;
66 | }
67 | int32 CRenderBuffer::GetMaximumSize()
68 | {
69 | GLint maxAttach = 0;
70 | glGetIntegerv( GL_MAX_RENDERBUFFER_SIZE, &maxAttach );
71 | return maxAttach;
72 | }
73 | GLuint CRenderBuffer::GenerateId()
74 | {
75 | GLuint id = 0;
76 | glGenRenderbuffers(1, &id);
77 | return id;
78 | }
79 | }
80 |
81 |
--------------------------------------------------------------------------------
/tutorials/engine/vvision/Renderer/RenderBuffer.h:
--------------------------------------------------------------------------------
1 | /* RenderBuffer.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef GL_REDNER_BUFFER_INCLUDED
21 | #define GL_REDNER_BUFFER_INCLUDED
22 |
23 | #include "types.h"
24 |
25 | namespace vvision
26 | {
27 | class CRenderBuffer
28 | {
29 |
30 | public :
31 |
32 | /** constructor*/
33 | CRenderBuffer();
34 |
35 | /** destructor*/
36 | ~CRenderBuffer();
37 |
38 | /** bind and activate render buffer*/
39 | void Bind();
40 |
41 | /** unbind and desactivate render buffer*/
42 | void UnBind();
43 |
44 | /** set render buffer format, widht and height
45 | * return true if success
46 | */
47 | bool SetParameters(GLenum InternalFormat,int32 width,int32 height);
48 |
49 | /** get gpu buffer ID*/
50 | inline uint32 GetID() { return m_uID;}
51 |
52 | /** static function to determine the maximum available size for the current opengl implementation*/
53 | static int32 GetMaximumSize();
54 |
55 | private :
56 | /** not allowed*/
57 | CRenderBuffer(const CRenderBuffer& sm);
58 | CRenderBuffer& operator=(const CRenderBuffer& sm);
59 |
60 | /** generate GL id for the buffe*/
61 | GLuint GenerateId();
62 |
63 | /** guarded bind/unding to avoid unecessary call to opengl API*/
64 | bool _GuardedBind();
65 | bool _GuardedUnbind();
66 |
67 | /**the buffer gpu ID*/
68 | GLuint m_uID;
69 |
70 | /**used for the guarded bind*/
71 | GLint m_iSaveID;
72 |
73 | };
74 | }
75 | #endif
76 |
77 |
--------------------------------------------------------------------------------
/tutorials/engine/vvision/Renderer/renderer.h:
--------------------------------------------------------------------------------
1 | /* renderer.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef VVISION_renderer_h
21 | #define VVISION_renderer_h
22 |
23 | #include "FrameBufferObject.h"
24 | #include "Material.h"
25 | #include "MeshBuffer.h"
26 | #include "Shader.h"
27 | #include "Texture.h"
28 | #include "TextureCubeMap.h"
29 | #include "VertexBuffer.h"
30 | #include "types.h"
31 | #include "RenderBuffer.h"
32 | #include "OffscreenRenderTarget.h"
33 |
34 | using namespace vvision;
35 |
36 | #endif
37 |
--------------------------------------------------------------------------------
/tutorials/engine/vvision/Utils/FilePath.h:
--------------------------------------------------------------------------------
1 | /* FilePath.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef FILE_PATH_INCLUDED
21 | #define FILE_PATH_INCLUDED
22 |
23 | #include "types.h"
24 |
25 | namespace vvision
26 | {
27 |
28 | /** Get the full path of a file in the filesystem.
29 | * @param filename the name of the file
30 | * @return the path to the given file
31 | */
32 | string getPath(const char8 *filename);
33 | string getPath(const string& filename);
34 |
35 | /** Reads every byte from the file specified by a given path.
36 | * @param filepath the path obtained from getPath, check getPath
37 | * @return the files content, u should delete the path from outside
38 | */
39 | string getContentFromPath(const char8 *filepath);
40 | string getContentFromPath(const string& filepath);
41 |
42 | /**
43 | * load a png/jpg image
44 | * @param filename the image file name, this function calls getPath implicitly ..
45 | * @param widht/height the image width and height
46 | * @return the data pointer to the image. dont forget to free memory by calling free.
47 | */
48 | char8* LoadImage(const char8* filename, int32 *width, int32 *height);
49 | char8* LoadImage(const string& filename, int32 *width, int32 *height);
50 | }
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/tutorials/engine/vvision/Utils/Utils.h:
--------------------------------------------------------------------------------
1 | //
2 | // Utils.h
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 21/09/12.
6 | // Copyright (c) 2012 virtual vision. All rights reserved.
7 | //
8 |
9 | #ifndef VVISION_Utils_h
10 | #define VVISION_Utils_h
11 |
12 | #include "Singleton.h"
13 | #include "FilePath.h"
14 |
15 |
16 | #endif
17 |
--------------------------------------------------------------------------------
/tutorials/engine/vvision/ext/assimp/include/Compiler/poppack1.h:
--------------------------------------------------------------------------------
1 |
2 | // ===============================================================================
3 | // May be included multiple times - resets structure packing to the defaults
4 | // for all supported compilers. Reverts the changes made by #include
5 | //
6 | // Currently this works on the following compilers:
7 | // MSVC 7,8,9
8 | // GCC
9 | // BORLAND (complains about 'pack state changed but not reverted', but works)
10 | // ===============================================================================
11 |
12 | #ifndef AI_PUSHPACK_IS_DEFINED
13 | # error pushpack1.h must be included after poppack1.h
14 | #endif
15 |
16 | // reset packing to the original value
17 | #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
18 | # pragma pack( pop )
19 | #endif
20 | #undef PACK_STRUCT
21 |
22 | #undef AI_PUSHPACK_IS_DEFINED
23 |
--------------------------------------------------------------------------------
/tutorials/engine/vvision/ext/assimp/include/Compiler/pushpack1.h:
--------------------------------------------------------------------------------
1 |
2 |
3 | // ===============================================================================
4 | // May be included multiple times - sets structure packing to 1
5 | // for all supported compilers. #include reverts the changes.
6 | //
7 | // Currently this works on the following compilers:
8 | // MSVC 7,8,9
9 | // GCC
10 | // BORLAND (complains about 'pack state changed but not reverted', but works)
11 | //
12 | //
13 | // USAGE:
14 | //
15 | // struct StructToBePacked {
16 | // } PACK_STRUCT;
17 | //
18 | // ===============================================================================
19 |
20 | #ifdef AI_PUSHPACK_IS_DEFINED
21 | # error poppack1.h must be included after pushpack1.h
22 | #endif
23 |
24 | #if defined(_MSC_VER) || defined(__BORLANDC__) || defined (__BCPLUSPLUS__)
25 | # pragma pack(push,1)
26 | # define PACK_STRUCT
27 | #elif defined( __GNUC__ )
28 | # define PACK_STRUCT __attribute__((packed))
29 | #else
30 | # error Compiler not supported
31 | #endif
32 |
33 | #if defined(_MSC_VER)
34 |
35 | // C4103: Packing was changed after the inclusion of the header, propably missing #pragma pop
36 | # pragma warning (disable : 4103)
37 | #endif
38 |
39 | #define AI_PUSHPACK_IS_DEFINED
40 |
41 |
42 |
--------------------------------------------------------------------------------
/tutorials/engine/vvision/ext/assimp/include/aiAssert.h:
--------------------------------------------------------------------------------
1 | /** @file aiAssert.h
2 | */
3 | #ifndef AI_DEBUG_H_INC
4 | #define AI_DEBUG_H_INC
5 |
6 | #ifdef _DEBUG
7 | # include
8 | # define ai_assert(expression) assert(expression)
9 | #else
10 | # define ai_assert(expression)
11 | #endif
12 |
13 |
14 | #endif
15 |
--------------------------------------------------------------------------------
/tutorials/engine/vvision/ext/assimp/include/aiDefines.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/engine/vvision/ext/assimp/include/aiDefines.h
--------------------------------------------------------------------------------
/tutorials/engine/vvision/ext/assimp/include/aiMatrix3x3.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/engine/vvision/ext/assimp/include/aiMatrix3x3.h
--------------------------------------------------------------------------------
/tutorials/engine/vvision/ext/assimp/include/aiMatrix3x3.inl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/engine/vvision/ext/assimp/include/aiMatrix3x3.inl
--------------------------------------------------------------------------------
/tutorials/engine/vvision/ext/assimp/include/aiMatrix4x4.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/engine/vvision/ext/assimp/include/aiMatrix4x4.h
--------------------------------------------------------------------------------
/tutorials/engine/vvision/ext/assimp/include/aiMatrix4x4.inl:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/engine/vvision/ext/assimp/include/aiMatrix4x4.inl
--------------------------------------------------------------------------------
/tutorials/engine/vvision/ext/assimp/include/aiPostProcess.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/engine/vvision/ext/assimp/include/aiPostProcess.h
--------------------------------------------------------------------------------
/tutorials/engine/vvision/ext/assimp/lib/ReleaseArmv7/libassimp.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/engine/vvision/ext/assimp/lib/ReleaseArmv7/libassimp.a
--------------------------------------------------------------------------------
/tutorials/engine/vvision/ext/assimp/lib/ReleaseI386/libassimpi386.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/engine/vvision/ext/assimp/lib/ReleaseI386/libassimpi386.a
--------------------------------------------------------------------------------
/tutorials/engine/vvision/vvision.h:
--------------------------------------------------------------------------------
1 | /* renderer.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU Lesser General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU Lesser General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU Lesser General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef VVISION_vvision_h
21 | #define VVISION_vvision_h
22 |
23 | #include "renderer.h"
24 | #include "vmath.h"
25 | #include "BoundingBox.h"
26 | #include "Mesh.h"
27 | #include "AssimpMesh.h"
28 | #include "CacheResourceManager.h"
29 |
30 | using namespace vvision;
31 | using namespace std;
32 |
33 | #endif
34 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Classes/Core/Tutorial.h:
--------------------------------------------------------------------------------
1 | /* Tutorial.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef vvision_Tutorial_h
21 | #define vvision_Tutorial_h
22 |
23 | #include "vvision.h"
24 | #include "CameraEntity.h"
25 | #include "AnimatedMeshEntity.h"
26 |
27 |
28 | class Tutorial
29 | {
30 | public:
31 |
32 | /** constructor*/
33 | Tutorial();
34 |
35 | /** destructor*/
36 | ~Tutorial();
37 |
38 | /** deploy tutorial content*/
39 | bool Deploy();
40 |
41 | /**display frame*/
42 | void Frame();
43 |
44 | /** set the screen size screen width and height ( this can be retreived from glGetViewPort.)
45 | this value is calculated once when the main frame buffer is created, at this time we can upate the window size in order to avoid calling glGetViewPort multiple times.
46 | */
47 | void SetWindowSize(float32 width, float32 height);
48 | private:
49 |
50 | /** cleanup*/
51 | void Cleanup();
52 |
53 | /** load shaders*/
54 | bool LoadShaders();
55 |
56 | /** load entities*/
57 | bool LoadEntities();
58 |
59 | /**render the scene from different position*/
60 | void RenderFromPosition(const mat4f& view, const mat4f& projection);
61 |
62 | /** shaders*/
63 | CShader *m_pShaderAnimatedMesh;
64 |
65 | /** m_pCamera entity*/
66 | CCameraEntity* m_pCamera;
67 |
68 | /** animated mesh entity*/
69 | CAnimatedMeshEntity* m_pAnimatedMesh;
70 |
71 | /** time*/
72 | float32 time;
73 |
74 |
75 | };
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Classes/Core/entities/AnimatedMeshEntity.h:
--------------------------------------------------------------------------------
1 | /* AnimatedMeshEntity.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 |
21 | #ifndef VVISION_AnimatedMeshEntity_h
22 | #define VVISION_AnimatedMeshEntity_h
23 |
24 | #include "vvision.h"
25 | #include "AssimpMesh.h"
26 |
27 | class CAnimatedMeshEntity
28 | {
29 | public:
30 |
31 | /** constructor*/
32 | CAnimatedMeshEntity(CAssimpMesh* mesh);
33 |
34 | /** destructor*/
35 | ~CAnimatedMeshEntity();
36 |
37 | /** update mesh*/
38 | virtual void Update(float32 dt);
39 |
40 | /** render*/
41 | virtual void Render(CShader* shader, const mat4f &view, const mat4f &projection);
42 |
43 | /** returns a reference to the transformation matrix of the model*/
44 | inline mat4f& GetTransfromationMatrix() {return m_mTransformationMatrix;}
45 |
46 | private:
47 | /** render mesh recursivly */
48 | void RenderNode(aiNode* piNode);
49 |
50 | /**the mesh*/
51 | CAssimpMesh* m_pMesh;
52 |
53 | /** animator ( calculate bone matrices) */
54 | AssimpSceneAnimator* m_pAnimator;
55 |
56 | /** global transformation matrix of the model*/
57 | mat4f m_mTransformationMatrix;
58 |
59 | /** shader for gpu skinning*/
60 | CShader* m_pShader;
61 |
62 | /** cache projeciton * view * matrix */
63 | mat4f m_mProjViewModelMatrix;
64 | };
65 |
66 | #endif
67 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Classes/GPUManager.h:
--------------------------------------------------------------------------------
1 | /* GPUManager.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #import
21 |
22 | #import
23 | #import
24 | #import
25 | #import
26 | #import "EAGLView.h"
27 | #import "Tutorial.h"
28 |
29 | @interface GPUManager : NSObject {
30 |
31 | EAGLView* _glview;
32 | GLuint _contextWidth;
33 | GLuint _contextHeight;
34 | EAGLContext *_context;
35 | Tutorial* _tutorial;
36 | }
37 |
38 | @property (nonatomic, retain) EAGLContext *context;
39 | @property GLuint contextWidth;
40 | @property GLuint contextHeight;
41 |
42 | - (id) init;
43 | - (void) AttachViewToContext:(UIView*) view;
44 | - (BOOL) CreateOpenGLESContext;
45 | - (void) TearOpenGLESContext;
46 | - (void)DrawFrame;
47 | @end
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Classes/GPUManager.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * GPUManager.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "GPUManager.h"
11 | #import "CacheResourceManager.h"
12 | @implementation GPUManager
13 |
14 | @synthesize context = _context;
15 | @synthesize contextWidth = _contextWidth;
16 | @synthesize contextHeight = _contextHeight;
17 |
18 |
19 | CCacheResourceManager& crm_ = CCacheResourceManager::Instance();
20 |
21 | -(id) init
22 | {
23 | self = [super init];
24 |
25 | if(self)
26 | {
27 | _tutorial = new Tutorial();
28 | }
29 |
30 | return self;
31 | }
32 |
33 | - (BOOL) CreateOpenGLESContext
34 | {
35 | if (self.context != nil)
36 | return YES;
37 |
38 | EAGLContext * aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
39 |
40 | if (!aContext)
41 | {
42 | NSLog(@"Failed to create ES context");
43 | return FALSE;
44 | }
45 |
46 | else if (![EAGLContext setCurrentContext:aContext])
47 | {
48 | NSLog(@"Failed to set ES context current");
49 | return FALSE;
50 | }
51 |
52 | self.Context = aContext;
53 | [aContext release];
54 |
55 | return _tutorial->Deploy();
56 | }
57 |
58 | - (void) AttachViewToContext:(UIView*) view
59 | {
60 | if (view != nil)
61 | {
62 | _glview = (EAGLView*)view;
63 | [_glview setContext:self.context];
64 | [_glview setFramebuffer];
65 | self.contextWidth = [ _glview framebufferWidth ];
66 | self.contextHeight = [ _glview framebufferHeight ];
67 | }
68 | }
69 | - (void)dealloc
70 | {
71 | [self TearOpenGLESContext];
72 | self.context = nil;
73 | SAFE_DELETE(_tutorial);
74 | [super dealloc];
75 | }
76 | - (void) TearOpenGLESContext
77 | {
78 | // Tear down context.
79 | if ([EAGLContext currentContext] == self.context)
80 | [EAGLContext setCurrentContext:nil];
81 | }
82 |
83 | - (void)DrawFrame
84 | {
85 | if(self.context)
86 | {
87 | [EAGLContext setCurrentContext:self.context];
88 | [_glview setFramebuffer];
89 | }
90 |
91 | //draw frame
92 | _tutorial->Frame();
93 | [_glview presentFramebuffer];
94 | }
95 | @end
96 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Classes/vvisionAppDelegate.h:
--------------------------------------------------------------------------------
1 | /* vvisionAppDelegate.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import
10 |
11 | @class vvisionViewController;
12 |
13 | @interface vvisionAppDelegate : NSObject {
14 | UIWindow *_window;
15 | vvisionViewController *_viewController;
16 | }
17 |
18 | @property (nonatomic, retain) IBOutlet UIWindow *window;
19 | @property (nonatomic, retain) IBOutlet vvisionViewController *viewController;
20 |
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Classes/vvisionAppDelegate.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * vvisionAppDelegate.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "vvisionAppDelegate.h"
11 | #import "vvisionViewController.h"
12 |
13 | @implementation vvisionAppDelegate
14 |
15 | @synthesize window = _window;
16 | @synthesize viewController = _viewController;
17 |
18 | - (void)applicationWillResignActive:(UIApplication *)application
19 | {
20 | [self.viewController stopAnimation];
21 | }
22 |
23 | - (void)applicationDidBecomeActive:(UIApplication *)application
24 | {
25 | NSLog(@"app became active");
26 | [self.viewController startAnimation];
27 | }
28 |
29 | - (void)applicationWillTerminate:(UIApplication *)application
30 | {
31 | [self.viewController stopAnimation];
32 | }
33 |
34 | - (void)applicationDidEnterBackground:(UIApplication *)application
35 | {
36 | // Handle any background procedures not related to animation here.
37 | NSLog(@"app entered background");
38 | }
39 |
40 | - (void)applicationWillEnterForeground:(UIApplication *)application
41 | {
42 | // Handle any foreground procedures not related to animation here.
43 | }
44 |
45 | - (void)dealloc
46 | {
47 | self.viewController = nil;//this should invoke a release msg on the retained object ( if count = 0 dealloc is invoked)
48 | self.window = nil;
49 | [super dealloc];
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Classes/vvisionViewController.h:
--------------------------------------------------------------------------------
1 | /* vvisionViewController.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import "GPUManager.h"
10 |
11 | @interface vvisionViewController : UIViewController
12 | {
13 |
14 | GPUManager* _gpuManager;
15 |
16 | BOOL animating;
17 | NSInteger _animationFrameInterval;
18 | CADisplayLink *_displayLink;
19 | }
20 |
21 | @property (nonatomic, assign) CADisplayLink *displayLink;
22 |
23 | - (void)startAnimation;
24 | - (void)stopAnimation;
25 |
26 | @end
27 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/gpuSkinning/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Resources/Shaders/GpuSkinnig.fsh:
--------------------------------------------------------------------------------
1 | //
2 | // GpuSkinnig.fsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | precision highp float;
10 | uniform sampler2D texture0;
11 | varying vec2 v_texCoord;
12 |
13 | void main()
14 | {
15 | gl_FragColor = texture2D( texture0, v_texCoord);
16 | }
17 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Resources/Shaders/GpuSkinnig.vsh:
--------------------------------------------------------------------------------
1 | //
2 | // GpuSkinnig.vsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 |
10 | varying vec2 v_texCoord;
11 |
12 | attribute vec4 position;
13 | attribute vec2 texCoord0;
14 | //influenced bones with their corresponding weight
15 | attribute vec4 bones;
16 | attribute vec4 weights;
17 |
18 | uniform mat4 matProjViewModel;
19 | //bones transformation at a given time
20 | #define JOINT_COUNT 60
21 | uniform mat4 skinningMatrix[JOINT_COUNT];
22 |
23 | void main()
24 | {
25 | v_texCoord = texCoord0;
26 |
27 | //each vertex position is affected by certain number of bones,
28 | //vertex attributes holds the index of influenced bone and the corresponding weight.
29 | //for eg: a vertex 'vert' is influenced by 'bone0' with 'weight0' and 'bone1' with 'weight1'.
30 | //the final position of 'vert' is:
31 | //vert.finalpos = weight0 * (bone0.matrix * vert.pos) + weight1 * (bone1.matrix * vert.pos);
32 |
33 | //here we suppose that a vertex is affected by four bones, for optimization we can reduce this to two if we have animated models with maximum bones per vertex equal to two.
34 | vec4 p0 = skinningMatrix[ int(bones.x) ] * position;
35 | vec4 p1 = skinningMatrix[ int(bones.y) ] * position;
36 | vec4 p2 = skinningMatrix[ int(bones.z) ] * position;
37 | vec4 p3 = skinningMatrix[ int(bones.w) ] * position;
38 |
39 | //blend position
40 | vec4 interpolatedPosition = p0 * weights.x + p1 * weights.y + p2 * weights.z + p3 * weights.w;
41 |
42 | //write final position
43 | gl_Position = matProjViewModel * interpolatedPosition;
44 |
45 | }
46 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Resources/dwarf/axe.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/gpuSkinning/Resources/dwarf/axe.jpg
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Resources/dwarf/dwarf.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/gpuSkinning/Resources/dwarf/dwarf.jpg
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Resources/dwarf/dwarf2.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/gpuSkinning/Resources/dwarf/dwarf2.jpg
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/gpuSkinning/Resources/icon.png
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/main.m:
--------------------------------------------------------------------------------
1 | /*
2 | * main.m
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import
11 |
12 | int main(int argc, char *argv[]) {
13 |
14 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
15 | int retVal = UIApplicationMain(argc, argv, nil, nil);
16 | [pool release];
17 | return retVal;
18 | }
19 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/vvision-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 | icon.png
13 | CFBundleIdentifier
14 | com.virtual-vision.tutorials
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | NSMainNibFile
30 | MainWindow
31 | UIStatusBarHidden
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/vvision.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/gpuSkinning/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
18 |
19 |
31 |
32 |
44 |
45 |
57 |
58 |
59 |
60 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | vvision.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 1D6058900D05DD3D006BFB54
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/gpuSkinning/vvision_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'vvision' target in the 'vvision' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Classes/Core/entities/MeshEntity.h:
--------------------------------------------------------------------------------
1 | /* MeshEntity.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef VVISION_MeshEntity_h
21 | #define VVISION_MeshEntity_h
22 |
23 | #include "vvision.h"
24 |
25 | class CMeshEntity
26 | {
27 | public:
28 |
29 | /** constructor*/
30 | CMeshEntity(IMesh* mesh);
31 |
32 | /** destructor*/
33 | ~CMeshEntity();
34 |
35 | /** update mesh*/
36 | virtual void Update(float32 dt);
37 |
38 | /** render*/
39 | virtual void Render(CShader* shader, const mat4f &view, const mat4f &projection);
40 |
41 | /**reference to transformation matrix*/
42 | mat4f& GetTransfromationMatrix() {return m_mTransformationMatrix;}
43 |
44 | /** reference to the mesh buffer*/
45 | CMeshBuffer& GetMeshBuffer() {return *m_pMesh->GetMeshBuffer();}
46 |
47 | private:
48 | IMesh* m_pMesh;
49 |
50 | mat4f m_mTransformationMatrix;
51 | };
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Classes/GPUManager.h:
--------------------------------------------------------------------------------
1 | /* GPUManager.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #import
21 |
22 | #import
23 | #import
24 | #import
25 | #import
26 | #import "EAGLView.h"
27 | #import "Tutorial.h"
28 |
29 | @interface GPUManager : NSObject {
30 |
31 | EAGLView* _glview;
32 | GLuint _contextWidth;
33 | GLuint _contextHeight;
34 | EAGLContext *_context;
35 | Tutorial* _tutorial;
36 | }
37 |
38 | @property (nonatomic, retain) EAGLContext *context;
39 | @property GLuint contextWidth;
40 | @property GLuint contextHeight;
41 |
42 | - (id) init;
43 | - (void) AttachViewToContext:(UIView*) view;
44 | - (BOOL) CreateOpenGLESContext;
45 | - (void) TearOpenGLESContext;
46 | - (void)DrawFrame;
47 | -(void) receivedControl:(CControlPad&) pad;
48 | @end
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Classes/vvisionAppDelegate.h:
--------------------------------------------------------------------------------
1 | /* vvisionAppDelegate.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import
10 |
11 | @class vvisionViewController;
12 |
13 | @interface vvisionAppDelegate : NSObject {
14 | UIWindow *_window;
15 | vvisionViewController *_viewController;
16 | }
17 |
18 | @property (nonatomic, retain) IBOutlet UIWindow *window;
19 | @property (nonatomic, retain) IBOutlet vvisionViewController *viewController;
20 |
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Classes/vvisionAppDelegate.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * vvisionAppDelegate.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "vvisionAppDelegate.h"
11 | #import "vvisionViewController.h"
12 |
13 | @implementation vvisionAppDelegate
14 |
15 | @synthesize window = _window;
16 | @synthesize viewController = _viewController;
17 |
18 | - (void)applicationWillResignActive:(UIApplication *)application
19 | {
20 | [self.viewController stopAnimation];
21 | }
22 |
23 | - (void)applicationDidBecomeActive:(UIApplication *)application
24 | {
25 | NSLog(@"app became active");
26 | [self.viewController startAnimation];
27 | }
28 |
29 | - (void)applicationWillTerminate:(UIApplication *)application
30 | {
31 | [self.viewController stopAnimation];
32 | }
33 |
34 | - (void)applicationDidEnterBackground:(UIApplication *)application
35 | {
36 | // Handle any background procedures not related to animation here.
37 | NSLog(@"app entered background");
38 | }
39 |
40 | - (void)applicationWillEnterForeground:(UIApplication *)application
41 | {
42 | // Handle any foreground procedures not related to animation here.
43 | }
44 |
45 | - (void)dealloc
46 | {
47 | self.viewController = nil;//this should invoke a release msg on the retained object ( if count = 0 dealloc is invoked)
48 | self.window = nil;
49 | [super dealloc];
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Classes/vvisionViewController.h:
--------------------------------------------------------------------------------
1 | /* vvisionViewController.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import "GPUManager.h"
10 |
11 | @interface vvisionViewController : UIViewController
12 | {
13 |
14 | GPUManager* _gpuManager;
15 |
16 | BOOL animating;
17 | NSInteger _animationFrameInterval;
18 | CADisplayLink *_displayLink;
19 | CControlPad _controlPad;
20 | }
21 |
22 | @property (nonatomic, assign) CADisplayLink *displayLink;
23 |
24 | - (void)startAnimation;
25 | - (void)stopAnimation;
26 |
27 | -(IBAction)buttonToutchDown:(id)butID;
28 | -(IBAction)buttonToutchUp:(id)butID;
29 | @end
30 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/Shaders/SkyBox.fsh:
--------------------------------------------------------------------------------
1 | //
2 | // SkyBox.fsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | //varying lowp vec4 colorVarying;
10 |
11 |
12 | precision mediump float;
13 | uniform samplerCube textureCubeMap;
14 | varying vec3 texCoord;
15 |
16 | void main()
17 | {
18 | gl_FragColor = vec4(textureCube(textureCubeMap, texCoord.xyz));
19 | }
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/Shaders/SkyBox.vsh:
--------------------------------------------------------------------------------
1 | //
2 | // SkyBox.vsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | attribute vec4 position;
10 | varying vec3 texCoord;
11 | uniform mat4 matProjViewModel;
12 |
13 | void main()
14 | {
15 | gl_Position = matProjViewModel * ( position );
16 | texCoord.xyz = position.xyz;
17 | }
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/Shaders/Terrain.fsh:
--------------------------------------------------------------------------------
1 | //
2 | // NoLighting.fsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 |
10 | precision highp float;
11 |
12 | uniform sampler2D texture0;
13 | uniform sampler2D textureDetail;
14 | uniform float detailFactor;
15 |
16 | varying vec2 v_texCoord;
17 |
18 |
19 |
20 | void main()
21 | {
22 | vec4 finalColor;
23 | vec4 color = texture2D( texture0, v_texCoord);
24 | vec2 fetch = v_texCoord.st * detailFactor;
25 | vec4 detail = texture2D(textureDetail, fetch);
26 | finalColor = color * detail ;
27 |
28 | //hard coded per pixel fog, its very expensive in a real time application to to perform exponential fog per pixel,
29 | //instead, calculate fog factor per vertex and write result to a varying variable .
30 | float z = gl_FragCoord.z / gl_FragCoord.w;
31 | vec4 fogColor = vec4(0.8, 0.8, 0.8, 1.0);
32 | float fogFactor = exp( -0.003 * z );
33 | fogFactor = clamp(fogFactor, 0.0, 1.0);
34 |
35 | //write final color
36 | gl_FragColor = mix(fogColor,finalColor,fogFactor);
37 |
38 | }
39 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/Shaders/Terrain.vsh:
--------------------------------------------------------------------------------
1 | //
2 | // NoLighting.vsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | attribute vec4 position;
10 | attribute vec2 texCoord0;
11 |
12 | varying vec2 v_texCoord;
13 |
14 | uniform mat4 matModel;
15 | uniform mat4 matProjViewModel;
16 |
17 | void main()
18 | {
19 | v_texCoord = texCoord0;
20 | gl_Position = matProjViewModel * position;
21 | }
22 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/Terrain/detail.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/Terrain/detail.jpg
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/Terrain/grass.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/Terrain/grass.jpg
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/Terrain/grassYellow.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/Terrain/grassYellow.jpg
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/Terrain/terrain2.ms3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/Terrain/terrain2.ms3d
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/icon.png
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/icons/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/icons/down.png
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/icons/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/icons/left.png
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/icons/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/icons/right.png
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/icons/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/icons/up.png
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_xn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_xn.jpg
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_xp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_xp.jpg
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_yn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_yn.jpg
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_yp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_yp.jpg
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_zn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_zn.jpg
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_zp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/Resources/skybox/sky_zp.jpg
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/main.m:
--------------------------------------------------------------------------------
1 | /*
2 | * main.m
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import
11 |
12 | int main(int argc, char *argv[]) {
13 |
14 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
15 | int retVal = UIApplicationMain(argc, argv, nil, nil);
16 | [pool release];
17 | return retVal;
18 | }
19 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/vvision-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | quatCamera
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 | icon.png
13 | CFBundleIdentifier
14 | com.virtual-vision.quatCamera
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | NSMainNibFile
30 | MainWindow
31 | UIStatusBarHidden
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/vvision.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/quaternionCamera/quaternionCamera/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | vvision.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 1D6058900D05DD3D006BFB54
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/quaternionCamera/quaternionCamera/vvision_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'vvision' target in the 'vvision' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Classes/Core/entities/MeshEntity.h:
--------------------------------------------------------------------------------
1 | /* MeshEntity.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef VVISION_MeshEntity_h
21 | #define VVISION_MeshEntity_h
22 |
23 | #include "vvision.h"
24 |
25 | class CMeshEntity
26 | {
27 | public:
28 |
29 | /** constructor*/
30 | CMeshEntity(IMesh* mesh);
31 |
32 | /** destructor*/
33 | ~CMeshEntity();
34 |
35 | /** update mesh*/
36 | virtual void Update(float32 dt);
37 |
38 | /** render*/
39 | virtual void Render(CShader* shader, const mat4f &view, const mat4f &projection);
40 |
41 | /**reference to transformation matrix*/
42 | mat4f& GetTransfromationMatrix() {return m_mTransformationMatrix;}
43 |
44 | /** reference to the mesh buffer*/
45 | CMeshBuffer& GetMeshBuffer() {return *m_pMesh->GetMeshBuffer();}
46 |
47 | private:
48 | IMesh* m_pMesh;
49 |
50 | mat4f m_mTransformationMatrix;
51 | };
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Classes/Core/entities/SkyBoxEntity.h:
--------------------------------------------------------------------------------
1 | /* SkyBoxEntity.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef SKY_BOX_ENTITY_INCLUDED
21 | #define SKY_BOX_ENTITY_INCLUDED
22 |
23 | #include "vvision.h"
24 |
25 | class CSkyBoxEntity
26 | {
27 | public :
28 |
29 | /** constructor
30 | * @param size the size of the sky box
31 | */
32 | CSkyBoxEntity( float32 size, const vec3f& position = vec3f());
33 |
34 | /** destructor*/
35 | ~CSkyBoxEntity();
36 |
37 |
38 | /** create skybox from a texture_base_name and size
39 | * @param texture_cubeMap the cube map texture used for the skybox
40 | * @return true if success
41 | */
42 | bool Create(CTextureCubeMap* texture_cubeMap);
43 |
44 | /** @inherited from Entity*/
45 | virtual void Render(CShader* shader, const mat4f &view, const mat4f &projection);
46 |
47 |
48 | private:
49 |
50 | /** the mesh buffer*/
51 | CMeshBuffer *m_pMeshBuffer;
52 |
53 | /** size of the skybox*/
54 | float32 m_fSize;
55 |
56 | /** transformation matrix*/
57 | mat4f m_mTransformationMatrix;
58 |
59 | };
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Classes/GPUManager.h:
--------------------------------------------------------------------------------
1 | /* GPUManager.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #import
21 |
22 | #import
23 | #import
24 | #import
25 | #import
26 | #import "EAGLView.h"
27 | #import "Tutorial.h"
28 |
29 | @interface GPUManager : NSObject {
30 |
31 | EAGLView* _glview;
32 | GLuint _contextWidth;
33 | GLuint _contextHeight;
34 | EAGLContext *_context;
35 | Tutorial* _tutorial;
36 | }
37 |
38 | @property (nonatomic, retain) EAGLContext *context;
39 | @property GLuint contextWidth;
40 | @property GLuint contextHeight;
41 |
42 | - (id) init;
43 | - (void) AttachViewToContext:(UIView*) view;
44 | - (BOOL) CreateOpenGLESContext;
45 | - (void) TearOpenGLESContext;
46 | - (void)DrawFrame;
47 | -(void) receivedControl:(CControlPad&) pad;
48 | @end
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Classes/GPUManager.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * GPUManager.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "GPUManager.h"
11 | #import "CacheResourceManager.h"
12 | @implementation GPUManager
13 |
14 | @synthesize context = _context;
15 | @synthesize contextWidth = _contextWidth;
16 | @synthesize contextHeight = _contextHeight;
17 |
18 |
19 | CCacheResourceManager& crm_ = CCacheResourceManager::Instance();
20 |
21 | -(id) init
22 | {
23 | self = [super init];
24 |
25 | if(self)
26 | {
27 | _tutorial = new Tutorial();
28 | }
29 |
30 | return self;
31 | }
32 |
33 | - (BOOL) CreateOpenGLESContext
34 | {
35 | if (self.context != nil)
36 | return YES;
37 |
38 | EAGLContext * aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
39 |
40 | if (!aContext)
41 | {
42 | NSLog(@"Failed to create ES context");
43 | return FALSE;
44 | }
45 |
46 | else if (![EAGLContext setCurrentContext:aContext])
47 | {
48 | NSLog(@"Failed to set ES context current");
49 | return FALSE;
50 | }
51 |
52 | self.Context = aContext;
53 | [aContext release];
54 |
55 |
56 | return _tutorial->Deploy();
57 | }
58 |
59 | - (void) AttachViewToContext:(UIView*) view
60 | {
61 | if (view != nil)
62 | {
63 | _glview = (EAGLView*)view;
64 | [_glview setContext:self.context];
65 | [_glview setFramebuffer];
66 | self.contextWidth = [ _glview framebufferWidth ];
67 | self.contextHeight = [ _glview framebufferHeight ];
68 | }
69 | }
70 | - (void)dealloc
71 | {
72 | [self TearOpenGLESContext];
73 | self.context = nil;
74 | SAFE_DELETE(_tutorial);
75 | [super dealloc];
76 | }
77 | - (void) TearOpenGLESContext
78 | {
79 | // Tear down context.
80 | if ([EAGLContext currentContext] == self.context)
81 | [EAGLContext setCurrentContext:nil];
82 | }
83 |
84 | - (void)DrawFrame
85 | {
86 | if(self.context)
87 | {
88 | [EAGLContext setCurrentContext:self.context];
89 | [_glview setFramebuffer];
90 | }
91 |
92 | //draw frame
93 | _tutorial->Frame();
94 | [_glview presentFramebuffer];
95 |
96 |
97 | }
98 | -(void) receivedControl:(CControlPad&) pad
99 | {
100 | _tutorial->UpdateControls(pad);
101 | }
102 | @end
103 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Classes/vvisionAppDelegate.h:
--------------------------------------------------------------------------------
1 | /* vvisionAppDelegate.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import
10 |
11 | @class vvisionViewController;
12 |
13 | @interface vvisionAppDelegate : NSObject {
14 | UIWindow *_window;
15 | vvisionViewController *_viewController;
16 | }
17 |
18 | @property (nonatomic, retain) IBOutlet UIWindow *window;
19 | @property (nonatomic, retain) IBOutlet vvisionViewController *viewController;
20 |
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Classes/vvisionAppDelegate.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * vvisionAppDelegate.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "vvisionAppDelegate.h"
11 | #import "vvisionViewController.h"
12 |
13 | @implementation vvisionAppDelegate
14 |
15 | @synthesize window = _window;
16 | @synthesize viewController = _viewController;
17 |
18 | - (void)applicationWillResignActive:(UIApplication *)application
19 | {
20 | [self.viewController stopAnimation];
21 | }
22 |
23 | - (void)applicationDidBecomeActive:(UIApplication *)application
24 | {
25 | NSLog(@"app became active");
26 | [self.viewController startAnimation];
27 | }
28 |
29 | - (void)applicationWillTerminate:(UIApplication *)application
30 | {
31 | [self.viewController stopAnimation];
32 | }
33 |
34 | - (void)applicationDidEnterBackground:(UIApplication *)application
35 | {
36 | // Handle any background procedures not related to animation here.
37 | NSLog(@"app entered background");
38 | }
39 |
40 | - (void)applicationWillEnterForeground:(UIApplication *)application
41 | {
42 | // Handle any foreground procedures not related to animation here.
43 | }
44 |
45 | - (void)dealloc
46 | {
47 | self.viewController = nil;//this should invoke a release msg on the retained object ( if count = 0 dealloc is invoked)
48 | self.window = nil;
49 | [super dealloc];
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Classes/vvisionViewController.h:
--------------------------------------------------------------------------------
1 | /* vvisionViewController.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import "GPUManager.h"
10 |
11 | @interface vvisionViewController : UIViewController
12 | {
13 |
14 | GPUManager* _gpuManager;
15 |
16 | BOOL animating;
17 | NSInteger _animationFrameInterval;
18 | CADisplayLink *_displayLink;
19 | CControlPad _controlPad;
20 | }
21 |
22 | @property (nonatomic, assign) CADisplayLink *displayLink;
23 |
24 | - (void)startAnimation;
25 | - (void)stopAnimation;
26 |
27 | -(IBAction)buttonToutchDown:(id)butID;
28 | -(IBAction)buttonToutchUp:(id)butID;
29 | @end
30 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/Default-568h@2x.png
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/Shaders/SkyBox.fsh:
--------------------------------------------------------------------------------
1 | //
2 | // SkyBox.fsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | //varying lowp vec4 colorVarying;
10 |
11 |
12 | precision mediump float;
13 | uniform samplerCube textureCubeMap;
14 | varying vec3 texCoord;
15 |
16 | void main()
17 | {
18 | gl_FragColor = vec4(textureCube(textureCubeMap, texCoord.xyz));
19 | }
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/Shaders/SkyBox.vsh:
--------------------------------------------------------------------------------
1 | //
2 | // SkyBox.vsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | attribute vec4 position;
10 | varying vec3 texCoord;
11 | uniform mat4 matProjViewModel;
12 |
13 | void main()
14 | {
15 | gl_Position = matProjViewModel * ( position );
16 | texCoord.xyz = position.xyz;
17 | }
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/Shaders/Terrain.fsh:
--------------------------------------------------------------------------------
1 | //
2 | // NoLighting.fsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 |
10 | precision highp float;
11 |
12 | uniform sampler2D texture0;
13 | uniform sampler2D textureDetail;
14 | uniform float detailFactor;
15 |
16 | varying vec2 v_texCoord;
17 |
18 | void main()
19 | {
20 | vec4 color = texture2D( texture0, v_texCoord);
21 | vec2 fetch = v_texCoord.st * detailFactor;
22 | vec4 detail = texture2D(textureDetail, fetch);
23 | gl_FragColor = color * detail ;
24 | }
25 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/Shaders/Terrain.vsh:
--------------------------------------------------------------------------------
1 | //
2 | // NoLighting.vsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | attribute vec4 position;
10 | attribute vec2 texCoord0;
11 |
12 | varying vec2 v_texCoord;
13 |
14 | uniform mat4 matModel;
15 | uniform mat4 matProjViewModel;
16 |
17 | void main()
18 | {
19 | v_texCoord = texCoord0;
20 | gl_Position = matProjViewModel * position;
21 | }
22 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/Terrain/detail.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/Terrain/detail.jpg
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/Terrain/grass.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/Terrain/grass.jpg
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/Terrain/grassYellow.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/Terrain/grassYellow.jpg
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/Terrain/terrain2.ms3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/Terrain/terrain2.ms3d
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/icon.png
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/icons/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/icons/down.png
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/icons/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/icons/left.png
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/icons/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/icons/right.png
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/icons/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/icons/up.png
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/skybox/sky_xn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/skybox/sky_xn.jpg
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/skybox/sky_xp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/skybox/sky_xp.jpg
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/skybox/sky_yn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/skybox/sky_yn.jpg
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/skybox/sky_yp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/skybox/sky_yp.jpg
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/skybox/sky_zn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/skybox/sky_zn.jpg
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/Resources/skybox/sky_zp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/Resources/skybox/sky_zp.jpg
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/main.m:
--------------------------------------------------------------------------------
1 | /*
2 | * main.m
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import
11 |
12 | int main(int argc, char *argv[]) {
13 |
14 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
15 | int retVal = UIApplicationMain(argc, argv, nil, nil);
16 | [pool release];
17 | return retVal;
18 | }
19 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/vvision-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | skyBox
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 | icon.png
13 | CFBundleIdentifier
14 | com.virtual-vision.skyBox
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | NSMainNibFile
30 | MainWindow
31 | UIStatusBarHidden
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/vvision.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/skybox/skybox/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | vvision.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 1D6058900D05DD3D006BFB54
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/skybox/skybox/vvision_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'vvision' target in the 'vvision' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Classes/Core/entities/MeshEntity.h:
--------------------------------------------------------------------------------
1 | /* MeshEntity.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef VVISION_MeshEntity_h
21 | #define VVISION_MeshEntity_h
22 |
23 | #include "vvision.h"
24 |
25 | class CMeshEntity
26 | {
27 | public:
28 |
29 | /** constructor*/
30 | CMeshEntity(IMesh* mesh);
31 |
32 | /** destructor*/
33 | ~CMeshEntity();
34 |
35 | /** update mesh*/
36 | virtual void Update(float32 dt);
37 |
38 | /** render*/
39 | virtual void Render(CShader* shader, const mat4f &view, const mat4f &projection);
40 |
41 | /**reference to transformation matrix*/
42 | mat4f& GetTransfromationMatrix() {return m_mTransformationMatrix;}
43 |
44 | /** reference to the mesh buffer*/
45 | CMeshBuffer& GetMeshBuffer() {return *m_pMesh->GetMeshBuffer();}
46 |
47 | private:
48 | IMesh* m_pMesh;
49 |
50 | mat4f m_mTransformationMatrix;
51 | };
52 |
53 | #endif
54 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Classes/Core/entities/SkyBoxEntity.h:
--------------------------------------------------------------------------------
1 | /* SkyBoxEntity.h
2 | *
3 | * Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #ifndef SKY_BOX_ENTITY_INCLUDED
21 | #define SKY_BOX_ENTITY_INCLUDED
22 |
23 | #include "vvision.h"
24 |
25 | class CSkyBoxEntity
26 | {
27 | public :
28 |
29 | /** constructor
30 | * @param size the size of the sky box
31 | */
32 | CSkyBoxEntity( float32 size, const vec3f& position = vec3f());
33 |
34 | /** destructor*/
35 | ~CSkyBoxEntity();
36 |
37 |
38 | /** create skybox from a texture_base_name and size
39 | * @param texture_cubeMap the cube map texture used for the skybox
40 | * @return true if success
41 | */
42 | bool Create(CTextureCubeMap* texture_cubeMap);
43 |
44 | /** @inherited from Entity*/
45 | virtual void Render(CShader* shader, const mat4f &view, const mat4f &projection);
46 |
47 |
48 | private:
49 |
50 | /** the mesh buffer*/
51 | CMeshBuffer *m_pMeshBuffer;
52 |
53 | /** size of the skybox*/
54 | float32 m_fSize;
55 |
56 | /** transformation matrix*/
57 | mat4f m_mTransformationMatrix;
58 |
59 | };
60 |
61 | #endif
62 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Classes/GPUManager.h:
--------------------------------------------------------------------------------
1 | /* GPUManager.h
2 | *
3 | * Virtual Vision Engine . Copyright (C) 2012 Abdallah DIB.
4 | * All rights reserved. Email: Abdallah.dib@virtual-vison.net
5 | * Web:
6 | *
7 | * This program is free software: you can redistribute it and/or modify
8 | * it under the terms of the GNU General Public License as published by
9 | * the Free Software Foundation, either version 3 of the License, or
10 | * (at your option) any later version.
11 | *
12 | * This program is distributed in the hope that it will be useful,
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 | * GNU General Public License for more details.
16 | *
17 | * You should have received a copy of the GNU General Public License
18 | * along with this program. If not, see .*/
19 |
20 | #import
21 |
22 | #import
23 | #import
24 | #import
25 | #import
26 | #import "EAGLView.h"
27 | #import "Tutorial.h"
28 |
29 | @interface GPUManager : NSObject {
30 |
31 | EAGLView* _glview;
32 | GLuint _contextWidth;
33 | GLuint _contextHeight;
34 | EAGLContext *_context;
35 | Tutorial* _tutorial;
36 | }
37 |
38 | @property (nonatomic, retain) EAGLContext *context;
39 | @property GLuint contextWidth;
40 | @property GLuint contextHeight;
41 |
42 | - (id) init;
43 | - (void) AttachViewToContext:(UIView*) view;
44 | - (BOOL) CreateOpenGLESContext;
45 | - (void) TearOpenGLESContext;
46 | - (void)DrawFrame;
47 | -(void) receivedControl:(CControlPad&) pad;
48 | @end
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Classes/GPUManager.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * GPUManager.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "GPUManager.h"
11 | #import "CacheResourceManager.h"
12 | @implementation GPUManager
13 |
14 | @synthesize context = _context;
15 | @synthesize contextWidth = _contextWidth;
16 | @synthesize contextHeight = _contextHeight;
17 |
18 |
19 | CCacheResourceManager& crm_ = CCacheResourceManager::Instance();
20 |
21 | -(id) init
22 | {
23 | self = [super init];
24 |
25 | if(self)
26 | {
27 | _tutorial = new Tutorial();
28 | }
29 |
30 | return self;
31 | }
32 |
33 | - (BOOL) CreateOpenGLESContext
34 | {
35 | if (self.context != nil)
36 | return YES;
37 |
38 | EAGLContext * aContext = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
39 |
40 | if (!aContext)
41 | {
42 | NSLog(@"Failed to create ES context");
43 | return FALSE;
44 | }
45 |
46 | else if (![EAGLContext setCurrentContext:aContext])
47 | {
48 | NSLog(@"Failed to set ES context current");
49 | return FALSE;
50 | }
51 |
52 | self.Context = aContext;
53 | [aContext release];
54 |
55 |
56 | return _tutorial->Deploy();
57 | }
58 |
59 | - (void) AttachViewToContext:(UIView*) view
60 | {
61 | if (view != nil)
62 | {
63 | _glview = (EAGLView*)view;
64 | [_glview setContext:self.context];
65 | [_glview setFramebuffer];
66 | self.contextWidth = [ _glview framebufferWidth ];
67 | self.contextHeight = [ _glview framebufferHeight ];
68 | }
69 | }
70 | - (void)dealloc
71 | {
72 | [self TearOpenGLESContext];
73 | self.context = nil;
74 | SAFE_DELETE(_tutorial);
75 | [super dealloc];
76 | }
77 | - (void) TearOpenGLESContext
78 | {
79 | // Tear down context.
80 | if ([EAGLContext currentContext] == self.context)
81 | [EAGLContext setCurrentContext:nil];
82 |
83 | }
84 |
85 | - (void)DrawFrame
86 | {
87 | if(self.context)
88 | {
89 | [EAGLContext setCurrentContext:self.context];
90 | [_glview setFramebuffer];
91 |
92 | _tutorial->SetWindowSize(_glview.framebufferWidth, _glview.framebufferHeight);
93 | }
94 |
95 | //draw frame
96 | _tutorial->Frame();
97 | [_glview presentFramebuffer];
98 |
99 |
100 | }
101 | -(void) receivedControl:(CControlPad&) pad
102 | {
103 | _tutorial->UpdateControls(pad);
104 | }
105 | @end
106 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Classes/vvisionAppDelegate.h:
--------------------------------------------------------------------------------
1 | /* vvisionAppDelegate.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import
10 |
11 | @class vvisionViewController;
12 |
13 | @interface vvisionAppDelegate : NSObject {
14 | UIWindow *_window;
15 | vvisionViewController *_viewController;
16 | }
17 |
18 | @property (nonatomic, retain) IBOutlet UIWindow *window;
19 | @property (nonatomic, retain) IBOutlet vvisionViewController *viewController;
20 |
21 | @end
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Classes/vvisionAppDelegate.mm:
--------------------------------------------------------------------------------
1 | /*
2 | * vvisionAppDelegate.mm
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import "vvisionAppDelegate.h"
11 | #import "vvisionViewController.h"
12 |
13 | @implementation vvisionAppDelegate
14 |
15 | @synthesize window = _window;
16 | @synthesize viewController = _viewController;
17 |
18 | - (void)applicationWillResignActive:(UIApplication *)application
19 | {
20 | [self.viewController stopAnimation];
21 | }
22 |
23 | - (void)applicationDidBecomeActive:(UIApplication *)application
24 | {
25 | NSLog(@"app became active");
26 | [self.viewController startAnimation];
27 | }
28 |
29 | - (void)applicationWillTerminate:(UIApplication *)application
30 | {
31 | [self.viewController stopAnimation];
32 | }
33 |
34 | - (void)applicationDidEnterBackground:(UIApplication *)application
35 | {
36 | // Handle any background procedures not related to animation here.
37 | NSLog(@"app entered background");
38 | }
39 |
40 | - (void)applicationWillEnterForeground:(UIApplication *)application
41 | {
42 | // Handle any foreground procedures not related to animation here.
43 | }
44 |
45 | - (void)dealloc
46 | {
47 | self.viewController = nil;//this should invoke a release msg on the retained object ( if count = 0 dealloc is invoked)
48 | self.window = nil;
49 | [super dealloc];
50 | }
51 |
52 | @end
53 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Classes/vvisionViewController.h:
--------------------------------------------------------------------------------
1 | /* vvisionViewController.h
2 | * Virtual Vision
3 | *
4 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
5 | * Copyright 2011 Virtual Vision. All rights reserved.
6 | *
7 | */
8 |
9 | #import "GPUManager.h"
10 |
11 | @interface vvisionViewController : UIViewController
12 | {
13 |
14 | GPUManager* _gpuManager;
15 |
16 | BOOL animating;
17 | NSInteger _animationFrameInterval;
18 | CADisplayLink *_displayLink;
19 | CControlPad _controlPad;
20 | }
21 |
22 | @property (nonatomic, assign) CADisplayLink *displayLink;
23 |
24 | - (void)startAnimation;
25 | - (void)stopAnimation;
26 |
27 | -(IBAction)buttonToutchDown:(id)butID;
28 | -(IBAction)buttonToutchUp:(id)butID;
29 | @end
30 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Default-568h@2x.png
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/House/house_diffuse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/House/house_diffuse.png
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/House/house_obj.mtl:
--------------------------------------------------------------------------------
1 | # Blender MTL File: ''
2 | # Material Count: 1
3 | newmtl blinn1SG_house_diffuse.png
4 | Ns 0.000000
5 | Ka 0.000000 0.000000 0.000000
6 | Kd 0.000000 0.000000 0.000000
7 | Ks 0.000000 0.000000 0.000000
8 | Ni 1.000000
9 | d 0.000000
10 | illum 2
11 | map_Kd house_diffuse.png
12 | map_Bump house_normal.png
13 | map_Ks house_spec.png
14 |
15 |
16 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/Shaders/SkyBox.fsh:
--------------------------------------------------------------------------------
1 | //
2 | // SkyBox.fsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | //varying lowp vec4 colorVarying;
10 |
11 |
12 | precision mediump float;
13 | uniform samplerCube textureCubeMap;
14 | varying vec3 texCoord;
15 |
16 | void main()
17 | {
18 | gl_FragColor = textureCube(textureCubeMap, texCoord.xyz);
19 | }
20 |
21 |
22 |
23 |
24 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/Shaders/SkyBox.vsh:
--------------------------------------------------------------------------------
1 | //
2 | // SkyBox.vsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | attribute vec4 position;
10 | varying vec3 texCoord;
11 | uniform mat4 matProjViewModel;
12 |
13 | void main() {
14 | gl_Position = matProjViewModel * ( position );
15 | texCoord.xyz = position.xyz;
16 | }
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/Shaders/Terrain.fsh:
--------------------------------------------------------------------------------
1 | //
2 | // NoLighting.fsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 |
10 |
11 | precision highp float;
12 | uniform int enableDiscardScene;
13 | uniform float waterHeight;
14 | uniform sampler2D texture0;
15 | uniform sampler2D textureDetail;
16 | uniform int useDetailTexture;
17 | uniform float detailFactor;
18 |
19 | varying vec2 v_texCoord;
20 | varying vec4 v_vertex;
21 |
22 |
23 | void main()
24 | {
25 | //we have to cull all objects under water for correct rendering of the mirrored texture
26 | if(enableDiscardScene == 1)
27 | {
28 | if(v_vertex.z < waterHeight)
29 | discard;// todo: this should be replaced with clip planes. its not recommanded to use discard operation.
30 | }
31 |
32 | vec4 color = texture2D( texture0, v_texCoord);
33 |
34 | vec4 finalColor;
35 | vec2 fetch = v_texCoord.st * detailFactor;
36 | vec4 detail = texture2D(textureDetail, fetch);
37 | finalColor = color * detail;
38 |
39 |
40 | gl_FragColor = finalColor;
41 |
42 | }
43 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/Shaders/Terrain.vsh:
--------------------------------------------------------------------------------
1 | //
2 | // NoLighting.vsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | attribute vec4 position;
10 | attribute vec2 texCoord0;
11 |
12 | varying vec2 v_texCoord;
13 |
14 | uniform mat4 matModel;
15 | uniform mat4 matProjViewModel;
16 |
17 | varying vec4 v_vertex;
18 | void main()
19 | {
20 | v_texCoord = texCoord0;
21 | gl_Position = matProjViewModel * position;
22 | v_vertex = matModel * position;
23 | }
24 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/Shaders/WaterSurface.fsh:
--------------------------------------------------------------------------------
1 | //
2 | // WaterSurface.fsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 |
10 | precision mediump float;
11 |
12 | uniform sampler2D texture0;
13 | uniform sampler2D normal;
14 | uniform float time;
15 | uniform float screenWidth;
16 | uniform float screenHeight;
17 |
18 | varying vec2 v_texCoord;
19 |
20 | void main()
21 | {
22 | //this define the number to water surface tile
23 | const float tile_factor = 20.0;
24 | const float noise_factor = 0.03;
25 |
26 | vec2 texCoordNormal0 = v_texCoord * tile_factor;
27 | texCoordNormal0 += time ;
28 |
29 | vec2 texCoordNormal1 = v_texCoord * tile_factor;
30 | texCoordNormal1.s -= time ;
31 | texCoordNormal1.t += time ;
32 |
33 | vec3 normal0 = texture2D(normal, texCoordNormal0).rgb * 2.0 - 1.0;
34 | vec3 normal1 = texture2D(normal, texCoordNormal1).rgb * 2.0 - 1.0;
35 | vec3 normal = normalize(normal0 + normal1);
36 |
37 | //adjust texture coordinate based on screen size
38 | vec2 texCoordReflection = vec2(gl_FragCoord.x * screenWidth, gl_FragCoord.y * screenHeight);
39 |
40 | //the final texture cooridnate is disturbed using the normal texture with some noise factor
41 | vec2 texCoordFinal = texCoordReflection.xy + noise_factor * normal.xy;
42 |
43 | gl_FragColor = texture2D( texture0, texCoordFinal);
44 | }
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/Shaders/WaterSurface.vsh:
--------------------------------------------------------------------------------
1 | //
2 | // WaterSurface.vsh
3 | // Virtual Vision
4 | //
5 | // Created by Abdallah Dib on 4/10/11.
6 | // Copyright 2011 Virtual Vision. All rights reserved.
7 | //
8 |
9 | attribute vec4 position;
10 | attribute vec2 texCoord0;
11 |
12 | varying vec2 v_texCoord;
13 |
14 | uniform mat4 matProjViewModel;
15 |
16 | void main()
17 | {
18 | v_texCoord = texCoord0;
19 | gl_Position = matProjViewModel * position;
20 | }
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/Terrain/detail.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/Terrain/detail.jpg
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/Terrain/grass.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/Terrain/grass.jpg
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/Terrain/grassYellow.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/Terrain/grassYellow.jpg
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/Terrain/terrain2.ms3d:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/Terrain/terrain2.ms3d
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/icon.png
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/icons/down.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/icons/down.png
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/icons/left.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/icons/left.png
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/icons/right.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/icons/right.png
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/icons/up.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/icons/up.png
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/skybox/sky_xn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/skybox/sky_xn.jpg
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/skybox/sky_xp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/skybox/sky_xp.jpg
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/skybox/sky_yn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/skybox/sky_yn.jpg
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/skybox/sky_yp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/skybox/sky_yp.jpg
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/skybox/sky_zn.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/skybox/sky_zn.jpg
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/skybox/sky_zp.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/skybox/sky_zp.jpg
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/Resources/water/normal.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/Resources/water/normal.jpg
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/main.m:
--------------------------------------------------------------------------------
1 | /*
2 | * main.m
3 | * Virtual Vision
4 | *
5 | * Created by Abdallah Dib Abdallah.dib@virtual-vison.net
6 | * Copyright 2011 Virtual Vision. All rights reserved.
7 | *
8 | */
9 |
10 | #import
11 |
12 | int main(int argc, char *argv[]) {
13 |
14 | NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
15 | int retVal = UIApplicationMain(argc, argv, nil, nil);
16 | [pool release];
17 | return retVal;
18 | }
19 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/vvision-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | English
7 | CFBundleDisplayName
8 | waterReflection
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIconFile
12 | icon.png
13 | CFBundleIdentifier
14 | com.virtual-vision.waterReflection
15 | CFBundleInfoDictionaryVersion
16 | 6.0
17 | CFBundleName
18 | ${PRODUCT_NAME}
19 | CFBundlePackageType
20 | APPL
21 | CFBundleShortVersionString
22 | 1.0
23 | CFBundleSignature
24 | ????
25 | CFBundleVersion
26 | 1.0
27 | LSRequiresIPhoneOS
28 |
29 | NSMainNibFile
30 | MainWindow
31 | UIStatusBarHidden
32 |
33 |
34 |
35 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/vvision.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/abdallahdib/opengles_tutorials/c9f9c63e836ea3923f1cc51db705c3b961348bd2/tutorials/waterReflection/waterReflection/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/UserInterfaceState.xcuserstate
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/vvision.xcodeproj/project.xcworkspace/xcuserdata/casper.xcuserdatad/WorkspaceSettings.xcsettings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | HasAskedToTakeAutomaticSnapshotBeforeSignificantChanges
6 |
7 | SnapshotAutomaticallyBeforeSignificantChanges
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcdebugger/Breakpoints.xcbkptlist:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/vvision.xcodeproj/xcuserdata/casper.xcuserdatad/xcschemes/xcschememanagement.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | SchemeUserState
6 |
7 | vvision.xcscheme
8 |
9 | orderHint
10 | 0
11 |
12 |
13 | SuppressBuildableAutocreation
14 |
15 | 1D6058900D05DD3D006BFB54
16 |
17 | primary
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/tutorials/waterReflection/waterReflection/vvision_Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'vvision' target in the 'vvision' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_3_0
8 | #warning "This project uses features only available in iPhone SDK 3.0 and later."
9 | #endif
10 |
11 | #ifdef __OBJC__
12 | #import
13 | #import
14 | #endif
15 |
--------------------------------------------------------------------------------