# Path: src/simulator/panda3d/camera/panda_ptz_camera.py
# class PandaPTZCamera(PandaCamera):
# 
#     def __init__(self, buffer, camera, camera_model):
#         PandaCamera.__init__(self, buffer, camera, camera_model)
#         self.zoom_motor = Motor(self, "setFov")
#         self.pan_motor = Motor(self, "setPan")
#         self.tilt_motor = Motor(self, "setTilt")
#         self.reset()
#         
#     def zoomIn(self, angle=10, time=1.0):
#         current = self.getFov()
#         new = current - angle
#         self.zoom_motor.newValue(current, new, time)
#         
#         
#     def zoomOut(self, angle=10, time=1.0):
#         current = self.getFov()
#         new = current + angle
#         self.zoom_motor.newValue(current, new, time)
#         
#         
#     def panLeft(self, angle=10, time=1.0):
#         current = self.getPan()
#         new = current - angle
#         self.pan_motor.newValue(current, new, time)
#         
#         
#     def panRight(self, angle=10, time=1.0):
#         current = self.getPan()
#         new = current + angle
#         self.pan_motor.newValue(current, new, time)
#         
#         
#     def tiltUp(self, angle=10, time=1.0):
#         current = self.getTilt()
#         new = current + angle
#         self.tilt_motor.newValue(current, new, time)
#         
#         
#     def tiltDown(self, angle=10, time=1.0):
#         current = self.getTilt()
#         new = current - angle
#         self.tilt_motor.newValue(current, new, time)
#         
#         
#     def revertToDefault(self, time=1.0):
#         fov = self.getDefaultFov()
#         cur_fov = self.getFov()
#         self.zoom_motor.newValue(cur_fov, fov, time)
#         
#         pan = 0
#         cur_pan = self.getPan()
#         self.pan_motor.newValue(cur_pan, pan, time)
#         
#         tilt = 0
#         cur_tilt = self.getTilt()
#         self.tilt_motor.newValue(cur_tilt, tilt, time)
#         
#         
#     def reset(self):
#         self.zoom_motor.stop()
#         self.pan_motor.stop()
#         self.tilt_motor.stop()
#         
#         self.setFov(self.getDefaultFov())
#         self.setPan(0)
#         self.setTilt(0)
#         self.cur_time = 0
#         
#         
#     def update(self, time):
#         increment = time - self.cur_time
#         self.cur_time = time
#         self.zoom_motor.update(increment)
#         self.pan_motor.update(increment)
#         self.tilt_motor.update(increment)


import os
from pandac.PandaModules import Spotlight
from pandac.PandaModules import Filename
from panda3d.core import (WindowProperties, FrameBufferProperties, GraphicsPipe,
                          GraphicsOutput, Texture)
from direct.actor.Actor import Actor
from ..camera.panda_ptz_camera import PandaPTZCamera
# that it will be useful, but WITHOUT ANY WARRANTY; 
# without even the implied warranty of MERCHANTABILITY or 
# FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the Virtual Vision Simulator.  
# If not, see <http://www.gnu.org/licenses/>.
#





class PandaCameraBuilder:
    """Used to build different types of cameras"""

    def __init__(self, parent):
        self.parent = parent


    def buildPandaPTZCamera(self, config):
        buffer = self.makeFBO("camera buffer")
        panda_camera = base.makeCamera(buffer)
        panda_camera.reparentTo(render)
        path = Filename.fromOsSpecific(os.path.dirname(__file__))
        camera_model = loader.loadModel("%s/../camera/camera.egg" % path)
        camera_model.setScale(0.3)
        camera_model.reparentTo(render)
        

# Path: src/simulator/panda3d/camera/panda_ptz_camera.py
# class PandaPTZCamera(PandaCamera):
# 
#     def __init__(self, buffer, camera, camera_model):
#         PandaCamera.__init__(self, buffer, camera, camera_model)
#         self.zoom_motor = Motor(self, "setFov")
#         self.pan_motor = Motor(self, "setPan")
#         self.tilt_motor = Motor(self, "setTilt")
#         self.reset()
#         
#     def zoomIn(self, angle=10, time=1.0):
#         current = self.getFov()
#         new = current - angle
#         self.zoom_motor.newValue(current, new, time)
#         
#         
#     def zoomOut(self, angle=10, time=1.0):
#         current = self.getFov()
#         new = current + angle
#         self.zoom_motor.newValue(current, new, time)
#         
#         
#     def panLeft(self, angle=10, time=1.0):
#         current = self.getPan()
#         new = current - angle
#         self.pan_motor.newValue(current, new, time)
#         
#         
#     def panRight(self, angle=10, time=1.0):
#         current = self.getPan()
#         new = current + angle
#         self.pan_motor.newValue(current, new, time)
#         
#         
#     def tiltUp(self, angle=10, time=1.0):
#         current = self.getTilt()
#         new = current + angle
#         self.tilt_motor.newValue(current, new, time)
#         
#         
#     def tiltDown(self, angle=10, time=1.0):
#         current = self.getTilt()
#         new = current - angle
#         self.tilt_motor.newValue(current, new, time)
#         
#         
#     def revertToDefault(self, time=1.0):
#         fov = self.getDefaultFov()
#         cur_fov = self.getFov()
#         self.zoom_motor.newValue(cur_fov, fov, time)
#         
#         pan = 0
#         cur_pan = self.getPan()
#         self.pan_motor.newValue(cur_pan, pan, time)
#         
#         tilt = 0
#         cur_tilt = self.getTilt()
#         self.tilt_motor.newValue(cur_tilt, tilt, time)
#         
#         
#     def reset(self):
#         self.zoom_motor.stop()
#         self.pan_motor.stop()
#         self.tilt_motor.stop()
#         
#         self.setFov(self.getDefaultFov())
#         self.setPan(0)
#         self.setTilt(0)
#         self.cur_time = 0
#         
#         
#     def update(self, time):
#         increment = time - self.cur_time
#         self.cur_time = time
#         self.zoom_motor.update(increment)
#         self.pan_motor.update(increment)
#         self.tilt_motor.update(increment)


# Path: src/simulator/panda3d/builders/camera_builder.py
import os
from pandac.PandaModules import Spotlight
from pandac.PandaModules import Filename
from panda3d.core import (WindowProperties, FrameBufferProperties, GraphicsPipe,
                          GraphicsOutput, Texture)
from direct.actor.Actor import Actor
from ..camera.panda_ptz_camera import PandaPTZCamera

# that it will be useful, but WITHOUT ANY WARRANTY; 
# without even the implied warranty of MERCHANTABILITY or 
# FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with the Virtual Vision Simulator.  
# If not, see <http://www.gnu.org/licenses/>.
#





class PandaCameraBuilder:
    """Used to build different types of cameras"""

    def __init__(self, parent):
        self.parent = parent


    def buildPandaPTZCamera(self, config):
        buffer = self.makeFBO("camera buffer")
        panda_camera = base.makeCamera(buffer)
        panda_camera.reparentTo(render)
        path = Filename.fromOsSpecific(os.path.dirname(__file__))
        camera_model = loader.loadModel("%s/../camera/camera.egg" % path)
        camera_model.setScale(0.3)
        camera_model.reparentTo(render)
        

        panda_ptz_camera = PandaPTZCamera(buffer, panda_camera, camera_model)