Exemple #1
0
    def _create_components(self):
        """ Internal method to init the widgets components """

        # Create the buffer which stores the last FPS values
        self._storage_buffer = Image.create_buffer("FPSValues", 250, "R16")
        self._storage_buffer.set_clear_color(Vec4(0))
        self._storage_buffer.clear_image()

        self._store_index = PTAInt.empty_array(1)
        self._store_index[0] = 0

        self._current_ftime = PTAFloat.empty_array(1)
        self._current_ftime[0] = 16.0

        self._chart_ms_max = PTAFloat.empty_array(1)
        self._chart_ms_max[0] = 40

        # Create the texture where the gui component is rendered inside
        self._display_tex = Image.create_2d("FPSChartRender", 250, 120, "RGBA8")
        self._display_tex.set_clear_color(Vec4(0))
        self._display_tex.clear_image()
        self._display_img = Sprite(
            image=self._display_tex, parent=self._node, w=250, h=120, x=10, y=10)

        # Defer the further loading
        Globals.base.taskMgr.doMethodLater(0.3, self._late_init, "FPSChartInit")
Exemple #2
0
    def _create_components(self):
        """ Internal method to init the widgets components """

        # Create the buffer which stores the last FPS values
        self._storage_buffer = Image.create_buffer("FPSValues", 250, "R16")
        self._storage_buffer.set_clear_color(Vec4(0))
        self._storage_buffer.clear_image()

        self._store_index = PTAInt.empty_array(1)
        self._store_index[0] = 0

        self._current_ftime = PTAFloat.empty_array(1)
        self._current_ftime[0] = 16.0

        self._chart_ms_max = PTAFloat.empty_array(1)
        self._chart_ms_max[0] = 40

        # Create the texture where the gui component is rendered inside
        self._display_tex = Image.create_2d("FPSChartRender", 250, 120,
                                            "RGBA8")
        self._display_tex.set_clear_color(Vec4(0))
        self._display_tex.clear_image()
        self._display_img = Sprite(image=self._display_tex,
                                   parent=self._node,
                                   w=250,
                                   h=120,
                                   x=10,
                                   y=10)

        # Defer the further loading
        Globals.base.taskMgr.doMethodLater(0.3, self._late_init,
                                           "FPSChartInit")
Exemple #3
0
    def __init__(self, pos=Vec2(0), rightAligned=False, color=Vec3(0, 0, 0),
                 size=0.04, parent=None):
        if parent is None:
            parent = Globals.base.aspect2d

        self.parent = parent

        self._loadCharset()
        self._prepareFontTextures()
        self._makeFontShader()
        self._makeSquare()

        self.data = PTAFloat.empty_array(100)
        self.lastText = ""
        self.size = 16.0 / base.win.getYSize() * 2.0

        self.square.setShaderInput("displData", self.data)

        self.rightAligned = rightAligned
        self.pos = pos
        self.posOffset = Vec2(0)
        self.color = PTALVecBase3f.emptyArray(1)
        self.color[0] = color

        self.posPTA = PTALVecBase2f.emptyArray(1)
        self.square.setShaderInput("pos", self.posPTA)

        self._updateInputs()
Exemple #4
0
    def __init__(self,
                 pos=Vec2(0),
                 rightAligned=False,
                 color=Vec3(0, 0, 0),
                 size=0.04):

        self._loadCharset()
        self._prepareFontTextures()
        self._makeFontShader()
        self._makeSquare()

        self.data = PTAFloat.empty_array(100)
        self.lastText = ""
        self.size = size
        self.square.setShaderInput("displData", self.data)

        self.rightAligned = rightAligned
        self.pos = pos
        self.posOffset = Vec2(0)
        self.color = color

        self.posPTA = PTALVecBase2f.emptyArray(1)
        self.square.setShaderInput("pos", self.posPTA)

        self._updateInputs()
    def __init__(self, pos=Vec2(0), rightAligned=False, color=Vec3(0,0,0), size=0.04):

        self._loadCharset()
        self._prepareFontTextures()
        self._makeFontShader()
        self._makeSquare()

        self.data = PTAFloat.empty_array(100)
        self.lastText = ""
        self.size = size
        self.square.setShaderInput("displData", self.data)

        self.rightAligned = rightAligned
        self.pos = pos
        self.posOffset = Vec2(0)
        self.color = color
        self._updateInputs()
 def _list_to_pta(self, list_values):
     """ Converts a list to a PTAFloat """
     pta = PTAFloat.empty_array(len(list_values))
     for i, val in enumerate(list_values):
         pta[i] = val
     return pta
 def _create_ptas(self):
     self._pta_grid_pos = PTALVecBase3.empty_array(1)
     self._pta_grid_size = PTAFloat.empty_array(1)
     self._pta_grid_res = PTAInt.empty_array(1)
     self._pta_grid_size[0] = self._voxel_ws
     self._pta_grid_res[0] = self._voxel_res
 def _list_to_pta(self, list_values):
     """ Converts a list to a PTAFloat """
     pta = PTAFloat.empty_array(len(list_values))
     for i, val in enumerate(list_values):
         pta[i] = val
     return pta