added tank model

This commit is contained in:
zzzzrrr 2009-08-11 14:11:30 -04:00
parent 0e71a0a3fd
commit 8ce22caf63
3 changed files with 67 additions and 4 deletions

55
data/tank.dat Normal file
View File

@ -0,0 +1,55 @@
-37.317758 260.65677
-37.317758 317.44301
-34.741139 339.73612
-27.330761 354.21222
59.525828 406.25724
444.17643 404.87856
538.9604 368.68832
555.15984 355.59089
558.95121 344.90615
559.64054 325.94936
568.19908 315.85885
572.586 322.56108
584.65003 322.31737
568.80837 296.11771
557.59736 289.78104
539.56224 286.49085
443.31476 286.82943
389.89106 280.79772
405.74583 272.00866
412.98388 262.01326
475.5413 262.1856
480.71134 267.01096
514.66123 266.66629
520.34827 262.01326
669.93463 262.01326
670.45162 264.08127
676.91417 263.82277
678.03434 262.09943
680.61936 261.66859
683.03204 255.46455
682.51504 249.94985
677.862 243.91814
668.81445 243.4873
665.28159 247.02016
520.86527 246.33082
514.66123 240.12678
479.67733 239.95444
475.5413 243.57347
412.98388 243.05647
397.64611 227.54636
324.74862 221.16998
323.88695 214.79361
328.36764 211.86392
326.6443 207.03856
300.79412 207.03856
295.62409 211.69159
285.28402 208.2449
272.01426 211.17458
96.577738 209.62357
80.205961 211.86392
58.491817 232.7164
74.863594 254.94755
168.61356 269.25131
175.16228 276.83403
87.271676 260.11758

View File

@ -85,8 +85,9 @@ class Poly2TriDemo extends BasicGame("Poly2Tri") {
val star = "data/star.dat" val star = "data/star.dat"
val strange = "data/strange.dat" val strange = "data/strange.dat"
val i18 = "data/i.18" val i18 = "data/i.18"
val tank = "data/tank.dat"
var currentModel = i18 var currentModel = tank
var doCDT = true var doCDT = true
var mouseButton = 0 var mouseButton = 0
@ -273,6 +274,7 @@ class Poly2TriDemo extends BasicGame("Poly2Tri") {
if(c == '5') selectModel(star) if(c == '5') selectModel(star)
if(c == '6') selectModel(i18) if(c == '6') selectModel(i18)
if(c == '7') selectModel(nazcaHeron) if(c == '7') selectModel(nazcaHeron)
if(c == '8') selectModel(tank)
if(c == 's') drawSegs = !drawSegs if(c == 's') drawSegs = !drawSegs
if(c == 'c') drawcdtMesh = !drawcdtMesh if(c == 'c') drawcdtMesh = !drawcdtMesh
if(c == 'e') {drawEarClip = !drawEarClip; drawCDT = false; selectModel(currentModel)} if(c == 'e') {drawEarClip = !drawEarClip; drawCDT = false; selectModel(currentModel)}
@ -308,6 +310,11 @@ class Poly2TriDemo extends BasicGame("Poly2Tri") {
doCDT = false; drawCDT = false; drawcdtMesh = false doCDT = false; drawCDT = false; drawcdtMesh = false
//CDT.clearPoint = 7 //CDT.clearPoint = 7
loadModel(nazcaHeron, 4.5f, Point(400f, 300f), 1500) loadModel(nazcaHeron, 4.5f, Point(400f, 300f), 1500)
case "data/tank.dat" =>
//doCDT = false; drawCDT = false; drawcdtMesh = false
doCDT = true; drawCDT = true
CDT.clearPoint = 50
loadModel(tank, -1f, Point(0f, 0f), 10)
case _ => case _ =>
assert(false) assert(false)
} }

View File

@ -44,7 +44,7 @@ object CDT {
// Inital triangle factor // Inital triangle factor
val ALPHA = 0.3f val ALPHA = 0.3f
val SHEER = 0.00001f val SHEER = 0.001f
var clearPoint = 0 var clearPoint = 0
@ -439,6 +439,7 @@ class CDT(val points: List[Point], val segments: List[Segment], iTriangle: Trian
val t2 = node.triangle val t2 = node.triangle
val point = t1.points(0) val point = t1.points(0)
/*
val oPoint = t2 oppositePoint t1 val oPoint = t2 oppositePoint t1
// Try to avoid creating degenerate triangles // Try to avoid creating degenerate triangles
@ -467,13 +468,13 @@ class CDT(val points: List[Point], val segments: List[Segment], iTriangle: Trian
aFront.insertLegalized(t1.points(1), t1, node) aFront.insertLegalized(t1.points(1), t1, node)
} else { } else {
*/
// Update neighbor // Update neighbor
t2.markNeighbor(t1) t2.markNeighbor(t1)
// Update advancing front // Update advancing front
aFront.insert(point, t1, node) aFront.insert(point, t1, node)
} //}
} }