void csm_calc_cascadeplanes(struct vec4f* planes, const struct plane vp_planes[6], const struct mat4f* cmat) { /* near plane */ const struct plane* p; struct vec4f pv; struct mat4f mt; mat4_inv(&mt, cmat); mat4_transpose_self(&mt); /* right plane */ p = &vp_planes[CAM_FRUSTUM_RIGHT]; vec4_setf(&pv, p->nx, p->ny, p->nz, p->d); vec4_transform(&planes[0], &pv, &mt); /* left plane */ p = &vp_planes[CAM_FRUSTUM_LEFT]; vec4_setf(&pv, p->nx, p->ny, p->nz, p->d); vec4_transform(&planes[1], &pv, &mt); /* top plane */ p = &vp_planes[CAM_FRUSTUM_TOP]; vec4_setf(&pv, p->nx, p->ny, p->nz, p->d); vec4_transform(&planes[2], &pv, &mt); /* bottom plane */ p = &vp_planes[CAM_FRUSTUM_BOTTOM]; vec4_setf(&pv, p->nx, p->ny, p->nz, p->d); vec4_transform(&planes[3], &pv, &mt); }
static inline void chroma_settings_update( struct chroma_key_filter_data *filter, obs_data_t *settings) { int64_t similarity = obs_data_get_int(settings, SETTING_SIMILARITY); int64_t smoothness = obs_data_get_int(settings, SETTING_SMOOTHNESS); int64_t spill = obs_data_get_int(settings, SETTING_SPILL); uint32_t key_color = (uint32_t)obs_data_get_int(settings, SETTING_KEY_COLOR); const char *key_type = obs_data_get_string(settings, SETTING_COLOR_TYPE); struct vec4 key_color_v4; struct matrix4 yuv_mat_m4; if (strcmp(key_type, "green") == 0) key_color = 0x00FF00; else if (strcmp(key_type, "blue") == 0) key_color = 0xFF9900; else if (strcmp(key_type, "magenta") == 0) key_color = 0xFF00FF; vec4_from_rgba(&filter->key_rgb, key_color | 0xFF000000); memcpy(&yuv_mat_m4, yuv_mat, sizeof(yuv_mat)); vec4_transform(&key_color_v4, &filter->key_rgb, &yuv_mat_m4); vec2_set(&filter->chroma, key_color_v4.y, key_color_v4.z); filter->similarity = (float)similarity / 1000.0f; filter->smoothness = (float)smoothness / 1000.0f; filter->spill = (float)spill / 1000.0f; }