Browse Source

fixing sample and completing sample code

Ashwini Jha 5 years ago
parent
commit
cce60420c7

+ 211 - 0
samples/navigation/main.py

@@ -0,0 +1,211 @@
+from direct.showbase.ShowBase import ShowBase
+from panda3d.core import Plane, Vec3, Point3, CardMaker, MouseButton
+from direct.task import Task
+from direct.actor.Actor import Actor
+from direct.interval.IntervalGlobal import Sequence
+from panda3d import navigation
+from panda3d import navmeshgen
+from panda3d.core import PointLight,DirectionalLight
+from panda3d.core import LPoint3
+from panda3d.core import PTA_LVecBase3
+from panda3d.core import LVecBase3
+from direct.actor.Actor import Actor
+from panda3d.core import LineSegs
+from panda3d.core import NodePath
+import math
+import time
+
+
+class MyApp(ShowBase):
+
+    def __init__(self):
+        ShowBase.__init__(self)
+
+
+        # Setting up light for better view.
+        plight = PointLight('plight')
+        plight.setColor((0.9, 0.9, 0.9, 0.5))
+        plnp = render.attachNewNode(plight)
+        plnp.setPos(10, 20, 0)
+        render.setLight(plnp)
+        dlight = DirectionalLight('dlight')
+        dlight.setColor((0.8, 0.5, 0.5, 1))
+        dlnp = render.attachNewNode(dlight)
+        dlnp.setHpr(0, -60, 0)
+        render.setLight(dlnp)
+
+        # Loading the model
+        self.scene = self.loader.loadModel("village.obj")
+        self.scene.reparentTo(self.render)
+        self.scene.setP(90)
+        
+        self.scene.setScale(0.25, 0.25, 0.25)
+        self.scene.flatten_light()
+        self.scene.setPos(-8, 42, 0)
+        
+        #mouseclick
+        #self.disableMouse()
+        self.camera.setPos(0, 60, 500)
+        self.camera.lookAt(0, 0, 0)
+        z = 0
+        self.plane = Plane(Vec3(0, 0, 1), Point3(0, 0, z))
+        # self.model = loader.loadModel("jack")
+        # self.model.reparentTo(render)
+        cm = CardMaker("blah")
+        cm.setFrame(-100, 100, -100, 100)
+        #self.scene.attachNewNode(cm.generate()).lookAt(0, 0, -1)
+        taskMgr.add(self.__getMousePos, "_YourClass__getMousePos")
+        #mouseclick end 
+
+
+        #Here start commenting
+        #NavMeshBuilder is a class that is responsible for building the polygon meshes and navigation meshes.
+        self.builder = navmeshgen.NavMeshBuilder()
+        self.structBuilder = navmeshgen.BuildSettings()
+        self.structBuilder.cell_size = 1;
+        # Take Nodepath as input. Nodepath should contain the required geometry.
+        self.builder.fromNodePath(self.scene)
+
+        #self.builder.setActorRadius(5)
+        self.builder.set_actor_height(10)
+        self.navmesh = self.builder.build()
+
+        # Code to attach the polymesh generated to the scene graph
+        self.node1 = self.navmesh.drawNavMeshGeom()
+        # self.node = self.scene.attachNewNode(self.node1)
+        # self.node.setColor(0,0,1)
+        
+        self.navmeshnode = navigation.NavMeshNode("firstnavmeshnode",self.navmesh)
+        self.navmeshnodepath = self.scene.attachNewNode(self.navmeshnode)
+        print("writing BAM")
+        #self.navmeshnodepath.write_bam_file("firstnavmeshnode.bam")
+
+
+        # print("start read")
+        #self.navmesh = loader.loadModel("firstnavmeshnode.bam")
+        #print(type(self.navmesh))
+        self.tempActor = Actor("models/panda", {"walk" : "models/panda-walk"})
+        self.tempActor.reparentTo(self.scene)
+        
+        # print(type(self.navmesh.node().getNavMesh()))
+        # self.node1 = self.navmesh.node().drawNavMeshGeom()
+        # self.node = self.scene.attachNewNode(self.node1)
+        # self.node.setColor(0,0,1)
+        
+        
+
+        self.pos1 = self.tempActor.getPos()
+        self.pos2 = self.pos1
+        self.query = navigation.NavMeshQuery(self.navmesh)
+        
+        # #self.query.setNavQuery(self.navmesh)
+        self.query.nearestPoint(self.pos1)
+        # print(pos1)
+        self.tempActor.setPos(self.pos1)
+
+        self.tempActor2 = Actor("models/panda", {"walk" : "models/panda-walk"})
+        self.tempActor2.reparentTo(self.scene)
+
+        # Load and transform the panda actor.
+        self.pandaActor = Actor("models/panda-model",
+                                {"walk": "models/panda-walk4"})
+        self.pandaActor.setScale(0.01, 0.01, 0.01)
+        self.pandaActor.reparentTo(self.scene)
+        self.pandaActor.loop("walk")
+        
+        self.pandaSequence = Sequence()
+        self.pandaSequence.start()
+
+        self.lineNodePath = NodePath()
+        self.lineNodePath2 = NodePath()
+
+    def __getMousePos(self,task):
+        if base.mouseWatcherNode.hasMouse() and base.mouseWatcherNode.isButtonDown(MouseButton.one()):
+            mpos = base.mouseWatcherNode.getMouse()
+            pos3d = Point3()
+            nearPoint = Point3()
+            farPoint = Point3()
+            base.camLens.extrude(mpos, nearPoint, farPoint)
+            if self.plane.intersectsLine(pos3d,
+                self.scene.getRelativePoint(camera, nearPoint),
+                self.scene.getRelativePoint(camera, farPoint)):
+                #print("Mouse ray intersects ground plane at ", pos3d)
+                #print("pos2 ", self.pos2)
+                if abs(self.pos2[0]-pos3d[0]) < 1:
+                    #print("not running", self.pos2[0]-pos3d[0])
+                    return task.again
+                #print("running it")
+                self.pos2 = pos3d
+                
+                self.pos1 = self.pandaActor.get_pos()
+                self.pandaSequence.finish()
+                
+                self.query.nearestPoint(self.pos2)
+                # print(pos2)
+                self.tempActor2.setPos(self.pos2)
+                path = self.query.findPath(self.pos1, self.pos2);
+                print("path.size(): ", len(path));
+                self.pathLine = LineSegs()
+                #self.pathLine.reset()
+                self.pathLine.setColor(0,1,0)
+                self.pathLine.setThickness(5)
+
+                self.pathLine2 = LineSegs()
+                #self.pathLine2.reset()
+                self.pathLine2.setColor(1,1,0)
+                self.pathLine2.setThickness(5)
+
+                
+                for i in range(len(path)):
+                    self.pathLine.drawTo(path[i])
+
+                self.pathLine.drawTo(self.pos2)
+                self.lineNode = self.pathLine.create()
+                self.lineNodePath.remove_node()
+                #self.lineNodePath = NodePath()
+                self.lineNodePath = self.scene.attachNewNode(self.lineNode)
+                self.lineNodePath.setZ(1)
+
+                path = self.query.findStraightPath(self.pos1, self.pos2, 0);
+                print("path.size(): ", len(path));
+
+                
+                for i in range(len(path)):
+                    self.pathLine2.drawTo(path[i])
+
+                
+                self.lineNode2 = self.pathLine2.create()
+                self.lineNodePath2.remove_node()
+                #self.lineNodePath2 = NodePath()
+                self.lineNodePath2 = self.scene.attachNewNode(self.lineNode2)
+                self.lineNodePath2.setZ(2)
+                
+                self.pandaSequence = Sequence()
+                current_dir = self.pandaActor.get_hpr()
+                for i in range(len(path)-1):
+                    print(i, path[i], path[i+1])
+                    vec = [ path[i+1][0] - path[i][0] , path[i+1][1] - path[i][1] ]
+                    cosval = -1 * vec[1] / math.sqrt( vec[0]**2 + vec[1]**2 )
+                    theta = math.acos(cosval) * 180/math.pi
+                    if vec[0] < 0:
+                        theta = 360 - theta
+                    new_dir = LPoint3(theta, current_dir[1], current_dir[2])
+                    rotate_speed = 90
+                    #rotate_time = abs(theta-current_dir[0])/rotate_speed
+                    rotate_time = 0
+                    self.pandaSequence.append(self.pandaActor.hprInterval(rotate_time, new_dir, current_dir))
+
+                    speed = 6
+                    dist = math.dist(path[i+1],path[i])
+                    print(dist)
+                    self.pandaSequence.append(self.pandaActor.posInterval(dist/speed, path[i+1], path[i]))
+                    current_dir = new_dir
+
+                self.pandaSequence.start()
+                self.pos1 = self.pos2
+        return task.again
+
+
+
+app = MyApp()
+app.run()

