HoviTron Video Pipeline
Public Types | Public Member Functions | Data Fields
VulkanWrapper Class Reference

Class that manages the classes related to Vulkan code and act as a wrapper around them. More...

#include <VulkanWrapper.h>

Public Types

using RenderPassType = VulkanRenderpass
 

Public Member Functions

 VulkanWrapper (WindowAbstract *window, PipelineMode pmode)
 
void init ()
 
void endInit (InputProvider *input, StartingPosition startingPt=StartingPosition::Average)
 
void start ()
 
void cleanUp ()
 
void recreateSwapChain ()
 
void updateSpaceTransform (glm::vec3 translation, glm::vec3 rotation)
 
void updateSpaceTransform (glm::vec3 translation, glm::vec3 rotation, glm::vec4 fov, int view)
 
void waitIdle ()
 
void createImageCall (uint32_t width, uint32_t height, vk::Format format, vk::ImageTiling tiling, vk::ImageUsageFlags usage, vk::MemoryPropertyFlags properties, vk::Image &image, vk::DeviceMemory &imageMemory)
 
void createBufferCall (vk::DeviceSize size, vk::BufferUsageFlags usage, vk::MemoryPropertyFlags properties, vk::Buffer &buffer, vk::DeviceMemory &bufferMemory)
 
void copyMemory (VkDeviceSize &size, vk::DeviceMemory &memory, unsigned char *dataToCopy)
 
void destroyImageAndMemory (std::vector< vk::Image > &vectorImage, std::vector< vk::DeviceMemory > &vectorMemory)
 
void destroyBufferAndMemory (std::vector< vk::Buffer > &vectorBuffer, std::vector< vk::DeviceMemory > &vectorMemory)
 
bool isDepthOutputRecquired ()
 
void setBlendingFactor (float blendingfactor)
 
void setTriangleThreshold (float triangleThreshold)
 
bool isUsingDifferentViewSize ()
 
VulkanContextgetContext ()
 
vk::Extent2D getSwapchainExtend (int view=0)
 
vk::Extent2D getRenderOutputExtent ()
 
std::vector< vk::Format > getRenderPassSupportedDepthFormats () const
 
vk::Format getSwapchainFormat (int view=0)
 
vk::Format getDepthSwapchainFormat (int view=0)
 
vk::ImageLayout getLayoutAfterRenderpass ()
 
int getAttachmentSize ()
 
int getViewNumber ()
 
void setAverageInputPosition (std::vector< InputProvider::StreamFrameInfo > &frameInfo)
 
void addDeltaToStartingPoint (glm::vec3 dPos, glm::vec3 dRot)
 
void setCorrectionRotation (int camId, glm::vec3 rotationCorrection)
 
void setCorrectionTranslation (int camId, glm::vec3 translationCorrection)
 
void setCorrectionFocal (int camId, glm::vec2 focals)
 
void setCorrectionPrincipalPt (int camId, glm::vec2 principalPt)
 
void setScaleFactor (float scaleFactor)
 
const std::vector< glm::vec3 > getCorrectionVectorRotation ()
 
const std::vector< InputProvider::StreamFrameInfogetFramesInfo (int view)
 
void saveConfigurationsToDisk ()
 
void loadConfigurationsFromDisk ()
 
std::vector< bool > getCameraActivation ()
 
void toggleCamera (int i)
 
void setCameraActivation (std::vector< bool > activation)
 

Data Fields

bool framebufferResized = false
 
const vk::Format internalColorAttachmentFormat = vk::Format::eR8G8B8A8Unorm
 
const vk::Format internal1DAttachmentFormat = vk::Format::eR32Sfloat
 
const vk::Format qualityAttachmentFormat = vk::Format::eR32Sfloat
 
const bool multiviewSetup
 
bool requireAverageInputPosition = true
 
VulkanContext context
 
RenderingParameters params
 

Detailed Description

Class that manages the classes related to Vulkan code and act as a wrapper around them.

Class that manages the classes related to Vulkan code and act as a wrapper around them. It manages the creation of the VulkanContext class, the RenderingParameter, the Vulkan RenderPass, ect ...

