Import Geant4 10.7.0 source tree
This commit is contained in:
@@ -22,6 +22,7 @@ namespace sg {
|
||||
typedef size_t bufpos;
|
||||
|
||||
class render_action : public matrix_action {
|
||||
TOOLS_ACTION_NO_COPY(render_action,tools::sg::render_action,matrix_action)
|
||||
public:
|
||||
typedef unsigned int gstoid;
|
||||
public:
|
||||
@@ -76,14 +77,14 @@ public:
|
||||
virtual sg::render_manager& render_manager() = 0; //sg:: is needed.
|
||||
public:
|
||||
render_action(std::ostream& a_out,unsigned int a_ww,unsigned int a_wh)
|
||||
:matrix_action(a_out,a_ww,a_wh){}
|
||||
:parent(a_out,a_ww,a_wh){}
|
||||
virtual ~render_action(){}
|
||||
public:
|
||||
render_action(const render_action& a_from)
|
||||
:matrix_action(a_from)
|
||||
:parent(a_from)
|
||||
{}
|
||||
render_action& operator=(const render_action& a_from){
|
||||
matrix_action::operator=(a_from);
|
||||
parent::operator=(a_from);
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
@@ -114,12 +115,12 @@ public:
|
||||
|
||||
void draw_vertex_array(gl::mode_t a_mode,const std::vector<float>& a_xyzs){
|
||||
const float* _xyzs = vec_data<float>(a_xyzs);
|
||||
draw_vertex_array(a_mode,a_xyzs.size(),_xyzs);
|
||||
draw_vertex_array(a_mode,a_xyzs.size(),_xyzs);
|
||||
}
|
||||
|
||||
void draw_vertex_array_xy(gl::mode_t a_mode,const std::vector<float>& a_xys){
|
||||
const float* _xys = vec_data<float>(a_xys);
|
||||
draw_vertex_array_xy(a_mode,a_xys.size(),_xys);
|
||||
draw_vertex_array_xy(a_mode,a_xys.size(),_xys);
|
||||
}
|
||||
|
||||
void draw_vertex_color_array(gl::mode_t a_mode,
|
||||
@@ -127,7 +128,7 @@ public:
|
||||
const std::vector<float>& a_rgbas){
|
||||
const float* _xyzs = vec_data<float>(a_xyzs);
|
||||
const float* _rgbas = vec_data<float>(a_rgbas);
|
||||
draw_vertex_color_array(a_mode,a_xyzs.size(),_xyzs,_rgbas);
|
||||
draw_vertex_color_array(a_mode,a_xyzs.size(),_xyzs,_rgbas);
|
||||
}
|
||||
|
||||
void draw_vertex_normal_array(gl::mode_t a_mode,
|
||||
@@ -135,7 +136,7 @@ public:
|
||||
const std::vector<float>& a_nms){
|
||||
const float* _xyzs = vec_data<float>(a_xyzs);
|
||||
const float* _nms = vec_data<float>(a_nms);
|
||||
draw_vertex_normal_array(a_mode,a_xyzs.size(),_xyzs,_nms);
|
||||
draw_vertex_normal_array(a_mode,a_xyzs.size(),_xyzs,_nms);
|
||||
}
|
||||
|
||||
void draw_vertex_color_normal_array(gl::mode_t a_mode,
|
||||
@@ -145,30 +146,30 @@ public:
|
||||
const float* _xyzs = vec_data<float>(a_xyzs);
|
||||
const float* _rgbas = vec_data<float>(a_rgbas);
|
||||
const float* _nms = vec_data<float>(a_nms);
|
||||
draw_vertex_color_normal_array(a_mode,a_xyzs.size(),_xyzs,_rgbas,_nms);
|
||||
draw_vertex_color_normal_array(a_mode,a_xyzs.size(),_xyzs,_rgbas,_nms);
|
||||
}
|
||||
|
||||
void normal(const vec3f& a_vec) {normal(a_vec[0],a_vec[1],a_vec[2]);}
|
||||
|
||||
public:
|
||||
// for sphere::visit template.
|
||||
bool add_triangles(size_t a_floatn,const float* a_xyzs,const float* a_nms) {
|
||||
bool add_triangles_normal(size_t a_floatn,const float* a_xyzs,const float* a_nms) {
|
||||
draw_vertex_normal_array(gl::triangles(),a_floatn,a_xyzs,a_nms);
|
||||
return true;
|
||||
}
|
||||
bool add_triangle_fan(size_t a_floatn,const float* a_xyzs,const float* a_nms) {
|
||||
bool add_triangle_fan_normal(size_t a_floatn,const float* a_xyzs,const float* a_nms) {
|
||||
draw_vertex_normal_array(gl::triangle_fan(),a_floatn,a_xyzs,a_nms);
|
||||
return true;
|
||||
}
|
||||
bool add_triangle_fan(size_t a_floatn,const float* a_xyzs,float* a_rgbas,const float* a_nms) {
|
||||
bool add_triangle_fan_normal_rgba(size_t a_floatn,const float* a_xyzs,float* a_nms,const float* a_rgbas) {
|
||||
draw_vertex_color_normal_array(gl::triangle_fan(),a_floatn,a_xyzs,a_rgbas,a_nms);
|
||||
return true;
|
||||
}
|
||||
bool add_triangle_strip(size_t a_floatn,const float* a_xyzs,const float* a_nms) {
|
||||
bool add_triangle_strip_normal(size_t a_floatn,const float* a_xyzs,const float* a_nms) {
|
||||
draw_vertex_normal_array(gl::triangle_strip(),a_floatn,a_xyzs,a_nms);
|
||||
return true;
|
||||
}
|
||||
bool add_triangle_strip(size_t a_floatn,const float* a_xyzs,const float* a_rgbas,const float* a_nms) {
|
||||
bool add_triangle_strip_normal_rgba(size_t a_floatn,const float* a_xyzs,const float* a_nms,const float* a_rgbas) {
|
||||
draw_vertex_color_normal_array(gl::triangle_strip(),a_floatn,a_xyzs,a_rgbas,a_nms);
|
||||
return true;
|
||||
}
|
||||
@@ -203,13 +204,11 @@ public:
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
bool add_triangle_fan_texture(size_t a_floatn,const float* a_xyzs,const float* a_nms,
|
||||
gstoid a_tex,const float* a_texs){
|
||||
bool add_triangle_fan_texture_normal(size_t a_floatn,const float* a_xyzs,const float* a_nms,gstoid a_tex,const float* a_texs){
|
||||
draw_vertex_normal_array_texture(gl::triangle_fan(),a_floatn,a_xyzs,a_nms,a_tex,a_texs);
|
||||
return true;
|
||||
}
|
||||
bool add_triangle_strip_texture(size_t a_floatn,const float* a_xyzs,const float* a_nms,
|
||||
gstoid a_tex,const float* a_texs){
|
||||
bool add_triangle_strip_texture_normal(size_t a_floatn,const float* a_xyzs,const float* a_nms,gstoid a_tex,const float* a_texs){
|
||||
draw_vertex_normal_array_texture(gl::triangle_strip(),a_floatn,a_xyzs,a_nms,a_tex,a_texs);
|
||||
return true;
|
||||
}
|
||||
@@ -235,7 +234,7 @@ public:
|
||||
draw_vertex_array(gl::lines(),a_xyzs.size(),_xyzs);
|
||||
return true;
|
||||
}
|
||||
bool add_triangles(const std::vector<float>& a_xyzs,const std::vector<float>& a_nms){
|
||||
bool add_triangles_normal(const std::vector<float>& a_xyzs,const std::vector<float>& a_nms){
|
||||
if(a_xyzs.size()!=a_nms.size()) return false;
|
||||
const float* _xyzs = vec_data<float>(a_xyzs);
|
||||
const float* _nms = vec_data<float>(a_nms);
|
||||
@@ -244,7 +243,7 @@ public:
|
||||
}
|
||||
bool project_point(const mat4f& a_model_matrix,const mat4f& a_projection_matrix,
|
||||
float& a_x,float& a_y,float& a_z,float& a_w) {
|
||||
//return project_point(a_x,a_y,a_z,a_w);
|
||||
//return project_point(a_x,a_y,a_z,a_w);
|
||||
a_w = 1;
|
||||
a_model_matrix.mul_4f(a_x,a_y,a_z,a_w);
|
||||
a_projection_matrix.mul_4f(a_x,a_y,a_z,a_w);
|
||||
@@ -253,7 +252,7 @@ public:
|
||||
a_y /= a_w;
|
||||
a_z /= a_w;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
/////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////
|
||||
@@ -262,19 +261,19 @@ public:
|
||||
bool add_triangle_strip_as_triangles(size_t a_floatn,const float* a_xyzs,const float* a_nms) { //used in sg::sphere, icosahedron_sphere.
|
||||
// It appears that if glShadeModel is GL_FLAT, triangle strip does not look the same in "gsto mode" where it is rendered as triangles.
|
||||
// We use this function for immediate rendering, in case we want the same rendering as "gsto mode".
|
||||
|
||||
|
||||
size_t num = a_floatn/3;
|
||||
if(num<3) return false;
|
||||
size_t nxyzs = (num-2)*3*3;
|
||||
|
||||
|
||||
std::vector<float> m_xyzs(nxyzs);
|
||||
std::vector<float> m_nms(nxyzs);
|
||||
|
||||
|
||||
{float* pxyzs = vec_data<float>(m_xyzs);
|
||||
float* pnms = vec_data<float>(m_nms);
|
||||
gl::triangle_strip_to_triangles(num,a_xyzs,a_nms,pxyzs,pnms);}
|
||||
gl::triangle_strip_to_triangles_nms(num,a_xyzs,a_nms,pxyzs,pnms);}
|
||||
|
||||
return add_triangles(nxyzs,vec_data<float>(m_xyzs),vec_data<float>(m_nms));
|
||||
return add_triangles_normal(nxyzs,vec_data<float>(m_xyzs),vec_data<float>(m_nms));
|
||||
}
|
||||
|
||||
void dump_vertex_array_xy(std::ostream& a_out,gl::mode_t /*a_mode*/,size_t a_floatn,const float* a_xys) {
|
||||
@@ -285,7 +284,7 @@ public:
|
||||
a_out << "xy : " << index
|
||||
<< " " << a_xys[2*index]
|
||||
<< " " << a_xys[2*index+1]
|
||||
<< std::endl;
|
||||
<< std::endl;
|
||||
}
|
||||
a_out << "dump_vertex_array_xy : end." << std::endl;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user