Add helper functions for drawing sources
If you look at the previous commits, you'll see I had added obs_source_draw before. For custom drawn sources in particular, each time obs_source_draw was called, it would restart the effect and its passes for each draw call, which was not optimal. It should really use the effect functions for that. I'll have to add a function to simplify effect usage. I also realized that including the color matrix parameters in obs_source_draw made the function kind of messy to use; instead, separating the color matrix stuff out to obs_source_draw_set_color_matrix feels a lot more clean. On top of that, having the ability to set the position would be nice to have as well, rather than having to mess with the matrix stuff each time, so I also added that for the sake of convenience. obs_source_draw will draw a texture sprite, optionally of a specific size and/or at a specific position, as well as optionally inverted. The texture used will be set to the 'image' parameter of whatever effect is currently active. obs_source_draw_set_color_matrix will set the color matrix value if the drawing requires color matrices. It will set the 'color_matrix', 'color_range_min', and 'color_range_max' parameters of whatever effect is currently active. Overall, these feel much more clean to use than the previous iteration.
Showing
想要评论请 注册 或 登录