Skip to content
Permalink
Browse files

EqPly: added --immersive option to use in VR mode

  • Loading branch information...
Raphael Dumusc
Raphael Dumusc committed Jun 1, 2018
1 parent 6983f2e commit 7f4c98d67cd4f05038d7be6977a2301f63935bcb
@@ -3,6 +3,9 @@ Changelog {#Changelog}

# git master

* [644](https://github.com/Eyescale/Equalizer/pull/644)
EqPly: new --immersive command line option to render a model in real-world
units in a VR environement.
* [632](https://github.com/Eyescale/Equalizer/pull/632)
Add uxmal: A ZeroBuf vocabulary and application for LOD and cull debugging

@@ -90,6 +90,12 @@ bool Config::init()
_loadModels();
_registerModels();

if (_initData.centerCamera())
{
_frameData.setCameraPosition(eq::Vector3f::zero());
_frameData.setModelRotation(eq::Vector3f::zero());
}

const eq::Canvases& canvases = getCanvases();
if (canvases.empty())
_currentCanvas = 0;
@@ -144,6 +150,8 @@ void Config::_loadModels()

if (_initData.useInvertedFaces())
model->useInvertedFaces();
if (!_initData.rescaleModels())
model->disableRescaling();

if (!model->readFromFile(filename.c_str()))
{
@@ -254,7 +262,7 @@ void Config::_updateData()
_frameData.setRotation(curStep.rotation);
_frameData.setCameraPosition(curStep.position);
}
else
else if (_initData.useCameraAnimation())
{
if (_frameData.usePilotMode())
_frameData.spinCamera(-0.001f * _spinX, -0.001f * _spinY);
@@ -49,6 +49,9 @@ LocalInitData::LocalInitData()
, _color(true)
, _isResident(false)
, _ignoreNoConfig(false)
, _centerCamera(false)
, _disableRescaling(false)
, _disableAnimation(false)
{
_filenames.push_back(lunchbox::getRootPath() + "/share/Equalizer/data");
}
@@ -61,6 +64,9 @@ LocalInitData& LocalInitData::operator=(const LocalInitData& from)
_filenames = from._filenames;
_pathFilename = from._pathFilename;
_ignoreNoConfig = from._ignoreNoConfig;
_centerCamera = from._centerCamera;
_disableRescaling = from._disableRescaling;
_disableAnimation = from._disableAnimation;

setWindowSystem(from.getWindowSystem());
setRenderMode(from.getRenderMode());
@@ -102,6 +108,7 @@ void LocalInitData::parseArguments(const int argc, char** argv)
bool userDefinedInvertFaces(false);
bool userDefinedDisableLogo(false);
bool userDefinedDisableROI(false);
bool userDefinedUseImmersiveMode(false);

const std::string& desc = EqPly::getHelp();
po::options_description options(desc + " Version " +
@@ -136,7 +143,18 @@ void LocalInitData::parseArguments(const int argc, char** argv)
"Disable overlay logo")(
"disableROI,d",
po::bool_switch(&userDefinedDisableROI)->default_value(false),
"Disable region of interest (ROI)");
"Disable region of interest (ROI)")(
"immersive",
po::bool_switch(&userDefinedUseImmersiveMode)->default_value(false),
"Immersive mode (equivalent to -o -z -s -p)")(
"centerCamera,z", po::bool_switch(&_centerCamera)->default_value(false),
"Center the camera at (0,0,0)")(
"disableRescaling,s",
po::bool_switch(&_disableRescaling)->default_value(false),
"Disable re-scaling of the model(s)")(
"disableAnimation,p",
po::bool_switch(&_disableAnimation)->default_value(false),
"Disable camera animation");
po::options_description all;
all.add(options);
all.add_options()("ignoreNoConfig",
@@ -197,6 +215,14 @@ void LocalInitData::parseArguments(const int argc, char** argv)
setRenderMode(triply::RENDER_MODE_BUFFER_OBJECT);
}

if (userDefinedUseImmersiveMode)
{
_centerCamera = true;
_disableRescaling = true;
_disableAnimation = true;
userDefinedDisableLogo = true;
}

if (userDefinedUseGLSL)
enableGLSL();

@@ -43,6 +43,7 @@ class LocalInitData : public InitData
{
public:
LocalInitData();
LocalInitData& operator=(const LocalInitData& from);

void parseArguments(const int argc, char** argv);

@@ -52,15 +53,19 @@ class LocalInitData : public InitData
bool isResident() const { return _isResident; }
bool ignoreNoConfig() const { return _ignoreNoConfig; }
const std::vector<std::string>& getFilenames() const { return _filenames; }
LocalInitData& operator=(const LocalInitData& from);

bool centerCamera() const { return _centerCamera; }
bool rescaleModels() const { return !_disableRescaling; }
bool useCameraAnimation() const { return !_disableAnimation; }
private:
eq::Strings _filenames;
std::string _pathFilename;
uint32_t _maxFrames;
bool _color;
bool _isResident;
bool _ignoreNoConfig;
bool _centerCamera;
bool _disableRescaling;
bool _disableAnimation;
};
}

@@ -53,7 +53,6 @@ std::string getArchitectureFilename(const std::string& filename);

VertexBufferRoot::VertexBufferRoot(const std::string& filename)
: VertexBufferNode()
, _invertFaces(false)
{
if (!readFromFile(filename))
throw std::runtime_error("Can't read " + filename);
@@ -258,7 +257,8 @@ bool VertexBufferRoot::_constructFromPly(const std::string& filename)
++progress;

data.calculateNormals();
data.scale(2.0f);
if (_rescale)
data.scale(2.0f);
++progress;

setupTree(data, progress);
@@ -40,11 +40,8 @@ namespace triply
class VertexBufferRoot : public VertexBufferNode
{
public:
VertexBufferRoot()
: VertexBufferNode()
, _invertFaces(false)
{
}
VertexBufferRoot() = default;

TRIPLY_API VertexBufferRoot(const std::string& filename);

TRIPLY_API virtual void cullDraw(VertexBufferState& state) const;
@@ -55,6 +52,7 @@ class VertexBufferRoot : public VertexBufferNode
TRIPLY_API bool readFromFile(const std::string& filename);
bool hasColors() const { return !_data.colors.empty(); }
void useInvertedFaces() { _invertFaces = true; }
void disableRescaling() { _rescale = false; }
const std::string& getName() const { return _name; }
protected:
TRIPLY_API void toStream(std::ostream& os) final;
@@ -69,7 +67,8 @@ class VertexBufferRoot : public VertexBufferNode

friend class VertexBufferDist;
VertexBufferData _data;
bool _invertFaces;
bool _invertFaces = false;
bool _rescale = true;
std::string _name;
};
}

0 comments on commit 7f4c98d

Please sign in to comment.
You can’t perform that action at this time.