Skip to content

Commit

Permalink
Merge pull request #21 from geefr/models-and-controller-positioning
Browse files Browse the repository at this point in the history
Models and controller positioning
  • Loading branch information
geefr authored Nov 30, 2022
2 parents 4de4e19 + 663ad37 commit 7e56043
Show file tree
Hide file tree
Showing 20 changed files with 19,861 additions and 12,485 deletions.
34 changes: 12 additions & 22 deletions examples/generic/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#include <iostream>
#include <algorithm>

#include "../../models/controller/controller.cpp"
#include "../../models/controller/controller2.cpp"
#include "../../models/world/world.cpp"

int main(int argc, char **argv) {
try
{
Expand All @@ -21,24 +25,12 @@ int main(int argc, char **argv) {
auto options = vsg::Options::create();
arguments.read(options);

vsg::Path filename = "world.vsgt";
if (argc > 1)
filename = arguments[1];
if (arguments.errors())
return arguments.writeErrorMessages(std::cerr);

// load the scene graph
vsg::ref_ptr<vsg::Group> vsg_scene =
vsg::read_cast<vsg::Group>(filename, options);
if (!vsg_scene)
return 0;
auto vsg_scene = vsg::Group::create();
vsg_scene->addChild(world());

auto controllerNodeLeft = vsg::MatrixTransform::create();
controllerNodeLeft->addChild(vsg::read_cast<vsg::Node>("controller.vsgt"));
auto controllerNodeLeft = controller();
vsg_scene->addChild(controllerNodeLeft);

auto controllerNodeRight = vsg::MatrixTransform::create();
controllerNodeRight->addChild(vsg::read_cast<vsg::Node>("controller2.vsgt"));
auto controllerNodeRight = controller2();
vsg_scene->addChild(controllerNodeRight);

// Initialise OpenXR
Expand All @@ -54,13 +46,11 @@ int main(int argc, char **argv) {
arguments.read("--screen", windowTraits->screenNum);
arguments.read("--display", windowTraits->display);

// Initialise OpenXR, and retrieve vulkan requirements
// OpenXR will require certain vulkan versions, along with a specific physical device
// Use a desktop window to create the instance, and select the correct device
// Retrieve vulkan requirements
// OpenXR will require certain vulkan versions, along with a specific physical device, and instance/device extensions
auto xrInstance = vsgvr::OpenXRInstance::create(xrTraits);
auto xrVulkanReqs = vsgvr::OpenXRGraphicsBindingVulkan::getVulkanRequirements(xrInstance);

// Validate the Vulkan instance, and re-create the instance with the required extensions

if (windowTraits->vulkanVersion < xrVulkanReqs.minVersion)
{
std::cout << "Vulkan API too low for OpenXR. Minimum required is " << xrVulkanReqs.minVersionStr << std::endl;
Expand Down Expand Up @@ -150,7 +140,7 @@ int main(int argc, char **argv) {
// Instead, create a standard perspective camera and bind it to the hmd's position - This looks better on the desktop window anyway

// set up the camera
auto lookAt = vsg::LookAt::create();
auto lookAt = vsg::LookAt::create(vsg::dvec3(-4.0, -15.0, 25.0), vsg::dvec3(0.0, 0.0, 0.0), vsg::dvec3(0.0, 0.0, 1.0));
auto perspective = vsg::Perspective::create(30.0, static_cast<double>(desktopWindow->extent2D().width) / static_cast<double>(desktopWindow->extent2D().height), 0.1, 100.0);
auto desktopCamera = vsg::Camera::create(perspective, lookAt, vsg::ViewportState::create(desktopWindow->extent2D()));
auto desktopCommandGraph = vsg::createCommandGraphForView(desktopWindow, desktopCamera, vsg_scene);
Expand Down
925 changes: 0 additions & 925 deletions examples/questnative/app/cpp/controller.cpp

This file was deleted.

925 changes: 0 additions & 925 deletions examples/questnative/app/cpp/controller2.cpp

This file was deleted.

6 changes: 3 additions & 3 deletions examples/questnative/app/cpp/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#include <vsgvr/actions/OpenXRActionPoseBinding.h>
#include <openxr/openxr_platform.h>

#include "controller.cpp"
#include "controller2.cpp"
#include "world.cpp"
#include "../../../../models/controller/controller.cpp"
#include "../../../../models/controller/controller2.cpp"
#include "../../../../models/world/world.cpp"

#define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, "vsgnative", __VA_ARGS__))
#define LOGW(...) ((void)__android_log_print(ANDROID_LOG_WARN, "vsgnative", __VA_ARGS__))
Expand Down
8,889 changes: 0 additions & 8,889 deletions examples/questnative/app/cpp/world.cpp

This file was deleted.

Binary file modified models/controller/controller.blend
Binary file not shown.
2,118 changes: 2,118 additions & 0 deletions models/controller/controller.cpp

Large diffs are not rendered by default.

Binary file modified models/controller/controller.glb
Binary file not shown.
Loading

0 comments on commit 7e56043

Please sign in to comment.