From a47b39541a7f60dfdda921c9598abe947e1e6ad9 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 28 Mar 2012 00:42:08 +0100 Subject: rayhit still iffy. starting morpher --- gaunt01/addons.make | 1 + gaunt01/config.make | 2 +- gaunt01/gaunt01.cbp | 6 + gaunt01/gaunt01.layout | 9 +- gaunt01/src/main.cpp | 2 +- gaunt01/src/testApp.cpp | 94 ++++++-- gaunt01/src/testApp.h | 8 + morpher/Makefile | 466 ++++++++++++++++++++++++++++++++++++++++ morpher/addons.make | 1 + morpher/bin/data/Bird-test1.xml | 39 ++++ morpher/bin/data/texture2.jpg | Bin 0 -> 480433 bytes morpher/config.make | 34 +++ morpher/morpher.cbp | 60 ++++++ morpher/morpher.layout | 10 + morpher/src/main.cpp | 16 ++ morpher/src/morphmesh.cpp | 26 +++ morpher/src/morphmesh.h | 19 ++ morpher/src/testApp.cpp | 71 ++++++ morpher/src/testApp.h | 23 ++ rayhit/rayhit.layout | 2 +- rayhit/src/testApp.cpp | 23 +- 21 files changed, 877 insertions(+), 35 deletions(-) create mode 100644 morpher/Makefile create mode 100644 morpher/addons.make create mode 100644 morpher/bin/data/Bird-test1.xml create mode 100644 morpher/bin/data/texture2.jpg create mode 100644 morpher/config.make create mode 100644 morpher/morpher.cbp create mode 100644 morpher/morpher.layout create mode 100644 morpher/src/main.cpp create mode 100644 morpher/src/morphmesh.cpp create mode 100644 morpher/src/morphmesh.h create mode 100644 morpher/src/testApp.cpp create mode 100644 morpher/src/testApp.h diff --git a/gaunt01/addons.make b/gaunt01/addons.make index 886857d..9e525f4 100644 --- a/gaunt01/addons.make +++ b/gaunt01/addons.make @@ -1 +1,2 @@ ofxOpenCv +ofxRay diff --git a/gaunt01/config.make b/gaunt01/config.make index 702abf0..9ce3e2f 100644 --- a/gaunt01/config.make +++ b/gaunt01/config.make @@ -3,7 +3,7 @@ # OF_ROOT allows to move projects outside apps/* just set this variable to the # absoulte path to the OF root folder -OF_ROOT = ../../of_preRelease_v007_linux +OF_ROOT = ../../openFrameworks-020912 # USER_CFLAGS allows to pass custom flags to the compiler diff --git a/gaunt01/gaunt01.cbp b/gaunt01/gaunt01.cbp index a53c7b0..1ad4c32 100644 --- a/gaunt01/gaunt01.cbp +++ b/gaunt01/gaunt01.cbp @@ -81,6 +81,12 @@ + + + + diff --git a/gaunt01/gaunt01.layout b/gaunt01/gaunt01.layout index 04e7795..e5fb8e8 100644 --- a/gaunt01/gaunt01.layout +++ b/gaunt01/gaunt01.layout @@ -1,13 +1,16 @@ + + + - + - + - + diff --git a/gaunt01/src/main.cpp b/gaunt01/src/main.cpp index 6a32c6a..e502a4d 100644 --- a/gaunt01/src/main.cpp +++ b/gaunt01/src/main.cpp @@ -6,7 +6,7 @@ int main( ){ ofAppGlutWindow window; - ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context + ofSetupOpenGL(&window, 640,480, OF_WINDOW); // <-------- setup the GL context // this kicks off the running of my app // can be OF_WINDOW or OF_FULLSCREEN diff --git a/gaunt01/src/testApp.cpp b/gaunt01/src/testApp.cpp index fdff756..00658b4 100644 --- a/gaunt01/src/testApp.cpp +++ b/gaunt01/src/testApp.cpp @@ -18,6 +18,23 @@ void testApp::setup(){ bLearnBakground = true; threshold = 80; + + ofVec3f centre=ofVec3f(ofGetWidth()/2,0,0); + ofVec3f normal=ofVec3f(0,0,-1); + ray=ofRay(); + plane=ofPlane(centre,normal); + plane.color=ofColor(255,255,255); + + projector=ofProjector(1.535f, ofVec2f(0.0f, 0.5f),ofGetWidth(),ofGetHeight()); + projector.setPosition(ofGetWidth()/2,ofGetHeight()/2,ofGetHeight()); + + cam=ofCamera(); + cam.setPosition(ofGetWidth()/2,ofGetHeight()/2,ofGetHeight()); + cam.lookAt(ofVec3f(ofGetWidth()/2,ofGetHeight()/2,0)); + cam.setFov(54.13); + + cam_angle=0; + } //-------------------------------------------------------------- @@ -54,7 +71,7 @@ void testApp::update(){ // find contours which are between the size of 20 pixels and 1/3 the w*h pixels. // also, find holes is set to true so we will get interior contours as well.... - contourFinder.findContours(grayDiff, 20, (340*240)/3, 10, true); // find holes + contourFinder.findContours(grayDiff, 20, (340*240)/3, 10, false); // don't find holes } } @@ -62,6 +79,7 @@ void testApp::update(){ //-------------------------------------------------------------- void testApp::draw(){ + /* // draw the incoming, the grayscale, the bg and the thresholded difference ofSetHexColor(0xffffff); colorImg.draw(20,20); @@ -70,45 +88,68 @@ void testApp::draw(){ grayDiff.draw(360,280); // then draw the contours: - + */ ofFill(); ofSetHexColor(0x333333); - ofRect(360,540,320,240); - ofSetHexColor(0xffffff); + //ofRect(360,540,320,240); + ofSetHexColor(0xa0a0a0); // we could draw the whole contour finder //contourFinder.draw(360,540); - // or, instead we can draw each blob individually, - // this is how to get access to them: - for (int i = 0; i < contourFinder.nBlobs; i++){ - contourFinder.blobs[i].draw(360,540); - } - // finally, a report: - - ofSetHexColor(0xffffff); - char reportStr[1024]; - sprintf(reportStr, "bg subtraction and blob detection\npress ' ' to capture bg\nthreshold %i (press: +/-)\nnum blobs found %i, fps: %f", threshold, contourFinder.nBlobs, ofGetFrameRate()); - ofDrawBitmapString(reportStr, 20, 600); + colorImg.draw(0,0,ofGetWidth(),ofGetHeight()); - float gap=ofGetHeight()-ofGetWidth(); + cam.begin(); + ofPushMatrix(); - ofTranslate(0,ofGetHeight(),0); ofRotate(cam_angle,1,0,0); - ofTranslate(0,-ofGetHeight(),0); - for (float i=0;i /dev/null | grep -v openFrameworksCompiled | grep -v Poco) +LIB_SHARED = $(shell ls $(OF_ROOT)/libs/*/lib/$(LIBSPATH)/*.so 2> /dev/null | grep -v openFrameworksCompiled | sed "s/.*\\/lib\([^/]*\)\.so/-l\1/") +LIB_STATIC += $(OF_ROOT)/libs/poco/lib/$(LIBSPATH)/libPocoNet.a $(OF_ROOT)/libs/poco/lib/$(LIBSPATH)/libPocoXML.a $(OF_ROOT)/libs/poco/lib/$(LIBSPATH)/libPocoUtil.a $(OF_ROOT)/libs/poco/lib/$(LIBSPATH)/libPocoFoundation.a +LIB_PATHS_FLAGS = $(shell ls -d $(OF_ROOT)/libs/*/lib/$(LIBSPATH) | sed "s/\(\.*\)/-L\1/") + +CFLAGS += -Wall -fexceptions +CFLAGS += -I. +CFLAGS += $(INCLUDES_FLAGS) +CFLAGS += $(CORE_INCLUDE_FLAGS) + + + +ifeq ($(ARCH),android) + LDFLAGS = --sysroot=$(SYSROOT) -nostdlib -L"$(NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/libs/armeabi" + SYSTEMLIBS += -lstdc++ -lsupc++ -lgcc -lz -lGLESv1_CM -llog -ldl -lm -lc +else + LDFLAGS = -Wl,-rpath=./libs + SYSTEMLIBS += $(shell pkg-config jack glew gstreamer-0.10 gstreamer-video-0.10 gstreamer-base-0.10 gstreamer-app-0.10 libudev --libs) + SYSTEMLIBS += -lglut -lGL -lasound -lopenal -lsndfile -lvorbis -lFLAC -logg -lfreeimage +endif + + +ifeq ($(findstring addons.make,$(wildcard *.make)),addons.make) + ifneq ($(ARCH),android) + ADDONS = $(shell cat addons.make | grep -v ofxAndroid) + else + ADDONS = $(shell cat addons.make) + endif + + ifneq ($(strip $(ADDONS)),) + ADDONS_REL_DIRS = $(addsuffix /src, $(ADDONS)) + ADDONS_LIBS_REL_DIRS = $(addsuffix /libs, $(ADDONS)) + ADDONS_DIRS = $(addprefix $(OF_ROOT)/addons/, $(ADDONS_REL_DIRS) ) + ADDONS_LIBS_DIRS = $(addprefix $(OF_ROOT)/addons/, $(ADDONS_LIBS_REL_DIRS) ) + ADDONS_BIN_LIBS_DIRS = $(addsuffix /*/lib/$(LIBSPATH), $(ADDONS_LIBS_DIRS) ) + + ADDONS_INCLUDES = $(ADDONS_DIRS) + ADDONS_INCLUDES = $(ADDONS_LIBS_DIRS) + ADDONS_INCLUDES += $(shell find $(ADDONS_DIRS) -type d 2> /dev/null) + ADDONS_INCLUDES += $(shell find $(ADDONS_LIBS_DIRS) -type d 2> /dev/null) + ADDONSCFLAGS = $(addprefix -I,$(ADDONS_INCLUDES)) + + ifeq ($(findstring libsorder.make,$(shell find $(ADDONS_BIN_LIBS_DIRS) -name libsorder.make 2> /dev/null)),libsorder.make) + ADDONS_LIBS_W_ORDER = $(shell cat $(shell find $(ADDONS_BIN_LIBS_DIRS) -name libsorder.make 2> /dev/null)) + EXCLUDE_LIBS_FILTER = $(addprefix %,$(addsuffix .a,$(ADDONS_LIBS_W_ORDER))) + ADDONS_LIBS_STATICS = $(filter-out $(EXCLUDE_LIBS_FILTER), $(shell find $(ADDONS_BIN_LIBS_DIRS) -name *.a)) + ADDONS_LIBS_STATICS += $(addprefix -l, $(ADDONS_LIBS_W_ORDER)) + ADDONS_LIBS_STATICS += $(addprefix -L, $(shell find $(ADDONS_BIN_LIBS_DIRS) -name libsorder.make 2> /dev/null | sed s/libsorder.make//g)) + else + ADDONS_LIBS_STATICS = $(shell find $(ADDONS_BIN_LIBS_DIRS) -name *.a 2> /dev/null) + endif + + ADDONS_LIBS_SHARED = $(shell find $(ADDONS_BIN_LIBS_DIRS) -name *.so 2> /dev/null) + ADDONSLIBS = $(ADDONS_LIBS_STATICS) + ADDONSLIBS += $(ADDONS_LIBS_SHARED) + + + ADDONS_SOURCES = $(shell find $(ADDONS_DIRS) -name "*.cpp" -or -name "*.c" 2> /dev/null) + ADDONS_SOURCES += $(shell find $(ADDONS_LIBS_DIRS) -name "*.cpp" -or -name "*.c" -or -name "*.cc" 2>/dev/null) + ADDONS_OBJFILES = $(subst $(OF_ROOT)/, ,$(patsubst %.cc,%.o,$(patsubst %.c,%.o,$(patsubst %.cpp,%.o,$(ADDONS_SOURCES))))) + endif +endif + + +ifeq ($(findstring Debug,$(MAKECMDGOALS)),Debug) + TARGET_CFLAGS = -g + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(LIBSPATH)/libopenFrameworksDebug.a + TARGET_NAME = Debug +endif + +ifeq ($(findstring Release,$(MAKECMDGOALS)),Release) + TARGET_CFLAGS = $(COMPILER_OPTIMIZATION) + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(LIBSPATH)/libopenFrameworks.a + TARGET_NAME = Release +endif + +ifeq ($(ARCH),android) + ifeq ($(findstring Debug,$(MAKECMDGOALS)),Debug) + TARGET = libs/armeabi/libOFAndroidApp.so + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworksDebug.a + LDFLAGS += -Wl,--fix-cortex-a8 -shared + USER_LIBS = $(USER_LIBS_ARM) + endif + + ifeq ($(findstring Release,$(MAKECMDGOALS)),Release) + TARGET = libs/armeabi/libOFAndroidApp.so + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworks.a + LDFLAGS += -Wl,--fix-cortex-a8 -shared + USER_LIBS = $(USER_LIBS_ARM) + endif + + ifeq ($(findstring Release_arm7,$(MAKECMDGOALS)),Release_arm7) + TARGET_NAME = Release_arm7 + TARGET_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mthumb + TARGET = libs/armeabi-v7a/libOFAndroidApp.so + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworks_arm7.a + USER_LIBS = $(USER_LIBS_ARM7) + endif + + ifeq ($(findstring Release_neon,$(MAKECMDGOALS)),Release_neon) + TARGET_NAME = Release_neon + TARGET_CFLAGS += -march=armv7-a -mfloat-abi=softfp -mfpu=neon + TARGET = libs/armeabi-v7a/libOFAndroidApp_neon.so + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworks_neon.a + USER_LIBS = $(USER_LIBS_NEON) + endif + + ifeq ($(findstring TestLink,$(MAKECMDGOALS)),TestLink) + TARGET_NAME = Debug + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(ARCH)/libopenFrameworksDebug.a + LDFLAGS += -Wl,--entry=main,--fix-cortex-a8 + BIN_NAME = $(APPNAME) + TARGET = obj/$(BIN_NAME) + USER_LIBS = $(USER_LIBS_ARM) + endif +else + ifeq ($(findstring Debug,$(MAKECMDGOALS)),Debug) + BIN_NAME = $(APPNAME)_debug + TARGET = bin/$(BIN_NAME) + endif + + ifeq ($(findstring Release,$(MAKECMDGOALS)),Release) + BIN_NAME = $(APPNAME) + TARGET = bin/$(BIN_NAME) + endif + + ifeq ($(MAKECMDGOALS),) + TARGET_NAME = Release + BIN_NAME = $(APPNAME) + TARGET = bin/$(BIN_NAME) + TARGET_LIBS = $(OF_ROOT)/libs/openFrameworksCompiled/lib/$(LIBSPATH)/libopenFrameworks.a + endif +endif + +ifeq ($(MAKECMDGOALS),clean) + TARGET = bin/$(APPNAME)_debug bin/$(APPNAME) + TARGET_NAME = Release +endif + + +OBJ_OUTPUT = obj/$(ARCH)$(TARGET_NAME)/ +CLEANTARGET = clean$(TARGET_NAME) + +OBJS = $(addprefix $(OBJ_OUTPUT), $(OBJFILES)) +DEPFILES = $(patsubst %.o,%.d,$(OBJS)) + +USER_OBJS = $(addprefix $(OBJ_OUTPUT), $(USER_OBJFILES)) +DEPFILES += $(patsubst %.o,%.d,$(USER_OBJS)) + +ifeq ($(findstring addons.make,$(wildcard *.make)),addons.make) + ADDONS_OBJS = $(addprefix $(OBJ_OUTPUT), $(ADDONS_OBJFILES)) + DEPFILES += $(patsubst %.o,%.d,$(ADDONS_OBJS)) +endif + +.PHONY: Debug Release all after afterDebugAndroid afterReleaseAndroid + +Release: $(TARGET) after + +Debug: $(TARGET) after + +all: + $(MAKE) Release + +DebugAndroid: $(TARGET) + +ReleaseAndroid: $(TARGET) + +Release_arm7Android: $(TARGET) + +Release_neonAndroid: $(TARGET) afterReleaseAndroid + +TestLinkAndroid: $(TARGET) afterDebugAndroid + +AndroidDebug: + $(MAKE) DebugAndroid + $(MAKE) TestLinkAndroid + +AndroidRelease: + $(MAKE) ReleaseAndroid + $(MAKE) Release_arm7Android + $(MAKE) Release_neonAndroid + + +#This rule does the compilation +#$(OBJS): $(SOURCES) +$(OBJ_OUTPUT)%.o: %.cpp + @echo "compiling object for: " $< + mkdir -p $(@D) + $(CXX) -c $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $< + +$(OBJ_OUTPUT)%.o: %.c + @echo "compiling object for: " $< + mkdir -p $(@D) + $(CC) -c $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $< + +$(OBJ_OUTPUT)%.o: %.cc + @echo "compiling object for: " $< + mkdir -p $(@D) + $(CC) -c $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $< + +$(OBJ_OUTPUT)%.o: $(OF_ROOT)/%.cpp + @echo "compiling addon object for" $< + mkdir -p $(@D) + $(CXX) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o $@ -c $< + +$(OBJ_OUTPUT)%.o: $(OF_ROOT)/%.c + @echo "compiling addon object for" $< + mkdir -p $(@D) + $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o $@ -c $< + +$(OBJ_OUTPUT)%.o: $(OF_ROOT)/%.cc + @echo "compiling addon object for" $< + mkdir -p $(@D) + $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o $@ -c $< + +$(OBJ_OUTPUT)%.o: $(USER_SOURCE_DIR)/%.c + @echo "compiling object for: " $< + mkdir -p $(@D) + $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $< + +$(OBJ_OUTPUT)%.o: $(USER_SOURCE_DIR)/%.cc + @echo "compiling object for: " $< + mkdir -p $(@D) + $(CC) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $< + +$(OBJ_OUTPUT)%.o: $(USER_SOURCE_DIR)/%.cpp + @echo "compiling object for: " $< + mkdir -p $(@D) + $(CXX) $(TARGET_CFLAGS) $(CFLAGS) $(ADDONSCFLAGS) $(USER_CFLAGS) -MMD -MP -MF$(OBJ_OUTPUT)$*.d -MT$(OBJ_OUTPUT)$*.d -o$@ -c $< + +$(TARGET): $(OBJS) $(ADDONS_OBJS) $(USER_OBJS) $(TARGET_LIBS) $(LIB_STATIC) + @echo 'linking $(TARGET)' + mkdir -p $(@D) + $(CXX) -o $@ $(OBJS) $(ADDONS_OBJS) $(USER_OBJS) $(LDFLAGS) $(USER_LDFLAGS) $(TARGET_LIBS) $(ADDONSLIBS) $(USER_LIBS) $(LIB_STATIC) $(LIB_PATHS_FLAGS) $(LIB_SHARED) $(SYSTEMLIBS) + +-include $(DEPFILES) + +.PHONY: clean cleanDebug cleanRelease CleanAndroid +clean: + rm -rf $(OBJ_OUTPUT) + rm -f $(TARGET) + rm -r bin/libs + +$(CLEANTARGET): + rm -rf $(OBJ_OUTPUT) + rm -f $(TARGET) + rm -rf bin/libs + +CleanAndroid: + rm -Rf obj + rm -f libs/armeabi-v7a/libOFAndroidApp.so + rm -f libs/armeabi/libOFAndroidApp.so + rm -f obj/$(APPNAME) + + +afterDebugAndroid:$(TARGET) + @if [ -d libs/armeabi-v7a ]; then rm -r libs/armeabi-v7a; fi + + @cp $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver libs/armeabi + + #create gdb.setup for armeabi + @echo "set solib-search-path $(PWD)/obj/local/armeabi:$(PWD)/libs/armeabi" > libs/armeabi/gdb.setup + @echo "directory $(NDK_ROOT)/platforms/$(NDK_PLATFORM)/arch-arm/usr/include" >> libs/armeabi/gdb.setup + @echo "directory $(PWD)/src" >> libs/armeabi/gdb.setup + @echo "directory $(NDK_ROOT)/sources/cxx-stl/system" >> libs/armeabi/gdb.setup + @echo "directory $(PWD)/libs/armeabi" >> libs/armeabi/gdb.setup + @echo "" >> libs/armeabi/gdb.setup + + @if [ ! -d jni ]; then mkdir jni; fi + @echo "APP_ABI := armeabi" > jni/Application.mk + @echo "#LOCAL_MODULE := OFAndroidApp" > jni/Android.mk + +afterReleaseAndroid:$(TARGET) + @if [ -f obj/$(BIN_NAME) ]; then rm obj/$(BIN_NAME); fi + + @cp $(OF_ROOT)/libs/openFrameworksCompiled/project/android/libneondetection.so libs/armeabi-v7a/ + @cp $(NDK_ROOT)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver libs/armeabi-v7a + + #create gdb.setup for armeabi-v7a + @echo "set solib-search-path $(PWD)/obj/local/armeabi-v7a:$(PWD)/libs/armeabi-v7a" > libs/armeabi-v7a/gdb.setup + @echo "directory $(NDK_ROOT)/platforms/$(NDK_PLATFORM)/arch-arm/usr/include" >> libs/armeabi-v7a/gdb.setup + @echo "directory $(PWD)/src" >> libs/armeabi-v7a/gdb.setup + @echo "directory $(NDK_ROOT)/sources/cxx-stl/system" >> libs/armeabi-v7a/gdb.setup + @echo "directory $(PWD)/libs/armeabi-v7a" >> libs/armeabi-v7a/gdb.setup + @echo "" >> libs/armeabi-v7a/gdb.setup + + @if [ ! -d jni ]; then mkdir jni; fi + @echo "APP_ABI := armeabi armeabi-v7a" > jni/Application.mk + @echo "#LOCAL_MODULE := OFAndroidApp" > jni/Android.mk + +RESNAME=$(shell echo $(APPNAME)Resources | tr '[A-Z]' '[a-z]') + +AndroidInstall: + if [ -d "bin/data" ]; then \ + mkdir -p res/raw; \ + rm res/raw/$(RESNAME).zip; \ + cd bin/data; \ + zip -r ../../res/raw/$(RESNAME).zip *; \ + cd ../..; \ + fi + if [ -f obj/$(BIN_NAME) ]; then rm obj/$(BIN_NAME); fi + #touch AndroidManifest.xml + $(SDK_ROOT)/tools/android update project --target $(NDK_PLATFORM) --path $(PROJECT_PATH) + ant debug + cp bin/OFActivity-debug.apk bin/$(APPNAME).apk + #if [ "$(shell $(SDK_ROOT)/platform-tools/adb get-state)" = "device" ]; then + $(SDK_ROOT)/platform-tools/adb install -r bin/$(APPNAME).apk; + #fi + $(SDK_ROOT)/platform-tools/adb shell am start -a android.intent.action.MAIN -n cc.openframeworks.$(APPNAME)/cc.openframeworks.$(APPNAME).OFActivity + + +after:$(TARGET) + cp -r $(OF_ROOT)/export/$(LIBSPATH)/libs bin/ + @echo + @echo " compiling done" + @echo " to launch the application" + @echo + @echo " cd bin" + @echo " ./$(BIN_NAME)" + @echo + + +.PHONY: help +help: + @echo + @echo openFrameworks universal makefile + @echo + @echo targets: + @echo "make Debug: builds the application with debug symbols" + @echo "make Release: builds the app with optimizations" + @echo "make: = make Release" + @echo "make all: = make Release" + @echo "make CleanDebug: cleans the Debug target" + @echo "make CleanRelease: cleans the Release target" + @echo "make clean: cleans everything" + @echo + @echo this should work with any OF app, just copy any example + @echo change the name of the folder and it should compile + @echo "only .cpp support, don't use .c files" + @echo it will look for files in any folder inside the application + @echo folder except that in the EXCLUDE_FROM_SOURCE variable. + @echo "it doesn't autodetect include paths yet" + @echo "add the include paths editing the var USER_CFLAGS" + @echo at the beginning of the makefile using the gcc syntax: + @echo -Ipath + @echo + @echo to add addons to your application, edit the addons.make file + @echo in this directory and add the names of the addons you want to + @echo include + @echo diff --git a/morpher/addons.make b/morpher/addons.make new file mode 100644 index 0000000..a66eaad --- /dev/null +++ b/morpher/addons.make @@ -0,0 +1 @@ +ofxXmlSettings diff --git a/morpher/bin/data/Bird-test1.xml b/morpher/bin/data/Bird-test1.xml new file mode 100644 index 0000000..6f58854 --- /dev/null +++ b/morpher/bin/data/Bird-test1.xml @@ -0,0 +1,39 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/morpher/bin/data/texture2.jpg b/morpher/bin/data/texture2.jpg new file mode 100644 index 0000000..2643b96 Binary files /dev/null and b/morpher/bin/data/texture2.jpg differ diff --git a/morpher/config.make b/morpher/config.make new file mode 100644 index 0000000..9ce3e2f --- /dev/null +++ b/morpher/config.make @@ -0,0 +1,34 @@ +# add custom variables to this file + +# OF_ROOT allows to move projects outside apps/* just set this variable to the +# absoulte path to the OF root folder + +OF_ROOT = ../../openFrameworks-020912 + + +# USER_CFLAGS allows to pass custom flags to the compiler +# for example search paths like: +# USER_CFLAGS = -I src/objects + +USER_CFLAGS = + + +# USER_LDFLAGS allows to pass custom flags to the linker +# for example libraries like: +# USER_LD_FLAGS = libs/libawesomelib.a + +USER_LDFLAGS = + + +# use this to add system libraries for example: +# USER_LIBS = -lpango + +USER_LIBS = + + +# change this to add different compiler optimizations to your project + +USER_COMPILER_OPTIMIZATION = -march=native -mtune=native -Os + + +EXCLUDE_FROM_SOURCE="bin,.xcodeproj,obj" diff --git a/morpher/morpher.cbp b/morpher/morpher.cbp new file mode 100644 index 0000000..920b41e --- /dev/null +++ b/morpher/morpher.cbp @@ -0,0 +1,60 @@ + + + + + + diff --git a/morpher/morpher.layout b/morpher/morpher.layout new file mode 100644 index 0000000..ca95c9c --- /dev/null +++ b/morpher/morpher.layout @@ -0,0 +1,10 @@ + + + + + + + + + + diff --git a/morpher/src/main.cpp b/morpher/src/main.cpp new file mode 100644 index 0000000..6a32c6a --- /dev/null +++ b/morpher/src/main.cpp @@ -0,0 +1,16 @@ +#include "ofMain.h" +#include "testApp.h" +#include "ofAppGlutWindow.h" + +//======================================================================== +int main( ){ + + ofAppGlutWindow window; + ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context + + // this kicks off the running of my app + // can be OF_WINDOW or OF_FULLSCREEN + // pass in width and height too: + ofRunApp( new testApp()); + +} diff --git a/morpher/src/morphmesh.cpp b/morpher/src/morphmesh.cpp new file mode 100644 index 0000000..c8826f3 --- /dev/null +++ b/morpher/src/morphmesh.cpp @@ -0,0 +1,26 @@ +#include "morphmesh.h" + +morphmesh::morphmesh() +{ + //ctor +} + +morphmesh::~morphmesh() +{ + //dtor +} + +bool morphmesh::loadmesh(string filename){ + bool loaded=false; + ofxXmlSettings XML; + if( !XML.loadFile(filename) ){ + printf("unable to load %s check data/ folder\n",filename.c_str()); + }else{ + if(XML.pushTag("MeshList")) { + int verts=ofToInt(XML.getAttribute("mesh","VertexCount","none",0)); + int numMeshes=XML.getNumTags("Mesh"); + + } + } + return loaded; +} \ No newline at end of file diff --git a/morpher/src/morphmesh.h b/morpher/src/morphmesh.h new file mode 100644 index 0000000..3f401c6 --- /dev/null +++ b/morpher/src/morphmesh.h @@ -0,0 +1,19 @@ +#ifndef MORPHMESH_H +#define MORPHMESH_H + +#include +#include + + +class morphmesh : public ofMesh +{ + public: + morphmesh(); + virtual ~morphmesh(); + bool loadmesh(string filename); + protected: + private: + vector < >targets; +}; + +#endif // MORPHMESH_H diff --git a/morpher/src/testApp.cpp b/morpher/src/testApp.cpp new file mode 100644 index 0000000..aac34cc --- /dev/null +++ b/morpher/src/testApp.cpp @@ -0,0 +1,71 @@ +#include "testApp.h" + +#include "morphmesh.h" + +//-------------------------------------------------------------- +void testApp::setup(){ + +} + +//-------------------------------------------------------------- +void testApp::update(){ + + + +} + +//-------------------------------------------------------------- +void testApp::draw(){ + ofBackground(0,0,0); + +} + +//-------------------------------------------------------------- +void testApp::keyPressed(int key){ + + switch (key){ + case 'a': + break; + case 'z': + break; + } +} + +//-------------------------------------------------------------- +void testApp::keyReleased(int key){ + +} + +//-------------------------------------------------------------- +void testApp::mouseMoved(int x, int y ){ + +} + +//-------------------------------------------------------------- +void testApp::mouseDragged(int x, int y, int button){ + +} + +//-------------------------------------------------------------- +void testApp::mousePressed(int x, int y, int button){ + +} + +void testApp::mouseReleased(int x, int y, int button){ + +} + +//-------------------------------------------------------------- +void testApp::windowResized(int w, int h){ + +} + +//-------------------------------------------------------------- +void testApp::gotMessage(ofMessage msg){ + +} + +//-------------------------------------------------------------- +void testApp::dragEvent(ofDragInfo dragInfo){ + +} diff --git a/morpher/src/testApp.h b/morpher/src/testApp.h new file mode 100644 index 0000000..58fb4ce --- /dev/null +++ b/morpher/src/testApp.h @@ -0,0 +1,23 @@ +#pragma once + +#include "ofMain.h" + +class testApp : public ofBaseApp{ + + public: + void setup(); + void update(); + void draw(); + + void keyPressed(int key); + void keyReleased(int key); + void mouseMoved(int x, int y ); + void mouseDragged(int x, int y, int button); + void mousePressed(int x, int y, int button); + void mouseReleased(int x, int y, int button); + void windowResized(int w, int h); + void dragEvent(ofDragInfo dragInfo); + void gotMessage(ofMessage msg); + +}; + diff --git a/rayhit/rayhit.layout b/rayhit/rayhit.layout index 52f6b25..63b7198 100644 --- a/rayhit/rayhit.layout +++ b/rayhit/rayhit.layout @@ -11,7 +11,7 @@ - + diff --git a/rayhit/src/testApp.cpp b/rayhit/src/testApp.cpp index 78a3890..392e84d 100644 --- a/rayhit/src/testApp.cpp +++ b/rayhit/src/testApp.cpp @@ -2,15 +2,26 @@ //-------------------------------------------------------------- void testApp::setup(){ - ofVec3f centre=ofVec3f(ofGetWidth()/2,0,0); + ofVec3f centre=ofVec3f(ofGetWidth()/2,0,0); //ofGetHeight(),0); ofVec3f normal=ofVec3f(0,0,-1); ray=ofRay(); plane=ofPlane(centre,normal); plane.color=ofColor(255,255,255); - //Projector::Projector(float throwRatio, const ofVec2f& lensOffset, int width, int height) + //setup that works for a new camera. but can we match the existing camera, must be possible! + /* + projector=ofProjector(1.535f, ofVec2f(0.0f, 0.5f),ofGetWidth(),ofGetHeight()); projector.setPosition(ofGetWidth()/2,ofGetHeight()/2,ofGetHeight()); + */ + + //Projector::Projector(float throwRatio, const ofVec2f& lensOffset, int width, int height) + + projector=ofProjector(2.0f, ofVec2f(0.0f, 0.0f),ofGetWidth(),ofGetHeight()); //1.535f + projector.setPosition(ofGetWidth()/2,ofGetHeight()/2,-ofGetWidth()); + projector.lookAt(ofVec3f(ofGetWidth()/2,ofGetHeight()/2,0),ofVec3f(0, -1, 0)); + + pos=ofVec3f(ofGetWidth()/2,ofGetHeight()/2,0); @@ -38,7 +49,7 @@ void testApp::update(){ void testApp::draw(){ ofBackground(0,0,0); - cam.begin(); + //cam.begin(); plane.draw(); @@ -61,7 +72,7 @@ void testApp::draw(){ ofPopMatrix(); - ofSphere(pos.x,pos.y,pos.z,2); + ofSphere(pos.x,pos.y,pos.z,20); /* for (int j=0;j