Permalink
Browse files

Fixing fluid animation (mouse)

  • Loading branch information...
gabriel committed Apr 29, 2012
1 parent 7a78065 commit de97a2abd50f6af7d6a189bbfe3dd538f1a1bf7d
View
@@ -10,7 +10,9 @@
#import "GHGLProgram.h"
#import "GHGLTexture.h"
-
+/*!
+ Simple fluid based shader.
+ */
@interface TFFluidShader : NSObject {
GHGLProgram *_prog;
View
@@ -30,8 +30,8 @@ - (void)dealloc {
[_prog release];
[_progCopy release];
[_progComposite release];
- //[_progBlurVertical release];
- //[_progBlurHorizontal release];
+ [_progBlurVertical release];
+ [_progBlurHorizontal release];
[_progFluidInit release];
[_progFluidAddMotion release];
[_progFluidAdvect release];
@@ -1,5 +1,5 @@
//
-// TFShader.h
+// TFTuringFluidShader.h
// TuringFluid
//
// Created by Gabriel Handford on 2/23/12.
@@ -10,8 +10,10 @@
#import "GHGLProgram.h"
#import "GHGLTexture.h"
-
-@interface TFShader : NSObject {
+/*!
+ Turning fluid based shader.
+ */
+@interface TFTuringFluidShader : NSObject {
GHGLProgram *_progTest;
GLuint _frameBufferTest;
GLuint _textureTest;
@@ -1,22 +1,22 @@
//
-// TFShaderView.m
+// TFTuringFluidShader.m
// TuringFluid
//
// Created by Gabriel Handford on 2/23/12.
// Copyright (c) 2012 rel.me. All rights reserved.
//
-#import "TFShader.h"
+#import "TFTuringFluidShader.h"
#import "GHGLUtils.h"
#import "GHTextureManager.h"
#define SizeX (1024.0f)
#define SizeY (768.0f)
-#define SimScale (2.0f)
-#define IsFluidEnabled (NO)
+#define SimScale (4.0f)
+#define IsFluidEnabled (YES)
-@implementation TFShader
+@implementation TFTuringFluidShader
@synthesize mouse=_mouse, mouseD=_mouseD, viewSize=_viewSize;
@@ -33,7 +33,6 @@ - (void)dealloc {
[_progComposite release];
[_progBlurHorizontal release];
[_progBlurVertical release];
-
[_progFluidInit release];
[_progFluidAddMotion release];
[_progFluidAdvect release];
View
@@ -1,11 +1,14 @@
+Turing Fluid
+============
+
OSX version of Turing Fluid demo: http://cake23.de/turing-fluid.html
-Install libusb:
+Install libusb
==============
brew install libusb --universal
-Install OpenNI:
+Install OpenNI
==============
git clone https://github.com/OpenNI/OpenNI.git
@@ -18,7 +21,7 @@ Install OpenNI:
sudo ln -s /usr/lib/libOpenNI.dylib /Applications/Xcode.app/Contents//Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk/usr/lib/
-To enable Kinect:
+Enable Kinect
==============
Set #define IsOpenNIEnabled (YES) in TFGLView.m.
@@ -7,7 +7,7 @@
#import <QuartzCore/CVDisplayLink.h>
-#import "TFShader.h"
+#import "TFTuringFluidShader.h"
//#import "TFFluidShader.h"
@interface TFGLView : NSOpenGLView {
@@ -22,7 +22,7 @@
CGPoint _mouseD;
CGPoint _oldMouse;
- TFShader *_shader;
+ TFTuringFluidShader *_shader;
//TFFluidShader *_shader;
}
@@ -84,7 +84,7 @@ - (void)stop {
}
- (void)prepareOpenGL {
- _shader = [[TFShader alloc] initWithViewSize:self.frame.size];
+ _shader = [[TFTuringFluidShader alloc] initWithViewSize:self.frame.size];
[_shader prepareOpenGL];
[self _openNI];
@@ -132,9 +132,6 @@ - (CVReturn)drawWithTime:(const CVTimeStamp *)outputTime {
}
_shader.mouse = _mouse;
_shader.mouseD = _mouseD;
- if (_mouseD.x > 0 || _mouseD.y > 0) {
- NSLog(@"Debug %0.1f, %0.1f", _mouseD.x, _mouseD.y);
- }
}
[_shader draw];
@@ -65,7 +65,7 @@
00FB517C14F74D9500C0AEF7 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 00FB517B14F74D9500C0AEF7 /* main.m */; };
00FB518614F74DC000C0AEF7 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 00FB518414F74DC000C0AEF7 /* InfoPlist.strings */; };
00FB518914F74DC400C0AEF7 /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 00FB518714F74DC400C0AEF7 /* MainMenu.xib */; };
- 00FB51B114F74F4000C0AEF7 /* TFShader.m in Sources */ = {isa = PBXBuildFile; fileRef = 00FB51B014F74F4000C0AEF7 /* TFShader.m */; };
+ 00FB51B114F74F4000C0AEF7 /* TFTuringFluidShader.m in Sources */ = {isa = PBXBuildFile; fileRef = 00FB51B014F74F4000C0AEF7 /* TFTuringFluidShader.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -127,8 +127,8 @@
00FB517B14F74D9500C0AEF7 /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = SOURCE_ROOT; };
00FB518514F74DC000C0AEF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = SOURCE_ROOT; };
00FB518814F74DC400C0AEF7 /* en */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = en; path = en.lproj/MainMenu.xib; sourceTree = SOURCE_ROOT; };
- 00FB51AF14F74F4000C0AEF7 /* TFShader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TFShader.h; sourceTree = "<group>"; };
- 00FB51B014F74F4000C0AEF7 /* TFShader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TFShader.m; sourceTree = "<group>"; };
+ 00FB51AF14F74F4000C0AEF7 /* TFTuringFluidShader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TFTuringFluidShader.h; sourceTree = "<group>"; };
+ 00FB51B014F74F4000C0AEF7 /* TFTuringFluidShader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TFTuringFluidShader.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -280,8 +280,8 @@
00FB51AE14F74F4000C0AEF7 /* Classes */ = {
isa = PBXGroup;
children = (
- 00FB51AF14F74F4000C0AEF7 /* TFShader.h */,
- 00FB51B014F74F4000C0AEF7 /* TFShader.m */,
+ 00FB51AF14F74F4000C0AEF7 /* TFTuringFluidShader.h */,
+ 00FB51B014F74F4000C0AEF7 /* TFTuringFluidShader.m */,
00D248E91500824D00AB9B7F /* TFFluidShader.h */,
00D248EA1500824D00AB9B7F /* TFFluidShader.m */,
);
@@ -396,7 +396,7 @@
00CAF55A14F74B350066B64F /* Shader-Test.vs in Sources */,
00CAF55B14F74B350066B64F /* Shader.vs in Sources */,
00FB517C14F74D9500C0AEF7 /* main.m in Sources */,
- 00FB51B114F74F4000C0AEF7 /* TFShader.m in Sources */,
+ 00FB51B114F74F4000C0AEF7 /* TFTuringFluidShader.m in Sources */,
0030305614F75ECD00A339F3 /* CocoaOpenNI.mm in Sources */,
0030305714F75ECD00A339F3 /* SceneDrawer.mm in Sources */,
0030305814F75ECD00A339F3 /* Shared.cpp in Sources */,

0 comments on commit de97a2a

Please sign in to comment.