Skip to content
Snippets Groups Projects
Commit 0add5aeb authored by Sean Radigan's avatar Sean Radigan
Browse files

Merged in ExportOculus (pull request #45)

Exports for smRenderingOculus and fixed oculus examples
parents bdeb66e0 b04e57e7
No related branches found
No related tags found
No related merge requests found
......@@ -45,8 +45,6 @@ endif()
include(SimMedTKMacros)
simmedtk_find_package(GLUT REQUIRED)
if(USE_PHANTOM_OMNI)
simmedtk_find_package(OpenHaptics)
endif()
......
......@@ -229,20 +229,28 @@ endif()
set(CMAKE_CXX_FLAGS ${SimMedTK_CXX_FLAGS} CACHE STRING "CMake C Flags" FORCE)
set(CMAKE_C_FLAGS ${SimMedTK_C_FLAGS} CACHE STRING "CMake CXX Flags" FORCE)
set(SimMedTK_exports
smCore
smCollision
smExternal
smExternalDevices
smGeometry
smMesh
smRendering
smShader
smSimulators
smTools
smUtilities
smEvent)
if(SimMedTK_USE_OCULUS)
list(APPEND SimMedTK_exports smRenderingOculus)
endif()
add_subdirectory(src)
export(PACKAGE SimMedTK)
export(TARGETS smCore
smCollision
smExternal
smExternalDevices
smGeometry
smMesh
smRendering
smShader
smSimulators
smTools
smUtilities
smEvent
export(TARGETS
${SimMedTK_exports}
FILE "${CMAKE_CURRENT_BINARY_DIR}/SimMedTKTargets.cmake"
NAMESPACE smtk::
EXPORT_LINK_INTERFACE_LIBRARIES
......
......@@ -28,6 +28,7 @@
#include "smCore/smSDK.h"
#include "smCore/smTextureManager.h"
#include "smGeometry/smMeshModel.h"
#include "smRendering/smOculusViewer.h"
int main()
......@@ -55,20 +56,14 @@ int main()
camCtl = std::make_shared<smtk::Examples::Common::wasdCameraController>();
keyShutdown = std::make_shared<smtk::Examples::Common::KeyPressSDKShutdown>();
//Initialize the texture manager
smTextureManager::init(sdk->getErrorLog());
auto cubeModel = std::make_shared<smMeshModel>();
cubeModel->load("models/cube.obj", "textures/cube.png", "cubetex");
//Load in the texture for the cube model
smTextureManager::loadTexture("textures/cube.png", "cubetex");
auto renderDetail = std::make_shared<smRenderDetail>(SIMMEDTK_RENDER_FACES | SIMMEDTK_RENDER_TEXTURE);
cubeModel->setRenderDetail(renderDetail);
cube = std::make_shared<smStaticSceneObject>();
//Load the cube model
cube->mesh->loadMesh("models/cube.obj", SM_FILETYPE_OBJ);
//Assign the previously loaded texture to the cube model
cube->mesh->assignTexture("cubetex");
//Tell SimMedTK to render the faces of the model, and the texture assigned
cube->mesh->getRenderDetail()->renderType = (SIMMEDTK_RENDER_FACES | SIMMEDTK_RENDER_TEXTURE);
cube->setModel(cubeModel);
//Add the cube to the scene to be rendered
scene1->addSceneObject(cube);
......
......@@ -29,6 +29,7 @@
#include "smCore/smSDK.h"
#include "smCore/smTextureManager.h"
#include "smRendering/smOculusViewer.h"
#include "smCollision/smMeshCollisionModel.h"
int main()
{
......@@ -56,43 +57,39 @@ int main()
camCtl = std::make_shared<smtk::Examples::Common::wasdCameraController>();
keyShutdown = std::make_shared<smtk::Examples::Common::KeyPressSDKShutdown>();
//Initialize the texture manager
smTextureManager::init(sdk->getErrorLog());
auto cubeModel = std::make_shared<smMeshModel>();
cubeModel->load("models/cube.obj", "textures/cube.png", "cubetex");
//Load in the texture for the cube model
smTextureManager::loadTexture("textures/cube.png", "cubetex");
auto renderDetail = std::make_shared<smRenderDetail>(SIMMEDTK_RENDER_FACES | SIMMEDTK_RENDER_TEXTURE);
cubeModel->setRenderDetail(renderDetail);
//setup scene1
cube = std::make_shared<smStaticSceneObject>();
//Load the cube model
cube->mesh->loadMesh("models/cube.obj", SM_FILETYPE_OBJ);
//Assign the previously loaded texture to the cube model
cube->mesh->assignTexture("cubetex");
//Tell SimMedTK to render the faces of the model, and the texture assigned
cube->mesh->getRenderDetail()->renderType = (SIMMEDTK_RENDER_FACES | SIMMEDTK_RENDER_TEXTURE);
cube->setModel(cubeModel);
//Add the cube to the scene to be rendered
scene1->addSceneObject(cube);
//setup scene2
//Create a color and depth texture for the FBO
smTextureManager::createColorTexture("colorTex1", 64, 64);
smTextureManager::createDepthTexture("depthTex1", 64, 64);
std::shared_ptr<smMeshModel> squareModel = std::make_shared<smMeshModel>();
squareModel->load("models/square.obj", SM_FILETYPE_OBJ);
squareModel->getMesh()->assignTexture("colorTex1");
renderDetail= std::make_shared<smRenderDetail>(SIMMEDTK_RENDER_FACES | SIMMEDTK_RENDER_TEXTURE);
squareModel->setRenderDetail(renderDetail);
square = std::make_shared<smStaticSceneObject>();
square->setModel(squareModel);
//Setup an FBO for rendering in the viewer.
//Create a color and depth texture for the FBO
smTextureManager::createColorTexture("colorTex1", 64, 64);
smTextureManager::createDepthTexture("depthTex1", 64, 64);
//Add the FBO and textures to the viewer
viewer->addFBO("fbo1",
smTextureManager::getTexture("colorTex1"),
smTextureManager::getTexture("depthTex1"),
64, 64);
square->mesh->loadMesh("models/square.obj", SM_FILETYPE_OBJ);
square->mesh->assignTexture("colorTex1");
square->mesh->getRenderDetail()->renderType = (SIMMEDTK_RENDER_FACES | SIMMEDTK_RENDER_TEXTURE);
//Add the square to the scene
scene2->addSceneObject(square);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment