Exemplo n.º 1
0
 def skyBoxDone(self, model):
     self.skybox = model
     self.skybox.setScale(0.8)
     self.skybox.setPos(0, 0, 0.5)
     self.skybox.setDepthTest(False)
     self.skybox.setAttrib(CullBinAttrib.make("skyboxBin", 1000))
     self.skybox.reparentTo(camera)
     taskMgr.add(self.skyboxTask, "forestsky")
Exemplo n.º 2
0
 def skyBoxDone(self, model):
     self.skybox = model
     self.skybox.setScale(0.8)
     self.skybox.setPos(0, 0, 0.5)
     self.skybox.setDepthTest(False)
     self.skybox.setAttrib(CullBinAttrib.make("skyboxBin", 1000))
     self.skybox.reparentTo(camera)
     taskMgr.add(self.skyboxTask, "forestsky")
Exemplo n.º 3
0
def DoubleSidedNoZ():
    global _DoubleSidedNoZ
    if not _DoubleSidedNoZ:
        _DoubleSidedNoZ = RenderState.make(
            CullFaceAttrib.make(CullFaceAttrib.MCullNone),
            DepthTestAttrib.make(DepthTestAttrib.MOff),
            DepthWriteAttrib.make(DepthWriteAttrib.MOff),
            CullBinAttrib.make("fixed", LEGlobals.WidgetSort))
    return _DoubleSidedNoZ
Exemplo n.º 4
0
 def select(self):
     self.state3D = self.state3D.setAttrib(ColorScaleAttrib.make(Vec4(1, 0.75, 0.75, 1)))
     self.state2D = self.state2D.setAttrib(ColorAttrib.makeFlat(Vec4(1, 0, 0, 1)))
     self.state2D = self.state2D.setAttrib(CullBinAttrib.make("fixed", LEGlobals.SelectedSort))
     self.state2D = self.state2D.setAttrib(DepthWriteAttrib.make(False))
     self.state2D = self.state2D.setAttrib(DepthTestAttrib.make(False))
     self.solid.setFaceGeomState(self.geom3D, self.state3D)
     self.solid.setFaceGeomState(self.geom2D, self.state2D)
     self.show3DLines()
     self.isSelected = True
Exemplo n.º 5
0
def DashedLineNoZ():
    global _DashedLineNoZ
    if not _DashedLineNoZ:
        shattr = getStippleShader()
        _DashedLineNoZ = RenderState.make(
            shattr,
            DepthTestAttrib.make(DepthTestAttrib.MOff),
            DepthWriteAttrib.make(DepthWriteAttrib.MOff),
            CullFaceAttrib.make(CullFaceAttrib.MCullNone),
        )
        _DashedLineNoZ = _DashedLineNoZ.setAttrib(CullBinAttrib.make("fixed", LEGlobals.BoxSort))
    return _DashedLineNoZ
Exemplo n.º 6
0
    def __init__(self, _heightField):

    	texture = loader.loadTexture("ground_tex.png")
        self.zScale = 45

        self.terrain = GeoMipTerrain("BasicTerrain")
        self.terrain.setHeightfield(_heightField)

        # Dynamic settings?
        self.terrain.setBlockSize(16)
        self.terrain.setNear(20)
        self.terrain.setFar(100)
        self.terrain.setFocalPoint(base.camera)

        # Settings
        self.terrain.getRoot().setSz(self.zScale)
        self.terrain.getRoot().setTexture(texture)
        self.terrain.getRoot().reparentTo(render)
        self.terrain.generate()

        self.terrainSize = (self.terrain.heightfield().getReadXSize(), self.terrain.heightfield().getReadYSize())
        print "Terrain Size:", self.terrainSize
        taskMgr.add(self.terrainTask, "TerrainTask")

        self.skydome = loader.loadModel("Skydome")
        self.skydome.setDepthTest(False)
        self.skydome.setAttrib(CullBinAttrib.make("skydomeBin", 1000))
        self.skydome.reparentTo(camera)
        self.skydome.setScale(2)
        self.skydome.setPos(0, 0, -0.5)
        self.skydome.setCollideMask(BitMask32.allOff())
        taskMgr.add(self.skydomeTask, "paperplanet_skydome")

        # Add some fancy fog
        self.fog = Fog("Fog Name")
        self.fog.setColor(0.4,0.2,0.3)
        self.fog.setExpDensity(0.015)
        render.setFog(self.fog)

        # Some Test light
        dlight = DirectionalLight("dlight")
        dlight.setColor(VBase4(0.8, 0.8, 0.5, 1))
        dlnp = render.attachNewNode(dlight)
        dlnp.setHpr(0, -60, 0)
        render.setLight(dlnp)


        # Add basic blacksmith hut
        tmp = loader.loadModel("blacksmith_hut")
        tmp.reparentTo(render)
        tmp.setPos(164.054, 340.92, 11.3384)
Exemplo n.º 7
0
    MovingPoint3 = 5

class ClipSide(IntEnum):
    Both = 0
    Front = 1
    Back = 2

PlaneVis3DState = RenderState.make(
    ColorAttrib.makeFlat(Vec4(0, 1, 1, 0.5)),
    TransparencyAttrib.make(TransparencyAttrib.MAlpha),
    CullFaceAttrib.make(CullFaceAttrib.MCullNone)
)

PlaneVis2DState = RenderState.make(
    ColorAttrib.makeFlat(Vec4(0, 1, 1, 1)),
    CullBinAttrib.make("fixed", LEGlobals.BoxSort),
    CullFaceAttrib.make(CullFaceAttrib.MCullNone)
)

# Draws the clip plane lines and move handles in each 2D viewport
class ClipToolViewport2D:

    def __init__(self, tool, vp):
        self.tool = tool
        self.vp = vp

        self.hPoint1 = self.makeHandle()
        self.hPoint2 = self.makeHandle()
        self.hPoint3 = self.makeHandle()

    def cleanup(self):
Exemplo n.º 8
0
from .ObjectProperty import ObjectProperty

from src.leveleditor.math.Line import Line
from src.leveleditor.geometry.Box import Box
from src.leveleditor.geometry.GeomView import GeomView
from src.leveleditor.viewport.ViewportType import VIEWPORT_2D_MASK, VIEWPORT_3D_MASK

from enum import IntEnum

BoundsBox3DState = RenderState.make(
    ColorAttrib.makeFlat(Vec4(1, 1, 0, 1))
)

BoundsBox2DState = RenderState.make(
    ColorAttrib.makeFlat(Vec4(1, 0, 0, 1)),
    CullBinAttrib.make("selected-foreground", 0)
)

MapObjectInit = PStatCollector("Arch:CreateSolid:MapObjInit")

# Base class for any object in the map (brush, entity, etc)
class MapObject(MapWritable):

    ObjectName = "object"

    def __init__(self, id):
        MapObjectInit.start()

        MapWritable.__init__(self, base.document)
        self.temporary = False
        self.id = id
Exemplo n.º 9
0
 def apply(self, nodePath):
     attrib = CullBinAttrib.make(self.value, self.draw_order)
     nodePath.setAttrib(attrib)