static inline void render_item(struct obs_scene_item *item) { if (item->crop_render) { uint32_t width = obs_source_get_width(item->source); uint32_t height = obs_source_get_height(item->source); uint32_t cx = calc_cx(item, width); uint32_t cy = calc_cy(item, height); if (cx && cy && gs_texrender_begin(item->crop_render, cx, cy)) { float cx_scale = (float)width / (float)cx; float cy_scale = (float)height / (float)cy; gs_matrix_scale3f(cx_scale, cy_scale, 1.0f); gs_matrix_translate3f( -(float)item->crop.left, -(float)item->crop.top, 0.0f); obs_source_video_render(item->source); gs_texrender_end(item->crop_render); } } gs_matrix_push(); gs_matrix_mul(&item->draw_transform); if (item->crop_render) { gs_texture_t *tex = gs_texrender_get_texture(item->crop_render); while (gs_effect_loop(obs->video.default_effect, "Draw")) obs_source_draw(tex, 0, 0, 0, 0, 0); } else { obs_source_video_render(item->source); } gs_matrix_pop(); }
static inline void render_child(obs_source_t *transition, obs_source_t *child, size_t idx) { uint32_t cx = transition->transition_actual_cx; uint32_t cy = transition->transition_actual_cy; struct vec4 blank; if (!child) return; if (gs_texrender_begin(transition->transition_texrender[idx], cx, cy)) { vec4_zero(&blank); gs_clear(GS_CLEAR_COLOR, &blank, 0.0f, 0); gs_matrix_push(); gs_matrix_mul(&transition->transition_matrices[idx]); obs_source_video_render(child); gs_matrix_pop(); gs_texrender_end(transition->transition_texrender[idx]); } }
static inline void render_item(struct obs_scene_item *item) { if (item->item_render) { uint32_t width = obs_source_get_width(item->source); uint32_t height = obs_source_get_height(item->source); uint32_t cx = calc_cx(item, width); uint32_t cy = calc_cy(item, height); if (cx && cy && gs_texrender_begin(item->item_render, cx, cy)) { float cx_scale = (float)width / (float)cx; float cy_scale = (float)height / (float)cy; struct vec4 clear_color; vec4_zero(&clear_color); gs_clear(GS_CLEAR_COLOR, &clear_color, 0.0f, 0); gs_ortho(0.0f, (float)width, 0.0f, (float)height, -100.0f, 100.0f); gs_matrix_scale3f(cx_scale, cy_scale, 1.0f); gs_matrix_translate3f( -(float)item->crop.left, -(float)item->crop.top, 0.0f); obs_source_video_render(item->source); gs_texrender_end(item->item_render); } } gs_matrix_push(); gs_matrix_mul(&item->draw_transform); if (item->item_render) { render_item_texture(item); } else { obs_source_video_render(item->source); } gs_matrix_pop(); }