Skip to content
Snippets Groups Projects
Commit fb0c2084 authored by Ansgar Philippsen's avatar Ansgar Philippsen
Browse files

tweaked non-tube trace rendering

parent 591242f5
Branches
Tags
No related merge requests found
...@@ -452,12 +452,14 @@ void CartoonRenderer::RebuildSplineObj(IndexedVertexArray& va, ...@@ -452,12 +452,14 @@ void CartoonRenderer::RebuildSplineObj(IndexedVertexArray& va,
double psized=static_cast<double>(psize); double psized=static_cast<double>(psize);
float of=static_cast<float>(psize)/(2.0*M_PI); float of=static_cast<float>(psize)/(2.0*M_PI);
for (; sc<slist.size(); ++sc) { for (; sc<slist.size(); ++sc) {
//double dd=geom::Dot(slist.at(sc-1).normal,slist.at(sc).normal); size_t offset=0;
geom::Vec3 dir=slist.at(sc).position-slist.at(sc-1).position; if(slist.at(sc).type==0) {
double ang=-geom::SignedAngle(geom::Cross(slist.at(sc-1).normal,dir), geom::Vec3 dir=slist.at(sc).position-slist.at(sc-1).position;
geom::Cross(slist.at(sc).normal,dir), double ang=-geom::SignedAngle(geom::Cross(slist.at(sc-1).normal,dir),
dir); geom::Cross(slist.at(sc).normal,dir),
size_t offset=psize+static_cast<size_t>(round(ang*of)+psized); dir);
offset=psize+static_cast<size_t>(round(ang*of)+psized);
}
if(slist.at(sc).type==3) { if(slist.at(sc).type==3) {
if(slist.at(sc-1).type!=3) { if(slist.at(sc-1).type!=3) {
// boundary to arrow // boundary to arrow
...@@ -718,9 +720,10 @@ namespace { ...@@ -718,9 +720,10 @@ namespace {
for(unsigned int i=0;i<d4;++i) { for(unsigned int i=0;i<d4;++i) {
unsigned int p1=(d4+i-1)%d4; unsigned int p1=(d4+i-1)%d4;
unsigned int p2=(i+1)%d4; unsigned int p2=(i+1)%d4;
float dx=prof[p2].v[0]-prof[p1].v[0]; float f1=geom::Length2(prof[p1].v-prof[i].v);
float dy=prof[p2].v[1]-prof[p1].v[1]; float f2=geom::Length2(prof[p2].v-prof[i].v);
prof[i].n=geom::Normalize(geom::Vec3(dy,-dx,0.0)); geom::Vec3 s = f2*(prof[p2].v-prof[i].v)-f1*(prof[p1].v-prof[i].v);
prof[i].n=geom::Normalize(geom::Vec3(s[1],-s[0],0.0));
} }
return prof; return prof;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment