コード例 #1
0
ファイル: entity.py プロジェクト: joismar/ursina
    def texture(self, value):
        if value is None and self._texture:
            # print('remove texture')
            self._texture = None
            self.setTextureOff(True)
            return

        if value.__class__ is Texture:
            texture = value

        elif isinstance(value, str):
            texture = load_texture(value)
            # print('loaded texture:', texture)
            if texture is None:
                print('no texture:', value)
                return

        if texture.__class__ is MovieTexture:
            self._texture = texture
            self.model.setTexture(texture, 1)
            return

        self._texture = texture
        if self.model:
            self.model.setTexture(texture._texture, 1)
コード例 #2
0
ファイル: entity.py プロジェクト: philippeitis/ursina
    def texture(self, value):
        if not self.model:
            return

        if value.__class__ is Texture:
            texture = value

        elif isinstance(value, str):
            texture = load_texture(value)
            # print('loaded texture:', texture)

        if texture.__class__ is MovieTexture:
            self._texture = texture
            self.model.setTexture(texture)
            return

        try:
            self._texture = texture
            self.model.setTexture(texture._texture, 1)
            # print('set texture:', value)
        except:
            pass
            if value:
                print('no texture:', value)

        if value == None:
            self.model.set_texture_off(True)
コード例 #3
0
    def texture(self, value):
        if value is None and self._texture:
            # print('remove texture')
            self.model.clearTexture()
            self._texture = None
            return

        if value.__class__ is Texture:
            texture = value

        elif isinstance(value, str):
            texture = load_texture(value)
            # print('loaded texture:', texture)
            if texture is None:
                if application.raise_exception_on_missing_texture:
                    raise ValueError(f"missing texture: '{value}'")

                print_warning(f"missing texture: '{value}'")
                return

        self.model.setTextureOff(False)
        if texture.__class__ is MovieTexture:
            self._texture = texture
            self.model.setTexture(texture, 1)
            return

        self._texture = texture
        if self.model:
            self.model.setTexture(texture._texture, 1)
コード例 #4
0
ファイル: scene.py プロジェクト: pokepetter/ursina
 def set_up(self):
     self.reparent_to(render)
     self.reflection_map = load_texture(self.reflection_map_name)
     self.fog = Fog('fog')
     self.setFog(self.fog)
     self.fog_color = color.light_gray
     self.fog_density = 0
コード例 #5
0
ファイル: entity.py プロジェクト: gargaki13/ursina
    def reflection_map(self, value):
        if value.__class__ is Texture:
            texture = value

        elif isinstance(value, str):
            texture = load_texture(value)

        self._reflection_map = texture
コード例 #6
0
ファイル: scene.py プロジェクト: bt530/ursina
    def set_up(self):
        from ursina.entity import Entity
        self.reparent_to(render)
        self.reflection_map = load_texture(self.reflection_map)

        self.fog = Fog('fog')
        self.setFog(self.fog)
        self.fog_color = color.light_gray
        self.fog_density = 0
コード例 #7
0
 def set_up(self):
     from ursina.entity import Entity
     self.reparent_to(render)
     self.reflection_map = load_texture(self.reflection_map)