+ 598 - 0
samples/navigation/models/village.mtl

@@ -0,0 +1,598 @@
+# Blender MTL File: 'None'
+# Material Count: 56
+
+newmtl BrownWood
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.266234 0.141210 0.034344
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl Kamien_1
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.785714 0.777056 0.759740
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl Kamien_3
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.510204 0.505144 0.484905
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl Kamien_4
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.316327 0.311621 0.292798
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl Objects.001
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl Texture-base
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl YellowCloth
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 1.000000 0.736779 0.218000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl barrel
+Ns 6.902690
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmpwxlx6vgh
+
+newmtl black.006
+Ns 0.000000
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmpr8h7b2_o
+
+newmtl blue.001
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl brown
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmp7llh1md9
+
+newmtl brown.002
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmpmyfvpdqf
+
+newmtl brown.004
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmptbv63j7j
+
+newmtl brown.007
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmp_a7nkx6s
+
+newmtl brown.008
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmpwmdmn4s0
+
+newmtl color
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl dirt
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl dirt_0
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl dirtroad
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Bump -bm 0.135861 /tmp/tmpkmxqeg0v
+map_Kd /tmp/tmpld6bbn9v
+
+newmtl dkbrown.001
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl grass
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Bump -bm 0.038300 /tmp/tmps6mik9bh
+map_Kd /tmp/tmpfgwrpxqe
+
+newmtl gray
+Ns 6.902690
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmp6spxroo5
+
+newmtl gray.001
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl gray.002
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl gray.003
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl gray.007
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl lambert1
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.487175 0.476081 0.449531
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl lambert2SG.001_0
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl lambert2SG.001_1
+Ns 27.896870
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmp1kdy744y
+
+newmtl lambert2SG.001_2
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl lambert2SG.001_3
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl lambert2SG.001_4
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl lambert2SG.001_5
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl lambert2SG.001_6
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl lambert2SG.001_7
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl litblue
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl ltgray.003
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl medievalfantasyforest_unwrap
+Ns 0.000000
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmps5rvgqc3
+
+newmtl schingle
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Bump -bm 0.343178 /tmp/tmp6u4xroa4
+map_Kd /tmp/tmpbmf1y7cg
+
+newmtl skincolr
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl slope_mat
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl smlstone
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Bump -bm 0.087081 /tmp/tmpp5gbt_eo
+map_Kd /tmp/tmp7nid32hz
+
+newmtl smlstone.001
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Bump -bm 0.099276 /tmp/tmp_jyx4d5r
+map_Kd /tmp/tmp1eg5b55t
+
+newmtl stairs
+Ns 0.024849
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmp822mibnh
+
+newmtl stone
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Bump -bm 0.221227 /tmp/tmpvcnzcer6
+map_Kd /tmp/tmp3tm7h1lc
+
+newmtl topbottom
+Ns 6.902690
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmphmpxuoge
+
+newmtl trubrown.001
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl well_material_1
+Ns 0.000000
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmp1603jxpw
+
+newmtl well_material_2
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2
+
+newmtl wood
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Bump -bm 0.349276 /tmp/tmpns7oos2_
+map_Kd /tmp/tmp3t5zzeiz
+
+newmtl wood.002
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Bump /tmp/tmphy_pqsnr
+map_Kd /tmp/tmp9rhqfv52
+
+newmtl wood.003
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Bump /tmp/tmpogr6dr_3
+map_Kd /tmp/tmpsfhtzfop
+
+newmtl wood.004
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Bump /tmp/tmp7pezj8hb
+map_Kd /tmp/tmpfp0lg04v
+
+newmtl wood.007
+Ns 3.006811
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Kd /tmp/tmpfhifcgsy
+
+newmtl wood.008
+Ns 3.537095
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.450000
+d 1.000000
+illum 2
+map_Bump /tmp/tmplcl38yny
+map_Kd /tmp/tmpx2_3hpjp
+
+newmtl yellow
+Ns 323.999994
+Ka 1.000000 1.000000 1.000000
+Kd 0.800000 0.800000 0.800000
+Ks 0.500000 0.500000 0.500000
+Ke 0.000000 0.000000 0.000000
+Ni 1.000000
+d 1.000000
+illum 2

