demotool/raymarcher.hh

48 lines
1,012 B
C++
Raw Normal View History

2017-09-30 21:53:45 +02:00
#pragma once
#ifndef REAL_BUILD
# define REAL_BUILD
# include "externals.hh"
# include "texture.hh"
# include "rendertarget.hh"
# include "utilities.hh"
2017-10-01 19:40:38 +02:00
# include "programs.hh"
2017-09-30 21:53:45 +02:00
# undef REAL_BUILD
#endif
struct T_Raymarcher
{
public:
T_Raymarcher( ) = delete;
T_Raymarcher( T_Raymarcher const& ) = delete;
T_Raymarcher( T_Raymarcher&& ) = delete;
T_Raymarcher( __rw__ T_FilesWatcher& watcher ,
__rd__ const uint32_t width ,
__rd__ const uint32_t height );
void render( );
void makeUI( );
T_Camera const& camera( ) const noexcept { return camera_; }
T_Camera& camera( ) noexcept { return camera_; }
T_Texture& output( ) noexcept { return txOutput_; }
2017-10-01 18:51:02 +02:00
T_Texture& depth( ) noexcept { return txDepth_; }
2017-09-30 21:53:45 +02:00
private:
T_Camera camera_;
2017-10-01 18:51:02 +02:00
GLuint pipeline_;
2017-09-30 21:53:45 +02:00
T_ShaderProgram program_;
2017-10-01 18:51:02 +02:00
T_Texture txOutput_ , txDepth_;
2017-09-30 21:53:45 +02:00
T_Rendertarget rtOutput_;
int rmIterations = 128;
float rmStep = .9;
float rmEpsilon = .000001;
float rmMaxDist = 50;
float epsLog = log( rmEpsilon ) / log( 10 );
};