Пример #1
0
    def draw_line_2d(self, x1, y1, x2, y2, color):
        messageBuilder = self.builder

        RenderMessage.RenderMessageStart(messageBuilder)
        RenderMessage.RenderMessageAddRenderType(messageBuilder, RenderType.DrawLine2D)
        RenderMessage.RenderMessageAddColor(messageBuilder, color)
        RenderMessage.RenderMessageAddStart(messageBuilder, self.__create_vector(x1, y1))
        RenderMessage.RenderMessageAddEnd(messageBuilder, self.__create_vector(x2, y2))
        message = RenderMessage.RenderMessageEnd(messageBuilder)

        self.render_list.append(message)
        return self
Пример #2
0
    def draw_line_2d_3d(self, x, y, vec, color):
        messageBuilder = self.builder

        RenderMessage.RenderMessageStart(messageBuilder)
        RenderMessage.RenderMessageAddRenderType(messageBuilder, RenderType.DrawLine2D_3D)
        RenderMessage.RenderMessageAddColor(messageBuilder, color)
        RenderMessage.RenderMessageAddStart(messageBuilder, self.__create_vector(x, y))
        RenderMessage.RenderMessageAddEnd(messageBuilder, self.__create_vector(vec))
        message = RenderMessage.RenderMessageEnd(messageBuilder)

        self.render_list.append(message)
        return self
Пример #3
0
    def draw_rect_2d(self, x, y, width, height, filled, color):
        messageBuilder = self.builder

        RenderMessage.RenderMessageStart(messageBuilder)
        RenderMessage.RenderMessageAddRenderType(messageBuilder, RenderType.DrawRect2D)
        RenderMessage.RenderMessageAddColor(messageBuilder, color)
        RenderMessage.RenderMessageAddStart(messageBuilder, self.__create_vector(x, y))
        RenderMessage.RenderMessageAddScaleX(messageBuilder, width)
        RenderMessage.RenderMessageAddScaleY(messageBuilder, height)
        RenderMessage.RenderMessageAddIsFilled(messageBuilder, filled)
        message = RenderMessage.RenderMessageEnd(messageBuilder)

        self.render_list.append(message)
        return self
Пример #4
0
    def draw_line_3d(self, vec1, vec2, color):
        messageBuilder = self.builder

        RenderMessage.RenderMessageStart(messageBuilder)
        RenderMessage.RenderMessageAddRenderType(messageBuilder,
                                                 RenderType.DrawLine3D)
        RenderMessage.RenderMessageAddColor(messageBuilder, color)
        RenderMessage.RenderMessageAddStart(messageBuilder,
                                            self.__create_vector(*vec1))
        RenderMessage.RenderMessageAddEnd(messageBuilder,
                                          self.__create_vector(*vec2))
        message = RenderMessage.RenderMessageEnd(messageBuilder)

        self.render_list.append(message)
        return self
Пример #5
0
    def draw_string_3d(self, vec, scale_x, scale_y, text, color):
        messageBuilder = self.builder
        builtString = messageBuilder.CreateString(text)

        RenderMessage.RenderMessageStart(messageBuilder)
        RenderMessage.RenderMessageAddRenderType(messageBuilder, RenderType.DrawString3D)
        RenderMessage.RenderMessageAddColor(messageBuilder, color)
        RenderMessage.RenderMessageAddStart(messageBuilder, self.__create_vector(vec))
        RenderMessage.RenderMessageAddScaleX(messageBuilder, scale_x)
        RenderMessage.RenderMessageAddScaleY(messageBuilder, scale_y)
        RenderMessage.RenderMessageAddText(messageBuilder, builtString)
        message = RenderMessage.RenderMessageEnd(messageBuilder)

        self.render_list.append(message)
        return self
Пример #6
0
    def draw_rect_3d(self, vec, width, height, filled, color, centered=False):
        messageBuilder = self.builder

        RenderMessage.RenderMessageStart(messageBuilder)
        RenderMessage.RenderMessageAddRenderType(
            messageBuilder,
            RenderType.DrawCenteredRect3D if centered else RenderType.DrawRect3D)
        RenderMessage.RenderMessageAddColor(messageBuilder, color)
        RenderMessage.RenderMessageAddStart(messageBuilder, self.__create_vector(vec))
        RenderMessage.RenderMessageAddScaleX(messageBuilder, width)
        RenderMessage.RenderMessageAddScaleY(messageBuilder, height)
        RenderMessage.RenderMessageAddIsFilled(messageBuilder, filled)
        message = RenderMessage.RenderMessageEnd(messageBuilder)

        self.render_list.append(message)
        return self
Пример #7
0
    def draw_polyline_3d(self, vectors, color):
        if len(vectors) < 2:
            get_logger("Renderer").error("draw_polyline_3d requires atleast 2 vectors!")
            return self

        messageBuilder = self.builder

        for i in range(0, len(vectors) - 1):
            RenderMessage.RenderMessageStart(messageBuilder)
            RenderMessage.RenderMessageAddRenderType(messageBuilder, RenderType.DrawLine3D)
            RenderMessage.RenderMessageAddColor(messageBuilder, color)
            RenderMessage.RenderMessageAddStart(messageBuilder, self.__create_vector(vectors[i]))
            RenderMessage.RenderMessageAddEnd(messageBuilder, self.__create_vector(vectors[i + 1]))
            message = RenderMessage.RenderMessageEnd(messageBuilder)
            self.render_list.append(message)

        return self