Import Geant4 10.3.0 source tree
This commit is contained in:
@@ -43,6 +43,7 @@ protected: //gstos
|
||||
//::printf("debug : atb_vertices : %lu : create_gsto : %u\n",this,npt);
|
||||
|
||||
std::vector<float> gsto_data;
|
||||
|
||||
if(rgbas.size()) {
|
||||
if(nms.size()) {
|
||||
if(do_back.value()) {
|
||||
@@ -87,26 +88,25 @@ public:
|
||||
a_action.begin_gsto(_id);
|
||||
if(rgbas.size()) {
|
||||
if(nms.size()) {
|
||||
unsigned int npt = xyzs.values().size()/3;
|
||||
size_t npt = xyzs.values().size()/3;
|
||||
bufpos pos_xyzs = 0;
|
||||
bufpos pos_nms = 0;
|
||||
bufpos pos_back_xyzs = 0;
|
||||
bufpos pos_back_nms = 0;
|
||||
bufpos pos_rgbas = 0;
|
||||
{unsigned int sz = npt*3;
|
||||
{size_t sz = npt*3;
|
||||
if(do_back.value()) {
|
||||
pos_xyzs = 0;
|
||||
pos_nms = sz*sizeof(float); //bytes
|
||||
pos_back_xyzs = 2*sz*sizeof(float);
|
||||
pos_back_nms = 3*sz*sizeof(float);
|
||||
pos_rgbas = 4*sz*sizeof(float);
|
||||
pos_nms = pos_xyzs+sz*sizeof(float); //bytes
|
||||
pos_back_xyzs = pos_nms+sz*sizeof(float);
|
||||
pos_back_nms = pos_back_xyzs+sz*sizeof(float);
|
||||
pos_rgbas = pos_back_nms+sz*sizeof(float);
|
||||
} else {
|
||||
pos_xyzs = 0;
|
||||
pos_nms = sz*sizeof(float);
|
||||
pos_rgbas = 2*sz*sizeof(float);
|
||||
pos_nms = pos_xyzs+sz*sizeof(float);
|
||||
pos_rgbas = pos_nms+sz*sizeof(float);
|
||||
}}
|
||||
|
||||
if(tools::gl::is_line(mode.value())) {
|
||||
if(gl::is_line(mode.value())) {
|
||||
//Same logic as Inventor SoLightModel.model = BASE_COLOR.
|
||||
a_action.set_lighting(false);
|
||||
if(do_back.value()) a_action.draw_gsto_vcn(mode.value(),npt,pos_back_xyzs,pos_rgbas,pos_back_nms);
|
||||
@@ -118,10 +118,10 @@ public:
|
||||
}
|
||||
|
||||
} else {
|
||||
unsigned int npt = xyzs.values().size()/3;
|
||||
size_t npt = xyzs.values().size()/3;
|
||||
bufpos pos_xyzs = 0;
|
||||
bufpos pos_rgbas = npt*3*sizeof(float);
|
||||
if(tools::gl::is_line(mode.value())) {
|
||||
if(gl::is_line(mode.value())) {
|
||||
//Same logic as Inventor SoLightModel.model = BASE_COLOR.
|
||||
a_action.set_lighting(false);
|
||||
a_action.draw_gsto_vc(mode.value(),npt,pos_xyzs,pos_rgbas);
|
||||
@@ -132,10 +132,10 @@ public:
|
||||
}
|
||||
} else { //rgbas.empty()
|
||||
if(nms.size()) {
|
||||
unsigned int npt = xyzs.values().size()/3;
|
||||
size_t npt = xyzs.values().size()/3;
|
||||
bufpos pos_xyzs = 0;
|
||||
bufpos pos_nms = npt*3*sizeof(float);
|
||||
if(tools::gl::is_line(mode.value())) {
|
||||
if(gl::is_line(mode.value())) {
|
||||
//Same logic as Inventor SoLightModel.model = BASE_COLOR.
|
||||
a_action.set_lighting(false);
|
||||
a_action.draw_gsto_vn(mode.value(),npt,pos_xyzs,pos_nms);
|
||||
@@ -144,9 +144,9 @@ public:
|
||||
a_action.draw_gsto_vn(mode.value(),npt,pos_xyzs,pos_nms);
|
||||
}
|
||||
} else {
|
||||
unsigned int npt = xyzs.values().size()/3;
|
||||
size_t npt = xyzs.values().size()/3;
|
||||
bufpos pos = 0;
|
||||
if(tools::gl::is_line(mode.value())) {
|
||||
if(gl::is_line(mode.value())) {
|
||||
//Same logic as Inventor SoLightModel.model = BASE_COLOR.
|
||||
a_action.set_lighting(false);
|
||||
a_action.draw_gsto_v(mode.value(),npt,pos);
|
||||
@@ -170,10 +170,11 @@ public:
|
||||
// immediate rendering :
|
||||
if(rgbas.size()) {
|
||||
if(nms.size()) {
|
||||
if(tools::gl::is_line(mode.value())) {
|
||||
if(gl::is_line(mode.value())) {
|
||||
//Same logic as Inventor SoLightModel.model = BASE_COLOR.
|
||||
a_action.set_lighting(false);
|
||||
if(do_back.value()) a_action.draw_vertex_color_normal_array(mode.value(),m_back_xyzs,rgbas.values(),m_back_nms);
|
||||
if(do_back.value())
|
||||
a_action.draw_vertex_color_normal_array(mode.value(),m_back_xyzs,rgbas.values(),m_back_nms);
|
||||
a_action.draw_vertex_color_normal_array(mode.value(),xyzs.values(),rgbas.values(),nms.values());
|
||||
a_action.set_lighting(state.m_GL_LIGHTING);
|
||||
} else {
|
||||
@@ -183,7 +184,7 @@ public:
|
||||
|
||||
|
||||
} else {
|
||||
if(tools::gl::is_line(mode.value())) {
|
||||
if(gl::is_line(mode.value())) {
|
||||
//Same logic as Inventor SoLightModel.model = BASE_COLOR.
|
||||
a_action.set_lighting(false);
|
||||
a_action.draw_vertex_color_array(mode.value(),xyzs.values(),rgbas.values());
|
||||
@@ -195,7 +196,7 @@ public:
|
||||
|
||||
} else { //rgbas.empty()
|
||||
if(nms.size()) {
|
||||
if(tools::gl::is_line(mode.value())) {
|
||||
if(gl::is_line(mode.value())) {
|
||||
//Same logic as Inventor SoLightModel.model = BASE_COLOR.
|
||||
a_action.set_lighting(false);
|
||||
a_action.draw_vertex_normal_array(mode.value(),xyzs.values(),nms.values());
|
||||
@@ -204,7 +205,7 @@ public:
|
||||
a_action.draw_vertex_normal_array(mode.value(),xyzs.values(),nms.values());
|
||||
}
|
||||
} else {
|
||||
if(tools::gl::is_line(mode.value())) {
|
||||
if(gl::is_line(mode.value())) {
|
||||
//Same logic as Inventor SoLightModel.model = BASE_COLOR.
|
||||
a_action.set_lighting(false);
|
||||
a_action.draw_vertex_array(mode.value(),xyzs.values());
|
||||
@@ -222,15 +223,18 @@ public:
|
||||
:parent()
|
||||
,do_back(false)
|
||||
,epsilon(0)
|
||||
,m_xyzs_pos(0)
|
||||
,m_rgbas_pos(0)
|
||||
,m_nms_pos(0)
|
||||
{
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
add_fields();
|
||||
}
|
||||
virtual ~atb_vertices(){
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::decrement(s_class().c_str());
|
||||
mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
@@ -241,9 +245,12 @@ public:
|
||||
,nms(a_from.nms)
|
||||
,do_back(a_from.do_back)
|
||||
,epsilon(a_from.epsilon)
|
||||
,m_xyzs_pos(a_from.m_xyzs_pos)
|
||||
,m_rgbas_pos(a_from.m_rgbas_pos)
|
||||
,m_nms_pos(a_from.m_nms_pos)
|
||||
{
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
add_fields();
|
||||
}
|
||||
@@ -254,9 +261,22 @@ public:
|
||||
nms = a_from.nms;
|
||||
do_back = a_from.do_back;
|
||||
epsilon = a_from.epsilon;
|
||||
m_xyzs_pos = a_from.m_xyzs_pos;
|
||||
m_rgbas_pos = a_from.m_rgbas_pos;
|
||||
m_nms_pos = a_from.m_nms_pos;
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
void add_pos_color(float a_x,float a_y,float a_z,float a_r,float a_g,float a_b,float a_a) {
|
||||
xyzs.add(a_x);
|
||||
xyzs.add(a_y);
|
||||
xyzs.add(a_z);
|
||||
rgbas.add(a_r);
|
||||
rgbas.add(a_g);
|
||||
rgbas.add(a_b);
|
||||
rgbas.add(a_a);
|
||||
}
|
||||
|
||||
template <class VEC,class COLOR>
|
||||
void add_pos_color(const VEC& a_pos,const COLOR& a_col) {
|
||||
xyzs.add(a_pos.x());
|
||||
@@ -267,6 +287,29 @@ public:
|
||||
rgbas.add(a_col.b());
|
||||
rgbas.add(a_col.a());
|
||||
}
|
||||
|
||||
void allocate_pos_color(size_t a_npt) {
|
||||
xyzs.values().resize(a_npt*3);
|
||||
rgbas.values().resize(a_npt*4);
|
||||
m_xyzs_pos = 0;
|
||||
m_rgbas_pos = 0;
|
||||
}
|
||||
|
||||
template <class VEC,class COLOR>
|
||||
void add_pos_color_allocated(const VEC& a_pos,const COLOR& a_col) {
|
||||
{std::vector<float>& v = xyzs.values();
|
||||
v[m_xyzs_pos] = a_pos.x();m_xyzs_pos++;
|
||||
v[m_xyzs_pos] = a_pos.y();m_xyzs_pos++;
|
||||
v[m_xyzs_pos] = a_pos.z();m_xyzs_pos++;
|
||||
xyzs.touch();}
|
||||
{std::vector<float>& v = rgbas.values();
|
||||
v[m_rgbas_pos] = a_col.r();m_rgbas_pos++;
|
||||
v[m_rgbas_pos] = a_col.g();m_rgbas_pos++;
|
||||
v[m_rgbas_pos] = a_col.b();m_rgbas_pos++;
|
||||
v[m_rgbas_pos] = a_col.a();m_rgbas_pos++;
|
||||
rgbas.touch();}
|
||||
}
|
||||
|
||||
template <class VEC,class COLOR>
|
||||
void add_pos_color_normal(const VEC& a_pos,const COLOR& a_col,const VEC& a_nm) {
|
||||
xyzs.add(a_pos.x());
|
||||
@@ -280,6 +323,36 @@ public:
|
||||
nms.add(a_nm.y());
|
||||
nms.add(a_nm.z());
|
||||
}
|
||||
|
||||
void allocate_pos_color_normal(size_t a_npt) {
|
||||
xyzs.values().resize(a_npt*3);
|
||||
rgbas.values().resize(a_npt*4);
|
||||
nms.values().resize(a_npt*3);
|
||||
m_xyzs_pos = 0;
|
||||
m_rgbas_pos = 0;
|
||||
m_nms_pos = 0;
|
||||
}
|
||||
|
||||
template <class VEC,class COLOR>
|
||||
void add_pos_color_normal_allocated(const VEC& a_pos,const COLOR& a_col,const VEC& a_nm) {
|
||||
{std::vector<float>& v = xyzs.values();
|
||||
v[m_xyzs_pos] = a_pos.x();m_xyzs_pos++;
|
||||
v[m_xyzs_pos] = a_pos.y();m_xyzs_pos++;
|
||||
v[m_xyzs_pos] = a_pos.z();m_xyzs_pos++;
|
||||
xyzs.touch();}
|
||||
{std::vector<float>& v = rgbas.values();
|
||||
v[m_rgbas_pos] = a_col.r();m_rgbas_pos++;
|
||||
v[m_rgbas_pos] = a_col.g();m_rgbas_pos++;
|
||||
v[m_rgbas_pos] = a_col.b();m_rgbas_pos++;
|
||||
v[m_rgbas_pos] = a_col.a();m_rgbas_pos++;
|
||||
rgbas.touch();}
|
||||
{std::vector<float>& v = nms.values();
|
||||
v[m_nms_pos] = a_nm.x();m_nms_pos++;
|
||||
v[m_nms_pos] = a_nm.y();m_nms_pos++;
|
||||
v[m_nms_pos] = a_nm.z();m_nms_pos++;
|
||||
nms.touch();}
|
||||
}
|
||||
|
||||
void add_rgba(float a_r,float a_g,float a_b,float a_a) {
|
||||
rgbas.add(a_r);
|
||||
rgbas.add(a_g);
|
||||
@@ -292,12 +365,20 @@ public:
|
||||
rgbas.add(a_col.b());
|
||||
rgbas.add(a_col.a());
|
||||
}
|
||||
|
||||
void add_normal(float a_x,float a_y,float a_z) {
|
||||
nms.add(a_x);
|
||||
nms.add(a_y);
|
||||
nms.add(a_z);
|
||||
}
|
||||
void add_rgba_allocated(unsigned int& a_pos,float a_r,float a_g,float a_b,float a_a) {
|
||||
template <class VEC>
|
||||
void add_normal(const VEC& a_nm) {
|
||||
nms.add(a_nm.x());
|
||||
nms.add(a_nm.y());
|
||||
nms.add(a_nm.z());
|
||||
}
|
||||
|
||||
void add_rgba_allocated(size_t& a_pos,float a_r,float a_g,float a_b,float a_a) {
|
||||
std::vector<float>& v = rgbas.values();
|
||||
v[a_pos] = a_r;a_pos++;
|
||||
v[a_pos] = a_g;a_pos++;
|
||||
@@ -305,13 +386,36 @@ public:
|
||||
v[a_pos] = a_a;a_pos++;
|
||||
rgbas.touch();
|
||||
}
|
||||
void add_normal_allocated(unsigned int& a_pos,float a_x,float a_y,float a_z) {
|
||||
void add_normal_allocated(size_t& a_pos,float a_x,float a_y,float a_z) {
|
||||
std::vector<float>& v = nms.values();
|
||||
v[a_pos] = a_x;a_pos++;
|
||||
v[a_pos] = a_y;a_pos++;
|
||||
v[a_pos] = a_z;a_pos++;
|
||||
nms.touch();
|
||||
}
|
||||
|
||||
template <class VEC>
|
||||
void add_pos_normal(const VEC& a_pos,const VEC& a_nm) {
|
||||
xyzs.add(a_pos.x());
|
||||
xyzs.add(a_pos.y());
|
||||
xyzs.add(a_pos.z());
|
||||
nms.add(a_nm.x());
|
||||
nms.add(a_nm.y());
|
||||
nms.add(a_nm.z());
|
||||
}
|
||||
|
||||
bool add_dashed_line_rgba(float a_bx,float a_by,float a_bz,
|
||||
float a_ex,float a_ey,float a_ez,
|
||||
unsigned int a_num_dash,
|
||||
float a_r,float a_g,float a_b,float a_a) {
|
||||
if(!parent::add_dashed_line(a_bx,a_by,a_bz,a_ex,a_ey,a_ez,a_num_dash)) return false;
|
||||
for(unsigned int index=0;index<a_num_dash;index++) {
|
||||
add_rgba(a_r,a_g,a_b,a_a);
|
||||
add_rgba(a_r,a_g,a_b,a_a);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void clear() {
|
||||
rgbas.clear();
|
||||
nms.clear();
|
||||
@@ -386,9 +490,15 @@ protected:
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
protected:
|
||||
std::vector<float> m_back_xyzs;
|
||||
std::vector<float> m_back_nms;
|
||||
std::vector<float> m_edges;
|
||||
protected:
|
||||
size_t m_xyzs_pos;
|
||||
size_t m_rgbas_pos;
|
||||
size_t m_nms_pos;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "normal"
|
||||
#include "separator"
|
||||
#include "tools"
|
||||
#include "nodekit"
|
||||
|
||||
#include "../lina/vec3f"
|
||||
#include "../mnmx"
|
||||
@@ -150,7 +151,8 @@ public:
|
||||
update_sg(a_action.out());
|
||||
reset_touched();
|
||||
}
|
||||
m_group.pick(a_action);
|
||||
//m_group.pick(a_action);
|
||||
nodekit_pick(a_action,m_group,this);
|
||||
}
|
||||
virtual void search(search_action& a_action) {
|
||||
parent::search(a_action);
|
||||
@@ -350,9 +352,9 @@ public:
|
||||
|
||||
if(modeling==tick_modeling_hplot()) {
|
||||
|
||||
unsigned int num = m_sub_ticks.size()/4;
|
||||
unsigned int pos = 0;
|
||||
for(unsigned int index=0;index<num;index++) {
|
||||
size_t num = m_sub_ticks.size()/4;
|
||||
size_t pos = 0;
|
||||
for(size_t index=0;index<num;index++) {
|
||||
float bx = m_sub_ticks[pos];pos++;
|
||||
float by = m_sub_ticks[pos];pos++;
|
||||
float ex = m_sub_ticks[pos];pos++;
|
||||
@@ -433,8 +435,8 @@ public:
|
||||
vec3f Y = m_labels_style.y_orientation.value();
|
||||
X.normalize();
|
||||
Y.normalize();
|
||||
vec3f Z = X.cross(Y);
|
||||
Y = Z.cross (X);
|
||||
vec3f Z;X.cross(Y,Z);
|
||||
Z.cross(X,Y);
|
||||
mat4f scale_rot(X.v0(),Y.v0(),Z.v0(),0, //first row
|
||||
X.v1(),Y.v1(),Z.v1(),0,
|
||||
X.v2(),Y.v2(),Z.v2(),0,
|
||||
@@ -631,18 +633,18 @@ public: //style
|
||||
m_mag_style = text_style();
|
||||
m_title_style = text_style();
|
||||
|
||||
m_line_style.color = colorf::black();
|
||||
m_ticks_style.color = colorf::black();
|
||||
m_line_style.color = colorf_black();
|
||||
m_ticks_style.color = colorf_black();
|
||||
|
||||
m_labels_style.color = colorf::black();
|
||||
m_labels_style.color = colorf_black();
|
||||
m_labels_style.font = font_hershey();
|
||||
m_labels_style.encoding = encoding_PAW();
|
||||
|
||||
m_mag_style.color = colorf::black();
|
||||
m_mag_style.color = colorf_black();
|
||||
m_mag_style.font = font_hershey();
|
||||
m_mag_style.encoding = encoding_PAW();
|
||||
|
||||
m_title_style.color = colorf::black();
|
||||
m_title_style.color = colorf_black();
|
||||
m_title_style.font = font_hershey();
|
||||
m_title_style.encoding = encoding_PAW();
|
||||
}
|
||||
@@ -797,8 +799,7 @@ protected:
|
||||
else
|
||||
pmag = startTick != 0.0 ? ffloor(flog10(ffabs(startTick))) : magxxx;
|
||||
|
||||
snpf(pstr,sizeof(pstr),
|
||||
"%%1.%df",(int)tools::mx<float>((pmag-magxxx),0.0));
|
||||
snpf(pstr,sizeof(pstr),"%%1.%df",(int)tools::mx<float>((pmag-magxxx),0.0));
|
||||
|
||||
y = startTick;
|
||||
while (y <= mx*(1.0+NUM_FUZZ)) {
|
||||
@@ -905,9 +906,9 @@ protected:
|
||||
}
|
||||
|
||||
if(labels_enforced) {
|
||||
unsigned int n = labels.size();
|
||||
size_t n = labels.size();
|
||||
if(tick_num>n) {
|
||||
for(unsigned int index=n;index<tick_num;index++) labels.add("");
|
||||
for(size_t index=n;index<tick_num;index++) labels.add("");
|
||||
}
|
||||
} else {
|
||||
labels = tick_labels;
|
||||
@@ -1013,7 +1014,7 @@ protected:
|
||||
|
||||
float range = mx - mn;
|
||||
|
||||
unsigned int tick_num = texts.size();
|
||||
size_t tick_num = texts.size();
|
||||
|
||||
// HPLOT stores the magnitude on the last label :
|
||||
magnitude.value(0);
|
||||
@@ -1025,10 +1026,10 @@ protected:
|
||||
}
|
||||
}
|
||||
|
||||
tick_number.value(tick_num);
|
||||
tick_number.value(uint32(tick_num));
|
||||
values.clear();
|
||||
coords.clear();
|
||||
for(unsigned int index=0;index<tick_num;index++) {
|
||||
for(size_t index=0;index<tick_num;index++) {
|
||||
float coord = (float)texts[index].fX;
|
||||
//NOTE : are we sure that val is in [mn,mx]
|
||||
float val = (coord/width.value()) * range + mn;
|
||||
@@ -1037,25 +1038,25 @@ protected:
|
||||
}
|
||||
|
||||
if(labels_enforced) {
|
||||
unsigned int n = labels.size();
|
||||
size_t n = labels.size();
|
||||
if(tick_num>n) {
|
||||
for(unsigned int index=n;index<tick_num;index++) labels.add("");
|
||||
for(size_t index=n;index<tick_num;index++) labels.add("");
|
||||
}
|
||||
} else {
|
||||
labels.clear();
|
||||
for(unsigned int index=0;index<tick_num;index++) {
|
||||
for(size_t index=0;index<tick_num;index++) {
|
||||
labels.add(texts[index].fString);
|
||||
}
|
||||
}
|
||||
|
||||
{sub_coords.clear();
|
||||
unsigned int num = m_sub_ticks.size()/4;
|
||||
unsigned int pos = 0;
|
||||
for(unsigned int index=0;index<num;index++) {
|
||||
size_t num = m_sub_ticks.size()/4;
|
||||
size_t pos = 0;
|
||||
for(size_t index=0;index<num;index++) {
|
||||
float coord = m_sub_ticks[pos];
|
||||
pos += 4;
|
||||
bool found = false;
|
||||
for(unsigned int i=0;i<tick_num;i++) {
|
||||
for(size_t i=0;i<tick_num;i++) {
|
||||
if((float)texts[i].fX==coord) {
|
||||
found = true;
|
||||
break;
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#define tools_sg_back_area
|
||||
|
||||
#include "node"
|
||||
#include "../colorf"
|
||||
#include "atb_vertices"
|
||||
#include "rgba"
|
||||
#include "draw_style"
|
||||
@@ -114,11 +113,11 @@ public:
|
||||
:parent()
|
||||
,width(1)
|
||||
,height(1)
|
||||
,color(colorf::white())
|
||||
,color(colorf_white())
|
||||
,gradient(false)
|
||||
,color_top(colorf::white())
|
||||
,color_top(colorf_white())
|
||||
,border_visible(true)
|
||||
,border_color(colorf::black())
|
||||
,border_color(colorf_black())
|
||||
,border_line_width(1)
|
||||
,shadow(0)
|
||||
,corner_radius(0) //in percent of the height.
|
||||
@@ -182,7 +181,7 @@ protected:
|
||||
float ye = height*0.5f;
|
||||
|
||||
sg::rgba* mat = new sg::rgba();
|
||||
mat->color = colorf::black();
|
||||
mat->color = colorf_black();
|
||||
m_back_sep.add(mat);
|
||||
|
||||
normal* nm = new normal;
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
#include "visible_action"
|
||||
#include "enums"
|
||||
|
||||
#include "../mathf" //astro
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
|
||||
@@ -87,9 +89,11 @@ public:
|
||||
}
|
||||
virtual void get_matrix(get_matrix_action& a_action){
|
||||
_mult_matrix(a_action);
|
||||
set_state(a_action);
|
||||
}
|
||||
virtual void is_visible(visible_action& a_action){
|
||||
_mult_matrix(a_action);
|
||||
set_state(a_action);
|
||||
}
|
||||
protected:
|
||||
base_camera()
|
||||
@@ -161,16 +165,20 @@ public:
|
||||
orientation.value().mul_vec(vec3f(0,0,-1),a_dir);
|
||||
}
|
||||
|
||||
void rotate_around_direction(float a_delta){
|
||||
void rotate_around_direction(float a_delta) { //used in exlib/examples/iOS/sg.
|
||||
vec3f dir;
|
||||
orientation.value().mul_vec(vec3f(0,0,-1),dir);
|
||||
//_MSC_VER : does not compile : orientation = rotf(dir,a_delta) * orientation;
|
||||
orientation.value(rotf(dir,a_delta) * orientation.value());
|
||||
}
|
||||
|
||||
void rotate_around_up(float a_delta){
|
||||
vec3f up;
|
||||
orientation.value().mul_vec(vec3f(0,1,0),up);
|
||||
orientation.value(rotf(up,a_delta) * orientation.value());
|
||||
//orientation.value(rotf(up,a_delta) * orientation.value());
|
||||
// must be the below so that rot-cam works for exlib/cbk/[pyrfits,astro,cfitsio] astro setup.
|
||||
// (astro setup change camera orientation).
|
||||
orientation.value(orientation.value() * rotf(up,a_delta));
|
||||
}
|
||||
|
||||
void rotate_around_y_at_focal(float a_delta){
|
||||
@@ -203,10 +211,9 @@ public:
|
||||
orientation.value().mul_vec(vec3f(0,0,-1),dir);
|
||||
vec3f up;
|
||||
orientation.value().mul_vec(vec3f(0,1,0),up);
|
||||
vec3f side = dir.cross(up);
|
||||
vec3f side;dir.cross(up,side);
|
||||
vec3f v = side * (side.dot(a_dir)) + dir * (dir.dot(a_dir));
|
||||
if(v.normalize())
|
||||
orientation.value(orientation.value()*rotf(dir,v));}
|
||||
if(v.normalize()) orientation.value(orientation.value()*rotf(dir,v));}
|
||||
|
||||
//rotate around dir^up so that a_dir matches dir.
|
||||
{vec3f dir;
|
||||
@@ -233,7 +240,7 @@ public:
|
||||
orientation.value().mul_vec(vec3f(0,0,-1),dir);
|
||||
vec3f up;
|
||||
orientation.value().mul_vec(vec3f(0,1,0),up);
|
||||
vec3f side = dir.cross(up);
|
||||
vec3f side;dir.cross(up,side);
|
||||
|
||||
vec3f d(a_x,a_y,a_z);
|
||||
d.subtract(position.value());
|
||||
@@ -247,7 +254,7 @@ public:
|
||||
orientation.value().mul_vec(vec3f(0,0,-1),dir);
|
||||
vec3f up;
|
||||
orientation.value().mul_vec(vec3f(0,1,0),up);
|
||||
vec3f side = dir.cross(up);
|
||||
vec3f side;dir.cross(up,side);
|
||||
vec3f pos = position.value() + side * a_delta;
|
||||
position.value(pos);
|
||||
}
|
||||
@@ -287,6 +294,35 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void astro_orientation(float a_ra,float a_dec/*,const vec3f& a_center*/) {
|
||||
// a_ra, a_dec are in decimal degrees.
|
||||
|
||||
// Camera default point toward -z with up along +y and +x at right.
|
||||
|
||||
// Arrange so that camera points toward x with up along +z :
|
||||
rotf r(vec3f::s_y(),-fhalf_pi());
|
||||
r *= rotf(vec3f::s_x(),fhalf_pi());
|
||||
// Now -y is at right.
|
||||
|
||||
// Then rotate it so that it points toward given (ra,dec) by keeping up upward +z direction.
|
||||
r *= rotf(vec3f::s_y(),-a_dec*fdeg2rad());
|
||||
r *= rotf(vec3f::s_z(),a_ra*fdeg2rad());
|
||||
orientation = r;
|
||||
|
||||
/*
|
||||
position = a_center*0.99f;
|
||||
znear = 0.1f;
|
||||
zfar = 200.0f;
|
||||
focal = (a_center-position).length();
|
||||
*/
|
||||
/*
|
||||
position = vec3f(0,0,0);
|
||||
znear = 1.0f;
|
||||
zfar = 2000.0f; //2*sky_radius.
|
||||
focal = a_center.length();
|
||||
da = 0.017f/100; //1/100 of a degree
|
||||
*/
|
||||
}
|
||||
protected:
|
||||
void update_sg(std::ostream& a_out) {
|
||||
|
||||
|
||||
@@ -22,16 +22,18 @@ public:
|
||||
typedef unsigned int unichar;
|
||||
typedef std::vector<unichar> uniline;
|
||||
mf_std_vec<unichar> unitext;
|
||||
//mf_string font_dirs; //do we want that ? It is costly. We should have a sg::font node.
|
||||
public:
|
||||
virtual const std::vector<field_desc>& node_fields() const {
|
||||
TOOLS_FIELD_DESC_NODE_CLASS(tools::sg::base_freetype)
|
||||
static std::vector<tools::sg::field_desc> s_v;
|
||||
static std::vector<field_desc> s_v;
|
||||
if(s_v.empty()) {
|
||||
s_v = parent::node_fields();
|
||||
TOOLS_ADD_FIELD_DESC(font)
|
||||
TOOLS_ADD_FIELD_DESC(front_face)
|
||||
TOOLS_ADD_FIELD_DESC(modeling)
|
||||
TOOLS_ADD_FIELD_DESC(unitext)
|
||||
//TOOLS_ADD_FIELD_DESC(font_dirs)
|
||||
}
|
||||
return s_v;
|
||||
}
|
||||
@@ -41,6 +43,7 @@ private:
|
||||
add_field(&front_face);
|
||||
add_field(&modeling);
|
||||
add_field(&unitext);
|
||||
//add_field(&font_dirs);
|
||||
}
|
||||
public:
|
||||
base_freetype()
|
||||
@@ -52,6 +55,7 @@ public:
|
||||
,modeling(font_filled) //font_outline
|
||||
//,modeling(font_outline)
|
||||
,unitext()
|
||||
//,font_dirs()
|
||||
{
|
||||
add_fields();
|
||||
}
|
||||
@@ -65,6 +69,7 @@ public:
|
||||
,front_face(a_from.front_face)
|
||||
,modeling(a_from.modeling)
|
||||
,unitext(a_from.unitext)
|
||||
//,font_dirs(a_from.font_dirs)
|
||||
{
|
||||
add_fields();
|
||||
}
|
||||
@@ -76,6 +81,7 @@ public:
|
||||
front_face = a_from.front_face;
|
||||
modeling = a_from.modeling;
|
||||
unitext = a_from.unitext;
|
||||
//font_dirs = a_from.font_dirs;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,17 +55,16 @@ public:
|
||||
bool operator!=(const bmf& a_from) const {
|
||||
return !operator==(a_from);
|
||||
}
|
||||
const T& operator[](unsigned int a_index) const {
|
||||
const T& operator[](size_t a_index) const {
|
||||
//WARNING : no check is done on a_index.
|
||||
return m_values[a_index];
|
||||
}
|
||||
T& operator[](unsigned int a_index) {
|
||||
T& operator[](size_t a_index) {
|
||||
//WARNING : no check is done on a_index.
|
||||
return m_values[a_index];
|
||||
}
|
||||
public:
|
||||
//unsigned int number() const {return m_values.size();}
|
||||
unsigned int size() const {return m_values.size();}
|
||||
size_t size() const {return m_values.size();}
|
||||
bool empty() const {return m_values.empty();}
|
||||
const std::vector<T>& values() const {return m_values;}
|
||||
std::vector<T>& values() {return m_values;}
|
||||
@@ -86,13 +85,13 @@ public:
|
||||
m_values.insert(a_it,a_value);
|
||||
m_touched = true;
|
||||
}
|
||||
bool set_value(unsigned int a_index,const T& a_value) {
|
||||
bool set_value(size_t a_index,const T& a_value) {
|
||||
if(a_index>=m_values.size()) return false;
|
||||
if(m_values[a_index]!=a_value) m_touched = true;
|
||||
m_values[a_index] = a_value;
|
||||
return true;
|
||||
}
|
||||
bool get_value(unsigned int a_index,T& a_value) {
|
||||
bool get_value(size_t a_index,T& a_value) {
|
||||
if(a_index>=m_values.size()) {a_value=T();return false;}
|
||||
a_value = m_values[a_index];
|
||||
return true;
|
||||
@@ -114,25 +113,25 @@ public:
|
||||
}
|
||||
|
||||
public: //for iv2sg
|
||||
//bool setValues(unsigned int a_index,unsigned int a_num,const T* a_vs) {
|
||||
// for(unsigned int index=0;index<a_num;index++) {
|
||||
//bool setValues(size_t a_index,size_t a_num,const T* a_vs) {
|
||||
// for(size_t index=0;index<a_num;index++) {
|
||||
// if(!set1Value(a_index+index,a_vs[index])) return false;
|
||||
// }
|
||||
// return true;
|
||||
//}
|
||||
|
||||
bool setValues(unsigned int a_index,unsigned int a_num,const T* a_vs) {
|
||||
bool setValues(size_t a_index,size_t a_num,const T* a_vs) {
|
||||
// 012345678
|
||||
// 234
|
||||
if((a_index+a_num)>=m_values.size()) m_values.resize(a_index+a_num);
|
||||
for(unsigned int index=0;index<a_num;index++) {
|
||||
for(size_t index=0;index<a_num;index++) {
|
||||
if(a_vs[index]!=m_values[a_index+index]) m_touched = true;
|
||||
m_values[a_index+index] = a_vs[index];
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool set1Value(unsigned int a_index,const T& a_value) {
|
||||
bool set1Value(size_t a_index,const T& a_value) {
|
||||
if(a_index>=m_values.size()) m_values.resize(a_index+1);
|
||||
if(m_values[a_index]!=a_value) m_touched = true;
|
||||
m_values[a_index] = a_value;
|
||||
|
||||
@@ -30,15 +30,15 @@ public:
|
||||
}
|
||||
virtual ~base_colormap(){}
|
||||
public:
|
||||
unsigned int colorn() const {return m_colors.size();}
|
||||
unsigned int valn() const {return m_values.size();}
|
||||
size_t colorn() const {return m_colors.size();}
|
||||
size_t valn() const {return m_values.size();}
|
||||
colorf color(unsigned int a_index) const {
|
||||
unsigned int n = m_colors.size();
|
||||
size_t n = m_colors.size();
|
||||
if(a_index>=n) return colorf(0.5F,0.5F,0.5F);
|
||||
return m_colors[a_index];
|
||||
}
|
||||
float value(unsigned int a_index) const {
|
||||
unsigned int n = m_values.size();
|
||||
size_t n = m_values.size();
|
||||
if(a_index>=n) return 0;
|
||||
return m_values[a_index];
|
||||
}
|
||||
@@ -55,7 +55,7 @@ public:
|
||||
}
|
||||
|
||||
void set_PAW_coloring() {
|
||||
unsigned int _valn = m_values.size();
|
||||
size_t _valn = m_values.size();
|
||||
if(_valn==1) {
|
||||
m_values[0] = take_log(m_values[0]);
|
||||
} else if(_valn>=2) {
|
||||
@@ -64,7 +64,7 @@ public:
|
||||
float vmin = take_log(m_values[0]);
|
||||
float vmax = take_log(m_values[_valn-1]);
|
||||
float dv = (vmax-vmin)/(_valn-1);
|
||||
for(unsigned int count=0;count<_valn;count++) {
|
||||
for(size_t count=0;count<_valn;count++) {
|
||||
m_values[count] = vmin + dv * count;
|
||||
}
|
||||
}
|
||||
@@ -121,8 +121,8 @@ protected:
|
||||
// black 10 cyan 50 green 100 orange 200 blue 300 pink 400 red
|
||||
std::vector<std::string> ws;
|
||||
words(aString," ",false,ws);
|
||||
int wordn = ws.size();
|
||||
int number = wordn/2;
|
||||
size_t wordn = ws.size();
|
||||
size_t number = wordn/2;
|
||||
if(number<=0) {
|
||||
aValues.clear();
|
||||
aColors.clear();
|
||||
@@ -144,7 +144,7 @@ protected:
|
||||
// <col> <num> <col> ... <num> <col>
|
||||
aValues.resize(number);
|
||||
aColors.resize(number+1);
|
||||
for(int count=0;count<number;count++) {
|
||||
for(size_t count=0;count<number;count++) {
|
||||
{const std::string& word = ws[2*count];
|
||||
if(!sg::find_color(a_cmaps,word,aColors[count])) {
|
||||
a_out << "by_value_colormap::set_by_value :"
|
||||
@@ -179,7 +179,7 @@ protected:
|
||||
// <num> <col> <num> ... <col> <num>
|
||||
aValues.resize(number+1);
|
||||
aColors.resize(number);
|
||||
for(int count=0;count<number;count++) {
|
||||
for(size_t count=0;count<number;count++) {
|
||||
{const std::string& word = ws[2*count];
|
||||
if(!to(word,aValues[count])) {
|
||||
a_out << "by_value_colormap::set_by_value :"
|
||||
@@ -238,8 +238,8 @@ protected:
|
||||
// colors[4] blue
|
||||
// colors[5] pink
|
||||
// colors[6] red
|
||||
unsigned int _valn = aValues.size();
|
||||
if(!_valn) {a_col = colorf::black();return;}
|
||||
size_t _valn = aValues.size();
|
||||
if(!_valn) {a_col = colorf_black();return;}
|
||||
if(aColors.size()==(_valn+1)) {
|
||||
// col0 val0 col1 val1 col2 val2 col3
|
||||
if(aValue<aValues[0]) {
|
||||
@@ -263,9 +263,9 @@ protected:
|
||||
}
|
||||
if(aValue<aValues[0]) {a_col = aColors[0];return;}
|
||||
if(aValue>=aValues[_valn-1]) {a_col = aColors[aColors.size()-1];return;}
|
||||
a_col = colorf::black();
|
||||
a_col = colorf_black();
|
||||
} else {
|
||||
a_col = colorf::black();
|
||||
a_col = colorf_black();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,9 +47,9 @@ protected: //gstos
|
||||
//bool draw_edges = state.m_GL_LIGHTING?false:true;
|
||||
//if(draw_edges) {
|
||||
|
||||
{unsigned int nsegs = 24; //4 segs * 6 faces.
|
||||
unsigned int ngsto = nsegs*2*3; //2 points * 3 coords.
|
||||
unsigned int sz = gsto_data.size();
|
||||
{size_t nsegs = 24; //4 segs * 6 faces.
|
||||
size_t ngsto = nsegs*2*3; //2 points * 3 coords.
|
||||
size_t sz = gsto_data.size();
|
||||
gsto_data.resize(sz+ngsto);
|
||||
float* pxyz = tools::vec_data<float>(gsto_data)+sz;
|
||||
floatp lines;
|
||||
@@ -57,10 +57,10 @@ protected: //gstos
|
||||
::memcpy(pxyz,lines,ngsto*sizeof(float));
|
||||
m_gsto_segs_sz = ngsto;}
|
||||
|
||||
{unsigned int ntris = 12;
|
||||
unsigned int nxyzs = ntris*3*3; //3 points * 3 coords
|
||||
unsigned int ngsto = nxyzs*2; //xyz+nms
|
||||
unsigned int sz = gsto_data.size();
|
||||
{size_t ntris = 12;
|
||||
size_t nxyzs = ntris*3*3; //3 points * 3 coords
|
||||
size_t ngsto = nxyzs*2; //xyz+nms
|
||||
size_t sz = gsto_data.size();
|
||||
gsto_data.resize(sz+ngsto);
|
||||
float* pxyz = tools::vec_data<float>(gsto_data)+sz;
|
||||
floatp tris,nms;
|
||||
@@ -730,8 +730,8 @@ protected:
|
||||
}
|
||||
|
||||
protected:
|
||||
unsigned int m_gsto_segs_sz;
|
||||
unsigned int m_gsto_tris_sz;
|
||||
size_t m_gsto_segs_sz;
|
||||
size_t m_gsto_tris_sz;
|
||||
/*
|
||||
enum draw_style {
|
||||
draw_point = 0,
|
||||
|
||||
@@ -61,8 +61,7 @@ public:
|
||||
state.m_line_pattern = line_pattern;
|
||||
state.m_point_size = point_size;
|
||||
state.m_GL_CULL_FACE = cull_face;
|
||||
state.m_winding =
|
||||
winding_ccw.value()?tools::sg::winding_ccw:tools::sg::winding_cw;
|
||||
state.m_winding = winding_ccw.value()?tools::sg::winding_ccw:tools::sg::winding_cw;
|
||||
|
||||
if(style.value()==lines) {
|
||||
//no LINE_STIPPLE in GLES.
|
||||
|
||||
@@ -141,7 +141,8 @@ enum number_type {
|
||||
number_uint,
|
||||
number_int,
|
||||
number_real,
|
||||
number_ip
|
||||
number_ip,
|
||||
number_radec
|
||||
};
|
||||
|
||||
enum camera_type {
|
||||
@@ -161,6 +162,12 @@ enum layout_policy {
|
||||
//layout_text_at_right_of_image = 2
|
||||
};
|
||||
|
||||
enum auto_lut_policy {
|
||||
auto_lut_none = 0,
|
||||
auto_lut_min_max = 1,
|
||||
auto_lut_mean_rms = 2
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -69,7 +69,10 @@ protected:
|
||||
static const std::string s_node_class(#a__class);
|
||||
|
||||
#define TOOLS_ADD_FIELD_DESC(a__field) \
|
||||
s_v.push_back(tools::sg::field_desc(s_node_class+"."+#a__field,this->a__field.s_cls(),(char*)((tools::sg::field*)&(this->a__field))-(char*)((tools::sg::node*)this)));
|
||||
s_v.push_back(tools::sg::field_desc(s_node_class+"."+#a__field,this->a__field.s_cls(),(char*)((tools::sg::field*)&(this->a__field))-(char*)((tools::sg::node*)this),true));
|
||||
|
||||
#define TOOLS_ADD_FIELD_DESC_NOT_EDITABLE(a__field) \
|
||||
s_v.push_back(tools::sg::field_desc(s_node_class+"."+#a__field,this->a__field.s_cls(),(char*)((tools::sg::field*)&(this->a__field))-(char*)((tools::sg::node*)this),false));
|
||||
|
||||
#define TOOLS_ADD_FIELD_DESC_ENUM(a__key) s_v.back().add_enum(#a__key,a__key);
|
||||
#define TOOLS_ADD_FIELD_DESC_OPT(a__value) s_v.back().add_opt(a__value);
|
||||
|
||||
@@ -20,10 +20,12 @@ public:
|
||||
field_desc():m_offset(0){} //touchy
|
||||
field_desc(const std::string& a_name,
|
||||
const std::string& a_class,
|
||||
offset_t a_offset)
|
||||
offset_t a_offset,
|
||||
bool a_editable)
|
||||
:m_name(a_name)
|
||||
,m_class(a_class)
|
||||
,m_offset(a_offset)
|
||||
,m_editable(a_editable)
|
||||
{}
|
||||
virtual ~field_desc(){}
|
||||
public:
|
||||
@@ -31,6 +33,7 @@ public:
|
||||
:m_name(a_from.m_name)
|
||||
,m_class(a_from.m_class)
|
||||
,m_offset(a_from.m_offset)
|
||||
,m_editable(a_from.m_editable)
|
||||
,m_enums(a_from.m_enums)
|
||||
,m_opts(a_from.m_opts)
|
||||
{}
|
||||
@@ -38,6 +41,7 @@ public:
|
||||
m_name = a_from.m_name;
|
||||
m_class = a_from.m_class;
|
||||
m_offset = a_from.m_offset;
|
||||
m_editable = a_from.m_editable;
|
||||
m_enums = a_from.m_enums;
|
||||
m_opts = a_from.m_opts;
|
||||
return *this;
|
||||
@@ -53,10 +57,13 @@ public:
|
||||
|
||||
void add_opt(const std::string& a_value) {m_opts.push_back(a_value);}
|
||||
const std::vector<std::string>& opts() const {return m_opts;}
|
||||
|
||||
bool editable() const {return m_editable;}
|
||||
protected:
|
||||
std::string m_name;
|
||||
std::string m_class;
|
||||
offset_t m_offset;
|
||||
bool m_editable;
|
||||
std::vector<enum_t> m_enums;
|
||||
std::vector<std::string> m_opts;
|
||||
};
|
||||
|
||||
@@ -14,12 +14,13 @@ namespace sg {
|
||||
|
||||
class gl_manager {
|
||||
public:
|
||||
virtual void begin_render(unsigned int,unsigned int, //drawing area size
|
||||
float,float,float,float) = 0; //back color
|
||||
virtual bool begin_render(int,int, //drawing area pos
|
||||
unsigned int,unsigned int, //drawing area size
|
||||
float,float,float,float,bool a_clear = true) = 0; //back color
|
||||
virtual void end_render() = 0;
|
||||
|
||||
virtual unsigned int create_texture(const tools::img_byte&) = 0;
|
||||
virtual unsigned int create_gsto_from_data(unsigned int,const float*) = 0;
|
||||
virtual unsigned int create_gsto_from_data(size_t,const float*) = 0;
|
||||
|
||||
virtual bool is_gsto_id_valid(unsigned int) const = 0;
|
||||
virtual void delete_gsto(unsigned int) = 0;
|
||||
@@ -29,8 +30,8 @@ public:
|
||||
virtual void set_gsto_mode(gsto_mode) = 0;
|
||||
virtual void available_gsto_modes(std::vector<std::string>&) = 0;
|
||||
virtual void available_not_memory_gsto_mode(std::string&) const = 0;
|
||||
virtual unsigned int used_texture_memory() const = 0;
|
||||
virtual unsigned int gstos_size() const = 0;
|
||||
virtual size_t used_texture_memory() const = 0;
|
||||
virtual size_t gstos_size() const = 0;
|
||||
public:
|
||||
virtual ~gl_manager(){}
|
||||
public:
|
||||
|
||||
@@ -137,8 +137,7 @@ public:
|
||||
template <class T>
|
||||
T* rsearch_from(const node* a_node) const {
|
||||
bool found = false;
|
||||
std::vector<node*>::const_reverse_iterator it;
|
||||
for(it=m_children.rbegin();it!=m_children.rend();++it) {
|
||||
tools_vforcrit(node*,m_children,it) {
|
||||
// the below logic permits to test a_node.
|
||||
if(!found) {if(*it==a_node) found = true;}
|
||||
if(found) {
|
||||
@@ -154,8 +153,7 @@ public:
|
||||
const std::string& a_class,
|
||||
bool a_inc_a_node = true) const {
|
||||
bool found = false;
|
||||
std::vector<node*>::const_reverse_iterator it;
|
||||
for(it=m_children.rbegin();it!=m_children.rend();++it) {
|
||||
tools_vforcrit(node*,m_children,it) {
|
||||
// the below logic permits to test a_node.
|
||||
if(!found) {
|
||||
if(*it==a_node) {
|
||||
@@ -236,9 +234,9 @@ public:
|
||||
void raw_clear(){ //used for sg coming from exlib/rroot/vis_volume.
|
||||
tools::raw_clear<node>(m_children);
|
||||
}
|
||||
unsigned int size() const {return m_children.size();}
|
||||
size_t size() const {return m_children.size();}
|
||||
bool empty() const {return m_children.size()?false:true;}
|
||||
node* operator[](unsigned int a_index) const{
|
||||
node* operator[](size_t a_index) const{
|
||||
//WARNING : no check is done on a_index.
|
||||
return m_children[a_index];
|
||||
}
|
||||
@@ -270,18 +268,16 @@ public:
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
*/
|
||||
template <class T>
|
||||
T* rsearch() const {
|
||||
std::vector<node*>::const_reverse_iterator it;
|
||||
for(it=m_children.rbegin();it!=m_children.rend();++it) {
|
||||
T* rsearch() const { //used in agora.
|
||||
tools_vforcrit(node*,m_children,it) {
|
||||
T* o = safe_cast<node,T>(*(*it));
|
||||
if(o) return o;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
bool position(const node* a_node,unsigned int& a_index) const {
|
||||
a_index = 0;
|
||||
tools_vforcit(node*,m_children,it) {
|
||||
|
||||
@@ -138,7 +138,7 @@ public:
|
||||
,rstrings()
|
||||
,num_spaces(4)
|
||||
|
||||
,color(colorf::black())
|
||||
,color(colorf_black())
|
||||
,font(font_hershey())
|
||||
,encoding(encoding_PAW())
|
||||
,line_width(1)
|
||||
|
||||
@@ -113,7 +113,7 @@ public:
|
||||
:parent()
|
||||
,strings()
|
||||
|
||||
,color(colorf::black())
|
||||
,color(colorf_black())
|
||||
//,transparency(0)
|
||||
,font(font_hershey())
|
||||
,encoding(encoding_PAW())
|
||||
@@ -241,7 +241,7 @@ public:
|
||||
m_sep.add(_sep);
|
||||
|
||||
rgba* mat = new rgba();
|
||||
mat->color = colorf::black();
|
||||
mat->color = colorf_black();
|
||||
_sep->add(mat);
|
||||
|
||||
if(font==font_hershey()) {
|
||||
|
||||
@@ -58,13 +58,13 @@ public:
|
||||
,lines()
|
||||
{
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
add_fields();
|
||||
}
|
||||
virtual ~line_set(){
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::decrement(s_class().c_str());
|
||||
mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
@@ -73,7 +73,7 @@ public:
|
||||
,lines(a_from.lines)
|
||||
{
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
add_fields();
|
||||
}
|
||||
@@ -84,7 +84,7 @@ public:
|
||||
}
|
||||
public:
|
||||
bool add(const line_t& a_line) {
|
||||
unsigned int npoint = a_line.size()/3;
|
||||
size_t npoint = a_line.size()/3;
|
||||
if(npoint*3!=a_line.size()) return false;
|
||||
lines.add(a_line);
|
||||
return true;
|
||||
|
||||
@@ -45,7 +45,7 @@ public:
|
||||
line_style()
|
||||
:parent()
|
||||
,visible(true)
|
||||
,color(colorf::black())
|
||||
,color(colorf_black())
|
||||
,width(1)
|
||||
,pattern(line_solid)
|
||||
{
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace sg {
|
||||
|
||||
class manager_zb : public virtual gl_manager {
|
||||
public:
|
||||
virtual void begin_render(unsigned int,unsigned int,float,float,float,float) {}
|
||||
virtual bool begin_render(int,int,unsigned int,unsigned int,float,float,float,float,bool = true) {return true;}
|
||||
virtual void end_render() {}
|
||||
|
||||
virtual unsigned int create_texture(const tools::img_byte& a_img) {
|
||||
@@ -22,7 +22,7 @@ public:
|
||||
return m_gen_id;
|
||||
}
|
||||
|
||||
virtual unsigned int create_gsto_from_data(unsigned int,const float*) {return 0;}
|
||||
virtual unsigned int create_gsto_from_data(size_t,const float*) {return 0;}
|
||||
|
||||
virtual bool is_gsto_id_valid(unsigned int a_id) const {
|
||||
gstos_t::const_iterator it = m_gstos.find(a_id);
|
||||
@@ -39,21 +39,23 @@ public:
|
||||
virtual void set_gsto_mode(tools::sg::gsto_mode) {}
|
||||
virtual void available_gsto_modes(std::vector<std::string>& a_v) {a_v.clear();}
|
||||
virtual void available_not_memory_gsto_mode(std::string& a_s) const {a_s.clear();}
|
||||
virtual unsigned int used_texture_memory() const {return 0;}
|
||||
virtual unsigned int gstos_size() const {return 0;}
|
||||
virtual size_t used_texture_memory() const {return 0;}
|
||||
virtual size_t gstos_size() const {return 0;}
|
||||
public:
|
||||
manager_zb():m_gen_id(0){}
|
||||
virtual ~manager_zb(){}
|
||||
virtual ~manager_zb(){
|
||||
m_gstos.clear();
|
||||
}
|
||||
public:
|
||||
manager_zb(const manager_zb& a_from)
|
||||
:gl_manager(a_from)
|
||||
,m_gen_id(0)
|
||||
,m_gstos(a_from.m_gstos)
|
||||
,m_gstos()
|
||||
{}
|
||||
manager_zb& operator=(const manager_zb& a_from){
|
||||
if(&a_from==this) return *this;
|
||||
m_gen_id = 0;
|
||||
m_gstos = a_from.m_gstos;
|
||||
m_gstos.clear();
|
||||
return *this;
|
||||
}
|
||||
public:
|
||||
@@ -63,7 +65,10 @@ public:
|
||||
a_img = (*it).second;
|
||||
return true;
|
||||
}
|
||||
void cleanup() {}
|
||||
//void cleanup() {}
|
||||
void delete_gstos() {
|
||||
m_gstos.clear();
|
||||
}
|
||||
protected:
|
||||
unsigned int m_gen_id;
|
||||
typedef std::map<unsigned int,tools::img_byte> gstos_t;
|
||||
|
||||
@@ -54,27 +54,29 @@ public:
|
||||
}
|
||||
virtual void get_matrix(get_matrix_action& a_action) {
|
||||
a_action.model_matrix().mul_mtx(mtx.value(),m_tmp);
|
||||
a_action.state().m_model = a_action.model_matrix();
|
||||
}
|
||||
virtual void is_visible(visible_action& a_action) {
|
||||
a_action.model_matrix().mul_mtx(mtx.value(),m_tmp);
|
||||
a_action.state().m_model = a_action.model_matrix();
|
||||
}
|
||||
public:
|
||||
matrix():parent(),mtx(tools::mat4f()) {
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
add_fields();
|
||||
mtx.set_identity();
|
||||
}
|
||||
virtual ~matrix(){
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::decrement(s_class().c_str());
|
||||
mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
matrix(const matrix& a_from):parent(a_from),mtx(a_from.mtx) {
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
add_fields();
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ public:
|
||||
public:
|
||||
virtual bool write(io::iwbuf& a_buffer) {
|
||||
const std::vector<T>& vec = parent::m_values;
|
||||
return a_buffer.write_vec(vec.size(),vec_data(vec));
|
||||
return a_buffer.write_vec((uint32)vec.size(),vec_data(vec));
|
||||
}
|
||||
virtual bool read(io::irbuf& a_buffer) {
|
||||
std::vector<T>& vec = parent::m_values;
|
||||
@@ -128,7 +128,7 @@ public:
|
||||
std::vector<int16> v; //an enum can be negative.
|
||||
typedef typename std::vector<T>::const_iterator cit_t;
|
||||
for(cit_t it=vec.begin();it!=vec.end();++it) v.push_back(*it);
|
||||
return a_buffer.write_vec(v.size(),vec_data(v));
|
||||
return a_buffer.write_vec((uint32)v.size(),vec_data(v));
|
||||
}
|
||||
virtual bool read(io::irbuf& a_buffer) {
|
||||
std::vector<int16> v; //an enum can be negative.
|
||||
@@ -206,11 +206,11 @@ public:
|
||||
for(cit_t it=vec.begin();it!=vec.end();++it) {
|
||||
|
||||
const T& v = (*it);
|
||||
unsigned int num = v.size();
|
||||
size_t num = v.size();
|
||||
const TT* d = get_data(v);
|
||||
|
||||
std::vector<TT> std_vec(num);
|
||||
for(unsigned int i=0;i<num;i++) std_vec[i] = d[i];
|
||||
for(size_t i=0;i<num;i++) std_vec[i] = d[i];
|
||||
|
||||
vec_vec.push_back(std_vec);
|
||||
}
|
||||
|
||||
@@ -154,7 +154,8 @@ protected:
|
||||
<< " : field not found."
|
||||
<< "."
|
||||
<< std::endl;
|
||||
/*
|
||||
//#define TOOLS_NODE_DEBUG_READ_FIELD
|
||||
#ifdef TOOLS_NODE_DEBUG_READ_FIELD
|
||||
check_fields(a_action.out()); //costly.
|
||||
dump_field_descs(a_action.out());
|
||||
{a_action.out() << "read field descs of node class " << s_cls() << " :" << std::endl;
|
||||
@@ -171,7 +172,7 @@ protected:
|
||||
<< std::endl;
|
||||
}}
|
||||
::exit(0);
|
||||
*/
|
||||
#endif
|
||||
fd = a_action.field_factory().create(fdesc.cls());
|
||||
if(!fd) {
|
||||
a_action.out() << "tools::node::read_fields :"
|
||||
|
||||
@@ -42,13 +42,13 @@ public:
|
||||
,height(2)
|
||||
{
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
add_fields();
|
||||
}
|
||||
virtual ~ortho(){
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::decrement(s_class().c_str());
|
||||
mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
,height(a_from.height)
|
||||
{
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
add_fields();
|
||||
}
|
||||
|
||||
@@ -204,6 +204,13 @@ public:
|
||||
set_to_pick_ndc(); //OPTIMIZATION
|
||||
}
|
||||
|
||||
void get_area(float& a_l,float& a_r,float& a_b,float& a_t) const {
|
||||
a_l = m_l;
|
||||
a_r = m_r;
|
||||
a_b = m_b;
|
||||
a_t = m_t;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////
|
||||
/////////////////////////////////////////////
|
||||
/////////////////////////////////////////////
|
||||
@@ -293,7 +300,7 @@ public:
|
||||
public:
|
||||
bool add__primitive_xy(sg::node& a_node,
|
||||
gl::mode_t a_mode,
|
||||
unsigned int a_floatn,const float* a_xys,
|
||||
size_t a_floatn,const float* a_xys,
|
||||
bool a_stop = false,
|
||||
bool a_triangle_revert = false){
|
||||
if(!a_floatn) return false;
|
||||
@@ -341,9 +348,7 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool add__line_strip_xy(sg::node& a_node,
|
||||
unsigned int a_floatn,const float* a_xys,
|
||||
bool a_stop = false){
|
||||
bool add__line_strip_xy(sg::node& a_node,size_t a_floatn,const float* a_xys,bool a_stop = false){
|
||||
if(!a_floatn) return false;
|
||||
if(m_stop_at_first){
|
||||
add_line_strip_xy(a_floatn,a_xys,a_stop);
|
||||
@@ -390,7 +395,7 @@ public:
|
||||
public:
|
||||
bool add__primitive(sg::node& a_node,
|
||||
gl::mode_t a_mode,
|
||||
unsigned int a_floatn,const float* a_xyzs,
|
||||
size_t a_floatn,const float* a_xyzs,
|
||||
bool a_stop = false){
|
||||
if(!a_floatn) return false;
|
||||
if(m_stop_at_first){
|
||||
@@ -437,7 +442,7 @@ public:
|
||||
}
|
||||
|
||||
bool add__line_strip(sg::node& a_node,
|
||||
unsigned int a_floatn,const float* a_xyzs,
|
||||
size_t a_floatn,const float* a_xyzs,
|
||||
bool a_stop = false){
|
||||
if(!a_floatn) return false;
|
||||
if(m_stop_at_first){
|
||||
@@ -460,7 +465,7 @@ public:
|
||||
}
|
||||
|
||||
bool add__triangles(sg::node& a_node,
|
||||
unsigned int a_floatn,
|
||||
size_t a_floatn,
|
||||
const float* a_xyzs,
|
||||
bool a_stop = false){
|
||||
if(!a_floatn) return false;
|
||||
@@ -675,13 +680,13 @@ protected:
|
||||
//NOTE : optimize ?
|
||||
|
||||
vec3f O(0,0,0);
|
||||
line<float> ln(O,O+vec3f(0,0,1));
|
||||
line<vec3f> ln(O,O+vec3f(0,0,1));
|
||||
|
||||
vec3f pz;
|
||||
{vec3f p1(x1,y1,a_1z);
|
||||
vec3f p2(x2,y2,a_2z);
|
||||
vec3f p3(x3,y3,a_3z);
|
||||
plane<float> pl(p1,p2,p3);
|
||||
plane<vec3f> pl(p1,p2,p3);
|
||||
if(!pl.intersect(ln,pz)) {
|
||||
m_out << "pick_action::intersect_triangle :"
|
||||
<< " z plane/line intersection failed."
|
||||
@@ -697,14 +702,14 @@ protected:
|
||||
{vec3f p1(x1,y1,a_1w);
|
||||
vec3f p2(x2,y2,a_2w);
|
||||
vec3f p3(x3,y3,a_3w);
|
||||
plane<float> pl(p1,p2,p3);
|
||||
plane<vec3f> pl(p1,p2,p3);
|
||||
if(!pl.intersect(ln,pw)) {
|
||||
m_out << "pick_action::intersect_triangle :"
|
||||
<< " plane/line intersection failed."
|
||||
<< std::endl;
|
||||
return false;
|
||||
}}
|
||||
//::printf("debug : w plane %g\n",p[2]);
|
||||
//::printf("debug : w planey %g\n",p[2]);
|
||||
|
||||
//m_out << "pick_action::intersect_triangle :"
|
||||
// << " p " << p[0] << " " << p[1] << " " << p[2]
|
||||
@@ -718,8 +723,8 @@ protected:
|
||||
{vec3f p1(x1,y1,a_1z);
|
||||
vec3f p2(x2,y2,a_2z);
|
||||
vec3f p3(x3,y3,a_3z);
|
||||
line<float> l1p(p1,pz);
|
||||
line<float> l23(p2,p3);
|
||||
line<vec3f> l1p(p1,pz);
|
||||
line<vec3fy> l23(p2,p3);
|
||||
vec3f q; //on 23 side.
|
||||
float prec = 1e10-8;
|
||||
if(!l1p.intersect(l23,q,prec)) {
|
||||
|
||||
@@ -71,7 +71,7 @@ private:
|
||||
public:
|
||||
class updater {
|
||||
public:
|
||||
virtual void update(plots&,unsigned int) = 0;
|
||||
virtual void update(plots&,size_t) = 0;
|
||||
virtual updater* copy() const = 0;
|
||||
public:
|
||||
virtual ~updater(){}
|
||||
@@ -140,7 +140,7 @@ public:
|
||||
,border_visible(false)
|
||||
,border_width(0)
|
||||
,border_height(0)
|
||||
,border_color(colorf::grey())
|
||||
,border_color(colorf_grey())
|
||||
|
||||
,m_ttf(a_ttf)
|
||||
,m_current(0)
|
||||
@@ -228,8 +228,8 @@ public:
|
||||
|
||||
void clear() {
|
||||
if(m_sep.empty()) update_sg();
|
||||
unsigned int _number = m_sep.size();
|
||||
for(unsigned int index=0;index<_number;index++) {
|
||||
size_t _number = m_sep.size();
|
||||
for(size_t index=0;index<_number;index++) {
|
||||
reg_t* sep = (reg_t*)m_sep[index];
|
||||
plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
|
||||
_plotter->clear();
|
||||
@@ -238,8 +238,8 @@ public:
|
||||
|
||||
bool has_data() {
|
||||
if(m_sep.empty()) update_sg();
|
||||
unsigned int _number = m_sep.size();
|
||||
for(unsigned int index=0;index<_number;index++) {
|
||||
size_t _number = m_sep.size();
|
||||
for(size_t index=0;index<_number;index++) {
|
||||
reg_t* sep = (reg_t*)m_sep[index];
|
||||
plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
|
||||
if(_plotter->plottables().size()) return true;
|
||||
@@ -249,8 +249,8 @@ public:
|
||||
|
||||
void touch_plotters() { //used in exlib/geant4/session.
|
||||
if(m_sep.empty()) update_sg();
|
||||
unsigned int _number = m_sep.size();
|
||||
for(unsigned int index=0;index<_number;index++) {
|
||||
size_t _number = m_sep.size();
|
||||
for(size_t index=0;index<_number;index++) {
|
||||
reg_t* sep = (reg_t*)m_sep[index];
|
||||
plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
|
||||
_plotter->touch();
|
||||
@@ -259,8 +259,8 @@ public:
|
||||
|
||||
void next() {
|
||||
if(m_sep.empty()) update_sg();
|
||||
unsigned int _number = m_sep.size();
|
||||
if(m_current>=(_number-1)) {
|
||||
size_t _number = m_sep.size();
|
||||
if(m_current>=(uint32(_number)-1)) {
|
||||
m_current = 0;
|
||||
} else {
|
||||
m_current++;
|
||||
@@ -278,12 +278,12 @@ public:
|
||||
|
||||
bool set_current(plotter* a_plotter) { //for popup.
|
||||
if(m_sep.empty()) update_sg();
|
||||
unsigned int _number = m_sep.size();
|
||||
for(unsigned int index=0;index<_number;index++) {
|
||||
size_t _number = m_sep.size();
|
||||
for(size_t index=0;index<_number;index++) {
|
||||
reg_t* sep = (reg_t*)m_sep[index];
|
||||
plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
|
||||
if(_plotter==a_plotter) {
|
||||
m_current = index;
|
||||
m_current = uint32(index);
|
||||
update_current_border();
|
||||
return true;
|
||||
}
|
||||
@@ -441,8 +441,8 @@ public:
|
||||
void plotters(std::vector<plotter*>& a_vec) { //a_vec do NOT get ownership of sg::plotter objects.
|
||||
a_vec.clear();
|
||||
if(m_sep.empty()) update_sg();
|
||||
unsigned int _number = m_sep.size();
|
||||
for(unsigned int index=0;index<_number;index++) {
|
||||
size_t _number = m_sep.size();
|
||||
for(size_t index=0;index<_number;index++) {
|
||||
reg_t* sep = (reg_t*)m_sep[index];
|
||||
plotter* _plotter = (plotter*)(*sep)[PLOTTER()];
|
||||
a_vec.push_back(_plotter);
|
||||
@@ -509,10 +509,10 @@ protected:
|
||||
float rw_wc = ww_wc/cols;
|
||||
float rh_wc = wh_wc/rows;
|
||||
|
||||
unsigned int _number = m_sep.size();
|
||||
for(unsigned int index=0;index<_number;index++) {
|
||||
unsigned int row = index/cols;
|
||||
unsigned int col = index-cols*row;
|
||||
size_t _number = m_sep.size();
|
||||
for(size_t index=0;index<_number;index++) {
|
||||
size_t row = index/cols.value();
|
||||
size_t col = index-cols.value()*row;
|
||||
|
||||
reg_t* sep = (reg_t*)m_sep[index];
|
||||
|
||||
@@ -558,7 +558,7 @@ protected:
|
||||
a_parent.add(new group()); //empty
|
||||
|
||||
rgba* mat = new rgba();
|
||||
mat->color = colorf::red();
|
||||
mat->color = colorf_red();
|
||||
sep->add(mat);
|
||||
|
||||
draw_style* ds = new draw_style;
|
||||
@@ -580,8 +580,8 @@ protected:
|
||||
}
|
||||
|
||||
void update_current_border() {
|
||||
unsigned int _number = m_sep.size();
|
||||
for(unsigned int index=0;index<_number;index++) {
|
||||
size_t _number = m_sep.size();
|
||||
for(size_t index=0;index<_number;index++) {
|
||||
reg_t* sep = (reg_t*)m_sep[index];
|
||||
_switch* _border = (_switch*)(*sep)[BORDER()];
|
||||
if(index==m_current) {
|
||||
@@ -700,7 +700,6 @@ protected:
|
||||
separator m_border_sep;
|
||||
unsigned int m_current;
|
||||
updater* m_updater;
|
||||
|
||||
unsigned int m_old_cols;
|
||||
unsigned int m_old_rows;
|
||||
};
|
||||
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
// virtual void* cast(const char*) const = 0;
|
||||
//};
|
||||
|
||||
inline const std::string& s_inlib_sg_fit2plot() {
|
||||
inline const std::string& s_tools_sg_fit2plot() {
|
||||
static const std::string s_v("tools::sg::fit2plot");
|
||||
return s_v;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,7 @@ class plotter : public node {
|
||||
TOOLS_NODE(plotter,tools::sg::plotter,node)
|
||||
private:
|
||||
static const std::string& s_infos_what_def() {
|
||||
static const std::string s_v
|
||||
("name entries mean rms fit_quality fit_ndf fit_parameters fit_errors");
|
||||
static const std::string s_v("name entries mean rms fit_quality fit_ndf fit_parameters fit_errors");
|
||||
return s_v;
|
||||
}
|
||||
static float default_infos_margin() {return 0.005f;} //0.005 or Wt
|
||||
@@ -183,11 +182,22 @@ public:
|
||||
TOOLS_ADD_FIELD_DESC(down_margin)
|
||||
TOOLS_ADD_FIELD_DESC(up_margin)
|
||||
|
||||
TOOLS_ADD_FIELD_DESC(colormap_visible)
|
||||
TOOLS_ADD_FIELD_DESC(colormap_axis_labeling)
|
||||
TOOLS_ADD_FIELD_DESC_ENUM(cells)
|
||||
TOOLS_ADD_FIELD_DESC_ENUM(min_max)
|
||||
TOOLS_ADD_FIELD_DESC(colormap_attached)
|
||||
TOOLS_ADD_FIELD_DESC(colormap_axis_visible)
|
||||
|
||||
TOOLS_ADD_FIELD_DESC(title_up);
|
||||
TOOLS_ADD_FIELD_DESC(title_to_axis);
|
||||
TOOLS_ADD_FIELD_DESC(title_height);
|
||||
TOOLS_ADD_FIELD_DESC(title_automated);
|
||||
TOOLS_ADD_FIELD_DESC(title_hjust);
|
||||
TOOLS_ADD_FIELD_DESC_ENUM(tools::sg::left)
|
||||
TOOLS_ADD_FIELD_DESC_ENUM(tools::sg::center)
|
||||
TOOLS_ADD_FIELD_DESC_ENUM(tools::sg::right)
|
||||
|
||||
TOOLS_ADD_FIELD_DESC(title)
|
||||
|
||||
TOOLS_ADD_FIELD_DESC(x_axis_enforced)
|
||||
@@ -222,6 +232,9 @@ public:
|
||||
TOOLS_ADD_FIELD_DESC(legends_visible)
|
||||
TOOLS_ADD_FIELD_DESC(legends_attached_to_infos)
|
||||
TOOLS_ADD_FIELD_DESC(legends_origin)
|
||||
TOOLS_ADD_FIELD_DESC_ENUM(unit_percent)
|
||||
TOOLS_ADD_FIELD_DESC_ENUM(unit_axis)
|
||||
|
||||
TOOLS_ADD_FIELD_DESC(legends_origin_unit)
|
||||
TOOLS_ADD_FIELD_DESC(legends_size)
|
||||
TOOLS_ADD_FIELD_DESC(legends_automated)
|
||||
@@ -229,7 +242,10 @@ public:
|
||||
TOOLS_ADD_FIELD_DESC(legends_color)
|
||||
|
||||
TOOLS_ADD_FIELD_DESC(shape_automated)
|
||||
|
||||
TOOLS_ADD_FIELD_DESC(shape)
|
||||
TOOLS_ADD_FIELD_DESC_ENUM(xy)
|
||||
TOOLS_ADD_FIELD_DESC_ENUM(xyz)
|
||||
|
||||
TOOLS_ADD_FIELD_DESC(xy_depth)
|
||||
}
|
||||
@@ -484,18 +500,18 @@ public: //style
|
||||
m_inner_frame_style = style();
|
||||
m_grid_style = style();
|
||||
|
||||
m_title_style.color = colorf::black();
|
||||
m_title_style.color = colorf_black();
|
||||
m_title_style.font = font_hershey();
|
||||
m_title_style.encoding = encoding_PAW();
|
||||
|
||||
m_background_style.back_color = colorf::white();
|
||||
m_background_style.back_color = colorf_white();
|
||||
m_background_style.line_width = 0; //no border
|
||||
m_background_style.color = colorf::black(); //border
|
||||
m_background_style.color = colorf_black(); //border
|
||||
|
||||
m_inner_frame_style.color = colorf::black();
|
||||
m_inner_frame_style.color = colorf_black();
|
||||
m_inner_frame_style.line_pattern = line_solid;
|
||||
|
||||
m_grid_style.color = colorf::black();
|
||||
m_grid_style.color = colorf_black();
|
||||
m_grid_style.line_pattern = line_dashed;
|
||||
|
||||
m_infos_style.font = font_hershey();
|
||||
@@ -1176,12 +1192,12 @@ public: //public
|
||||
text_style& title_box_style() {return m_title_box_style;}
|
||||
|
||||
style& bins_style(unsigned int a_index) {
|
||||
unsigned int sz = m_bins_style.size();
|
||||
size_t sz = m_bins_style.size();
|
||||
if(a_index>=sz) {
|
||||
//012345 sz=6
|
||||
// 9 a_index wanted
|
||||
// 6789 loop
|
||||
for(unsigned int index=sz;index<=a_index;index++) {
|
||||
for(size_t index=sz;index<=a_index;index++) {
|
||||
m_bins_style.push_back(style());
|
||||
m_bins_style.back().modeling = modeling_top_lines();
|
||||
m_bins_style.back().marker_size = 5; //for profile.
|
||||
@@ -1191,9 +1207,9 @@ public: //public
|
||||
}
|
||||
|
||||
style& errors_style(unsigned int a_index) {
|
||||
unsigned int sz = m_errors_style.size();
|
||||
size_t sz = m_errors_style.size();
|
||||
if(a_index>=sz) {
|
||||
for(unsigned int index=sz;index<=a_index;index++) {
|
||||
for(size_t index=sz;index<=a_index;index++) {
|
||||
m_errors_style.push_back(style());
|
||||
m_errors_style.back().visible = false;
|
||||
}
|
||||
@@ -1202,9 +1218,9 @@ public: //public
|
||||
}
|
||||
|
||||
style& func_style(unsigned int a_index) {
|
||||
unsigned int sz = m_func_style.size();
|
||||
size_t sz = m_func_style.size();
|
||||
if(a_index>=sz) {
|
||||
for(unsigned int index=sz;index<=a_index;index++) {
|
||||
for(size_t index=sz;index<=a_index;index++) {
|
||||
m_func_style.push_back(style());
|
||||
}
|
||||
}
|
||||
@@ -1212,12 +1228,12 @@ public: //public
|
||||
}
|
||||
|
||||
style& points_style(unsigned int a_index) {
|
||||
unsigned int sz = m_points_style.size();
|
||||
size_t sz = m_points_style.size();
|
||||
if(a_index>=sz) {
|
||||
//012345 sz=6
|
||||
// 9 a_index wanted
|
||||
// 6789 loop
|
||||
for(unsigned int index=sz;index<=a_index;index++) {
|
||||
for(size_t index=sz;index<=a_index;index++) {
|
||||
m_points_style.push_back(style());
|
||||
}
|
||||
}
|
||||
@@ -1226,12 +1242,12 @@ public: //public
|
||||
|
||||
/*
|
||||
text_style& legend_style(unsigned int a_index) {
|
||||
unsigned int sz = m_legend_style.size();
|
||||
size_t sz = m_legend_style.size();
|
||||
if(a_index>=sz) {
|
||||
//012345 sz=6
|
||||
// 9 a_index wanted
|
||||
// 6789 loop
|
||||
for(unsigned int index=sz;index<=a_index;index++) {
|
||||
for(size_t index=sz;index<=a_index;index++) {
|
||||
m_legend_style.push_back(text_style());
|
||||
}
|
||||
}
|
||||
@@ -2161,14 +2177,11 @@ public:
|
||||
|
||||
m_cmap_axis.width = 0;
|
||||
m_cmap_cells_sep.clear();
|
||||
if(m_bins_cmaps.size() && m_bins_cmaps[0] &&
|
||||
m_bins_cmaps[0]->valn()) { //major_bins
|
||||
if(m_bins_cmaps.size() && m_bins_cmaps[0] && m_bins_cmaps[0]->valn()) { //major_bins
|
||||
update_cmap(a_out,*(m_bins_cmaps[0]));
|
||||
} else if(m_points_cmaps.size() && m_points_cmaps[0] &&
|
||||
m_points_cmaps[0]->valn()) { //major_points
|
||||
} else if(m_points_cmaps.size() && m_points_cmaps[0] && m_points_cmaps[0]->valn()) { //major_points
|
||||
update_cmap(a_out,*(m_points_cmaps[0]));
|
||||
} else if(m_func_cmaps.size() && m_func_cmaps[0] &&
|
||||
m_func_cmaps[0]->valn()) { //major_func
|
||||
} else if(m_func_cmaps.size() && m_func_cmaps[0] && m_func_cmaps[0]->valn()) { //major_func
|
||||
update_cmap(a_out,*(m_func_cmaps[0]));
|
||||
}
|
||||
}
|
||||
@@ -2609,9 +2622,9 @@ public:
|
||||
void update_cmap(std::ostream& a_out,const base_colormap& a_cmap){
|
||||
if(!colormap_visible.value()) return;
|
||||
|
||||
unsigned int valn = a_cmap.valn();
|
||||
size_t valn = a_cmap.valn();
|
||||
if(!valn) return;
|
||||
unsigned int coln = a_cmap.colorn();
|
||||
size_t coln = a_cmap.colorn();
|
||||
if(!coln) return;
|
||||
|
||||
float XSIZ = width;
|
||||
@@ -2674,7 +2687,7 @@ public:
|
||||
|
||||
// surrounding box :
|
||||
{rgba* mat = new rgba();
|
||||
mat->color = colorf::black();
|
||||
mat->color = colorf_black();
|
||||
m_cmap_cells_sep.add(mat);
|
||||
|
||||
draw_style* ds = new draw_style;
|
||||
@@ -2730,7 +2743,7 @@ public:
|
||||
if((valn+1)==coln) { // <col> <num> <col> ... <num> <col>
|
||||
m_cmap_axis.width = hcmap-2*h;
|
||||
m_cmap_axis.modeling = tick_modeling_none();
|
||||
m_cmap_axis.tick_number = valn;
|
||||
m_cmap_axis.tick_number = uint32(valn);
|
||||
m_cmap_axis.labels.clear();
|
||||
m_cmap_axis.coords.clear();
|
||||
for(unsigned int index=0;index<valn;index++) {
|
||||
@@ -2743,7 +2756,7 @@ public:
|
||||
} else if((coln+1)==valn) { // <num> <col> <num> ... <col> <num>
|
||||
m_cmap_axis.width = hcmap;
|
||||
m_cmap_axis.modeling = tick_modeling_none();
|
||||
m_cmap_axis.tick_number = valn;
|
||||
m_cmap_axis.tick_number = uint32(valn);
|
||||
m_cmap_axis.labels.clear();
|
||||
m_cmap_axis.coords.clear();
|
||||
for(unsigned int index=0;index<valn;index++) {
|
||||
@@ -2762,13 +2775,13 @@ public:
|
||||
m_cmap_axis.modeling = tick_modeling_hippo();
|
||||
m_cmap_axis.width = hcmap;
|
||||
m_cmap_axis.minimum_value = a_cmap.value(0);
|
||||
m_cmap_axis.maximum_value = a_cmap.value(valn-1);
|
||||
m_cmap_axis.maximum_value = a_cmap.value(uint32(valn)-1);
|
||||
}
|
||||
} else { //grey_scale,grey_scale_inverse,violet_to_red
|
||||
m_cmap_axis.modeling = tick_modeling_hippo();
|
||||
m_cmap_axis.width = hcmap;
|
||||
m_cmap_axis.minimum_value = a_cmap.value(0);
|
||||
m_cmap_axis.maximum_value = a_cmap.value(valn-1);
|
||||
m_cmap_axis.maximum_value = a_cmap.value(uint32(valn)-1);
|
||||
}
|
||||
|
||||
{text_style& style = m_cmap_axis.labels_style();
|
||||
@@ -3032,7 +3045,7 @@ protected: //vis bins
|
||||
bins.push_back(rep_bin2D(xx,xe,yy,ye,val,ibin,jbin));
|
||||
}
|
||||
}}
|
||||
unsigned int number = bins.size();
|
||||
size_t number = bins.size();
|
||||
|
||||
painting_policy painting = a_data_style.painting;
|
||||
if(painting==painting_by_value) {
|
||||
@@ -3044,7 +3057,7 @@ protected: //vis bins
|
||||
(painting==painting_violet_to_red) ){
|
||||
{float dbins = bmax-bmin;
|
||||
if(dbins!=0.0F) {
|
||||
for(unsigned int index=0;index<number;index++) {
|
||||
for(size_t index=0;index<number;index++) {
|
||||
bins[index].m_ratio = bins[index].m_val/dbins;
|
||||
}
|
||||
}}
|
||||
@@ -3206,7 +3219,7 @@ protected: //vis bins
|
||||
|
||||
if(!a_style.visible) return;
|
||||
|
||||
unsigned int number = a_points.points();
|
||||
size_t number = a_points.points();
|
||||
if(!number) return;
|
||||
|
||||
const std::string& modeling = a_style.modeling;
|
||||
@@ -3283,7 +3296,7 @@ protected: //vis bins
|
||||
bins.push_back(rep_bin2D(xx,xe,yy,ye,val,ibin,jbin));
|
||||
}
|
||||
}}
|
||||
unsigned int number = bins.size();
|
||||
size_t number = bins.size();
|
||||
|
||||
float bmin;
|
||||
float bmax;
|
||||
@@ -3302,7 +3315,7 @@ protected: //vis bins
|
||||
(painting==painting_violet_to_red) ){
|
||||
{float dbins = bmax-bmin;
|
||||
if(dbins!=0.0F) {
|
||||
for(unsigned int index=0;index<number;index++) {
|
||||
for(size_t index=0;index<number;index++) {
|
||||
bins[index].m_ratio = bins[index].m_val/dbins;
|
||||
}
|
||||
}}
|
||||
@@ -3427,8 +3440,8 @@ protected: //vis bins
|
||||
(painting==painting_violet_to_red) ){
|
||||
float vmin = faces[0].m_v1;
|
||||
float vmax = faces[0].m_v1;
|
||||
unsigned int number = faces.size();
|
||||
for(unsigned int index=0;index<number;index++) {
|
||||
size_t number = faces.size();
|
||||
for(size_t index=0;index<number;index++) {
|
||||
float vmean = faces[index].m_v1;
|
||||
vmean += faces[index].m_v2;
|
||||
vmean += faces[index].m_v3;
|
||||
@@ -3443,7 +3456,7 @@ protected: //vis bins
|
||||
|
||||
{float dbins = vmax-vmin;
|
||||
if(dbins!=0.0F) {
|
||||
for(unsigned int index=0;index<number;index++) {
|
||||
for(size_t index=0;index<number;index++) {
|
||||
faces[index].m_ratio /= dbins;
|
||||
}
|
||||
}}
|
||||
@@ -3792,7 +3805,7 @@ protected: //vis bins
|
||||
for(it=m_plottables.begin();it!=m_plottables.end();++it) {
|
||||
plottable* object = *it;
|
||||
if(!object) continue;
|
||||
if(object->cast(s_inlib_sg_fit2plot())) {
|
||||
if(object->cast(s_tools_sg_fit2plot())) {
|
||||
if(a_s.size()) a_s += "\n";
|
||||
std::string _s;
|
||||
object->infos(opts,_s);
|
||||
@@ -3817,7 +3830,7 @@ protected: //vis bins
|
||||
get_infos(sinfos);
|
||||
std::vector<std::string> ws;
|
||||
words(sinfos,"\n",false,ws);
|
||||
unsigned int linen = ws.size()/2;
|
||||
size_t linen = ws.size()/2;
|
||||
|
||||
float zz = ZINFOS(); //xy
|
||||
if(m_shape==xyz) zz = depth*0.5f;
|
||||
@@ -3832,7 +3845,7 @@ protected: //vis bins
|
||||
|
||||
std::string infos_title;
|
||||
if(m_infos_style.modeling==infos_modeling_ROOT()) {
|
||||
for(unsigned int index=0;index<linen;index++) {
|
||||
for(size_t index=0;index<linen;index++) {
|
||||
const std::string& name = ws[2*index];
|
||||
if(name=="Name") {
|
||||
infos_title = ws[2*index+1];
|
||||
@@ -3893,7 +3906,7 @@ protected: //vis bins
|
||||
infos->back_area::shadow = m_infos_style.back_shadow;
|
||||
infos->border_line_width = m_infos_style.line_width;
|
||||
|
||||
{for(unsigned int index=0;index<linen;index++) {
|
||||
{for(size_t index=0;index<linen;index++) {
|
||||
const std::string& name = ws[2*index];
|
||||
const std::string& value = ws[2*index+1];
|
||||
infos->lstrings.add(name);
|
||||
@@ -3991,8 +4004,8 @@ protected: //vis bins
|
||||
}
|
||||
}}
|
||||
|
||||
unsigned int number = m_legend_strings.size();
|
||||
for(unsigned int index=0;index<number;index++) {
|
||||
size_t number = m_legend_strings.size();
|
||||
for(size_t index=0;index<number;index++) {
|
||||
|
||||
separator* sep = new separator;
|
||||
m_legend_sep.add(sep);
|
||||
@@ -4241,39 +4254,35 @@ protected: //vis bins
|
||||
if(draw_vertical) {
|
||||
float _width = m_y_axis.width;
|
||||
float xx;
|
||||
{unsigned int _number = m_x_axis.coords.size();
|
||||
{size_t _number = m_x_axis.coords.size();
|
||||
if(is_solid) {
|
||||
pts.reserve(_number*6);
|
||||
for(unsigned int count=0;count<_number;count++) {
|
||||
for(size_t count=0;count<_number;count++) {
|
||||
xx = m_x_axis.coords[count];
|
||||
vtxs->add(xx, 0 ,zz);
|
||||
vtxs->add(xx, _width,zz);
|
||||
}
|
||||
} else {
|
||||
pts.reserve(_number*100*6);
|
||||
for(unsigned int count=0;count<_number;count++) {
|
||||
for(size_t count=0;count<_number;count++) {
|
||||
xx = m_x_axis.coords[count];
|
||||
vtxs->add_dashed_line(xx,0, zz,
|
||||
xx,_width,zz,
|
||||
100);
|
||||
vtxs->add_dashed_line(xx,0,zz,xx,_width,zz,100);
|
||||
}
|
||||
}}
|
||||
if(m_x_axis.is_log) {
|
||||
unsigned int _number = m_x_axis.sub_coords.size();
|
||||
size_t _number = m_x_axis.sub_coords.size();
|
||||
if(is_solid) {
|
||||
pts.reserve(_number*6);
|
||||
for(unsigned int count=0;count<_number;count++) {
|
||||
for(size_t count=0;count<_number;count++) {
|
||||
xx = m_x_axis.sub_coords[count];
|
||||
vtxs->add(xx, 0 ,zz);
|
||||
vtxs->add(xx, width,zz);
|
||||
}
|
||||
} else {
|
||||
pts.reserve(_number*100*6);
|
||||
for(unsigned int count=0;count<_number;count++) {
|
||||
for(size_t count=0;count<_number;count++) {
|
||||
xx = m_x_axis.sub_coords[count];
|
||||
vtxs->add_dashed_line(xx,0 ,zz,
|
||||
xx,width,zz,
|
||||
100);
|
||||
vtxs->add_dashed_line(xx,0,zz,xx,width,zz,100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4282,39 +4291,35 @@ protected: //vis bins
|
||||
if(draw_horizontal) {
|
||||
float _width = m_x_axis.width;
|
||||
float yy;
|
||||
{unsigned int _number = m_y_axis.coords.size();
|
||||
{size_t _number = m_y_axis.coords.size();
|
||||
if(is_solid) {
|
||||
pts.reserve(_number*6);
|
||||
for(unsigned int count=0;count<_number;count++) {
|
||||
for(size_t count=0;count<_number;count++) {
|
||||
yy = m_y_axis.coords[count];
|
||||
vtxs->add(0,yy ,zz);
|
||||
vtxs->add(_width,yy,zz);
|
||||
}
|
||||
} else {
|
||||
pts.reserve(_number*100*6);
|
||||
for(unsigned int count=0;count<_number;count++) {
|
||||
for(size_t count=0;count<_number;count++) {
|
||||
yy = m_y_axis.coords[count];
|
||||
vtxs->add_dashed_line(0,yy, zz,
|
||||
_width,yy,zz,
|
||||
100);
|
||||
vtxs->add_dashed_line(0,yy,zz,_width,yy,zz,100);
|
||||
}
|
||||
}}
|
||||
if(m_y_axis.is_log) {
|
||||
unsigned int _number = m_y_axis.sub_coords.size();
|
||||
size_t _number = m_y_axis.sub_coords.size();
|
||||
if(is_solid) {
|
||||
pts.reserve(_number*6);
|
||||
for(unsigned int count=0;count<_number;count++) {
|
||||
for(size_t count=0;count<_number;count++) {
|
||||
yy = m_y_axis.sub_coords[count];
|
||||
vtxs->add(0,yy, zz);
|
||||
vtxs->add(_width,yy,zz);
|
||||
}
|
||||
} else {
|
||||
pts.reserve(_number*100*6);
|
||||
for(unsigned int count=0;count<_number;count++) {
|
||||
for(size_t count=0;count<_number;count++) {
|
||||
yy = m_y_axis.sub_coords[count];
|
||||
vtxs->add_dashed_line(0,yy, zz,
|
||||
_width,yy,zz,
|
||||
100);
|
||||
vtxs->add_dashed_line(0,yy,zz,_width,yy,zz,100);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4428,8 +4433,8 @@ protected: //rep
|
||||
colorf clr;
|
||||
|
||||
float yp = 0;
|
||||
int xnbin = a_bins.size();
|
||||
for(int index=0;index<xnbin;index++) {
|
||||
size_t xnbin = a_bins.size();
|
||||
for(size_t index=0;index<xnbin;index++) {
|
||||
float xx = a_bins[index].m_x_min;
|
||||
float xe = a_bins[index].m_x_max;
|
||||
float y = a_bins[index].m_val;
|
||||
@@ -4532,8 +4537,8 @@ protected: //rep
|
||||
bool empty = true;
|
||||
colorf clr;
|
||||
|
||||
int xnbin = a_bins.size();
|
||||
for(int index=0;index<xnbin;index++) {
|
||||
size_t xnbin = a_bins.size();
|
||||
for(size_t index=0;index<xnbin;index++) {
|
||||
float x = (a_bins[index].m_x_min + a_bins[index].m_x_max)/2;
|
||||
float y = a_bins[index].m_val;
|
||||
float val = a_bins[index].m_val;
|
||||
@@ -5014,9 +5019,9 @@ protected: //rep
|
||||
float dy = a_box_y.m_width;
|
||||
bool ylog = a_box_y.m_log;
|
||||
|
||||
int xnbin = a_bins.size();
|
||||
size_t xnbin = a_bins.size();
|
||||
|
||||
for(int index=0;index<xnbin;index++) {
|
||||
for(size_t index=0;index<xnbin;index++) {
|
||||
|
||||
//Need all bins modeled for fitting.
|
||||
|
||||
@@ -5113,9 +5118,9 @@ protected: //rep
|
||||
float dy = a_box_y.m_width;
|
||||
bool ylog = a_box_y.m_log;
|
||||
|
||||
int xnbin = a_bins.size();
|
||||
size_t xnbin = a_bins.size();
|
||||
|
||||
for(int index=0;index<xnbin;index++) {
|
||||
for(size_t index=0;index<xnbin;index++) {
|
||||
|
||||
//Need all bins modeled for fitting.
|
||||
|
||||
@@ -5453,9 +5458,10 @@ protected: //rep
|
||||
_sep->add(vtxs);
|
||||
|
||||
colorf clr;
|
||||
vec3f nm;
|
||||
|
||||
unsigned int number = a_faces.size();
|
||||
for(unsigned int index=0;index<number;index++) {
|
||||
size_t number = a_faces.size();
|
||||
for(size_t index=0;index<number;index++) {
|
||||
float xx = a_faces[index].m_x_min;
|
||||
float xe = a_faces[index].m_x_max;
|
||||
float yy = a_faces[index].m_y_min;
|
||||
@@ -5517,9 +5523,9 @@ protected: //rep
|
||||
vtxs->add_color(clr);
|
||||
vtxs->add_color(clr);
|
||||
|
||||
vec3f nm = direction(xx,ye,val4,
|
||||
xx,yy,val1,
|
||||
xe,yy,val2);
|
||||
direction(xx,ye,val4,
|
||||
xx,yy,val1,
|
||||
xe,yy,val2,nm);
|
||||
nm.normalize();
|
||||
vtxs->add_normal(nm[0],nm[1],nm[2]);
|
||||
vtxs->add_normal(nm[0],nm[1],nm[2]);
|
||||
@@ -5535,9 +5541,9 @@ protected: //rep
|
||||
vtxs->add_rgba(clr[0],clr[1],clr[2],clr[3]);
|
||||
vtxs->add_rgba(clr[0],clr[1],clr[2],clr[3]);
|
||||
|
||||
nm = direction(xe,yy,val2,
|
||||
xe,ye,val3,
|
||||
xx,ye,val4);
|
||||
direction(xe,yy,val2,
|
||||
xe,ye,val3,
|
||||
xx,ye,val4,nm);
|
||||
nm.normalize();
|
||||
vtxs->add_normal(nm[0],nm[1],nm[2]);
|
||||
vtxs->add_normal(nm[0],nm[1],nm[2]);
|
||||
|
||||
@@ -52,8 +52,8 @@ public:
|
||||
add_point(a_x,a_y,a_z,w);
|
||||
}
|
||||
|
||||
bool add_triangle_fan(unsigned int a_floatn,const float* a_xyzs,bool a_stop = false){
|
||||
unsigned int num = a_floatn/3;
|
||||
bool add_triangle_fan(size_t a_floatn,const float* a_xyzs,bool a_stop = false){
|
||||
size_t num = a_floatn/3;
|
||||
if(num<3) return false;
|
||||
|
||||
m_mode = gl::triangle_fan();
|
||||
@@ -74,7 +74,7 @@ public:
|
||||
p2z = *(pos2+2);
|
||||
project(p2x,p2y,p2z,w2);
|
||||
|
||||
for(unsigned int index=2;index<num;index++) {
|
||||
for(size_t index=2;index<num;index++) {
|
||||
const float* pos = a_xyzs+3*index;
|
||||
p3x = *(pos+0);
|
||||
p3y = *(pos+1);
|
||||
@@ -95,8 +95,8 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_triangle_strip(unsigned int a_floatn,const float* a_xyzs,bool a_stop = false){
|
||||
unsigned int num = a_floatn/3;
|
||||
bool add_triangle_strip(size_t a_floatn,const float* a_xyzs,bool a_stop = false){
|
||||
size_t num = a_floatn/3;
|
||||
if(num<3) return false;
|
||||
|
||||
m_mode = gl::triangle_strip();
|
||||
@@ -118,7 +118,7 @@ public:
|
||||
project(p2x,p2y,p2z,w2);
|
||||
|
||||
bool flip = false;
|
||||
for(unsigned int index=2;index<num;index++) {
|
||||
for(size_t index=2;index<num;index++) {
|
||||
const float* pos = a_xyzs+3*index;
|
||||
p3x = *(pos+0);
|
||||
p3y = *(pos+1);
|
||||
@@ -154,8 +154,8 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_triangles(unsigned int a_floatn,const float* a_xyzs,bool a_stop = false){
|
||||
unsigned int num = a_floatn/3;
|
||||
bool add_triangles(size_t a_floatn,const float* a_xyzs,bool a_stop = false){
|
||||
size_t num = a_floatn/3;
|
||||
if(num<3) return false;
|
||||
|
||||
m_mode = gl::triangles();
|
||||
@@ -164,23 +164,23 @@ public:
|
||||
float p2x,p2y,p2z,w2=1;
|
||||
float p3x,p3y,p3z,w3=1;
|
||||
|
||||
for(unsigned int index=0;index<num;index+=3) {
|
||||
for(size_t index=0;index<num;index+=3) {
|
||||
|
||||
const float* pos = a_xyzs+3*index;
|
||||
|
||||
p1x = *(pos++);
|
||||
p1y = *(pos++);
|
||||
p1z = *(pos++);
|
||||
p1x = *pos;pos++;
|
||||
p1y = *pos;pos++;
|
||||
p1z = *pos;pos++;
|
||||
project(p1x,p1y,p1z,w1);
|
||||
|
||||
p2x = *(pos++);
|
||||
p2y = *(pos++);
|
||||
p2z = *(pos++);
|
||||
p2x = *pos;pos++;
|
||||
p2y = *pos;pos++;
|
||||
p2z = *pos;pos++;
|
||||
project(p2x,p2y,p2z,w2);
|
||||
|
||||
p3x = *(pos++);
|
||||
p3y = *(pos++);
|
||||
p3z = *(pos++);
|
||||
p3x = *pos;pos++;
|
||||
p3y = *pos;pos++;
|
||||
p3z = *pos;pos++;
|
||||
project(p3x,p3y,p3z,w3);
|
||||
|
||||
if(!add_triangle(p1x,p1y,p1z,w1,
|
||||
@@ -192,8 +192,8 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_triangles(unsigned int a_floatn,const float* a_xyzs,const float* a_rgbas,bool a_stop = false){
|
||||
unsigned int num = a_floatn/3;
|
||||
bool add_triangles(size_t a_floatn,const float* a_xyzs,const float* a_rgbas,bool a_stop = false){
|
||||
size_t num = a_floatn/3;
|
||||
if(num<3) return false;
|
||||
|
||||
m_mode = gl::triangles();
|
||||
@@ -206,41 +206,41 @@ public:
|
||||
float r2,g2,b2,a2;
|
||||
float r3,g3,b3,a3;
|
||||
|
||||
for(unsigned int index=0;index<num;index+=3) {
|
||||
for(size_t index=0;index<num;index+=3) {
|
||||
|
||||
const float* pos = a_xyzs+3*index;
|
||||
|
||||
p1x = *(pos++);
|
||||
p1y = *(pos++);
|
||||
p1z = *(pos++);
|
||||
p1x = *pos;pos++;
|
||||
p1y = *pos;pos++;
|
||||
p1z = *pos;pos++;
|
||||
project(p1x,p1y,p1z,w1);
|
||||
|
||||
p2x = *(pos++);
|
||||
p2y = *(pos++);
|
||||
p2z = *(pos++);
|
||||
p2x = *pos;pos++;
|
||||
p2y = *pos;pos++;
|
||||
p2z = *pos;pos++;
|
||||
project(p2x,p2y,p2z,w2);
|
||||
|
||||
p3x = *(pos++);
|
||||
p3y = *(pos++);
|
||||
p3z = *(pos++);
|
||||
p3x = *pos;pos++;
|
||||
p3y = *pos;pos++;
|
||||
p3z = *pos;pos++;
|
||||
project(p3x,p3y,p3z,w3);
|
||||
|
||||
const float* qos = a_rgbas+4*index;
|
||||
|
||||
r1 = *(qos++);
|
||||
g1 = *(qos++);
|
||||
b1 = *(qos++);
|
||||
a1 = *(qos++);
|
||||
r1 = *qos;qos++;
|
||||
g1 = *qos;qos++;
|
||||
b1 = *qos;qos++;
|
||||
a1 = *qos;qos++;
|
||||
|
||||
r2 = *(qos++);
|
||||
g2 = *(qos++);
|
||||
b2 = *(qos++);
|
||||
a2 = *(qos++);
|
||||
r2 = *qos;qos++;
|
||||
g2 = *qos;qos++;
|
||||
b2 = *qos;qos++;
|
||||
a2 = *qos;qos++;
|
||||
|
||||
r3 = *(qos++);
|
||||
g3 = *(qos++);
|
||||
b3 = *(qos++);
|
||||
a3 = *(qos++);
|
||||
r3 = *qos;qos++;
|
||||
g3 = *qos;qos++;
|
||||
b3 = *qos;qos++;
|
||||
a3 = *qos;qos++;
|
||||
|
||||
if(!add_triangle(p1x,p1y,p1z,w1,r1,g1,b1,a1,
|
||||
p2x,p2y,p2z,w2,r2,g2,b2,a2,
|
||||
@@ -251,16 +251,16 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_line_strip(unsigned int a_floatn,const float* a_xyzs,bool a_stop = false){
|
||||
unsigned int num = a_floatn/3;
|
||||
bool add_line_strip(size_t a_floatn,const float* a_xyzs,bool a_stop = false){
|
||||
size_t num = a_floatn/3;
|
||||
if(num<=1) return false;
|
||||
unsigned int nseg = num-1;
|
||||
size_t nseg = num-1;
|
||||
|
||||
m_mode = gl::line_strip();
|
||||
|
||||
float xb,yb,zb,wb,xe,ye,ze,we;
|
||||
float* pos;
|
||||
for(unsigned int iseg = 0;iseg<nseg;iseg++) {
|
||||
for(size_t iseg = 0;iseg<nseg;iseg++) {
|
||||
pos = (float*)(a_xyzs+3*iseg);
|
||||
xb = *pos;pos++;
|
||||
yb = *pos;pos++;
|
||||
@@ -277,10 +277,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_line_strip(unsigned int a_floatn,const float* a_xyzs,const float* a_rgbas,bool a_stop = false){
|
||||
unsigned int num = a_floatn/3;
|
||||
bool add_line_strip(size_t a_floatn,const float* a_xyzs,const float* a_rgbas,bool a_stop = false){
|
||||
size_t num = a_floatn/3;
|
||||
if(num<=1) return false;
|
||||
unsigned int nseg = num-1;
|
||||
size_t nseg = num-1;
|
||||
|
||||
m_mode = gl::line_strip();
|
||||
|
||||
@@ -288,7 +288,7 @@ public:
|
||||
float rb,gb,bb,ab,re,ge,be,ae;
|
||||
float* pos;
|
||||
float* qos;
|
||||
for(unsigned int iseg = 0;iseg<nseg;iseg++) {
|
||||
for(size_t iseg = 0;iseg<nseg;iseg++) {
|
||||
pos = (float*)(a_xyzs+3*iseg);
|
||||
xb = *pos;pos++;
|
||||
yb = *pos;pos++;
|
||||
@@ -320,16 +320,16 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_line_loop(unsigned int a_floatn,const float* a_xyzs,bool a_stop = false) {
|
||||
unsigned int num = a_floatn/3;
|
||||
bool add_line_loop(size_t a_floatn,const float* a_xyzs,bool a_stop = false) {
|
||||
size_t num = a_floatn/3;
|
||||
if(num<=1) return false;
|
||||
unsigned int nseg = num-1;
|
||||
size_t nseg = num-1;
|
||||
|
||||
m_mode = gl::line_loop();
|
||||
|
||||
float xb,yb,zb,wb,xe,ye,ze,we;
|
||||
float* pos;
|
||||
for(unsigned int iseg = 0;iseg<nseg;iseg++) {
|
||||
for(size_t iseg = 0;iseg<nseg;iseg++) {
|
||||
pos = (float*)(a_xyzs+3*iseg);
|
||||
xb = *pos;pos++;
|
||||
yb = *pos;pos++;
|
||||
@@ -364,10 +364,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_line_loop(unsigned int a_floatn,const float* a_xyzs,const float* a_rgbas,bool a_stop = false) {
|
||||
unsigned int num = a_floatn/3;
|
||||
bool add_line_loop(size_t a_floatn,const float* a_xyzs,const float* a_rgbas,bool a_stop = false) {
|
||||
size_t num = a_floatn/3;
|
||||
if(num<=1) return false;
|
||||
unsigned int nseg = num-1;
|
||||
size_t nseg = num-1;
|
||||
|
||||
m_mode = gl::line_loop();
|
||||
|
||||
@@ -375,7 +375,7 @@ public:
|
||||
float rb,gb,bb,ab,re,ge,be,ae;
|
||||
float* pos;
|
||||
float* qos;
|
||||
for(unsigned int iseg = 0;iseg<nseg;iseg++) {
|
||||
for(size_t iseg = 0;iseg<nseg;iseg++) {
|
||||
pos = (float*)(a_xyzs+3*iseg);
|
||||
xb = *pos;pos++;
|
||||
yb = *pos;pos++;
|
||||
@@ -437,11 +437,11 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_lines(unsigned int a_floatn,const float* a_xyzs,const float* a_rgbas,bool a_stop = false) {
|
||||
bool add_lines(size_t a_floatn,const float* a_xyzs,const float* a_rgbas,bool a_stop = false) {
|
||||
//lines = segments.
|
||||
unsigned int num = a_floatn/3;
|
||||
size_t num = a_floatn/3;
|
||||
|
||||
unsigned int nseg = num/2;
|
||||
size_t nseg = num/2;
|
||||
if(!nseg) return false;
|
||||
|
||||
m_mode = gl::lines();
|
||||
@@ -450,7 +450,7 @@ public:
|
||||
float rb,gb,bb,ab,re,ge,be,ae;
|
||||
float* pos;
|
||||
float* qos;
|
||||
for(unsigned int iseg = 0;iseg<nseg;iseg++) {
|
||||
for(size_t iseg = 0;iseg<nseg;iseg++) {
|
||||
pos = (float*)(a_xyzs+6*iseg);
|
||||
xb = *pos;pos++;
|
||||
yb = *pos;pos++;
|
||||
@@ -479,18 +479,18 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_lines(unsigned int a_floatn,const float* a_xyzs,bool a_stop = false) {
|
||||
bool add_lines(size_t a_floatn,const float* a_xyzs,bool a_stop = false) {
|
||||
//lines = segments.
|
||||
unsigned int num = a_floatn/3;
|
||||
size_t num = a_floatn/3;
|
||||
|
||||
unsigned int nseg = num/2;
|
||||
size_t nseg = num/2;
|
||||
if(!nseg) return false;
|
||||
|
||||
m_mode = gl::lines();
|
||||
|
||||
float xb,yb,zb,wb,xe,ye,ze,we;
|
||||
float* pos;
|
||||
for(unsigned int iseg = 0;iseg<nseg;iseg++) {
|
||||
for(size_t iseg = 0;iseg<nseg;iseg++) {
|
||||
pos = (float*)(a_xyzs+6*iseg);
|
||||
xb = *pos;pos++;
|
||||
yb = *pos;pos++;
|
||||
@@ -508,14 +508,14 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_points(unsigned int a_floatn,const float* a_xyzs,bool a_stop = false){
|
||||
unsigned int num = a_floatn/3;
|
||||
bool add_points(size_t a_floatn,const float* a_xyzs,bool a_stop = false){
|
||||
size_t num = a_floatn/3;
|
||||
|
||||
m_mode = gl::points();
|
||||
|
||||
float x,y,z,w;
|
||||
float* pos;
|
||||
for(unsigned int ipt=0;ipt<num;ipt++) {
|
||||
for(size_t ipt=0;ipt<num;ipt++) {
|
||||
pos = (float*)(a_xyzs+3*ipt);
|
||||
x = *pos;pos++;
|
||||
y = *pos;pos++;
|
||||
@@ -528,8 +528,8 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_points(unsigned int a_floatn,const float* a_xyzs,const float* a_rgbas,bool a_stop = false){
|
||||
unsigned int num = a_floatn/3;
|
||||
bool add_points(size_t a_floatn,const float* a_xyzs,const float* a_rgbas,bool a_stop = false){
|
||||
size_t num = a_floatn/3;
|
||||
|
||||
m_mode = gl::points();
|
||||
|
||||
@@ -539,7 +539,7 @@ public:
|
||||
float* pos;
|
||||
float* qos;
|
||||
|
||||
for(unsigned int ipt=0;ipt<num;ipt++) {
|
||||
for(size_t ipt=0;ipt<num;ipt++) {
|
||||
pos = (float*)(a_xyzs+3*ipt);
|
||||
x = *pos;pos++;
|
||||
y = *pos;pos++;
|
||||
@@ -558,7 +558,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_primitive(gl::mode_t a_mode,unsigned int a_floatn,const float* a_xyzs,bool a_stop = false) {
|
||||
bool add_primitive(gl::mode_t a_mode,size_t a_floatn,const float* a_xyzs,bool a_stop = false) {
|
||||
|
||||
if(a_mode==gl::points()) {
|
||||
return add_points(a_floatn,a_xyzs,a_stop);
|
||||
@@ -587,7 +587,7 @@ public:
|
||||
}
|
||||
|
||||
bool add_primitive(gl::mode_t a_mode,
|
||||
unsigned int a_floatn,
|
||||
size_t a_floatn,
|
||||
const float* a_xyzs,
|
||||
const float* a_rgbas,
|
||||
bool a_stop = false){
|
||||
@@ -622,14 +622,14 @@ public:
|
||||
/// points with x,y only ///////////////////////////////
|
||||
////////////////////////////////////////////////////////
|
||||
|
||||
bool add_points_xy(unsigned int a_floatn,const float* a_xys,bool a_stop = false) {
|
||||
unsigned int num = a_floatn/2;
|
||||
bool add_points_xy(size_t a_floatn,const float* a_xys,bool a_stop = false) {
|
||||
size_t num = a_floatn/2;
|
||||
|
||||
m_mode = gl::points();
|
||||
|
||||
float x,y,z,w;
|
||||
float* pos;
|
||||
for(unsigned int ipt=0;ipt<num;ipt++) {
|
||||
for(size_t ipt=0;ipt<num;ipt++) {
|
||||
pos = (float*)(a_xys+2*ipt);
|
||||
x = *pos;pos++;
|
||||
y = *pos;pos++;
|
||||
@@ -642,10 +642,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_triangle_fan_xy(unsigned int a_floatn,const float* a_xys,
|
||||
bool add_triangle_fan_xy(size_t a_floatn,const float* a_xys,
|
||||
bool a_stop = false,
|
||||
bool a_triangle_revert = false){
|
||||
unsigned int num = a_floatn/2;
|
||||
size_t num = a_floatn/2;
|
||||
if(num<3) return false;
|
||||
|
||||
m_mode = gl::triangle_fan();
|
||||
@@ -666,7 +666,7 @@ public:
|
||||
p2z = 0;
|
||||
project(p2x,p2y,p2z,w2);
|
||||
|
||||
for(unsigned int index=2;index<num;index++) {
|
||||
for(size_t index=2;index<num;index++) {
|
||||
const float* pos = a_xys+2*index;
|
||||
p3x = *(pos+0);
|
||||
p3y = *(pos+1);
|
||||
@@ -696,10 +696,10 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_triangle_strip_xy(unsigned int a_floatn,const float* a_xys,
|
||||
bool add_triangle_strip_xy(size_t a_floatn,const float* a_xys,
|
||||
bool a_stop = false,
|
||||
bool a_triangle_revert = false){
|
||||
unsigned int num = a_floatn/2;
|
||||
size_t num = a_floatn/2;
|
||||
if(num<3) return false;
|
||||
|
||||
m_mode = gl::triangle_strip();
|
||||
@@ -721,7 +721,7 @@ public:
|
||||
project(p2x,p2y,p2z,w2);
|
||||
|
||||
bool flip = false;
|
||||
for(unsigned int index=2;index<num;index++) {
|
||||
for(size_t index=2;index<num;index++) {
|
||||
const float* pos = a_xys+2*index;
|
||||
p3x = *(pos+0);
|
||||
p3y = *(pos+1);
|
||||
@@ -777,8 +777,8 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_triangles_xy(unsigned int a_floatn,const float* a_xys,bool a_stop = false,bool a_triangle_revert = false){
|
||||
unsigned int num = a_floatn/2;
|
||||
bool add_triangles_xy(size_t a_floatn,const float* a_xys,bool a_stop = false,bool a_triangle_revert = false){
|
||||
size_t num = a_floatn/2;
|
||||
if(num<3) return false;
|
||||
|
||||
m_mode = gl::triangles();
|
||||
@@ -787,7 +787,7 @@ public:
|
||||
float p2x,p2y,p2z,w2=1;
|
||||
float p3x,p3y,p3z,w3=1;
|
||||
|
||||
for(unsigned int index=0;index<num;index+=3) {
|
||||
for(size_t index=0;index<num;index+=3) {
|
||||
|
||||
const float* pos1 = a_xys+2*index;
|
||||
p1x = *(pos1+0);
|
||||
@@ -824,16 +824,16 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_line_loop_xy(unsigned int a_floatn,const float* a_xys,bool a_stop = false){
|
||||
unsigned int num = a_floatn/2;
|
||||
bool add_line_loop_xy(size_t a_floatn,const float* a_xys,bool a_stop = false){
|
||||
size_t num = a_floatn/2;
|
||||
if(num<=1) return false;
|
||||
unsigned int nseg = num-1;
|
||||
size_t nseg = num-1;
|
||||
|
||||
m_mode = gl::line_loop();
|
||||
|
||||
float xb,yb,zb,wb,xe,ye,ze,we;
|
||||
float* pos;
|
||||
for(unsigned int iseg = 0;iseg<nseg;iseg++) {
|
||||
for(size_t iseg = 0;iseg<nseg;iseg++) {
|
||||
pos = (float*)(a_xys+2*iseg);
|
||||
xb = *pos;pos++;
|
||||
yb = *pos;pos++;
|
||||
@@ -868,16 +868,16 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_line_strip_xy(unsigned int a_floatn,const float* a_xys,bool a_stop = false){
|
||||
unsigned int num = a_floatn/2;
|
||||
bool add_line_strip_xy(size_t a_floatn,const float* a_xys,bool a_stop = false){
|
||||
size_t num = a_floatn/2;
|
||||
if(num<=1) return false;
|
||||
unsigned int nseg = num-1;
|
||||
size_t nseg = num-1;
|
||||
|
||||
m_mode = gl::line_strip();
|
||||
|
||||
float xb,yb,zb,wb,xe,ye,ze,we;
|
||||
float* pos;
|
||||
for(unsigned int iseg = 0;iseg<nseg;iseg++) {
|
||||
for(size_t iseg = 0;iseg<nseg;iseg++) {
|
||||
pos = (float*)(a_xys+2*iseg);
|
||||
xb = *pos;pos++;
|
||||
yb = *pos;pos++;
|
||||
@@ -894,20 +894,20 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
bool add_lines_xy(unsigned int a_floatn,const float* a_xys,bool a_stop = false){
|
||||
bool add_lines_xy(size_t a_floatn,const float* a_xys,bool a_stop = false){
|
||||
//lines = segments. Each point having only (x,y) (no z).
|
||||
//used in exlib::sg::[text_freetype, text_hershey].
|
||||
|
||||
unsigned int num = a_floatn/2;
|
||||
size_t num = a_floatn/2;
|
||||
|
||||
unsigned int nseg = num/2;
|
||||
size_t nseg = num/2;
|
||||
if(!nseg) return false;
|
||||
|
||||
m_mode = gl::lines();
|
||||
|
||||
float xb,yb,zb,wb,xe,ye,ze,we;
|
||||
float* pos;
|
||||
for(unsigned int iseg = 0;iseg<nseg;iseg++) {
|
||||
for(size_t iseg = 0;iseg<nseg;iseg++) {
|
||||
pos = (float*)(a_xys+4*iseg);
|
||||
xb = *pos;pos++;
|
||||
yb = *pos;pos++;
|
||||
@@ -926,7 +926,7 @@ public:
|
||||
}
|
||||
|
||||
bool add_primitive_xy(gl::mode_t a_mode,
|
||||
unsigned int a_floatn,const float* a_xys,
|
||||
size_t a_floatn,const float* a_xys,
|
||||
bool a_stop = false,
|
||||
bool a_triangle_revert = false){
|
||||
|
||||
@@ -1003,34 +1003,34 @@ public:
|
||||
|
||||
public:
|
||||
//for sg::[tex_]sphere::visit() template :
|
||||
bool add_triangle_fan(unsigned int a_floatn,const float* a_xyzs,const float* /*a_nms*/) {
|
||||
bool add_triangle_fan(size_t a_floatn,const float* a_xyzs,const float* /*a_nms*/) {
|
||||
return add_triangle_fan(a_floatn,a_xyzs);
|
||||
}
|
||||
bool add_triangle_fan(unsigned int a_floatn,const float* a_xyzs,const float* /*a_rgbas*/,const float* /*a_nms*/) {
|
||||
bool add_triangle_fan(size_t a_floatn,const float* a_xyzs,const float* /*a_rgbas*/,const float* /*a_nms*/) {
|
||||
return add_triangle_fan(a_floatn,a_xyzs);
|
||||
}
|
||||
/*
|
||||
bool add_triangles_texture(unsigned int a_floatn,const float* a_xyzs,unsigned int,const float*){
|
||||
bool add_triangles_texture(size_t a_floatn,const float* a_xyzs,unsigned int,const float*){
|
||||
return add_triangles(a_floatn,a_xyzs);
|
||||
}
|
||||
bool add_triangle_fan_texture(unsigned int a_floatn,const float* a_xyzs,unsigned int,const float*){
|
||||
bool add_triangle_fan_texture(size_t a_floatn,const float* a_xyzs,unsigned int,const float*){
|
||||
return add_triangle_fan(a_floatn,a_xyzs);
|
||||
}
|
||||
bool add_triangle_strip_texture(unsigned int a_floatn,const float* a_xyzs,unsigned int,const float*){
|
||||
bool add_triangle_strip_texture(size_t a_floatn,const float* a_xyzs,unsigned int,const float*){
|
||||
return add_triangle_strip(a_floatn,a_xyzs,false);
|
||||
}
|
||||
*/
|
||||
bool add_triangle_fan_texture(unsigned int a_floatn,const float* a_xyzs,const float* /*a_nms*/,unsigned int,const float*){
|
||||
bool add_triangle_fan_texture(size_t a_floatn,const float* a_xyzs,const float* /*a_nms*/,unsigned int,const float*){
|
||||
return add_triangle_fan(a_floatn,a_xyzs);
|
||||
}
|
||||
bool add_triangle_strip_texture(unsigned int a_floatn,const float* a_xyzs,const float* /*a_nms*/,unsigned int,const float*){
|
||||
bool add_triangle_strip_texture(size_t a_floatn,const float* a_xyzs,const float* /*a_nms*/,unsigned int,const float*){
|
||||
return add_triangle_strip(a_floatn,a_xyzs,false);
|
||||
}
|
||||
|
||||
bool add_triangle_strip(unsigned int a_floatn,const float* a_xyzs,const float* /*a_nms*/) {
|
||||
bool add_triangle_strip(size_t a_floatn,const float* a_xyzs,const float* /*a_nms*/) {
|
||||
return add_triangle_strip(a_floatn,a_xyzs,false);
|
||||
}
|
||||
bool add_triangle_strip(unsigned int a_floatn,const float* a_xyzs,const float* /*a_rgbas*/,const float* /*a_nms*/) {
|
||||
bool add_triangle_strip(size_t a_floatn,const float* a_xyzs,const float* /*a_rgbas*/,const float* /*a_nms*/) {
|
||||
return add_triangle_strip(a_floatn,a_xyzs,false);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,54 +19,42 @@ namespace sg {
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
|
||||
typedef unsigned int bufpos;
|
||||
typedef size_t bufpos;
|
||||
|
||||
class render_action : public matrix_action {
|
||||
public:
|
||||
typedef unsigned int gstoid;
|
||||
public:
|
||||
virtual void load_proj_matrix(const mat4f&) = 0;
|
||||
virtual void load_model_matrix(const mat4f&) = 0;
|
||||
public:
|
||||
virtual void draw_vertex_array(gl::mode_t,
|
||||
unsigned int,
|
||||
const float*) = 0;
|
||||
virtual void draw_vertex_array_xy(gl::mode_t,
|
||||
unsigned int,
|
||||
const float*) = 0;
|
||||
virtual void draw_vertex_color_array(gl::mode_t,
|
||||
unsigned int,
|
||||
const float*,
|
||||
const float*) = 0;
|
||||
virtual void draw_vertex_normal_array(gl::mode_t,
|
||||
unsigned int,
|
||||
const float*,
|
||||
const float*) = 0;
|
||||
virtual void draw_vertex_color_normal_array(gl::mode_t,
|
||||
unsigned int,
|
||||
const float*,
|
||||
const float*,
|
||||
const float*) = 0;
|
||||
virtual void draw_vertex_array(gl::mode_t,size_t,const float*) = 0;
|
||||
virtual void draw_vertex_array_xy(gl::mode_t,size_t,const float*) = 0;
|
||||
virtual void draw_vertex_color_array(gl::mode_t,size_t,const float*,const float*) = 0;
|
||||
virtual void draw_vertex_normal_array(gl::mode_t,size_t,const float*,const float*) = 0;
|
||||
virtual void draw_vertex_color_normal_array(gl::mode_t,size_t,const float*,const float*,const float*) = 0;
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/// texture /////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
virtual void draw_vertex_array_texture(tools::gl::mode_t,
|
||||
unsigned int,const float*,
|
||||
unsigned int,
|
||||
size_t,const float*,
|
||||
gstoid,
|
||||
const float*) = 0;
|
||||
virtual void draw_vertex_normal_array_texture(tools::gl::mode_t,
|
||||
unsigned int,
|
||||
size_t,
|
||||
const float*,const float*,
|
||||
unsigned int,
|
||||
gstoid,
|
||||
const float*) = 0;
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/// VBO /////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
virtual void begin_gsto(unsigned int) = 0;
|
||||
virtual void draw_gsto_v(gl::mode_t,unsigned int,bufpos) = 0;
|
||||
virtual void draw_gsto_vc(gl::mode_t,unsigned int,bufpos,bufpos) = 0;
|
||||
virtual void draw_gsto_vn(gl::mode_t,unsigned int,bufpos,bufpos) = 0;
|
||||
virtual void draw_gsto_vcn(gl::mode_t,unsigned int,bufpos,bufpos,bufpos) = 0;
|
||||
virtual void begin_gsto(gstoid) = 0;
|
||||
virtual void draw_gsto_v(gl::mode_t,size_t,bufpos) = 0;
|
||||
virtual void draw_gsto_vc(gl::mode_t,size_t,bufpos,bufpos) = 0;
|
||||
virtual void draw_gsto_vn(gl::mode_t,size_t,bufpos,bufpos) = 0;
|
||||
virtual void draw_gsto_vcn(gl::mode_t,size_t,bufpos,bufpos,bufpos) = 0;
|
||||
virtual void end_gsto() = 0;
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
@@ -168,56 +156,56 @@ public:
|
||||
|
||||
public:
|
||||
// for sphere::visit template.
|
||||
bool add_triangle_fan(unsigned int a_floatn,const float* a_xyzs,const float* a_nms) {
|
||||
bool add_triangle_fan(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(unsigned int a_floatn,const float* a_xyzs,float* a_rgbas,const float* a_nms) {
|
||||
bool add_triangle_fan(size_t a_floatn,const float* a_xyzs,float* a_rgbas,const float* a_nms) {
|
||||
draw_vertex_color_normal_array(gl::triangle_fan(),a_floatn,a_xyzs,a_rgbas,a_nms);
|
||||
return true;
|
||||
}
|
||||
bool add_triangle_strip(unsigned int a_floatn,const float* a_xyzs,const float* a_nms) {
|
||||
bool add_triangle_strip(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(unsigned int a_floatn,const float* a_xyzs,const float* a_rgbas,const float* a_nms) {
|
||||
bool add_triangle_strip(size_t a_floatn,const float* a_xyzs,const float* a_rgbas,const float* a_nms) {
|
||||
draw_vertex_color_normal_array(gl::triangle_strip(),a_floatn,a_xyzs,a_rgbas,a_nms);
|
||||
return true;
|
||||
}
|
||||
bool add_line_loop(unsigned int a_floatn,const float* a_xyzs) {
|
||||
bool add_line_loop(size_t a_floatn,const float* a_xyzs) {
|
||||
draw_vertex_array(gl::line_loop(),a_floatn,a_xyzs);
|
||||
return true;
|
||||
}
|
||||
bool add_line_strip(unsigned int a_floatn,const float* a_xyzs) {
|
||||
bool add_line_strip(size_t a_floatn,const float* a_xyzs) {
|
||||
draw_vertex_array(gl::line_strip(),a_floatn,a_xyzs);
|
||||
return true;
|
||||
}
|
||||
bool add_points(unsigned int a_floatn,const float* a_xyzs) {
|
||||
bool add_points(size_t a_floatn,const float* a_xyzs) {
|
||||
draw_vertex_array(gl::points(),a_floatn,a_xyzs);
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
bool add_triangles_texture(unsigned int a_floatn,const float* a_xyzs,unsigned int a_tex,const float* a_texs){
|
||||
bool add_triangles_texture(size_t a_floatn,const float* a_xyzs,gstoid a_tex,const float* a_texs){
|
||||
draw_vertex_array_texture(gl::triangles(),a_floatn,a_xyzs,a_tex,a_texs);
|
||||
return true;
|
||||
}
|
||||
bool add_triangle_fan_texture(unsigned int a_floatn,const float* a_xyzs,unsigned int a_tex,const float* a_texs){
|
||||
bool add_triangle_fan_texture(size_t a_floatn,const float* a_xyzs,gstoid a_tex,const float* a_texs){
|
||||
draw_vertex_array_texture(gl::triangle_fan(),a_floatn,a_xyzs,a_tex,a_texs);
|
||||
return true;
|
||||
}
|
||||
bool add_triangle_strip_texture(unsigned int a_floatn,const float* a_xyzs,unsigned int a_tex,const float* a_texs){
|
||||
bool add_triangle_strip_texture(size_t a_floatn,const float* a_xyzs,gstoid a_tex,const float* a_texs){
|
||||
draw_vertex_array_texture(gl::triangle_strip(),a_floatn,a_xyzs,a_tex,a_texs);
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
bool add_triangle_fan_texture(unsigned int a_floatn,const float* a_xyzs,const float* a_nms,
|
||||
unsigned int a_tex,const float* a_texs){
|
||||
bool add_triangle_fan_texture(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(unsigned int a_floatn,const float* a_xyzs,const float* a_nms,
|
||||
unsigned int a_tex,const float* a_texs){
|
||||
bool add_triangle_strip_texture(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;
|
||||
}
|
||||
@@ -228,11 +216,11 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
void dump_vertex_array_xy(std::ostream& a_out,gl::mode_t /*a_mode*/,unsigned int a_floatn,const float* a_xys) {
|
||||
unsigned int num = a_floatn/2;
|
||||
void dump_vertex_array_xy(std::ostream& a_out,gl::mode_t /*a_mode*/,size_t a_floatn,const float* a_xys) {
|
||||
size_t num = a_floatn/2;
|
||||
if(!num) return;
|
||||
a_out << "dump_vertex_array_xy : begin : " << num << std::endl;
|
||||
for(unsigned int index=0;index<num;index++) {
|
||||
for(size_t index=0;index<num;index++) {
|
||||
a_out << "xy : " << index
|
||||
<< " " << a_xys[2*index]
|
||||
<< " " << a_xys[2*index+1]
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
#include "../lina/plane"
|
||||
#include "../mathf"
|
||||
#include "../hls"
|
||||
#include "../colorfs"
|
||||
#include "../lina/vec2f"
|
||||
#include "../lina/vec3d" //ZZ=double
|
||||
#include "../lina/geom2"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// disable the warning about the usage of "this" in the constructor.
|
||||
@@ -26,25 +30,25 @@ namespace sg {
|
||||
|
||||
class render_zb : public render_action {
|
||||
public:
|
||||
virtual void draw_vertex_array(gl::mode_t a_mode,unsigned int a_floatn,const float* a_xyzs){
|
||||
virtual void draw_vertex_array(gl::mode_t a_mode,size_t a_floatn,const float* a_xyzs){
|
||||
m_pv.add_primitive(a_mode,a_floatn,a_xyzs);
|
||||
}
|
||||
|
||||
virtual void draw_vertex_array_xy(gl::mode_t a_mode,unsigned int a_floatn,const float* a_xys){
|
||||
virtual void draw_vertex_array_xy(gl::mode_t a_mode,size_t a_floatn,const float* a_xys){
|
||||
m_pv.add_primitive_xy(a_mode,a_floatn,a_xys);
|
||||
}
|
||||
|
||||
virtual void draw_vertex_color_array(gl::mode_t a_mode,unsigned int a_floatn,
|
||||
virtual void draw_vertex_color_array(gl::mode_t a_mode,size_t a_floatn,
|
||||
const float* a_xyzs,const float* a_rgbas){
|
||||
m_pv.add_primitive(a_mode,a_floatn,a_xyzs,a_rgbas);
|
||||
}
|
||||
|
||||
virtual void draw_vertex_normal_array(gl::mode_t a_mode,unsigned int a_floatn,
|
||||
virtual void draw_vertex_normal_array(gl::mode_t a_mode,size_t a_floatn,
|
||||
const float* a_xyzs,const float* /*a_nms*/){
|
||||
m_pv.add_primitive(a_mode,a_floatn,a_xyzs);
|
||||
}
|
||||
|
||||
virtual void draw_vertex_color_normal_array(gl::mode_t a_mode,unsigned int a_floatn,
|
||||
virtual void draw_vertex_color_normal_array(gl::mode_t a_mode,size_t a_floatn,
|
||||
const float* a_xyzs,const float* a_rgbas,const float* /*a_nms*/){
|
||||
// We expect a_nms of size : 3*(a_floatn/3)
|
||||
// (then one normal per 3D point).
|
||||
@@ -128,14 +132,25 @@ public:
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/// texture /////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
virtual void draw_vertex_array_texture(tools::gl::mode_t,unsigned int a_xyzn,const float* a_xyzs,
|
||||
unsigned int a_id,const float*) {
|
||||
virtual void draw_vertex_array_texture(gl::mode_t,size_t a_xyzn,const float* a_xyzs,
|
||||
gstoid a_id,const float* a_tcs) {
|
||||
//::printf("debug : render_zb : 000 : %d\n",a_id);
|
||||
|
||||
tools::img_byte img;
|
||||
img_byte img;
|
||||
if(!m_mgr.find(a_id,img)) return;
|
||||
|
||||
//::printf("debug : render_zb : img : %d %d\n",img.width(),img.height());
|
||||
if(img.is_empty()) return;
|
||||
|
||||
unsigned int imw = img.width();
|
||||
unsigned int imh = img.height();
|
||||
unsigned int imn = img.bpp();
|
||||
if(imn!=3) {
|
||||
m_out << "tools::sg::render_zb::draw_vertex_array_texture :"
|
||||
<< " not a 3 bytes per pixel image."
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
if(a_xyzn!=12) {
|
||||
m_out << "tools::sg::render_zb::draw_vertex_array_texture :"
|
||||
@@ -144,69 +159,84 @@ public:
|
||||
return;
|
||||
}
|
||||
|
||||
float x1 = a_xyzs[0];
|
||||
float y1 = a_xyzs[ 1];
|
||||
//float z1 = a_xyzs[ 2];
|
||||
//::printf("debug : render_zb : tcs : %g %g, %g %g, %g %g, %g %g\n",
|
||||
// a_tcs[0],a_tcs[1],a_tcs[2],a_tcs[3],a_tcs[4],a_tcs[5],a_tcs[6],a_tcs[7]);
|
||||
|
||||
float x2 = a_xyzs[3];
|
||||
//float y2 = a_xyzs[ 4];
|
||||
//float z2 = a_xyzs[ 5];
|
||||
vec3f p1(a_xyzs[0],a_xyzs[ 1],a_xyzs[ 2]);
|
||||
vec3f p2(a_xyzs[3],a_xyzs[ 4],a_xyzs[ 5]);
|
||||
//vec3f p3(a_xyzs[6],a_xyzs[ 7],a_xyzs[ 8]);
|
||||
vec3f p4(a_xyzs[9],a_xyzs[10],a_xyzs[11]);
|
||||
|
||||
//float x3 = a_xyzs[6];
|
||||
//float y3 = a_xyzs[ 7];
|
||||
//float z3 = a_xyzs[ 8];
|
||||
vec3f dx = p2-p1;
|
||||
vec3f dy = p4-p1;
|
||||
|
||||
//float x4 = a_xyzs[9];
|
||||
float y4 = a_xyzs[10];
|
||||
//float z4 = a_xyzs[11];
|
||||
|
||||
float bw = x2-x1;
|
||||
float bh = y4-y1;
|
||||
float bw_2 = bw*0.5f;
|
||||
float bh_2 = bh*0.5f;
|
||||
|
||||
//::printf("debug : render_zb : box : %g %g\n",bw,bh);
|
||||
|
||||
unsigned int w = img.width();
|
||||
unsigned int h = img.height();
|
||||
unsigned int bpp = img.bpp();
|
||||
if(bpp!=3) {
|
||||
vec2f t1(a_tcs[0],a_tcs[1]);
|
||||
vec2f t2(a_tcs[2],a_tcs[3]);
|
||||
vec2f t3(a_tcs[4],a_tcs[5]);
|
||||
vec2f t4(a_tcs[6],a_tcs[7]);
|
||||
vec2f tdx = t2-t1;
|
||||
vec2f tdy = t4-t1;
|
||||
if(!tdx.length()) {
|
||||
m_out << "tools::sg::render_zb::draw_vertex_array_texture :"
|
||||
<< " not a 3 bytes per pixel image."
|
||||
<< " tdx is null."
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
unsigned char* pos = img.buffer();
|
||||
for(unsigned int row=0;row<h;row++) {
|
||||
for(unsigned int col=0;col<w;col++) {
|
||||
float r = (*pos)/255.0f;pos++;
|
||||
float g = (*pos)/255.0f;pos++;
|
||||
float b = (*pos)/255.0f;pos++;
|
||||
float x = bw*float(col)/float(w-1)-bw_2;
|
||||
float y = bh*float(row)/float(h-1)-bh_2;
|
||||
float z = 0;
|
||||
m_rgba.set_value(r,g,b,1);
|
||||
m_pv.add_one_point(x,y,z);
|
||||
}
|
||||
if(!tdy.length()) {
|
||||
m_out << "tools::sg::render_zb::draw_vertex_array_texture :"
|
||||
<< " tdy is null."
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
std::vector<vec2f> poly;
|
||||
poly.push_back(t1);
|
||||
poly.push_back(t2);
|
||||
poly.push_back(t3);
|
||||
poly.push_back(t4);
|
||||
poly.push_back(t1);
|
||||
|
||||
{float r,g,b,tx,ty;
|
||||
vec3f p;
|
||||
vec2f t;
|
||||
unsigned char* pos = img.buffer();
|
||||
for(unsigned int row=0;row<imh;row++) {
|
||||
for(unsigned int col=0;col<imw;col++) {
|
||||
r = (*pos)/255.0f;pos++;
|
||||
g = (*pos)/255.0f;pos++;
|
||||
b = (*pos)/255.0f;pos++;
|
||||
|
||||
tx = float(col)/float(imw-1); //[0,1]
|
||||
ty = float(row)/float(imh-1); //[0,1]
|
||||
|
||||
t.set_value(tx,ty);
|
||||
|
||||
if(!is_inside(t,poly)) continue;
|
||||
|
||||
t = t - t1;
|
||||
|
||||
p = p1+dx*t.x()/tdx.length()+dy*t.y()/tdy.length();
|
||||
|
||||
m_rgba.set_value(r,g,b,1);
|
||||
m_pv.add_one_point(p.x(),p.y(),p.z());
|
||||
}
|
||||
}}
|
||||
|
||||
}
|
||||
|
||||
virtual void draw_vertex_normal_array_texture(tools::gl::mode_t a_mode,
|
||||
unsigned int a_xyzn,const float* a_xyzs,const float* /*a_nms*/,
|
||||
unsigned int a_id,const float* a_tcs) {
|
||||
virtual void draw_vertex_normal_array_texture(gl::mode_t a_mode,
|
||||
size_t a_xyzn,const float* a_xyzs,const float* /*a_nms*/,
|
||||
gstoid a_id,const float* a_tcs) {
|
||||
draw_vertex_array_texture(a_mode,a_xyzn,a_xyzs,a_id,a_tcs);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/// VBO /////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
virtual void begin_gsto(unsigned int) {}
|
||||
virtual void draw_gsto_v(tools::gl::mode_t,unsigned int,bufpos){}
|
||||
virtual void draw_gsto_vc(tools::gl::mode_t,unsigned int,bufpos,bufpos) {}
|
||||
virtual void draw_gsto_vn(tools::gl::mode_t,unsigned int,bufpos,bufpos) {}
|
||||
virtual void draw_gsto_vcn(tools::gl::mode_t,unsigned int,bufpos,bufpos,bufpos) {}
|
||||
virtual void begin_gsto(gstoid) {}
|
||||
virtual void draw_gsto_v(gl::mode_t,size_t,bufpos){}
|
||||
virtual void draw_gsto_vc(gl::mode_t,size_t,bufpos,bufpos) {}
|
||||
virtual void draw_gsto_vn(gl::mode_t,size_t,bufpos,bufpos) {}
|
||||
virtual void draw_gsto_vcn(gl::mode_t,size_t,bufpos,bufpos,bufpos) {}
|
||||
virtual void end_gsto() {}
|
||||
/////////////////////////////////////////////////////////////////
|
||||
/////////////////////////////////////////////////////////////////
|
||||
@@ -217,8 +247,8 @@ public:
|
||||
:render_action(a_out,a_ww,a_wh)
|
||||
,m_mgr(a_mgr)
|
||||
,m_pv(*this)
|
||||
,m_light_color(tools::colorf::white())
|
||||
,m_light_direction(tools::vec3f(0,0,-1))
|
||||
,m_light_color(colorf_white())
|
||||
,m_light_direction(vec3f(0,0,-1))
|
||||
|
||||
,m_ccw(true)
|
||||
,m_POLYGON_OFFSET_FILL(false)
|
||||
@@ -310,7 +340,7 @@ public:
|
||||
zb::buffer::ZPixel add_color(const colorf& a_col){
|
||||
//::printf("debug : render_zb::add_color : %g %g %g %g : %d\n",
|
||||
// a_col.r(),a_col.g(),a_col.b(),a_col.a(),m_cmap.size());
|
||||
zb::buffer::ZPixel pix = m_cmap.size();
|
||||
zb::buffer::ZPixel pix = (zb::buffer::ZPixel)m_cmap.size();
|
||||
m_cmap[a_col] = pix;
|
||||
return pix;
|
||||
}
|
||||
@@ -333,11 +363,11 @@ protected:
|
||||
}
|
||||
}
|
||||
public:
|
||||
//typedef tools::wps::VCol VCol;
|
||||
//typedef wps::VCol VCol;
|
||||
typedef float VCol;
|
||||
|
||||
static bool get_rgb(void* a_tag,unsigned int a_col,unsigned int a_row,VCol& a_r,VCol& a_g,VCol& a_b){
|
||||
//used with tools::wps.
|
||||
//used with wps.
|
||||
render_zb* rzb = (render_zb*)a_tag;
|
||||
|
||||
zb::buffer::ZPixel pix;
|
||||
@@ -368,6 +398,27 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
unsigned char* get_rgbas(size_t& a_sz) {
|
||||
if(!m_ww || !m_wh) {a_sz = 0;return 0;}
|
||||
a_sz = 4 * m_ww * m_wh;
|
||||
typedef unsigned char uchar;
|
||||
uchar* rgbas = new uchar[a_sz];
|
||||
if(!rgbas) {a_sz = 0;return 0;}
|
||||
uchar* pos = rgbas;
|
||||
VCol r,g,b;
|
||||
VCol a = 1;
|
||||
for(unsigned int row=0;row<m_wh;row++) {
|
||||
for(unsigned int col=0;col<m_ww;col++) {
|
||||
get_rgb(this,col,m_wh-row-1,r,g,b);
|
||||
*pos = (uchar)(r*255.0F);pos++;
|
||||
*pos = (uchar)(g*255.0F);pos++;
|
||||
*pos = (uchar)(b*255.0F);pos++;
|
||||
*pos = (uchar)(a*255.0F);pos++;
|
||||
}
|
||||
}
|
||||
return rgbas;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool project_point(float& a_x,float& a_y,float& a_z,float& a_w) {
|
||||
a_w = 1;
|
||||
@@ -540,9 +591,9 @@ protected:
|
||||
p3z -= epsil;
|
||||
}
|
||||
|
||||
typedef tools::zb::ZZ ZZ;
|
||||
typedef zb::ZZ ZZ; //double
|
||||
|
||||
plane<ZZ> pn(
|
||||
plane<vec3d> pn(
|
||||
vec3<ZZ>(p1x,p1y,p1z),
|
||||
vec3<ZZ>(p2x,p2y,p2z),
|
||||
vec3<ZZ>(p3x,p3y,p3z)
|
||||
@@ -590,7 +641,7 @@ protected:
|
||||
m_rzb.m_proj_1.mul_4f(_p2x,_p2y,_p2z,_p2w);
|
||||
m_rzb.m_proj_1.mul_4f(_p3x,_p3y,_p3z,_p3w);
|
||||
|
||||
plane<ZZ> _pn(
|
||||
plane<vec3d> _pn(
|
||||
vec3<ZZ>(_p1x,_p1y,_p1z),
|
||||
vec3<ZZ>(_p2x,_p2y,_p2z),
|
||||
vec3<ZZ>(_p3x,_p3y,_p3z)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "sf_vec"
|
||||
#include "render_action"
|
||||
#include "../colorf"
|
||||
#include "../colorfs"
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
@@ -53,7 +53,7 @@ public:
|
||||
public:
|
||||
rgba()
|
||||
:parent()
|
||||
,color(colorf(0.8f,0.8f,0.8f,0))
|
||||
,color(colorf_grey())
|
||||
{
|
||||
add_fields();
|
||||
}
|
||||
|
||||
@@ -37,8 +37,10 @@ public: //node
|
||||
}
|
||||
virtual void bbox(bbox_action& a_action) {
|
||||
a_action.push_matrices();
|
||||
a_action.push_state();
|
||||
parent::bbox(a_action);
|
||||
a_action.pop_matrices();
|
||||
a_action.pop_state();
|
||||
}
|
||||
virtual void event(event_action& a_action) {
|
||||
a_action.push_matrices();
|
||||
@@ -49,8 +51,10 @@ public: //node
|
||||
}
|
||||
virtual void get_matrix(get_matrix_action& a_action) {
|
||||
a_action.push_matrices();
|
||||
a_action.push_state();
|
||||
parent::get_matrix(a_action);
|
||||
a_action.pop_matrices();
|
||||
a_action.pop_state();
|
||||
}
|
||||
virtual bool write(write_action& a_action) {
|
||||
if(!a_action.beg_node(*this)) return false;
|
||||
@@ -61,24 +65,26 @@ public: //node
|
||||
}
|
||||
virtual void is_visible(visible_action& a_action) {
|
||||
a_action.push_matrices();
|
||||
a_action.push_state();
|
||||
parent::is_visible(a_action);
|
||||
a_action.pop_matrices();
|
||||
a_action.pop_state();
|
||||
}
|
||||
public:
|
||||
separator():parent(){
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
virtual ~separator(){
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::decrement(s_class().c_str());
|
||||
mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
separator(const separator& a_from):parent(a_from){
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
separator& operator=(const separator& a_from){
|
||||
|
||||
@@ -6,8 +6,6 @@
|
||||
|
||||
#include "sf"
|
||||
|
||||
#include "enums" //hjust,vjust
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
|
||||
|
||||
@@ -147,7 +147,7 @@ public:
|
||||
public:
|
||||
void screen2ndc(int a_x,int a_y, //signed because of wall.
|
||||
float& a_wcx,float& a_wcy,float& a_wcz,float& a_wcw) const {
|
||||
// a proj point in near plan has (z,w) :
|
||||
// a proj point in near plane has (z,w) :
|
||||
// ortho -1,1 -> z/w = -1 and xy in [-1,1][-1,1]
|
||||
// persp -n,n -> z/w = -1 and xy in [-n,n][-n,n]
|
||||
|
||||
|
||||
@@ -136,34 +136,30 @@ inline const std::string& font_hershey() {
|
||||
static const std::string s_v("hershey");
|
||||
return s_v;
|
||||
}
|
||||
inline const std::string& font_arial_ttf() {
|
||||
static const std::string s_v("arial.ttf");
|
||||
return s_v;
|
||||
}
|
||||
inline const std::string& font_arialbd_ttf() {
|
||||
static const std::string s_v("arialbd.ttf");
|
||||
return s_v;
|
||||
}
|
||||
inline const std::string& font_timesbd_ttf() {
|
||||
static const std::string s_v("timesbd.ttf");
|
||||
return s_v;
|
||||
}
|
||||
inline const std::string& font_symbol_ttf() {
|
||||
static const std::string s_v("symbol.ttf");
|
||||
return s_v;
|
||||
|
||||
#define TOOLS_FONT_TTF(a__name) \
|
||||
inline const std::string& font_##a__name##_ttf() {\
|
||||
static const std::string s_v(std::string(#a__name)+".ttf");\
|
||||
return s_v;\
|
||||
}
|
||||
|
||||
TOOLS_FONT_TTF(arial)
|
||||
TOOLS_FONT_TTF(arialbd)
|
||||
TOOLS_FONT_TTF(timesbd)
|
||||
TOOLS_FONT_TTF(symbol)
|
||||
TOOLS_FONT_TTF(helvetica)
|
||||
TOOLS_FONT_TTF(times_roman)
|
||||
TOOLS_FONT_TTF(cour)
|
||||
TOOLS_FONT_TTF(courbd)
|
||||
TOOLS_FONT_TTF(couri)
|
||||
TOOLS_FONT_TTF(courbi)
|
||||
|
||||
#undef TOOLS_FONT_TTF
|
||||
|
||||
inline const std::string& font_stixgeneral_otf() {
|
||||
static const std::string s_v("stixgeneral.otf");
|
||||
return s_v;
|
||||
}
|
||||
inline const std::string& font_helvetica_ttf() {
|
||||
static const std::string s_v("helvetica.ttf");
|
||||
return s_v;
|
||||
}
|
||||
inline const std::string& font_times_roman_ttf() {
|
||||
static const std::string s_v("times_roman.ttf");
|
||||
return s_v;
|
||||
}
|
||||
|
||||
inline const std::string& gui_font() {
|
||||
//static const std::string s_v("arial.ttf");
|
||||
|
||||
@@ -145,9 +145,9 @@ private:
|
||||
public:
|
||||
style()
|
||||
:parent()
|
||||
,color(colorf::black())
|
||||
,highlight_color(colorf::black())
|
||||
,back_color(colorf::white())
|
||||
,color(colorf_black())
|
||||
,highlight_color(colorf_black())
|
||||
,back_color(colorf_white())
|
||||
,line_width(1)
|
||||
,marker_size(1)
|
||||
,font_size(10)
|
||||
|
||||
@@ -73,90 +73,104 @@ public:
|
||||
snpf(ss,sizeof(ss),"%g %g %g",c[0],c[1],c[2]);
|
||||
a_s = std::string(ss);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
public:
|
||||
void add(style_color a_color) {
|
||||
(*this)[(*this).size()] = a_color;
|
||||
void add(const style_color& a_color) {
|
||||
(*this)[uint32((*this).size())] = a_color;
|
||||
}
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
#include "../colors"
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
|
||||
class style_default_colormap : public style_colormap {
|
||||
public:
|
||||
TOOLS_CLASS_STRING(default)
|
||||
public:
|
||||
#define STYLE_COLORMAP_ADD(a__name) \
|
||||
tmp.set_name(#a__name);\
|
||||
set_color_##a__name(tmp);\
|
||||
add(tmp);
|
||||
|
||||
style_default_colormap() {
|
||||
add(style_color("aquamarine",colorf::aquamarine()));
|
||||
add(style_color("mediumaquamarine",colorf::mediumaquamarine()));
|
||||
add(style_color("black",colorf::black()));
|
||||
add(style_color("blue",colorf::blue()));
|
||||
add(style_color("cadetblue",colorf::cadetblue()));
|
||||
add(style_color("cornflowerblue",colorf::cornflowerblue()));
|
||||
add(style_color("darkslateblue",colorf::darkslateblue()));
|
||||
add(style_color("lightblue",colorf::lightblue()));
|
||||
add(style_color("lightsteelblue",colorf::lightsteelblue()));
|
||||
add(style_color("mediumblue",colorf::mediumblue()));
|
||||
style_color tmp;
|
||||
STYLE_COLORMAP_ADD(aquamarine)
|
||||
STYLE_COLORMAP_ADD(mediumaquamarine)
|
||||
STYLE_COLORMAP_ADD(black)
|
||||
STYLE_COLORMAP_ADD(blue)
|
||||
STYLE_COLORMAP_ADD(cadetblue)
|
||||
STYLE_COLORMAP_ADD(cornflowerblue)
|
||||
STYLE_COLORMAP_ADD(darkslateblue)
|
||||
STYLE_COLORMAP_ADD(lightblue)
|
||||
STYLE_COLORMAP_ADD(lightsteelblue)
|
||||
STYLE_COLORMAP_ADD(mediumblue)
|
||||
|
||||
add(style_color("mediumslateblue",colorf::mediumslateblue()));
|
||||
add(style_color("midnightblue",colorf::midnightblue()));
|
||||
add(style_color("navyblue",colorf::navyblue()));
|
||||
add(style_color("navy",colorf::navy()));
|
||||
add(style_color("skyblue",colorf::skyblue()));
|
||||
add(style_color("slateblue",colorf::slateblue()));
|
||||
add(style_color("steelblue",colorf::steelblue()));
|
||||
add(style_color("coral",colorf::coral()));
|
||||
add(style_color("cyan",colorf::cyan()));
|
||||
add(style_color("firebrick",colorf::firebrick()));
|
||||
STYLE_COLORMAP_ADD(mediumslateblue)
|
||||
STYLE_COLORMAP_ADD(midnightblue)
|
||||
STYLE_COLORMAP_ADD(navyblue)
|
||||
STYLE_COLORMAP_ADD(navy)
|
||||
STYLE_COLORMAP_ADD(skyblue)
|
||||
STYLE_COLORMAP_ADD(slateblue)
|
||||
STYLE_COLORMAP_ADD(steelblue)
|
||||
STYLE_COLORMAP_ADD(coral)
|
||||
STYLE_COLORMAP_ADD(cyan)
|
||||
STYLE_COLORMAP_ADD(firebrick)
|
||||
|
||||
add(style_color("brown",colorf::brown()));
|
||||
add(style_color("gold",colorf::gold()));
|
||||
add(style_color("goldenrod",colorf::goldenrod()));
|
||||
add(style_color("green",colorf::green()));
|
||||
add(style_color("darkgreen",colorf::darkgreen()));
|
||||
add(style_color("darkolivegreen",colorf::darkolivegreen()));
|
||||
add(style_color("forestgreen",colorf::forestgreen()));
|
||||
add(style_color("limegreen",colorf::limegreen()));
|
||||
add(style_color("mediumseagreen",colorf::mediumseagreen()));
|
||||
add(style_color("mediumspringgreen",colorf::mediumspringgreen()));
|
||||
STYLE_COLORMAP_ADD(brown)
|
||||
STYLE_COLORMAP_ADD(gold)
|
||||
STYLE_COLORMAP_ADD(goldenrod)
|
||||
STYLE_COLORMAP_ADD(green)
|
||||
STYLE_COLORMAP_ADD(darkgreen)
|
||||
STYLE_COLORMAP_ADD(darkolivegreen)
|
||||
STYLE_COLORMAP_ADD(forestgreen)
|
||||
STYLE_COLORMAP_ADD(limegreen)
|
||||
STYLE_COLORMAP_ADD(mediumseagreen)
|
||||
STYLE_COLORMAP_ADD(mediumspringgreen)
|
||||
|
||||
add(style_color("palegreen",colorf::palegreen()));
|
||||
add(style_color("seagreen",colorf::seagreen()));
|
||||
add(style_color("springgreen",colorf::springgreen()));
|
||||
add(style_color("yellowgreen",colorf::yellowgreen()));
|
||||
add(style_color("darkslategrey",colorf::darkslategrey()));
|
||||
add(style_color("dimgrey",colorf::dimgrey()));
|
||||
add(style_color("lightgrey",colorf::lightgrey()));
|
||||
add(style_color("grey",colorf::grey()));
|
||||
add(style_color("khaki",colorf::khaki()));
|
||||
add(style_color("magenta",colorf::magenta()));
|
||||
STYLE_COLORMAP_ADD(palegreen)
|
||||
STYLE_COLORMAP_ADD(seagreen)
|
||||
STYLE_COLORMAP_ADD(springgreen)
|
||||
STYLE_COLORMAP_ADD(yellowgreen)
|
||||
STYLE_COLORMAP_ADD(darkslategrey)
|
||||
STYLE_COLORMAP_ADD(dimgrey)
|
||||
STYLE_COLORMAP_ADD(lightgrey)
|
||||
STYLE_COLORMAP_ADD(grey)
|
||||
STYLE_COLORMAP_ADD(khaki)
|
||||
STYLE_COLORMAP_ADD(magenta)
|
||||
|
||||
add(style_color("maroon",colorf::maroon()));
|
||||
add(style_color("orange",colorf::orange()));
|
||||
add(style_color("orchid",colorf::orchid()));
|
||||
add(style_color("darkorchid",colorf::darkorchid()));
|
||||
add(style_color("mediumorchid",colorf::mediumorchid()));
|
||||
add(style_color("pink",colorf::pink()));
|
||||
add(style_color("plum",colorf::plum()));
|
||||
add(style_color("red",colorf::red()));
|
||||
add(style_color("indianred",colorf::indianred()));
|
||||
add(style_color("mediumvioletred",colorf::mediumvioletred()));
|
||||
STYLE_COLORMAP_ADD(maroon)
|
||||
STYLE_COLORMAP_ADD(orange)
|
||||
STYLE_COLORMAP_ADD(orchid)
|
||||
STYLE_COLORMAP_ADD(darkorchid)
|
||||
STYLE_COLORMAP_ADD(mediumorchid)
|
||||
STYLE_COLORMAP_ADD(pink)
|
||||
STYLE_COLORMAP_ADD(plum)
|
||||
STYLE_COLORMAP_ADD(red)
|
||||
STYLE_COLORMAP_ADD(indianred)
|
||||
STYLE_COLORMAP_ADD(mediumvioletred)
|
||||
|
||||
add(style_color("orangered",colorf::orangered()));
|
||||
add(style_color("violetred",colorf::violetred()));
|
||||
add(style_color("salmon",colorf::salmon()));
|
||||
add(style_color("sienna",colorf::sienna()));
|
||||
add(style_color("tan",colorf::tan()));
|
||||
add(style_color("thistle",colorf::thistle()));
|
||||
add(style_color("turquoise",colorf::turquoise()));
|
||||
add(style_color("darkturquoise",colorf::darkturquoise()));
|
||||
add(style_color("mediumturquoise",colorf::mediumturquoise()));
|
||||
add(style_color("violet",colorf::violet()));
|
||||
STYLE_COLORMAP_ADD(orangered)
|
||||
STYLE_COLORMAP_ADD(violetred)
|
||||
STYLE_COLORMAP_ADD(salmon)
|
||||
STYLE_COLORMAP_ADD(sienna)
|
||||
STYLE_COLORMAP_ADD(tan)
|
||||
STYLE_COLORMAP_ADD(thistle)
|
||||
STYLE_COLORMAP_ADD(turquoise)
|
||||
STYLE_COLORMAP_ADD(darkturquoise)
|
||||
STYLE_COLORMAP_ADD(mediumturquoise)
|
||||
STYLE_COLORMAP_ADD(violet)
|
||||
|
||||
add(style_color("blueviolet",colorf::blueviolet()));
|
||||
add(style_color("wheat",colorf::wheat()));
|
||||
add(style_color("white",colorf::white()));
|
||||
add(style_color("yellow",colorf::yellow()));
|
||||
add(style_color("greenyellow",colorf::greenyellow()));
|
||||
STYLE_COLORMAP_ADD(blueviolet)
|
||||
STYLE_COLORMAP_ADD(wheat)
|
||||
STYLE_COLORMAP_ADD(white)
|
||||
STYLE_COLORMAP_ADD(yellow)
|
||||
STYLE_COLORMAP_ADD(greenyellow)
|
||||
}
|
||||
#undef STYLE_COLORMAP_ADD
|
||||
};
|
||||
|
||||
class style_ROOT_colormap : public style_colormap {
|
||||
@@ -611,7 +625,6 @@ inline bool find_color(const cmaps_t& a_cmaps,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -9,12 +9,11 @@
|
||||
#include "enums"
|
||||
#include "style_colormap"
|
||||
|
||||
#include "../cstr" //for get_lines
|
||||
#include "../mathf"
|
||||
#include "../lina/vec3f"
|
||||
#include "../sout"
|
||||
|
||||
#include <string>
|
||||
#include "../colorfs"
|
||||
#include "../get_lines"
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
@@ -231,9 +230,9 @@ public:
|
||||
}
|
||||
|
||||
virtual void reset(){ //virtual because of SoGC
|
||||
m_color = colorf::black();
|
||||
m_highlight_color = colorf::lightgrey();
|
||||
m_back_color = colorf::white();
|
||||
m_color = colorf_black();
|
||||
m_highlight_color = colorf_lightgrey();
|
||||
m_back_color = colorf_white();
|
||||
m_line_width = 1;
|
||||
m_marker_size = 1;
|
||||
m_font_size = 10;
|
||||
@@ -871,7 +870,7 @@ public:
|
||||
}
|
||||
std::vector<std::string> words;
|
||||
tools::words(line," ",false,words);
|
||||
unsigned int wordn = words.size();
|
||||
size_t wordn = words.size();
|
||||
if(!wordn) {
|
||||
a_out << "style_parser::parse :"
|
||||
<< " in " << tools::sout(a_s)
|
||||
@@ -1465,9 +1464,9 @@ public:
|
||||
}
|
||||
|
||||
protected:
|
||||
static bool check_2(unsigned int a_n,
|
||||
const std::string& a_s,
|
||||
const std::string& a_line,std::ostream& a_out) {
|
||||
static bool check_2(size_t a_n,
|
||||
const std::string& a_s,
|
||||
const std::string& a_line,std::ostream& a_out) {
|
||||
if(a_n!=2) {
|
||||
a_out << "style_parser::parse :"
|
||||
<< " in " << tools::sout(a_s)
|
||||
@@ -1531,37 +1530,6 @@ protected:
|
||||
return true;
|
||||
}
|
||||
|
||||
static void get_lines(const std::string& a_string,
|
||||
std::vector<std::string>& a_lines){
|
||||
// a_string is a list separated by "\n" or "\\n".
|
||||
// For "xxx\n\nxxx", {"xxx","","xxx"} will be created.
|
||||
// WARNING : if a_string is a Windows file name, it may
|
||||
// contains a \n which is not a delimiter ; like ..\data\ntuples.hbook.
|
||||
a_lines.clear();
|
||||
int length = a_string.length();
|
||||
if(length<=0) return;
|
||||
char* cstring = tools::str_dup(a_string.c_str());
|
||||
if(!cstring) return;
|
||||
int pos = 0;
|
||||
length++;
|
||||
for(int count=0;count<length;count++) {
|
||||
if( (cstring[count]=='\n') ||
|
||||
(cstring[count]=='\0') ||
|
||||
( (cstring[count]=='\\') && (cstring[count+1]=='n') ) ) {
|
||||
char shift_one = (cstring[count]=='\n' ? 1 : 0);
|
||||
cstring[count] = '\0';
|
||||
a_lines.push_back(cstring+pos);
|
||||
if(shift_one==1) {
|
||||
pos = count+1;
|
||||
} else {
|
||||
pos = count+2;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
tools::str_del(cstring);
|
||||
}
|
||||
|
||||
protected:
|
||||
colorf m_color;
|
||||
colorf m_highlight_color;
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
,strings()
|
||||
,confine(false)
|
||||
|
||||
,color(colorf::black())
|
||||
,color(colorf_black())
|
||||
,font(font_hershey())
|
||||
,encoding(encoding_PAW())
|
||||
,line_width(1)
|
||||
|
||||
@@ -60,6 +60,8 @@ namespace sg {
|
||||
|
||||
class text_freetype : public tools::sg::base_freetype {
|
||||
TOOLS_NODE(text_freetype,tools::sg::text_freetype,tools::sg::base_freetype)
|
||||
protected:
|
||||
TOOLS_CLASS_STRING(TOOLS_FONT_PATH)
|
||||
protected:
|
||||
enum wndg_type {
|
||||
wndg_ccw,
|
||||
@@ -72,8 +74,8 @@ protected: //gstos
|
||||
|
||||
{tools_vforcit(line_t,m_lines,it) {
|
||||
const line_t& item = *it;
|
||||
unsigned int pos = item.first;
|
||||
unsigned int num = item.second;
|
||||
size_t pos = item.first;
|
||||
size_t num = item.second;
|
||||
|
||||
if(num<2) {
|
||||
a_out << "tools::sg::text_freetype::create_gsto :"
|
||||
@@ -86,10 +88,10 @@ protected: //gstos
|
||||
|
||||
// data is a line_strip(), convert it to lines.
|
||||
|
||||
unsigned int nsegs = num-1;
|
||||
size_t nsegs = num-1;
|
||||
|
||||
unsigned int ngsto = nsegs*2*3; //3 = have a z (Windows GL).
|
||||
unsigned int sz = gsto_data.size();
|
||||
size_t ngsto = nsegs*2*3; //3 = have a z (Windows GL).
|
||||
size_t sz = gsto_data.size();
|
||||
gsto_data.resize(sz+ngsto);
|
||||
float* pxyz = tools::vec_data<float>(gsto_data)+sz;
|
||||
|
||||
@@ -100,8 +102,8 @@ protected: //gstos
|
||||
|
||||
{tools_vforcit(gl_triangle_t,m_triangles,it) {
|
||||
const std::pair<GLUenum,triangle_t>& item = *it;
|
||||
unsigned int pos = item.second.first;
|
||||
unsigned int num = item.second.second;
|
||||
size_t pos = item.second.first;
|
||||
size_t num = item.second.second;
|
||||
|
||||
if(num<3) {
|
||||
a_out << "tools::sg::text_freetype::create_gsto :"
|
||||
@@ -115,10 +117,10 @@ protected: //gstos
|
||||
|
||||
if((*it).first==tools::gl::triangles()) {
|
||||
|
||||
unsigned int ntri = num/3;
|
||||
size_t ntri = num/3;
|
||||
|
||||
unsigned int ngsto = ntri*3*3;
|
||||
unsigned int sz = gsto_data.size();
|
||||
size_t ngsto = ntri*3*3;
|
||||
size_t sz = gsto_data.size();
|
||||
gsto_data.resize(sz+ngsto);
|
||||
float* pxyz = tools::vec_data<float>(gsto_data)+sz;
|
||||
|
||||
@@ -126,10 +128,10 @@ protected: //gstos
|
||||
|
||||
} else if((*it).first==tools::gl::triangle_fan()) {
|
||||
|
||||
unsigned int ntri = num-2;
|
||||
size_t ntri = num-2;
|
||||
|
||||
unsigned int ngsto = ntri*3*3;
|
||||
unsigned int sz = gsto_data.size();
|
||||
size_t ngsto = ntri*3*3;
|
||||
size_t sz = gsto_data.size();
|
||||
gsto_data.resize(sz+ngsto);
|
||||
float* pxyz = tools::vec_data<float>(gsto_data)+sz;
|
||||
|
||||
@@ -137,10 +139,10 @@ protected: //gstos
|
||||
|
||||
} else if((*it).first==tools::gl::triangle_strip()) {
|
||||
|
||||
unsigned int ntri = num-2;
|
||||
size_t ntri = num-2;
|
||||
|
||||
unsigned int ngsto = ntri*3*3;
|
||||
unsigned int sz = gsto_data.size();
|
||||
size_t ngsto = ntri*3*3;
|
||||
size_t sz = gsto_data.size();
|
||||
gsto_data.resize(sz+ngsto);
|
||||
float* pxyz = tools::vec_data<float>(gsto_data)+sz;
|
||||
|
||||
@@ -182,7 +184,7 @@ public:
|
||||
unsigned int _id = get_gsto_id(a_action.out(),a_action.gl_manager());
|
||||
if(_id) {
|
||||
a_action.begin_gsto(_id);
|
||||
unsigned int sz_tris = m_gsto_sz-m_gsto_lines_sz;
|
||||
size_t sz_tris = m_gsto_sz-m_gsto_lines_sz;
|
||||
if(m_gsto_lines_sz) {
|
||||
a_action.set_line_smooth(true);
|
||||
a_action.draw_gsto_v(tools::gl::lines(),m_gsto_lines_sz/3,0);
|
||||
@@ -217,8 +219,8 @@ public:
|
||||
|
||||
{tools_vforcit(line_t,m_lines,it) {
|
||||
const line_t& item = *it;
|
||||
unsigned int pos = item.first;
|
||||
unsigned int num = item.second;
|
||||
size_t pos = item.first;
|
||||
size_t num = item.second;
|
||||
if(!num) continue;
|
||||
//a_out << "tools::sg::text_freetype::render :"
|
||||
// << " num points " << num
|
||||
@@ -236,8 +238,8 @@ public:
|
||||
///////////////////////////////////////////////////////////
|
||||
{tools_vforcit(gl_triangle_t,m_triangles,it) {
|
||||
const std::pair<GLUenum,triangle_t>& item = *it;
|
||||
unsigned int pos = item.second.first;
|
||||
unsigned int num = item.second.second;
|
||||
size_t pos = item.second.first;
|
||||
size_t num = item.second.second;
|
||||
if(!num) continue;
|
||||
//a_out << "tools::sg::text_freetype::render :"
|
||||
// << " num points " << num
|
||||
@@ -293,8 +295,8 @@ public:
|
||||
|
||||
{tools_vforcit(line_t,m_lines,it) {
|
||||
const line_t& item = *it;
|
||||
unsigned int pos = item.first;
|
||||
unsigned int num = item.second;
|
||||
size_t pos = item.first;
|
||||
size_t num = item.second;
|
||||
const float* data = tools::vec_data<float>(m_xys)+pos;
|
||||
if(a_action.add__line_strip_xy(*this,2*num,data,true)) return;
|
||||
}}
|
||||
@@ -305,8 +307,8 @@ public:
|
||||
///////////////////////////////////////////////////////////
|
||||
{tools_vforcit(gl_triangle_t,m_triangles,it) {
|
||||
const std::pair<GLUenum,triangle_t>& item = *it;
|
||||
unsigned int pos = item.second.first;
|
||||
unsigned int num = item.second.second;
|
||||
size_t pos = item.second.first;
|
||||
size_t num = item.second.second;
|
||||
const float* data = tools::vec_data<float>(m_xys)+pos;
|
||||
if(a_action.add__primitive_xy(*this,item.first,2*num,data,true)) return;
|
||||
}}
|
||||
@@ -321,12 +323,12 @@ public:
|
||||
|
||||
{tools_vforcit(line_t,m_lines,it) {
|
||||
const line_t& item = *it;
|
||||
unsigned int num = item.second;
|
||||
size_t num = item.second;
|
||||
const float* data = tools::vec_data<float>(m_xys)+item.first;
|
||||
|
||||
float px,py,pz;
|
||||
float* pos = (float*)data;
|
||||
for(unsigned int index=0;index<num;index++) {
|
||||
for(size_t index=0;index<num;index++) {
|
||||
px = *pos;pos++;
|
||||
py = *pos;pos++;
|
||||
pz = 0;
|
||||
@@ -340,12 +342,12 @@ public:
|
||||
///////////////////////////////////////////////////////////
|
||||
{tools_vforcit(gl_triangle_t,m_triangles,it) {
|
||||
const std::pair<GLUenum,triangle_t>& item = *it;
|
||||
unsigned int num = item.second.second;
|
||||
size_t num = item.second.second;
|
||||
const float* data = tools::vec_data<float>(m_xys)+item.second.first;
|
||||
|
||||
float px,py,pz;
|
||||
float* pos = (float*)data;
|
||||
for(unsigned int index=0;index<num;index++) {
|
||||
for(size_t index=0;index<num;index++) {
|
||||
px = *pos;pos++;
|
||||
py = *pos;pos++;
|
||||
pz = 0;
|
||||
@@ -567,18 +569,18 @@ protected:
|
||||
|
||||
{tools_vforit(line_t,m_lines,it) {
|
||||
line_t& item = *it;
|
||||
unsigned int pos = item.first;
|
||||
unsigned int npt = item.second;
|
||||
size_t pos = item.first;
|
||||
size_t npt = item.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos+1;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= 0.5F * szy;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= 0.5F * szy;
|
||||
}}
|
||||
|
||||
{tools_vforit(gl_triangle_t,m_triangles,it) {
|
||||
std::pair<GLUenum,triangle_t>& item = *it;
|
||||
unsigned int pos = item.second.first;
|
||||
unsigned int npt = item.second.second;
|
||||
size_t pos = item.second.first;
|
||||
size_t npt = item.second.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos+1;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= 0.5F * szy;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= 0.5F * szy;
|
||||
}}
|
||||
|
||||
} else if(vjust==tools::sg::top) {
|
||||
@@ -589,18 +591,18 @@ protected:
|
||||
|
||||
{tools_vforit(line_t,m_lines,it) {
|
||||
line_t& item = *it;
|
||||
unsigned int pos = item.first;
|
||||
unsigned int npt = item.second;
|
||||
size_t pos = item.first;
|
||||
size_t npt = item.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos+1;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= szy;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= szy;
|
||||
}}
|
||||
|
||||
{tools_vforit(gl_triangle_t,m_triangles,it) {
|
||||
std::pair<GLUenum,triangle_t>& item = *it;
|
||||
unsigned int pos = item.second.first;
|
||||
unsigned int npt = item.second.second;
|
||||
size_t pos = item.second.first;
|
||||
size_t npt = item.second.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos+1;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= szy;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= szy;
|
||||
}}
|
||||
|
||||
}
|
||||
@@ -620,7 +622,7 @@ protected:
|
||||
//a_out << line << std::endl;
|
||||
m_trans_x = 0;
|
||||
m_trans_y = yline;
|
||||
unsigned int ibeg = m_lines.size(); //for hjust.
|
||||
size_t ibeg = m_lines.size(); //for hjust.
|
||||
tools_sforcit(line,it) {
|
||||
if(!char_outline_2_gl(a_out,*it + m_encoding_offset)) return;
|
||||
}
|
||||
@@ -628,22 +630,22 @@ protected:
|
||||
|
||||
{float sx = m_trans_x;
|
||||
if(hjust==tools::sg::center) {
|
||||
unsigned int num = m_lines.size();
|
||||
for(unsigned int index=ibeg;index<num;index++) {
|
||||
size_t num = m_lines.size();
|
||||
for(size_t index=ibeg;index<num;index++) {
|
||||
line_t& item = m_lines[index];
|
||||
unsigned int pos = item.first;
|
||||
unsigned int npt = item.second;
|
||||
size_t pos = item.first;
|
||||
size_t npt = item.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= 0.5F * sx;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= 0.5F * sx;
|
||||
}
|
||||
} else if(hjust==tools::sg::right) {
|
||||
unsigned int num = m_lines.size();
|
||||
for(unsigned int index=ibeg;index<num;index++) {
|
||||
size_t num = m_lines.size();
|
||||
for(size_t index=ibeg;index<num;index++) {
|
||||
line_t& item = m_lines[index];
|
||||
unsigned int pos = item.first;
|
||||
unsigned int npt = item.second;
|
||||
size_t pos = item.first;
|
||||
size_t npt = item.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= sx;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= sx;
|
||||
}
|
||||
}}
|
||||
}
|
||||
@@ -655,7 +657,7 @@ protected:
|
||||
//a_out << line << std::endl;
|
||||
m_trans_x = 0;
|
||||
m_trans_y = yline;
|
||||
unsigned int ibeg = m_lines.size(); //for hjust.
|
||||
size_t ibeg = m_lines.size(); //for hjust.
|
||||
tools_vforcit(unichar,line,it) {
|
||||
if(!char_outline_2_gl(a_out,*it)) return;
|
||||
}
|
||||
@@ -663,22 +665,22 @@ protected:
|
||||
|
||||
{float sx = m_trans_x;
|
||||
if(hjust==tools::sg::center) {
|
||||
unsigned int num = m_lines.size();
|
||||
for(unsigned int index=ibeg;index<num;index++) {
|
||||
size_t num = m_lines.size();
|
||||
for(size_t index=ibeg;index<num;index++) {
|
||||
line_t& item = m_lines[index];
|
||||
unsigned int pos = item.first;
|
||||
unsigned int npt = item.second;
|
||||
size_t pos = item.first;
|
||||
size_t npt = item.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= 0.5F*sx;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= 0.5F*sx;
|
||||
}
|
||||
} else if(hjust==tools::sg::center) {
|
||||
unsigned int num = m_lines.size();
|
||||
for(unsigned int index=ibeg;index<num;index++) {
|
||||
size_t num = m_lines.size();
|
||||
for(size_t index=ibeg;index<num;index++) {
|
||||
line_t& item = m_lines[index];
|
||||
unsigned int pos = item.first;
|
||||
unsigned int npt = item.second;
|
||||
size_t pos = item.first;
|
||||
size_t npt = item.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= sx;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= sx;
|
||||
}
|
||||
}}
|
||||
}
|
||||
@@ -787,7 +789,7 @@ protected:
|
||||
//a_out << line << std::endl;
|
||||
m_trans_x = 0;
|
||||
m_trans_y = yline;
|
||||
unsigned int ibeg = m_triangles.size(); //for hjust.
|
||||
size_t ibeg = m_triangles.size(); //for hjust.
|
||||
tools_sforcit(line,it) {
|
||||
if(!char_triangles_2_gl(a_out,*it + m_encoding_offset)) {
|
||||
::gluDeleteTess(m_tobj);
|
||||
@@ -799,22 +801,22 @@ protected:
|
||||
|
||||
{float sx = m_trans_x;
|
||||
if(hjust==tools::sg::center) {
|
||||
unsigned int num = m_triangles.size();
|
||||
for(unsigned int index=ibeg;index<num;index++) {
|
||||
size_t num = m_triangles.size();
|
||||
for(size_t index=ibeg;index<num;index++) {
|
||||
std::pair<GLUenum,triangle_t>& item = m_triangles[index];
|
||||
unsigned int pos = item.second.first;
|
||||
unsigned int npt = item.second.second;
|
||||
size_t pos = item.second.first;
|
||||
size_t npt = item.second.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= sx*0.5f;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= sx*0.5f;
|
||||
}
|
||||
} else if(hjust==tools::sg::right) {
|
||||
unsigned int num = m_triangles.size();
|
||||
for(unsigned int index=ibeg;index<num;index++) {
|
||||
size_t num = m_triangles.size();
|
||||
for(size_t index=ibeg;index<num;index++) {
|
||||
std::pair<GLUenum,triangle_t>& item = m_triangles[index];
|
||||
unsigned int pos = item.second.first;
|
||||
unsigned int npt = item.second.second;
|
||||
size_t pos = item.second.first;
|
||||
size_t npt = item.second.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= sx;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= sx;
|
||||
}
|
||||
}}
|
||||
}
|
||||
@@ -825,7 +827,7 @@ protected:
|
||||
//a_out << line << std::endl;
|
||||
m_trans_x = 0;
|
||||
m_trans_y = yline;
|
||||
unsigned int ibeg = m_triangles.size(); //for hjust.
|
||||
size_t ibeg = m_triangles.size(); //for hjust.
|
||||
tools_vforcit(unichar,line,it) {
|
||||
if(!char_triangles_2_gl(a_out,*it)) {
|
||||
::gluDeleteTess(m_tobj);
|
||||
@@ -837,22 +839,22 @@ protected:
|
||||
|
||||
{float sx = m_trans_x;
|
||||
if(hjust==tools::sg::center) {
|
||||
unsigned int num = m_triangles.size();
|
||||
for(unsigned int index=ibeg;index<num;index++) {
|
||||
size_t num = m_triangles.size();
|
||||
for(size_t index=ibeg;index<num;index++) {
|
||||
std::pair<GLUenum,triangle_t>& item = m_triangles[index];
|
||||
unsigned int pos = item.second.first;
|
||||
unsigned int npt = item.second.second;
|
||||
size_t pos = item.second.first;
|
||||
size_t npt = item.second.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= sx*0.5f;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= sx*0.5f;
|
||||
}
|
||||
} else if(hjust==tools::sg::right) {
|
||||
unsigned int num = m_triangles.size();
|
||||
for(unsigned int index=ibeg;index<num;index++) {
|
||||
size_t num = m_triangles.size();
|
||||
for(size_t index=ibeg;index<num;index++) {
|
||||
std::pair<GLUenum,triangle_t>& item = m_triangles[index];
|
||||
unsigned int pos = item.second.first;
|
||||
unsigned int npt = item.second.second;
|
||||
size_t pos = item.second.first;
|
||||
size_t npt = item.second.second;
|
||||
float* data = tools::vec_data<float>(m_xys)+pos;
|
||||
for(unsigned int i=0;i<npt;i++,data+=2) *data -= sx;
|
||||
for(size_t i=0;i<npt;i++,data+=2) *data -= sx;
|
||||
}
|
||||
}}
|
||||
}
|
||||
@@ -1313,8 +1315,8 @@ protected:
|
||||
|
||||
float gx,gy;
|
||||
|
||||
unsigned int num = self.m_steps - 1;
|
||||
for(unsigned int i=0;i<num;i++) {
|
||||
size_t num = self.m_steps - 1;
|
||||
for(size_t i=0;i<num;i++) {
|
||||
fromx += dfx;
|
||||
fromy += dfy;
|
||||
|
||||
@@ -1413,8 +1415,8 @@ protected:
|
||||
// from = starting point.
|
||||
float gx,gy;
|
||||
|
||||
unsigned int num = self.m_steps - 1;
|
||||
for(unsigned int i=0;i<num;i++) {
|
||||
size_t num = self.m_steps - 1;
|
||||
for(size_t i=0;i<num;i++) {
|
||||
fromx += dfx;
|
||||
fromy += dfy;
|
||||
|
||||
@@ -1541,13 +1543,17 @@ protected:
|
||||
return;
|
||||
}
|
||||
std::string file;
|
||||
if(!tools::find_with_path(a_out,"TOOLS_FONT_PATH",font.value(),file)) {
|
||||
a_out << "tools::sg::text_freetype::load_face :"
|
||||
<< " font file not found for font "
|
||||
<< tools::sout(font.value()) << "."
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
//if(tools::file::exists(font.value())) { //look in current directory.
|
||||
// file = font.value(); //ok
|
||||
//} else if(!inlib::find_with_dirs(a_out,font_dirs.values(),font.value(),file,false)) {
|
||||
if(!tools::find_with_env(a_out,s_TOOLS_FONT_PATH(),font.value(),file,false)) {
|
||||
a_out << "tools::sg::text_freetype::load_face :"
|
||||
<< " font file not found for font "
|
||||
<< tools::sout(font.value()) << "."
|
||||
<< std::endl;
|
||||
return;
|
||||
}
|
||||
//}
|
||||
|
||||
if(m_verbose) {
|
||||
a_out << "tools::sg::text_freetype::load_face :"
|
||||
@@ -1887,7 +1893,7 @@ protected:
|
||||
float m_last_x,m_last_y;
|
||||
float m_scale;
|
||||
float m_trans_x,m_trans_y;
|
||||
unsigned int m_steps;
|
||||
size_t m_steps;
|
||||
float m_delta;
|
||||
float m_delta2;
|
||||
float m_delta3;
|
||||
@@ -1896,7 +1902,7 @@ protected:
|
||||
////////////////////////////////////////////////////////
|
||||
/// outline lines //////////////////////////////////////
|
||||
////////////////////////////////////////////////////////
|
||||
typedef std::pair<unsigned int,unsigned int> line_t; //pos in m_xys.
|
||||
typedef std::pair<size_t,size_t> line_t; //pos in m_xys.
|
||||
typedef std::vector<line_t> lines_t;
|
||||
lines_t m_lines;
|
||||
////////////////////////////////////////////////////////
|
||||
@@ -1905,23 +1911,21 @@ protected:
|
||||
GLUtesselator* m_tobj;
|
||||
bool m_contour_open;
|
||||
std::vector<double*> m_glutess_trids;
|
||||
unsigned int m_glutess_trids_num;
|
||||
size_t m_glutess_trids_num;
|
||||
std::vector<double*> m_combine_trids;
|
||||
unsigned int m_combine_trids_num;
|
||||
size_t m_combine_trids_num;
|
||||
GLUenum m_mode;
|
||||
typedef std::pair<unsigned int,unsigned int> triangle_t; //pos in m_xys.
|
||||
typedef std::pair<size_t,size_t> triangle_t; //pos in m_xys.
|
||||
typedef std::pair<GLUenum,triangle_t> gl_triangle_t;
|
||||
typedef std::vector<gl_triangle_t> triangles_t;
|
||||
triangles_t m_triangles;
|
||||
size_t m_pos;
|
||||
unsigned int m_gsto_lines_sz;
|
||||
unsigned int m_gsto_sz;
|
||||
size_t m_gsto_lines_sz;
|
||||
size_t m_gsto_sz;
|
||||
wndg_type m_wndg;
|
||||
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
//exlib_build_use inlib freetype inlib_glutess
|
||||
|
||||
#endif
|
||||
|
||||
@@ -105,13 +105,13 @@ protected: //gstos
|
||||
virtual unsigned int create_gsto(std::ostream&,sg::gl_manager& a_mgr) {
|
||||
std::vector<float> gsto_data;
|
||||
|
||||
{unsigned int npts = m_segs.size()/2; //2 coords
|
||||
unsigned int ngsto = npts*3; //3 coords.
|
||||
unsigned int sz = gsto_data.size();
|
||||
{size_t npts = m_segs.size()/2; //2 coords
|
||||
size_t ngsto = npts*3; //3 coords.
|
||||
size_t sz = gsto_data.size();
|
||||
gsto_data.resize(sz+ngsto);
|
||||
float* pxyz = tools::vec_data<float>(gsto_data)+sz;
|
||||
const float* data = tools::vec_data<float>(m_segs);
|
||||
tools::gl::cvt_2to3(npts,data,pxyz);}
|
||||
float* pxyz = vec_data<float>(gsto_data)+sz;
|
||||
const float* data = vec_data<float>(m_segs);
|
||||
gl::cvt_2to3(npts,data,pxyz);}
|
||||
|
||||
m_gsto_sz = gsto_data.size();
|
||||
|
||||
@@ -130,7 +130,7 @@ public:
|
||||
unsigned int _id = get_gsto_id(a_action.out(),a_action.gl_manager());
|
||||
if(_id) {
|
||||
a_action.begin_gsto(_id);
|
||||
a_action.draw_gsto_v(tools::gl::lines(),m_gsto_sz/3,0);
|
||||
a_action.draw_gsto_v(gl::lines(),m_gsto_sz/3,0);
|
||||
a_action.end_gsto();
|
||||
return;
|
||||
|
||||
@@ -143,7 +143,7 @@ public:
|
||||
}
|
||||
|
||||
// immediate rendering :
|
||||
a_action.draw_vertex_array_xy(tools::gl::lines(),m_segs);
|
||||
a_action.draw_vertex_array_xy(gl::lines(),m_segs);
|
||||
}
|
||||
|
||||
virtual void pick(pick_action& a_action) {
|
||||
@@ -254,7 +254,7 @@ public:
|
||||
a_mx_y = HEIGHT;
|
||||
a_mx_z = 0;
|
||||
} else {
|
||||
tools::box_3f_make_empty(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z);
|
||||
box_3f_make_empty(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -367,11 +367,11 @@ protected:
|
||||
float cwidth;
|
||||
int number;
|
||||
if (a_font==sg::greek) {
|
||||
tools::hershey::greek_char_points(*it,a_height,number,max_point,xp,yp,cwidth);
|
||||
hershey::greek_char_points(*it,a_height,number,max_point,xp,yp,cwidth);
|
||||
} else if (a_font==sg::special) {
|
||||
tools::hershey::special_char_points(*it,a_height,number,max_point,xp,yp,cwidth);
|
||||
hershey::special_char_points(*it,a_height,number,max_point,xp,yp,cwidth);
|
||||
} else {
|
||||
tools::hershey::latin_char_points(*it,a_height,number,max_point,xp,yp,cwidth);
|
||||
hershey::latin_char_points(*it,a_height,number,max_point,xp,yp,cwidth);
|
||||
}
|
||||
|
||||
float advance = cwidth + a_height * 0.01F;
|
||||
@@ -389,7 +389,7 @@ protected:
|
||||
float a_scale,bool a_bar,
|
||||
float& a_mn_x,float& a_mn_y,float& a_mn_z,
|
||||
float& a_mx_x,float& a_mx_y,float& a_mx_z){
|
||||
tools::box_3f_make_empty(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z);
|
||||
box_3f_make_empty(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z);
|
||||
|
||||
const unsigned int mx_poly = 4;
|
||||
const unsigned int mx_point = 160;
|
||||
@@ -401,11 +401,11 @@ protected:
|
||||
int number;
|
||||
float width;
|
||||
if (a_font==sg::greek) {
|
||||
tools::hershey::greek_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
hershey::greek_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
} else if (a_font==sg::special) {
|
||||
tools::hershey::special_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
hershey::special_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
} else {
|
||||
tools::hershey::latin_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
hershey::latin_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
}
|
||||
|
||||
float ymax = 0;
|
||||
@@ -416,12 +416,10 @@ protected:
|
||||
if(pointn>0) {
|
||||
for(int count=0;count<pointn-1;count++) {
|
||||
ymax = tools::mx(ymax,yp[ipoint]);
|
||||
tools::box_3f_extend_by(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z,
|
||||
xp[ipoint],yp[ipoint],0);
|
||||
box_3f_extend_by(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z,xp[ipoint],yp[ipoint],0);
|
||||
|
||||
ymax = tools::mx(ymax,yp[ipoint+1]);
|
||||
tools::box_3f_extend_by(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z,
|
||||
xp[ipoint+1],yp[ipoint+1],0);
|
||||
box_3f_extend_by(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z,xp[ipoint+1],yp[ipoint+1],0);
|
||||
|
||||
ipoint ++;
|
||||
}
|
||||
@@ -432,10 +430,8 @@ protected:
|
||||
if(a_bar) { //Draw a bar on top of the character.
|
||||
float xbar = 0;
|
||||
float ybar = ymax * 1.3F;
|
||||
tools::box_3f_extend_by(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z,
|
||||
xbar,ybar,0);
|
||||
tools::box_3f_extend_by(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z,
|
||||
xbar+width,ybar,0);
|
||||
box_3f_extend_by(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z,xbar,ybar,0);
|
||||
box_3f_extend_by(a_mn_x,a_mn_y,a_mn_z,a_mx_x,a_mx_y,a_mx_z,xbar+width,ybar,0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -510,11 +506,11 @@ protected:
|
||||
int number;
|
||||
float width;
|
||||
if (a_font==sg::greek) {
|
||||
tools::hershey::greek_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
hershey::greek_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
} else if (a_font==sg::special) {
|
||||
tools::hershey::special_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
hershey::special_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
} else {
|
||||
tools::hershey::latin_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
hershey::latin_char_points(a_char,a_scale,number,max_point,xp,yp,width);
|
||||
}
|
||||
if(!aGEN_POINTS) return width;
|
||||
|
||||
@@ -689,7 +685,7 @@ protected:
|
||||
|
||||
protected:
|
||||
std::vector<float> m_segs; //list of [begin,end]
|
||||
unsigned int m_gsto_sz;
|
||||
size_t m_gsto_sz;
|
||||
};
|
||||
|
||||
}}
|
||||
|
||||
@@ -107,8 +107,8 @@ public:
|
||||
text_style()
|
||||
:parent()
|
||||
,visible(true)
|
||||
,color(colorf::black())
|
||||
,back_color(colorf::white())
|
||||
,color(colorf_black())
|
||||
,back_color(colorf_white())
|
||||
,back_shadow(0)
|
||||
,modeling()
|
||||
,font(font_hershey())
|
||||
|
||||
@@ -39,8 +39,8 @@ inline void add_string(
|
||||
vec3f Y = a_Y;
|
||||
X.normalize();
|
||||
Y.normalize();
|
||||
vec3f Z = X.cross(Y);
|
||||
Y = Z.cross (X);
|
||||
vec3f Z;X.cross(Y,Z);
|
||||
Z.cross(X,Y);
|
||||
mat4f r(X.v0(),Y.v0(),Z.v0(),0, //first row
|
||||
X.v1(),Y.v1(),Z.v1(),0,
|
||||
X.v2(),Y.v2(),Z.v2(),0,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "sf_vec"
|
||||
#include "render_action"
|
||||
|
||||
#include "../colorf"
|
||||
#include "../colorfs"
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
@@ -18,8 +18,8 @@ namespace sg {
|
||||
class torche : public node {
|
||||
TOOLS_NODE(torche,tools::sg::torche,node)
|
||||
public:
|
||||
sf_vec<tools::colorf,float> color;
|
||||
sf_vec<tools::vec3f,float> direction;
|
||||
sf_vec<colorf,float> color;
|
||||
sf_vec<vec3f,float> direction;
|
||||
sf<bool> on;
|
||||
public:
|
||||
virtual const std::vector<field_desc>& node_fields() const {
|
||||
@@ -60,8 +60,8 @@ public:
|
||||
public:
|
||||
torche()
|
||||
:parent()
|
||||
,color(tools::colorf::white())
|
||||
,direction(tools::vec3f(0,0,-1))
|
||||
,color(colorf_white())
|
||||
,direction(vec3f(0,0,-1))
|
||||
,on(true)
|
||||
{
|
||||
add_fields();
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#include "render_action"
|
||||
#include "pick_action"
|
||||
#include "bbox_action"
|
||||
#include "visible_action"
|
||||
|
||||
namespace tools {
|
||||
namespace sg {
|
||||
@@ -54,19 +55,22 @@ public:
|
||||
virtual void bbox(bbox_action& a_action) {
|
||||
a_action.add_points(xyzs.values());
|
||||
}
|
||||
virtual void is_visible(visible_action& a_action) {
|
||||
if(_is_visible(a_action)) a_action.increment();
|
||||
}
|
||||
|
||||
public:
|
||||
vertices()
|
||||
:parent()
|
||||
,mode(tools::gl::line_strip()){
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
add_fields();
|
||||
}
|
||||
virtual ~vertices(){
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::decrement(s_class().c_str());
|
||||
mem::decrement(s_class().c_str());
|
||||
#endif
|
||||
}
|
||||
public:
|
||||
@@ -76,7 +80,7 @@ public:
|
||||
,xyzs(a_from.xyzs)
|
||||
{
|
||||
#ifdef TOOLS_MEM
|
||||
tools::mem::increment(s_class().c_str());
|
||||
mem::increment(s_class().c_str());
|
||||
#endif
|
||||
add_fields();
|
||||
}
|
||||
@@ -100,7 +104,7 @@ public:
|
||||
xyzs.add(a_y);
|
||||
xyzs.add(a_z);
|
||||
}
|
||||
void add_allocated(unsigned int& a_pos,float a_x,float a_y,float a_z) {
|
||||
void add_allocated(size_t& a_pos,float a_x,float a_y,float a_z) {
|
||||
std::vector<float>& v = xyzs.values();
|
||||
v[a_pos] = a_x;a_pos++;
|
||||
v[a_pos] = a_y;a_pos++;
|
||||
@@ -120,8 +124,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
*/
|
||||
//unsigned int size() const {return xyzs.size();}
|
||||
unsigned int number() const {return xyzs.size()/3;}
|
||||
size_t number() const {return xyzs.size()/3;}
|
||||
void clear() {xyzs.clear();}
|
||||
|
||||
bool add_dashed_line(float a_bx,float a_by,float a_bz,
|
||||
@@ -151,7 +154,22 @@ public:
|
||||
py += two_sy;
|
||||
pz += two_sz;
|
||||
}
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
protected:
|
||||
bool _is_visible(const matrix_action& a_action) {
|
||||
if(xyzs.empty()) return false;
|
||||
const state& _state = a_action.state();
|
||||
pick_action action(a_action.out(),_state.m_ww,_state.m_wh,0,float(_state.m_ww),0,float(_state.m_wh));
|
||||
action.set_win_size(_state.m_ww,_state.m_wh);
|
||||
action.set_area(0,float(_state.m_ww),0,float(_state.m_wh));
|
||||
action.set_stop_at_first(true);
|
||||
action.matrix_action::operator=(a_action); //IMPORTANT.
|
||||
int old_cur = action.cur(); //not 0.
|
||||
action.add__primitive(*this,mode.value(),xyzs.values(),true);
|
||||
if(action.cur()!=old_cur) return false;
|
||||
if(!action.node()) return false;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user