Definition at line 66 of file VulkanWrapper.h.

Member Typedef Documentation

◆ RenderPassType

using VulkanWrapper::RenderPassType = VulkanRenderpass

Definition at line 216 of file VulkanWrapper.h.

Constructor & Destructor Documentation

◆ VulkanWrapper()

VulkanWrapper::VulkanWrapper ( WindowAbstract window,
PipelineMode  pmode 
)

Create the VulkanWrapper object

Definition at line 43 of file VulkanWrapper.cpp.

43 :
44 context(window),
45 renderPass([&]()->VulkanRenderPassAbstract*{
46 switch (pmode) {
47 default:
48 return new VulkanRenderPass(&context, this);
49 }
50 }()),
51 drawing(&context, renderPass.get(), window, this),
52 multiviewSetup(window->useOpenXR())
53{
54 this->window = window;
55 window->setWrapper(this);
56
57}
An abstract class that contains a common base of code for the class that inherit from it.
Class that manage the renderPass containing the synthesis and blending steps.
VulkanContext context
const bool multiviewSetup
virtual const bool useOpenXR()
void setWrapper(VulkanWrapper *wraps)

Member Function Documentation

◆ addDeltaToStartingPoint()

void VulkanWrapper::addDeltaToStartingPoint ( glm::vec3  dPos,
glm::vec3  dRot 
)

Add an offset to the stored by the virtual parameters

Definition at line 480 of file VulkanWrapper.cpp.

481{
482 auto R = glmEulerAnglesDegreeToRotationMatrixNotOMAF(params.getStartingRotation());
483 auto dR = glmEulerAnglesDegreeToRotationMatrixNotOMAF(dRot);
484
485 auto pos = params.getStartingPosition() + glm::transpose(R)* dPos;
486 auto rot = glm::transpose(R) * dRot * R;
487
488 params.setStartingPt(pos,rot);
489
490
491}
void setStartingPt(glm::vec3 startPos, glm::vec3 startRot)
const glm::vec3 getStartingPosition()
const glm::vec3 getStartingRotation()
RenderingParameters params

◆ cleanUp()

void VulkanWrapper::cleanUp ( )

Start to cleanup ressources. The classes of the project have to be destroyed in a certain order

Definition at line 270 of file VulkanWrapper.cpp.

271{
272
273 if(drawing.isInitialized()) {
274 drawing.cleanup();
275 }
276
277 //pipeline.cleanUp();
278 if(renderPass->isInitialized()){
279 renderPass->cleanUp();
280 }
281 /*
282 if (!window->isSwapChainNeeded()) {
283 static_cast<NoWindow*>(window)->cleanUpRessources();
284 }*/
285 window->cleanUp();
286
287}
virtual void cleanUp()=0

◆ copyMemory()

void VulkanWrapper::copyMemory ( VkDeviceSize &  size,
vk::DeviceMemory &  memory,
unsigned char *  dataToCopy 
)

Copy the data to the requested device memory location

Definition at line 328 of file VulkanWrapper.cpp.

329{
330 void* data;
331 context.device.mapMemory(memory, 0, size, {}, &data);
332 memcpy(dataToCopy, data, static_cast<size_t>(size));
333 context.device.unmapMemory(memory);
334}
vk::Device device
Definition: VulkanContext.h:87

◆ createBufferCall()

void VulkanWrapper::createBufferCall ( vk::DeviceSize  size,
vk::BufferUsageFlags  usage,
vk::MemoryPropertyFlags  properties,
vk::Buffer &  buffer,
vk::DeviceMemory &  bufferMemory 
)

Create a vk::Buffer with the requested characteristics

Definition at line 324 of file VulkanWrapper.cpp.

325{
326 createBuffer(size, usage, properties, buffer, bufferMemory, context.device, context.physicalDevice);
327}
vk::PhysicalDevice physicalDevice
Definition: VulkanContext.h:85

◆ createImageCall()

