Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Spartan322 committed Nov 5, 2024
2 parents d14f2a3 + b00e1cb commit 70166f9
Show file tree
Hide file tree
Showing 216 changed files with 4,071 additions and 1,429 deletions.
21 changes: 9 additions & 12 deletions .clang-tidy
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
---
Checks: >-
-*,
cppcoreguidelines-pro-type-member-init,
modernize-redundant-void-arg,
modernize-use-bool-literals,
modernize-use-default-member-init,
modernize-use-nullptr,
readability-braces-around-statements,
readability-redundant-member-init
WarningsAsErrors: ''
Checks:
- -*
- cppcoreguidelines-pro-type-member-init
- modernize-redundant-void-arg
- modernize-use-bool-literals
- modernize-use-default-member-init
- modernize-use-nullptr
- readability-braces-around-statements
- readability-redundant-member-init
HeaderFileExtensions: ['', h, hh, hpp, hxx, inc, glsl]
ImplementationFileExtensions: [c, cc, cpp, cxx, m, mm, java]
HeaderFilterRegex: (core|doc|drivers|editor|main|modules|platform|scene|servers|tests)/
Expand All @@ -19,4 +17,3 @@ CheckOptions:
modernize-use-bool-literals.IgnoreMacros: false
modernize-use-default-member-init.IgnoreMacros: false
modernize-use-default-member-init.UseAssignment: true
...
3 changes: 3 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,6 @@ e8542b06acca3c1bdeee4b528411771f0819f084

# Set clang-format `RemoveSemicolon` rule to `true`
0d350e71086fffce0553811739aae9f6ad66136c

# Style: Apply clang-tidy fixes (superficial)
bb5f390fb9b466be35a5df7651323d7e66afca31
2 changes: 1 addition & 1 deletion .github/workflows/linux_builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
# TODO: Figure out somehow how to embed this one.
- name: wayland-scanner dependency
run: |
sudo apt-get install libwayland-bin libegl-dev
sudo apt-get install libwayland-bin
- name: Free disk space on runner
run: |
Expand Down
2 changes: 1 addition & 1 deletion COPYRIGHT.txt
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ License: BSD-3-clause
Files: ./thirdparty/misc/smolv.cpp
./thirdparty/misc/smolv.h
Comment: SMOL-V
Copyright: 2016-2020, Aras Pranckevicius
Copyright: 2016-2024, Aras Pranckevicius
License: public-domain or Unlicense or Expat

Files: ./thirdparty/misc/stb_rect_pack.h
Expand Down
2 changes: 1 addition & 1 deletion core/input/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1036,7 +1036,7 @@ void Input::action_release(const StringName &p_action) {

// Create or retrieve existing action.
ActionState &action_state = action_states[p_action];
action_state.cache.pressed = 0;
action_state.cache.pressed = false;
action_state.cache.strength = 0.0;
action_state.cache.raw_strength = 0.0;
// As input may come in part way through a physics tick, the earliest we can react to it is the next physics tick.
Expand Down
2 changes: 1 addition & 1 deletion core/object/message_queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ class CallQueue {
bool is_flushing() const;
int get_max_buffer_usage() const;

CallQueue(Allocator *p_custom_allocator = 0, uint32_t p_max_pages = 8192, const String &p_error_text = String());
CallQueue(Allocator *p_custom_allocator = nullptr, uint32_t p_max_pages = 8192, const String &p_error_text = String());
virtual ~CallQueue();
};

Expand Down
2 changes: 0 additions & 2 deletions core/typedefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,4 @@ struct BuildIndexSequence<0, Is...> : IndexSequence<Is...> {};
#define ___gd_is_defined(val) ____gd_is_defined(__GDARG_PLACEHOLDER_##val)
#define GD_IS_DEFINED(x) ___gd_is_defined(x)

#define FORCE_SEMICOLON ;

#endif // TYPEDEFS_H
12 changes: 4 additions & 8 deletions core/variant/variant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2721,8 +2721,7 @@ Variant::Variant(const Vector<Plane> &p_array) :
}
}

