command
This type is used to change render command parameters.
Be cautious when changing stuff in an instance of this type. Passing invalid data to texture
or frag_shader
, or not restoring some changes after you're done drawing can lead to undefined behavior, and more likely, a crash. If you are not sure how to operate this type, take a look into examples.
texture
Type: ptr
Texture pointer. You can get one from an instance of texture
type by accessing obj
field. Passing invalid data to this field WILL result in a crash. For a safer way, please use set_texture
.
frag_shader
Type: Type: ptr
Fragment shader (aka Pixel Shader in DirectX terms) pointer. You can get one from an instance of shader
type by accessing obj
field. Passing invalid data to this field WILL result in a crash. For a safer way, please use set_shader
.
clip_rect
Type: rect?
Clip rectangle used for scissor testing. If this is set to nil
, will not clip anything.
It is advised to instead use layer's override_clip_rect
method. While you can pass custom rect to this field, you will lose information about previous clip rects set before. Using that method will make sure to intersect the previous rect with the one you pass and produce a probably more expected result.
uv_rect
Type: rect?
UV rect used for texture mapping. If this field is set to nil
, will use 0, 0, 1, 1
rectangle to map the texture. You can learn more about texture mapping in the tutorial section.
alpha
Type: float
Global opacity override. Defaults to 1
, but if you set anything else - will modulate opacity of every next shape you will render.
rotation
Type: float
Shape rotation. Not all shapes support this field. The value is set in degrees, not radians.
anti_alias
Type: bool
If set to true
, will apply tesselation to shapes.
ignore_scaling
Type: bool
If set to true
, will ignore global DPI scale. This is set to true
by default, but you are free to change it to false
if you are trying to render some custom UI elements.
chained_call
Type: bool
Only useful when using shaders. If set to true
, will not update back buffer texture. This can be used if you need the very same texture data, as when applying several shaders to the back buffer.
only_downsampled
Type: bool
If set to true
, will capture back buffer (as long as chained_call
is set to false
). The name of this field is quite misleading due to the fact that in the CS:GO version of Fatality, it was used to configure if the rendering system should also downsample the captured backbuffer into another texture. In DirectX11, this operation is much faster, so it is done regardless.
capture_back_buffer
Type: bool
An alias to only_downsampled
.
is_tile
Type: bool
If set to true
, will use a separate texture sampler that supports tiling. By default, all textures are stretched, but if you enable this option - their tiling and stretch will be fully configurable by the uv_rect
field.
mode
Type: render_mode
Rendering mode. You can read more about it in the type's documentation.
set_texture
Sets a texture in a safe manner.
Arguments
Name
Type
Description
Returns
Nothing.
Example
cmd:set_texture(my_tex);
set_shader
Sets a fragment shader in a safe manner.
Arguments
Name
Type
Description
sh
[shader
]
Shader object.
Returns
Nothing.
Example
cmd:set_shader(my_shader);
Last updated