void VulkanWrapper::createImageCall ( uint32_t  width,
uint32_t  height,
vk::Format  format,
vk::ImageTiling  tiling,
vk::ImageUsageFlags  usage,
vk::MemoryPropertyFlags  properties,
vk::Image &  image,
vk::DeviceMemory &  imageMemory 
)

Create a vk::Image with the requested characteristics

Definition at line 320 of file VulkanWrapper.cpp.

321{
322 createImage(context.device,context.physicalDevice,width,height,format,tiling,usage,properties,image,imageMemory);
323}

◆ destroyBufferAndMemory()

void VulkanWrapper::destroyBufferAndMemory ( std::vector< vk::Buffer > &  vectorBuffer,
std::vector< vk::DeviceMemory > &  vectorMemory 
)

Destroy the buffer and their associated buffer mamory

Definition at line 348 of file VulkanWrapper.cpp.

349{
350 //delete image
351 for (auto const& buf : vectorBuffer) {
352 context.device.destroyBuffer(buf);
353 }
354 //delete attachement memory
355 for (auto const& mem : vectorMemory) {
356 context.device.freeMemory(mem);
357 }
358}

◆ destroyImageAndMemory()

void VulkanWrapper::destroyImageAndMemory ( std::vector< vk::Image > &  vectorImage,
std::vector< vk::DeviceMemory > &  vectorMemory 
)

Destroy the images and their associated memory

Definition at line 336 of file VulkanWrapper.cpp.

337{
338 //delete image
339 for (auto const& image : vectorImage) {
340 context.device.destroyImage(image);
341 }
342 //delete attachement memory
343 for (auto const& mem : vectorMemory) {
344 context.device.freeMemory(mem);
345 }
346}

◆ endInit()

void VulkanWrapper::endInit ( InputProvider input,
StartingPosition  startingPt = StartingPosition::Average 
)

Continue the initialisation process once the InputProvider has been created.

Definition at line 98 of file VulkanWrapper.cpp.

98 {
99 this->inputProvider = inputProvider;
100 auto input = inputProvider->enumerateStreamsParameters();
101 assert(input.size() >= 1);
102
103 correctionVectorRotation.resize(input.size());
104 correctionVectorTranslation.resize(input.size());
105 correctionPrincipalPt.resize(input.size());
106 correctionFocal.resize(input.size());
107
108
109 streamFrameInfos.resize(input.size());
110 cameraActivation.resize(input.size(),true);
111
112 float maxD = input[0].farDepth;
113 float minD = input[0].nearDepth;
114 for (const auto & in : input) {
115 maxD = in.farDepth > maxD ? in.farDepth : maxD;
116 minD = in.nearDepth > minD ? in.nearDepth : minD;
117 }
118 params.max_depth = maxD;
119 params.min_depth = minD;
120
121
122 D(PRINT("=====renderpass======"));
123 renderPass->init(inputProvider);
124 D(PRINT("=====drawing======"));
125 drawing.init(inputProvider);
126
127 if (startingPt == StartingPosition::Average) {
129 }
130 else {
132 }
133}
void init(InputProvider *inputProvider)
bool requireAverageInputPosition

◆ getAttachmentSize()

int VulkanWrapper::getAttachmentSize ( )

Get the number of attachment required by view by getting it from the window. Usually it's the size of the number of images in the swapchain. (or max of this if there is multiple swapchain)

Definition at line 447 of file VulkanWrapper.cpp.

448{
449 return window->getAttachmentSize();
450}

◆ getCameraActivation()

std::vector< bool > VulkanWrapper::getCameraActivation ( )

Return which input cameras are activated

Definition at line 209 of file VulkanWrapper.cpp.

210{
211 return cameraActivation;
212}

◆ getContext()

VulkanContext * VulkanWrapper::getContext ( )

Return the VulkanContext class

Definition at line 394 of file VulkanWrapper.cpp.

395{
396 return &context;
397}

◆ getCorrectionVectorRotation()

const std::vector< glm::vec3 > VulkanWrapper::getCorrectionVectorRotation ( )

Return the vector related to rotation

Definition at line 539 of file VulkanWrapper.cpp.

540{
541 return correctionVectorRotation;
542}

◆ getDepthSwapchainFormat()

