cPy.cRender module#
Expand for references to
cPy.cRender
- class image_format(value)[source]#
Bases:
EnumThe coat namespace used for most 3DCoat API calls except low-level internal structures.- fmtNone = 0#
- R8 = 1#
- Rg8 = 2#
- Rgb8 = 3#
- Rgba8 = 4#
- R16 = 5#
- Rg16 = 6#
- Rgb16 = 7#
- Rgba16 = 8#
- R16f = 9#
- Rg16f = 10#
- Rgb16f = 11#
- Rgba16f = 12#
- R32f = 13#
- Rg32f = 14#
- Rgb32f = 15#
- Rgba32f = 16#
- Depth16 = 17#
- Depth24 = 18#
- Depth24Stencil8 = 19#
- Dxt1 = 20#
- Dxt3 = 21#
- Dxt5 = 22#
- PVRTC4 = 23#
- PVRTC4_Alpha = 24#
- Count = 25#
- class RenderUtils[source]#
Bases:
objectBase class for rendering utilities- static CreateFBO(width: int, height: int, format: image_format) int[source]#
- Create frame buffer object. An FBO is a texture or data that can accept a rendered result
- Parameters:
width (int) – The size of the sampler in width
height (int) – The size of the sampler in height
format (image_format) – image_format - enum with the number of channels and the channel type. For example coat.image_format.Rgb8
- Returns:
texture id - can be used as texture id and as FBO for rendering target
- Return type:
int
- static clear(fbo_id: int, fill_color: any, clear_color: bool = True, clear_depth: bool = True, fill_depth: float = 1) int[source]#
- Clear the framebuffer object - fill each pixel of the FBO sample with the same data
- Parameters:
fbo_id (int) – FBO ID to be filled for clearing
fill_color – Color to fill each pixel
clear_color (bool) – Do you want to clear the FBO color? if “true” the color of each pixel will be changed to fill_color, if “false” the color will not be changed.
clear_depth (bool) – Do you want to clear the FBO depth? if “true” the depth of each pixel will be changed to fill_depth, if “false” the depth will not be changed.
fill_depth (float) – Depth value for fill each pixel
- Returns:
true if successfully
- Return type:
int
- static draw_on_screen(texture: int = 1, left: int = 0, top: int = 0, right: int = 0, bottom: int = 0, red: int = 255, green: int = 255, blue: int = 255, opacity: int = 255) int[source]#
- Draw a texture rectangle in the main 3DCoat window
- Parameters:
texture (int) – The ID of the texture that will be rendered
left (int) – The position of the left side of the rendered texture on the screen
top (int) – The position of the top side of the rendered texture on the screen
right (int) – The position of the right side of the rendered texture on the screen
bottom (int) – The position of the bottom side of the rendered texture on the screen
red (int) – Multiplier for the red channel of the texture
green (int) – Multiplier for the green channel of the texture
blue (int) – Multiplier for the blue channel of the texture
- Returns:
true if successfully
- Return type:
int
- static draw_text(x: float, y: float, text: str, color_r: float = 1, color_g: float = 1, color_b: float = 1, color_a: float = 1) int[source]#
- Draw the text in the main 3DCoat window
- Parameters:
x (float) – The position of the left side of the text block
y (float) – The position of the top side of the text block
text (str) – The content of the text block you want to display
color_r (float) – Value of the red channel of the text color
color_g (float) – Value of the gleen channel of the text color
color_b (float) – Value of the blue channel of the text color
color_a (float) – Opacity of the rendered text
- Returns:
true if successfully
- Return type:
int
- static CreateGPUTexture(src_data: any, format: image_format) int[source]#
- Create a 2D sampler in GPU memory from a numpy array
- Parameters:
src_data – numpy array from which the 2d sampler will be created. A numpy array must have the correct width and height, type and number of channels as in OpenCV
format (image_format) – The texture type must match the numpy structure and type. For example coat.image_format.Rgb8
- Returns:
the texture id of the new sampler
- Return type:
int
- static GPUTextureFromFile(file_path: str, Clamp: bool = False, Smooth: bool = True, swapRB: bool = False, Flip: bool = False) int[source]#
- Create a 2D sampler in GPU memory from a numpy array
- Returns:
the texture id of the new sampler
- Return type:
int
- static DeleteGPUTexture(texture_id: int) bool[source]#
- Remove sampler from GPU memory
- Parameters:
texture_id (int) – Texture ID
- Returns:
true if successfully
- Return type:
bool
- static GetTextureID(Name: str, Clamp: bool = False, Smooth: bool = False, swapRB: bool = False, Flip: bool = False) int[source]#
- static drawBottomAlignedText(xb: int, yb: int, Text: str, MaxLx: int, FontSize: int, Color: int, Align: int, Draw: bool) int[source]#
- static drawCenetrAlignedText(x: int, y: int, Text: str, MaxLx: int, FontSize: int, Color: int) int[source]#
- static drawMultilineText(x: int, y: int, s: str, DefaultFont: int, DefColor: int, MaxLx: int, MaxLy: int = 100000, CenterX: any = 0, Draw: bool = True) int[source]#
- static drawThickArrow(x: float, y: float, x1: float, y1: float, Color1: int, Color2: int, Thickness: float)[source]#