BIN
samples/navigation/models/village.obj.pz


+ 0 - 46
samples/street-navigation/main.py

@@ -1,46 +0,0 @@
-from direct.showbase.ShowBase import ShowBase
-from panda3d import navigation
-from panda3d.core import PointLight,DirectionalLight
-
-class MyApp(ShowBase):
-
-    def __init__(self):
-        ShowBase.__init__(self)
-
-        # Setting up light for better view.
-        plight = PointLight('plight')
-        plight.setColor((20, 0.9, 0.9, 1))
-        plnp = render.attachNewNode(plight)
-        plnp.setPos(10, 20, 0)
-        render.setLight(plnp)
-        dlight = DirectionalLight('dlight')
-        dlight.setColor((0.8, 0.5, 0.5, 1))
-        dlnp = render.attachNewNode(dlight)
-        dlnp.setHpr(0, -60, 0)
-        render.setLight(dlnp)
-
-        # Loading the model
-        self.scene = self.loader.loadModel("models/street.obj")
-        self.scene.reparentTo(self.render)
-        self.scene.setP(90)
-        self.scene.flatten_light()
-        self.scene.setScale(0.25, 0.25, 0.25)
-        self.scene.setPos(-8, 42, 0)
-
-        # NavMeshBuilder is a class that is responsible for building the polygon meshes and navigation meshes.
-        self.builder = navigation.NavMeshBuilder()
-        # Take Nodepath as input. Nodepath should contain the required geometry.
-        self.builder.fromNodePath(self.scene)
-
-        self.builder.build()
-
-        # Code to attach the polymesh generated to the scene graph
-        self.node1 = self.builder.drawPolyMeshGeom()
-        self.node = self.scene.attachNewNode(self.node1)
-        self.node.setColor(0,0,1)
-        
-        
-
-
-app = MyApp()
-app.run()

+ 0 - 22
samples/street-navigation/models/street.mtl

@@ -1,22 +0,0 @@
-# Blender MTL File: 'None'
-# Material Count: 2
-
-newmtl Material
-Ns 323.999994
-Ka 1.000000 1.000000 1.000000
-Kd 0.800000 0.800000 0.800000
-Ks 0.500000 0.500000 0.500000
-Ke 0.000000 0.000000 0.000000
-Ni 1.450000
-d 1.000000
-illum 2
-
-newmtl None
-Ns 225.000000
-Ka 1.000000 1.000000 1.000000
-Kd 0.800000 0.800000 0.800000
-Ks 0.500000 0.500000 0.500000
-Ke 0.000000 0.000000 0.000000
-Ni 1.450000
-d 1.000000
-illum 2

BIN
samples/street-navigation/models/street.obj.pz