vk::Format VulkanWrapper::getDepthSwapchainFormat ( int  view = 0)

Return the format selected by the swapchain for depth

Definition at line 433 of file VulkanWrapper.cpp.

434{
435 return window->getDepthSwapchainFormat(view);
436}
virtual vk::Format getDepthSwapchainFormat(int view)

◆ getFramesInfo()

const std::vector< InputProvider::StreamFrameInfo > VulkanWrapper::getFramesInfo ( int  view)

Retrieve the information from the InputProvider to render a new frame for the requested view

Definition at line 544 of file VulkanWrapper.cpp.

545{
546 if (requestChange) {
547 context.device.waitIdle();
548#ifdef HVT_UDP_CONTROL
549 mutexAct.lock();
550#endif
551 drawing.cleanup();
552 renderPass->cleanUp();
553 renderPass->init(inputProvider);
554 drawing.init(inputProvider);
555 requestChange = false;
556#ifdef HVT_UDP_CONTROL
557 mutexAct.unlock();
558#endif
559 }
560 inputProvider->acquireStreamsFrames(params.getVirtualExtrinsics(view), streamFrameInfos);
562 setAverageInputPosition(streamFrameInfos);
563 }
564
565 assert(correctionVectorRotation.size() == streamFrameInfos.size());
566
567 for (int i = 0; i < correctionVectorRotation.size(); i++) {
568 streamFrameInfos[i].extrinsics.rotation += correctionVectorRotation[i];
569 streamFrameInfos[i].extrinsics.position += correctionVectorTranslation[i];
570
571 if (streamFrameInfos[i].intrinsics.index() == 0) {
572 std::get<InputProvider::PerspectiveIntrinsics>(streamFrameInfos[i].intrinsics).focals += correctionFocal[i];
573 std::get<InputProvider::PerspectiveIntrinsics>(streamFrameInfos[i].intrinsics).principle += correctionPrincipalPt[i];
574 }
575
576 }
577
578 return streamFrameInfos;
579}
const InputProvider::Extrinsics getVirtualExtrinsics(int view)
void setAverageInputPosition(std::vector< InputProvider::StreamFrameInfo > &frameInfo)

◆ getLayoutAfterRenderpass()

vk::ImageLayout VulkanWrapper::getLayoutAfterRenderpass ( )

Return the image layout where the image should be at the end of the rendering operation. In the case of WindowGLFW, it will be vk::ImageLayout::ePresentSrcKHR When used with an headset, it will be vk::ImageLayout::eColorAttachmentOptimal

Definition at line 438 of file VulkanWrapper.cpp.

439{
440 auto res = vk::ImageLayout::eColorAttachmentOptimal;
441 if (!window->useOpenXR() && !window->isIndepFromWindowDimension()) {
442 res = vk::ImageLayout::ePresentSrcKHR;
443 }
444 return res;
445}
bool isIndepFromWindowDimension()

◆ getRenderOutputExtent()

vk::Extent2D VulkanWrapper::getRenderOutputExtent ( )

Return the size of theresult of the rendering

Definition at line 404 of file VulkanWrapper.cpp.

405{
406 /*if (window->isIndepFromWindowDimension()) {
407 //return VirtualView [0]
408 auto size = app->getConfig().params_virtual[0].getSize();
409 return vk::Extent2D(size.width,size.height);
410 }
411 else { */
412 //return the size of the first swapchain
413 //return window->swapChainExtent[0];
414 //}
415 vk::Extent2D max = {0,0};
416 for (int i = 0; i < window->getViewNumber(); i++) {
417 auto ext = window->getSwapchainExtent(i);
418 if (max.width < ext.width) {
419 max.width = ext.width;
420 }
421 if (max.height < ext.height) {
422 max.height = ext.height;
423 }
424 }
425 return max;
426}
virtual vk::Extent2D getSwapchainExtent(int view)

◆ getRenderPassSupportedDepthFormats()

std::vector< vk::Format > VulkanWrapper::getRenderPassSupportedDepthFormats ( ) const

return the list of the depth format supported for the selected renderpass

