from panda3d.core import CardMaker, MovieTexture, NodePath, TextureStage, TransparencyAttrib
from visual import visual

class Technics(visual):
    def setup(self):
        self.path.removeNode()
        self.path = self.render.attachNewNode("1210mk2")

        self.plane = CardMaker("plane")

        self.plane.setFrame(-10,10,-10,10)
        
        self.amplifier = self.path.attachNewNode(self.plane.generate())
        self.comic = self.path.attachNewNode(self.plane.generate())
        self.drivecoil = self.path.attachNewNode(self.plane.generate())
        self.drivecontrol = self.path.attachNewNode(self.plane.generate())
        self.output = self.path.attachNewNode(self.plane.generate())
        self.parts1 = self.path.attachNewNode(self.plane.generate())
        self.parts2 = self.path.attachNewNode(self.plane.generate())
        self.tonearm = self.path.attachNewNode(self.plane.generate())
        self.pitchled = self.path.attachNewNode(self.plane.generate())
        self.scheme = self.path.attachNewNode(self.plane.generate())
        self.setup = self.path.attachNewNode(self.plane.generate())
        self.strobeilluminator = self.path.attachNewNode(self.plane.generate())
        self.stylus = self.path.attachNewNode(self.plane.generate())
        self.top = self.path.attachNewNode(self.plane.generate())
        self.tonearmbalance = self.path.attachNewNode(self.plane.generate())


        """
        self.left.setX(-10)
        self.right.setX(10)
        self.up.setZ(10)
        self.down.setZ(-10)
        self.left.setH(270)
        self.right.setH(90)
        self.up.setP(270)
        self.down.setP(90)
        self.front.setY(-10)
        self.back.setY(10)
        self.back.setH(180)
        """

        self.amplifiertex = self.loader.loadTexture("1210amplifier.png")
        self.comictex = self.loader.loadTexture("1210comic.png")
        self.drivecoiltex = self.loader.loadTexture("1210drivecoil.png")
        self.drivecontroltex = self.loader.loadTexture("1210drivecontrol_pcb.png")
        self.outputtex = self.loader.loadTexture("1210output_pcb.png")
        self.parts1tex = self.loader.loadTexture("1210parts1.png")
        self.parts2tex = self.loader.loadTexture("1210parts2.png")
        self.tonearmtex = self.loader.loadTexture("1210pickup.png")
        self.pitchledtex = self.loader.loadTexture("1210pitchled.png")
        self.schemetex = self.loader.loadTexture("1210scheme.png")
        self.setuptex = self.loader.loadTexture("1210setup.png")
        self.strobeilluminatortex = self.loader.loadTexture("1210strobeilluminator_pcb.png")
        self.stylustex = self.loader.loadTexture("1210stylus.png")
        self.toptex = self.loader.loadTexture("1210top.png")
        self.tonearmbalancetex = self.loader.loadTexture("1210tonearmbalance.png")

        self.amplifier.setTexture(self.amplifiertex)
        self.comic.setTexture(self.comictex)
        self.drivecoil.setTexture(self.drivecoiltex)
        self.drivecontrol.setTexture(self.drivecontroltex)
        self.output.setTexture(self.outputtex)
        self.parts1.setTexture(self.parts1tex)
        self.parts2.setTexture(self.parts2tex)
        self.tonearm.setTexture(self.tonearmtex)
        self.pitchled.setTexture(self.pitchledtex)
        self.scheme.setTexture(self.schemetex)
        self.setup.setTexture(self.setuptex)
        self.strobeilluminator.setTexture(self.strobeilluminatortex)
        self.stylus.setTexture(self.stylustex)
        self.top.setTexture(self.toptex)
        self.tonearmbalance.setTexture(self.tonearmbalancetex)
        
        self.amplifier.setX(-20)
        self.drivecoil.setX(20)
        self.drivecontrol.setX(20)
        self.drivecontrol.setY(20)
        self.output.setX(-20)
        self.output.setY(20)
        self.parts1.setX(-40)
        self.parts2.setX(-40)
        self.parts2.setY(20)
        self.tonearm.setX(40)
        self.pitchled.setX(40)
        self.pitchled.setY(20)
        self.scheme.setX(40)
        self.scheme.setY(-20)
        self.setup.setX(-40)
        self.setup.setY(-20)
        self.strobeilluminator.setX(-60)
        self.stylus.setX(60)
        self.top.setX(-60)
        self.top.setY(-20)
        self.tonearmbalance.setX(-60)
        self.tonearmbalance.setY(20)
        
        self.path.setTransparency(TransparencyAttrib.MAlpha, 1)
        self.path.setTwoSided(1)

