当前位置: 首页>>代码示例>>Python>>正文


Python Color.white方法代码示例

本文整理汇总了Python中color.Color.white方法的典型用法代码示例。如果您正苦于以下问题:Python Color.white方法的具体用法?Python Color.white怎么用?Python Color.white使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在color.Color的用法示例。


在下文中一共展示了Color.white方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: from color import Color [as 别名]
# 或者: from color.Color import white [as 别名]
    def __init__(self, pixels, width, height):
        self.pixels = pixels
        self.width = width
        self.height = height

        self.canvas = Canvas(width, height, pixels)

        # setup key handlers
        key_esc = 27
        self.handlers = {
            key_esc: self.exit
        }
		
		
        self.v1 = Vertex(Vector(0, 0), Color.cyan())
        self.v2 = Vertex(Vector(300, 100), Color.red())
        self.v3 = Vertex(Vector(200, 300), Color.white())
        self.v4 = Vertex(Vector(300, 0), Color.green())
开发者ID:Rain1996,项目名称:rasterizer.py,代码行数:20,代码来源:window.py

示例2: __init__

# 需要导入模块: from color import Color [as 别名]
# 或者: from color.Color import white [as 别名]
    def __init__(self, model_path: str, texture_path: str):
        self.position = Vector(0, 0, 0)
        self.rotation = Vector(0, 0, 0)
        self.scale = Vector(1, 1, 1)

        self.texture = Texture(texture_path)

        # load model file
        delimiter = ' '
        self.vertices = []
        self.indices = []
        with open(model_path) as model_file:

            # eat file descriptor and version
            model_file.readline()
            model_file.readline()

            vs = model_file.readline().split(delimiter)
            number_of_vertices = int(vs[1])

            ts = model_file.readline().split(delimiter)
            number_of_triangles = int(ts[1])

            # vertices
            for i in range(number_of_vertices):
                vs = model_file.readline().split(delimiter)
                x = float(vs[0])
                y = float(vs[1])
                z = float(vs[2])

                nx = float(vs[3])
                ny = float(vs[4])
                nz = float(vs[5])

                u = float(vs[6])
                v = float(vs[7])
                self.vertices.append(Vertex(Vector(x, y, z), Vector(nx, ny, nz), u, v, Color.white()))

            # triangles
            for i in range(number_of_triangles):
                t = model_file.readline().split(delimiter)
                a = int(t[0])
                b = int(t[1])
                c = int(t[2])
                self.indices.append(a)
                self.indices.append(b)
                self.indices.append(c)
开发者ID:happlebao,项目名称:rendererpy,代码行数:49,代码来源:mesh.py

示例3: draw_point

# 需要导入模块: from color import Color [as 别名]
# 或者: from color.Color import white [as 别名]
 def draw_point(self, point: Vector, color: Color = Color.white()):
     if 0 <= point.x < self.width and 0 <= point.y < self.height:
         self.put_pixel(point.x, point.y, point.z, color)
开发者ID:happlebao,项目名称:rendererpy,代码行数:5,代码来源:canvas.py


注:本文中的color.Color.white方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。