Variant::Variant(const Vector<Face3> &p_face_array) :
type(NIL) {
Variant::Variant(const Vector<Face3> &p_face_array) {
PackedVector3Array vertices;
int face_count = p_face_array.size();
vertices.resize(face_count * 3);
Expand All @@ -2741,8 +2740,7 @@ Variant::Variant(const Vector<Face3> &p_face_array) :
*this = vertices;
}

Variant::Variant(const Vector<Variant> &p_array) :
type(NIL) {
Variant::Variant(const Vector<Variant> &p_array) {
Array arr;
arr.resize(p_array.size());
for (int i = 0; i < p_array.size(); i++) {
Expand All @@ -2751,8 +2749,7 @@ Variant::Variant(const Vector<Variant> &p_array) :
*this = arr;
}

Variant::Variant(const Vector<StringName> &p_array) :
type(NIL) {
Variant::Variant(const Vector<StringName> &p_array) {
PackedStringArray v;
int len = p_array.size();
v.resize(len);
Expand Down Expand Up @@ -2910,8 +2907,7 @@ Variant::Variant(const IPAddress &p_address) :
memnew_placement(_data._mem, String(p_address));
}

Variant::Variant(const Variant &p_variant) :
type(NIL) {
Variant::Variant(const Variant &p_variant) {
reference(p_variant);
}

Expand Down
3 changes: 1 addition & 2 deletions core/variant/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -816,8 +816,7 @@ class Variant {
static void unregister_types();

Variant(const Variant &p_variant);
_FORCE_INLINE_ Variant() :
type(NIL) {}
_FORCE_INLINE_ Variant() {}
_FORCE_INLINE_ ~Variant() {
clear();
}
Expand Down
18 changes: 18 additions & 0 deletions doc/classes/CameraFeed.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,21 @@
Returns the position of camera on the device.
</description>
</method>
<method name="get_texture_tex_id">
<return type="int" />
<param index="0" name="feed_image_type" type="int" enum="CameraServer.FeedImage" />
<description>
Returns the texture backend ID (usable by some external libraries that need a handle to a texture to write data).
</description>
</method>
<method name="set_external">
<return type="void" />
<param index="0" name="width" type="int" />
<param index="1" name="height" type="int" />
<description>
Sets the feed as external feed provided by another library.
</description>
</method>
<method name="set_format">
<return type="bool" />
<param index="0" name="index" type="int" />
Expand Down Expand Up @@ -110,6 +125,9 @@
<constant name="FEED_YCBCR_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_EXTERNAL" value="4" enum="FeedDataType">
Feed supplies external image.
</constant>
<constant name="FEED_UNSPECIFIED" value="0" enum="FeedPosition">
Unspecified position.
</constant>
Expand Down
2 changes: 1 addition & 1 deletion doc/classes/DisplayServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@
<return type="Color" />
<description>
Returns OS theme accent color. Returns [code]Color(0, 0, 0, 0)[/code], if accent color is unknown.
[b]Note:[/b] This method is implemented on macOS and Windows.
[b]Note:[/b] This method is implemented on macOS, Windows, and Android.
</description>
</method>
<method name="get_base_color" qualifiers="const">
Expand Down
8 changes: 8 additions & 0 deletions doc/classes/RenderingServer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,14 @@
Sets the intensity of the background color.
</description>
</method>
<method name="environment_set_camera_id">
<return type="void" />
<param index="0" name="env" type="RID" />
<param index="1" name="id" type="int" />
<description>
Sets the camera ID to be used as environment background.
</description>
</method>
<method name="environment_set_canvas_max_layer">
<return type="void" />
<param index="0" name="env" type="RID" />
Expand Down
2 changes: 2 additions & 0 deletions drivers/d3d12/rendering_device_driver_d3d12.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6179,6 +6179,8 @@ uint64_t RenderingDeviceDriverD3D12::api_trait_get(ApiTrait p_trait) {
return false;
case API_TRAIT_USE_GENERAL_IN_COPY_QUEUES:
return true;
case API_TRAIT_BUFFERS_REQUIRE_TRANSITIONS:
return !barrier_capabilities.enhanced_barriers_supported;
default:
return RenderingDeviceDriver::api_trait_get(p_trait);
}
Expand Down
130 changes: 130 additions & 0 deletions drivers/gles3/effects/feed_effects.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/**************************************************************************/
/* feed_effects.cpp */
/**************************************************************************/
/* This file is part of: */
/* REDOT ENGINE */
/* https://redotengine.org */
/**************************************************************************/
/* Copyright (c) 2024-present Redot Engine contributors */
/* (see REDOT_AUTHORS.md) */
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifdef GLES3_ENABLED

#include "feed_effects.h"

#ifdef ANDROID_ENABLED
#include <GLES3/gl3ext.h>
#endif

#define GL_PROGRAM_POINT_SIZE 0x8642

using namespace GLES3;

FeedEffects *FeedEffects::singleton = nullptr;

FeedEffects *FeedEffects::get_singleton() {
return singleton;
}

FeedEffects::FeedEffects() {
singleton = this;

feed.shader.initialize();
feed.shader_version = feed.shader.version_create();
feed.shader.version_bind_shader(feed.shader_version, FeedShaderGLES3::MODE_DEFAULT);

{ // Screen Triangle.
glGenBuffers(1, &screen_triangle);
glBindBuffer(GL_ARRAY_BUFFER, screen_triangle);

const float qv[6] = {
-1.0f,
-1.0f,
3.0f,
-1.0f,
-1.0f,
3.0f,
};

glBufferData(GL_ARRAY_BUFFER, sizeof(float) * 6, qv, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind

glGenVertexArrays(1, &screen_triangle_array);
glBindVertexArray(screen_triangle_array);
glBindBuffer(GL_ARRAY_BUFFER, screen_triangle);
glVertexAttribPointer(RS::ARRAY_VERTEX, 2, GL_FLOAT, GL_FALSE, sizeof(float) * 2, nullptr);
glEnableVertexAttribArray(RS::ARRAY_VERTEX);
glBindVertexArray(0);
glBindBuffer(GL_ARRAY_BUFFER, 0); //unbind
}
}

FeedEffects::~FeedEffects() {
singleton = nullptr;
glDeleteBuffers(1, &screen_triangle);
glDeleteVertexArrays(1, &screen_triangle_array);
feed.shader.version_free(feed.shader_version);
}

Transform3D transform3D_from_mat4(const float *p_mat4) {
Transform3D res;

res.basis.rows[0][0] = p_mat4[0];
res.basis.rows[1][0] = p_mat4[1];
res.basis.rows[2][0] = p_mat4[2];
// p_mat4[3] = 0;
res.basis.rows[0][1] = p_mat4[4];
res.basis.rows[1][1] = p_mat4[5];
res.basis.rows[2][1] = p_mat4[6];
// p_mat4[7] = 0;
res.basis.rows[0][2] = p_mat4[8];
res.basis.rows[1][2] = p_mat4[9];
res.basis.rows[2][2] = p_mat4[10];
// p_mat4[11] = 0;
res.origin.x = p_mat4[12];
res.origin.y = p_mat4[13];
res.origin.z = p_mat4[14];
// p_mat4[15] = 1;

return res;
}

void FeedEffects::draw() {
bool success = feed.shader.version_bind_shader(feed.shader_version, FeedShaderGLES3::MODE_DEFAULT, FeedShaderGLES3::USE_EXTERNAL_SAMPLER);
if (!success) {
OS::get_singleton()->print("Godot : FeedShaderGLES3 Could not bind version_bind_shader USE_EXTERNAL_SAMPLER");
return;
}

draw_screen_triangle();
}

void FeedEffects::draw_screen_triangle() {
glBindVertexArray(screen_triangle_array);
glDrawArrays(GL_TRIANGLES, 0, 3);
glBindVertexArray(0);
}

#endif // GLES3_ENABLED
70 changes: 70 additions & 0 deletions drivers/gles3/effects/feed_effects.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/**************************************************************************/
/* feed_effects.h */
/**************************************************************************/
/* This file is part of: */
/* REDOT ENGINE */
/* https://redotengine.org */
/**************************************************************************/
/* Copyright (c) 2024-present Redot Engine contributors */
/* (see REDOT_AUTHORS.md) */
/* Copyright (c) 2014-present Godot Engine contributors (see AUTHORS.md). */
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/**************************************************************************/

#ifndef FEED_EFFECTS_GLES3_H
#define FEED_EFFECTS_GLES3_H

#ifdef GLES3_ENABLED

#include "drivers/gles3/shaders/feed.glsl.gen.h"

namespace GLES3 {

class FeedEffects {
private:
struct Feed {
FeedShaderGLES3 shader;
RID shader_version;
} feed;

static FeedEffects *singleton;

GLuint screen_triangle = 0;
GLuint screen_triangle_array = 0;

public:
static FeedEffects *get_singleton();

FeedEffects();
~FeedEffects();

void draw();

private:
void draw_screen_triangle();
};

} // namespace GLES3

#endif // GLES3_ENABLED

#endif // FEED_EFFECTS_GLES3_H
Loading

0 comments on commit 70166f9

Please sign in to comment.