RepDistDash.cpp (pymol-v2.1.0.tar.bz2) | : | RepDistDash.cpp (pymol-open-source-2.2.0) | ||
---|---|---|---|---|
skipping to change at line 34 | skipping to change at line 34 | |||
#include"RepDistDash.h" | #include"RepDistDash.h" | |||
#include"Color.h" | #include"Color.h" | |||
#include"Scene.h" | #include"Scene.h" | |||
#include"main.h" | #include"main.h" | |||
#include"Vector.h" | #include"Vector.h" | |||
#include"Setting.h" | #include"Setting.h" | |||
#include"PyMOLObject.h" | #include"PyMOLObject.h" | |||
#include"CGO.h" | #include"CGO.h" | |||
#include"ShaderMgr.h" | #include"ShaderMgr.h" | |||
#include"CoordSet.h" | #include"CoordSet.h" | |||
#ifdef _WEBGL | ||||
#include "WebPyMOLLibrary.h" | ||||
#endif | ||||
typedef struct RepDistDash { | typedef struct RepDistDash { | |||
Rep R; | Rep R; | |||
float *V; | float *V; | |||
int N; | int N; | |||
CObject *Obj; | CObject *Obj; | |||
DistSet *ds; | DistSet *ds; | |||
float linewidth, radius; | float linewidth, radius; | |||
CGO *shaderCGO; | CGO *shaderCGO; | |||
bool shaderCGO_has_cylinders, shaderCGO_has_trilines; | ||||
} RepDistDash; | } RepDistDash; | |||
#include"ObjectDist.h" | #include"ObjectDist.h" | |||
void RepDistDashFree(RepDistDash * I); | void RepDistDashFree(RepDistDash * I); | |||
void RepDistDashFree(RepDistDash * I) | void RepDistDashFree(RepDistDash * I) | |||
{ | { | |||
if (I->shaderCGO){ | if (I->shaderCGO){ | |||
CGOFree(I->shaderCGO); | CGOFree(I->shaderCGO); | |||
I->shaderCGO = 0; | I->shaderCGO = 0; | |||
} | } | |||
VLAFreeP(I->V); | VLAFreeP(I->V); | |||
RepPurge(&I->R); | RepPurge(&I->R); | |||
OOFreeP(I); | OOFreeP(I); | |||
} | } | |||
/* Has no prototype */ | ||||
static void RepDistDashCGOGenerate(RepDistDash * I) | ||||
{ | ||||
int ok = true; | ||||
PyMOLGlobals *G = I->R.G; | ||||
float *v = I->V; | ||||
int c = I->N; | ||||
int color = | ||||
SettingGet_color(G, NULL, I->ds->Obj->Obj.Setting, cSetting_dash_color); | ||||
short dash_as_cylinders = 0; | ||||
dash_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && Set | ||||
tingGetGlobal_b(G, cSetting_dash_as_cylinders); | ||||
if (ok) | ||||
ok &= CGOSpecial(I->shaderCGO, LINEWIDTH_DYNAMIC_WITH_SCALE_DASH); | ||||
if (ok) | ||||
ok &= CGOResetNormal(I->shaderCGO, true); | ||||
if (ok){ | ||||
if(color >= 0){ | ||||
ok &= CGOColorv(I->shaderCGO, ColorGet(G, color)); | ||||
} else if (I->Obj && I->Obj->Color >= 0){ | ||||
ok &= CGOColorv(I->shaderCGO, ColorGet(G, I->Obj->Color)); | ||||
} | ||||
} | ||||
v = I->V; | ||||
c = I->N; | ||||
if (dash_as_cylinders){ | ||||
float *origin = NULL, axis[3]; | ||||
while(ok && c > 0) { | ||||
origin = v; | ||||
v += 3; | ||||
axis[0] = v[0] - origin[0]; | ||||
axis[1] = v[1] - origin[1]; | ||||
axis[2] = v[2] - origin[2]; | ||||
v += 3; | ||||
ok &= (bool)I->shaderCGO->add<cgo::draw::shadercylinder>(origin, axis, 1.f | ||||
, 15); | ||||
c -= 2; | ||||
} | ||||
} else { | ||||
ok &= CGOBegin(I->shaderCGO, GL_LINES); | ||||
while(ok && c > 0) { | ||||
ok &= CGOVertexv(I->shaderCGO, v); | ||||
v += 3; | ||||
if (ok) | ||||
ok &= CGOVertexv(I->shaderCGO, v); | ||||
v += 3; | ||||
c -= 2; | ||||
} | ||||
if (ok) | ||||
ok &= CGOEnd(I->shaderCGO); | ||||
} | ||||
} | ||||
static void RepDistDashRender(RepDistDash * I, RenderInfo * info) | static void RepDistDashRender(RepDistDash * I, RenderInfo * info) | |||
{ | { | |||
CRay *ray = info->ray; | CRay *ray = info->ray; | |||
Picking **pick = info->pick; | Picking **pick = info->pick; | |||
PyMOLGlobals *G = I->R.G; | PyMOLGlobals *G = I->R.G; | |||
float *v = I->V; | float *v = I->V; | |||
int c = I->N; | int c = I->N; | |||
float *vc; | const float *vc; | |||
int round_ends; | int round_ends; | |||
int ok = true; | int ok = true; | |||
int color = | int color = | |||
SettingGet_color(G, NULL, I->ds->Obj->Obj.Setting, cSetting_dash_color); | SettingGet_color(G, NULL, I->ds->Obj->Obj.Setting, cSetting_dash_color); | |||
float line_width = | float line_width = | |||
SettingGet_f(G, NULL, I->ds->Obj->Obj.Setting, cSetting_dash_width); | SettingGet_f(G, NULL, I->ds->Obj->Obj.Setting, cSetting_dash_width); | |||
float dash_transparency = | ||||
SettingGet_f(G, NULL, I->ds->Obj->Obj.Setting, cSetting_dash_transparency); | ||||
bool t_mode_3 = | ||||
SettingGet_i(G, NULL, I->ds->Obj->Obj.Setting, cSetting_transparency_mode) = | ||||
= 3; | ||||
short dash_transparency_enabled; | ||||
dash_transparency = (dash_transparency < 0.f ? 0.f : (dash_transparency > 1.f | ||||
? 1.f : dash_transparency)); | ||||
dash_transparency_enabled = (dash_transparency > 0.f); | ||||
if (!(ray || pick) && (!info->pass || (info->pass > 0) == dash_transparency_en | ||||
abled)) | ||||
return; | ||||
if(color < 0) | ||||
color = I->Obj->Color; | ||||
I->radius = | I->radius = | |||
SettingGet_f(G, NULL, I->ds->Obj->Obj.Setting, cSetting_dash_radius); | SettingGet_f(G, NULL, I->ds->Obj->Obj.Setting, cSetting_dash_radius); | |||
round_ends = | round_ends = | |||
SettingGet_b(G, NULL, I->ds->Obj->Obj.Setting, cSetting_dash_round_ends); | SettingGet_b(G, NULL, I->ds->Obj->Obj.Setting, cSetting_dash_round_ends); | |||
line_width = SceneGetDynamicLineWidth(info, line_width); | line_width = SceneGetDynamicLineWidth(info, line_width); | |||
if(ray) { | if(ray) { | |||
float radius; | float radius; | |||
if (dash_transparency_enabled){ | ||||
ray->transparentf(dash_transparency); | ||||
} | ||||
if(I->radius <= 0.0F) { | if(I->radius <= 0.0F) { | |||
radius = ray->PixelRadius * line_width / 2.0F; | radius = ray->PixelRadius * line_width / 2.0F; | |||
} else { | } else { | |||
radius = I->radius; | radius = I->radius; | |||
} | } | |||
if(color < 0) | ||||
color = I->Obj->Color; | ||||
vc = ColorGet(G, color); | vc = ColorGet(G, color); | |||
v = I->V; | v = I->V; | |||
c = I->N; | c = I->N; | |||
while(ok && c > 0) { | while(ok && c > 0) { | |||
/* printf("%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f \n",v[3],v[4],v[5],v [6],v[7],v[8]); */ | /* printf("%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f \n",v[3],v[4],v[5],v [6],v[7],v[8]); */ | |||
if(round_ends) { | if(round_ends) { | |||
ok &= ray->sausage3fv(v, v + 3, radius, vc, vc); | ok &= ray->sausage3fv(v, v + 3, radius, vc, vc); | |||
} else { | } else { | |||
ok &= ray->customCylinder3fv(v, v + 3, radius, vc, vc, cCylCapFlat, cCyl CapFlat); | ok &= ray->customCylinder3fv(v, v + 3, radius, vc, vc, cCylCapFlat, cCyl CapFlat); | |||
} | } | |||
v += 6; | v += 6; | |||
c -= 2; | c -= 2; | |||
} | } | |||
} else if(G->HaveGUI && G->ValidContext) { | } else if(G->HaveGUI && G->ValidContext) { | |||
if(pick) { | if(pick) { | |||
} else { | } else { | |||
short use_shader, generate_shader_cgo = 0, dash_as_cylinders = 0; | short use_shader, generate_shader_cgo = 0, dash_as_cylinders = 0; | |||
use_shader = SettingGetGlobal_b(G, cSetting_dash_use_shader) & | use_shader = SettingGetGlobal_b(G, cSetting_dash_use_shader) & | |||
SettingGetGlobal_b(G, cSetting_use_shaders); | SettingGetGlobal_b(G, cSetting_use_shaders); | |||
dash_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_dash_as_cylinders); | dash_as_cylinders = SettingGetGlobal_b(G, cSetting_render_as_cylinders) && SettingGetGlobal_b(G, cSetting_dash_as_cylinders); | |||
if (!GET_FRAGDEPTH_SUPPORT() && dash_as_cylinders) | ||||
dash_as_cylinders = false; | ||||
if (!use_shader && I->shaderCGO){ | if (!use_shader && I->shaderCGO){ | |||
CGOFree(I->shaderCGO); | CGOFree(I->shaderCGO); | |||
I->shaderCGO = 0; | I->shaderCGO = 0; | |||
} | } | |||
if (I->shaderCGO && (dash_as_cylinders ^ I->shaderCGO->has_draw_cylinder_b | if (I->shaderCGO && (dash_as_cylinders ^ I->shaderCGO_has_cylinders)){ | |||
uffers)){ | CGOFree(I->shaderCGO); | |||
I->shaderCGO = 0; | ||||
} | ||||
if (I->shaderCGO && !dash_as_cylinders && I->shaderCGO_has_trilines != Set | ||||
tingGetGlobal_b(G, cSetting_trilines)){ | ||||
CGOFree(I->shaderCGO); | CGOFree(I->shaderCGO); | |||
I->shaderCGO = 0; | I->shaderCGO = 0; | |||
} | } | |||
if (use_shader){ | if (use_shader){ | |||
if (!I->shaderCGO){ | if (!I->shaderCGO){ | |||
I->shaderCGO = CGONew(G); | I->shaderCGO = CGONew(G); | |||
CHECKOK(ok, I->shaderCGO); | CHECKOK(ok, I->shaderCGO); | |||
if (ok) | if (ok) | |||
I->shaderCGO->use_shader = true; | I->shaderCGO->use_shader = true; | |||
generate_shader_cgo = 1; | generate_shader_cgo = 1; | |||
} else if (ok) { | if (dash_transparency_enabled){ | |||
CShaderPrg *shaderPrg; | CGOAlpha(I->shaderCGO, 1.f-dash_transparency); | |||
if (dash_as_cylinders){ | ||||
float pixel_scale_value = SettingGetGlobal_f(G, cSetting_ray_pixel_sc | ||||
ale); | ||||
if(pixel_scale_value < 0) | ||||
pixel_scale_value = 1.0F; | ||||
shaderPrg = CShaderPrg_Enable_CylinderShader(G); | ||||
if(I->radius == 0.0F) { | ||||
CShaderPrg_Set1f(shaderPrg, "uni_radius", info->vertex_scale * pixe | ||||
l_scale_value * line_width/ 2.f); | ||||
} else { | ||||
CShaderPrg_Set1f(shaderPrg, "uni_radius", I->radius); | ||||
} | ||||
if (!round_ends){ | ||||
CShaderPrg_Set1f(shaderPrg, "no_flat_caps", 0.f); | ||||
} | ||||
} else { | ||||
shaderPrg = CShaderPrg_Enable_DefaultShader(G); | ||||
CShaderPrg_SetLightingEnabled(shaderPrg, 0); | ||||
} | } | |||
if (!shaderPrg) return; | RepDistDashCGOGenerate(I); | |||
} else if (ok) { | ||||
CGORenderGL(I->shaderCGO, NULL, NULL, NULL, info, &I->R); | CGORenderGL(I->shaderCGO, NULL, NULL, NULL, info, &I->R); | |||
CShaderPrg_Disable(shaderPrg); | ||||
return; | return; | |||
} | } | |||
} | } | |||
#ifndef PURE_OPENGL_ES_2 | ||||
if (generate_shader_cgo){ | if (!generate_shader_cgo) { | |||
if (ok) | ||||
ok &= CGOLinewidthSpecial(I->shaderCGO, LINEWIDTH_DYNAMIC_WITH_SCALE_DA | ||||
SH); | ||||
if (ok) | ||||
ok &= CGOResetNormal(I->shaderCGO, true); | ||||
} else { | ||||
if(info->width_scale_flag) { | if(info->width_scale_flag) { | |||
glLineWidth(line_width * info->width_scale); | glLineWidth(line_width * info->width_scale); | |||
} else { | } else { | |||
glLineWidth(line_width); | glLineWidth(line_width); | |||
} | } | |||
SceneResetNormal(G, true); | SceneResetNormal(G, true); | |||
} | } | |||
if (generate_shader_cgo){ | { | |||
if (ok){ | ||||
if(color >= 0){ | ||||
ok &= CGOColorv(I->shaderCGO, ColorGet(G, color)); | ||||
} else if (I->Obj && I->Obj->Color >= 0){ | ||||
ok &= CGOColorv(I->shaderCGO, ColorGet(G, I->Obj->Color)); | ||||
} | ||||
} | ||||
v = I->V; | ||||
c = I->N; | ||||
if (dash_as_cylinders){ | ||||
float *origin = NULL, axis[3]; | ||||
while(ok && c > 0) { | ||||
origin = v; | ||||
v += 3; | ||||
axis[0] = v[0] - origin[0]; | ||||
axis[1] = v[1] - origin[1]; | ||||
axis[2] = v[2] - origin[2]; | ||||
v += 3; | ||||
ok &= CGOShaderCylinder(I->shaderCGO, origin, axis, 1.f, 15); | ||||
c -= 2; | ||||
} | ||||
} else { | ||||
ok &= CGOBegin(I->shaderCGO, GL_LINES); | ||||
while(ok && c > 0) { | ||||
ok &= CGOVertexv(I->shaderCGO, v); | ||||
v += 3; | ||||
if (ok) | ||||
ok &= CGOVertexv(I->shaderCGO, v); | ||||
v += 3; | ||||
c -= 2; | ||||
} | ||||
if (ok) | ||||
ok &= CGOEnd(I->shaderCGO); | ||||
} | ||||
} else { | ||||
if(color >= 0){ | if(color >= 0){ | |||
glColor3fv(ColorGet(G, color)); | if (dash_transparency_enabled){ | |||
const float *col = ColorGet(G, color); | ||||
glColor4f(col[0], col[1], col[2], 1.f-dash_transparency); | ||||
} else { | ||||
glColor3fv(ColorGet(G, color)); | ||||
} | ||||
} else if (dash_transparency_enabled){ | ||||
float col[4]; | ||||
copy3f(ColorGet(I->Obj->G, I->Obj->Color), col); | ||||
col[3] = 1.f-dash_transparency; | ||||
glColor4fv(col); | ||||
} | } | |||
v = I->V; | v = I->V; | |||
c = I->N; | c = I->N; | |||
if (dash_transparency_enabled && !t_mode_3) | ||||
glDisable(GL_DEPTH_TEST); | ||||
if(!info->line_lighting) | if(!info->line_lighting) | |||
glDisable(GL_LIGHTING); | glDisable(GL_LIGHTING); | |||
glBegin(GL_LINES); | glBegin(GL_LINES); | |||
while(c > 0) { | while(c > 0) { | |||
glVertex3fv(v); | glVertex3fv(v); | |||
v += 3; | v += 3; | |||
glVertex3fv(v); | glVertex3fv(v); | |||
v += 3; | v += 3; | |||
c -= 2; | c -= 2; | |||
} | } | |||
glEnd(); | glEnd(); | |||
glEnable(GL_LIGHTING); | glEnable(GL_LIGHTING); | |||
if (dash_transparency_enabled && !t_mode_3) | ||||
glEnable(GL_DEPTH_TEST); | ||||
} | } | |||
#endif | ||||
if (use_shader) { | if (use_shader) { | |||
if (generate_shader_cgo){ | if (generate_shader_cgo){ | |||
CGO *convertcgo = NULL; | CGO *convertcgo = NULL; | |||
if (ok) | if (ok) | |||
ok &= CGOStop(I->shaderCGO); | ok &= CGOStop(I->shaderCGO); | |||
{ | ||||
bool trilines = SettingGetGlobal_b(G, cSetting_trilines); | ||||
if (dash_as_cylinders || !trilines) { | ||||
if (ok) | if (ok) | |||
convertcgo = CGOCombineBeginEnd(I->shaderCGO, 0); | convertcgo = CGOCombineBeginEnd(I->shaderCGO, 0); | |||
CHECKOK(ok, convertcgo); | CHECKOK(ok, convertcgo); | |||
CGOFree(I->shaderCGO); | CGOFree(I->shaderCGO); | |||
I->shaderCGO = convertcgo; | I->shaderCGO = convertcgo; | |||
convertcgo = NULL; | convertcgo = NULL; | |||
} | ||||
if (ok){ | if (ok){ | |||
if (dash_as_cylinders){ | if (dash_as_cylinders){ | |||
convertcgo = CGOOptimizeGLSLCylindersToVBOIndexed(I->shaderCGO, 0); | CGO *tmpCGO = CGONew(G); | |||
} else { | if (ok) ok &= CGOEnable(tmpCGO, GL_CYLINDER_SHADER); | |||
convertcgo = CGOOptimizeToVBONotIndexed(I->shaderCGO, 0); | if (ok) ok &= CGOSpecial(tmpCGO, CYLINDER_WIDTH_FOR_DISTANCES); | |||
convertcgo = CGOConvertShaderCylindersToCylinderShader(I->shaderC | ||||
GO, tmpCGO); | ||||
if (ok) ok &= CGOEnable(tmpCGO, GL_DASH_TRANSPARENCY_DEPTH_TEST); | ||||
if (ok) ok &= CGOAppendNoStop(tmpCGO, convertcgo); | ||||
if (ok) ok &= CGODisable(tmpCGO, GL_DASH_TRANSPARENCY_DEPTH_TEST) | ||||
; | ||||
if (ok) ok &= CGODisable(tmpCGO, GL_CYLINDER_SHADER); | ||||
if (ok) ok &= CGOStop(tmpCGO); | ||||
CGOFreeWithoutVBOs(convertcgo); | ||||
convertcgo = tmpCGO; | ||||
I->shaderCGO_has_cylinders = true; | ||||
I->shaderCGO_has_trilines = false; | ||||
} else { | ||||
CGO *tmpCGO = CGONew(G); | ||||
int shader = trilines ? GL_TRILINES_SHADER : GL_DEFAULT_SHADER; | ||||
if (ok) ok &= CGOEnable(tmpCGO, shader); | ||||
if (ok) ok &= CGODisable(tmpCGO, CGO_GL_LIGHTING); | ||||
if (trilines) { | ||||
if (ok) ok &= CGOSpecial(tmpCGO, LINEWIDTH_DYNAMIC_WITH_SCALE_ | ||||
DASH); | ||||
convertcgo = CGOConvertLinesToTrilines(I->shaderCGO, false); | ||||
} else { | ||||
convertcgo = CGOOptimizeToVBONotIndexedNoShader(I->shaderCGO, 0 | ||||
); | ||||
} | ||||
I->shaderCGO_has_trilines = trilines; | ||||
if (ok) ok &= CGOEnable(tmpCGO, GL_DASH_TRANSPARENCY_DEPTH_TEST); | ||||
if (ok) ok &= CGOAppendNoStop(tmpCGO, convertcgo); | ||||
if (ok) ok &= CGODisable(tmpCGO, GL_DASH_TRANSPARENCY_DEPTH_TEST) | ||||
; | ||||
if (ok) ok &= CGODisable(tmpCGO, shader); | ||||
if (ok) ok &= CGOStop(tmpCGO); | ||||
CGOFreeWithoutVBOs(convertcgo); | ||||
convertcgo = tmpCGO; | ||||
I->shaderCGO_has_cylinders = false; | ||||
} | ||||
convertcgo->use_shader = true; | ||||
} | } | |||
CHECKOK(ok, convertcgo); | ||||
} | } | |||
if (convertcgo){ | if (convertcgo){ | |||
CGOFree(I->shaderCGO); | CGOFree(I->shaderCGO); | |||
I->shaderCGO = convertcgo; | I->shaderCGO = convertcgo; | |||
convertcgo = NULL; | convertcgo = NULL; | |||
} | } | |||
} | } | |||
if (ok) { | if (ok) { | |||
CShaderPrg *shaderPrg; | ||||
if (dash_as_cylinders){ | ||||
float pixel_scale_value = SettingGetGlobal_f(G, cSetting_ray_pixel_sc | ||||
ale); | ||||
if(pixel_scale_value < 0) | ||||
pixel_scale_value = 1.0F; | ||||
shaderPrg = CShaderPrg_Enable_CylinderShader(G); | ||||
if(I->radius == 0.0F) { | ||||
CShaderPrg_Set1f(shaderPrg, "uni_radius", info->vertex_scale * pixe | ||||
l_scale_value * line_width/ 2.f); | ||||
} else { | ||||
CShaderPrg_Set1f(shaderPrg, "uni_radius", I->radius); | ||||
} | ||||
if (!round_ends){ | ||||
CShaderPrg_Set1f(shaderPrg, "no_flat_caps", 0.f); | ||||
} | ||||
} else { | ||||
shaderPrg = CShaderPrg_Enable_DefaultShader(G); | ||||
CShaderPrg_SetLightingEnabled(shaderPrg, 0); | ||||
} | ||||
if (!shaderPrg) | ||||
return; | ||||
CGORenderGL(I->shaderCGO, NULL, NULL, NULL, info, &I->R); | CGORenderGL(I->shaderCGO, NULL, NULL, NULL, info, &I->R); | |||
CShaderPrg_Disable(shaderPrg); | ||||
} | } | |||
} | } | |||
} | } | |||
} | } | |||
if (!ok){ | if (!ok){ | |||
CGOFree(I->shaderCGO); | CGOFree(I->shaderCGO); | |||
I->ds->Rep[cRepDash] = NULL; | I->ds->Rep[cRepDash] = NULL; | |||
RepDistDashFree(I); | RepDistDashFree(I); | |||
} | } | |||
} | } | |||
Rep *RepDistDashNew(DistSet * ds, int state) | Rep *RepDistDashNew(DistSet * ds, int state) | |||
{ | { | |||
PyMOLGlobals *G = ds->State.G; | PyMOLGlobals *G = ds->State.G; | |||
int a; | int a; | |||
int n; | int n; | |||
float *v, *v1, *v2, d[3], d1[3]; | float *v, *v1, *v2, d[3]; | |||
float l; | float l; | |||
float dash_len, dash_gap, dash_sum; | float dash_len, dash_gap, dash_sum; | |||
int ok = true; | int ok = true; | |||
OOAlloc(G, RepDistDash); | OOAlloc(G, RepDistDash); | |||
CHECKOK(ok, I); | CHECKOK(ok, I); | |||
if(!ok || !ds->NIndex) { | if(!ok || !ds->NIndex) { | |||
OOFreeP(I); | OOFreeP(I); | |||
return (NULL); | return (NULL); | |||
skipping to change at line 322 | skipping to change at line 365 | |||
I->R.fRecolor = NULL; | I->R.fRecolor = NULL; | |||
I->R.obj = &ds->Obj->Obj; | I->R.obj = &ds->Obj->Obj; | |||
I->R.context.state = state; | I->R.context.state = state; | |||
dash_len = SettingGet_f(G, NULL, ds->Obj->Obj.Setting, cSetting_dash_length); | dash_len = SettingGet_f(G, NULL, ds->Obj->Obj.Setting, cSetting_dash_length); | |||
dash_gap = SettingGet_f(G, NULL, ds->Obj->Obj.Setting, cSetting_dash_gap); | dash_gap = SettingGet_f(G, NULL, ds->Obj->Obj.Setting, cSetting_dash_gap); | |||
dash_sum = dash_len + dash_gap; | dash_sum = dash_len + dash_gap; | |||
if(dash_sum < R_SMALL4) | if(dash_sum < R_SMALL4) | |||
dash_sum = 0.5; | dash_sum = 0.5; | |||
I->shaderCGO = 0; | I->shaderCGO = 0; | |||
I->shaderCGO_has_cylinders = false; | ||||
I->shaderCGO_has_trilines = false; | ||||
I->N = 0; | I->N = 0; | |||
I->V = NULL; | I->V = NULL; | |||
I->R.P = NULL; | I->R.P = NULL; | |||
I->Obj = (CObject *) ds->Obj; | I->Obj = (CObject *) ds->Obj; | |||
I->ds = ds; | I->ds = ds; | |||
n = 0; | n = 0; | |||
if(ds->NIndex) { | if(ds->NIndex) { | |||
I->V = VLAlloc(float, ds->NIndex * 10); | I->V = VLAlloc(float, ds->NIndex * 10); | |||
CHECKOK(ok, I->V); | CHECKOK(ok, I->V); | |||
skipping to change at line 343 | skipping to change at line 388 | |||
v1 = ds->Coord + 3 * a; | v1 = ds->Coord + 3 * a; | |||
v2 = ds->Coord + 3 * (a + 1); | v2 = ds->Coord + 3 * (a + 1); | |||
/* vector from v2->v1 */ | /* vector from v2->v1 */ | |||
subtract3f(v2, v1, d); | subtract3f(v2, v1, d); | |||
l = (float) length3f(d); | l = (float) length3f(d); | |||
if(l > R_SMALL4) { | if(l > R_SMALL4) { | |||
copy3f(v1, d1); | ||||
/* this makes d the direction vector of the distance measure from v2->v1 */ | /* this makes d the direction vector of the distance measure from v2->v1 */ | |||
normalize3f(d); | normalize3f(d); | |||
if(dash_gap > R_SMALL4) { | if(dash_gap > R_SMALL4) { | |||
float avg[3], proj1[3], proj2[3]; | float avg[3], proj1[3], proj2[3]; | |||
float l_left = l / 2.0F; | float l_left = l / 2.0F; | |||
float l_used = 0.0F; | float l_used = 0.0F; | |||
float half_dash_gap = dash_gap * 0.5; | float half_dash_gap = dash_gap * 0.5; | |||
average3f(v1, v2, avg); | average3f(v1, v2, avg); | |||
End of changes. 28 change blocks. | ||||
108 lines changed or deleted | 157 lines changed or added |