Definition at line 94 of file VulkanWrapper.cpp.

94 {
95 return renderPass->getSupportedDepthFormats();
96}

◆ getSwapchainExtend()

vk::Extent2D VulkanWrapper::getSwapchainExtend ( int  view = 0)

Return the size of the swapchain for the requested view

Definition at line 399 of file VulkanWrapper.cpp.

400{
401 return window->getSwapchainExtent(view);
402}

◆ getSwapchainFormat()

vk::Format VulkanWrapper::getSwapchainFormat ( int  view = 0)

Return the format selected by the swapchain

Definition at line 428 of file VulkanWrapper.cpp.

429{
430 return window->getSwapchainFormat(view);//window->swapChainImageFormat[view];
431}
virtual vk::Format getSwapchainFormat(int view)

◆ getViewNumber()

int VulkanWrapper::getViewNumber ( )

Return the number of view required by the systems. Usually only one view when displayed on the screen, 2 for a stereographic headset and 4 if a certain openxr extension has been activated.

Definition at line 452 of file VulkanWrapper.cpp.

453{
454 return window->getViewNumber();
455}

◆ init()

void VulkanWrapper::init ( )

Do the first step of the initialisation process of the VulkanWrapper. Start the initialization of the Window, Create the VulkanContext object, create the RenderingParameters class.

Definition at line 64 of file VulkanWrapper.cpp.

65{
66#endif
67
68 window->initWindow();
69#ifdef __ANDROID__
71#else
73#endif
74 if (!context.isInitialized()) {
75 D(PRINT("====context======="));
77 }
78 D(PRINT("===continue window initialisation==="));
79 window->continueInit();
80 //set the number of attachment to
81 attachmentSize = window->getAttachmentSize();
82 int viewNum = window->getViewNumber();
83
84#ifdef HVT_UDP_CONTROL
85 params.init(viewNum, window, this, port);
86 this->port = port;
87#else
88 params.init(viewNum, window, this);
89#endif // DEBUG
90
91 D(PRINT("Size of attachment = %d", attachmentSize));
92}
void init(int view, WindowAbstract *window, VulkanWrapper *wraps)
void loadShaders()
Definition: Shader.cpp:68
static ShadersList & getInstance()
Definition: Shader.cpp:99
virtual void continueInit()=0
virtual void initWindow()=0

◆ isDepthOutputRecquired()

bool VulkanWrapper::isDepthOutputRecquired ( )

Return true if the depth has to be given as a result of the rendering

Definition at line 360 of file VulkanWrapper.cpp.

361{
362 return window->isDepthRecquired();
363}
virtual bool isDepthRecquired()

◆ isUsingDifferentViewSize()

bool VulkanWrapper::isUsingDifferentViewSize ( )

Return true if view of different size are used

Definition at line 376 of file VulkanWrapper.cpp.

377{
378 assert(params.virtualViewDef.size() > 0);
379 if (params.virtualViewDef.size() == 1) {
380 return false;
381 }
382 else {
383 auto ref = params.virtualViewDef[0];
384 for (auto & v : params.virtualViewDef) {
385 if (v[0] != ref[0] || v[1] != ref[1]) {
386 return true;
387 }
388 }
389 return false;
390 }
391
392}
std::vector< glm::vec2 > virtualViewDef

◆ loadConfigurationsFromDisk()

void VulkanWrapper::loadConfigurationsFromDisk ( )

Load the corrections to be applied on input from a json file

Definition at line 182 of file VulkanWrapper.cpp.

183{
184
185 std::ifstream stream(fileN, std::ifstream::out);
186
187 json j;
188 std::cout << "load correction of rotation to disk at " << fileN << std::endl;
189 if (stream.is_open()) {
190 j << stream;
191
192 for (auto& cam : j["camera"]) {
193 int id = cam["id"];
194 auto r = j["camera"][id]["correction"]["rotation"];
195 correctionVectorRotation[id] = { r[0],r[1],r[2] };
196 auto t = j["camera"][id]["correction"]["translation"];
197 correctionVectorTranslation[id] = { t[0],t[1],t[2] };
198 auto p = j["camera"][id]["correction"]["principalPt"];
199 correctionPrincipalPt[id] = { p[0],p[1] };
200 auto f = j["camera"][id]["correction"]["focal"];
201 correctionFocal[id] = { f[0],f[1] };
202 }
203 }
204 else {
205 std::cout << "No save file found" << std::endl;
206 }
207}

◆ recreateSwapChain()

void VulkanWrapper::recreateSwapChain ( )

This function is called when the swapchain has to be recreated (mainly when the window size change)

Definition at line 289 of file VulkanWrapper.cpp.

290{
291#ifdef __ANDROID__
292 LOGI("recreate swapchain");
293#else
294 std::cout << ("recreation swapchain !") << std::endl;
295#endif
296 window->checkForCorrectSize();
297 //could be better TODO -> https://vulkan-tutorial.com/Drawing_a_triangle/Swap_chain_recreation
298 context.device.waitIdle();
299 //cleanUp
300 cleanUp();
301 //init
302#ifdef HVT_UDP_CONTROL
303 init(port);
304#else
305 init();
306#endif
307
308}
virtual void checkForCorrectSize()=0

◆ saveConfigurationsToDisk()

void VulkanWrapper::saveConfigurationsToDisk ( )

Save the corrections to be applied on input in a json file

Definition at line 136 of file VulkanWrapper.cpp.

137{
138
139 std::cout << "Save correction of rotation to disk at " << fileN << std::endl;
140 std::ofstream stream(fileN, std::ifstream::out);
141
142 assert(correctionVectorRotation.size() == correctionVectorTranslation.size());
143 assert(correctionVectorTranslation.size() == correctionPrincipalPt.size());
144 assert(correctionPrincipalPt.size() == correctionFocal.size());
145
146
147 json j;
148 for (int id = 0; id < correctionVectorRotation.size(); id ++ ) {
149 //j["camera"][id] = json::array();
150 j["camera"][id]["id"] = id;
151
152 //j["camera"][id]["correction"] = json::object();
153 auto r = correctionVectorRotation[id];
154 j["camera"][id]["correction"]["rotation"] = { r.x,r.y,r.z };
155 auto t = correctionVectorTranslation[id];
156 j["camera"][id]["correction"]["translation"] = {t.x,t.y,t.z};
157 auto p = correctionPrincipalPt[id];
158 j["camera"][id]["correction"]["principalPt"] = json::array({p.x,p.y});
159 auto f = correctionFocal[id];
160 j["camera"][id]["correction"]["focal"] = json::array({f.x,f.y});
161
162 //j["camera"][id]["current"] = json::array();
163 auto ro = streamFrameInfos[id].extrinsics.rotation;
164 j["camera"][id]["current"]["rotation"] = {ro.x,ro.y,ro.z};
165 auto to = streamFrameInfos[id].extrinsics.position;
166 j["camera"][id]["current"]["translation"] = { to.x,to.y,to.z };
167
168 //-------- TODO case with equirectangular
169 if (streamFrameInfos[id].intrinsics.index() == 0) {
170 auto po = std::get<InputProvider::PerspectiveIntrinsics>(streamFrameInfos[id].intrinsics).principle;
171 j["camera"][id]["current"]["principalPt"] = json::array({ po.x,po.y });
172 auto fo = std::get<InputProvider::PerspectiveIntrinsics>(streamFrameInfos[id].intrinsics).focals;
173 j["camera"][id]["current"]["focal"] = json::array({ fo.x,fo.y });
174 }
175
176 }
177 stream << j.dump(4);
178
179 stream.close();
180}

◆ setAverageInputPosition()

void VulkanWrapper::setAverageInputPosition ( std::vector< InputProvider::StreamFrameInfo > &  frameInfo)

Calculate the position at the middle of the input camera array

Definition at line 457 of file VulkanWrapper.cpp.

