Skip to content

Commit

Permalink
added exercise 9
Browse files Browse the repository at this point in the history
  • Loading branch information
mimetaur committed Sep 10, 2012
1 parent 5ae6db8 commit 43f5901
Show file tree
Hide file tree
Showing 7 changed files with 432 additions and 0 deletions.
5 changes: 5 additions & 0 deletions introduction/Exercise9/include/Resources.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#pragma once
#include "cinder/CinderResources.h"
#include "Resources.h"

//#define RES_MY_RES CINDER_RESOURCE( ../resources/, image_name.png, 128, IMAGE )
63 changes: 63 additions & 0 deletions introduction/Exercise9/src/Exercise9App.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#include "cinder/app/AppBasic.h"
#include "cinder/gl/gl.h"
#include "cinder/CinderMath.h"
#include "cinder/Perlin.h"
#include "cinder/params/Params.h"
#include "cinder/gl/Fbo.h"

using namespace ci;
using namespace ci::app;
using namespace std;

class Exercise9App : public AppBasic {
public:
void setup();
void update();
void draw();

Perlin perlin_;
Channel clouds_;
gl::Texture cloudsTex_;

float xoff_;
float yoff_;
float zoff_;
};

void Exercise9App::setup()
{
gl::clear( Color( 0, 0, 0 ) );
clouds_ = Channel(getWindowWidth(), getWindowHeight());
cloudsTex_ = gl::Texture(getWindowWidth(), getWindowHeight());

xoff_ = 0.0f;
yoff_ = 0.0f;
zoff_ = 0.0f;
}

void Exercise9App::update()
{
xoff_ = 0.0f;
Channel::Iter iter = clouds_.getIter();
while (iter.line()) {
yoff_ = 0.0f;
while (iter.pixel()) {
float noiseOutput = perlin_.noise(xoff_, yoff_, zoff_);
float brightness = lmap(noiseOutput, -1.0f, 1.0f, 0.0f, 255.0f);
iter.v() = brightness;

yoff_ += 0.01;
}
xoff_ += 0.01;
}
zoff_ += 0.1;
cloudsTex_.update(clouds_, getWindowBounds());
}

void Exercise9App::draw()
{
gl::clear( Color( 0, 0, 0 ) );
gl::draw(cloudsTex_);
}

