Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
尘离序散
obs-studio
提交
d2ba08e4
O
obs-studio
项目概览
尘离序散
/
obs-studio
与 Fork 源项目一致
从无法访问的项目Fork
通知
30
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
O
obs-studio
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
d2ba08e4
编写于
10月 26, 2013
作者:
J
jp9000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
add frame flipping code
上级
7dada3be
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
41 addition
and
19 deletion
+41
-19
libobs/graphics/graphics.c
libobs/graphics/graphics.c
+33
-11
libobs/graphics/graphics.h
libobs/graphics/graphics.h
+4
-1
libobs/obs-source.c
libobs/obs-source.c
+2
-4
libobs/obs-source.h
libobs/obs-source.h
+0
-1
test/test-input/test-filter.c
test/test-input/test-filter.c
+1
-1
test/test-input/test-random.c
test/test-input/test-random.c
+1
-1
未找到文件。
libobs/graphics/graphics.c
浏览文件 @
d2ba08e4
...
...
@@ -644,12 +644,42 @@ texture_t gs_create_volumetexture_from_file(const char *file, uint32_t flags)
return
NULL
;
}
void
gs_draw_sprite
(
texture_t
tex
)
static
inline
void
assign_sprite_uv
(
float
*
start
,
float
*
end
,
bool
flip
)
{
if
(
!
flip
)
{
*
start
=
0
.
0
f
;
*
end
=
1
.
0
f
;
}
else
{
*
start
=
1
.
0
f
;
*
end
=
0
.
0
f
;
}
}
static
inline
void
build_sprite
(
struct
vb_data
*
data
,
float
fcx
,
float
fcy
,
uint32_t
flip
)
{
struct
vec2
*
tvarray
=
data
->
tvarray
[
0
].
array
;
float
start_u
,
end_u
;
float
start_v
,
end_v
;
assign_sprite_uv
(
&
start_u
,
&
end_u
,
(
flip
&
GS_FLIP_U
)
!=
0
);
assign_sprite_uv
(
&
start_v
,
&
end_v
,
(
flip
&
GS_FLIP_V
)
!=
0
);
vec3_zero
(
data
->
points
);
vec3_set
(
data
->
points
+
1
,
fcx
,
0
.
0
f
,
0
.
0
f
);
vec3_set
(
data
->
points
+
2
,
0
.
0
f
,
fcy
,
0
.
0
f
);
vec3_set
(
data
->
points
+
3
,
fcx
,
fcy
,
0
.
0
f
);
vec2_set
(
tvarray
,
start_u
,
start_v
);
vec2_set
(
tvarray
+
1
,
end_u
,
start_v
);
vec2_set
(
tvarray
+
2
,
start_u
,
end_v
);
vec2_set
(
tvarray
+
3
,
end_u
,
end_v
);
}
void
gs_draw_sprite
(
texture_t
tex
,
uint32_t
flip
)
{
graphics_t
graphics
=
thread_graphics
;
float
fcx
,
fcy
;
struct
vb_data
*
data
;
struct
vec2
*
tvarray
;
assert
(
tex
);
...
...
@@ -662,15 +692,7 @@ void gs_draw_sprite(texture_t tex)
fcy
=
(
float
)
texture_getheight
(
tex
);
data
=
vertexbuffer_getdata
(
graphics
->
sprite_buffer
);
tvarray
=
data
->
tvarray
[
0
].
array
;
vec3_zero
(
data
->
points
);
vec3_set
(
data
->
points
+
1
,
fcx
,
0
.
0
f
,
0
.
0
f
);
vec3_set
(
data
->
points
+
2
,
0
.
0
f
,
fcy
,
0
.
0
f
);
vec3_set
(
data
->
points
+
3
,
fcx
,
fcy
,
0
.
0
f
);
vec2_zero
(
tvarray
);
vec2_set
(
tvarray
+
1
,
1
.
0
f
,
0
.
0
f
);
vec2_set
(
tvarray
+
2
,
0
.
0
f
,
1
.
0
f
);
vec2_set
(
tvarray
+
3
,
1
.
0
f
,
1
.
0
f
);
build_sprite
(
data
,
fcx
,
fcy
,
flip
);
vertexbuffer_flush
(
graphics
->
sprite_buffer
,
false
);
gs_load_vertexbuffer
(
graphics
->
sprite_buffer
);
gs_load_indexbuffer
(
NULL
);
...
...
libobs/graphics/graphics.h
浏览文件 @
d2ba08e4
...
...
@@ -479,7 +479,10 @@ EXPORT texture_t gs_create_cubetexture_from_file(const char *flie,
EXPORT
texture_t
gs_create_volumetexture_from_file
(
const
char
*
flie
,
uint32_t
flags
);
EXPORT
void
gs_draw_sprite
(
texture_t
tex
);
#define GS_FLIP_U (1<<0)
#define GS_FLIP_V (1<<1)
EXPORT
void
gs_draw_sprite
(
texture_t
tex
,
uint32_t
flip
);
EXPORT
void
gs_draw_cube_backdrop
(
texture_t
cubetex
,
const
struct
quat
*
rot
,
float
left
,
float
right
,
float
top
,
float
bottom
,
float
znear
);
...
...
libobs/obs-source.c
浏览文件 @
d2ba08e4
...
...
@@ -411,7 +411,7 @@ static void obs_source_draw_texture(texture_t tex, struct source_frame *frame)
param
=
effect_getparambyname
(
effect
,
"diffuse"
);
effect_settexture
(
effect
,
param
,
tex
);
gs_draw_sprite
(
tex
);
gs_draw_sprite
(
tex
,
frame
->
flip
?
GS_FLIP_V
:
0
);
technique_endpass
(
tech
);
technique_end
(
tech
);
...
...
@@ -427,10 +427,8 @@ static void obs_source_render_async_video(obs_source_t source)
if
(
!
source
->
timing_set
&&
source
->
audio_buffer
.
num
)
obs_source_flush_audio_buffer
(
source
);
if
(
set_texture_size
(
source
,
frame
))
{
source
->
flip
=
frame
->
flip
;
if
(
set_texture_size
(
source
,
frame
))
obs_source_draw_texture
(
source
->
output_texture
,
frame
);
}
obs_source_releaseframe
(
source
,
frame
);
}
...
...
libobs/obs-source.h
浏览文件 @
d2ba08e4
...
...
@@ -214,7 +214,6 @@ struct obs_source {
uint64_t
last_frame_timestamp
;
uint64_t
last_sys_timestamp
;
texture_t
output_texture
;
bool
flip
;
audio_line_t
audio_line
;
DARRAY
(
struct
audiobuf
)
audio_buffer
;
...
...
test/test-input/test-filter.c
浏览文件 @
d2ba08e4
...
...
@@ -69,7 +69,7 @@ void test_video_render(struct test_filter *tf)
technique_begin
(
tech
);
technique_beginpass
(
tech
,
0
);
gs_draw_sprite
(
tex
);
gs_draw_sprite
(
tex
,
0
);
technique_endpass
(
tech
);
technique_end
(
tech
);
...
...
test/test-input/test-random.c
浏览文件 @
d2ba08e4
...
...
@@ -68,7 +68,7 @@ void random_video_render(struct random_tex *rt, obs_source_t filter_target)
technique_begin
(
tech
);
technique_beginpass
(
tech
,
0
);
gs_draw_sprite
(
rt
->
texture
);
gs_draw_sprite
(
rt
->
texture
,
0
);
technique_endpass
(
tech
);
technique_end
(
tech
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录