458{
459 glm::vec3 averagePos = {0,0,0};
460 glm::vec3 averageRot = {0,0,0};
461 const int numInput = frameInfo.size();
462
463 for (auto f : frameInfo) {
464 averagePos += f.extrinsics.position;
465 //averageRot += f.extrinsics.rotation;
466 }
467 averagePos /= numInput;
468 //averageRot /= numInput;
469
470 //convert from OMAF to the coordinate system used by virtual parameters
471 auto conversion = glm::transpose(params.conversionToOMAF);
472 auto pos = conversion * averagePos;
473
474 params.setStartingPt(pos, averageRot);
475 //params.startingRotation = conversion * averageRot * glm::transpose(conversion) ;
476
478}
const glm::mat3x3 conversionToOMAF

◆ setBlendingFactor()

void VulkanWrapper::setBlendingFactor ( float  blendingfactor)

Set the blending factor for RVS

Definition at line 365 of file VulkanWrapper.cpp.

366{
367 params.blendingFactor = blendingfactor;
368}

◆ setCameraActivation()

void VulkanWrapper::setCameraActivation ( std::vector< bool >  activation)

Set which camera are activated

Definition at line 238 of file VulkanWrapper.cpp.

239{
240
241 assert(activation.size() == cameraActivation.size());
242
243 bool valid = false;
244 for (auto a : activation) {
245 valid += a;
246 }
247
248 if (valid) {
249#ifdef HVT_UDP_CONTROL
250 mutexAct.lock();
251#endif
252 requestChange = true;
253 cameraActivation = activation;
254#ifdef HVT_UDP_CONTROL
255 mutexAct.unlock();
256#endif
257 }
258 else {
259 PRINT("Invalid activation vector. At least one camera should be activated");
260 }
261}

◆ setCorrectionFocal()

void VulkanWrapper::setCorrectionFocal ( int  camId,
glm::vec2  focals 
)

Store an offset to be applied on the focal of one of the input camera

Definition at line 513 of file VulkanWrapper.cpp.

514{
515 if (camId < correctionFocal.size()) {
516 correctionFocal[camId] += focals;
517 }
518 else {
519 PRINT("Camera %i does not exist, only %i camera are availables", camId, (int)correctionFocal.size());
520 }
521}

◆ setCorrectionPrincipalPt()

void VulkanWrapper::setCorrectionPrincipalPt ( int  camId,
glm::vec2  principalPt 
)

Store an offset to be applied on the principal point of one of the input camera

Definition at line 523 of file VulkanWrapper.cpp.

524{
525 if (camId < correctionFocal.size()) {
526 correctionPrincipalPt[camId] += principalPt;
527 }
528 else {
529 PRINT("Camera %i does not exist, only %i camera are availables", camId, (int)correctionPrincipalPt.size());
530 }
531}

◆ setCorrectionRotation()

void VulkanWrapper::setCorrectionRotation ( int  camId,
glm::vec3  rotationCorrection 
)

Store an offset to be applied on the rotation of one of the input camera

Definition at line 493 of file VulkanWrapper.cpp.

494{
495 if (camId < correctionVectorRotation.size()) {
496 correctionVectorRotation[camId] += rotationCorrection;
497 }
498 else {
499 PRINT("Camera %i does not exist, only %i camera are availables", camId, (int) correctionVectorRotation.size());
500 }
501}

◆ setCorrectionTranslation()

void VulkanWrapper::setCorrectionTranslation ( int  camId,
glm::vec3  translationCorrection 
)

Store an offset to be applied on the translation of one of the input camera

Definition at line 503 of file VulkanWrapper.cpp.

504{
505 if (camId < correctionVectorTranslation.size()) {
506 correctionVectorTranslation[camId] += translationCorrection;
507 }
508 else {
509 PRINT("Camera %i does not exist, only %i camera are availables", camId, (int)correctionVectorTranslation.size());
510 }
511}

◆ setScaleFactor()

void VulkanWrapper::setScaleFactor ( float  scaleFactor)

Set the scene at a certain scale

Definition at line 533 of file VulkanWrapper.cpp.

534{
535 assert(scaleFactor > 0);
536 params.scaleFactor = scaleFactor;
537}

◆ setTriangleThreshold()

void VulkanWrapper::setTriangleThreshold ( float  triangleThreshold)

Set the triangle threshold

