[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [12110] trunk/blender/source/blender/src/ retopo.c: == Retopo ==
Nicholas Bishop
nicholasbishop at gmail.com
Sun Sep 23 08:02:58 CEST 2007
Revision: 12110
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=12110
Author: nicholasbishop
Date: 2007-09-23 08:02:58 +0200 (Sun, 23 Sep 2007)
Log Message:
-----------
== Retopo ==
Changed some of the retopo functions to use doubles instead of shorts; this makes the transformation more accurate if the view is zoomed out far enough to have multiple vertices appear at the same pixel location.
Modified Paths:
--------------
trunk/blender/source/blender/src/retopo.c
Modified: trunk/blender/source/blender/src/retopo.c
===================================================================
--- trunk/blender/source/blender/src/retopo.c 2007-09-22 19:28:36 UTC (rev 12109)
+++ trunk/blender/source/blender/src/retopo.c 2007-09-23 06:02:58 UTC (rev 12110)
@@ -85,7 +85,7 @@
float where;
} RetopoPaintHit;
-void retopo_do_2d(View3D *v3d, short proj[2], float *v, char adj);
+void retopo_do_2d(View3D *v3d, double proj[2], float *v, char adj);
void retopo_paint_debug_print(RetopoPaintData *rpd);
/* Painting */
@@ -295,7 +295,8 @@
for(i=0; i<hitcount; ++i) {
RetopoPaintPoint *intersection= BLI_findlink(&rpd->intersections,i);
- retopo_do_2d(rpd->paint_v3d,&intersection->loc.x, hitco, 1);
+ double proj[2] = {intersection->loc.x, intersection->loc.y};
+ retopo_do_2d(rpd->paint_v3d, proj, hitco, 1);
intersection->eve= addvertlist(hitco, NULL);
intersection->eve->f= SELECT;
}
@@ -320,12 +321,16 @@
void add_rppoint(RetopoPaintLine *l, short x, short y)
{
RetopoPaintPoint *p= MEM_callocN(sizeof(RetopoPaintPoint),"RetopoPaintPoint");
+ double proj[2];
p->loc.x= x;
p->loc.y= y;
BLI_addtail(&l->points,p);
p->index= p->prev?p->prev->index+1:0;
- retopo_do_2d(G.editMesh->retopo_paint_data->paint_v3d, &p->loc.x, p->co, 1);
+ proj[0] = p->loc.x;
+ proj[1] = p->loc.y;
+
+ retopo_do_2d(G.editMesh->retopo_paint_data->paint_v3d, proj, p->co, 1);
}
RetopoPaintLine *add_rpline(RetopoPaintData *rpd)
{
@@ -749,13 +754,13 @@
allqueue(REDRAWVIEW3D, 0);
}
-void retopo_do_2d(View3D *v3d, short proj[2], float *v, char adj)
+void retopo_do_2d(View3D *v3d, double proj[2], float *v, char adj)
{
/* Check to make sure vert is visible in window */
if(proj[0]>0 && proj[1]>0 && proj[0] < v3d->depths->w && proj[1] < v3d->depths->h) {
- float depth= v3d->depths->depths[(int)(proj[1]*v3d->depths->w+proj[0])];
+ float depth= v3d->depths->depths[((int)proj[1])*v3d->depths->w+((int)proj[0])];
double px, py, pz;
-
+
/* Don't modify the point if it'll be mapped to the background */
if(depth==v3d->depths->depth_range[1]) {
if(adj) {
@@ -781,14 +786,11 @@
void retopo_do_vert(View3D *v3d, float *v)
{
- short proj[2];
- double px, py, pz;
+ double proj[3];
/* Find 2D location (project) */
gluProject(v[0],v[1],v[2],v3d->retopo_view_data->mats.modelview,v3d->retopo_view_data->mats.projection,
- (GLint *)v3d->retopo_view_data->mats.viewport,&px,&py,&pz);
- proj[0]= px;
- proj[1]= py;
+ (GLint *)v3d->retopo_view_data->mats.viewport,&proj[0],&proj[1],&proj[2]);
retopo_do_2d(v3d,proj,v,0);
}
More information about the Bf-blender-cvs
mailing list