CINDER_APP_BASIC( Exercise9App, RendererGl )
Binary file added introduction/Exercise9/xcode/CinderApp.icns
Binary file not shown.
322 changes: 322 additions & 0 deletions introduction/Exercise9/xcode/Exercise9.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,322 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
0091D8F90E81B9330029341E /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0091D8F80E81B9330029341E /* OpenGL.framework */; };
0097E3E50F3E9819005A4392 /* QuickTime.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0097E3E40F3E9819005A4392 /* QuickTime.framework */; };
00B784B30FF439BC000DE1D7 /* Accelerate.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784AF0FF439BC000DE1D7 /* Accelerate.framework */; };
00B784B40FF439BC000DE1D7 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */; };
00B784B50FF439BC000DE1D7 /* AudioUnit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B10FF439BC000DE1D7 /* AudioUnit.framework */; };
00B784B60FF439BC000DE1D7 /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 00B784B20FF439BC000DE1D7 /* CoreAudio.framework */; };
00BAE65A0E7ED9C10018A608 /* Exercise9App.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 00BAE6590E7ED9C10018A608 /* Exercise9App.cpp */; };
00CCAF15116A9FEE008396D5 /* CinderApp.icns in Resources */ = {isa = PBXBuildFile; fileRef = 00CCAF14116A9FEE008396D5 /* CinderApp.icns */; };
5323E6B20EAFCA74003A9687 /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5323E6B10EAFCA74003A9687 /* CoreVideo.framework */; };
5323E6B60EAFCA7E003A9687 /* QTKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 5323E6B50EAFCA7E003A9687 /* QTKit.framework */; };
53E3CDFC0E86099300238D2B /* Carbon.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 53E3CDFB0E86099300238D2B /* Carbon.framework */; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
0091D8F80E81B9330029341E /* OpenGL.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGL.framework; path = /System/Library/Frameworks/OpenGL.framework; sourceTree = "<absolute>"; };
0097E3E40F3E9819005A4392 /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = "<absolute>"; };
00B784AF0FF439BC000DE1D7 /* Accelerate.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Accelerate.framework; path = System/Library/Frameworks/Accelerate.framework; sourceTree = SDKROOT; };
00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; };
00B784B10FF439BC000DE1D7 /* AudioUnit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioUnit.framework; path = System/Library/Frameworks/AudioUnit.framework; sourceTree = SDKROOT; };
00B784B20FF439BC000DE1D7 /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; };
00BAE6590E7ED9C10018A608 /* Exercise9App.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Exercise9App.cpp; path = ../src/Exercise9App.cpp; sourceTree = SOURCE_ROOT; };
00CCAF14116A9FEE008396D5 /* CinderApp.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = CinderApp.icns; sourceTree = SOURCE_ROOT; };
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
32CA4F630368D1EE00C91783 /* Exercise9_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exercise9_Prefix.pch; sourceTree = "<group>"; };
5323E6B10EAFCA74003A9687 /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = /System/Library/Frameworks/CoreVideo.framework; sourceTree = "<absolute>"; };
5323E6B50EAFCA7E003A9687 /* QTKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QTKit.framework; path = /System/Library/Frameworks/QTKit.framework; sourceTree = "<absolute>"; };
53E3CDFB0E86099300238D2B /* Carbon.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Carbon.framework; path = /System/Library/Frameworks/Carbon.framework; sourceTree = "<absolute>"; };
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8D1107320486CEB800E47090 /* Exercise9.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Exercise9.app; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
8D11072E0486CEB800E47090 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
0091D8F90E81B9330029341E /* OpenGL.framework in Frameworks */,
53E3CDFC0E86099300238D2B /* Carbon.framework in Frameworks */,
5323E6B20EAFCA74003A9687 /* CoreVideo.framework in Frameworks */,
5323E6B60EAFCA7E003A9687 /* QTKit.framework in Frameworks */,
0097E3E50F3E9819005A4392 /* QuickTime.framework in Frameworks */,
00B784B30FF439BC000DE1D7 /* Accelerate.framework in Frameworks */,
00B784B40FF439BC000DE1D7 /* AudioToolbox.framework in Frameworks */,
00B784B50FF439BC000DE1D7 /* AudioUnit.framework in Frameworks */,
00B784B60FF439BC000DE1D7 /* CoreAudio.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */

/* Begin PBXGroup section */
080E96DDFE201D6D7F000001 /* Source */ = {
isa = PBXGroup;
children = (
00BAE6590E7ED9C10018A608 /* Exercise9App.cpp */,
);
name = Source;
sourceTree = "<group>";
};
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
isa = PBXGroup;
children = (
00B784AF0FF439BC000DE1D7 /* Accelerate.framework */,
00B784B00FF439BC000DE1D7 /* AudioToolbox.framework */,
00B784B10FF439BC000DE1D7 /* AudioUnit.framework */,
00B784B20FF439BC000DE1D7 /* CoreAudio.framework */,
0097E3E40F3E9819005A4392 /* QuickTime.framework */,
5323E6B50EAFCA7E003A9687 /* QTKit.framework */,
5323E6B10EAFCA74003A9687 /* CoreVideo.framework */,
53E3CDFB0E86099300238D2B /* Carbon.framework */,
0091D8F80E81B9330029341E /* OpenGL.framework */,
1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
);
name = "Linked Frameworks";
sourceTree = "<group>";
};
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
isa = PBXGroup;
children = (
29B97324FDCFA39411CA2CEA /* AppKit.framework */,
13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
29B97325FDCFA39411CA2CEA /* Foundation.framework */,
);
name = "Other Frameworks";
sourceTree = "<group>";
};
19C28FACFE9D520D11CA2CBB /* Products */ = {
isa = PBXGroup;
children = (
8D1107320486CEB800E47090 /* Exercise9.app */,
);
name = Products;
sourceTree = "<group>";
};
29B97314FDCFA39411CA2CEA /* Noise2DExercise8 */ = {
isa = PBXGroup;
children = (
29B97315FDCFA39411CA2CEA /* Headers */,
080E96DDFE201D6D7F000001 /* Source */,
29B97317FDCFA39411CA2CEA /* Resources */,
29B97323FDCFA39411CA2CEA /* Frameworks */,
19C28FACFE9D520D11CA2CBB /* Products */,
);
name = Noise2DExercise8;
sourceTree = "<group>";
};
29B97315FDCFA39411CA2CEA /* Headers */ = {
isa = PBXGroup;
children = (
32CA4F630368D1EE00C91783 /* Exercise9_Prefix.pch */,
);
name = Headers;
sourceTree = "<group>";
};
29B97317FDCFA39411CA2CEA /* Resources */ = {
isa = PBXGroup;
children = (
8D1107310486CEB800E47090 /* Info.plist */,
00CCAF14116A9FEE008396D5 /* CinderApp.icns */,
);
name = Resources;
sourceTree = "<group>";
};
29B97323FDCFA39411CA2CEA /* Frameworks */ = {
isa = PBXGroup;
children = (
1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
);
name = Frameworks;
sourceTree = "<group>";
};
/* End PBXGroup section */

