mirror of
https://github.com/JulianGro/overte.git
synced 2025-04-25 17:14:59 +02:00
leftover changes / minor corrections
This commit is contained in:
parent
4444bcf26e
commit
5de3ec035b
4 changed files with 60 additions and 12 deletions
|
@ -54,6 +54,7 @@ find_package(OpenGL REQUIRED)
|
|||
find_package(GLUT REQUIRED)
|
||||
find_package(GLM REQUIRED)
|
||||
find_package(LodePNG REQUIRED)
|
||||
find_package(CURL REQUIRED)
|
||||
|
||||
# include headers for external libraries and InterfaceConfig.
|
||||
include_directories(
|
||||
|
@ -62,6 +63,7 @@ include_directories(
|
|||
${GLUT_INCLUDE_DIR}
|
||||
${GLM_INCLUDE_DIRS}
|
||||
${LODEPNG_INCLUDE_DIRS}
|
||||
${CURL_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
# link target to external libraries
|
||||
|
@ -69,6 +71,7 @@ target_link_libraries(interface
|
|||
${OPENGL_LIBRARY}
|
||||
${GLUT_LIBRARY}
|
||||
${LODEPNG_LIBRARY}
|
||||
${CURL_LIBRARY}
|
||||
)
|
||||
|
||||
if (WIN32)
|
||||
|
@ -117,4 +120,4 @@ endif (UNIX AND NOT APPLE)
|
|||
INSTALL(TARGETS interface
|
||||
BUNDLE DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/install COMPONENT Runtime
|
||||
RUNTIME DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/install COMPONENT Runtime
|
||||
)
|
||||
)
|
||||
|
|
|
@ -1,3 +1,12 @@
|
|||
#
|
||||
# gen_stars.py
|
||||
# interface
|
||||
#
|
||||
# Created by Tobias Schwinger on 3/22/13.
|
||||
# Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||
#
|
||||
|
||||
# Input file generator for the starfield.
|
||||
|
||||
from random import random,randint
|
||||
from sys import argv
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// FieldOfView.cpp
|
||||
// FieldOfView.h
|
||||
// interface
|
||||
//
|
||||
// Created by Tobias Schwinger on 3/21/13.
|
||||
|
|
|
@ -35,10 +35,15 @@
|
|||
#include <pthread.h>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtc/type_ptr.hpp>
|
||||
|
||||
#include "Field.h"
|
||||
#include "world.h"
|
||||
#include "Util.h"
|
||||
#include "Audio.h"
|
||||
#include "FieldOfView.h"
|
||||
#include "Stars.h"
|
||||
#include "Head.h"
|
||||
#include "Hand.h"
|
||||
#include "Particle.h"
|
||||
|
@ -54,7 +59,7 @@
|
|||
|
||||
using namespace std;
|
||||
|
||||
int audio_on = 1; // Whether to turn on the audio support
|
||||
int audio_on = 0; // Whether to turn on the audio support
|
||||
int simulate_on = 1;
|
||||
|
||||
//
|
||||
|
@ -93,6 +98,10 @@ Oscilloscope audioScope(256,200,true);
|
|||
#define HAND_RADIUS 0.25 // Radius of in-world 'hand' of you
|
||||
Head myHead; // The rendered head of oneself
|
||||
|
||||
#define USE_FOV
|
||||
FieldOfView fov;
|
||||
|
||||
Stars stars;
|
||||
|
||||
glm::vec3 box(WORLD_SIZE,WORLD_SIZE,WORLD_SIZE);
|
||||
ParticleSystem balls(0,
|
||||
|
@ -329,7 +338,9 @@ void init(void)
|
|||
head_mouse_y = HEIGHT/2;
|
||||
head_lean_x = WIDTH/2;
|
||||
head_lean_y = HEIGHT/2;
|
||||
|
||||
|
||||
stars.readInput("file://stars.txt");
|
||||
|
||||
// Initialize Field values
|
||||
field = Field();
|
||||
printf( "Field Initialized.\n" );
|
||||
|
@ -564,14 +575,29 @@ void display(void)
|
|||
glMateriali(GL_FRONT, GL_SHININESS, 96);
|
||||
|
||||
// Rotate, translate to camera location
|
||||
#ifdef USE_FOV
|
||||
fov.setOrientation(
|
||||
glm::rotate(glm::rotate(glm::translate(glm::mat4(1.0f),
|
||||
glm::vec3(-location[0], -location[1], -location[2])),
|
||||
-myHead.getRenderYaw(), glm::vec3(0.0f,1.0f,0.0f)),
|
||||
-myHead.getRenderPitch(), glm::vec3(1.0f,0.0f,0.0f)) );
|
||||
|
||||
glLoadMatrixf( glm::value_ptr(fov.getWorldViewerXform()) );
|
||||
#else
|
||||
glRotatef(myHead.getRenderPitch(), 1, 0, 0);
|
||||
glRotatef(myHead.getRenderYaw(), 0, 1, 0);
|
||||
glTranslatef(location[0], location[1], location[2]);
|
||||
|
||||
#endif
|
||||
|
||||
glDisable(GL_LIGHTING);
|
||||
glDisable(GL_DEPTH_TEST);
|
||||
stars.render(fov);
|
||||
glEnable(GL_LIGHTING);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
|
||||
glColor3f(1,0,0);
|
||||
glutSolidSphere(0.25, 15, 15);
|
||||
|
||||
|
||||
// Draw cloud of dots
|
||||
glDisable( GL_POINT_SPRITE_ARB );
|
||||
glDisable( GL_TEXTURE_2D );
|
||||
|
@ -684,6 +710,7 @@ void display(void)
|
|||
framecount++;
|
||||
}
|
||||
|
||||
const float KEYBOARD_PITCH_RATE = 0.8;
|
||||
const float KEYBOARD_YAW_RATE = 0.8;
|
||||
const float KEYBOARD_STRAFE_RATE = 0.03;
|
||||
const float KEYBOARD_FLY_RATE = 0.08;
|
||||
|
@ -741,6 +768,8 @@ void key(unsigned char k, int x, int y)
|
|||
if (k == ' ') reset_sensors();
|
||||
if (k == 'a') render_yaw_rate -= KEYBOARD_YAW_RATE;
|
||||
if (k == 'd') render_yaw_rate += KEYBOARD_YAW_RATE;
|
||||
if (k == 't') render_pitch_rate += KEYBOARD_PITCH_RATE;
|
||||
if (k == 'g') render_pitch_rate -= KEYBOARD_PITCH_RATE;
|
||||
if (k == 'o') simulate_on = !simulate_on;
|
||||
if (k == 'p')
|
||||
{
|
||||
|
@ -820,19 +849,26 @@ void reshape(int width, int height)
|
|||
{
|
||||
WIDTH = width;
|
||||
HEIGHT = height;
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
|
||||
glMatrixMode(GL_PROJECTION); //hello
|
||||
#ifdef USE_FOV
|
||||
fov.setResolution(width, height)
|
||||
.setFrustum(glm::vec3(-0.5f,-0.5f,-50.0f), glm::vec3(0.5f, 0.5f, 0.1f) )
|
||||
.setPerspective(0.78f);
|
||||
|
||||
glLoadMatrixf(glm::value_ptr(fov.getViewerScreenXform()));
|
||||
#else
|
||||
|
||||
glLoadIdentity();
|
||||
gluPerspective(45, //view angle
|
||||
1.0, //aspect ratio
|
||||
0.1, //near clip
|
||||
50.0);//far clip
|
||||
1.0, //aspect ratio
|
||||
0.1, //near clip
|
||||
50.0);//far clip
|
||||
#endif
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glLoadIdentity();
|
||||
|
||||
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
void mouseFunc( int button, int state, int x, int y )
|
||||
|
|
Loading…
Reference in a new issue