VisPro  1.0
Project of Visualisierung 2
main.h File Reference

main application file More...

#include <tk.h>
#include "MyTkMain.h"
#include <iostream>
#include <fstream>
#include <sstream>
#include <stdio.h>
#include <stdlib.h>
#include "glew.h"
#include "glfw3.h"
#include <GL/gl.h>
#include "glm.hpp"
#include "gtc/type_ptr.hpp"
#include "gtc/matrix_transform.hpp"
#include <memory>
#include "UserInput.h"
#include "Texture.h"
#include "Geometry.h"
#include "SceneObject.h"
#include "PointLight.h"
#include "Light.h"
#include "../Scene/Camera.h"
#include "../Shader/Shader.h"
#include "../Shader/BlinnPhongShader.h"
#include "../Shader/NormalShader.h"
#include "../Shader/TextureShader.h"
#include "SceneImporter.h"
#include "SceneObjectManager.h"
#include "CutawaySurface.h"
#include "Quad.h"
#include "StringHelpers.hpp"
#include <opencv2\opencv.hpp>
#include <opencv2\imgproc\imgproc.hpp>
#include <opencv2\highgui\highgui.hpp>
#include <opencv2\features2d\features2d.hpp>
#include <opencv2\nonfree\features2d.hpp>
#include <opencv2\nonfree\nonfree.hpp>
#include <Windows.h>
#include <opencv2\highgui\highgui_c.h>
#include "ZBufferView.h"
#include "RGBBufferView.h"
#include "TextureView.h"
#include "FrameBufferObjectView.h"

Go to the source code of this file.

Functions

void UpdateNearPlane (float nearPlane)
 
void UpdateFarPlane (float farPlane)
 
void UpdateDrillAngle (float drillAngle)
 
void UpdateEnvironment (const std::string &environmentDaeFile)
 
void UpdateItem (const std::string &itemDaeFile)
 
