00001 #ifndef _RENDERPARAMS_H_
00002 #define _RENDERPARAMS_H_
00003
00004 #include "defs.h"
00005 #include "Enums.h"
00006 #include "Color.h"
00007 #include "Light.h"
00008 #include <cstring>
00009 #include <ostream>
00010 #include <type_traits>
00011
00012 namespace FemViewer {
00013
00014 struct BaseParams {
00015
00016 float proj[16];
00017 float view[16];
00018
00019 float wireframe_col[4];
00020 float border_col[4];
00021 float iso_color[4];
00022 float iso_values[MAX_ISO_VALUES][4];
00023 int num_breaks;
00024 int num_tri_faces;
00025 int edges_on;
00026 int isolines_on;
00027 float light_intensity[4];
00028 float light_ambient[4];
00029
00030
00031 BaseParams() {
00032 int i;
00033 memset(this,0x0,sizeof(BaseParams));
00034
00035 for (i=0;i<4;i++) wireframe_col[i] = 1.0f;
00036
00037 border_col[3] = 1.f;
00038
00039 for (i=0;i<3;i++) iso_color[i] = 0.1f;
00040 iso_color[i] = 1.0f;
00041
00042 for (i=0;i<4;i++) light_intensity[i] = 1.0f;
00043
00044 for (i=0;i<3;i++) light_ambient[i] = 1.0f;
00045 }
00046
00047 };
00048
00049
00050 static_assert(
00051 (sizeof(BaseParams) == (sizeof(float) * 184) &&
00052 std::is_standard_layout<BaseParams>::value),
00053
00054 "BaseParams does not satisfy contiguous storage requirements");
00055
00056 inline std::ostream& operator << (std::ostream& os, const BaseParams& rhs)
00057 {
00058 os << "Basic shader parameters:\n";
00059 os << "\tWireframe color:\t\t{"
00060 << rhs.wireframe_col[0] << ", "
00061 << rhs.wireframe_col[1] << ", "
00062 << rhs.wireframe_col[2] << ", "
00063 << rhs.wireframe_col[3] << "}\n";
00064 os << "\tBorder color:\t\t{"
00065 << rhs.border_col[0] << ", "
00066 << rhs.border_col[1] << ", "
00067 << rhs.border_col[2] << ", "
00068 << rhs.border_col[3] << "}\n";
00069 os << "\tIsovalue color:\t\t{"
00070 << rhs.iso_color[0] << ", "
00071 << rhs.iso_color[1] << ", "
00072 << rhs.iso_color[2] << ", "
00073 << rhs.iso_color[3] << "}\n";
00074 os << "\tNumber of iso-breaks: " << rhs.num_breaks << "\n";
00075 for (int i=0;i<rhs.num_breaks;i++)
00076 os << "\t\tvalue: " << rhs.iso_values[i][3] << "\n";
00077
00078 }
00079
00080 struct RenderParams
00081 {
00082 enum RenderType
00083 {
00084 eFull = 0,
00085 eBoundingBox,
00086 eFast
00087 };
00088
00089 RenderType eRMode;
00090
00091 Render_t eRenderType;
00092
00093 MouseMode eMouseMode;
00094 bool bSmoothNormals;
00095 bool bFacetFrame;
00096 bool bDoubleSided;
00097 ColorRGB cBkgColor;
00098 ColorRGB cEdgeColor;
00099 ColorRGB cVertexIdColor;
00100 ColorRGB cElemIdColor;
00101 int iPrimitiveOptimizerValue;
00102
00103
00104
00105 int iRMode_Fast_Option;
00106 bool bShowNumOfVertices;
00107 bool bShowNumOfElements;
00108 BaseParams sShaderParams;
00109 bool bDrawWireframe;
00110 bool bDrawCutted;
00111 bool bColorShading;
00112 Light cLight;
00113
00114 RenderParams()
00115 : eRMode (eFull)
00116 , eRenderType (RASTERIZATION_GL)
00117 , eMouseMode (MOUSE_NONE)
00118 , bSmoothNormals (false)
00119 , bFacetFrame (false)
00120 , bDoubleSided (false)
00121 , cBkgColor ()
00122 , cEdgeColor ()
00123 , cVertexIdColor(1.f,0.f,1.f)
00124 , cElemIdColor(0.f,1.f,1.f)
00125 , iPrimitiveOptimizerValue(100)
00126 , iRMode_Fast_Option (1)
00127 , bShowNumOfVertices (false)
00128 , bShowNumOfElements (false)
00129 , sShaderParams()
00130 , bDrawWireframe(false)
00131 , bDrawCutted(false)
00132 , bColorShading(true)
00133 , cLight()
00134 {
00135 ;
00136 }
00137
00138 };
00139
00140 }
00141
00142 #endif
00143
00144