/* Begin PBXNativeTarget section */
8D1107260486CEB800E47090 /* Exercise9 */ = {
isa = PBXNativeTarget;
buildConfigurationList = C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Exercise9" */;
buildPhases = (
8D1107290486CEB800E47090 /* Resources */,
8D11072C0486CEB800E47090 /* Sources */,
8D11072E0486CEB800E47090 /* Frameworks */,
);
buildRules = (
);
dependencies = (
);
name = Exercise9;
productInstallPath = "$(HOME)/Applications";
productName = Noise2DExercise8;
productReference = 8D1107320486CEB800E47090 /* Exercise9.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */

/* Begin PBXProject section */
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0440;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Exercise9" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
en,
);
mainGroup = 29B97314FDCFA39411CA2CEA /* Noise2DExercise8 */;
projectDirPath = "";
projectRoot = "";
targets = (
8D1107260486CEB800E47090 /* Exercise9 */,
);
};
/* End PBXProject section */

/* Begin PBXResourcesBuildPhase section */
8D1107290486CEB800E47090 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
00CCAF15116A9FEE008396D5 /* CinderApp.icns in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
8D11072C0486CEB800E47090 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
00BAE65A0E7ED9C10018A608 /* Exercise9App.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */

/* Begin XCBuildConfiguration section */
C01FCF4B08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
GCC_DYNAMIC_NO_PIC = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Exercise9_Prefix.pch;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
OTHER_LDFLAGS = (
"\"$(CINDER_PATH)/lib/libcinder_d.a\"",
"-lcurl",
);
PRODUCT_NAME = Exercise9;
SYMROOT = ./build;
WRAPPER_EXTENSION = app;
};
name = Debug;
};
C01FCF4C08A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_FAST_MATH = YES;
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
GCC_INLINES_ARE_PRIVATE_EXTERN = NO;
GCC_MODEL_TUNING = G5;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Exercise9_Prefix.pch;
GCC_SYMBOLS_PRIVATE_EXTERN = NO;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
OTHER_LDFLAGS = (
"\"$(CINDER_PATH)/lib/libcinder.a\"",
"-lcurl",
);
PRODUCT_NAME = Exercise9;
STRIP_INSTALLED_PRODUCT = YES;
SYMROOT = ./build;
WRAPPER_EXTENSION = app;
};
name = Release;
};
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = i386;
CINDER_PATH = ../../../../../cinder_0.8.4_mac;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/boost\"";
MACOSX_DEPLOYMENT_TARGET = 10.5;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
USER_HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/include\" ../include";
};
name = Debug;
};
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = i386;
CINDER_PATH = ../../../../../cinder_0.8.4_mac;
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/boost\"";
MACOSX_DEPLOYMENT_TARGET = 10.5;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
USER_HEADER_SEARCH_PATHS = "\"$(CINDER_PATH)/include\" ../include";
};
name = Release;
};
/* End XCBuildConfiguration section */

/* Begin XCConfigurationList section */
C01FCF4A08A954540054247B /* Build configuration list for PBXNativeTarget "Exercise9" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4B08A954540054247B /* Debug */,
C01FCF4C08A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
C01FCF4E08A954540054247B /* Build configuration list for PBXProject "Exercise9" */ = {
isa = XCConfigurationList;
buildConfigurations = (
C01FCF4F08A954540054247B /* Debug */,
C01FCF5008A954540054247B /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
}
Loading

0 comments on commit 43f5901

Please sign in to comment.