Definition at line 370 of file VulkanWrapper.cpp.

371{
372 assert(triangleThreshold > 0);
373 params.pixelThreshold = triangleThreshold;
374}

◆ start()

void VulkanWrapper::start ( )

Call the mainloop function that is part of the WindowAbstract class

Definition at line 263 of file VulkanWrapper.cpp.

264{
265
266 window->mainLoop(&drawing);
267 context.device.waitIdle();
268}
virtual void mainLoop(VulkanDrawing *vulkanDrawing)=0

◆ toggleCamera()

void VulkanWrapper::toggleCamera ( int  i)

Activate/desactivate the specified input camera

Definition at line 214 of file VulkanWrapper.cpp.

215{
216
217 assert( i < cameraActivation.size() );
218
219 if (!cameraActivation[i] || renderPass->inputImage > 1 ) {
220#ifdef HVT_UDP_CONTROL
221
222 mutexAct.lock();
223#endif // HVT_UDP_CONTROL
224
225 requestChange = true;
226 cameraActivation[i] = !cameraActivation[i];
227#ifdef HVT_UDP_CONTROL
228 mutexAct.unlock();
229#endif
230 }
231 else {
232 //we don't need to desactivate all the camera
233 //always let one activated
234 std::cout << "Impossible to desactivate camera " << i << " :there must always be one camera active" << std::endl;
235 }
236}

◆ updateSpaceTransform() [1/2]

void VulkanWrapper::updateSpaceTransform ( glm::vec3  translation,
glm::vec3  rotation 
)

Update the translation and rotation of the virtual view

Definition at line 310 of file VulkanWrapper.cpp.

311{
312
313 params.updateSpaceTransform(translation,rotation);
314
315}
void updateSpaceTransform(glm::vec3 translation, glm::vec3 rotation)

◆ updateSpaceTransform() [2/2]

void VulkanWrapper::updateSpaceTransform ( glm::vec3  translation,
glm::vec3  rotation,
glm::vec4  fov,
int  view 
)

Update the translation, rotation as well as the field of view of the specified virtual view

Definition at line 603 of file VulkanWrapper.cpp.

603 {
604
605 params.updateSpaceTransform(translation, rotation, fov, view);
606}

◆ waitIdle()

void VulkanWrapper::waitIdle ( )

Wait for the device to be idle

Definition at line 317 of file VulkanWrapper.cpp.

317 {
318 context.device.waitIdle();
319}

Field Documentation

◆ context

VulkanContext VulkanWrapper::context

Reference to the class that manges object and info related to vulkan context

Definition at line 194 of file VulkanWrapper.h.

◆ framebufferResized

bool VulkanWrapper::framebufferResized = false

Put the true if the framebuffer was resized

Definition at line 177 of file VulkanWrapper.h.

◆ internal1DAttachmentFormat

const vk::Format VulkanWrapper::internal1DAttachmentFormat = vk::Format::eR32Sfloat

Format for the attachment in 1D used internally (usually for the pseudo depth attachment)

Definition at line 182 of file VulkanWrapper.h.

◆ internalColorAttachmentFormat

const vk::Format VulkanWrapper::internalColorAttachmentFormat = vk::Format::eR8G8B8A8Unorm

Format for the attachment in color used internally

Definition at line 180 of file VulkanWrapper.h.

◆ multiviewSetup

const bool VulkanWrapper::multiviewSetup

Usually at true when openxr is used

Definition at line 189 of file VulkanWrapper.h.

◆ params

RenderingParameters VulkanWrapper::params

Refrence to the class that manage the virtual parameters

Definition at line 197 of file VulkanWrapper.h.

◆ qualityAttachmentFormat

const vk::Format VulkanWrapper::qualityAttachmentFormat = vk::Format::eR32Sfloat

Format for the quality attachment in color used internally

Definition at line 184 of file VulkanWrapper.h.

◆ requireAverageInputPosition

bool VulkanWrapper::requireAverageInputPosition = true

true if the avarage position has to be calculated

Definition at line 191 of file VulkanWrapper.h.


The documentation for this class was generated from the following files: