Fix FO z fighting and fix maze

This commit is contained in:
John 2015-06-18 21:35:22 +03:00
parent 9804328571
commit 67e76cea51
2 changed files with 6 additions and 7 deletions

View file

@ -559,13 +559,12 @@ class DistributedBuilding(DistributedObject.DistributedObject):
backgroundNP = loader.loadModel('phase_5/models/cogdominium/field_office_sign') backgroundNP = loader.loadModel('phase_5/models/cogdominium/field_office_sign')
backgroundNP.reparentTo(signOrigin) backgroundNP.reparentTo(signOrigin)
backgroundNP.setPosHprScale(0.0, 0.0, -1.2 + textHeight * 0.8 / zScale, 0.0, 0.0, 0.0, 20.0, 8.0, 8.0 * zScale) backgroundNP.setPosHprScale(0.0, 0.0, -1.2 + textHeight * 0.8 / zScale, 0.0, 0.0, 0.0, 20.0, 8.0, 8.0 * zScale)
backgroundNP.node().setEffect(DecalEffect.make())
signTextNodePath = backgroundNP.attachNewNode(textNode.generate()) signTextNodePath = backgroundNP.attachNewNode(textNode.generate())
signTextNodePath.setPosHprScale(0.0, 0.0, -0.13 + textHeight * 0.1 / zScale, 0.0, 0.0, 0.0, 0.1 * 8.0 / 20.0, 0.1, 0.1 / zScale) signTextNodePath.setPosHprScale(0.0, 0.0, -0.13 + textHeight * 0.1 / zScale, 0.0, 0.0, 0.0, 0.1 * 8.0 / 20.0, 0.1, 0.1 / zScale)
signTextNodePath.setColor(1.0, 1.0, 1.0, 1.0) signTextNodePath.setColor(1.0, 1.0, 1.0, 1.0)
frontNP = suitBuildingNP.find('**/*_front') frontNP = suitBuildingNP.find('**/*_front')
backgroundNP.wrtReparentTo(frontNP) backgroundNP.wrtReparentTo(frontNP)
frontNP.node().setEffect(DecalEffect.make()) signTextNodePath.setAttrib(DepthOffsetAttrib.make(1))
suitBuildingNP.setName('cb' + str(self.block) + ':_landmark__DNARoot') suitBuildingNP.setName('cb' + str(self.block) + ':_landmark__DNARoot')
suitBuildingNP.setPosHprScale(nodePath, 15.463, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0) suitBuildingNP.setPosHprScale(nodePath, 15.463, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0)
suitBuildingNP.setColorScale(0.6, 0.6, 0.6, 1.0) suitBuildingNP.setColorScale(0.6, 0.6, 0.6, 1.0)

View file

@ -1,6 +1,6 @@
from direct.showbase.PythonUtil import Enum from direct.showbase.PythonUtil import Enum
from direct.gui.DirectGui import DirectFrame, DGG from direct.gui.DirectGui import DirectFrame, DGG
from pandac.PandaModules import Vec2, VBase4D from pandac.PandaModules import Vec2, VBase4F
from pandac.PandaModules import CardMaker, NodePath from pandac.PandaModules import CardMaker, NodePath
from pandac.PandaModules import Texture, PNMImage from pandac.PandaModules import Texture, PNMImage
DEFAULT_MASK_RESOLUTION = 32 DEFAULT_MASK_RESOLUTION = 32
@ -48,7 +48,7 @@ class MazeMapGui(DirectFrame):
def _createMapTextureCard(self): def _createMapTextureCard(self):
mapImage = PNMImage(MAP_RESOLUTION, MAP_RESOLUTION) mapImage = PNMImage(MAP_RESOLUTION, MAP_RESOLUTION)
mapImage.fill(*self._bgColor) mapImage.fill(*self._bgColor)
fgColor = VBase4D(*self._fgColor) fgColor = VBase4F(*self._fgColor)
for x in xrange(self._mazeHeight): for x in xrange(self._mazeHeight):
for y in xrange(self._mazeWidth): for y in xrange(self._mazeWidth):
if self._mazeCollTable[y][x] == 1: if self._mazeCollTable[y][x] == 1:
@ -128,15 +128,15 @@ class MazeMapGui(DirectFrame):
def _revealSmoothCircle(self, x, y, center): def _revealSmoothCircle(self, x, y, center):
length = (Vec2(x, y) - center).length() length = (Vec2(x, y) - center).length()
goalAlpha = max(0.0, length / float(self._radius) - 0.5) goalAlpha = max(0.0, length / float(self._radius) - 0.5)
self._maskImage.setXelA(x, y, VBase4D(0.0, 0.0, 0.0, min(self._maskImage.getAlpha(x, y), goalAlpha * 2.0))) self._maskImage.setXelA(x, y, VBase4F(0.0, 0.0, 0.0, min(self._maskImage.getAlpha(x, y), goalAlpha * 2.0)))
def _revealHardCircle(self, x, y, center): def _revealHardCircle(self, x, y, center):
length = (Vec2(x, y) - center).length() length = (Vec2(x, y) - center).length()
if length <= self._radius: if length <= self._radius:
self._maskImage.setXelA(x, y, VBase4D(0, 0, 0, 0)) self._maskImage.setXelA(x, y, VBase4F(0, 0, 0, 0))
def _revealSquare(self, x, y, center): def _revealSquare(self, x, y, center):
self._maskImage.setXelA(x, y, VBase4D(0, 0, 0, 0)) self._maskImage.setXelA(x, y, VBase4F(0, 0, 0, 0))
def _drawHole(self, x, y): def _drawHole(self, x, y):
center = Vec2(x, y) center = Vec2(x, y)