Mercurial > hg > ccmieditor
view native/PhantomOmni/utils.cpp @ 6:1c5af356bb99
added 64 bit native narrator
allow hapitic native dll to load only on 32 bit JVM
refactored DiagramEditorApp for better inheritance
fixed Java 7 bug: NullPointerException when typing
minor bug fixes
added splashscreen
author | Fiore Martin <fiore@eecs.qmul.ac.uk> |
---|---|
date | Mon, 17 Dec 2012 18:39:40 +0000 |
parents | 9e67171477bc |
children |
line wrap: on
line source
#include "utils.h" void checkExceptions(JNIEnv *env, char* what){ if(env->ExceptionOccurred()){ std::cout << "Exception occurred!!!" << std::endl; std::cout << what << std::endl; env->ExceptionDescribe(); exit(-1); } } void stopExecution(char* msg){ std::cerr << msg << std::endl; exit(-1); } bool fromScreen(const hduVector3Dd &win, hduVector3Dd &obj) { hduMatrix m_worldTview; hduMatrix m_viewTclip; int m_viewport[4]; glGetDoublev(GL_MODELVIEW_MATRIX, m_worldTview); glGetDoublev(GL_PROJECTION_MATRIX, m_viewTclip); glGetIntegerv(GL_VIEWPORT, m_viewport); int nResult = gluUnProject( win[0], win[1], win[2], m_worldTview, m_viewTclip, m_viewport, &obj[0], &obj[1], &obj[2]); return nResult == GL_TRUE; } bool toScreen(const hduVector3Dd &obj, hduVector3Dd &win) { hduMatrix m_worldTview; hduMatrix m_viewTclip; int m_viewport[4]; glGetDoublev(GL_MODELVIEW_MATRIX, m_worldTview); glGetDoublev(GL_PROJECTION_MATRIX, m_viewTclip); glGetIntegerv(GL_VIEWPORT, m_viewport); int nResult = gluProject( obj[0], obj[1], obj[2], m_worldTview, m_viewTclip, m_viewport, &win[0], &win[1], &win[2]); return nResult == GL_TRUE; } HDdouble norm(HDdouble v[3]){ return sqrt( (v[0]*v[0])+(v[1]*v[1])+(v[2]*v[2])); } void print(char* str){ std::cout << str << std::endl; } void print(int str){ std::cout << str << std::endl; } float rotate(){ static float rot = 0.0f; rot += 0.5f; if(rot > 360) rot = 0; return rot; }