VisPro
1.0
Project of Visualisierung 2
|
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 |
Camera * | camera |
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) |
CutawaySurface * | cutaway = 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 = "" |
ZBufferView * | zBufferView = nullptr |
RGBBufferView * | rgbBufferView = nullptr |
TextureView * | tex1View = nullptr |
TextureView * | tex2View = nullptr |
FrameBufferObjectView * | fbo101View = nullptr |
FrameBufferObjectView * | fbo202View = nullptr |
FrameBufferObjectView * | fbo101View_II = nullptr |
FrameBufferObjectView * | fbo202View_II = nullptr |
bool | startSim = false |
Tcl_Interp * | interp = nullptr |
main application file
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.
fileName | filename of TCL script |
int GetDoCutawayCmd | ( | ClientData | clientData, |
Tcl_Interp * | interp, | ||
int | argc, | ||
CONST84 char * | argv[] | ||
) |
TCL command function to return cutaway surface flag to TCL script.
clientData | data handle to interpreter values |
interp | current TCL interpreter |
argc | number of arguments to TCL command |
argv | arguments 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.
clientData | data handle to interpreter values |
interp | current TCL interpreter |
argc | number of arguments to TCL command |
argv | arguments 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.
clientData | data handle to interpreter values |
interp | current TCL interpreter |
argc | number of arguments to TCL command |
argv | arguments 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.
clientData | data handle to interpreter values |
interp | current TCL interpreter |
argc | number of arguments to TCL command |
argv | arguments 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.
window | the 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.
argc_in | pendant to application argc |
argv_in | pendant to application argv |
int main | ( | int | argc, |
char ** | argv | ||
) |
Main entry point of application
argc | number of command line arguments |
argv | command line arguments within a string array |
int SetDoCutawayCmd | ( | ClientData | clientData, |
Tcl_Interp * | interp, | ||
int | argc, | ||
CONST84 char * | argv[] | ||
) |
TCL command function to enable or disable cutaway surface calculation.
clientData | data handle to interpreter values |
interp | current TCL interpreter |
argc | number of arguments to TCL command |
argv | arguments 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.
clientData | data handle to interpreter values |
interp | current TCL interpreter |
argc | number of arguments to TCL command |
argv | arguments 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.
clientData | data handle to interpreter values |
interp | current TCL interpreter |
argc | number of arguments to TCL command |
argv | arguments 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.
clientData | data handle to interpreter values |
interp | current TCL interpreter |
argc | number of arguments to TCL command |
argv | arguments 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.
clientData | data handle to interpreter values |
interp | current TCL interpreter |
argc | number of arguments to TCL command |
argv | arguments 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.
clientData | data handle to interpreter values |
interp | current TCL interpreter |
argc | number of arguments to TCL command |
argv | arguments 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.
clientData | data handle to interpreter values |
interp | current TCL interpreter |
argc | number of arguments to TCL command |
argv | arguments 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.
interp | current TCL interpreter |
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.
window | given GLFW window |
deltaTime | time since last update |
void UpdateDrillAngle | ( | float | drillAngle | ) |
Update drill angle for cutaway surface calculation.
drillAngle | angle that defines the steepness of cutting cones |
void UpdateEnvironment | ( | const std::string & | environmentDaeFile | ) |
Update secondary objects i.e. environment file in simulation.
environmentDaeFile | dae file of secondary objects i.e. environment |
void UpdateFarPlane | ( | float | farPlane | ) |
Update far plane in OpenGL view.
farPlane | distance of far plane |
void UpdateItem | ( | const std::string & | itemDaeFile | ) |
Update primary objects i.e. items file in simulation.
itemDaeFile | dae file of primary objects i.e. items |
void UpdateNearPlane | ( | float | nearPlane | ) |
Update near plane in OpenGL view.
nearPlane | distance of near plane |