Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
godot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
community
godot
Commits
4ebedb5f
Commit
4ebedb5f
authored
Jun 19, 2019
by
Bastiaan Olij
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Made constants fully upper case in camera server
parent
7fa941bf
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
27 additions
and
27 deletions
+27
-27
CameraFeed.xml
doc/classes/CameraFeed.xml
+2
-2
CameraServer.xml
doc/classes/CameraServer.xml
+2
-2
rasterizer_scene_gles2.cpp
drivers/gles2/rasterizer_scene_gles2.cpp
+4
-4
rasterizer_scene_gles3.cpp
drivers/gles3/rasterizer_scene_gles3.cpp
+4
-4
camera_feed.cpp
servers/camera/camera_feed.cpp
+9
-9
camera_feed.h
servers/camera/camera_feed.h
+2
-2
camera_server.cpp
servers/camera_server.cpp
+2
-2
camera_server.h
servers/camera_server.h
+2
-2
No files found.
doc/classes/CameraFeed.xml
View file @
4ebedb5f
...
...
@@ -45,10 +45,10 @@
<constant
name=
"FEED_RGB"
value=
"1"
enum=
"FeedDataType"
>
Feed supplies RGB images.
</constant>
<constant
name=
"FEED_YC
bCr
"
value=
"2"
enum=
"FeedDataType"
>
<constant
name=
"FEED_YC
BCR
"
value=
"2"
enum=
"FeedDataType"
>
Feed supplies YCbCr images that need to be converted to RGB.
</constant>
<constant
name=
"FEED_YC
bCr_Sep
"
value=
"3"
enum=
"FeedDataType"
>
<constant
name=
"FEED_YC
BCR_SEP
"
value=
"3"
enum=
"FeedDataType"
>
Feed supplies separate Y and CbCr images that need to be combined and converted to RGB.
</constant>
<constant
name=
"FEED_UNSPECIFIED"
value=
"0"
enum=
"FeedPosition"
>
...
...
doc/classes/CameraServer.xml
View file @
4ebedb5f
...
...
@@ -70,13 +70,13 @@
<constant
name=
"FEED_RGBA_IMAGE"
value=
"0"
enum=
"FeedImage"
>
The RGBA camera image.
</constant>
<constant
name=
"FEED_YC
bCr
_IMAGE"
value=
"0"
enum=
"FeedImage"
>
<constant
name=
"FEED_YC
BCR
_IMAGE"
value=
"0"
enum=
"FeedImage"
>
The YCbCr camera image.
</constant>
<constant
name=
"FEED_Y_IMAGE"
value=
"0"
enum=
"FeedImage"
>
The Y component camera image.
</constant>
<constant
name=
"FEED_C
bCr
_IMAGE"
value=
"1"
enum=
"FeedImage"
>
<constant
name=
"FEED_C
BCR
_IMAGE"
value=
"1"
enum=
"FeedImage"
>
The CbCr component camera image.
</constant>
</constants>
...
...
drivers/gles2/rasterizer_scene_gles2.cpp
View file @
4ebedb5f
...
...
@@ -2920,16 +2920,16 @@ void RasterizerSceneGLES2::render_scene(const Transform &p_cam_transform, const
VS
::
get_singleton
()
->
texture_bind
(
camera_RGBA
,
0
);
}
else
if
(
feed
->
get_datatype
()
==
CameraFeed
::
FEED_YC
bCr
)
{
RID
camera_YCbCr
=
feed
->
get_texture
(
CameraServer
::
FEED_YC
bCr
_IMAGE
);
}
else
if
(
feed
->
get_datatype
()
==
CameraFeed
::
FEED_YC
BCR
)
{
RID
camera_YCbCr
=
feed
->
get_texture
(
CameraServer
::
FEED_YC
BCR
_IMAGE
);
VS
::
get_singleton
()
->
texture_bind
(
camera_YCbCr
,
0
);
storage
->
shaders
.
copy
.
set_conditional
(
CopyShaderGLES2
::
YCBCR_TO_RGB
,
true
);
}
else
if
(
feed
->
get_datatype
()
==
CameraFeed
::
FEED_YC
bCr_Sep
)
{
}
else
if
(
feed
->
get_datatype
()
==
CameraFeed
::
FEED_YC
BCR_SEP
)
{
RID
camera_Y
=
feed
->
get_texture
(
CameraServer
::
FEED_Y_IMAGE
);
RID
camera_CbCr
=
feed
->
get_texture
(
CameraServer
::
FEED_C
bCr
_IMAGE
);
RID
camera_CbCr
=
feed
->
get_texture
(
CameraServer
::
FEED_C
BCR
_IMAGE
);
VS
::
get_singleton
()
->
texture_bind
(
camera_Y
,
0
);
VS
::
get_singleton
()
->
texture_bind
(
camera_CbCr
,
1
);
...
...
drivers/gles3/rasterizer_scene_gles3.cpp
View file @
4ebedb5f
...
...
@@ -4454,16 +4454,16 @@ void RasterizerSceneGLES3::render_scene(const Transform &p_cam_transform, const
RID
camera_RGBA
=
feed
->
get_texture
(
CameraServer
::
FEED_RGBA_IMAGE
);
VS
::
get_singleton
()
->
texture_bind
(
camera_RGBA
,
0
);
}
else
if
(
feed
->
get_datatype
()
==
CameraFeed
::
FEED_YC
bCr
)
{
RID
camera_YCbCr
=
feed
->
get_texture
(
CameraServer
::
FEED_YC
bCr
_IMAGE
);
}
else
if
(
feed
->
get_datatype
()
==
CameraFeed
::
FEED_YC
BCR
)
{
RID
camera_YCbCr
=
feed
->
get_texture
(
CameraServer
::
FEED_YC
BCR
_IMAGE
);
VS
::
get_singleton
()
->
texture_bind
(
camera_YCbCr
,
0
);
storage
->
shaders
.
copy
.
set_conditional
(
CopyShaderGLES3
::
YCBCR_TO_SRGB
,
true
);
}
else
if
(
feed
->
get_datatype
()
==
CameraFeed
::
FEED_YC
bCr_Sep
)
{
}
else
if
(
feed
->
get_datatype
()
==
CameraFeed
::
FEED_YC
BCR_SEP
)
{
RID
camera_Y
=
feed
->
get_texture
(
CameraServer
::
FEED_Y_IMAGE
);
RID
camera_CbCr
=
feed
->
get_texture
(
CameraServer
::
FEED_C
bCr
_IMAGE
);
RID
camera_CbCr
=
feed
->
get_texture
(
CameraServer
::
FEED_C
BCR
_IMAGE
);
VS
::
get_singleton
()
->
texture_bind
(
camera_Y
,
0
);
VS
::
get_singleton
()
->
texture_bind
(
camera_CbCr
,
1
);
...
...
servers/camera/camera_feed.cpp
View file @
4ebedb5f
...
...
@@ -60,8 +60,8 @@ void CameraFeed::_bind_methods() {
BIND_ENUM_CONSTANT
(
FEED_NOIMAGE
);
BIND_ENUM_CONSTANT
(
FEED_RGB
);
BIND_ENUM_CONSTANT
(
FEED_YC
bCr
);
BIND_ENUM_CONSTANT
(
FEED_YC
bCr_Sep
);
BIND_ENUM_CONSTANT
(
FEED_YC
BCR
);
BIND_ENUM_CONSTANT
(
FEED_YC
BCR_SEP
);
BIND_ENUM_CONSTANT
(
FEED_UNSPECIFIED
);
BIND_ENUM_CONSTANT
(
FEED_FRONT
);
...
...
@@ -145,7 +145,7 @@ CameraFeed::CameraFeed() {
// create a texture object
VisualServer
*
vs
=
VisualServer
::
get_singleton
();
texture
[
CameraServer
::
FEED_Y_IMAGE
]
=
vs
->
texture_create
();
// also used for RGBA
texture
[
CameraServer
::
FEED_C
bCr
_IMAGE
]
=
vs
->
texture_create
();
texture
[
CameraServer
::
FEED_C
BCR
_IMAGE
]
=
vs
->
texture_create
();
}
CameraFeed
::
CameraFeed
(
String
p_name
,
FeedPosition
p_position
)
{
...
...
@@ -162,14 +162,14 @@ CameraFeed::CameraFeed(String p_name, FeedPosition p_position) {
// create a texture object
VisualServer
*
vs
=
VisualServer
::
get_singleton
();
texture
[
CameraServer
::
FEED_Y_IMAGE
]
=
vs
->
texture_create
();
// also used for RGBA
texture
[
CameraServer
::
FEED_C
bCr
_IMAGE
]
=
vs
->
texture_create
();
texture
[
CameraServer
::
FEED_C
BCR
_IMAGE
]
=
vs
->
texture_create
();
}
CameraFeed
::~
CameraFeed
()
{
// Free our textures
VisualServer
*
vs
=
VisualServer
::
get_singleton
();
vs
->
free
(
texture
[
CameraServer
::
FEED_Y_IMAGE
]);
vs
->
free
(
texture
[
CameraServer
::
FEED_C
bCr
_IMAGE
]);
vs
->
free
(
texture
[
CameraServer
::
FEED_C
BCR
_IMAGE
]);
}
void
CameraFeed
::
set_RGB_img
(
Ref
<
Image
>
p_rgb_img
)
{
...
...
@@ -208,7 +208,7 @@ void CameraFeed::set_YCbCr_img(Ref<Image> p_ycbcr_img) {
}
vs
->
texture_set_data
(
texture
[
CameraServer
::
FEED_RGBA_IMAGE
],
p_ycbcr_img
);
datatype
=
CameraFeed
::
FEED_YC
bCr
;
datatype
=
CameraFeed
::
FEED_YC
BCR
;
}
}
...
...
@@ -233,12 +233,12 @@ void CameraFeed::set_YCbCr_imgs(Ref<Image> p_y_img, Ref<Image> p_cbcr_img) {
vs
->
texture_allocate
(
texture
[
CameraServer
::
FEED_Y_IMAGE
],
new_y_width
,
new_y_height
,
0
,
Image
::
FORMAT_R8
,
VS
::
TEXTURE_TYPE_2D
,
VS
::
TEXTURE_FLAG_USED_FOR_STREAMING
);
///@TODO GLES2 doesn't support FORMAT_RG8, need to do some form of conversion
vs
->
texture_allocate
(
texture
[
CameraServer
::
FEED_C
bCr
_IMAGE
],
new_cbcr_width
,
new_cbcr_height
,
0
,
Image
::
FORMAT_RG8
,
VS
::
TEXTURE_TYPE_2D
,
VS
::
TEXTURE_FLAG_USED_FOR_STREAMING
);
vs
->
texture_allocate
(
texture
[
CameraServer
::
FEED_C
BCR
_IMAGE
],
new_cbcr_width
,
new_cbcr_height
,
0
,
Image
::
FORMAT_RG8
,
VS
::
TEXTURE_TYPE_2D
,
VS
::
TEXTURE_FLAG_USED_FOR_STREAMING
);
}
vs
->
texture_set_data
(
texture
[
CameraServer
::
FEED_Y_IMAGE
],
p_y_img
);
vs
->
texture_set_data
(
texture
[
CameraServer
::
FEED_C
bCr
_IMAGE
],
p_cbcr_img
);
datatype
=
CameraFeed
::
FEED_YC
bCr_Sep
;
vs
->
texture_set_data
(
texture
[
CameraServer
::
FEED_C
BCR
_IMAGE
],
p_cbcr_img
);
datatype
=
CameraFeed
::
FEED_YC
BCR_SEP
;
}
}
...
...
servers/camera/camera_feed.h
View file @
4ebedb5f
...
...
@@ -50,8 +50,8 @@ public:
enum
FeedDataType
{
FEED_NOIMAGE
,
// we don't have an image yet
FEED_RGB
,
// our texture will contain a normal RGB texture that can be used directly
FEED_YC
bCr
,
// our texture will contain a YCbCr texture that needs to be converted to RGB before output
FEED_YC
bCr_Sep
// our camera is split into two textures, first plane contains Y data, second plane contains CbCr data
FEED_YC
BCR
,
// our texture will contain a YCbCr texture that needs to be converted to RGB before output
FEED_YC
BCR_SEP
// our camera is split into two textures, first plane contains Y data, second plane contains CbCr data
};
enum
FeedPosition
{
...
...
servers/camera_server.cpp
View file @
4ebedb5f
...
...
@@ -47,9 +47,9 @@ void CameraServer::_bind_methods() {
ADD_SIGNAL
(
MethodInfo
(
"camera_feed_removed"
,
PropertyInfo
(
Variant
::
INT
,
"id"
)));
BIND_ENUM_CONSTANT
(
FEED_RGBA_IMAGE
);
BIND_ENUM_CONSTANT
(
FEED_YC
bCr
_IMAGE
);
BIND_ENUM_CONSTANT
(
FEED_YC
BCR
_IMAGE
);
BIND_ENUM_CONSTANT
(
FEED_Y_IMAGE
);
BIND_ENUM_CONSTANT
(
FEED_C
bCr
_IMAGE
);
BIND_ENUM_CONSTANT
(
FEED_C
BCR
_IMAGE
);
};
CameraServer
*
CameraServer
::
singleton
=
NULL
;
...
...
servers/camera_server.h
View file @
4ebedb5f
...
...
@@ -53,9 +53,9 @@ class CameraServer : public Object {
public
:
enum
FeedImage
{
FEED_RGBA_IMAGE
=
0
,
FEED_YC
bCr
_IMAGE
=
0
,
FEED_YC
BCR
_IMAGE
=
0
,
FEED_Y_IMAGE
=
0
,
FEED_C
bCr
_IMAGE
=
1
,
FEED_C
BCR
_IMAGE
=
1
,
FEED_IMAGES
=
2
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment