fixed for Mac in examples

This commit is contained in:
Erwin Coumans 2015-04-16 15:52:30 -07:00
parent ffb0cab2e7
commit b2ba615874
9 changed files with 46 additions and 13 deletions

View File

@ -5,7 +5,7 @@
#include "../OpenGLWindow/SimpleOpenGL3App.h" #include "../OpenGLWindow/SimpleOpenGL3App.h"
#include "../CommonInterfaces/CommonRenderInterface.h" #include "../CommonInterfaces/CommonRenderInterface.h"
#ifdef __APPLE__ #ifdef __APPLE__
#include "OpenGLWindow/MacOpenGLWindow.h" #include "../OpenGLWindow/MacOpenGLWindow.h"
#else #else
#ifdef _WIN32 #ifdef _WIN32
#include "../OpenGLWindow/Win32OpenGLWindow.h" #include "../OpenGLWindow/Win32OpenGLWindow.h"

View File

@ -1,7 +1,7 @@
#include "ImportObjExample.h" #include "ImportObjExample.h"
#include <vector> #include <vector>
#include "../OpenGLWindow/GLInstancingRenderer.h" #include "../OpenGLWindow/GLInstancingRenderer.h"
#include"../Wavefront/tiny_obj_loader.h" #include"Wavefront/tiny_obj_loader.h"
#include "../OpenGLWindow/GLInstanceGraphicsShape.h" #include "../OpenGLWindow/GLInstanceGraphicsShape.h"
#include "btBulletDynamicsCommon.h" #include "btBulletDynamicsCommon.h"
#include "../OpenGLWindow/SimpleOpenGL3App.h" #include "../OpenGLWindow/SimpleOpenGL3App.h"

View File

@ -1,5 +1,5 @@
#include "LoadMeshFromObj.h" #include "LoadMeshFromObj.h"
#include"../Wavefront/tiny_obj_loader.h" #include"Wavefront/tiny_obj_loader.h"
#include "../OpenGLWindow/GLInstanceGraphicsShape.h" #include "../OpenGLWindow/GLInstanceGraphicsShape.h"
#include <stdio.h> //fopen #include <stdio.h> //fopen
#include "Bullet3Common/b3AlignedObjectArray.h" #include "Bullet3Common/b3AlignedObjectArray.h"

View File

@ -1,7 +1,7 @@
#ifndef WAVEFRONT2GRAPHICS_H #ifndef WAVEFRONT2GRAPHICS_H
#define WAVEFRONT2GRAPHICS_H #define WAVEFRONT2GRAPHICS_H
#include"../Wavefront/tiny_obj_loader.h" #include"Wavefront/tiny_obj_loader.h"
#include <vector> #include <vector>
struct GLInstanceGraphicsShape* btgCreateGraphicsShapeFromWavefrontObj(std::vector<tinyobj::shape_t>& shapes); struct GLInstanceGraphicsShape* btgCreateGraphicsShapeFromWavefrontObj(std::vector<tinyobj::shape_t>& shapes);

View File

@ -1,7 +1,7 @@
#ifndef MAC_OPENGL_WINDOW_H #ifndef MAC_OPENGL_WINDOW_H
#define MAC_OPENGL_WINDOW_H #define MAC_OPENGL_WINDOW_H
#include "b3gWindowInterface.h" #include "../CommonInterfaces/CommonWindowInterface.h"
#define b3gDefaultOpenGLWindow MacOpenGLWindow #define b3gDefaultOpenGLWindow MacOpenGLWindow
@ -40,6 +40,8 @@ public:
void runMainLoop(); void runMainLoop();
virtual bool isModifiedKeyPressed(int key);
void setMouseButtonCallback(b3MouseButtonCallback mouseCallback) void setMouseButtonCallback(b3MouseButtonCallback mouseCallback)
{ {
m_mouseButtonCallback = mouseCallback; m_mouseButtonCallback = mouseCallback;
@ -52,6 +54,7 @@ public:
void setResizeCallback(b3ResizeCallback resizeCallback); void setResizeCallback(b3ResizeCallback resizeCallback);
void setKeyboardCallback( b3KeyboardCallback keyboardCallback) void setKeyboardCallback( b3KeyboardCallback keyboardCallback)
{ {
m_keyboardCallback = keyboardCallback; m_keyboardCallback = keyboardCallback;

View File

@ -222,6 +222,35 @@ MacOpenGLWindow::~MacOpenGLWindow()
} }
bool MacOpenGLWindow::isModifiedKeyPressed(int key)
{
bool isPressed = false;
switch (key)
{
case B3G_ALT:
{
isPressed = ((m_modifierFlags && NSAlternateKeyMask)!=0);
break;
};
case B3G_SHIFT:
{
isPressed = ((m_modifierFlags && NSShiftKeyMask)!=0);
break;
};
case B3G_CONTROL:
{
isPressed = ((m_modifierFlags && NSControlKeyMask )!=0);
break;
};
default:
{
}
};
return isPressed;
}
float MacOpenGLWindow::getTimeInSeconds() float MacOpenGLWindow::getTimeInSeconds()
{ {
return 0.f; return 0.f;

View File

@ -47,11 +47,11 @@ struct RaytracerPhysicsSetup : public ExampleInterface
///lowlevelRaytest performs a ray versus convex shape, returning true is a hit is found (filling in worldNormal and worldHitPoint) ///lowlevelRaytest performs a ray versus convex shape, returning true is a hit is found (filling in worldNormal and worldHitPoint)
bool lowlevelRaytest(const btVector3& rayFrom,const btVector3& rayTo,btVector3& worldNormal,btVector3& worldHitPoint); bool lowlevelRaytest(const btVector3& rayFrom,const btVector3& rayTo,btVector3& worldNormal,btVector3& worldHitPoint);
virtual bool RaytracerPhysicsSetup::mouseMoveCallback(float x,float y); virtual bool mouseMoveCallback(float x,float y);
virtual bool RaytracerPhysicsSetup::mouseButtonCallback(int button, int state, float x, float y); virtual bool mouseButtonCallback(int button, int state, float x, float y);
virtual bool RaytracerPhysicsSetup::keyboardCallback(int key, int state); virtual bool keyboardCallback(int key, int state);
virtual void renderScene() virtual void renderScene()
{ {

View File

@ -4,6 +4,7 @@
#include <stdio.h> #include <stdio.h>
#include "b3Scalar.h" #include "b3Scalar.h"
#include <stddef.h>//ptrdiff_h #include <stddef.h>//ptrdiff_h
#include <string>
struct b3FileUtils struct b3FileUtils
{ {