int SetEnvironmentCmd (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
 
int SetItemCmd (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
 
int StartSimCmd (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
 
int SetNearPlaneCmd (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
 
int SetFarPlaneCmd (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
 
int SetDrillAngleCmd (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
 
int SetDoCutawayCmd (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
 
int GetNearPlaneCmd (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
 
int GetFarPlaneCmd (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
 
int GetDrillAngleCmd (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
 
int GetDoCutawayCmd (ClientData clientData, Tcl_Interp *interp, int argc, CONST84 char *argv[])
 
int Tk_AppInit (Tcl_Interp *interp)
 
int InitTcl (int argc_in, char *argv_in[])
 
void TearDownTcl ()
 
int EvalTclFile (char *fileName)
 
int main (int argc, char **argv)
 
void init (GLFWwindow *window)
 
void update (GLFWwindow *window, float deltaTime)
 
void createDepthImage ()
 
void calculateCutawaySurface ()
 
void draw ()
 
void cleanup ()
 
void initScreenParameters ()
 

Variables

int width = 1024
 
int height = 800
 
int refreshrate = 60
 
bool fullscreen = false
 
SceneObjectManager obj_manager
 
std::vector< std::shared_ptr< Energy > > e_items
 
std::vector< std::shared_ptr< Environment > > environment
 
Cameracamera
 
float speed = 15.0f
 
float look_speed = 0.001f
 
float near_plane = 0.1f
 
float far_plane = 180.0f
 
float ratio = width / height
 
float fov = glm::radians(70.0f)
 
CutawaySurfacecutaway = nullptr
 
float drill_angle = 40.0f
 
float doCutaway = 1.0f
 
UserInput user_input
 
int drawnFaces = 0
 
GLFWwindow * m_window = nullptr
 
std::string m_environmentDaeFile = ""
 
std::string m_itemDaeFile = ""
 
ZBufferViewzBufferView = nullptr
 
RGBBufferViewrgbBufferView = nullptr
 
TextureViewtex1View = nullptr
 
TextureViewtex2View = nullptr
 
FrameBufferObjectViewfbo101View = nullptr
 
FrameBufferObjectViewfbo202View = nullptr
 
FrameBufferObjectViewfbo101View_II = nullptr
 
FrameBufferObjectViewfbo202View_II = nullptr
 
bool startSim = false
 
Tcl_Interp * interp = nullptr
 

Detailed Description

main application file

Function Documentation

void calculateCutawaySurface ( )

Calculate the cutaway surface out of depth values of objects of interest. Process is iterative. Several passes of jump flooding algorithm with decreasing step size are triggered here.

void cleanup ( )

Cleanup of simulation objects.

void createDepthImage ( )

Creation of depth image of objects of interest. The depth image is a starting point of cutaway calculation.

void draw ( )

Draw objects of interest and secondary objects. Objects of interest are drawn completely whereas secondary objects are intersected with the cutaway surface.

int EvalTclFile ( char *  fileName)

Eval given TCL script in current interpreter.

Parameters
fileNamefilename of TCL script
Returns
TCL_OK if everything is fine, TCL_ERROR otherwise
int GetDoCutawayCmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
CONST84 char *  argv[] 
)

TCL command function to return cutaway surface flag to TCL script.

Parameters
clientDatadata handle to interpreter values
interpcurrent TCL interpreter
argcnumber of arguments to TCL command
argvarguments to TCL command as string array
int GetDrillAngleCmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
CONST84 char *  argv[] 
)

TCL command function to return the drill angle of cutaway surface calculation to TCL script.

Parameters
clientDatadata handle to interpreter values
interpcurrent TCL interpreter
argcnumber of arguments to TCL command
argvarguments to TCL command as string array
int GetFarPlaneCmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
CONST84 char *  argv[] 
)

TCL command function to return the far plane distance value of OpenGL view to TCL script.

Parameters
clientDatadata handle to interpreter values
interpcurrent TCL interpreter
argcnumber of arguments to TCL command
argvarguments to TCL command as string array
int GetNearPlaneCmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
CONST84 char *  argv[] 
)

TCL command function to return the near plane distance value of OpenGL view to TCL script.

Parameters
clientDatadata handle to interpreter values
interpcurrent TCL interpreter
argcnumber of arguments to TCL command
argvarguments to TCL command as string array
void init ( GLFWwindow *  window)

Initialization of GLFW window as main render context, loading of objects of interest and secondary objects, setup of view in the simulation. Initialization of cutaway surface calculation is also done here.

Parameters
windowthe GLFW window to bind
void initScreenParameters ( )

Extraction of simulation parameters for screen and cutaway surface calculation from settings file.

int InitTcl ( int  argc_in,
char *  argv_in[] 
)

Initialization of TCL interpreter. Create an interpreter here.

Parameters
argc_inpendant to application argc
argv_inpendant to application argv
Returns
TCL_OK if everything is fine
int main ( int  argc,
char **  argv 
)

Main entry point of application

Parameters
argcnumber of command line arguments
argvcommand line arguments within a string array
Returns
0 if everything is OK
int SetDoCutawayCmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
CONST84 char *  argv[] 
)

TCL command function to enable or disable cutaway surface calculation.

Parameters
clientDatadata handle to interpreter values
interpcurrent TCL interpreter
argcnumber of arguments to TCL command
argvarguments to TCL command as string array
int SetDrillAngleCmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
CONST84 char *  argv[] 
)

TCL command function to set drill angle for cutaway surface calculation.

Parameters
clientDatadata handle to interpreter values
interpcurrent TCL interpreter
argcnumber of arguments to TCL command
argvarguments to TCL command as string array
int SetEnvironmentCmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
CONST84 char *  argv[] 
)

TCL command function to set secondary objects i.e. environment file in simulation.

Parameters
clientDatadata handle to interpreter values
interpcurrent TCL interpreter
argcnumber of arguments to TCL command
argvarguments to TCL command as string array
int SetFarPlaneCmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
CONST84 char *  argv[] 
)

TCL command function to set the far plane in OpenGL view.

Parameters
clientDatadata handle to interpreter values
interpcurrent TCL interpreter
argcnumber of arguments to TCL command
argvarguments to TCL command as string array
int SetItemCmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
CONST84 char *  argv[] 
)

TCL command function to set primary objects i.e. item file in simulation.

Parameters
clientDatadata handle to interpreter values
interpcurrent TCL interpreter
argcnumber of arguments to TCL command
argvarguments to TCL command as string array
int SetNearPlaneCmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
CONST84 char *  argv[] 
)

TCL command function to set the near plane in OpenGL view.

Parameters
clientDatadata handle to interpreter values
interpcurrent TCL interpreter
argcnumber of arguments to TCL command
argvarguments to TCL command as string array
int StartSimCmd ( ClientData  clientData,
Tcl_Interp *  interp,
int  argc,
CONST84 char *  argv[] 
)

TCL command function to switch from initialization mode of the simulation to running mode.

Parameters
clientDatadata handle to interpreter values
interpcurrent TCL interpreter
argcnumber of arguments to TCL command
argvarguments to TCL command as string array
void TearDownTcl ( )

Tear down TCL interpreter and application.

int Tk_AppInit ( Tcl_Interp *  interp)

Tk application initializer. Define application-specific commands here.

Parameters
interpcurrent TCL interpreter
Returns
TCL_OK if everything is fine
void update ( GLFWwindow *  window,
float  deltaTime 
)

Update of view of given GLFW window. Update camera as well as scene according to time passed since last update.

Parameters
windowgiven GLFW window
deltaTimetime since last update
void UpdateDrillAngle ( float  drillAngle)

Update drill angle for cutaway surface calculation.

Parameters
drillAngleangle that defines the steepness of cutting cones
void UpdateEnvironment ( const std::string &  environmentDaeFile)

Update secondary objects i.e. environment file in simulation.

Parameters
environmentDaeFiledae file of secondary objects i.e. environment
void UpdateFarPlane ( float  farPlane)

Update far plane in OpenGL view.

Parameters
farPlanedistance of far plane
void UpdateItem ( const std::string &  itemDaeFile)

Update primary objects i.e. items file in simulation.

Parameters
itemDaeFiledae file of primary objects i.e. items
void UpdateNearPlane ( float  nearPlane)

Update near plane in OpenGL view.

Parameters
nearPlanedistance of near plane