summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bin/data/settings.xml2
-rw-r--r--map4.layout2
-rw-r--r--src/main.cpp2
-rw-r--r--src/testApp.cpp62
-rw-r--r--src/testApp.h7
5 files changed, 58 insertions, 17 deletions
diff --git a/bin/data/settings.xml b/bin/data/settings.xml
index 1804f5e..7a88929 100644
--- a/bin/data/settings.xml
+++ b/bin/data/settings.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" ?>
-<map4>
+<map4 model="tigerbottle.3DS" x="0" y="101" z="0">
<view>
<settings x="0.000000" y="0.000000" w="0.500000" h="1.000000" distort="0.000000" fov="17.250000" roll="90.294998" targX="20.669331" targY="112.000000" targZ="0.000000" lat="37.926994" lng="-41.419994" dolly="886.637329" />
</view>
diff --git a/map4.layout b/map4.layout
index 9ee2048..98f5fcf 100644
--- a/map4.layout
+++ b/map4.layout
@@ -26,7 +26,7 @@
<Cursor position="165" topLine="0" />
</File>
<File name="src/testApp.cpp" open="1" top="1" tabpos="2">
- <Cursor position="807" topLine="6" />
+ <Cursor position="637" topLine="6" />
</File>
<File name="src/testApp.h" open="1" top="0" tabpos="1">
<Cursor position="1326" topLine="31" />
diff --git a/src/main.cpp b/src/main.cpp
index d8de5c8..7391c9e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -17,7 +17,7 @@
int main( ){
ofAppGlutWindow window;
- ofSetupOpenGL(&window, 1440,900, OF_FULLSCREEN); // <-------- setup the GL context
+ ofSetupOpenGL(&window, 2048,768, OF_FULLSCREEN); // <-------- setup the GL context
//ofSetupOpenGL(&window, 1024,300, OF_WINDOW);
glutIgnoreKeyRepeat(1);
glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF); //these don't work!!!
diff --git a/src/testApp.cpp b/src/testApp.cpp
index c2772aa..6f8b00f 100644
--- a/src/testApp.cpp
+++ b/src/testApp.cpp
@@ -6,6 +6,8 @@ testApp::~testApp(){
//--------------------------------------------------------------
void testApp::setup(){
+ loadSettings("settings.xml");
+
ofBackground(0,0,0);
///ofSetVerticalSync(true);
@@ -16,16 +18,21 @@ void testApp::setup(){
glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE);
glEnable (GL_COLOR_MATERIAL);
+ printf("loading %s at %f,%f,%f",model_name.c_str(),model_x,model_y,model_z);
+
//load the bottle model - the 3ds and the texture file need to be in the same folder
- bottle.loadModel("tigerbottle.3DS", 1);
- bottle.setRotation(0, 180, 1, 0, 0);
- bottle.setPosition(0, 101, 0);
+
+ model.loadModel(model_name, 1);
+ model.setRotation(0, 180, 1, 0, 0);
+ //model.setRotation(0, 90, 0, 1, 0);
+ model.setPosition(model_x, model_y, model_z);
+
//ofDisableArbTex();
mode=DISPLAY;
- loadSettings("settings.xml");
+
whichClip=0;
texture.loadMovie(clips[whichClip]);
@@ -54,11 +61,17 @@ void testApp::draw(){
switch(mode) {
case CALIBRATE:
drawBoard(0,225,0);
- bottle.draw();
+ ofPushMatrix();
+ ofRotate(90,0,1,0);
+ model.draw();
+ ofPopMatrix();
break;
case DISPLAY:
bindTexture(texture);
- bottle.draw();
+ ofPushMatrix();
+ ofRotate(90,0,1,0);
+ model.draw();
+ ofPopMatrix();
unbindTexture(texture);
break;
case NOTHING:
@@ -82,6 +95,15 @@ void testApp::keyPressed(int key){
if (activeView<0) for (int i=0;i<numViews;i++) views[i].keyPressed(key);
else if (activeView<numViews) views[activeView].keyPressed(key);
switch (key) {
+ //'vertigo effect' always affects ALL VIEWPOINTS
+ case 'i':
+ for (int i=0;i<numViews;i++) views[i].keyPressed('o');
+ for (int i=0;i<numViews;i++) views[i].keyPressed('s');
+ break;
+ case 'k':
+ for (int i=0;i<numViews;i++) views[i].keyPressed('l');
+ for (int i=0;i<numViews;i++) views[i].keyPressed('w');
+ break;
case '8':
mode=CALIBRATE;
break;
@@ -125,15 +147,34 @@ void testApp::keyPressed(int key){
light=!light;
printf(light?"LIGHT ON\n":"LIGHT OFF\n");
break;
-
}
-
}
+//--------------------------------------------------------------
+void testApp::keyReleased(int key){
+ if (activeView<0) for (int i=0;i<numViews;i++) views[i].keyReleased(key);
+ else if (activeView<numViews) views[activeView].keyReleased(key);
+ switch (key) {
+ //'vertigo effect' always affects ALL VIEWPOINTS
+ case 'i':
+ for (int i=0;i<numViews;i++) views[i].keyReleased('o');
+ for (int i=0;i<numViews;i++) views[i].keyReleased('s');
+ break;
+ case 'k':
+ for (int i=0;i<numViews;i++) views[i].keyReleased('l');
+ for (int i=0;i<numViews;i++) views[i].keyReleased('w');
+ break;
+ }
+}
+
void testApp::loadSettings(string filename){
//viewport settings are float/ normalised to 0..1
if( !XML.loadFile(filename) ){
printf("unable to load %s check data/ folder\n",filename.c_str());
}else{
+ model_name=XML.getAttribute("map4","model","none",0);
+ model_x=ofToFloat(XML.getAttribute("map4","x","none",0));
+ model_y=ofToFloat(XML.getAttribute("map4","y","none",0));
+ model_z=ofToFloat(XML.getAttribute("map4","z","none",0));
if(XML.pushTag("map4")) {
numViews=XML.getNumTags("view");
if(numViews) {
@@ -196,11 +237,6 @@ void testApp::saveSettings(string filename){
XML.saveFile(filename);
printf("saved %s\n",filename.c_str());
}
-//--------------------------------------------------------------
-void testApp::keyReleased(int key){
- if (activeView<0) for (int i=0;i<numViews;i++) views[i].keyReleased(key);
- else if (activeView<numViews) views[activeView].keyReleased(key);
-}
//--------------------------------------------------------------
void testApp::mouseMoved(int x, int y ){
diff --git a/src/testApp.h b/src/testApp.h
index 63e922d..2ed8732 100644
--- a/src/testApp.h
+++ b/src/testApp.h
@@ -51,7 +51,12 @@ class testApp : public ofBaseApp{
void dragEvent(ofDragInfo dragInfo);
void gotMessage(ofMessage msg);
- ofx3DModelLoader bottle;
+ string model_name;
+ float model_x;
+ float model_y;
+ float model_z;
+
+ ofx3DModelLoader model;
ofVideoPlayer texture;
string* clips;