-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathheadless.h
105 lines (72 loc) · 3.38 KB
/
headless.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// ======================================================================== //
// Copyright 2022-2022 Stefan Zellmann //
// //
// Licensed under the Apache License, Version 2.0 (the "License"); //
// you may not use this file except in compliance with the License. //
// You may obtain a copy of the License at //
// //
// http://www.apache.org/licenses/LICENSE-2.0 //
// //
// Unless required by applicable law or agreed to in writing, software //
// distributed under the License is distributed on an "AS IS" BASIS, //
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. //
// See the License for the specific language governing permissions and //
// limitations under the License. //
// ======================================================================== //
#pragma once
#include <string>
#include <QObject>
#include "owl/common/math/vec.h"
#include "qtOWL/Camera.h"
namespace exa {
struct Headless : QObject {
Headless(const std::string &title = "OWL Sample Viewer",
const owl::vec2i &initWindowSize=owl::vec2i(1024,1024));
~Headless();
void setOutFileName(std::string fileName);
void setOutFileNameFPS(std::string fileName);
void run();
virtual void resize(const owl::vec2i &newSize);
void setTitle(const std::string &s);
virtual void render() {}
virtual void draw() {}
virtual void key(char key, const owl::vec2i &/*where*/) {}
virtual void mouseButtonLeft(const owl::vec2i &where, bool pressed) {}
virtual void mouseDragLeft(const owl::vec2i &where, const owl::vec2i &delta) {}
virtual void cameraChanged() {}
owl::vec2i getWindowSize() const { return fbSize; }
qtOWL::Camera &getCamera() { return camera; }
void screenShot(const std::string &fileName);
virtual void setWorldScale(const float worldScale);
/*! set a new window aspect ratio for the camera, update the
camera, and notify the app */
void setAspect(const float aspect)
{
camera.setAspect(aspect);
updateCamera();
}
void updateCamera();
/*! set a new orientation for the camera, update the camera, and
notify the app */
void setCameraOrientation(/* camera origin : */const owl::vec3f &origin,
/* point of interest: */const owl::vec3f &interest,
/* up-vector : */const owl::vec3f &up,
/* fovy, in degrees : */float fovyInDegrees);
void loadTransferFunction(const std::string &fileName);
// protected:
owl::vec2i fbSize { 0 };
uint32_t *fbPointer { nullptr };
std::string title;
qtOWL::Camera camera;
struct {
float opacityScale { 100.f };
owl::interval<float> absDomain { 0.f, 1.f };
owl::interval<float> relDomain { 0.f, 99.f };
std::vector<owl::vec4f> colorMap;
} xf;
owl::interval<float> xfRange();
std::string outFileName;
std::string outFileNameFPS;
};
} // ::exa
// vim: sw=2:expandtab:softtabstop=2:ts=2:cino=\:0g0t0