hexsha
stringlengths
40
40
size
int64
7
1.05M
ext
stringclasses
13 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
4
269
max_stars_repo_name
stringlengths
5
109
max_stars_repo_head_hexsha
stringlengths
40
40
max_stars_repo_licenses
listlengths
1
9
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
4
269
max_issues_repo_name
stringlengths
5
116
max_issues_repo_head_hexsha
stringlengths
40
40
max_issues_repo_licenses
listlengths
1
9
max_issues_count
int64
1
48.5k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
4
269
max_forks_repo_name
stringlengths
5
116
max_forks_repo_head_hexsha
stringlengths
40
40
max_forks_repo_licenses
listlengths
1
9
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
7
1.05M
avg_line_length
float64
1.21
330k
max_line_length
int64
6
990k
alphanum_fraction
float64
0.01
0.99
author_id
stringlengths
2
40
66c438e51bf580136bf8a0c9ec54ee9d9a0180e3
1,192
cpp
C++
Codeforces/GYM/UTPC Contest 10-29-21 Div. 2 (Beginner)/E.cpp
MaGnsio/CP-Problems
a7f518a20ba470f554b6d54a414b84043bf209c5
[ "Unlicense" ]
3
2020-11-01T06:31:30.000Z
2022-02-21T20:37:51.000Z
Codeforces/GYM/UTPC Contest 10-29-21 Div. 2 (Beginner)/E.cpp
MaGnsio/CP-Problems
a7f518a20ba470f554b6d54a414b84043bf209c5
[ "Unlicense" ]
null
null
null
Codeforces/GYM/UTPC Contest 10-29-21 Div. 2 (Beginner)/E.cpp
MaGnsio/CP-Problems
a7f518a20ba470f554b6d54a414b84043bf209c5
[ "Unlicense" ]
1
2021-05-05T18:56:31.000Z
2021-05-05T18:56:31.000Z
/** * author: MaGnsi0 * created: 21.11.2021 15:54:14 **/ #include <bits/stdc++.h> using namespace std; void dfs(vector<vector<int>>& adj, int& x, int& maxd, int v = 0, int curd = 0, int par = -1) { if (curd > maxd) { x = v; maxd = curd; } for (auto& u : adj[v]) { if (u == par) { continue; } dfs(adj, x, maxd, u, curd + 1, v); } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; vector<vector<int>> adj1(n); for (int i = 0; i < n - 1; ++i) { int u, v; cin >> u >> v; u--, v--; adj1[u].push_back(v); adj1[v].push_back(u); } int x1 = 0, x2 = 0, maxd1; maxd1 = 0; dfs(adj1, x1, maxd1); maxd1 = 0; dfs(adj1, x2, maxd1, x1); int m; cin >> m; vector<vector<int>> adj2(m); for (int i = 0; i < m - 1; ++i) { int u, v; cin >> u >> v; u--, v--; adj2[u].push_back(v); adj2[v].push_back(u); } int x3 = 0, x4 = 0, maxd2; maxd2 = 0; dfs(adj2, x3, maxd2); maxd2 = 0; dfs(adj2, x4, maxd2, x3); cout << maxd1 + maxd2 + 2; }
21.285714
94
0.439597
MaGnsio
66cb64a7e7ab92f4f426ffa12b5634eee9cf3242
4,161
cpp
C++
test/Filesystem.test.cpp
Brett208/nas2d-core
f9506540f32d34f3c60bc83b87b34460d582ae81
[ "Zlib" ]
null
null
null
test/Filesystem.test.cpp
Brett208/nas2d-core
f9506540f32d34f3c60bc83b87b34460d582ae81
[ "Zlib" ]
null
null
null
test/Filesystem.test.cpp
Brett208/nas2d-core
f9506540f32d34f3c60bc83b87b34460d582ae81
[ "Zlib" ]
null
null
null
#include "NAS2D/Filesystem.h" #include <gtest/gtest.h> #include <gmock/gmock.h> TEST(Filesystem, ConstructDestruct) { EXPECT_NO_THROW(NAS2D::Filesystem fs("", "NAS2DUnitTests", "LairWorks")); } class FilesystemTest : public ::testing::Test { protected: static constexpr auto AppName = "NAS2DUnitTests"; static constexpr auto OrganizationName = "LairWorks"; FilesystemTest() : fs("", AppName, OrganizationName) { fs.mount(fs.basePath()); fs.mount("data/"); fs.mountReadWrite(fs.prefPath()); } NAS2D::Filesystem fs; }; TEST_F(FilesystemTest, basePath) { // Result is a directory, and should end with a directory separator EXPECT_THAT(fs.basePath(), testing::EndsWith(fs.dirSeparator())); } TEST_F(FilesystemTest, prefPath) { // Result is a directory, and should end with a directory separator EXPECT_THAT(fs.prefPath(), testing::EndsWith(fs.dirSeparator())); EXPECT_THAT(fs.prefPath(), testing::HasSubstr(AppName)); } TEST_F(FilesystemTest, extension) { EXPECT_EQ(".txt", fs.extension("subdir/file.txt")); EXPECT_EQ(".txt", fs.extension("file.txt")); EXPECT_EQ(".reallyLongExtensionName", fs.extension("file.reallyLongExtensionName")); EXPECT_EQ(".a", fs.extension("file.a")); EXPECT_EQ(".file", fs.extension(".file")); EXPECT_EQ(".", fs.extension("file.")); EXPECT_EQ("", fs.extension("file")); } TEST_F(FilesystemTest, workingPath) { EXPECT_EQ("data/", fs.workingPath("data/file.extension")); EXPECT_EQ("data/subfolder/", fs.workingPath("data/subfolder/file.extension")); EXPECT_EQ("anotherFolder/", fs.workingPath("anotherFolder/file.extension")); EXPECT_EQ("", fs.workingPath("file.extension")); } TEST_F(FilesystemTest, searchPath) { auto pathList = fs.searchPath(); EXPECT_EQ(3u, pathList.size()); EXPECT_THAT(pathList, Contains(testing::HasSubstr("NAS2DUnitTests"))); EXPECT_THAT(pathList, Contains(testing::HasSubstr("data/"))); } TEST_F(FilesystemTest, directoryList) { auto pathList = fs.directoryList(""); EXPECT_LE(1u, pathList.size()); EXPECT_THAT(pathList, Contains(testing::StrEq("file.txt"))); } TEST_F(FilesystemTest, exists) { EXPECT_TRUE(fs.exists("file.txt")); } TEST_F(FilesystemTest, open) { const auto file = fs.open("file.txt"); EXPECT_EQ("Test data\n", file.bytes()); } // Test a few related methods. Some don't test well standalone. TEST_F(FilesystemTest, writeReadDeleteExists) { const std::string testFilename = "TestFile.txt"; const std::string testData = "Test file contents"; const auto file = NAS2D::File(testData, testFilename); EXPECT_NO_THROW(fs.write(file)); EXPECT_TRUE(fs.exists(testFilename)); // Try to overwrite file, with and without permission EXPECT_NO_THROW(fs.write(file)); EXPECT_THROW(fs.write(file, false), std::runtime_error); const auto fileRead = fs.open(testFilename); EXPECT_EQ(testData, fileRead.bytes()); EXPECT_NO_THROW(fs.del(testFilename)); EXPECT_FALSE(fs.exists(testFilename)); EXPECT_THROW(fs.del(testFilename), std::runtime_error); } TEST_F(FilesystemTest, isDirectoryMakeDirectory) { const std::string fileName = "file.txt"; const std::string folderName = "subfolder/"; EXPECT_TRUE(fs.exists(fileName)); EXPECT_FALSE(fs.isDirectory(fileName)); EXPECT_NO_THROW(fs.makeDirectory(folderName)); EXPECT_TRUE(fs.exists(folderName)); EXPECT_TRUE(fs.isDirectory(folderName)); fs.del(folderName); EXPECT_FALSE(fs.exists(folderName)); EXPECT_FALSE(fs.isDirectory(folderName)); } TEST_F(FilesystemTest, mountUnmount) { const std::string extraMount = "data/extraData/"; const std::string extraFile = "extraFile.txt"; EXPECT_FALSE(fs.exists(extraFile)); EXPECT_NO_THROW(fs.mount(extraMount)); EXPECT_THAT(fs.searchPath(), Contains(testing::HasSubstr(extraMount))); EXPECT_TRUE(fs.exists(extraFile)); EXPECT_NO_THROW(fs.unmount(extraMount)); EXPECT_FALSE(fs.exists(extraFile)); EXPECT_THROW(fs.mount("nonExistentPath/"), std::runtime_error); } TEST_F(FilesystemTest, dirSeparator) { // Varies by platform, so we can't know the exact value ("/", "\", ":") // New platforms may choose a new unique value // Some platforms may not even have a hierarchal filesystem ("") EXPECT_NO_THROW(fs.dirSeparator()); }
30.595588
85
0.738765
Brett208
66cd26240c0319321dde87beff637e079f6e42fa
1,416
cpp
C++
module-platform/rt1051/src/RT1051Platform.cpp
buk7456/MuditaOS
06ef1e131b27b0f397cc615c96d51bede7050423
[ "BSL-1.0" ]
369
2021-11-10T09:20:29.000Z
2022-03-30T06:36:58.000Z
module-platform/rt1051/src/RT1051Platform.cpp
buk7456/MuditaOS
06ef1e131b27b0f397cc615c96d51bede7050423
[ "BSL-1.0" ]
149
2021-11-10T08:38:35.000Z
2022-03-31T23:01:52.000Z
module-platform/rt1051/src/RT1051Platform.cpp
buk7456/MuditaOS
06ef1e131b27b0f397cc615c96d51bede7050423
[ "BSL-1.0" ]
41
2021-11-10T08:30:37.000Z
2022-03-29T08:12:46.000Z
// Copyright (c) 2017-2022, Mudita Sp. z.o.o. All rights reserved. // For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md #include <platform/rt1051/RT1051Platform.hpp> #include "BlockDeviceFactory.hpp" #include <bsp/bsp.hpp> #include <purefs/vfs_subsystem.hpp> #include <exception> #include <Logger.hpp> using platform::rt1051::BlockDeviceFactory; using platform::rt1051::RT1051Platform; RT1051Platform::RT1051Platform() { bsp::board_init(); bsp::register_exit_functions(Log::Logger::destroyInstance); } void RT1051Platform::init() { initFilesystem(); ::platform::Platform::initCommonUserFolders(); } void RT1051Platform::initFilesystem() { if (usesFilesystem) { throw std::runtime_error("Filesystem already initialized"); } auto blockDeviceFactory = std::make_unique<BlockDeviceFactory>(); vfs = purefs::subsystem::initialize(std::move(blockDeviceFactory)); if (int err = purefs::subsystem::mount_defaults(); err != 0) { throw std::runtime_error("Failed to initiate filesystem: " + std::to_string(err)); } usesFilesystem = true; } void platform::rt1051::RT1051Platform::deinit() { if (usesFilesystem) { if (int err = purefs::subsystem::unmount_all(); err != 0) { throw std::runtime_error("Failed to unmount all: " + std::to_string(err)); } usesFilesystem = false; } }
27.230769
91
0.681497
buk7456
66cd5e1884982ac8ef79ca8479e8f2384f267403
13,977
hpp
C++
glm/detail/type_vec5.hpp
gchunev/Dice4D
f96db406204fdca0155d26db856b66a2afd4e664
[ "MIT" ]
1
2019-05-22T08:53:46.000Z
2019-05-22T08:53:46.000Z
glm/detail/type_vec5.hpp
gchunev/Dice4D
f96db406204fdca0155d26db856b66a2afd4e664
[ "MIT" ]
null
null
null
glm/detail/type_vec5.hpp
gchunev/Dice4D
f96db406204fdca0155d26db856b66a2afd4e664
[ "MIT" ]
null
null
null
/// @ref core /// @file glm/detail/type_vec5.hpp #pragma once #include "qualifier.hpp" #include <cstddef> namespace glm { template<typename T, qualifier Q> struct vec<5, T, Q> { // -- Implementation detail -- typedef T value_type; typedef vec<5, T, Q> type; typedef vec<5, bool, Q> bool_type; // -- Data -- # if GLM_SILENT_WARNINGS == GLM_ENABLE # if GLM_COMPILER & GLM_COMPILER_GCC # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wpedantic" # elif GLM_COMPILER & GLM_COMPILER_CLANG # pragma clang diagnostic push # pragma clang diagnostic ignored "-Wgnu-anonymous-struct" # pragma clang diagnostic ignored "-Wnested-anon-types" # elif GLM_COMPILER & GLM_COMPILER_VC # pragma warning(push) # pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union # if GLM_CONFIG_ALIGNED_GENTYPES == GLM_ENABLE # pragma warning(disable: 4324) // structure was padded due to alignment specifier # endif # endif # endif # if GLM_CONFIG_XYZW_ONLY T x, y, z, w, v; # elif GLM_CONFIG_ANONYMOUS_STRUCT == GLM_ENABLE union { struct{ T x, y, z, w, v; }; struct{ T r, g, b, a, d; }; struct{ T s, t, p, q, k; }; typename detail::storage<5, T, detail::is_aligned<Q>::value>::type data; }; # else union { T x, y, z, w, v; }; union { T r, g, b, a, d; }; union { T s, t, p, q, k; }; # endif//GLM_LANG # if GLM_SILENT_WARNINGS == GLM_ENABLE # if GLM_COMPILER & GLM_COMPILER_CLANG # pragma clang diagnostic pop # elif GLM_COMPILER & GLM_COMPILER_GCC # pragma GCC diagnostic pop # elif GLM_COMPILER & GLM_COMPILER_VC # pragma warning(pop) # endif # endif // -- Component accesses -- /// Return the count of components of the vector typedef length_t length_type; GLM_FUNC_DECL static GLM_CONSTEXPR length_type length(){return 5;} GLM_FUNC_DECL GLM_CONSTEXPR T & operator[](length_type i); GLM_FUNC_DECL GLM_CONSTEXPR T const& operator[](length_type i) const; // -- Implicit basic constructors -- GLM_FUNC_DECL GLM_CONSTEXPR vec() GLM_DEFAULT; GLM_FUNC_DECL GLM_CONSTEXPR vec(vec const& v) GLM_DEFAULT; template<qualifier P> GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<5, T, P> const& v); // -- Explicit basic constructors -- GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(T scalar); GLM_FUNC_DECL GLM_CONSTEXPR vec(T a, T b, T c, T d, T e); // -- Conversion scalar constructors -- template<typename U, qualifier P> GLM_FUNC_DECL GLM_CONSTEXPR explicit vec(vec<1, U, P> const& v); // -- Conversion vector constructors -- template<typename A, typename B, qualifier P> GLM_FUNC_DECL GLM_CONSTEXPR vec(vec<4, A, P> const& _xyzw, B _v); /// Explicit conversions template<typename U, qualifier P> GLM_FUNC_DECL GLM_CONSTEXPR GLM_EXPLICIT vec(vec<5, U, P> const& v); // -- Unary arithmetic operators -- GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q>& operator=(vec<5, T, Q> const& v) GLM_DEFAULT; template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator=(vec<5, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator+=(U scalar); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator+=(vec<1, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator+=(vec<5, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator-=(U scalar); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator-=(vec<1, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator-=(vec<5, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator*=(U scalar); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator*=(vec<1, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator*=(vec<5, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator/=(U scalar); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator/=(vec<1, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator/=(vec<5, U, Q> const& v); // -- Increment and decrement operators -- GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator++(); GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator--(); GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator++(int); GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator--(int); // -- Unary bit operators -- template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator%=(U scalar); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator%=(vec<1, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator%=(vec<5, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator&=(U scalar); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator&=(vec<1, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator&=(vec<5, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator|=(U scalar); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator|=(vec<1, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator|=(vec<5, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator^=(U scalar); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator^=(vec<1, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator^=(vec<5, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator<<=(U scalar); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator<<=(vec<1, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator<<=(vec<5, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator>>=(U scalar); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator>>=(vec<1, U, Q> const& v); template<typename U> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> & operator>>=(vec<5, U, Q> const& v); }; // -- Unary operators -- template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator+(vec<5, T, Q> const& v); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator-(vec<5, T, Q> const& v); // -- Binary operators -- template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator+(vec<5, T, Q> const& v, T scalar); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator+(vec<5, T, Q> const& v, vec<1, T, Q> const& scalar); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator+(T scalar, vec<5, T, Q> const& v); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator+(vec<1, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator+(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator-(vec<5, T, Q> const& v, T scalar); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator-(vec<5, T, Q> const& v1, vec<1, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator-(T scalar, vec<5, T, Q> const& v); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator-(vec<1, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator-(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator*(vec<5, T, Q> const& v, T scalar); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator*(vec<5, T, Q> const& v1, vec<1, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator*(T scalar, vec<5, T, Q> const& v); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator*(vec<1, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator*(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator/(vec<5, T, Q> const& v, T scalar); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator/(vec<5, T, Q> const& v1, vec<1, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator/(T scalar, vec<5, T, Q> const& v); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator/(vec<1, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator/(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator%(vec<5, T, Q> const& v, T scalar); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator%(vec<5, T, Q> const& v1, vec<1, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator%(T scalar, vec<5, T, Q> const& v); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator%(vec<1, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator%(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator&(vec<5, T, Q> const& v1, T scalar); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator&(vec<5, T, Q> const& v1, vec<1, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator&(T scalar, vec<5, T, Q> const& v); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator&(vec<1, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator&(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator|(vec<5, T, Q> const& v, T scalar); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator|(vec<5, T, Q> const& v1, vec<1, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator|(T scalar, vec<5, T, Q> const& v); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator|(vec<1, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator|(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator^(vec<5, T, Q> const& v, T scalar); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator^(vec<5, T, Q> const& v1, vec<1, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator^(T scalar, vec<5, T, Q> const& v); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator^(vec<1, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator^(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator<<(vec<5, T, Q> const& v, T scalar); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator<<(vec<5, T, Q> const& v1, vec<1, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator<<(T scalar, vec<5, T, Q> const& v); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator<<(vec<1, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator<<(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator>>(vec<5, T, Q> const& v, T scalar); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator>>(vec<5, T, Q> const& v1, vec<1, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator>>(T scalar, vec<5, T, Q> const& v); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator>>(vec<1, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator>>(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, T, Q> operator~(vec<5, T, Q> const& v); // -- Boolean operators -- template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR bool operator==(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<typename T, qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR bool operator!=(vec<5, T, Q> const& v1, vec<5, T, Q> const& v2); template<qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, bool, Q> operator&&(vec<5, bool, Q> const& v1, vec<5, bool, Q> const& v2); template<qualifier Q> GLM_FUNC_DECL GLM_CONSTEXPR vec<5, bool, Q> operator||(vec<5, bool, Q> const& v1, vec<5, bool, Q> const& v2); }//namespace glm #ifndef GLM_EXTERNAL_TEMPLATE #include "type_vec5.inl" #endif//GLM_EXTERNAL_TEMPLATE
38.717452
110
0.686628
gchunev
66cfd0d171eeeb1358dba701d9c51814d629158d
2,469
cpp
C++
stringext.cpp
AlpsMonaco/BinInCpp
feffcda6ae63b81946aefbaa88dbb1559c22217f
[ "MIT" ]
null
null
null
stringext.cpp
AlpsMonaco/BinInCpp
feffcda6ae63b81946aefbaa88dbb1559c22217f
[ "MIT" ]
null
null
null
stringext.cpp
AlpsMonaco/BinInCpp
feffcda6ae63b81946aefbaa88dbb1559c22217f
[ "MIT" ]
null
null
null
#include "stringext.h" namespace stringext { void ReplaceAll(std::string &s, const std::string &from, const std::string &to) { size_t index = 0; while ((index = s.find(from, index)) != std::string::npos) { s.replace(index, from.length(), to); index += to.length(); } } void ReplaceAll(std::string &s, const char *from, const char *to) { ReplaceAll(s, std::string(from), std::string(to)); } std::vector<std::string> Split(const std::string &s, const std::string &sep) { size_t begin = 0; size_t end = 0; std::vector<std::string> v; while ((end = s.find(sep, begin)) != std::string::npos) { v.push_back(s.substr(begin, end - begin)); begin = end + sep.length(); } if (s.length() > begin) v.push_back(s.substr(begin, s.length() - begin)); return v; } std::vector<std::string> Split(const std::string &s, const char *sep) { return Split(s, std::string(sep)); } const std::string SpaceCharacters = " \t\r\n"; void TrimSpace(std::string &s) { TrimSpaceLeft(s); TrimSpaceRight(s); } void TrimSpaceLeft(std::string &s) { size_t size = 0; for (auto it = s.begin(); it < s.end(); it++) { if (SpaceCharacters.find(*it) != std::string::npos) size++; else break; } s.replace(0, size, ""); } void TrimSpaceRight(std::string &s) { size_t size = 0; for (auto it = s.rbegin(); it < s.rend(); it++) { if (SpaceCharacters.find(*it) != std::string::npos) size++; else break; } s.replace(s.length() - size, size, ""); } std::string Join(const std::vector<std::string> &stringVector, const std::string &sep) { if (stringVector.size() == 0) return ""; std::string result; for (std::vector<std::string>::const_iterator it = stringVector.begin(); it < stringVector.end() - 1; it++) result += *it + sep; result += *(stringVector.end() - 1); return result; } std::string Join(const std::vector<std::string> &stringVector, const char *sep) { if (stringVector.size() == 0) return ""; std::string result; for (std::vector<std::string>::const_iterator it = stringVector.begin(); it < stringVector.end() - 1; it++) result += *it + sep; result += *(stringVector.end() - 1); return result; } void ToUpper(std::string &s) { for (std::string::iterator it = s.begin(); it < s.end(); it++) *it = ::toupper(*it); } void ToLower(std::string &s) { for (std::string::iterator it = s.begin(); it < s.end(); it++) *it = ::tolower(*it); } }
24.69
121
0.603888
AlpsMonaco
66d2e2e4b36375ec233ca1ff385b825f3712d3c7
704
cpp
C++
matu137.cpp
NewtonVan/Fxxk_Y0u_m47u
d303c7f13c074b5462ac8390a9ff94e546099fac
[ "MIT" ]
1
2020-09-26T16:47:16.000Z
2020-09-26T16:47:16.000Z
matu137.cpp
NewtonVan/Fxxk_Y0u_m47u
d303c7f13c074b5462ac8390a9ff94e546099fac
[ "MIT" ]
null
null
null
matu137.cpp
NewtonVan/Fxxk_Y0u_m47u
d303c7f13c074b5462ac8390a9ff94e546099fac
[ "MIT" ]
1
2020-09-26T16:47:40.000Z
2020-09-26T16:47:40.000Z
#include <cstdio> #include <iostream> #include <algorithm> #include <cstring> #include <cmath> using namespace std; class Ctriangle{ double a, b, c; public: Ctriangle(double aa, double bb, double cc) : a(aa), b(bb), c(cc){} Ctriangle(){} void display(); double GetArea(); double GetPerimeter(); }; void Ctriangle::display() { printf("Ctriangle:a=%.0f,b=%.0f,c=%.0f\n", a, b, c); } double Ctriangle::GetPerimeter() { return a+b+c; } double Ctriangle::GetArea() { double p= (a+b+c)/2; return sqrt(p*(p-a)*(p-b)*(p-c)); } int main(){ double a,b,c; cin>>a>>b>>c; Ctriangle T(a,b,c); T.display(); cout<<"Perimeter:"<<T.GetPerimeter()<<endl; cout<<"Area:"<<T.GetArea()<<endl; return 0; }
17.170732
67
0.629261
NewtonVan
202d43b10ae1b8103a0820ce6478817f52ba4094
1,261
cpp
C++
cuda/CudaPartition.cpp
jdinkla/parallel2015_gpucomputing
15654399897d891637bb466bcca0e5aa73c22fce
[ "MIT" ]
1
2020-03-13T18:40:07.000Z
2020-03-13T18:40:07.000Z
cuda/CudaPartition.cpp
jdinkla/parallel2015_gpucomputing
15654399897d891637bb466bcca0e5aa73c22fce
[ "MIT" ]
1
2019-06-09T14:33:31.000Z
2019-06-18T20:35:30.000Z
cuda/CudaPartition.cpp
jdinkla/parallel2015_gpucomputing
15654399897d891637bb466bcca0e5aa73c22fce
[ "MIT" ]
null
null
null
/* * Copyright (c) 2015 by Joern Dinkla, www.dinkla.com, All rights reserved. * * See the LICENSE file in the root directory. */ #include "CudaPartition.h" using namespace std; vector<CudaPartition> calc_partitions(GPUs& gpus, const Extent2& extent) { vector<CudaPartition> partitions; const int num_gpus = gpus.get_number_of_gpus(); const int width = extent.get_width(); const int height = extent.get_height(); partition_t ps1 = partition(0, height - 1, num_gpus); partition_t ps2 = partition(0, height - 1, num_gpus, 1); partitions.clear(); int i = 0; for (auto& gpu : gpus) { int y_low, y_hi, y_len; y_low = ps2[i].first; y_hi = ps2[i].second; y_len = y_hi - y_low + 1; Extent2 local_extent_with_overlap(width, y_len); Pos2 offset_with_overlap(0, y_low); y_low = ps1[i].first; y_hi = ps1[i].second; y_len = y_hi - y_low + 1; Extent2 local_extent_without_overlap(width, y_len); Pos2 offset_without_overlap(0, y_low); framework f{ gpu }; data d{ XExtent2(extent, local_extent_with_overlap, offset_with_overlap, local_extent_without_overlap, offset_without_overlap) }; CudaPartition p{ i, f, d }; partitions.push_back(p); i++; } return partitions; }
23.792453
132
0.680412
jdinkla
20340d83f323bb09267d40a675a18c7c2f7c80d2
9,849
cpp
C++
windows_agent/TestCollect/SoftwareCollector.cpp
syslist/Syslist
1b8c1051a6423a98bdc09d55904f2de63b3fe95c
[ "MIT" ]
7
2016-08-07T01:11:30.000Z
2021-01-27T11:03:02.000Z
windows_agent/TestCollect/SoftwareCollector.cpp
syslist/Syslist
1b8c1051a6423a98bdc09d55904f2de63b3fe95c
[ "MIT" ]
1
2018-07-02T14:01:04.000Z
2018-07-02T14:01:04.000Z
windows_agent/TestCollect/SoftwareCollector.cpp
syslist/Syslist
1b8c1051a6423a98bdc09d55904f2de63b3fe95c
[ "MIT" ]
6
2016-12-01T02:11:39.000Z
2022-03-26T03:31:27.000Z
#include "stdafx.h" #include "SoftwareCollector.h" #include "KeyDecode.h" #include <sstream> char SW_INFO_PATH[] = "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"; char SW_MS_OFFICE_PATH[] = "Software\\Microsoft\\Office"; long SW_INFO_PATH_LEN = sizeof (SW_INFO_PATH); char* SWCL_TAG = "SoftwareList"; char* SWC_TAG = "Program"; static RegObjValueEntry ProcessorItems[] = { RegObjValueEntry("DisplayName"), RegObjValueEntry("DisplayVersion"), RegObjValueEntry("Publisher"), RegObjValueEntry("VersionMajor"), RegObjValueEntry("VersionMinor"), (NULL) }; static std::map<std::string,std::string> MSOffice10PlusMap; static std::map<std::string,std::string> MSOffice10PlusMapID; static std::map<int,std::string> MSOfficePre10Map; long PopulateOfficeMap() { AutoRegKey EnumKey; long Status; #ifdef INSTRUMENTED MessageBox (NULL, "Office Zero", "Report", MB_OK); #endif Status = RegOpenKeyEx (HKEY_LOCAL_MACHINE, SW_MS_OFFICE_PATH, 0, KEY_READ, &EnumKey); W32_RETURN_ON_ERROR(Status); #ifdef INSTRUMENTED MessageBox (NULL, "Office Alpha", "Report", MB_OK); #endif DWORD ItemCount = 0; Status = RegQueryInfoKey(EnumKey, // HKEY NULL, // lpClass NULL, // lpcbClass NULL, // lpReserved &ItemCount, //lpcSubKeys NULL, // lpcbMaxSubKeyLen NULL, // lpcbMaxClassLen NULL, // lpcValues NULL, // lpcbMaxValueNameLen NULL, // lpcbMaxValueLen NULL, // lpcbSecurityDescriptor NULL); // lpftLastWriteTime W32_RETURN_ON_ERROR(Status); #ifdef INSTRUMENTED MessageBox (NULL, "Office Beta", "Report", MB_OK); #endif long EnumIndex; char EnumSubKeyNameBuf[256]; DWORD EnumSubKeyNameLen; for (EnumIndex = 0; EnumIndex < ItemCount; EnumIndex ++) { EnumSubKeyNameLen = 256; Status = RegEnumKeyExA(EnumKey, EnumIndex, EnumSubKeyNameBuf, &EnumSubKeyNameLen, NULL, NULL, NULL, NULL); if (Status == ERROR_NO_MORE_ITEMS) break; else { W32_RETURN_ON_ERROR(Status); } #ifdef INSTRUMENTED_DEEP MessageBox (NULL, "Office Gamma", "Report", MB_OK); #endif // Skip it this entry if it was not a version number if (!isdigit(EnumSubKeyNameBuf[0])) { continue; } int VersionNum; int ScanCount = 0; ScanCount = sscanf (EnumSubKeyNameBuf,"%d", &VersionNum); if (ScanCount != 1) { continue; } AutoRegKey EnumSubKey; std::ostringstream RegInfoSubPath; RegInfoSubPath << SW_MS_OFFICE_PATH << "\\" << EnumSubKeyNameBuf << "\\" << "Registration"; // Pre version 10 cuts straight to the chase with a sub key called ProductID if (VersionNum < 10) { RegInfoSubPath << "\\" << "ProductID"; } Status = RegOpenKeyEx (HKEY_LOCAL_MACHINE, RegInfoSubPath.str().c_str(), 0, KEY_READ, &EnumSubKey); if (Status != ERROR_SUCCESS) { continue; } #ifdef INSTRUMENTED_DEEP MessageBox (NULL, "Office Delta", "Report", MB_OK); #endif if (VersionNum < 10) { // Old Style Prog ID extraction - The registration // key has the information we need - simply extract // it and add to the pre version 10 table - We index // off of the version number later to match it up char ProdID[256]; unsigned long ItemSize = 256; DWORD ItemType = REG_SZ; #ifdef INSTRUMENTED_DEEP MessageBox (NULL, "Office EpsilonAlpha", "Report", MB_OK); #endif Status = RegQueryValueEx( EnumSubKey, // handle to key to query NULL, // address of name of value to query NULL, // reserved &ItemType, // address of buffer for value type (unsigned char *) ProdID, // address of data buffer &ItemSize // address of data buffer size ); if (Status != ERROR_SUCCESS) { continue; } #ifdef INSTRUMENTED_DEEP MessageBox (NULL, "Office EpsilonBeta", "Report", MB_OK); #endif MSOfficePre10Map[VersionNum] = std::string(ProdID); } else { // New Style Prog ID extraction - The registration // key has the information in a series of GUID // indexed sub keys, Those GUID keys have a ProductID // value that has what we need - we index off of the // GUID later to match it up unsigned long RegCount = 0; Status = RegQueryInfoKey(EnumSubKey, // HKEY NULL, // lpClass NULL, // lpcbClass NULL, // lpReserved &RegCount, //lpcSubKeys NULL, // lpcbMaxSubKeyLen NULL, // lpcbMaxClassLen NULL, // lpcValues NULL, // lpcbMaxValueNameLen NULL, // lpcbMaxValueLen NULL, // lpcbSecurityDescriptor NULL); // lpftLastWriteTime if (Status != ERROR_SUCCESS) { continue; } // Iterate over the GUID keys to extract the ProductID keys for (long SubEnumIndex = 0; SubEnumIndex < RegCount; SubEnumIndex ++) { EnumSubKeyNameLen = 256; char ProdGUID[256]; #ifdef INSTRUMENTED_DEEP MessageBox (NULL, "Office IotaAlpha", "Report", MB_OK); #endif Status = RegEnumKeyExA(EnumSubKey, SubEnumIndex, ProdGUID, &EnumSubKeyNameLen, NULL, NULL, NULL, NULL); if (Status == ERROR_NO_MORE_ITEMS) { break; } else if (Status != ERROR_SUCCESS){ continue; } AutoRegKey ProdIDKey; #ifdef INSTRUMENTED_DEEP MessageBox (NULL, "Office IotaBeta", "Report", MB_OK); #endif Status = RegOpenKeyEx(EnumSubKey, ProdGUID, 0, KEY_READ, &ProdIDKey); if (Status != ERROR_SUCCESS) { continue; } char ProdID[256]; unsigned long ItemSize = 256; DWORD ItemType = REG_SZ; #ifdef INSTRUMENTED_DEEP MessageBox (NULL, "Office IotaDelta", "Report", MB_OK); #endif Status = RegQueryValueEx( ProdIDKey, // handle to key to query "ProductID", // address of name of value to query NULL, // reserved &ItemType, // address of buffer for value type (unsigned char *) ProdID, // address of data buffer &ItemSize // address of data buffer size ); if (Status == ERROR_SUCCESS) { MSOffice10PlusMap[std::string(ProdGUID)] = std::string(ProdID); } ItemSize = 256; ItemType = REG_BINARY; Status = RegQueryValueEx( ProdIDKey, // handle to key to query "DigitalProductID", // address of name of value to query NULL, // reserved &ItemType, // address of buffer for value type (unsigned char *) ProdID, // address of data buffer &ItemSize // address of data buffer size ); if (Status == ERROR_SUCCESS) { char decodeKey[kDecodeKeyLen + 1]; if (DecodeMSKeyReg(decodeKey, ProdID) == ERROR_SUCCESS) { MSOffice10PlusMapID[std::string(ProdGUID)] = std::string(decodeKey); } } } } } #ifdef INSTRUMENTED MessageBox (NULL, "Office EXIT!", "Report", MB_OK); #endif return ERROR_SUCCESS; } long SoftwareCollector::CollectSingleProgram (HKEY SubKey, char * SubKeyName, NVDataItem * TargetData, bool * KeepItem) { const char* DispName = NULL; TargetData->GetValueByName("DisplayName", & DispName); if (DispName == NULL) { *KeepItem = false; return ERROR_SUCCESS; } if (strstr(DispName, "Microsoft Office") != NULL) { const char * VersionString = NULL; TargetData->GetValueByName ("DisplayVersion", & VersionString); if (VersionString == NULL) return ERROR_SUCCESS; int ScanCount = 0; int VersionNum = 0; ScanCount = sscanf(VersionString,"%d",& VersionNum); if (ScanCount != 1) return ERROR_SUCCESS; if (VersionNum < 10) { std::map<int, std::string>::iterator VersionItem; VersionItem = MSOfficePre10Map.find(VersionNum); if (VersionItem == MSOfficePre10Map.end()) return ERROR_SUCCESS; TargetData->AddNVItem("SerialNumber", VersionItem->second.c_str()); } else { std::map<std::string, std::string>::iterator VersionItem; VersionItem = MSOffice10PlusMap.find(std::string(SubKeyName)); if (VersionItem != MSOffice10PlusMap.end()) { TargetData->AddNVItem("SerialNumber", VersionItem->second.c_str()); } VersionItem = MSOffice10PlusMapID.find(std::string(SubKeyName)); if (VersionItem != MSOffice10PlusMapID.end()) { TargetData->AddNVItem("ProductKey", VersionItem->second.c_str()); } } return ERROR_SUCCESS; } const char * MfrName = NULL; TargetData->GetValueByName ("Publisher", & MfrName); if (MfrName != NULL && strstr(MfrName, "Adobe") != NULL) { long Status; DWORD ItemType = REG_SZ; char SerialFromKey[256] = {0}; unsigned long ItemSize = 256; Status = RegQueryValueEx( SubKey, "SERIAL", NULL, &ItemType, (unsigned char *) SerialFromKey, &ItemSize); if (Status != ERROR_SUCCESS) { return ERROR_SUCCESS; } TargetData->AddNVItem("SerialNumber", SerialFromKey); } return ERROR_SUCCESS; } long SoftwareCollector::Collect(NVDataItem **ReturnItem) { #ifdef INSTRUMENTED MessageBox (NULL, "Software STARTING!", "Report", MB_OK); #endif auto_ptr<NVDataItem> DataItems (new NVDataItem(SWCL_TAG)); long Status; #ifdef INSTRUMENTED MessageBox(NULL, "Starting Office Detection", "Report", MB_OK); #endif Status = PopulateOfficeMap(); #ifdef INSTRUMENTED MessageBox(NULL, "Finished Office Starting Main!", "Report", MB_OK); #endif Status = RegEnumerateSubKeys(HKEY_LOCAL_MACHINE, SW_INFO_PATH, SWC_TAG, DataItems.get(), ProcessorItems, CollectSingleProgram, NULL); W32_RETURN_ON_ERROR(Status); *ReturnItem = DataItems.release(); #ifdef INSTRUMENTED MessageBox(NULL, "Software Complete!", "Report", MB_OK); #endif return ERROR_SUCCESS; }
28.301724
135
0.648797
syslist
203532959ca2a192bf9409770eb25396ad402125
1,599
cpp
C++
window.cpp
lewez/zombie-game
fdfefc312aaac4848a025c150e0862ca37a71fca
[ "MIT" ]
1
2019-04-26T12:57:05.000Z
2019-04-26T12:57:05.000Z
window.cpp
lewez/zombie-game
fdfefc312aaac4848a025c150e0862ca37a71fca
[ "MIT" ]
null
null
null
window.cpp
lewez/zombie-game
fdfefc312aaac4848a025c150e0862ca37a71fca
[ "MIT" ]
null
null
null
/* MIT License Copyright (c) 2019 Lewis Clark 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. */ #include "window.h" game::Window::~Window() { Destroy(); } game::Window::Window(SDL_Window* sdlwin) : m_sdlwin(sdlwin) { } game::Renderer* game::Window::CreateRenderer(std::uint32_t flags) { SDL_Renderer* sdlren = SDL_CreateRenderer(m_sdlwin, -1, flags); if (!sdlren) { return nullptr; } m_renderers.push_back(std::make_unique<Renderer>(sdlren)); return m_renderers.back().get(); } void game::Window::Destroy() { for (const auto& ren : m_renderers) { ren->Destroy(); } SDL_DestroyWindow(m_sdlwin); }
29.611111
78
0.762977
lewez
2038570c3414f4bccef2da6105fff771dbe0df27
3,083
cpp
C++
p2p/xxx/peer_storage.cpp
akhavr/beam
99e427f6ba0a0ee1a0dbe598d0fa6d642e571d62
[ "Apache-2.0" ]
null
null
null
p2p/xxx/peer_storage.cpp
akhavr/beam
99e427f6ba0a0ee1a0dbe598d0fa6d642e571d62
[ "Apache-2.0" ]
null
null
null
p2p/xxx/peer_storage.cpp
akhavr/beam
99e427f6ba0a0ee1a0dbe598d0fa6d642e571d62
[ "Apache-2.0" ]
null
null
null
// Copyright 2018 The Beam Team // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #include "peer_storage.h" #include <errno.h> namespace beam { using namespace io; static constexpr size_t ITEM_SIZE = sizeof(PeerInfo); PeerStorage::~PeerStorage() { close(); } Result PeerStorage::open(const std::string& fileName) { if (_file) close(); _file = fopen(fileName.c_str(), "a+b"); ErrorCode errorCode = EC_OK; if (!_file) { #ifndef _WIN32 errorCode = ErrorCode(-errno); #else errorCode = EC_EACCES; //TODO GetLastError and map into io::Error or whatever #endif } return make_result(errorCode); } static bool seek_end(FILE* f, long& offset) { if (fseek(f, 0, SEEK_END) != 0) return false; offset = ftell(f); return true; } static bool seek_to(FILE* f, long offset) { return fseek(f, offset, SEEK_SET) == 0; } Result PeerStorage::load_peers(const LoadCallback& cb) { ErrorCode ec = EC_EBADF; if (!_file) { return make_unexpected(ec); } long length=0; if (!(seek_end(_file, length) && seek_to(_file, 0))) { return make_unexpected(ec); } if (length % ITEM_SIZE != 0) { return make_unexpected(EC_FILE_CORRUPTED); } size_t nPeers = length / ITEM_SIZE; PeerInfo peer; for (size_t i=0; i<nPeers; ++i) { if (ITEM_SIZE != fread(&peer, 1, ITEM_SIZE, _file)) { return make_unexpected(EC_EOF); } _index[peer.sessionId] = ITEM_SIZE * i; cb(peer); } return Ok(); } Result PeerStorage::forget_old_peers(uint32_t howLong) { // TODO compact db return Ok(); } Result PeerStorage::update_peer(const PeerInfo& peer) { ErrorCode ec = EC_EBADF; if (!_file) { return make_unexpected(ec); } auto it = _index.find(peer.sessionId); long offset=0; if (it == _index.end()) { if (!seek_end(_file, offset)) { return make_unexpected(ec); } _index[peer.sessionId] = offset; } else { offset = _index[peer.sessionId]; if (!seek_to(_file, offset)) { return make_unexpected(ec); } } if (ITEM_SIZE != fwrite(&peer, 1, ITEM_SIZE, _file)) { _index.erase(peer.sessionId); return make_unexpected(ec); } return Ok(); } void PeerStorage::close() { if (_file) { fclose(_file); _file = 0; _index.clear(); } } } //namespace
24.862903
86
0.600389
akhavr
203a1e29d6c664f030bff9cd2c44a3894a036e38
193
hpp
C++
libs/numeric/mtl/examples/gdbinit_example.hpp
lit-uriy/mtl4-mirror
37cf7c2847165d3537cbc3400cb5fde6f80e3d8b
[ "MTLL" ]
24
2019-03-26T15:25:45.000Z
2022-03-26T10:00:45.000Z
libs/numeric/mtl/examples/gdbinit_example.hpp
lit-uriy/mtl4-mirror
37cf7c2847165d3537cbc3400cb5fde6f80e3d8b
[ "MTLL" ]
2
2020-04-17T12:35:32.000Z
2021-03-03T15:46:25.000Z
libs/numeric/mtl/examples/gdbinit_example.hpp
lit-uriy/mtl4-mirror
37cf7c2847165d3537cbc3400cb5fde6f80e3d8b
[ "MTLL" ]
10
2019-12-01T13:40:30.000Z
2022-01-14T08:39:54.000Z
python import sys # STL support and alike here sys.path.insert(0, '/home/username/tools/gdb_printers/python') from mtl.printers import register_mtl_printers register_mtl_printers (None) end
17.545455
62
0.80829
lit-uriy
2044e9c642160319e9658cb48ad579f1efad6561
6,323
cpp
C++
Frameworks/Helmet/Core/src/Plugin/Environment.cpp
hatboysoftware/helmet
97f26d134742fdb732abc6177bb2adaeb67b3187
[ "Zlib" ]
2
2018-02-07T01:19:37.000Z
2018-02-09T14:27:48.000Z
Frameworks/Helmet/Core/src/Plugin/Environment.cpp
hatboysoftware/helmet
97f26d134742fdb732abc6177bb2adaeb67b3187
[ "Zlib" ]
null
null
null
Frameworks/Helmet/Core/src/Plugin/Environment.cpp
hatboysoftware/helmet
97f26d134742fdb732abc6177bb2adaeb67b3187
[ "Zlib" ]
null
null
null
//-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ // Helmet Software Framework // // Copyright (C) 2018 Hat Boy Software, Inc. // // @author Matthew Alan Gray - <mgray@hatboysoftware.com> //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ #include "Environment.hpp" #include <boost/log/trivial.hpp> #include <boost/property_tree/json_parser.hpp> //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ namespace Helmet { namespace Core { namespace Plugin { //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ Environment::Environment() : m_configuration() , m_sessionInfo() { } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ Environment::~Environment() { } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ bool Environment::loadConfiguration(const boost::filesystem::path& _path) { if (boost::filesystem::exists(_path)) { std::ifstream fileStream; fileStream.open(_path.string(), std::ios_base::in | std::ios_base::binary); if (loadConfiguration(fileStream)) { BOOST_LOG_TRIVIAL(info) << "Loaded configuration from " << _path; return true; } } BOOST_LOG_TRIVIAL(error) << "Configuration file " << _path << " does not exist."; return false; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ bool Environment::loadConfiguration(std::istream& _input) { try { std::stringstream json; json << _input.rdbuf(); read_json(json, m_configuration); return true; } catch (std::exception& _ex) { BOOST_LOG_TRIVIAL(error) << "Environment::loadConfiguration() : " << _ex.what(); } return false; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ bool Environment::saveConfiguration(const boost::filesystem::path& _path) { std::ofstream fileStream; fileStream.open(_path.string(), std::ios_base::out | std::ios_base::trunc); if (saveConfiguration(fileStream)) { BOOST_LOG_TRIVIAL(info) << "Saved configuration to " << _path; return true; } BOOST_LOG_TRIVIAL(error) << "Error saving configuration to " << _path; return false; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ bool Environment::saveConfiguration(std::ostream& _output) { try { write_json(_output, m_configuration); return true; } catch (std::exception& _ex) { BOOST_LOG_TRIVIAL(error) << "Environment::saveConfiguration() : " << _ex.what(); } return false; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ void Environment::writeConfigurationField(const std::string& _key, const std::string& _value) { m_configuration.put(_key, _value); } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ bool Environment::loadSessionInfo(const boost::filesystem::path& _path) { if (boost::filesystem::exists(_path)) { std::ifstream fileStream; fileStream.open(_path.string(), std::ios_base::in | std::ios_base::binary); if (loadSessionInfo(fileStream)) { BOOST_LOG_TRIVIAL(info) << "Loaded session info from " << _path; return true; } } BOOST_LOG_TRIVIAL(error) << "Session info file " << _path << " does not exist."; return false; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ bool Environment::loadSessionInfo(std::istream& _input) { try { std::stringstream json; json << _input.rdbuf(); read_json(json, m_sessionInfo); return true; } catch (std::exception& _ex) { BOOST_LOG_TRIVIAL(error) << "Environment::loadSessionInfo() : " << _ex.what(); } return false; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ bool Environment::saveSessionInfo(const boost::filesystem::path& _path) { std::ofstream fileStream; fileStream.open(_path.string(), std::ios_base::out | std::ios_base::trunc); if (saveSessionInfo(fileStream)) { BOOST_LOG_TRIVIAL(info) << "Saved session info to " << _path; return true; } BOOST_LOG_TRIVIAL(error) << "Error saving session info to " << _path; return false; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ bool Environment::saveSessionInfo(std::ostream& _output) { try { write_json(_output, m_sessionInfo); return true; } catch (std::exception& _ex) { BOOST_LOG_TRIVIAL(error) << "Environment::saveSessionInfo() : " << _ex.what(); } return false; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ void Environment::writeSessionInfoField(const std::string& _key, const std::string& _value) { m_sessionInfo.put(_key, _value); } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ template<class Ptree> inline Ptree &empty_ptree() { static Ptree pt; return pt; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ boost::property_tree::ptree& Environment::operator[](const std::string& _key) { if (m_configuration.get_child_optional(_key).is_initialized()) { return m_configuration.get_child(_key); } else if (m_sessionInfo.get_child_optional(_key).is_initialized()) { return m_sessionInfo.get_child(_key); } return empty_ptree<boost::property_tree::ptree>(); } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ boost::property_tree::ptree& Environment::getConfiguration() { return m_configuration; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ boost::property_tree::ptree& Environment::getSession() { return m_sessionInfo; } //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~ } // namespace Plugin } // namespace Core } // namespace Helmet //-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~
27.732456
88
0.47177
hatboysoftware
20454b4a1188ce6f0f195b84a5ec271f929c65d9
366
hpp
C++
src/Ast/LessThanCondition.hpp
JCube001/pl0
a6ce723ffc7f639ab64d1a06946990fb6ec295d5
[ "MIT" ]
null
null
null
src/Ast/LessThanCondition.hpp
JCube001/pl0
a6ce723ffc7f639ab64d1a06946990fb6ec295d5
[ "MIT" ]
null
null
null
src/Ast/LessThanCondition.hpp
JCube001/pl0
a6ce723ffc7f639ab64d1a06946990fb6ec295d5
[ "MIT" ]
null
null
null
#ifndef PL0_AST_LESS_THAN_CONDITION_HPP #define PL0_AST_LESS_THAN_CONDITION_HPP #include "Ast/BinaryCondition.hpp" namespace PL0 { namespace Ast { struct LessThanCondition final : public BinaryCondition { void accept(Visitor& visitor) override { visitor.visit(*this); } }; } // namespace Ast } // namespace PL0 #endif // PL0_AST_LESS_THAN_CONDITION_HPP
19.263158
55
0.773224
JCube001
204a893f0e0c67829072d10a9fbc2d3baa2e1675
3,588
hpp
C++
include/chopper/build/read_data_file_and_set_high_level_bins.hpp
Felix-Droop/Chopper
5cc214103b2d088ae400bec0fde8973e03dd3095
[ "BSD-3-Clause" ]
null
null
null
include/chopper/build/read_data_file_and_set_high_level_bins.hpp
Felix-Droop/Chopper
5cc214103b2d088ae400bec0fde8973e03dd3095
[ "BSD-3-Clause" ]
null
null
null
include/chopper/build/read_data_file_and_set_high_level_bins.hpp
Felix-Droop/Chopper
5cc214103b2d088ae400bec0fde8973e03dd3095
[ "BSD-3-Clause" ]
null
null
null
#pragma once #include <cstdlib> #include <set> #include <string> #include <vector> #include <seqan3/std/charconv> #include <chopper/build/build_config.hpp> #include <chopper/build/build_data.hpp> #include <chopper/detail_bin_prefixes.hpp> #include <chopper/detail_parse_chopper_pack_line.hpp> #include <chopper/detail_starts_with.hpp> auto read_data_file_and_set_high_level_bins(build_config const & config) { build_data header; std::vector<chopper_pack_record> records{}; std::unordered_map<std::string, chopper_pack_record> low_level_records{}; std::ifstream binning_file{config.binning_filename}; if (!binning_file.good() || !binning_file.is_open()) throw std::logic_error{"Could not open file " + config.binning_filename + " for reading"}; std::string current_line; while (std::getline(binning_file, current_line) && current_line[0] == '#') { if (current_line.substr(1, hibf_prefix.size()) == hibf_prefix) { assert(current_line.substr(hibf_prefix.size() + 2, 11) == "max_bin_id:"); header.hibf_max_bin_id = current_line.substr(hibf_prefix.size() + 13, current_line.size() - hibf_prefix.size() - 13); } else if (current_line.substr(1, merged_bin_prefix.size()) == merged_bin_prefix) { std::string const name(current_line.begin() + 1, std::find(current_line.begin() + merged_bin_prefix.size() + 2, current_line.end(), ' ')); assert(current_line.substr(name.size() + 2, 11) == "max_bin_id:"); std::string const bin_idx_str = current_line.substr(name.size() + 13, current_line.size() - name.size() - 13); size_t const bin_idx = std::atoi(bin_idx_str.c_str()); header.merged_bin_map[name] = bin_idx; } } size_t record_idx{}; do { auto && record = parse_chopper_pack_line(current_line); if (starts_with(record.bin_name, merged_bin_prefix)) { // cache low level records in map first to accumulate them std::string const prefix(record.bin_name.begin(), std::find(record.bin_name.begin() + merged_bin_prefix.size() + 1, record.bin_name.end(), '_')); auto & merged_bin_record = low_level_records[prefix]; merged_bin_record.filenames.insert(merged_bin_record.filenames.end(), record.filenames.begin(), record.filenames.end()); merged_bin_record.bins += record.bins; } else { // add split record records.push_back(record); if (record.bin_name == header.hibf_max_bin_id) record_idx = records.size() - 1; } } while (std::getline(binning_file, current_line)); for (auto & [bin_name, rec] : low_level_records) { rec.bin_name = bin_name; records.push_back(rec); if (rec.bin_name.substr(0, header.hibf_max_bin_id.size()) == header.hibf_max_bin_id) record_idx = records.size() - 1; } header.hibf_max_record = &records[record_idx]; // only take a pointer now s.t. it is not invalidated by push_backs return std::make_pair(std::move(header), std::move(records)); };
39
122
0.578595
Felix-Droop
204cb8a0ba405dd7cac79a70cacfa2fd5a22993a
1,329
hpp
C++
include/literator/internal/filter_iterator_base.hpp
jason2506/literator
452e5d1416bed80093d989c49cb27c3b665c4bba
[ "BSL-1.0" ]
null
null
null
include/literator/internal/filter_iterator_base.hpp
jason2506/literator
452e5d1416bed80093d989c49cb27c3b665c4bba
[ "BSL-1.0" ]
null
null
null
include/literator/internal/filter_iterator_base.hpp
jason2506/literator
452e5d1416bed80093d989c49cb27c3b665c4bba
[ "BSL-1.0" ]
null
null
null
// (c) Copyright David Abrahams 2002. // (c) Copyright Jeremy Siek 2002. // (c) Copyright Thomas Witt 2002. // (c) Copyright Chi-En Wu 2016. // // Distributed under the Boost Software License, Version 1.0. // (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #ifndef LITERATOR_INTERNAL_FILTER_ITERATOR_BASE_HPP_ #define LITERATOR_INTERNAL_FILTER_ITERATOR_BASE_HPP_ #include <iterator> #include <type_traits> #include "../iterator_adaptor.hpp" namespace literator { // forward declaration template <typename Predicate, typename Iterator> class filter_iterator; namespace internal { /************************************************ * Declaration: class filter_iterator_base<P, I> ************************************************/ template <typename Predicate, typename Iterator> using filter_iterator_base = iterator_adaptor< filter_iterator<Predicate, Iterator>, Iterator, use_default, typename std::conditional< std::is_convertible< typename std::iterator_traits<Iterator>::iterator_category, std::random_access_iterator_tag >::value, std::bidirectional_iterator_tag, use_default >::type >; } // namespace internal } // namespace literator #endif // LITERATOR_INTERNAL_FILTER_ITERATOR_BASE_HPP_
26.58
71
0.684725
jason2506
204e41cd089df96cb3a85ace70de165b3d007716
447
cpp
C++
msvcTemplate/vc2010/VC2010DuiLibWizard/Templates/2052/MainFrame.cpp
wenyongfan/DuiLib_DuiEditor
087b0de316b7816a366a278e2439aef7cbc5ed26
[ "BSD-2-Clause" ]
72
2020-02-25T03:59:19.000Z
2022-03-27T23:20:46.000Z
msvcTemplate/vc2010/VC2010DuiLibWizard/Templates/2052/MainFrame.cpp
wenyongfan/DuiLib_DuiEditor
087b0de316b7816a366a278e2439aef7cbc5ed26
[ "BSD-2-Clause" ]
3
2021-03-17T14:42:54.000Z
2022-02-13T09:03:37.000Z
msvcTemplate/vc2010/VC2010DuiLibWizard/Templates/2052/MainFrame.cpp
wenyongfan/DuiLib_DuiEditor
087b0de316b7816a366a278e2439aef7cbc5ed26
[ "BSD-2-Clause" ]
31
2020-03-15T01:57:50.000Z
2022-03-19T11:10:29.000Z
#include "StdAfx.h" #include "MainFrame.h" CMainFrame::CMainFrame(void) { } CMainFrame::~CMainFrame(void) { } void CMainFrame::InitWindow() { } bool CMainFrame::OnCustomMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) { return false; } bool CMainFrame::OnMenuCommand(const MenuCmd *cmd) { return false; } bool CMainFrame::OnMenuUpdateCommandUI(CMenuCmdUI *cmdUI) { return false; } void CMainFrame::OnNotifyClick(TNotifyUI& msg) { }
11.763158
73
0.733781
wenyongfan
204eb679e842f9be8e90207999d270514f8bc630
259
hpp
C++
src/vm/include/nk/vm/interp.hpp
nickl-lang/nickl
bc68fb85b81eea770907ad1dbe8f680178fa9937
[ "BSD-3-Clause" ]
1
2022-02-09T10:56:50.000Z
2022-02-09T10:56:50.000Z
src/vm/include/nk/vm/interp.hpp
nickl-lang/nickl
bc68fb85b81eea770907ad1dbe8f680178fa9937
[ "BSD-3-Clause" ]
null
null
null
src/vm/include/nk/vm/interp.hpp
nickl-lang/nickl
bc68fb85b81eea770907ad1dbe8f680178fa9937
[ "BSD-3-Clause" ]
null
null
null
#ifndef HEADER_GUARD_NK_VM_INTERP #define HEADER_GUARD_NK_VM_INTERP #include "nk/vm/bc.hpp" namespace nk { namespace vm { void interp_invoke(type_t self, value_t ret, value_t args); } // namespace vm } // namespace nk #endif // HEADER_GUARD_NK_VM_INTERP
17.266667
59
0.772201
nickl-lang
204faf8cc4fd0bf00282909c9527af49a36dae68
577
cpp
C++
creating of nodes.cpp
Pratikrocks/linked--lists
7832fed689ba25008b6136da2c7ea17b759fb6e7
[ "MIT" ]
null
null
null
creating of nodes.cpp
Pratikrocks/linked--lists
7832fed689ba25008b6136da2c7ea17b759fb6e7
[ "MIT" ]
null
null
null
creating of nodes.cpp
Pratikrocks/linked--lists
7832fed689ba25008b6136da2c7ea17b759fb6e7
[ "MIT" ]
null
null
null
#include<bits/stdc++.h> using namespace std; struct node { int data; struct node *next; }; void print(struct node*n) { while(n!=NULL) { cout<<n->data<<" "; n=n->next; } } int main() { struct node*head=NULL; struct node*first=NULL; struct node*second=NULL; head=(struct node*)malloc(sizeof(struct node)); first=(struct node*)malloc(sizeof(struct node)); second=(struct node*)malloc(sizeof(struct node)); head->data=1; head->next=first; first->data=2; first->next=second; second->data=3; second->next=NULL; print(head); }
16.485714
51
0.632582
Pratikrocks
205c63011276c504199caa68bb444b85b1dbb6f4
1,728
cpp
C++
Graphics/Drawing/scale.cpp
YemSalat/jetcat
6fffb814759bb7e46a9967e2c6226df3a1a0eb91
[ "MIT" ]
1
2016-04-20T13:47:20.000Z
2016-04-20T13:47:20.000Z
Graphics/Drawing/scale.cpp
YemSalat/jetcat
6fffb814759bb7e46a9967e2c6226df3a1a0eb91
[ "MIT" ]
null
null
null
Graphics/Drawing/scale.cpp
YemSalat/jetcat
6fffb814759bb7e46a9967e2c6226df3a1a0eb91
[ "MIT" ]
null
null
null
/********************************************************************************/ /* Portable Graphics Library for Embedded Systems * (C) Componentality Oy, 2015 */ /* Initial design and development: Konstantin A. Khait */ /* Support, comments and questions: dev@componentality.com */ /********************************************************************************/ /* Definitions of the surface which upscales or downscales image being output */ /* to it. Lets simply scale image without changing of the painting algorithms */ /* and approaches. */ /********************************************************************************/ #include "scale.h" #define round_d(x) ((int) (x)) #define round_u(x) ((int) ((double) (x) + 0.9999)) using namespace Componentality::Graphics; // Set individual pixel's color void ScaledSurface::plot(const size_t x, const size_t y, const Color& color) { int _x = round_d(mXScaleFactor * x); int _y = round_d(mYScaleFactor * y); for (int i = _x; (round_u(i / mXScaleFactor) == x) && (i >= 0); i--) { for (int j = _y; (round_u(j / mYScaleFactor) == y) && (j >= 0); j--) { mMasterSurface.plot(i, j, color); } } } // Get individual pixel's color Color ScaledSurface::peek(const size_t x, const size_t y) { double _x = mXScaleFactor * x; double _y = mYScaleFactor * y; return mMasterSurface.peek((size_t)_x, (size_t)_y); } // Get width size_t ScaledSurface::getWidth() const { return (size_t)(mMasterSurface.getWidth() * mXScaleFactor); } // Get height size_t ScaledSurface::getHeight() const { return (size_t)(mMasterSurface.getHeight() * mYScaleFactor); }
33.230769
82
0.548032
YemSalat
205c891c1bd6ff5bdd8940cb2e0c9c229f9be53a
1,113
cpp
C++
Chapter_5_Mathematics/Probability/kattis_anthony.cpp
BrandonTang89/CP4_Code
5114471f439978dd11f6f2cbf6af20ca654593da
[ "MIT" ]
2
2021-12-29T04:12:59.000Z
2022-03-30T09:32:19.000Z
Chapter_5_Mathematics/Probability/kattis_anthony.cpp
BrandonTang89/CP4_Code
5114471f439978dd11f6f2cbf6af20ca654593da
[ "MIT" ]
null
null
null
Chapter_5_Mathematics/Probability/kattis_anthony.cpp
BrandonTang89/CP4_Code
5114471f439978dd11f6f2cbf6af20ca654593da
[ "MIT" ]
1
2022-03-01T06:12:46.000Z
2022-03-01T06:12:46.000Z
/**Kattis - anthony * A relatively simple probability problem. The neat trick here is that we don't need to use * both c_left and a_left as DP parameters since a_left + c_left = n - game so we can recover * it from a_left and game. * * Time: O(a*(a+c)), Space: O(a*(a+c)) */ #pragma GCC optimize("Ofast") #pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma") #pragma GCC optimize("unroll-loops") #include <bits/stdc++.h> using namespace std; typedef long double ld; int n, a, c; ld memo[2005][1005]; ld round_prob[2005]; ld prob_win(int game, int a_left){ if (a_left == 0) return 0; int c_left = n - game - a_left; if (c_left == 0) return 1; ld &ans = memo[game][a_left]; if (ans != -1) return ans; ans = round_prob[game] * prob_win(game + 1, a_left) + (1 - round_prob[game]) * prob_win(game + 1, a_left - 1); return ans; } int main(){ scanf("%d %d", &a, &c); n = a + c; // n games are played for (int i = 0; i < n; i++) scanf("%Le", &round_prob[i]); memset(memo, -1, sizeof memo); printf("%Lf\n", prob_win(0, a)); return 0; }
29.289474
114
0.617251
BrandonTang89
205f2e1b4ac818c618cb2cabdb762fca7fbb673c
14,763
cpp
C++
Test.cpp
Sarah-han/War-game-a-b
7ac91779b294f12fc9616836166a9efde9d711f2
[ "MIT" ]
null
null
null
Test.cpp
Sarah-han/War-game-a-b
7ac91779b294f12fc9616836166a9efde9d711f2
[ "MIT" ]
null
null
null
Test.cpp
Sarah-han/War-game-a-b
7ac91779b294f12fc9616836166a9efde9d711f2
[ "MIT" ]
null
null
null
#include "doctest.h" #include <stdbool.h> #include "Board.hpp" #include "FootCommander.hpp" #include "FootSoldier.hpp" #include "Paramedic.hpp" #include "ParamedicCommander.hpp" #include "Sniper.hpp" #include "SniperCommander.hpp" #include "Soldier.hpp" using namespace WarGame; TEST_CASE("Snipers And Paramedics") { Board board(6,6); //-----Player 1 soldiers-------// CHECK(!board.has_soldiers(1)); board[{0,0}] = new Paramedic(1); CHECK(typeid(board[{0,0}]) == typeid(Paramedic)); //Checks whether placement has occurred CHECK(board.has_soldiers(1)); board[{0,1}] = new ParamedicCommander(1); CHECK(typeid(board[{0,1}]) == typeid(ParamedicCommander)); //Checks whether placement has occurred board[{0,2}] = new Sniper(1); CHECK(typeid(board[{0,2}]) == typeid(Sniper)); //Checks whether placement has occurred board[{0,3}] = new SniperCommander(1); CHECK(typeid(board[{0,3}]) == typeid(SniperCommander)); //Checks whether placement has occurred board[{0,4}] = new Paramedic(1); CHECK(typeid(board[{0,4}]) == typeid(Paramedic)); //Checks whether placement has occurred board[{0,5}] = new Sniper(1); CHECK(typeid(board[{0,5}]) == typeid(Sniper)); //Checks whether placement has occurred CHECK(board.has_soldiers(1)); //-----Player 2 soldiers-------// CHECK(!board.has_soldiers(2)); board[{5,5}] = new Paramedic(2); CHECK(typeid(board[{5,5}]) == typeid(Paramedic)); //Checks whether placement has occurred CHECK(board.has_soldiers(2)); board[{5,4}] = new ParamedicCommander(2); CHECK(typeid(board[{5,4}]) == typeid(ParamedicCommander)); //Checks whether placement has occurred board[{5,3}] = new Sniper(2); CHECK(typeid(board[{5,3}]) == typeid(Sniper)); //Checks whether placement has occurred board[{5,2}] = new SniperCommander(2); CHECK(typeid(board[{5,2}]) == typeid(SniperCommander)); //Checks whether placement has occurred board[{5,1}] = new Paramedic(2); CHECK(typeid(board[{5,1}]) == typeid(Paramedic)); //Checks whether placement has occurred board[{5,0}] = new Sniper(2); CHECK(typeid(board[{5,0}]) == typeid(Sniper)); //Checks whether placement has occurred CHECK(board.has_soldiers(2)); //-----------moves--------------------------------------------------------- CHECK_NOTHROW(board.move(1, {0,3}, Board::MoveDIR::Up)); // move to {1,3} and shoot; damage 10 CHECK(board[{0,3}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {1,3}]) == typeid(SniperCommander)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(2, {5,2}, Board::MoveDIR::Down)); // move to {4,2} and shoot; damage 10 CHECK(board[{5,2}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {4,2}]) == typeid(SniperCommander)); CHECK_NOTHROW(board.move(1, {0,5}, Board::MoveDIR::Up)); // move to {1,5} and shoot; damage 10 CHECK(board[{0,5}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {1,5}]) == typeid(Sniper)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(2, {5,0}, Board::MoveDIR::Down)); // move to {4,0} and shoot; damage 10 CHECK(board[{5,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {4,0}]) == typeid(Sniper)); CHECK_NOTHROW(board.move(1, {1,3}, Board::MoveDIR::Up)); // move to {2,3} and shoot; damage 10 CHECK(board[{1,3}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {2,3}]) == typeid(SniperCommander)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(2, {5,3}, Board::MoveDIR::Down)); // move to {4,3} and shoot; damage 10 CHECK(board[{5,3}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {4,3}]) == typeid(Sniper)); CHECK_NOTHROW(board.move(1, {0,4}, Board::MoveDIR::Up)); // move to {1,4} and shoot; damage 10 CHECK(board[{0,4}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {1,4}]) == typeid(Paramedic)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(2, {4,3}, Board::MoveDIR::Down)); // move to {3,3} and shoot; damage 10 CHECK(board[{4,3}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {3,3}]) == typeid(Sniper)); CHECK_NOTHROW(board.move(1, {0,2}, Board::MoveDIR::Up)); // move to {1,2} and shoot; damage 10 CHECK(board[{0,2}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {1,2}]) == typeid(Sniper)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(2, {5,1}, Board::MoveDIR::Down)); // move to {4,1} and shoot; damage 10 CHECK(board[{5,1}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {4,1}]) == typeid(Paramedic)); } TEST_CASE("Foot soldiers simple game") { Board board (8,1); CHECK(!board.has_soldiers(1)); board[{0,0}] = new FootSoldier(1); CHECK(board.has_soldiers(1)); CHECK(!board.has_soldiers(2)); board[{7,0}] = new FootSoldier(2); CHECK(board.has_soldiers(2)); CHECK_NOTHROW(board.move(1, {0,0}, Board::MoveDIR::Up)); // move to {1,0} and shoot; damage 10 CHECK(board[{0,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {1,0}]) == typeid(FootSoldier)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW( board.move(1, {1,0}, Board::MoveDIR::Down)); // move back to {0,0} and shoot; damage 10 CHECK(board[{1,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {0,0}]) == typeid(FootSoldier)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(1, {0,0}, Board::MoveDIR::Up)); // move to {1,0} and shoot; damage 10 CHECK(board[{0,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {1,0}]) == typeid(FootSoldier)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(1, {1,0}, Board::MoveDIR::Down)); // move back to {0,0} and shoot; damage 10 CHECK(board[{1,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {0,0}]) == typeid(FootSoldier)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(1, {0,0}, Board::MoveDIR::Up)); // move to {1,0} and shoot; damage 10 CHECK(board[{0,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {1,0}]) == typeid(FootSoldier)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(1, {1,0}, Board::MoveDIR::Down)); // move back to {0,0} and shoot; damage 10 CHECK(board[{1,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{0,0}]) == typeid(FootSoldier)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(1, {0,0}, Board::MoveDIR::Up)); // move to {1,0} and shoot; damage 10 CHECK(board[{0,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {1,0}]) == typeid(FootSoldier)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(1, {1,0}, Board::MoveDIR::Down)); // move back to {0,0} and shoot; damage 10 CHECK(board[{1,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{0,0}]) == typeid(FootSoldier)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(1, {0,0}, Board::MoveDIR::Up)); // move to {1,0} and shoot; damage 10 CHECK(board[{0,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[ {1,0}]) == typeid(FootSoldier)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK_NOTHROW(board.move(1, {1,0}, Board::MoveDIR::Down)); // move back to {0,0} and shoot; damage 10 CHECK(board[{1,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{0,0}]) == typeid(FootSoldier)); //Checks whether the new location has the right soldier type,i.e the soldier has actually moved CHECK(!board.has_soldiers(2)); CHECK(board.has_soldiers(1)); } TEST_CASE("Foot soldiers simple game2") { Board board (4,4); CHECK(!board.has_soldiers(1)); board[{0,0}] = new FootSoldier(1); CHECK(typeid(board[{0,0}]) == typeid(FootSoldier)); //Checks whether placement has occurred CHECK(board.has_soldiers(1)); board[{0,3}] = new FootCommander(1); CHECK(typeid(board[{0,3}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK(board.has_soldiers(1)); CHECK(!board.has_soldiers(2)); board[{3,0}] = new FootSoldier(2); CHECK(typeid(board[{3,0}]) == typeid(FootSoldier)); //Checks whether placement has occurred board[{3,1}] = new Paramedic(2); CHECK(typeid(board[{3,1}]) == typeid(Paramedic)); //Checks whether placement has occurred board[{3,3}] = new FootCommander(2); CHECK(typeid(board[{3,3}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK(board.has_soldiers(2)); CHECK_NOTHROW(board.move(1, {0,3}, Board::MoveDIR::Up)); // move to {1,3} and shoot; damage 10 and damage 20 CHECK(board[{0,3}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{1,3}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK_NOTHROW(board.move(2, {3,3}, Board::MoveDIR::Left)); // move to {3,2} and shoot; damage 10 and damage 20 CHECK(board[{3,3}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{3,2}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK_NOTHROW(board.move(1, {0,0}, Board::MoveDIR::Right)); // move to {0,1} and shoot; damage 10 CHECK(board[{0,0}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{0,1}]) == typeid(FootSoldier)); //Checks whether placement has occurred CHECK_NOTHROW( board.move(2, {3,1}, Board::MoveDIR::Down)); // move back to {2,0} and shoot; damage 10 CHECK(board[{3,1}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{2,1}]) == typeid(Paramedic)); //Checks whether placement has occurred CHECK_NOTHROW( board.move(1, {1,3}, Board::MoveDIR::Up)); // move to {1,0} and shoot; damage 10 CHECK(board[{1,3}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{2,3}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK_NOTHROW( board.move(2, {3,2}, Board::MoveDIR::Down)); // move to {1,0} and shoot; damage 10 CHECK(board[{3,2}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{2,2}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK_NOTHROW( board.move(2, {2,2}, Board::MoveDIR::Up)); // move to {1,0} and shoot; damage 10 CHECK(board[{2,2}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{3,2}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK_NOTHROW( board.move(2, {3,2}, Board::MoveDIR::Down)); // move to {1,0} and shoot; damage 10 CHECK(board[{3,2}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{2,2}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK_NOTHROW( board.move(2, {2,2}, Board::MoveDIR::Up)); // move to {1,0} and shoot; damage 10 CHECK(board[{2,2}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{3,2}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK_NOTHROW( board.move(2, {3,2}, Board::MoveDIR::Down)); // move to {1,0} and shoot; damage 10 CHECK(board[{3,2}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{2,2}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK_NOTHROW( board.move(2, {2,2}, Board::MoveDIR::Up)); // move to {1,0} and shoot; damage 10 CHECK(board[{2,2}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{3,2}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK_NOTHROW( board.move(2, {3,2}, Board::MoveDIR::Down)); // move to {1,0} and shoot; damage 10 CHECK(board[{3,2}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{2,2}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK_NOTHROW( board.move(2, {2,2}, Board::MoveDIR::Up)); // move to {1,0} and shoot; damage 10 CHECK(board[{2,2}]== nullptr); //Checks whether the soldier is moving and is no longer in his starting position CHECK(typeid(board[{3,2}]) == typeid(FootCommander)); //Checks whether placement has occurred CHECK(!board.has_soldiers(2)); CHECK(board.has_soldiers(1)); }
66.800905
156
0.681095
Sarah-han
20655d6ec142d8aabab826e5c12e0809b6338ef7
17,930
c++
C++
src/Note.c++
dsvi/NotesTree
e9f932027281f8eb2e53dcd250d99bc48caeeabf
[ "Zlib" ]
null
null
null
src/Note.c++
dsvi/NotesTree
e9f932027281f8eb2e53dcd250d99bc48caeeabf
[ "Zlib" ]
null
null
null
src/Note.c++
dsvi/NotesTree
e9f932027281f8eb2e53dcd250d99bc48caeeabf
[ "Zlib" ]
null
null
null
#include "Note.h" using namespace std; using namespace boost::filesystem; const char Note::delimChar; Note::Note() { } Note::~Note() { } bool Note::hasAttach() { if (parent_) return exists(attachDir()); return false; } QString Note::decodeFromFilename(const boost::filesystem::path &filename) { QString ret; QString fn(filename.c_str()); ret.reserve(fn.size()); for (auto c = fn.begin(); c != fn.end(); ++c){ if (*c == delimChar){ QString num; for (int i = 2; --i >= 0;){ if (++c == fn.end()){ throw Exception(QCoreApplication::translate( "Filesystem", "Wrong num after delimiter %1 in file name: %2").arg(delimChar).arg(fn)); } num += *c; } bool ok; int code = num.toInt(&ok, 16); if (!ok){ throw Exception(QCoreApplication::translate( "Filesystem", "Wrong num after delimiter %1 in file name: %2").arg(delimChar).arg(fn)); } ret += QChar(code); } else{ ret += *c; } } return ret; } boost::filesystem::path Note::encodeToFilename(const QString &name) { QString ret; ret.reserve(name.size()); for (auto i = name.begin(); i != name.end(); ++i){ auto c = *i; if (c == delimChar || c == L'/' || c == L'\\' || (i == name.begin() && c == L'.')){ ret += delimChar; QString num; num.setNum(c.unicode(), 16); ASSERT(num.length() <= 2); if (num.length() < 2) ret += L'0'; ret += num; } else{ ret += c; } } return path(ret.toUtf8()); } void Note::addFromSubnotesDir(const boost::filesystem::path &path) { if (name_.isNull()) name_ = decodeFromFilename(path.filename()); std::unordered_map<QString, directory_entry> dirs; for (auto&& x : directory_iterator(path)) if (x.status().type() == file_type::directory_file && x.path().filename().native()[0] != '.') dirs.insert({x.path().filename().c_str(), x}); for (directory_entry& fi : directory_iterator(path)){ if (fi.status().type() == file_type::directory_file) continue; QString name = fi.path().filename().c_str(); if (!name.endsWith(Note::textExt)) continue; auto subNote = make_shared<Note>(); subNote->createFromNoteTextFile(fi.path()); addNote(subNote); class path subDir = subNote->subNotesDir(); if (exists(subDir)) subNote->addFromSubnotesDir(subDir); dirs.erase(toQS(encodeToFilename(subNote->name_))); dirs.erase(toQS(encodeToFilename(subNote->name_ + attachExt))); dirs.erase(toQS(encodeToFilename(subNote->name_ + embedExt))); } for (auto dir = dirs.begin(); dir != dirs.end(); ){ const boost::filesystem::path &dirPath = dir->second.path(); if ( toQS(dirPath.filename()).endsWith(attachExt) || toQS(dirPath.filename()).endsWith(embedExt) ){ ++dir; continue; } auto subNote = make_shared<Note>(); subNote->name_ = decodeFromFilename(dirPath.filename()); addNote(subNote); subNote->addFromSubnotesDir(dirPath); dirs.erase(toQS(encodeToFilename(subNote->name_ + attachExt))); dirs.erase(toQS(encodeToFilename(subNote->name_ + embedExt))); dir = dirs.erase(dir); } // just in case we happened to have a note name ending on attachExt etc // kinda stupid part for (auto &dir : dirs){ const boost::filesystem::path &dirPath = dir.second.path(); auto subNote = make_shared<Note>(); subNote->name_ = decodeFromFilename(dirPath.filename()); addNote(subNote); subNote->addFromSubnotesDir(dirPath); } } void Note::createFromNoteTextFile(const path &fi) { path name = fi.filename(); ASSERT(name.extension() == Note::textExt); name = name.stem(); name_ = decodeFromFilename(name); } void Note::createHierarchyFromRoot(const path &p) { try{ ASSERT(parent_ == nullptr); emit clear(); subNotes_.clear(); name_ = toQS(p); if (!exists(p)) throw RecoverableException(QCoreApplication::translate("Filesystem", "directory '%1' doesnt exist").arg(name_)); addFromSubnotesDir(p); } catch(...){ subNotes_.clear(); name_.clear(); warning("Can't load notes."); } } void Note::move(const boost::filesystem::path &newPath, const boost::filesystem::path &newFileName) { ASSERT(is_directory(newPath)); auto ren = [&](const path &oldPath, const char *ext){ if (exists(oldPath)){ path newPathname = newPath / newFileName; if (ext) newPathname += ext; rename(oldPath, newPathname); } }; ren(textPathname(), textExt); ren(subNotesDir(), nullptr); ren(attachDir(), attachExt); ren(embedDir(), embedExt); } void Note::adopt_(const std::shared_ptr<Note> &n) { if (n.get() == this) throw Exception(tr("Can't add as subnote to self. (%1)").arg(name_)); ensureSubDirExist(); n->move(subNotesDir(), encodeToFilename(n->name_)); addNote(n->removeFromParent()); } void Note::cleanUpFileSystem() { if ( parent_ == nullptr ) //nothing to clean up at root return; auto subDir = subNotesDir(); auto textFile = textPathname(); auto attach = attachDir(); auto embed = embedDir(); if (exists(subDir) && boost::filesystem::is_empty(subDir) && exists(textFile)) remove(subDir); if (exists(textFile) && boost::filesystem::is_empty(textFile) && exists(subDir)) remove(textFile); if (exists(attach) && boost::filesystem::is_empty(attach)) remove(attach); if (exists(embed) && boost::filesystem::is_empty(embed)) remove(embed); } void Note::ensureSubDirExist() { auto subDir = subNotesDir(); if (exists(subDir)) return; create_directory(subDir); } void Note::warning(QString &&msg) { try{ throw_with_nested(RecoverableException(std::move(msg))); } catch(...){ app->reportError(std::current_exception()); } } void Note::error(QString &&msg) { try{ throw_with_nested(Exception(std::move(msg))); } catch(...){ error(); } } void Note::error() { auto e = std::current_exception(); if (!isRecoverable(e)){ Note *r = root(); r->subNotes_.clear(); // zombify! r->name_.clear(); } app->error(e); } Note* Note::root() { Note *r = this; for (Note *n = parent_; n != nullptr; n = n->parent_) r = n; return r; } void Note::emitAddNoteRecursively(std::shared_ptr<Note> &note) { emit noteAdded(note); for (auto &cn : note->subNotes_) note->emitAddNoteRecursively(cn); } void Note::addNote(std::shared_ptr<Note> note) { note->parent_ = this; subNotes_.push_back(note); note->cleanUpFileSystem(); emitAddNoteRecursively(note); } std::shared_ptr<Note> Note::removeFromParent() { auto myNdx = parent_->findIndexOf(this); auto ret = parent_->subNotes_[myNdx]; auto it = parent_->subNotes_.begin() + myNdx; parent_->subNotes_.erase(it, it+1); parent_->cleanUpFileSystem(); emit noteRemoved(); return ret; } void Note::adopt(const std::vector<std::weak_ptr<Note> > &list) { try{ std::set<QString> uniquenessCheck; for (auto np : list){ auto n = np.lock(); if (!n) continue; QString name = n->name_; if (exist(name) || uniquenessCheck.find(name) != uniquenessCheck.end()){ auto e = RecoverableException(tr( "Note names have to be unique in the subnotes list. '%1' is not.\n").arg(name)); if (n->hierarchyDepth() > 1) e.append(tr("It came from '%1'.\n").arg(n->makePathName())); throw e; } uniquenessCheck.insert(name); } for (auto n : list) if (!n.expired()) adopt_(n.lock()); } catch(...){ error(); } } void Note::createSubnote(const QString &name) { if (root()->isZombie()) return; try{ if (exist(name)) throw RecoverableException( tr("Note '%1' already exist here.\n").arg(name)); ensureSubDirExist(); auto subNote = make_shared<Note>(); subNote->parent_ = this; subNote->name_ = name; auto txtPath = subNote->textPathname(); if (exists(txtPath)) throw RecoverableException( tr("Filename '%1' already exist.\n").arg(QString::fromStdWString(txtPath.wstring()))); boost::filesystem::fstream out( subNote->textPathname(), ios_base::out | ios_base::binary); addNote(subNote); cleanUpFileSystem(); } catch(...){ warning(tr("Cant create note '%1'").arg(name)); } } void Note::deleteRecursively(const std::vector<std::weak_ptr<Note> > &list) { try{ vector<Note*> notes; for (auto &n : list ){ if (!n.expired()) notes.push_back(n.lock().get()); } std::sort(notes.begin(), notes.end(),[](const auto a, const auto b){ return a->hierarchyDepth() > b->hierarchyDepth(); }); for (auto n : notes) n->deleteSelfRecursively(); } catch(...){ error(); } } void Note::deleteSelfRecursively() { ASSERT(parent_ != nullptr); //not root try{ remove_all(subNotesDir()); remove_all(attachDir()); remove_all(embedDir()); remove(textPathname()); removeFromParent(); parent_->cleanUpFileSystem(); } catch(...){ throw Exception(tr("Can't delete note '%1':").arg(name_)); } } static const char * UrlRegexps[3] = { "<(?:img|source)[^>]+src\\s*=\\s*\"([^\"]+)\"", "<(?:img|source)[^>]+src\\s*=\\s*'([^']+)'", "<(?:img|source)[^>]+src\\s*=\\s*[^'\"](\\S+)" }; static QString changeUrls(QString html, std::function<QString(const QString &)> mapper){ for (auto r : UrlRegexps){ QString newHtml; int from = 0; int to; QRegExp reg(r); int pos = 0; while (true){ pos = reg.indexIn(html, pos); if (pos < 0) break; // qDebug()<< reg.cap(0); // qDebug()<< reg.cap(1); pos += reg.cap(0).size(); auto cap = reg.cap(1); QString newUrl = mapper(cap); if (newUrl == cap) continue; to = reg.pos(1); newHtml += html.midRef(from, to - from); newHtml += newUrl; from = to + cap.size(); } if (from == 0) continue; newHtml += html.midRef(from, html.size()); html = move(newHtml); } return html; } static set<QString> grabUrlsOfEmbeddedFiles(const QString &html) { set<QString> srcs; changeUrls(html, [&](const QString &from)->QString { srcs.insert(from); return from; }); return srcs; } path Note::generateEmbedFilename(const boost::filesystem::path &hint) { auto emDir = embedDir(); if (!exists(emDir)) create_directory(emDir); auto simpleCase = emDir/hint.filename(); if (simpleCase.string().size() < 100 && !exists(simpleCase)) return simpleCase; path ext = hint.extension(); path pref = hint.stem(); if (pref.size() > 100) pref = path(""); if (ext.size() > 100) ext = path(""); ui32 id = 0; path retFilename; do{ path fn = pref; fn += path(to_string(id)); fn += ext; retFilename = emDir / fn; id++; } while(exists(retFilename)); return retFilename; } static QString urlEnc(const QString &s){ return QString(QUrl::toPercentEncoding(s, "./")); } void Note::downloaded(const QString &originalUrl, const QByteArray &content, const QString &error) { try{ urlsInDownload_.erase(originalUrl); if (!error.isNull()){ throw RecoverableException(tr( "Can't download embedded file for '%1'\n" "url: %2\n" "problem: %3").arg(name_).arg(originalUrl).arg(error)); } QString embedUrl; { path embed = generateEmbedFilename(toPath(QUrl::fromPercentEncoding(originalUrl.toUtf8()))); using io = std::ios_base; boost::filesystem::fstream out(embed, io::out | io::trunc | io::binary); out.exceptions(io::failbit | io::badbit); out.write(content.data(), content.size()); out.close(); embedUrl = urlEnc("./" + toQS(embed.parent_path().filename() / embed.filename())); } urlsPatch_[originalUrl] = embedUrl; saveTxt(applyPatch(loadTxt())); } catch(...){ warning(tr("Problems while getting embedded content for '%1'\n").arg(name_)); } } QString Note::applyPatch(const QString &html) { return changeUrls(html, [&](const QString& from)->QString{ auto i = urlsPatch_.find(from); if (i == urlsPatch_.end()) return from; return i->second; }); } void Note::saveTxt(const QString &txt) { boost::filesystem::path outFilename; try{ outFilename = textPathname(); outFilename += newFileExt; using io = std::ios_base; boost::filesystem::fstream out(outFilename, io::out | io::trunc | io::binary); out.exceptions(io::failbit | io::badbit); auto utf8txt = txt.toUtf8(); out.write(utf8txt.data(), utf8txt.size()); out.close(); rename(outFilename, textPathname()); } catch(...){ warning(tr("Can't save note '%1' to file '%2'\n").arg(name_).arg(toQS(outFilename))); } } QString Note::loadTxt() { try{ auto inFilename = textPathname(); if (!exists(inFilename)) return QString(); using io = std::ios_base; boost::filesystem::fstream in(inFilename, io::in | io::binary); in.exceptions(io::failbit | io::badbit); auto inSize = file_size(inFilename); if (inSize == static_cast<uintmax_t>(-1)) throw RecoverableException( tr("Can't determine file size. Is it really a file?")); QByteArray ba; ba.resize(inSize); in.read(ba.data(), ba.size()); in.close(); return QString::fromUtf8(ba); } catch(...){ warning(tr("Can't load file '%1'\n").arg(toQS(textPathname()))); } return QString(); } void Note::startEditing() { stopEditing(); QString html = loadTxt(); emit noteTextRdy(html, toQS(pathToNote())); } void Note::save(QString html) { try{ html = applyPatch(html); set<path> validEmbeds; auto urls = grabUrlsOfEmbeddedFiles(html); for (auto u : urls){ if (u.startsWith(".")){ path em = toPath(QUrl::fromPercentEncoding(u.toUtf8())); validEmbeds.insert(em.filename()); continue; } QString filePrefix = "file://"; if (u.startsWith(filePrefix)){ QString url = u; url.remove(0, filePrefix.size()); url = QUrl::fromPercentEncoding(url.toUtf8()); auto srcPath = toPath(url); path dstPath = generateEmbedFilename(srcPath); boost::system::error_code err; create_hard_link(srcPath, dstPath, err); if (err) copy_file(srcPath,dstPath); validEmbeds.insert(dstPath.filename()); auto dstUrl = urlEnc("./" + toQS(dstPath.parent_path().filename() / dstPath.filename())); urlsPatch_[u] = dstUrl; continue; } if (urlsInDownload_.find(u) != urlsInDownload_.end()) continue; auto dlr = app->downloader(); connect(dlr, &Downloader::finished, this, &Note::downloaded, Qt::UniqueConnection); dlr->get(u); urlsInDownload_.insert(u); } // just in case we have updated the patch by copeing local file html = applyPatch(html); saveTxt(html); if (exists(embedDir())){ for (auto&& ef : directory_iterator(embedDir())){ // remove unused embeds if (validEmbeds.find(ef.path().filename()) == validEmbeds.end()) remove(ef.path()); } } cleanUpFileSystem(); } catch(...){ warning(tr("Can't save note '%1'.").arg(name_)); } } void Note::stopEditing() { urlsPatch_.clear(); } void Note::getNotePlainTxt() { QString html = loadTxt(); QString txt; txt.reserve(html.size()); bool skipTillEndOfTag = false; for (auto it = html.begin(); it != html.end(); ++it){ if (skipTillEndOfTag){ if (*it == '>') skipTillEndOfTag = false; continue; } if (*it == '<'){ skipTillEndOfTag = true; continue; } txt.append(*it); } txt = txt.simplified(); emit notePlainTextRdy(txt); } void Note::attach() { try{ if (!parent_) return; auto a = attachDir(); create_directory(a); emit attachReady(toQS(a)); } catch(...){ warning(tr("Can't create attachment directory.")); } } void Note::getNoteRelatedPaths() { vector<QString> lst; auto pref = QString("file://"); auto text = textPathname(); if (exists(text)) lst.emplace_back(pref + urlEnc(toQS(text))); auto attach = attachDir(); if (exists(attach)) lst.emplace_back(pref + urlEnc(toQS(attach))); auto embed =embedDir(); if (exists(embed)) lst.emplace_back(pref + urlEnc(toQS(embed))); emit pathsReady(lst); } path Note::pathToNote() const { if (parent_) return parent_->subNotesDir(); else return path(name_.toUtf8()); } boost::filesystem::path Note::attachDir() const { ASSERT(parent_ != nullptr); // root has no attach return pathToNote() / encodeToFilename(name_+attachExt); } path Note::embedDir() const { ASSERT(parent_ != nullptr); // root has no embed return pathToNote() / encodeToFilename(name_+embedExt); } boost::filesystem::path Note::subNotesDir() const { if (parent_ == nullptr) return pathToNote(); return pathToNote() / encodeToFilename(name_); } boost::filesystem::path Note::textPathname() const { ASSERT(parent_ != nullptr); // root has no text return pathToNote() / encodeToFilename(name_+textExt); } size_t Note::findIndexOf(const Note *n) const { for (size_t i = 0; i < subNotes_.size(); ++i){ if (subNotes_[i].get() == n) return i; } ASSERT(false); return subNotes_.size(); // make caller crash } bool Note::exist(const QString &name) { for (auto &sub : subNotes_) if (sub->name_ == name) return true; return false; } QString Note::makePathName(const QString separator) const { std::stack<const Note*> stack; for (const Note *n = parent_; n != nullptr; n = n->parent_) stack.push(n); stack.pop(); QString ret; while (!stack.empty()){ ret += stack.top()->name_; stack.pop(); if (!stack.empty()) ret += separator; } return ret; } int Note::hierarchyDepth() const { int depth = 0; for (const Note *n = parent_; n != nullptr; n = n->parent_) depth++; return depth; } void Note::changeName(const QString &name) { ASSERT(parent_ != nullptr); try{ if (name == name_) return; if (parent_->exist(name)){ throw RecoverableException( QCoreApplication::translate( "notes renaming", "'%1' already exist there.\n").arg(name)); } if (exists(embedDir())){ QString html = loadTxt(); QString oldUrlPrefix = urlEnc("./" + toQS(encodeToFilename(name_ + embedExt))); auto oldPrefLen = oldUrlPrefix.size(); QString newUrlPrefix = urlEnc("./" + toQS(encodeToFilename(name + embedExt))); html = changeUrls(html, [&](const QString& from)->QString{ if (!from.startsWith(oldUrlPrefix)) return from; QString ret = from; ret.remove(0, oldPrefLen).prepend(newUrlPrefix); return ret; }); saveTxt(html); } move(pathToNote(), encodeToFilename(name)); name_ = name; emit nameChanged(name); } catch(...){ error(); } }
24.002677
115
0.649805
dsvi
2069353ea4fa81075506c54b491868cdc1ece792
3,192
cpp
C++
data_structure/splay/RANK_TREE_SPLAY.cpp
searchstar2017/acmtool
03392b8909a3d45f10c2711ca4ad9ba69f64a481
[ "MIT" ]
null
null
null
data_structure/splay/RANK_TREE_SPLAY.cpp
searchstar2017/acmtool
03392b8909a3d45f10c2711ca4ad9ba69f64a481
[ "MIT" ]
null
null
null
data_structure/splay/RANK_TREE_SPLAY.cpp
searchstar2017/acmtool
03392b8909a3d45f10c2711ca4ad9ba69f64a481
[ "MIT" ]
null
null
null
template<typename T> struct SPLAY { //0 is invalid int c[MAXN][2], fa[MAXN], cnt[MAXN], siz[MAXN], tot, root; T keys[MAXN]; #define ls(rt) c[rt][0] #define rs(rt) c[rt][1] void Init() { root = tot = 0; } bool Side(int rt) { return rt == rc(fa[rt]); } void PushUp(int rt) { siz[rt] = cnt[rt]; if (lc(rt)) siz[rt] += siz[lc(rt)]; if (rc(rt)) siz[rt] += siz[rc(rt)]; } void Init(int rt, const T& key) { lc(rt) = rc(rt) = fa[rt] = 0; siz[rt] = cnt[rt] = 1; keys[rt] = key; } void SetSon(int x, int f, int s) { if (f) c[f][s] = x; if (x) fa[x] = f; } //Will update siz[now] and siz[fa[now]] void RotateUp(int now) { int f = fa[now]; bool side = Side(now); SetSon(c[now][!side], f, side); SetSon(now, fa[f], Side(f)); SetSon(f, now, !side); PushUp(f); PushUp(now); if (!fa[now]) root = now; } //Require that cnt[now] is up to date void Splay(int now, int to = 0) { if (!now) return; for (int f = fa[now]; f != to; f = fa[now]) { if (fa[f] != to) RotateUp(Side(now) == Side(f) ? f : now); RotateUp(now); } } //The new node will be the root void Insert(const T& key) { if (!root) { Init(root = ++tot, key); } else { int now = root, f; while (1) { if (!now) { Init(now = ++tot, key); fa[now] = f; c[f][keys[f] < key] = now; break; } else if (keys[now] == key) { ++cnt[now]; break; } f = now; now = c[now][keys[now] < key]; } Splay(now); } } //The target node will be the root int find(const T& key) { int now = root; while (now && keys[now] != key) now = c[now][keys[now] < key]; Splay(now); return now; } int FindPreOrNext(int now, bool nex) const { if (!c[now][nex]) return 0; nex = !nex; for (now = c[now][!nex]; c[now][nex]; now = c[now][nex]); return now; } void DelRoot() { int now = FindPreOrNext(root, false); if (!now) { root = rs(root); fa[root] = 0; } else { Splay(now); SetSon(rs(rs(root)), root, 1); PushUp(root); } //No need to free the target node } void Del(const T& key) { int now = find(key); if (!now) return; if (cnt[root] > 1) { --cnt[root]; --siz[root]; } else if (!lc(root) || !rc(root)) { root = lc(root) + rc(root); fa[root] = 0; //Even if root == 0, it does no harm //No need to free the target node } else { DelRoot(); } } T QueryKth(int k) { int rt = root; while (rt) { if (siz[c[rt][0]] < k && siz[c[rt][0]] + cnt[rt] >= k) { return keys[rt]; } else if (siz[c[rt][0]] >= k) { rt = c[rt][0]; } else { k -= siz[c[rt][0]] + cnt[rt]; rt = c[rt][1]; } } return -1; } int QuerySmaller(const T& key) { int now = find(key); bool flag = false; if (!now) { Insert(key); flag = true; } int ans = lc(root) ? siz[lc(root)] : 0; if (flag) DelRoot(); return ans; } T QueryPreOrNext(const T& key, bool nex) { int now = find(key); bool flag = false; if (!now) { Insert(key); now = root; flag = true; } if (!c[now][nex]) { if (flag) Del(key); return -1; } now = FindPreOrNext(now, nex); if (flag) Del(key); return now >= 0 ? keys[now] : -1; } };
19.703704
59
0.515038
searchstar2017
2069a4e15b5fb0b5fe3c1a28e8f6e453111a30f4
1,563
hpp
C++
src/res/Prefab/ComponentParsing/ParseTransformComponent.hpp
awwdev/MiniSTL
218998f6109a2a42c0017b4255bec48a235998c3
[ "MIT" ]
5
2021-02-10T19:14:32.000Z
2021-11-19T13:29:55.000Z
src/res/Prefab/ComponentParsing/ParseTransformComponent.hpp
awwdev/MiniSTL
218998f6109a2a42c0017b4255bec48a235998c3
[ "MIT" ]
41
2020-05-16T09:56:45.000Z
2020-07-05T15:14:33.000Z
src/res/Prefab/ComponentParsing/ParseTransformComponent.hpp
awwdev/MiniSTL
218998f6109a2a42c0017b4255bec48a235998c3
[ "MIT" ]
2
2021-07-21T22:21:41.000Z
2021-09-06T19:25:11.000Z
//https://github.com/awwdev #pragma once #include "ecs/Components/TransformComponent.hpp" #include "res/Prefab/ComponentParsing/ComponentMember.hpp" namespace rpg::res { inline auto ParseTransformComponent(ComponentMemberPairs const& pairs) { ecs::TransformComponent transformComponent {}; FOR_ARRAY(pairs, i) { auto const [key, val, componentDataEnum] = pairs[i].get_data(); switch(componentDataEnum) { case ComponentMemberEnum::Children: { /* const auto values = ValStrToValArray<3, 100>(val); dbg::Assert(!values.Empty(), "values are empty"); FOR_ARRAY(values, i){ auto const prefabEnum = res::PREFAB_STR_TO_ENUM.GetOptional(values[i].Data()); dbg::Assert(prefabEnum, "child prefab enum wrong"); transformComponent.children.AppendElement((ID) *prefabEnum); } */ } break; case ComponentMemberEnum::Scale: { /* const auto values = ValStrToValArray<3, 10>(val); dbg::Assert(!values.Empty(), "values are empty"); FOR_ARRAY(values, i){ transformComponent.scale[0][i] = std::atof(values[i].Data()); } */ } break; default: dbg::Assert(false, "component data enum missing / wrong"); } } return transformComponent; } }//ns
31.897959
98
0.535509
awwdev
206b9a298595565ea89c60d9dd381c847a5f16e2
2,309
cpp
C++
ComTest/main.cpp
iclosure/com422
7279f625ad9dd2e6c374e61608074fdaf206f326
[ "MIT" ]
1
2018-09-20T07:45:43.000Z
2018-09-20T07:45:43.000Z
ComTest/main.cpp
iclosure/com422
7279f625ad9dd2e6c374e61608074fdaf206f326
[ "MIT" ]
null
null
null
ComTest/main.cpp
iclosure/com422
7279f625ad9dd2e6c374e61608074fdaf206f326
[ "MIT" ]
null
null
null
// ComTest.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <stdio.h> //#include "test_comapi_load.h" //#include "test_comapi_speed.h" //#include "test_comm.h" #include "moxa/pcomm.h" #include "serialport/serialport.h" #pragma comment(lib, "moxa/pcomm") #define HR_DEBUG_PRINT_PREFIX_MAX_SIZE 80 // max size of prefix string // Global variables static TCHAR _g_stringPrefix[HR_DEBUG_PRINT_PREFIX_MAX_SIZE] = { 0 }; BOOL __cdecl HR_PRINT_SET_PREFIX(__in LPCTSTR Prefix) { errno_t result = _tcscpy_s(_g_stringPrefix, HR_DEBUG_PRINT_PREFIX_MAX_SIZE, Prefix); return (result == 0) ? TRUE : FALSE; } BOOL __cdecl HR_PRINT_GET_PREFIX(__out LPTSTR Prefix, __in size_t size) { errno_t result = _tcsncpy_s(Prefix, size, _g_stringPrefix, HR_DEBUG_PRINT_PREFIX_MAX_SIZE); return (result == 0) ? TRUE : FALSE; } ULONG __cdecl HrDbgPrint(__in LPCTSTR Format, ...) { va_list ap; ULONG n; TCHAR szData[356] = { 0 }; lstrcat(szData, _g_stringPrefix); va_start(ap, Format); n = _vsntprintf_s(&szData[lstrlen(_g_stringPrefix)], 256, 256, Format, ap); va_end(ap); OutputDebugString(szData); return n; } ULONG __cdecl HR_PRINT_METHOD_BEGIN(__in LPCTSTR MethodName) { return HrDbgPrint(_T("-> %s\n"), MethodName); } ULONG __cdecl HR_PRINT_METHOD_END(__in LPCTSTR MethodName) { return HrDbgPrint(_T("<- %s\n"), MethodName); } SerialPort serialPort; INT WriteBytes = 0; int ReadBytes = 0; bool flag = true; #include <Windows.h> DWORD WINAPI ReadProc(void*) { char buf[1024]; while (flag) { ReadBytes += serialPort.read(buf, 1024); } return 0; } DWORD WINAPI WriteProc(void*) { char buf[1024]; while (flag) { WriteBytes += serialPort.write(buf, 1024); } return 0; } int _tmain(int argc, _TCHAR* argv[]) { HR_PRINT_SET_PREFIX(_T("#> TEST")); // test serial port //test_comm(); // test com api load //test_comapi_load(); // test com api speed //test_comapi_speed(); serialPort.set(115200, 8, "None", 1); CreateThread(NULL, 0, ReadProc, NULL, 0, NULL); CreateThread(NULL, 0, WriteProc, NULL, 0, NULL); while (1) { int c = getchar(); if (c == 'p') { printf("RX:%d, TX:%d\n", ReadBytes, WriteBytes); } else if (c == 'q') { flag = false; break; } } system("pause"); return 0; }
18.181102
92
0.686011
iclosure
2075bcb585d944b48c82d9b8299daafb2440718e
11,733
cpp
C++
src/AudioFrame.cpp
SolarAquarion/ffmpegyag
bb77508afd7dd30b853ff8e56a9a062c01ca8237
[ "MIT" ]
12
2017-09-24T06:27:25.000Z
2022-02-02T09:40:38.000Z
src/AudioFrame.cpp
SolarAquarion/ffmpegyag
bb77508afd7dd30b853ff8e56a9a062c01ca8237
[ "MIT" ]
3
2017-09-24T06:34:06.000Z
2018-06-11T05:31:21.000Z
src/AudioFrame.cpp
SolarAquarion/ffmpegyag
bb77508afd7dd30b853ff8e56a9a062c01ca8237
[ "MIT" ]
4
2018-03-02T15:23:12.000Z
2019-06-05T12:07:13.000Z
#include "AudioFrame.h" AudioFrame::AudioFrame(int64_t FrameTimestamp, int64_t FrameTimecode, int64_t FrameDuration, int FrameSampleRate, int FrameChannels, AVSampleFormat FrameSampleFormat, size_t FrameSampleCount) { Timestamp = FrameTimestamp; Timecode = FrameTimecode; Duration = FrameDuration; SampleRate = FrameSampleRate; ChannelCount = FrameChannels; PCMFormat = FrameSampleFormat; SampleCount = FrameSampleCount; DataSize = av_samples_get_buffer_size(NULL, FrameChannels, FrameSampleCount, PCMFormat, 1); ChannelSize = DataSize / ChannelCount; SampleSize = DataSize / SampleCount; SampleFormatSize = SampleSize / ChannelCount; Data = (unsigned char*)av_malloc(DataSize); } AudioFrame::~AudioFrame() { av_free(Data); Data = NULL; } void AudioFrame::FillFrame(unsigned char** FrameData) { if(av_sample_fmt_is_planar(PCMFormat) > 0) { // Convert non-interleaved data to interleaved data // TODO: Is ordering of channels correct? // [ L L L L R R R R C C C C ] -> [ L R C L R C L R C L R C ] for(size_t s=0, b=0, so=0; s<SampleCount; s++) { so = s*SampleFormatSize; for(int c=0; c<ChannelCount; c++) { for(int f=0; f<SampleFormatSize; f++) { // FrameData only holds a maximum of AV_NUM_DATA_POINTERS planes(channels) if(c < AV_NUM_DATA_POINTERS) { Data[b] = FrameData[c][so+f]; } else { Data[b] = 0; } b++; } } } } else { memcpy(Data, FrameData[0], DataSize); } } void AudioFrame::FilterFrameIntersection(int64_t* FilterTimeFrom, int64_t* FilterTimeTo, size_t* p1, size_t* p2) { int64_t Endtime = Timecode + Duration; // TODO (ronny#medium#): verify all conditions for correctness, unit testing? if(Endtime < *FilterTimeFrom) { *p1 = SampleCount; *p2 = SampleCount; return; // Outside Before } // invalid segment interval if(*FilterTimeFrom >= *FilterTimeTo) { *p2 = SampleCount; if(Timecode < *FilterTimeFrom) { *p1 = SampleCount * (*FilterTimeFrom - Timecode) / Duration; return; // Inside } *p1 = 0; return; // Intersects @From } if(Timecode > *FilterTimeTo) { *p1 = 0; *p2 = 0; return; // Outside After } // this audio packet lies completely inside the filter range if(Timecode >= *FilterTimeFrom && Endtime <= *FilterTimeTo) { *p1 = 0; *p2 = SampleCount; return; // Inside } if(Timecode <= *FilterTimeFrom && Endtime >= *FilterTimeFrom) { *p1 = SampleCount * (*FilterTimeFrom - Timecode) / Duration; if(Endtime <= *FilterTimeTo) { *p2 = SampleCount; return; // Intersects @From } *p2 = SampleCount * (*FilterTimeTo - Timecode) / Duration; return; // Intersects @From & @To } if(Timecode <= *FilterTimeTo && Endtime >= *FilterTimeTo) { *p2 = SampleCount * (*FilterTimeTo - Timecode) / Duration; if(Timecode >= *FilterTimeFrom) { *p1 = 0; return; // Intersects @To } *p1 = SampleCount * (*FilterTimeFrom - Timecode) / Duration; return; // Intersects @From & @To } printf("ERROR AudioFrame::FilterFrameIntersection(...): No appropriate audio packet pivots found!\n"); *p1 = 0; *p2 = SampleCount; } void AudioFrame::MuteClipped(int64_t* FilterTimeFrom, int64_t* FilterTimeTo) { if(Timecode < *FilterTimeFrom || Timecode + Duration > *FilterTimeTo) { size_t PivotFrom; size_t PivotTo; FilterFrameIntersection(FilterTimeFrom, FilterTimeTo, &PivotFrom, &PivotTo); // mute sound between [0...PivotFrom] memset(Data, 0, PivotFrom * SampleSize); // keep sound between [PivotFrom...PivotTo] //memset(...) // mute sound between [PivotTo...SampleCount] memset(Data + (PivotTo * SampleSize), 0, (SampleCount - PivotTo) * SampleSize); } } void AudioFrame::Fade(int64_t* FilterTimeFrom, int64_t* FilterTimeTo, FadingType FadeType, FadingCurve FadeCurve) { if((FadeType == FadeIn && Timecode < *FilterTimeTo) || (FadeType == FadeOut && Timecode + Duration > *FilterTimeFrom)) { size_t PivotFrom; size_t PivotTo; FilterFrameIntersection(FilterTimeFrom, FilterTimeTo, &PivotFrom, &PivotTo); if(FadeType == FadeIn) { // mute sound between [0...PivotFrom] memset(Data, 0, PivotFrom * SampleSize); } // keep sound between [0...PivotFrom] // fade sound between [PivotFrom...PivotTo] // unfortunately we using milli seconds as resolution -> accuracy max. 1ms, but should be sufficient for fading int64_t ratio_den = *FilterTimeTo - *FilterTimeFrom; int64_t ratio_num = ratio_den; short* data_16 = (short*)Data; int* data_32 = (int*)Data; float* data_f = (float*)Data; double* data_d = (double*)Data; size_t index; for(size_t sample_index=PivotFrom; sample_index<PivotTo; sample_index++) // loop all samples { if(FadeType == FadeIn) { ratio_num = Timecode - *FilterTimeFrom + (Duration * (int64_t)sample_index / (int64_t)SampleCount); } if(FadeType == FadeOut) { ratio_num = Timecode - *FilterTimeTo + (Duration * (int64_t)sample_index / (int64_t)SampleCount); } for(size_t c=0; c<(size_t)ChannelCount; c++) // loop all channels { // NOTE: non-interleaved (planar) formats can be treated as interleaved data, // because it was converted during the assignment (FillFrame(*data)) index = sample_index * ChannelCount + c; if(PCMFormat == AV_SAMPLE_FMT_U8 || PCMFormat == AV_SAMPLE_FMT_U8P) { if(FadeCurve == FadeLinear) { Data[index] = (unsigned char)(Data[index] * ratio_num / ratio_den); } if(FadeCurve == FadeQuadratic) { Data[index] = (unsigned char)(Data[index] * ratio_num / ratio_den); } } if(PCMFormat == AV_SAMPLE_FMT_S16 || PCMFormat == AV_SAMPLE_FMT_S16P) { if(FadeCurve == FadeLinear) { data_16[index] = (short)(data_16[index] * ratio_num / ratio_den); } if(FadeCurve == FadeQuadratic) { data_16[index] = (short)(data_16[index] * ratio_num / ratio_den); } } if(PCMFormat == AV_SAMPLE_FMT_S32 || PCMFormat == AV_SAMPLE_FMT_S32P) { if(FadeCurve == FadeLinear) { data_32[index] = (int)(data_32[index] * ratio_num / ratio_den); } if(FadeCurve == FadeQuadratic) { data_32[index] = (int)(data_32[index] * ratio_num / ratio_den); } } if(PCMFormat == AV_SAMPLE_FMT_FLT || PCMFormat == AV_SAMPLE_FMT_FLTP) { if(FadeCurve == FadeLinear) { data_f[index] = (float)(data_f[index] * ((float)ratio_num / (float)ratio_den)); } if(FadeCurve == FadeQuadratic) { data_f[index] = (float)(data_f[index] * ((float)ratio_num / (float)ratio_den)); } } if(PCMFormat == AV_SAMPLE_FMT_DBL || PCMFormat == AV_SAMPLE_FMT_DBLP) { if(FadeCurve == FadeLinear) { data_d[index] = (double)(data_d[index] * ((double)ratio_num / (double)ratio_den)); } if(FadeCurve == FadeQuadratic) { data_d[index] = (double)(data_d[index] * ((double)ratio_num / (double)ratio_den)); } } } } data_16 = NULL; data_32 = NULL; data_f = NULL; data_d = NULL; if(FadeType == FadeOut) { // mute sound between [PivotTo...SampleCount] memset(Data + (PivotTo * SampleSize), 0, (SampleCount - PivotTo) * SampleSize); } // keep sound between [PivotTo...SampleCount] } } void AudioFrame::MixDown() { if(ChannelCount > 2) { short* data_16 = (short*)Data; int* data_32 = (int*)Data; float* data_f = (float*)Data; double* data_d = (double*)Data; size_t index; size_t index_center_channel; for(size_t sample_index=0; sample_index<SampleCount; sample_index++) // loop all samples { // NOTE: non-interleaved (planar) formats can be treated as interleaved data, // because it was converted during the assignment (FillFrame(*data)) index = sample_index*ChannelCount; // NOTE: Order of interleaved channels -> Front_L, Front_R, Center, LowFreq, Side_L, Side_R, Back_L, Back_R index_center_channel = 2; if(PCMFormat == AV_SAMPLE_FMT_U8 || PCMFormat == AV_SAMPLE_FMT_U8P) { Data[index+0] = (unsigned char)((Data[index+0] + Data[index+index_center_channel]) / 2); // center ++> left Data[index+1] = (unsigned char)((Data[index+1] + Data[index+index_center_channel]) / 2); // center ++> right } if(PCMFormat == AV_SAMPLE_FMT_S16 || PCMFormat == AV_SAMPLE_FMT_S16P) { data_16[index+0] = (short)((data_16[index+0] + data_16[index+index_center_channel]) / 2); // center ++> left data_16[index+1] = (short)((data_16[index+1] + data_16[index+index_center_channel]) / 2); // center ++> right } if(PCMFormat == AV_SAMPLE_FMT_S32 || PCMFormat == AV_SAMPLE_FMT_S32P) { data_32[index+0] = (int)((data_32[index+0] + data_32[index+index_center_channel]) / 2); // center ++> left data_32[index+1] = (int)((data_32[index+1] + data_32[index+index_center_channel]) / 2); // center ++> right } if(PCMFormat == AV_SAMPLE_FMT_FLT || PCMFormat == AV_SAMPLE_FMT_FLTP) { data_f[index+0] = (float)((data_f[index+0] + data_f[index+index_center_channel]) / 2); // center ++> left data_f[index+1] = (float)((data_f[index+1] + data_f[index+index_center_channel]) / 2); // center ++> right } if(PCMFormat == AV_SAMPLE_FMT_DBL || PCMFormat == AV_SAMPLE_FMT_DBLP) { data_d[index+0] = (double)((data_d[index+0] + data_d[index+index_center_channel]) / 2); // center ++> left data_d[index+1] = (double)((data_d[index+1] + data_d[index+index_center_channel]) / 2); // center ++> right } } data_16 = NULL; data_32 = NULL; data_f = NULL; data_d = NULL; } }
37.605769
191
0.534987
SolarAquarion
208c9c87b731803550534e629c27e52784c2aa37
3,207
hpp
C++
src/webots/vrml/WbFieldModel.hpp
binppo/webots
9ac92fb46265173f25ac2358e052e3a04991cf01
[ "Apache-2.0" ]
null
null
null
src/webots/vrml/WbFieldModel.hpp
binppo/webots
9ac92fb46265173f25ac2358e052e3a04991cf01
[ "Apache-2.0" ]
null
null
null
src/webots/vrml/WbFieldModel.hpp
binppo/webots
9ac92fb46265173f25ac2358e052e3a04991cf01
[ "Apache-2.0" ]
1
2021-09-09T10:34:42.000Z
2021-09-09T10:34:42.000Z
// Copyright 1996-2019 Cyberbotics Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef WB_FIELD_MODEL_HPP #define WB_FIELD_MODEL_HPP // // Description: a class that defines a model for a node's field // The model is used in WbNodeModels. // #include <QtCore/QString> #include <WbValue.hpp> #include <WbVariant.hpp> #include <core/WbConfig.h> class WbTokenizer; class WbToken; class WbVrmlWriter; class WB_LIB_EXPORT WbFieldModel { public: // create from tokenizer WbFieldModel(WbTokenizer *tokenizer, const QString &worldPath); // field name const QString &name() const { return mName; } // VRML export bool isVrml() const { return mIsVrml; } void write(WbVrmlWriter &writer) const; bool isDeprecated() const { return mIsDeprecated; } // Hidden field flag bool isHiddenField() const { return mIsHiddenField; } bool isHiddenParameter() const { return mIsHiddenParameter; } bool isUnconnected() const { return mIsUnconnected; } // default value WbValue *defaultValue() const { return mDefaultValue; } // accepted values bool isValueAccepted(const WbValue *value, int *refusedIndex) const; bool hasRestrictedValues() const { return !mAcceptedValues.isEmpty(); } const QList<WbVariant> acceptedValues() const { return mAcceptedValues; } // field type WbFieldType type() const { return mDefaultValue->type(); } bool isMultiple() const; bool isSingle() const; // useful tokens for error reporting WbToken *nameToken() const { return mNameToken; } // template void setTemplateRegenerator(bool isRegenerator) { mIsTemplateRegenerator = isRegenerator; } bool isTemplateRegenerator() const { return mIsTemplateRegenerator; } // add/remove a reference to this field model from a field, a proto model or a node model instance // when the reference count reaches zero (in unref()) the field model is deleted void ref() const; void unref() const; // delete this field model // reference count has to be zero void destroy(); private: WbFieldModel(const WbFieldModel &); // non constructor-copyable WbFieldModel &operator=(const WbFieldModel &); // non copyable ~WbFieldModel(); QString mName; bool mIsVrml; bool mIsHiddenField, mIsHiddenParameter; bool mIsTemplateRegenerator; bool mIsDeprecated; bool mIsUnconnected; WbValue *mDefaultValue; QList<WbVariant> mAcceptedValues; // TODO: const WbVariant WbToken *mNameToken; mutable int mRefCount; WbValue *createValueForVrmlType(const QString &type, WbTokenizer *tokenizer, const QString &worldPath); QList<WbVariant> getAcceptedValues(const QString &type, WbTokenizer *tokenizer, const QString &worldPath); }; #endif
30.836538
108
0.741191
binppo
208e009d0f1045a14240785fd3d86d3cffe85fd9
5,020
cpp
C++
UnitTests/ZilchShaders/RendererShared.cpp
RachelWilSingh/ZeroCore
e9a2f82d395e5c89fb98eceac44ce60d016dbff3
[ "MIT" ]
52
2018-09-11T17:18:35.000Z
2022-03-13T15:28:21.000Z
UnitTests/ZilchShaders/RendererShared.cpp
RachelWilSingh/ZeroCore
e9a2f82d395e5c89fb98eceac44ce60d016dbff3
[ "MIT" ]
1,409
2018-09-19T18:03:43.000Z
2021-06-09T08:33:33.000Z
UnitTests/ZilchShaders/RendererShared.cpp
RachelWilSingh/ZeroCore
e9a2f82d395e5c89fb98eceac44ce60d016dbff3
[ "MIT" ]
26
2018-09-11T17:16:32.000Z
2021-11-22T06:21:19.000Z
/////////////////////////////////////////////////////////////////////////////// /// /// Authors: Joshua Davis /// Copyright 2015, DigiPen Institute of Technology /// /////////////////////////////////////////////////////////////////////////////// #include "Precompiled.hpp" String mFragmentExtension = "zilchfrag"; String RenderResults::mZilchKey = "Zilch"; LogMessage::LogMessage() { } LogMessage::LogMessage(StringParam filePath, StringParam lineNumber, StringParam message) { mFilePath = filePath; mLineNumber = lineNumber; mMessage = message; } //-------------------------------------------------------------------ErrorReporter ErrorReporter::ErrorReporter() { mAssert = true; } void ErrorReporter::Report(StringParam message) { ZPrint("%s", message.c_str()); if(mAssert) ZERO_DEBUG_BREAK; } void ErrorReporter::Report(StringParam filePath, StringParam lineNumber, StringParam header, StringParam message) { if(!header.Empty()) ZPrint("%s", header.c_str()); // Display the error in visual studio format (so double-clicking the error line will work) ZPrint("%s(%s): \n\t%s\n", filePath.c_str(), lineNumber.c_str(), message.c_str()); if(mAssert) ZERO_DEBUG_BREAK; } void ErrorReporter::Report(StringParam filePath, StringParam lineNumber, StringParam message) { Report(filePath, lineNumber, String(), message); } void ErrorReporter::ReportCompilationWarning(StringParam filePath, StringParam lineNumber, StringParam message) { bool assert = mAssert; mAssert = false; String header = "\n------------Compilation Warnings------------\n\n"; Report(filePath, lineNumber, header, message); mAssert = assert; } void ErrorReporter::ReportCompilationWarning(const Array<LogMessage>& messages) { String header = "\n------------Compilation Warnings------------\n\n"; ZPrint("%s", header.c_str()); // Display the error in visual studio format (so double-clicking the error line will work) for(size_t i = 0; i < messages.Size(); ++i) { const LogMessage& message = messages[i]; ZPrint("%s(%s): \n\t%s\n", message.mFilePath.c_str(), message.mLineNumber.c_str(), message.mMessage.c_str()); } } void ErrorReporter::ReportCompilationError(StringParam filePath, StringParam lineNumber, StringParam message) { String header = "\n------------Compilation Errors------------\n\n"; Report(filePath, lineNumber, header, message); } void ErrorReporter::ReportCompilationError(const Array<LogMessage>& messages) { String header = "\n------------Compilation Errors------------\n\n"; ZPrint("%s", header.c_str()); // Display the error in visual studio format (so double-clicking the error line will work) for(size_t i = 0; i < messages.Size(); ++i) { const LogMessage& message = messages[i]; ZPrint("%s(%s): \n\t%s\n", message.mFilePath.c_str(), message.mLineNumber.c_str(), message.mMessage.c_str()); } if(mAssert) ZERO_DEBUG_BREAK; } void ErrorReporter::ReportLinkerError(StringParam filePath, StringParam lineNumber, StringParam message) { String header = "\n------------Linker Errors------------\n\n"; Report(filePath, lineNumber, header, message); } void ErrorReporter::ReportPostProcessError(StringParam testName, Vec4Param expected, Vec4Param result, int renderTargetIndex) { String expectedVectorStr = String::Format("(%g, %g, %g, %g)", expected.x, expected.y, expected.z, expected.w); String resultVectorStr = String::Format("(%g, %g, %g, %g)", result.x, result.y, result.z, result.w); String message = String::Format("Post process %s failed target %d. Expected %s but got %s", testName.c_str(), renderTargetIndex, expectedVectorStr.c_str(), resultVectorStr.c_str()); Report(message); } void ErrorReporter::DisplayDiffs(StringParam expectedFile, StringParam resultFile) { if(mAssert) { String parameters = String::Format("\"%s\" \"%s\"", resultFile.c_str(), expectedFile.c_str()); String arguments = String::Format("tortoisemerge.exe %s", parameters.c_str()); SimpleProcess process; process.ExecProcess("tortoisemerge", arguments.c_str(), nullptr, true); process.WaitForClose(); } } //-------------------------------------------------------------------FragmentInfo FragmentInfo::FragmentInfo() { } FragmentInfo::FragmentInfo(StringParam filePath) { mFilePath = filePath; mFragmentCode = ReadFileIntoString(filePath); } FragmentInfo::FragmentInfo(StringParam filePath, StringParam fragmentCode) { mFilePath = filePath; mFragmentCode = fragmentCode; } //-------------------------------------------------------------------BaseRenderer BaseRenderer::BaseRenderer() { // buffer for fullscreen triangle mFullScreenTriangleVerts[0] = {Vec3(-1, 3, 0), Vec2(0, -1), Vec4()}; mFullScreenTriangleVerts[1] = {Vec3(-1, -1, 0), Vec2(0, 1), Vec4()}; mFullScreenTriangleVerts[2] = {Vec3(3, -1, 0), Vec2(2, 1), Vec4()}; }
32.179487
184
0.629681
RachelWilSingh
208ef8e54f0800ecc365ca834868adf9d5b9d3d5
930
cpp
C++
Challenge-2020-07/3_sum.cpp
qiufengyu/LetsCode
196fae0bf5c78ee20d05798a9439596e702fdb24
[ "MIT" ]
null
null
null
Challenge-2020-07/3_sum.cpp
qiufengyu/LetsCode
196fae0bf5c78ee20d05798a9439596e702fdb24
[ "MIT" ]
null
null
null
Challenge-2020-07/3_sum.cpp
qiufengyu/LetsCode
196fae0bf5c78ee20d05798a9439596e702fdb24
[ "MIT" ]
null
null
null
#include "header.h" class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) { vector<vector<int>> res; int size = nums.size(); sort(nums.begin(), nums.end()); for (int i = 0; i < size - 2; i++) { if ( i > 0 && nums[i] > 0) break; if (nums[i] == nums[i-1]) continue; int l = i + 1, r = size - 1; while (l < r) { if (nums[i] + nums[l] + nums[r] == 0) { res.push_back({nums[i], nums[l], nums[r]}); l++; r--; while (l < r && nums[l] == nums[l - 1]) l++; while (l < r && nums[r] == nums[r + 1]) r--; } else if (nums[i] + nums[l] + nums[r] < 0) { l++; } else { r--; } } } return res; } }; int main() { return 0; }
29.0625
64
0.352688
qiufengyu
2092d9f3af99ecdf098a4d38c0c597b3884ff79e
1,256
cc
C++
src/gui/ScreenManager.cc
shiromino/shiromino
10e9bc650417ea05d5990836c64709af3f82ec5e
[ "CC-BY-4.0" ]
23
2020-07-12T22:49:10.000Z
2022-03-15T17:58:22.000Z
src/gui/ScreenManager.cc
shiromino/shiromino
10e9bc650417ea05d5990836c64709af3f82ec5e
[ "CC-BY-4.0" ]
64
2020-07-12T22:27:53.000Z
2022-01-02T23:10:24.000Z
src/gui/ScreenManager.cc
shiromino/shiromino
10e9bc650417ea05d5990836c64709af3f82ec5e
[ "CC-BY-4.0" ]
8
2020-08-30T04:16:17.000Z
2021-06-28T17:12:06.000Z
#include "ScreenManager.h" #include "CoreState.h" #include "game_qs.h" GUIScreen *mainMenu_create(CoreState *cs, ScreenManager *mngr, BitFont& font) { SDL_Rect destRect = {0, 0, 640, 480}; GUIScreen *mainMenu = new GUIScreen {cs, "Main Menu", mainMenuInteractionCallback, destRect}; SDL_Rect pentominoRect = {20, 20, 100, 20}; Button *button1 = new Button {0, pentominoRect, "Pentomino C", font}; SDL_Rect g1MasterRect = {20, 42, 100, 20}; Button *button2 = new Button {1, g1MasterRect, "G1 Master", font}; mainMenu->addControlElement(button1); mainMenu->addControlElement(button2); return mainMenu; } void mainMenuInteractionCallback(GUIInteractable& interactable, GUIEvent& event) { if(event.type == mouse_clicked) { CoreState *cs = interactable.getWindow()->origin; switch(interactable.ID) { default: break; case 0: cs->p1game = qs_game_create(cs, 0, MODE_PENTOMINO, -1); cs->p1game->init(cs->p1game); break; case 1: cs->p1game = qs_game_create(cs, 0, MODE_G1_MASTER, -1); cs->p1game->init(cs->p1game); break; } } }
27.911111
97
0.599522
shiromino
2096cde2cb4d401e3d8d98efe3743aa451fc3fff
20,092
cpp
C++
tests/unittests/tiglWingGuideCurves.cpp
MarAlder/tigl
76e1f1442a045e1b8b7954119ca6f9c883ea41e2
[ "Apache-2.0" ]
null
null
null
tests/unittests/tiglWingGuideCurves.cpp
MarAlder/tigl
76e1f1442a045e1b8b7954119ca6f9c883ea41e2
[ "Apache-2.0" ]
null
null
null
tests/unittests/tiglWingGuideCurves.cpp
MarAlder/tigl
76e1f1442a045e1b8b7954119ca6f9c883ea41e2
[ "Apache-2.0" ]
null
null
null
/* * Copyright (C) 2007-2014 German Aerospace Center (DLR/SC) * * Created: 2014-02-10 Tobias Stollenwerk <Tobias.Stollenwerk@dlr.de> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file * @brief Tests for wing guide curves */ #include "test.h" // Brings in the GTest framework #include "tigl.h" #include "testUtils.h" #include "tiglcommonfunctions.h" #include "CSharedPtr.h" #include "CCPACSConfigurationManager.h" #include "BRep_Tool.hxx" #include "TopoDS_Shape.hxx" #include "TopTools_SequenceOfShape.hxx" #include "TopExp_Explorer.hxx" #include "BRepBuilderAPI_MakeEdge.hxx" #include "BRepBuilderAPI_MakeWire.hxx" #include "BRepTools_WireExplorer.hxx" #include "Geom_Curve.hxx" #include "Geom_Plane.hxx" #include "Geom_Circle.hxx" #include "gp_Pnt.hxx" #include "gp_Vec.hxx" #include "BRep_Builder.hxx" #include "GeomAPI_IntCS.hxx" #include "GeomAPI_ProjectPointOnCurve.hxx" #include "CTiglError.h" #include "CTiglTransformation.h" #include "CCPACSGuideCurveProfile.h" #include "CCPACSGuideCurveProfiles.h" #include "generated/CPACSGuideCurve.h" #include "CCPACSGuideCurves.h" #include "CCPACSWingProfileGetPointAlgo.h" #include "CCPACSGuideCurveAlgo.h" #include "CCPACSWingSegment.h" #include "tiglcommonfunctions.h" /******************************************************************************/ typedef class CSharedPtr<tigl::CTiglPoint> PCTiglPoint; class WingGuideCurve : public ::testing::Test { protected: void SetUp() override { const char* filename = "TestData/simple_test_guide_curves.xml"; ReturnCode tixiRet; TiglReturnCode tiglRet; tiglHandle = -1; tixiHandle = -1; tixiRet = tixiOpenDocument(filename, &tixiHandle); ASSERT_TRUE (tixiRet == SUCCESS); tiglRet = tiglOpenCPACSConfiguration(tixiHandle, "GuideCurveModel", &tiglHandle); ASSERT_TRUE(tiglRet == TIGL_SUCCESS); // get guide curve //tigl::CCPACSGuideCurve & guideCurve = config.GetGuideCurve("GuideCurveModel_Wing_Sec1_El1_Pro"); // constant values for the guide curve points const double tempy[] = {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9}; beta=std::vector<double>(tempy, tempy + sizeof(tempy) / sizeof(tempy[0]) ); const double tempz[] = {0.0, 0.001, 0.003, 0.009, 0.008, 0.007, 0.006, 0.002, 0.0}; gamma=std::vector<double>(tempz, tempz + sizeof(tempz) / sizeof(tempz[0]) ); } void TearDown() override { ASSERT_TRUE(tiglCloseCPACSConfiguration(tiglHandle) == TIGL_SUCCESS); ASSERT_TRUE(tixiCloseDocument(tixiHandle) == SUCCESS); tiglHandle = -1; tixiHandle = -1; } TixiDocumentHandle tixiHandle; TiglCPACSConfigurationHandle tiglHandle; //tigl::CCPACSGuideCurve guideCurve; std::vector<double> alpha; std::vector<double> beta; std::vector<double> gamma; }; /******************************************************************************/ /** * Tests CCPACSGuideCurveProfile class */ TEST_F(WingGuideCurve, tiglWingGuideCurve_CCPACSGuideCurveProfile) { tigl::CCPACSGuideCurveProfile guideCurve(NULL); guideCurve.ReadCPACS(tixiHandle, "/cpacs/vehicles/profiles/guideCurves/guideCurveProfile[5]"); ASSERT_EQ(guideCurve.GetUID(), "GuideCurveModel_Wing_GuideCurveProfile_LeadingEdge_NonLinear"); ASSERT_EQ(guideCurve.GetName(), "NonLinear Leading Edge Guide Curve Profile for GuideCurveModel - Wing"); } /** * Tests CCPACSGuideCurveProfiles class */ TEST_F(WingGuideCurve, tiglWingGuideCurve_CCPACSGuideCurveProfiles) { tigl::CCPACSGuideCurveProfiles guideCurves(NULL); guideCurves.ReadCPACS(tixiHandle, "/cpacs/vehicles/profiles/guideCurves"); ASSERT_EQ(guideCurves.GetGuideCurveProfileCount(), 6); tigl::CCPACSGuideCurveProfile& guideCurve = guideCurves.GetGuideCurveProfile("GuideCurveModel_Wing_GuideCurveProfile_LeadingEdge_NonLinear"); ASSERT_EQ(guideCurve.GetUID(), "GuideCurveModel_Wing_GuideCurveProfile_LeadingEdge_NonLinear"); ASSERT_EQ(guideCurve.GetName(), "NonLinear Leading Edge Guide Curve Profile for GuideCurveModel - Wing"); } /** * Tests CCPACSGuideCurve class */ TEST_F(WingGuideCurve, tiglWingGuideCurve_CCPACSGuideCurve) { tigl::CCPACSGuideCurve guideCurve(NULL); guideCurve.ReadCPACS(tixiHandle, "/cpacs/vehicles/aircraft/model/wings/wing/segments/segment[1]/guideCurves/guideCurve[1]"); ASSERT_EQ(guideCurve.GetUID(), "GuideCurveModel_Wing_Seg_1_2_GuideCurve_TrailingEdgeLower"); ASSERT_EQ(guideCurve.GetName(), "Lower Trailing Edge GuideCurve from GuideCurveModel - Wing Section 1 Main Element to GuideCurveModel - Wing Section 2 Main Element "); ASSERT_EQ(guideCurve.GetGuideCurveProfileUID(), "GuideCurveModel_Wing_GuideCurveProfile_TrailingEdgeLower_NonLinear"); ASSERT_TRUE(!!guideCurve.GetFromRelativeCircumference_choice2()); ASSERT_EQ(*guideCurve.GetFromRelativeCircumference_choice2(), -1.0); ASSERT_EQ(guideCurve.GetToRelativeCircumference(), -1.0); } /** * Tests CCPACSGuideCurves class */ TEST_F(WingGuideCurve, tiglWingGuideCurve_CCPACSGuideCurves) { tigl::CCPACSGuideCurves guideCurves(NULL); guideCurves.ReadCPACS(tixiHandle, "/cpacs/vehicles/aircraft/model/wings/wing/segments/segment[2]/guideCurves"); ASSERT_EQ(guideCurves.GetGuideCurveCount(), 3); const tigl::CCPACSGuideCurve& guideCurve = guideCurves.GetGuideCurve("GuideCurveModel_Wing_Seg_2_3_GuideCurve_LeadingEdge"); ASSERT_EQ(guideCurve.GetUID(), "GuideCurveModel_Wing_Seg_2_3_GuideCurve_LeadingEdge"); ASSERT_EQ(guideCurve.GetName(), "Leading Edge GuideCurve from GuideCurveModel - Wing Section 2 Main Element to GuideCurveModel - Wing Section 3 Main Element "); ASSERT_EQ(guideCurve.GetGuideCurveProfileUID(), "GuideCurveModel_Wing_GuideCurveProfile_LeadingEdge_NonLinear"); ASSERT_TRUE(!guideCurve.GetFromRelativeCircumference_choice2()); ASSERT_EQ(*guideCurve.GetFromGuideCurveUID_choice1(), "GuideCurveModel_Wing_Seg_1_2_GuideCurve_LeadingEdge_NonLinear" ); ASSERT_EQ(guideCurve.GetToRelativeCircumference(), 0.0); } /** * Tests CCPACSWingProfileGetPointAlgo class */ TEST_F(WingGuideCurve, tiglWingGuideCurve_CCPACSWingProfileGetPointAlgoOnProfile) { // read configuration tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); tigl::CCPACSConfiguration& config = manager.GetConfiguration(tiglHandle); // get upper and lower wing profile tigl::CCPACSWingProfile& profile = config.GetWingProfile("GuideCurveModel_Wing_Sec3_El1_Pro"); TopoDS_Edge upperWire = profile.GetUpperWire(); TopoDS_Edge lowerWire = profile.GetLowerWire(); // concatenate wires TopTools_SequenceOfShape wireContainer; wireContainer.Append(lowerWire); wireContainer.Append(upperWire); // instantiate getPointAlgo tigl::CCPACSWingProfileGetPointAlgo getPointAlgo(wireContainer); gp_Pnt point; gp_Vec tangent; // plot points and tangents int N = 20; int M = 2; for (int i=0; i<=N+2*M; i++) { double da = 2.0/double(N); double alpha = -1.0 -M*da + da*i; getPointAlgo.GetPointTangent(alpha, point, tangent); outputXY(i, point.X(), point.Z(), "./TestData/analysis/tiglWingGuideCurve_profileSamplePoints_points.dat"); outputXYVector(i, point.X(), point.Z(), tangent.X(), tangent.Z(), "./TestData/analysis/tiglWingGuideCurve_profileSamplePoints_tangents.dat"); // plot points and tangents with gnuplot by: // echo "plot 'TestData/analysis/tiglWingGuideCurve_profileSamplePoints_tangents.dat' u 1:2:3:4 with vectors filled head lw 2, 'TestData/analysis/tiglWingGuideCurve_profileSamplePoints_points.dat' w linespoints lw 2" | gnuplot -persist } // leading edge: point must be zero and tangent must be in z-direction getPointAlgo.GetPointTangent(0.0, point, tangent); ASSERT_NEAR(point.X(), 0.0, 1E-10); ASSERT_NEAR(point.Y(), 0.0, 1E-10); ASSERT_NEAR(point.Z(), 0.0, 1E-10); ASSERT_NEAR(tangent.X(), 0.0, 1E-10); ASSERT_NEAR(tangent.Y(), 0.0, 1E-10); // lower trailing edge getPointAlgo.GetPointTangent(-1.0, point, tangent); ASSERT_NEAR(point.X(), 1.0, 1E-5); ASSERT_NEAR(point.Y(), 0.0, 1E-10); ASSERT_NEAR(point.Z(), -0.003, 1E-5); // upper trailing edge getPointAlgo.GetPointTangent(1.0, point, tangent); ASSERT_NEAR(point.X(), 1.0, 1E-10); ASSERT_NEAR(point.Y(), 0.0, 1E-10); ASSERT_NEAR(point.Z(), 0.00126, 1E-10); // check if tangent is constant for alpha > 1 gp_Vec tangent2; getPointAlgo.GetPointTangent(1.0, point, tangent); getPointAlgo.GetPointTangent(2.0, point, tangent2); ASSERT_EQ(tangent.X(), tangent2.X()); ASSERT_EQ(tangent.Y(), tangent2.Y()); ASSERT_EQ(tangent.Z(), tangent2.Z()); // check if tangent is constant for alpha < 1 getPointAlgo.GetPointTangent(-1.0, point, tangent); getPointAlgo.GetPointTangent(-2.0, point, tangent2); ASSERT_EQ(tangent.X(), tangent2.X()); ASSERT_EQ(tangent.Y(), tangent2.Y()); ASSERT_EQ(tangent.Z(), tangent2.Z()); } /** * Tests CCPACSWingProfileGetPointAlgo class */ TEST_F(WingGuideCurve, tiglWingGuideCurve_CCPACSWingProfileGetPointAlgoOnCircle) { double radius1=1.0; gp_Pnt location1(radius1, 0.0, 0.0); gp_Ax2 circlePosition1(location1, gp::DY(), gp::DX()); Handle(Geom_Circle) circle1 = new Geom_Circle(circlePosition1, radius1); // cut into lower and upper half circle double start=0.0; double mid=start+M_PI; double end=mid+M_PI; TopoDS_Edge innerLowerEdge = BRepBuilderAPI_MakeEdge(circle1, start, mid); TopoDS_Edge innerUpperEdge = BRepBuilderAPI_MakeEdge(circle1, mid, end); // concatenate wires for guide curve algo TopTools_SequenceOfShape innerWireContainer; innerWireContainer.Append(innerLowerEdge); innerWireContainer.Append(innerUpperEdge); // instantiate getPointAlgo tigl::CCPACSWingProfileGetPointAlgo getPointAlgo(innerWireContainer); gp_Pnt point; gp_Vec tangent; // plot points and tangents int N = 20; int M = 2; for (int i=0; i<=N+2*M; i++) { double da = 2.0/double(N); double alpha = -1.0 -M*da + da*i; getPointAlgo.GetPointTangent(alpha, point, tangent); outputXY(i, point.X(), point.Z(), "./TestData/analysis/tiglWingGuideCurve_circleSamplePoints_points.dat"); outputXYVector(i, point.X(), point.Z(), tangent.X(), tangent.Z(), "./TestData/analysis/tiglWingGuideCurve_circleSamplePoints_tangents.dat"); // plot points and tangents with gnuplot by: // echo "plot 'TestData/analysis/tiglWingGuideCurve_circleSamplePoints_tangents.dat' u 1:2:3:4 with vectors filled head lw 2, 'TestData/analysis/tiglWingGuideCurve_circleSamplePoints_points.dat' w linespoints lw 2" | gnuplot -persist } // leading edge: point must be zero and tangent must be in z-direction and has to be of length pi getPointAlgo.GetPointTangent(0.0, point, tangent); ASSERT_NEAR(point.X(), 0.0, 1E-10); ASSERT_NEAR(point.Y(), 0.0, 1E-10); ASSERT_NEAR(point.Z(), 0.0, 1E-10); ASSERT_NEAR(tangent.X(), 0.0, 1E-10); ASSERT_NEAR(tangent.Y(), 0.0, 1E-10); ASSERT_NEAR(tangent.Z(), M_PI, 1E-10); // check lower trailing edge point. Tangent must be in negative z-direction has to be of length pi getPointAlgo.GetPointTangent(-1.0, point, tangent); ASSERT_NEAR(point.X(), 2.0, 1E-10); ASSERT_NEAR(point.Y(), 0.0, 1E-10); ASSERT_NEAR(point.Z(), 0.0, 1E-10); ASSERT_NEAR(tangent.X(), 0.0, 1E-10); ASSERT_NEAR(tangent.Y(), 0.0, 1E-10); ASSERT_NEAR(tangent.Z(), -M_PI, 1E-10); // check upper trailing edge point. Tangent must be in negative z-direction has to be of length pi getPointAlgo.GetPointTangent(1.0, point, tangent); ASSERT_NEAR(point.X(), 2.0, 1E-10); ASSERT_NEAR(point.Y(), 0.0, 1E-10); ASSERT_NEAR(point.Z(), 0.0, 1E-10); ASSERT_NEAR(tangent.X(), 0.0, 1E-10); ASSERT_NEAR(tangent.Y(), 0.0, 1E-10); ASSERT_NEAR(tangent.Z(), -M_PI, 1E-10); // check points and tangents for alpha > 1 gp_Pnt point2; gp_Vec tangent2; getPointAlgo.GetPointTangent(1.0, point, tangent); getPointAlgo.GetPointTangent(2.0, point2, tangent2); ASSERT_NEAR(point2.X(), 2.0, 1E-10); ASSERT_NEAR(point2.Y(), 0.0, 1E-10); ASSERT_NEAR(point2.Z(), -M_PI, 1E-10); ASSERT_EQ(tangent.X(), tangent2.X()); ASSERT_EQ(tangent.Y(), tangent2.Y()); ASSERT_EQ(tangent.Z(), tangent2.Z()); ASSERT_NEAR(point.Distance(point2), M_PI, 1E-10); // check if tangent is constant for alpha < 1 getPointAlgo.GetPointTangent(-1.0, point, tangent); getPointAlgo.GetPointTangent(-2.0, point2, tangent2); ASSERT_NEAR(point2.X(), 2.0, 1E-10); ASSERT_NEAR(point2.Y(), 0.0, 1E-10); ASSERT_NEAR(point2.Z(), M_PI, 1E-10); ASSERT_EQ(tangent.X(), tangent2.X()); ASSERT_EQ(tangent.Y(), tangent2.Y()); ASSERT_EQ(tangent.Z(), tangent2.Z()); ASSERT_NEAR(point.Distance(point2), M_PI, 1E-10); } /** * Tests CCPACSGuideCurveAlgo class */ TEST_F(WingGuideCurve, tiglWingGuideCurve_CCPACSGuideCurveAlgo) { // create two circles parallel to the x-z plane going through the y-axis at alpha=0 // the sense of rotation is such that the negative z-values come first double radius1=1.0; double radius2=1.0; double distance=1.0; gp_Pnt location1(radius1, 0.0, 0.0); gp_Ax2 circlePosition1(location1, gp::DY(), gp::DX()); Handle(Geom_Circle) circle1 = new Geom_Circle(circlePosition1, radius1); gp_Pnt location2(radius2, distance, 0.0); gp_Ax2 circlePosition2(location2, gp::DY(), gp::DX()); Handle(Geom_Circle) circle2 = new Geom_Circle(circlePosition2, radius2); // cut into lower and upper half circle double start=0.0; double mid=start+M_PI; double end=mid+M_PI; TopoDS_Edge innerLowerEdge = BRepBuilderAPI_MakeEdge(circle1, start, mid); TopoDS_Edge innerUpperEdge = BRepBuilderAPI_MakeEdge(circle1, mid, end); TopoDS_Edge outerLowerEdge = BRepBuilderAPI_MakeEdge(circle2, start, mid); TopoDS_Edge outerUpperEdge = BRepBuilderAPI_MakeEdge(circle2, mid, end); // concatenate wires for guide curve algo TopTools_SequenceOfShape innerWireContainer; innerWireContainer.Append(innerLowerEdge); innerWireContainer.Append(innerUpperEdge); TopTools_SequenceOfShape outerWireContainer; outerWireContainer.Append(outerLowerEdge); outerWireContainer.Append(outerUpperEdge); // get guide curve profile tigl::CCPACSGuideCurveProfile guideCurveProfile(NULL); guideCurveProfile.ReadCPACS(tixiHandle, "/cpacs/vehicles/profiles/guideCurves/guideCurveProfile[5]"); std::vector<gp_Pnt> guideCurvePnts; // instantiate guideCurveAlgo guideCurvePnts = tigl::CCPACSGuideCurveAlgo<tigl::CCPACSWingProfileGetPointAlgo> (innerWireContainer, outerWireContainer, 0.0, 0.0, 2*radius1, 2*radius2, gp_Dir(1., 0., 0.), guideCurveProfile); TopoDS_Edge guideCurveEdge = EdgeSplineFromPoints(guideCurvePnts);; // check if guide curve runs through sample points // get curve Standard_Real u1, u2; Handle(Geom_Curve) curve = BRep_Tool::Curve(guideCurveEdge, u1, u2); // set predicted sample points from cpacs file const double temp[] = {0.0, 0.0, -0.01, -0.03, -0.09, -0.08, -0.07, -0.06, -0.02, 0.0, 0.0}; std::vector<double> predictedSamplePointsX (temp, temp + sizeof(temp) / sizeof(temp[0]) ); for (unsigned int i = 0; i <= 10; ++i) { // get intersection point of the guide curve with planes parallel to the x-z plane located at b double b = i/double(10); Handle(Geom_Plane) plane = new Geom_Plane(gp_Pnt(0.0, b*distance, 0.0), gp_Dir(0.0, 1.0, 0.0)); GeomAPI_IntCS intersection (curve, plane); ASSERT_EQ(Standard_True, intersection.IsDone()); ASSERT_EQ(intersection.NbPoints(), 1); gp_Pnt point = intersection.Point(1); // scale sample points since 2nd profile is scaled by a factor 2 predictedSamplePointsX[i]*=(2*radius1+(2*radius2-2*radius1)*b); // check is guide curve runs through the predicted sample points ASSERT_NEAR(predictedSamplePointsX[i], point.X(), 1E-14); ASSERT_NEAR(b*distance, point.Y(), 1E-14); ASSERT_NEAR(0.0, point.Z(), 1E-14); } } /** * Tests wing segment guide curve routines */ TEST_F(WingGuideCurve, tiglWingGuideCurve_CCPACSWingSegment) { tigl::CCPACSConfigurationManager& manager = tigl::CCPACSConfigurationManager::GetInstance(); tigl::CCPACSConfiguration& config = manager.GetConfiguration(tiglHandle); tigl::CCPACSWing& wing = config.GetWing(1); ASSERT_EQ(wing.GetSegmentCount(),3); tigl::CCPACSWingSegment& segment3 = wing.GetSegment(3); ASSERT_TRUE(segment3.GetGuideCurves().get_ptr() != NULL); tigl::CCPACSGuideCurves& guides = *segment3.GetGuideCurves(); ASSERT_EQ(guides.GetGuideCurveCount(), 3); // obtain leading edge guide curve TopoDS_Edge guideCurveEdge = guides.GetGuideCurve(1).GetCurve(); // check if guide curve runs through sample points // get curve Standard_Real u1, u2; Handle(Geom_Curve) curve = BRep_Tool::Curve(guideCurveEdge, u1, u2); // gamma values of cpacs data points const double temp[] = {0.0, 0.0, -0.01, -0.03, -0.09, -0.08, -0.07, -0.06, -0.02, 0.0, 0.0}; std::vector<double> gammaDeviation (temp, temp + sizeof(temp) / sizeof(temp[0]) ); // number of sample points unsigned int N=10; // segement width double width=2.0; // segment position double position=12.0; // inner profile scale factor double innerScale=1.0; // outer profile scale factor double outerScale=0.5; // outer profile has a sweep angle of -30 degrees) double angle=-M_PI/6.0; for (unsigned int i = 0; i <= N; ++i) { // get intersection point of the guide curve with planes in direction n located at b // n is the y direction rotated pi/6 (30 degrees) inside the x-y plane double b = width*i/double(N); gp_Pnt planeLocation = gp_Pnt(b*sin(angle), b*cos(angle)+position, 0.0); Handle(Geom_Plane) plane = new Geom_Plane(planeLocation, gp_Dir(0.0, 1.0, 0.0)); GeomAPI_IntCS intersection (curve, plane); ASSERT_EQ(intersection.NbPoints(), 1); gp_Pnt point = intersection.Point(1); // start at segment leading edge gp_Vec predictedPoint(0.0, position, 0.0); // go along the leading edge predictedPoint += gp_Vec(b*sin(angle), b*cos(angle), 0.0); // scale sample points since outer profile's chordline smaller by a factor of 0.5 double s=(innerScale+(outerScale-innerScale)*i/double(N)); // go along direction perpendicular to the leading edge in the x-y plane predictedPoint += gp_Vec(gammaDeviation[i]*s, 0.0, 0.0); // check is guide curve runs through the predicted sample points ASSERT_NEAR(predictedPoint.X(), point.X(), 1E-5); ASSERT_NEAR(predictedPoint.Y(), point.Y(), 1E-5); ASSERT_NEAR(predictedPoint.Z(), point.Z(), 1E-14); } }
43.678261
244
0.689578
MarAlder
2098ec4d8fdccefe938aa81571c5dcb93d2384c6
28,136
cpp
C++
tools/geomc/main.cpp
tonipes/wargrid
2458f3f606f28fe6892c67eb736d5c8282d02c85
[ "MIT" ]
null
null
null
tools/geomc/main.cpp
tonipes/wargrid
2458f3f606f28fe6892c67eb736d5c8282d02c85
[ "MIT" ]
null
null
null
tools/geomc/main.cpp
tonipes/wargrid
2458f3f606f28fe6892c67eb736d5c8282d02c85
[ "MIT" ]
null
null
null
// ============================================================================ // Kimberlite // // Copyright 2020 Toni Pesola. All Rights Reserved. // ============================================================================ #define KB_TOOL_ONLY #include <kb/foundation/core.h> #include <kb/foundation/time.h> #include <kb/foundation/array.h> #include <kb/log.h> #include <kbextra/cliargs.h> #include <kbextra/geometry.h> #include <kbextra/vertex.h> #include "kb/foundation.cpp" #include "kb/log.cpp" #include "kbextra/texture.cpp" #include "kbextra/vertex.cpp" #include "kbextra/cliargs.cpp" #include "kbextra/geometry.cpp" #include <meshoptimizer/meshoptimizer.h> #include <meshoptimizer/allocator.cpp> #include <meshoptimizer/clusterizer.cpp> #include <meshoptimizer/indexcodec.cpp> #include <meshoptimizer/indexgenerator.cpp> #include <meshoptimizer/overdrawanalyzer.cpp> #include <meshoptimizer/overdrawoptimizer.cpp> #include <meshoptimizer/simplifier.cpp> #include <meshoptimizer/spatialorder.cpp> #include <meshoptimizer/stripifier.cpp> #include <meshoptimizer/vcacheanalyzer.cpp> #include <meshoptimizer/vcacheoptimizer.cpp> #include <meshoptimizer/vertexcodec.cpp> #include <meshoptimizer/vertexfilter.cpp> #include <meshoptimizer/vfetchanalyzer.cpp> #include <meshoptimizer/vfetchoptimizer.cpp> #define CGLTF_IMPLEMENTATION #include <cgltf/cgltf.h> #include <platform/platform_rwops_stdio.cpp> #define EXIT_FAIL 1 #define EXIT_SUCCESS 0 #define POSITION_TYPE kb::float4 #define NORMAL_TYPE kb::float4 #define TANGENT_TYPE kb::float4 #define TEXCOORD_TYPE kb::float4 #define COLOR_TYPE kb::float4 #define JOINT_TYPE kb::float4 #define WEIGHT_TYPE kb::float4 const uint16_t POSITION_COMPONENT_COUNT = sizeof(POSITION_TYPE) / sizeof(float); const uint16_t NORMAL_COMPONENT_COUNT = sizeof(NORMAL_TYPE) / sizeof(float); const uint16_t TANGENT_COMPONENT_COUNT = sizeof(TANGENT_TYPE) / sizeof(float); const uint16_t TEXCOORD_COMPONENT_COUNT = sizeof(TEXCOORD_TYPE) / sizeof(float); const uint16_t COLOR_COMPONENT_COUNT = sizeof(COLOR_TYPE) / sizeof(float); const uint16_t JOINT_COMPONENT_COUNT = sizeof(JOINT_TYPE) / sizeof(float); const uint16_t WEIGHT_COMPONENT_COUNT = sizeof(WEIGHT_TYPE) / sizeof(float); using IndexType = uint32_t; // Temporary storage types struct PrimitiveParseData { uint32_t first_triangle; uint32_t triangle_count; int32_t material; }; struct MeshParseData { char name[KB_CONFIG_MAX_NAME_SIZE]; uint32_t prim_count; PrimitiveParseData* prims; }; struct VertexIndices { IndexType position; IndexType normal; IndexType tangent; IndexType texcoords; IndexType colors; IndexType weights; IndexType joints; }; struct IndexTriangle { VertexIndices vert[3]; }; struct VertexData { kb::array<POSITION_TYPE> positions; kb::array<NORMAL_TYPE> normals; kb::array<TANGENT_TYPE> tangents; kb::array<TEXCOORD_TYPE> texcoords; kb::array<COLOR_TYPE> colors; kb::array<JOINT_TYPE> joints; kb::array<WEIGHT_TYPE> weights; kb::array<IndexTriangle> triangles; }; template <typename T> int32_t index_from(const T* f, const T* e) { if (f == nullptr || e == nullptr || e < f) return -1; return e - f; } void print_help(const char* error = nullptr) { if (error != nullptr) printf("%s\n\n", error); printf( "Kimberlite geomc\n" "\tUsage: geomc --input <file> --output <file> --index_size <int>\n" "\tSet data to export with\n" "\t\t--position\n" "\t\t--normal\n" "\t\t--tangent\n" "\t\t--texcoord\n" "\t\t--color\n" "\t\t--joints\n" "\t\t--weights\n" ); } kb_xform get_node_xform(cgltf_node* node) { kb_xform xform; xform.position = { 0, 0, 0 }; xform.scale = { 1, 1, 1 }; xform.rotation = { 0, 0, 0, 1 }; if (node->has_matrix) { printf("\t\tTODO: decompose matrix\n"); } if (node->has_translation) { xform.position = { node->translation[0], node->translation[1], node->translation[2] }; } if (node->has_rotation) { xform.rotation = { node->rotation[0], node->rotation[1], node->rotation[2], node->rotation[3] }; } if (node->has_scale) { xform.scale = { node->scale[0], node->scale[1], node->scale[2] }; } return xform; } int main(int argc, const char* argv[]) { int exit_val = EXIT_FAIL; cgltf_result result; uint64_t total_optim_time = 0; cgltf_options options = {}; cgltf_data* gltf_data = nullptr; uint32_t input_size = 0; void* input_data = nullptr; kb_stream* rwops_in = nullptr; kb_stream* rwops_out = nullptr; const char* in_filepath = nullptr; const char* out_filepath = nullptr; MeshParseData* parse_meshes = nullptr; VertexData vertex_data = {}; bool export_position = false; bool export_normal = false; bool export_tangent = false; bool export_texcoord = false; bool export_color = false; bool export_joints = false; bool export_weights = false; int index_size = 0; uint64_t max_prim_size = 0; // Output geom kb_geometry_data geom = {}; kb_cli_args args {}; kb_cliargs_init(&args, argc, argv); if (kb_cliargs_has(&args, "help")) { print_help(); goto end; } kb_cliargs_get_str(&args, &in_filepath, "input"); if (in_filepath == nullptr) { print_help("Please specify input file with --input"); goto end; } kb_cliargs_get_str(&args, &out_filepath, "output"); if (out_filepath == nullptr) { print_help("Please specify output file with --output"); goto end; } rwops_in = kb_stream_open_file(in_filepath, KB_FILE_MODE_READ); if (!rwops_in) { print_help("Unable to open input file"); goto end; } rwops_out = kb_stream_open_file(out_filepath, KB_FILE_MODE_WRITE); if (!rwops_out) { print_help("Unable to open output file"); goto end; } kb_cliargs_get_int(&args, &index_size, "index_size"); if (index_size != 32) { print_help("Please specify index size with --index_size. Only 32 is supported"); goto end; } max_prim_size = ((uint64_t) 1 << index_size) - 1; geom.index_size = index_size / 8; export_position = kb_cliargs_has(&args, "position"); export_normal = kb_cliargs_has(&args, "normal"); export_tangent = kb_cliargs_has(&args, "tangent"); export_texcoord = kb_cliargs_has(&args, "texcoord"); export_color = kb_cliargs_has(&args, "color"); export_joints = kb_cliargs_has(&args, "joints"); export_weights = kb_cliargs_has(&args, "weights"); if (!(export_position || export_normal || export_tangent || export_texcoord || export_color || export_joints || export_weights)) { print_help("Nothing to export"); goto end; } // Load input_size = kb_stream_size(rwops_in); input_data = KB_DEFAULT_ALLOC(input_size); kb_stream_read(rwops_in, input_data, 1, input_size); // Parse GLTF result = cgltf_parse(&options, input_data, input_size, &gltf_data); if (result != cgltf_result_success) { print_help("Unable to parse input file"); goto end; } result = cgltf_load_buffers(&options, gltf_data, in_filepath); if (result != cgltf_result_success) { print_help("Failed to load buffers"); goto end; } geom.node_count = gltf_data->nodes_count; geom.mesh_count = gltf_data->meshes_count; geom.material_count = gltf_data->materials_count; geom.nodes = KB_DEFAULT_ALLOC_TYPE(kb_node_data, geom.node_count); geom.meshes = KB_DEFAULT_ALLOC_TYPE(kb_mesh_data, geom.mesh_count); geom.materials = KB_DEFAULT_ALLOC_TYPE(kb_hash, geom.material_count); parse_meshes = KB_DEFAULT_ALLOC_TYPE(MeshParseData, geom.mesh_count); //##################################################################################################################### // Parse //##################################################################################################################### { // TODO: Skins for (cgltf_size skin_i = 0; skin_i < gltf_data->skins_count; ++skin_i) { cgltf_skin* src = &gltf_data->skins[skin_i]; } // TODO: Animations for (cgltf_size anim_i = 0; anim_i < gltf_data->animations_count; ++anim_i) { cgltf_animation* src = &gltf_data->animations[anim_i]; } // Node data for (cgltf_size node_i = 0; node_i < geom.node_count; ++node_i) { geom.nodes[node_i] = {}; cgltf_node* src = &gltf_data->nodes[node_i]; kb_node_data* dst = &geom.nodes[node_i]; kb_strcpy(dst->name, src->name); dst->xform = get_node_xform(src); dst->mesh = index_from(gltf_data->meshes, src->mesh); } // Materials for (cgltf_size material_i = 0; material_i < geom.material_count; ++material_i) { cgltf_material* src = &gltf_data->materials[material_i]; geom.materials[material_i] = kb_hash_string(src->name); } // Mesh Data for (cgltf_size mesh_i = 0; mesh_i < geom.mesh_count; ++mesh_i) { parse_meshes[mesh_i] = {}; geom.meshes[mesh_i] = {}; cgltf_mesh* src = &gltf_data->meshes[mesh_i]; MeshParseData* dst = &parse_meshes[mesh_i]; kb_strcpy(dst->name, src->name); for (cgltf_size prim_i = 0; prim_i < src->primitives_count; ++prim_i) { cgltf_primitive* prim = &src->primitives[prim_i]; uint32_t prim_first_triangle_index = vertex_data.triangles.count(); //kb_array_count(&vertex_data.triangles); uint32_t prim_first_position_index = vertex_data.positions.count(); //kb_array_count(&vertex_data.positions); uint32_t prim_first_normal_index = vertex_data.normals.count(); //kb_array_count(&vertex_data.normals); uint32_t prim_first_tangent_index = vertex_data.tangents.count(); //kb_array_count(&vertex_data.tangents); uint32_t prim_first_texcoord_index = vertex_data.texcoords.count(); //kb_array_count(&vertex_data.texcoords); uint32_t prim_first_color_index = vertex_data.colors.count(); //kb_array_count(&vertex_data.colors); uint32_t prim_first_joints_index = vertex_data.joints.count(); //kb_array_count(&vertex_data.joints); uint32_t prim_first_weights_index = vertex_data.weights.count(); //kb_array_count(&vertex_data.weights); // Vertex data for (cgltf_size attrib_i = 0; attrib_i < prim->attributes_count; ++attrib_i) { cgltf_attribute* attrib = &prim->attributes[attrib_i]; cgltf_accessor* accessor = attrib->data; cgltf_size accessor_count = accessor->count; cgltf_size accessor_stride = accessor->stride; cgltf_size accessor_elem_size = cgltf_num_components(accessor->type); if (attrib->index > 0) { printf("ERROR: Only attrib index 0 is currently supported. Sorry!\n"); continue; } switch (attrib->type) { case cgltf_attribute_type_position: { uint32_t start = vertex_data.positions.count(); vertex_data.positions.resize(start + accessor_count); for (uint32_t i = 0; i < accessor_count; i++) { cgltf_accessor_read_float(accessor, i, (cgltf_float*) &vertex_data.positions.at(start + i), accessor_elem_size); } } break; case cgltf_attribute_type_normal: { uint32_t start = vertex_data.normals.count(); vertex_data.normals.resize(start + accessor_count); for (uint32_t i = 0; i < accessor_count; i++) { cgltf_accessor_read_float(accessor, i, (cgltf_float*) &vertex_data.normals.at(start + i), accessor_elem_size); } } break; case cgltf_attribute_type_tangent: { uint32_t start = vertex_data.tangents.count(); vertex_data.tangents.resize(start + accessor_count); for (uint32_t i = 0; i < accessor_count; i++) { cgltf_accessor_read_float(accessor, i, (cgltf_float*) &vertex_data.tangents.at(start + i), accessor_elem_size); } } break; case cgltf_attribute_type_texcoord: { uint32_t start = vertex_data.texcoords.count(); vertex_data.texcoords.resize(start + accessor_count); for (uint32_t i = 0; i < accessor_count; i++) { cgltf_accessor_read_float(accessor, i, (cgltf_float*) &vertex_data.texcoords.at(start + i), accessor_elem_size); } } break; case cgltf_attribute_type_color: { uint32_t start = vertex_data.colors.count(); vertex_data.colors.resize(start + accessor_count); for (uint32_t i = 0; i < accessor_count; i++) { cgltf_accessor_read_float(accessor, i, (cgltf_float*) &vertex_data.colors.at(start + i), accessor_elem_size); } } break; case cgltf_attribute_type_joints: { uint32_t start = vertex_data.joints.count(); vertex_data.joints.resize(start + accessor_count); for (uint32_t i = 0; i < accessor_count; i++) { cgltf_accessor_read_float(accessor, i, (cgltf_float*) &vertex_data.joints.at(start + i), accessor_elem_size); } } break; case cgltf_attribute_type_weights: { uint32_t start = vertex_data.weights.count(); vertex_data.weights.resize(start + accessor_count); for (uint32_t i = 0; i < accessor_count; i++) { cgltf_accessor_read_float(accessor, i, (cgltf_float*) &vertex_data.weights.at(start + i), accessor_elem_size); } } break; default: {} break; } } bool has_position = export_position && prim_first_position_index < vertex_data.positions.count(); bool has_normal = export_normal && prim_first_normal_index < vertex_data.normals.count(); bool has_tangent = export_tangent && prim_first_tangent_index < vertex_data.tangents.count(); bool has_texcoord = export_texcoord && prim_first_texcoord_index < vertex_data.texcoords.count(); bool has_color = export_color && prim_first_color_index < vertex_data.colors.count(); bool has_joints = export_joints && prim_first_joints_index < vertex_data.joints.count(); bool has_weights = export_weights && prim_first_weights_index < vertex_data.weights.count(); // Indices if (prim->indices) { cgltf_size index_count = prim->indices->count; for (cgltf_size i = 0; i < index_count; i += 3) { // Tri vertex_data.triangles.resize(vertex_data.triangles.count() + 1); IndexTriangle& tri = vertex_data.triangles.back(); for (int v = 0; v < 3; ++v) { uint32_t vertex_index = cgltf_accessor_read_index(prim->indices, v + i); tri.vert[v].position = has_position ? prim_first_position_index + vertex_index : (IndexType) -1; tri.vert[v].normal = has_normal ? prim_first_normal_index + vertex_index : (IndexType) -1; tri.vert[v].tangent = has_tangent ? prim_first_tangent_index + vertex_index : (IndexType) -1; tri.vert[v].texcoords = has_texcoord ? prim_first_texcoord_index + vertex_index : (IndexType) -1; tri.vert[v].colors = has_color ? prim_first_color_index + vertex_index : (IndexType) -1; tri.vert[v].joints = has_joints ? prim_first_joints_index + vertex_index : (IndexType) -1; tri.vert[v].weights = has_weights ? prim_first_weights_index + vertex_index : (IndexType) -1; } } } // Split to primitives uint32_t tri_count = vertex_data.triangles.count() - prim_first_triangle_index; uint32_t tri_ind = 0; while (tri_ind < tri_count) { uint32_t tris_remaining = tri_count - tri_ind; uint32_t prim_tri_count = kb_int_min(tris_remaining, max_prim_size / 3); uint32_t idx = dst->prim_count++; dst->prims = KB_DEFAULT_REALLOC_TYPE(PrimitiveParseData, dst->prims, dst->prim_count); PrimitiveParseData* prim_out = &dst->prims[idx]; prim_out->first_triangle = prim_first_triangle_index + tri_ind; prim_out->triangle_count = prim_tri_count; prim_out->material = index_from(gltf_data->materials, prim->material); tri_ind += prim_tri_count; } } } } //##################################################################################################################### // Process & Optimize //##################################################################################################################### { bool has_position = false; bool has_normal = false; bool has_tangent = false; bool has_texcoord = false; bool has_color = false; bool has_joints = false; bool has_weights = false; for (uint64_t tri_i = 0; tri_i < vertex_data.triangles.count(); ++tri_i) { IndexTriangle& tri = vertex_data.triangles.at(tri_i); for (uint32_t i = 0; i < 3; ++i) { has_position |= tri.vert[i].position != (IndexType) -1; has_normal |= tri.vert[i].normal != (IndexType) -1; has_tangent |= tri.vert[i].tangent != (IndexType) -1; has_texcoord |= tri.vert[i].texcoords != (IndexType) -1; has_color |= tri.vert[i].colors != (IndexType) -1; has_weights |= tri.vert[i].weights != (IndexType) -1; has_joints |= tri.vert[i].joints != (IndexType) -1; } } int32_t attrib_position = -1; int32_t attrib_normal = -1; int32_t attrib_tangent = -1; int32_t attrib_texcoord = -1; int32_t attrib_color = -1; int32_t attrib_joints = -1; int32_t attrib_weights = -1; kb_vertex_layout vertex_layout; kb_vertex_layout_begin(&vertex_layout); if (has_position) attrib_position = kb_vertex_layout_add(&vertex_layout, KB_ATTRIB_FLOAT, POSITION_COMPONENT_COUNT); if (has_normal) attrib_normal = kb_vertex_layout_add(&vertex_layout, KB_ATTRIB_FLOAT, NORMAL_COMPONENT_COUNT); if (has_tangent) attrib_tangent = kb_vertex_layout_add(&vertex_layout, KB_ATTRIB_FLOAT, TANGENT_COMPONENT_COUNT); if (has_texcoord) attrib_texcoord = kb_vertex_layout_add(&vertex_layout, KB_ATTRIB_FLOAT, TEXCOORD_COMPONENT_COUNT); if (has_color) attrib_color = kb_vertex_layout_add(&vertex_layout, KB_ATTRIB_FLOAT, COLOR_COMPONENT_COUNT); if (has_weights) attrib_weights = kb_vertex_layout_add(&vertex_layout, KB_ATTRIB_FLOAT, WEIGHT_COMPONENT_COUNT); if (has_joints) attrib_joints = kb_vertex_layout_add(&vertex_layout, KB_ATTRIB_FLOAT, JOINT_COMPONENT_COUNT); kb_vertex_layout_end(&vertex_layout); uint32_t vertex_stride = kb_vertex_layout_stride(&vertex_layout); uint64_t max_vertex_count = vertex_data.triangles.count() * 3; uint64_t max_index_count = vertex_data.triangles.count() * 3; uint8_t* geom_vert_data = (uint8_t*) KB_DEFAULT_ALLOC(max_vertex_count * vertex_stride); IndexType* geom_ind_data = (IndexType*) KB_DEFAULT_ALLOC(sizeof(IndexType) * max_index_count); uint64_t vertex_count = 0; uint64_t index_count = 0; for (uint32_t i = 0; i < geom.mesh_count; ++i) { MeshParseData* mesh = &parse_meshes[i]; // Init output mesh kb_mesh_data* mesh_out = &geom.meshes[i]; mesh_out->primitive_count = mesh->prim_count; mesh_out->primitives = KB_DEFAULT_ALLOC_TYPE(kb_primitive_data, mesh_out->primitive_count); kb_strcpy(mesh_out->name, mesh->name); for (uint32_t i = 0; i < mesh->prim_count; i++) { PrimitiveParseData* prim = &mesh->prims[i]; uint64_t prim_vertex_count = prim->triangle_count * 3; uint64_t prim_index_count = prim->triangle_count * 3; uint8_t* prim_vert_data = KB_DEFAULT_ALLOC_TYPE(uint8_t, prim_index_count * vertex_stride); IndexType* prim_ind_data = KB_DEFAULT_ALLOC_TYPE(IndexType, prim_index_count); uint32_t prim_vert = 0; uint32_t prim_index = 0; for (uint32_t tri_i = prim->first_triangle; tri_i < prim->first_triangle + prim->triangle_count; ++tri_i) { IndexTriangle& tri = vertex_data.triangles.at(tri_i); for (uint32_t v = 0; v < 3; ++v) { const VertexIndices& vert = tri.vert[v]; if (has_position) { uint32_t idx = vert.position == UINT32_MAX ? 0 : vert.position; uint32_t attrib_size = kb_vertex_layout_size(&vertex_layout, attrib_position); uint32_t attrib_offset = kb_vertex_layout_offset(&vertex_layout, attrib_position); kb_memcpy_with_stride(prim_vert_data, &vertex_data.positions.at(idx), attrib_size, prim_vert, vertex_stride, attrib_offset); } if (has_normal) { uint32_t idx = vert.normal == UINT32_MAX ? 0 : vert.normal; uint32_t attrib_size = kb_vertex_layout_size(&vertex_layout, attrib_normal); uint32_t attrib_offset = kb_vertex_layout_offset(&vertex_layout, attrib_normal); kb_memcpy_with_stride(prim_vert_data, &vertex_data.normals.at(idx), attrib_size, prim_vert, vertex_stride, attrib_offset); } if (has_tangent) { uint32_t idx = vert.tangent == UINT32_MAX ? 0 : vert.tangent; uint32_t attrib_size = kb_vertex_layout_size(&vertex_layout, attrib_tangent); uint32_t attrib_offset = kb_vertex_layout_offset(&vertex_layout, attrib_tangent); kb_memcpy_with_stride(prim_vert_data, &vertex_data.tangents.at(idx), attrib_size, prim_vert, vertex_stride, attrib_offset); } if (has_texcoord) { uint32_t idx = vert.texcoords == UINT32_MAX ? 0 : vert.texcoords; uint32_t attrib_size = kb_vertex_layout_size(&vertex_layout, attrib_texcoord); uint32_t attrib_offset = kb_vertex_layout_offset(&vertex_layout, attrib_texcoord); kb_memcpy_with_stride(prim_vert_data, &vertex_data.texcoords.at(idx), attrib_size, prim_vert, vertex_stride, attrib_offset); } if (has_color) { uint32_t idx = vert.colors == UINT32_MAX ? 0 : vert.colors; uint32_t attrib_size = kb_vertex_layout_size(&vertex_layout, attrib_color); uint32_t attrib_offset = kb_vertex_layout_offset(&vertex_layout, attrib_color); kb_memcpy_with_stride(prim_vert_data, &vertex_data.colors.at(idx), attrib_size, prim_vert, vertex_stride, attrib_offset); } if (has_weights) { uint32_t idx = vert.weights == UINT32_MAX ? 0 : vert.weights; uint32_t attrib_size = kb_vertex_layout_size(&vertex_layout, attrib_weights); uint32_t attrib_offset = kb_vertex_layout_offset(&vertex_layout, attrib_weights); kb_memcpy_with_stride(prim_vert_data, &vertex_data.weights.at(idx), attrib_size, prim_vert, vertex_stride, attrib_offset); } if (has_joints) { uint32_t idx = vert.joints == UINT32_MAX ? 0 : vert.joints; uint32_t attrib_size = kb_vertex_layout_size(&vertex_layout, attrib_joints); uint32_t attrib_offset = kb_vertex_layout_offset(&vertex_layout, attrib_joints); kb_memcpy_with_stride(prim_vert_data, &vertex_data.joints.at(idx), attrib_size, prim_vert, vertex_stride, attrib_offset); } prim_ind_data[prim_index++] = prim_vert; prim_vert++; } } // Optimize primitive uint64_t opt_start_time = kb_time_get_raw(); uint32_t* remap = KB_DEFAULT_ALLOC_TYPE(uint32_t, prim_vertex_count * 3); uint32_t opt_vertex_count = meshopt_generateVertexRemap(remap, prim_ind_data, prim_index_count, prim_vert_data, prim_vertex_count, vertex_stride); uint8_t* opt_vert_data = KB_DEFAULT_ALLOC_TYPE(uint8_t, opt_vertex_count * vertex_stride); IndexType* opt_ind_data = KB_DEFAULT_ALLOC_TYPE(IndexType, prim_index_count); meshopt_remapIndexBuffer (opt_ind_data, prim_ind_data, prim_index_count, remap); meshopt_remapVertexBuffer (opt_vert_data, prim_vert_data, prim_vertex_count, vertex_stride, remap); meshopt_optimizeVertexCache (opt_ind_data, opt_ind_data, prim_index_count, prim_vertex_count); meshopt_optimizeOverdraw (opt_ind_data, opt_ind_data, prim_index_count, (float*) opt_vert_data, prim_vertex_count, vertex_stride, 1.05f); meshopt_optimizeVertexFetch (opt_vert_data, opt_ind_data, prim_index_count, opt_vert_data, opt_vertex_count, vertex_stride); total_optim_time += kb_time_get_raw() - opt_start_time; mesh_out->primitives[i] = {}; mesh_out->primitives[i].first_vertex = vertex_count; mesh_out->primitives[i].first_index = index_count; mesh_out->primitives[i].vertex_count = opt_vertex_count; mesh_out->primitives[i].index_count = prim_index_count; mesh_out->primitives[i].material = prim->material; // Copy data to main buffers kb_memcpy(geom_ind_data + index_count , opt_ind_data , prim_index_count * sizeof(IndexType)); kb_memcpy(geom_vert_data + vertex_count * vertex_stride , opt_vert_data , opt_vertex_count * vertex_stride); vertex_count += opt_vertex_count; index_count += prim_index_count; KB_DEFAULT_FREE(opt_vert_data); KB_DEFAULT_FREE(opt_ind_data); KB_DEFAULT_FREE(remap); KB_DEFAULT_FREE(prim_vert_data); KB_DEFAULT_FREE(prim_ind_data); } } // Copy data to geom geom.vertex_data_size = vertex_count * vertex_stride; geom.index_data_size = index_count * sizeof(IndexType); geom.vertex_data = KB_DEFAULT_ALLOC(geom.vertex_data_size); geom.index_data = KB_DEFAULT_ALLOC(geom.index_data_size); kb_memset(geom.vertex_data, '\0', geom.vertex_data_size); kb_memset(geom.index_data, '\0', geom.index_data_size); kb_memcpy(geom.vertex_data, geom_vert_data, geom.vertex_data_size); kb_memcpy(geom.index_data, geom_ind_data, geom.index_data_size); KB_DEFAULT_FREE(geom_vert_data); KB_DEFAULT_FREE(geom_ind_data); } printf("All done! Total optimization time: %f\n", double(total_optim_time) / double(kb_time_get_frequency())); //##################################################################################################################### // Export //##################################################################################################################### kb_geometry_data_write(&geom, rwops_out); exit_val = EXIT_SUCCESS; end: kb_stream_close(rwops_in); kb_stream_close(rwops_out); kb_geometry_data_destroy(&geom); KB_DEFAULT_FREE(input_data); kb_array_destroy(&vertex_data.positions); kb_array_destroy(&vertex_data.normals); kb_array_destroy(&vertex_data.tangents); kb_array_destroy(&vertex_data.texcoords); kb_array_destroy(&vertex_data.colors); kb_array_destroy(&vertex_data.joints); kb_array_destroy(&vertex_data.weights); kb_array_destroy(&vertex_data.triangles); return exit_val; }
39.965909
156
0.634987
tonipes
20a308d486b7a79728cd79ccd05269545e2bae92
8,630
cpp
C++
src/GreenThumbFrame.cpp
captain-igloo/greenthumb
39d62004e6f6b6fa7da52b3f6ff1c198b04e1d72
[ "MIT" ]
3
2019-04-08T19:17:51.000Z
2019-05-21T01:01:29.000Z
src/GreenThumbFrame.cpp
captain-igloo/greenthumb
39d62004e6f6b6fa7da52b3f6ff1c198b04e1d72
[ "MIT" ]
1
2019-04-30T23:39:06.000Z
2019-07-27T00:07:20.000Z
src/GreenThumbFrame.cpp
captain-igloo/greenthumb
39d62004e6f6b6fa7da52b3f6ff1c198b04e1d72
[ "MIT" ]
1
2019-02-28T09:22:18.000Z
2019-02-28T09:22:18.000Z
/** * Copyright 2019 Colin Doig. Distributed under the MIT license. */ #include <time.h> #include <wx/wx.h> #include <wx/menu.h> #include <wx/sizer.h> #include <wx/treectrl.h> #include "dialog/LoginDialog.h" #include "dialog/Settings.h" #include "entity/Config.h" #include "worker/GetAccountDetails.h" #include "worker/ListMarketCatalogue.h" #include "worker/Login.h" #include "ArtProvider.h" #include "MenuTreeData.h" #include "GreenThumb.h" #include "GreenThumbFrame.h" #include "MarketPanel.h" #include "Util.h" namespace greenthumb { const wxString GreenThumbFrame::VIEW_ACCOUNT = "account"; const wxString GreenThumbFrame::VIEW_BETTING = "betting"; const uint32_t GreenThumbFrame::MAX_SESSION_AGE_SECONDS = 86400; GreenThumbFrame::GreenThumbFrame() : wxFrame(NULL, wxID_ANY, _T("Green Thumb"), wxDefaultPosition, wxDefaultSize, wxDEFAULT_FRAME_STYLE | wxNO_FULL_REPAINT_ON_RESIZE | wxMAXIMIZE), workerManager(this), betfairMarkets(100) { wxIcon greenthumbIcon; greenthumbIcon.CopyFromBitmap(ArtProvider::GetBitmap(ArtProvider::IconId::GREENTHUMB)); SetIcon(greenthumbIcon); mainView = entity::Config::GetConfigValue<wxString>("mainView", VIEW_BETTING); CreateMenuBar(); wxBoxSizer* sizer = new wxBoxSizer(wxVERTICAL); SetSizer(sizer); bettingPanel = new wxSplitterWindow(this, wxID_ANY); bettingPanel->SetSashGravity(0.0); bettingPanel->SetMinimumPaneSize(200); wxPanel* eventTreePanel = new wxPanel(bettingPanel, wxID_ANY); wxBoxSizer* eventTreeSizer = new wxBoxSizer(wxVERTICAL); eventTree = new greenthumb::EventTree(eventTreePanel, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxTR_DEFAULT_STYLE); eventTree->SetBetfairMarketsCache(&betfairMarkets); eventTreeSizer->Add(eventTree, 1, wxEXPAND, 0); eventTreePanel->SetSizer(eventTreeSizer); eventTreePanel->SetInitialSize(wxSize(400, -1)); marketsPanel = new MarketPanels(bettingPanel, wxID_ANY); marketsPanel->FitInside(); marketsPanel->SetScrollRate(5, 5); wxBoxSizer* marketsSizer = new wxBoxSizer(wxVERTICAL); marketsPanel->SetSizer(marketsSizer); bettingPanel->SplitVertically(eventTreePanel, marketsPanel, 200); accountPanel = new AccountPanel(this, wxID_ANY); accountPanel->SetBetfairMarketsCache(&betfairMarkets); if (mainView == VIEW_ACCOUNT) { bettingPanel->Show(false); } else { accountPanel->Show(false); } sizer->Add(bettingPanel, 1, wxEXPAND, 0); sizer->Add(accountPanel, 1, wxEXPAND, 0); Bind(wxEVT_TREE_ITEM_ACTIVATED, &GreenThumbFrame::OnItemActivated, this, wxID_ANY); workerManager.Bind(worker::GET_ACCOUNT_DETAILS); workerManager.Bind(worker::LIST_MARKET_CATALOGUE); Bind(worker::LIST_MARKET_CATALOGUE, &GreenThumbFrame::OnListMarketCatalogue, this, wxID_ANY); CreateStatusBar(1); } void GreenThumbFrame::OpenLoginDialog() { dialog::LoginDialog loginDialog(NULL, wxID_ANY, "Login"); if (loginDialog.ShowModal() == wxID_OK) { eventTree->SyncMenu(false); // get account currency if we don't already have it. wxString currencySymbol = GetCurrencySymbol( entity::Config::GetConfigValue<wxString>("accountCurrency", "?") ); if (currencySymbol == "?") { workerManager.RunWorker(new worker::GetAccountDetails(&workerManager)); } } } void GreenThumbFrame::Login() { wxString ssoid = entity::Config::GetConfigValue<wxString>("ssoid", ""); int64_t loginTime = entity::Config::GetConfigValue<int64_t>("loginTime", 0); wxString appKey = greenthumb::entity::Config::GetConfigValue<wxString>("applicationKey", ""); if (appKey == "" || ssoid == "" || (time(NULL) - loginTime > MAX_SESSION_AGE_SECONDS)) { OpenLoginDialog(); } else { GreenThumb::GetBetfairApi().setApplicationKey(appKey.ToStdString()); GreenThumb::GetBetfairApi().setSsoid(ssoid.ToStdString()); } } void GreenThumbFrame::CreateMenuBar() { wxMenuBar* menu = new wxMenuBar(); wxMenu* fileMenu = new wxMenu(); wxWindowID menuFileLoginId = wxWindow::NewControlId(); fileMenu->Append(menuFileLoginId, _("Log &in...")); wxWindowID menuFileLogoutId = wxWindow::NewControlId(); fileMenu->Append(menuFileLogoutId, _("Log &out")); wxWindowID menuFileRefreshMenuId = wxWindow::NewControlId(); fileMenu->Append(menuFileRefreshMenuId, _("Refresh &menu")); wxWindowID menuFileSettingsId = wxWindow::NewControlId(); fileMenu->Append(menuFileSettingsId, _("&Settings...")); fileMenu->Append(wxID_EXIT, _("E&xit")); menu->Append(fileMenu, _("&File")); Bind(wxEVT_MENU, &GreenThumbFrame::OnMenuFileExit, this, wxID_EXIT); wxMenu* viewMenu = new wxMenu(); wxWindowID menuViewAccountId = wxWindow::NewControlId(); wxMenuItem* accountMenuItem = viewMenu->AppendRadioItem(menuViewAccountId, wxT("&Account")); wxWindowID menuViewBettingId = wxWindow::NewControlId(); wxMenuItem* bettingMenuItem = viewMenu->AppendRadioItem(menuViewBettingId, wxT("&Betting")); if (mainView == VIEW_ACCOUNT) { accountMenuItem->Check(); } else { bettingMenuItem->Check(); } menu->Append(viewMenu, _("&View")); wxMenu* helpMenu = new wxMenu(); helpMenu->Append(wxID_ABOUT, _("&About")); menu->Append(helpMenu, _("&Help")); SetMenuBar(menu); Bind(wxEVT_MENU, &GreenThumbFrame::OnMenuFileLogin, this, menuFileLoginId); Bind(wxEVT_MENU, &GreenThumbFrame::OnMenuFileLogout, this, menuFileLogoutId); Bind(wxEVT_MENU, &GreenThumbFrame::OnMenuFileRefreshMenu, this, menuFileRefreshMenuId); Bind(wxEVT_MENU, &GreenThumbFrame::OnMenuFileSettings, this, menuFileSettingsId); Bind(wxEVT_MENU, &GreenThumbFrame::OnMenuViewAccount, this, menuViewAccountId); Bind(wxEVT_MENU, &GreenThumbFrame::OnMenuViewBetting, this, menuViewBettingId); Bind(wxEVT_MENU, &GreenThumbFrame::OnMenuHelpAbout, this, wxID_ABOUT); } void GreenThumbFrame::OnMenuFileLogin(const wxCommandEvent& menuEvent) { OpenLoginDialog(); } void GreenThumbFrame::OnMenuFileLogout(const wxCommandEvent& menuEvent) { GreenThumb::GetBetfairApi().logout(); } void GreenThumbFrame::OnMenuFileRefreshMenu(const wxCommandEvent& menuEvent) { eventTree->SyncMenu(); } void GreenThumbFrame::OnMenuFileSettings(const wxCommandEvent& menuEvent) { dialog::Settings settings(NULL, wxID_ANY, "Settings"); settings.ShowModal(); } void GreenThumbFrame::OnMenuFileExit(const wxCommandEvent& menuEvent) { Close(true); } void GreenThumbFrame::OnMenuViewAccount(const wxCommandEvent& menuEvent) { bettingPanel->Show(false); accountPanel->Show(true); Layout(); entity::Config::SetConfigValue("mainView", VIEW_ACCOUNT); } void GreenThumbFrame::OnMenuViewBetting(const wxCommandEvent& menuEvent) { accountPanel->Show(false); bettingPanel->Show(true); Layout(); entity::Config::SetConfigValue("mainView", VIEW_BETTING); } void GreenThumbFrame::OnMenuHelpAbout(const wxCommandEvent& menuEvent) { (void) wxMessageBox(_("Green Thumb\n(c) 2017 Colin Doig"), _("Green Thumb"), wxOK | wxICON_INFORMATION); } void GreenThumbFrame::OnItemActivated(const wxTreeEvent& treeEvent) { wxTreeItemId itemId = treeEvent.GetItem(); MenuTreeData* data = dynamic_cast<MenuTreeData*>(eventTree->GetItemData(itemId)); if (data && data->valid && data->node.getType() == greentop::menu::Node::Type::MARKET) { marketsPanel->AddMarket(data->node); if (betfairMarkets.exists(data->node.getId())) { marketsPanel->SetMarket(betfairMarkets.get(data->node.getId())); } else { if (!eventTree->ListMarketCatalogueInProgress()) { std::set<std::string> marketIds = { data->node.getId() }; workerManager.RunWorker( new worker::ListMarketCatalogue(&workerManager, marketIds) ); } } } } void GreenThumbFrame::OnListMarketCatalogue(const wxThreadEvent& event) { try { std::map<std::string, entity::Market> markets = event.GetPayload<std::map<std::string, entity::Market>>(); for (auto it = markets.begin(); it != markets.end(); ++it) { if (it->second.HasMarketCatalogue()) { betfairMarkets.put(it->second.GetMarketCatalogue().getMarketId(), it->second); marketsPanel->SetMarket(it->second); } } } catch (const std::exception& e) { wxLogStatus(e.what()); } } }
33.710938
97
0.696524
captain-igloo
20a3608d9b8d9ca4382e05da72b8563d06559736
1,880
cpp
C++
C++/03-currying_lambda.cpp
duinomaker/LearningStuff
34f8e3338dd2322013d519c19230c12fcb7897d4
[ "CC0-1.0" ]
null
null
null
C++/03-currying_lambda.cpp
duinomaker/LearningStuff
34f8e3338dd2322013d519c19230c12fcb7897d4
[ "CC0-1.0" ]
null
null
null
C++/03-currying_lambda.cpp
duinomaker/LearningStuff
34f8e3338dd2322013d519c19230c12fcb7897d4
[ "CC0-1.0" ]
null
null
null
#include <deque> #include <functional> #include <iostream> #include <iterator> using namespace std; // Automatic Currying template<typename Ret, typename Arg> auto curry_(function<Ret(Arg)> f) { return f; } template<typename Ret, typename Arg, typename ...Args> auto curry_(function<Ret(Arg, Args...)> f) { return [=](Arg arg) { function<Ret(Args...)> rest = [=](Args ...args) -> Ret { return f(arg, args...); }; return curry_(rest); }; } template<typename Ret, typename ...Args> function<Ret(Args...)> make_func(Ret(*f)(Args...)) { return f; } template<typename F> auto curry(F f) { return curry_(make_func(f)); } // C#-Func-delegate-like `Func` template template<typename Arg, typename ...Args> struct Func_ { using type = function<typename Func_<Args...>::type(Arg)>; }; template<typename Arg> struct Func_<Arg> { using type = Arg; }; template<typename ...Args> using Func = typename Func_<Args...>::type; // List-like operations template<typename A> deque<A> prepend(A x, deque<A> l) { auto lp = l; lp.push_front(x); return lp; } // Functional utilities template<typename F, typename G> auto compose(F f, G g) { return [=](auto x) { return f(g(x)); }; } template<typename A, typename B> B reduce(Func<A, B, B> f, B r, deque<A> l) { if (l.empty()) { return r; } auto rest = l; auto first = rest.back(); rest.pop_back(); return reduce(f, f(first)(r), rest); } template<typename A, typename B> auto map(Func<A, B> f) { return curry(reduce<A, deque<B>>)(compose(curry(prepend<B>), f))({}); } // Experiments int main() { auto f = [](int x) -> int { return x * 2; }; auto lst = deque<int>{1, 2, 3, 4, 5}; auto result = map<int, int>(f)(lst); copy(result.begin(), result.end(), ostream_iterator<int>(cout, " ")); cout << endl; }
20.659341
73
0.605319
duinomaker
20a736689f90c32671db6c5206d35bb451770a23
11,784
cpp
C++
src/interpreter.cpp
mujido/moove
380fd0ea2eb2ad59b62a27bb86079ecb8c5b783b
[ "Apache-2.0" ]
null
null
null
src/interpreter.cpp
mujido/moove
380fd0ea2eb2ad59b62a27bb86079ecb8c5b783b
[ "Apache-2.0" ]
null
null
null
src/interpreter.cpp
mujido/moove
380fd0ea2eb2ad59b62a27bb86079ecb8c5b783b
[ "Apache-2.0" ]
null
null
null
#include "interpreter.hpp" #include "reply.hpp" #include "except.hpp" #include "exec_state.hpp" #include "opcodes.hpp" #include "op_map.hpp" #include "op_package.hpp" #include "type_registry.hpp" #include "listvar.hpp" #include "strvar.hpp" #include "intvar.hpp" #include "realvar.hpp" #include <iostream> namespace Moove { void Interpreter::clearTemps() { m_temps.clear(); } void Interpreter::defineVariables(VariableDefMap& varDefs) { MOOVE_ASSERT(m_bcDebug, "cannot set variables in a non-debug compilation"); // make sure that the variable "args" has a value even if not defined in varDefs std::string argsStr("args"); if (varDefs.find(argsStr) == varDefs.end()) { ListVar::Container contents; varDefs.emplace(argsStr, m_execState->listFactory().createList(contents)); } for (auto& def : varDefs) { // if this variable exists (has a defined symbol), set the value Symbol varSym = m_bcDebug->varSymTable().findSymbol(def.first); if(varSym) { CodeVector::Word tempID = m_bcDebug->varIDBySymbol(varSym); m_temps[tempID] = std::move(def.second); } } } bool Interpreter::execFinished()const { return m_retVal.get() != 0; } void Interpreter::execBuiltin() { std::unique_ptr<ListVar> args(popStack<ListVar>()); std::unique_ptr<StrVar> name(popStack<StrVar>()); Reply reply; BuiltinRegistry::Function builtinFunc = m_execState->builtinRegistry().findFunction(name->value()); if(!builtinFunc) { if(name->value() == "self") { VariableDefMap recurseVarDefs; std::string argsName("args"); recurseVarDefs.emplace(argsName, std::move(args)); reply.reset(Reply::NORMAL, m_execState->call(*m_bcDebug, recurseVarDefs, m_traceFlag)); } else MOOVE_THROW("invalid builtin function: " + name->value()); } else reply = builtinFunc(*m_execState, std::move(args)); // if at this point, a builtin was executed that does not return a value. return a bogus value if (reply.normal() && reply.value()) m_stack.push_back(std::move(reply.value())); else m_stack.emplace_back(m_execState->intFactory().createValue(0)); } void Interpreter::lengthList() { std::unique_ptr<ListVar> listVar = popStack<ListVar>(); IntVar::value_type size = listVar->contents()->size(); pushStack(std::move(listVar)); pushStack(std::unique_ptr<Variant>(m_execState->intFactory().createValue(size))); } void Interpreter::appendList() { boost::shared_ptr<Variant> valueVar(popStack<Variant>().release()); std::unique_ptr<ListVar> listVar(popStack<ListVar>()); listVar->appendValue(valueVar); pushStack(std::move(listVar)); } void Interpreter::indexList() { std::unique_ptr<IntVar> indexVar(popStack<IntVar>()); std::unique_ptr<ListVar> listVar(popStack<ListVar>()); MOOVE_ASSERT(indexVar->value() >= 1 && indexVar->value() <= listVar->contents()->size(), "index out of range"); pushStack(std::unique_ptr<Variant>((*listVar->contents())[indexVar->value() - 1]->clone())); } void Interpreter::setIndexList() { std::unique_ptr<Variant> valueVar = popStack<Variant>(); std::unique_ptr<IntVar> indexVar = popStack<IntVar>(); std::unique_ptr<ListVar> listVar = popStack<ListVar>(); MOOVE_ASSERT(indexVar->value() >= 1 && indexVar->value() <= listVar->contents()->size(), "index out of range"); listVar->setIndex(indexVar->value() - 1, boost::shared_ptr<Variant>(std::move(valueVar))); pushStack(std::move(listVar)); } void Interpreter::rangeList() { std::unique_ptr<IntVar> endVar(popStack<IntVar>()); std::unique_ptr<IntVar> startVar(popStack<IntVar>()); std::unique_ptr<ListVar> listVar(popStack<ListVar>()); MOOVE_ASSERT(startVar->value() >= 1 && startVar->value() <= listVar->contents()->size(), "index out of range"); MOOVE_ASSERT(endVar->value() >= startVar->value() && endVar->value() <= listVar->contents()->size(), "index out of range"); ListVar::Container range; for(ListVar::Container::size_type i = startVar->value() - 1; i < endVar->value(); ++i) range.push_back(boost::shared_ptr<Variant>((*listVar->contents())[i]->clone())); pushStack(std::unique_ptr<Variant>(m_execState->listFactory().createList(range))); } void Interpreter::spliceList() { std::unique_ptr<ListVar> srcListVar(popStack<ListVar>()); std::unique_ptr<ListVar> destListVar(popStack<ListVar>()); ListVar::Container contents(*destListVar->contents()); contents.insert(contents.end(), srcListVar->contents()->begin(), srcListVar->contents()->end()); destListVar->setContents(contents); pushStack(std::move(destListVar)); } void Interpreter::stepInstruction() { assert(m_execState); try { MOOVE_ASSERT(m_curVect != 0, "NULL current CodeVector"); if(!execFinished()) { Reply reply; Opcode op = static_cast<Opcode>(*m_execPos++); MOOVE_ASSERT(OpcodeInfo::validOp(op), "invalid opcode"); const OpcodeInfo::Op& opInfo = OpcodeInfo::getOp(op); if(opInfo.isUnaryOp()) { std::unique_ptr<Variant> operand(popStack<Variant>()); OperatorMap::UnaryDispatch dispatch = m_execState->operatorMap().findUnary(operand->factory().regEntry()); MOOVE_ASSERT(dispatch != 0, "unhandled unary operation"); reply = dispatch(op, std::move(operand)); MOOVE_ASSERT(reply.normal(), "error occured in unary operation"); pushStack(std::unique_ptr<Variant>(reply.value()->clone())); } else if(opInfo.isBinaryOp()) { std::unique_ptr<Variant> rightOperand(popStack<Variant>()); std::unique_ptr<Variant> leftOperand(popStack<Variant>()); OperatorMap::BinaryDispatch dispatch = m_execState->operatorMap().findBinary(leftOperand->factory().regEntry(), rightOperand->factory().regEntry()); MOOVE_ASSERT(dispatch != 0, "unhandled binary operation"); reply = dispatch(op, std::move(leftOperand), std::move(rightOperand)); MOOVE_ASSERT(reply.normal(), "error occured in binary operation"); pushStack(std::unique_ptr<Variant>(reply.value()->clone())); } else { CodeVector::Word imm; if (opInfo.hasImmediate()) { if (opInfo.immediateType() == ImmediateValue::LABEL) { imm = m_curVect->unpackWord(m_execPos, m_curVect->labelSize()); m_execPos += m_curVect->labelSize(); } else { imm = m_curVect->unpackWord(m_execPos, m_bc->immediateSize(opInfo.immediateType())); m_execPos += m_bc->immediateSize(opInfo.immediateType()); } } switch(op) { case OP_DONE: m_retVal.reset(m_execState->intFactory().createValue(0)); break; case OP_JUMP_FALSE: { std::unique_ptr<Variant> testVar = popStack<Variant>(); if(testVar->truthValue()) { // value is true, continue executing next instruction break; } [[fallthrough]]; } case OP_JUMP: m_execPos = m_curVect->begin() + imm; break; case OP_RETURN: m_retVal = popStack<Variant>(); break; case OP_PUSH_LITERAL: // don't push a value if it will be immediately popped if (execFinished() || *m_execPos != OP_POP) { pushStack(std::unique_ptr<Variant>(m_bc->literal(imm).clone())); } else { // skip OP_POP ++m_execPos; } break; case OP_PUSH: MOOVE_ASSERT(imm < m_temps.size(), "temporary ID out of range"); MOOVE_ASSERT(m_temps[imm] != nullptr, "undefined variable"); // don't push a value if it will be immediately popped if (execFinished() || *m_execPos != OP_POP) { pushStack(std::unique_ptr<Variant>(m_temps[imm]->clone())); } else { // skip OP_POP ++m_execPos; } break; case OP_PUT: { MOOVE_ASSERT(imm < m_temps.size(), "temporary ID out of range"); if (!execFinished() && *m_execPos == OP_POP) { m_temps[imm] = popStack<Variant>(); ++m_execPos; } else m_temps[imm].reset(m_stack.back()->clone()); } break; case OP_POP: popStack<Variant>(); break; case OP_INDEX: indexList(); break; case OP_INDEX_SET: setIndexList(); break; case OP_RANGE: rangeList(); break; case OP_SPLICE: spliceList(); break; case OP_LENGTH: lengthList(); break; case OP_APPEND_LIST: appendList(); break; case OP_CALL_BUILTIN: execBuiltin(); break; default: MOOVE_THROW((std::string)"not yet implemented: " + opInfo.name()); } } if (m_traceFlag) { std::cerr << opInfo.name() << std::endl; dumpStack(std::cerr); } } } catch (...) { std::cerr << "Error occured at BC position " << (m_execPos - m_curVect->begin()) << std::endl; std::cerr << "\nStack dump:\n"; dumpStack(std::cerr); throw; } } Interpreter::Interpreter(const DebugBytecodeProgram& bc) : m_execState(0), m_curVect(0), m_traceFlag(false) { m_bc.reset(m_bcDebug = new DebugBytecodeProgram(bc)); // Setup with correct number of NULL initial values for(TemporaryValues::size_type i = 0; i < 1000; ++i) m_temps.push_back(0); } std::unique_ptr<Variant> Interpreter::run(ExecutionState& execState, VariableDefMap& varDefs, bool traceFlag) { m_retVal.reset(); m_stack.clear(); m_execState = &execState; m_curVect = &m_bc->forkVector(0); m_execPos = m_curVect->begin(); m_traceFlag = traceFlag; defineVariables(varDefs); while(!execFinished()) stepInstruction(); MOOVE_ASSERT(m_retVal.get() != 0, "no return value"); return std::move(m_retVal); } } // namespace Moove
34.761062
129
0.535048
mujido
20a7c5edda5c2d6f6d9acd98ea6904ba7f25d77c
1,488
cpp
C++
318-1.cpp
Alex-Amber/LeetCode
c8d09e86cee52648f84ca2afed8dd0f13e51ab58
[ "MIT" ]
null
null
null
318-1.cpp
Alex-Amber/LeetCode
c8d09e86cee52648f84ca2afed8dd0f13e51ab58
[ "MIT" ]
null
null
null
318-1.cpp
Alex-Amber/LeetCode
c8d09e86cee52648f84ca2afed8dd0f13e51ab58
[ "MIT" ]
null
null
null
class UnionFind { private: vector<int> p, size; public: UnionFind(int N) { p.assign(N, 0); size.assign(N, 1); for (int i = 0; i < N; i++) p[i] = i; } int findSet(int u) { return p[u] == u ? u : p[u] = findSet(p[u]); } bool isSameSet(int u, int v) { return findSet(u) == findSet(v); } void unionSet(int u, int v) { if (!isSameSet(u, v)) { int x = findSet(u), y = findSet(v); if (size[x] > size[y]) { p[y] = x; size[x] += size[y]; } else { p[x] = y; size[y] += size[x]; } } return; } }; class Solution { public: int maxProduct(vector<string>& words) { int n = words.size(); vector<UnionFind> conns(26, UnionFind(n + 1)); for (int i = 0; i < n; i++) { for (int j = 0; j < words[i].size(); j++) { int ch = words[i][j] - 'a'; conns[ch].unionSet(i, n); } } int res = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { bool share = false; for (int k = 0; k < 26; k++) share = share || conns[k].isSameSet(i, j); if (!share) res = max(res, (int)(words[i].size() * words[j].size())); } } return res; } };
26.105263
77
0.373656
Alex-Amber
20acd8cb9b1b1f66f72c62cb38837fc199432b63
22,041
cpp
C++
fileformats/DFFaceTex.cpp
Pickle/XLEngine
c1aa5cf4584cb1940373505e4350336662fecf43
[ "MIT" ]
179
2018-04-04T12:35:07.000Z
2021-11-28T03:53:30.000Z
fileformats/DFFaceTex.cpp
Pickle/XLEngine
c1aa5cf4584cb1940373505e4350336662fecf43
[ "MIT" ]
34
2018-04-04T17:15:40.000Z
2021-11-28T03:01:22.000Z
fileformats/DFFaceTex.cpp
Pickle/XLEngine
c1aa5cf4584cb1940373505e4350336662fecf43
[ "MIT" ]
25
2018-04-04T23:49:46.000Z
2022-02-05T01:02:58.000Z
/*=========================================================================== * * File: DF_3DSTex.CPP * Author: Dave Humphrey (uesp@m0use.net) * Created On: Friday, March 22, 2002 * * Implements 3DS specific texture and material related export functions * for Daggerfall 3D objects. * *=========================================================================*/ /* * This version modified on 07/05/2002 by Gavin Clayton for Daggerfall Explorer. * For the original version of this file, please go to http://m0use.net/~uesp * and download DFTo3DS by Dave Humprey. * */ /* Include Files */ #include "DFFaceTex.h" /*=========================================================================== * * Local Function - boolean l_ComputeDFUVMatrixXY (Matrix, Params); * * Computes the UV conversion parameters from the given input based on * the formula: * U = AX + BY + D * * Returns FALSE on any error. For use on faces with 0 Z-coordinates. * *=========================================================================*/ bool DFFaceTex::l_ComputeDFUVMatrixXY(df3duvmatrix& Matrix, const df3duvparams_l& Params) { float Determinant; float Xi[3], Yi[3], Zi[3]; /* Compute the determinant of the coefficient matrix */ Determinant = Params.X[0]*Params.Y[1] + Params.Y[0]*Params.X[2] + Params.X[1]*Params.Y[2] - Params.Y[1]*Params.X[2] - Params.Y[0]*Params.X[1] - Params.X[0]*Params.Y[2]; /* Check for a singular matrix indicating no valid solution */ if (Determinant == 0) return (false); /* Compute parameters of the the inverted XYZ matrix */ Xi[0] = ( Params.Y[1] - Params.Y[2]) / Determinant; Xi[1] = (-Params.X[1] + Params.X[2]) / Determinant; Xi[2] = ( Params.X[1]*Params.Y[2] - Params.X[2]*Params.Y[1]) / Determinant; Yi[0] = (-Params.Y[0] + Params.Y[2]) / Determinant; Yi[1] = ( Params.X[0] - Params.X[2]) / Determinant; Yi[2] = (-Params.X[0]*Params.Y[2] + Params.X[2]*Params.Y[0]) / Determinant; Zi[0] = ( Params.Y[0] - Params.Y[1]) / Determinant; Zi[1] = (-Params.X[0] + Params.X[1]) / Determinant; Zi[2] = ( Params.X[0]*Params.Y[1] - Params.X[1]*Params.Y[0]) / Determinant; /* Compute the UV conversion parameters */ Matrix.UA = (Params.U[0]*Xi[0] + Params.U[1]*Yi[0] + Params.U[2]*Zi[0]); Matrix.UB = (Params.U[0]*Xi[1] + Params.U[1]*Yi[1] + Params.U[2]*Zi[1]); Matrix.UC = 0.0f; Matrix.UD = (Params.U[0]*Xi[2] + Params.U[1]*Yi[2] + Params.U[2]*Zi[2]);; Matrix.VA = (Params.V[0]*Xi[0] + Params.V[1]*Yi[0] + Params.V[2]*Zi[0]); Matrix.VB = (Params.V[0]*Xi[1] + Params.V[1]*Yi[1] + Params.V[2]*Zi[1]); Matrix.VC = 0.0f; Matrix.VD = (Params.V[0]*Xi[2] + Params.V[1]*Yi[2] + Params.V[2]*Zi[2]); return (true); } /*=========================================================================== * End of Function l_ComputeDFUVMatrixXY() *=========================================================================*/ /*=========================================================================== * * Local Function - boolean l_ComputeDFUVMatrixXZ (Matrix, Params); * * Computes the UV conversion parameters from the given input based on * the formula: * U = AX + CZ + D * * Returns FALSE on any error. For use on faces with 0 Y-coordinates. * *=========================================================================*/ bool DFFaceTex::l_ComputeDFUVMatrixXZ(df3duvmatrix& Matrix, const df3duvparams_l& Params) { float Determinant; float Xi[3], Yi[3], Zi[3]; /* Compute the determinant of the coefficient matrix */ Determinant = Params.X[0]*Params.Z[2] + Params.Z[1]*Params.X[2] + Params.Z[0]*Params.X[1] - Params.Z[0]*Params.X[2] - Params.X[1]*Params.Z[2] - Params.X[0]*Params.Z[1]; /* Check for a singular matrix indicating no valid solution */ if (Determinant == 0) return (false); /* Compute parameters of the the inverted XYZ matrix */ Xi[0] = ( Params.Z[2] - Params.Z[1]) / Determinant; Xi[1] = (-Params.X[1]*Params.Z[2] + Params.X[2]*Params.Z[1]) / Determinant; Xi[2] = ( Params.X[1] - Params.X[2]) / Determinant; Yi[0] = (-Params.Z[2] + Params.Z[0]) / Determinant; Yi[1] = ( Params.X[0]*Params.Z[2] - Params.X[2]*Params.Z[0]) / Determinant; Yi[2] = (-Params.X[0] + Params.X[2]) / Determinant; Zi[0] = ( Params.Z[1] - Params.Z[0]) / Determinant; Zi[1] = (-Params.X[0]*Params.Z[1] + Params.X[1]*Params.Z[0]) / Determinant; Zi[2] = ( Params.X[0] - Params.X[1]) / Determinant; /* Compute the UV conversion parameters */ Matrix.UA = (Params.U[0]*Xi[0] + Params.U[1]*Yi[0] + Params.U[2]*Zi[0]); Matrix.UB = 0.0f; Matrix.UC = (Params.U[0]*Xi[2] + Params.U[1]*Yi[2] + Params.U[2]*Zi[2]); Matrix.UD = (Params.U[0]*Xi[1] + Params.U[1]*Yi[1] + Params.U[2]*Zi[1]); Matrix.VA = (Params.V[0]*Xi[0] + Params.V[1]*Yi[0] + Params.V[2]*Zi[0]); Matrix.VB = 0.0f; Matrix.VC = (Params.V[0]*Xi[2] + Params.V[1]*Yi[2] + Params.V[2]*Zi[2]); Matrix.VD = (Params.V[0]*Xi[1] + Params.V[1]*Yi[1] + Params.V[2]*Zi[1]); return (true); } /*=========================================================================== * End of Function l_ComputeDFUVMatrixXZ() *=========================================================================*/ /*=========================================================================== * * Local Function - boolean l_ComputeDFUVMatrixYZ (Matrix, Params); * * Computes the UV conversion parameters from the given input based on * the formula: * U = BY + CZ + D * * Returns FALSE on any error. For use on faces with 0 X-coordinates. * *=========================================================================*/ bool DFFaceTex::l_ComputeDFUVMatrixYZ(df3duvmatrix& Matrix, const df3duvparams_l& Params) { float Determinant; float Xi[3], Yi[3], Zi[3]; /* Compute the determinant of the coefficient matrix */ Determinant = Params.Y[1]*Params.Z[2] + Params.Y[0]*Params.Z[1] + Params.Z[0]*Params.Y[2] - Params.Z[0]*Params.Y[1] - Params.Y[0]*Params.Z[2] - Params.Z[1]*Params.Y[2]; /* Check for a singular matrix indicating no valid solution */ if (Determinant == 0) return (false); /* Compute parameters of the the inverted XYZ matrix */ Xi[0] = ( Params.Y[1]*Params.Z[2] - Params.Y[2]*Params.Z[1]) / Determinant; Xi[1] = (-Params.Z[2] + Params.Z[1]) / Determinant; Xi[2] = ( Params.Y[2] - Params.Y[1]) / Determinant; Yi[0] = (-Params.Y[0]*Params.Z[2] + Params.Y[2]*Params.Z[0]) / Determinant; Yi[1] = ( Params.Z[2] - Params.Z[0]) / Determinant; Yi[2] = (-Params.Y[2] + Params.Y[0]) / Determinant; Zi[0] = ( Params.Y[0]*Params.Z[1] - Params.Y[1]*Params.Z[0]) / Determinant; Zi[1] = (-Params.Z[1] + Params.Z[0]) / Determinant; Zi[2] = ( Params.Y[1] - Params.Y[0]) / Determinant; /* Compute the UV conversion parameters */ Matrix.UA = 0.0f; Matrix.UB = (Params.U[0]*Xi[1] + Params.U[1]*Yi[1] + Params.U[2]*Zi[1]); Matrix.UC = (Params.U[0]*Xi[2] + Params.U[1]*Yi[2] + Params.U[2]*Zi[2]); Matrix.UD = (Params.U[0]*Xi[0] + Params.U[1]*Yi[0] + Params.U[2]*Zi[0]); Matrix.VA = 0.0f; Matrix.VB = (Params.V[0]*Xi[1] + Params.V[1]*Yi[1] + Params.V[2]*Zi[1]); Matrix.VC = (Params.V[0]*Xi[2] + Params.V[1]*Yi[2] + Params.V[2]*Zi[2]); Matrix.VD = (Params.V[0]*Xi[0] + Params.V[1]*Yi[0] + Params.V[2]*Zi[0]); return (true); } /*=========================================================================== * End of Function l_ComputeDFUVMatrixYZ() *=========================================================================*/ /*=========================================================================== * * Local Function - boolean l_ComputeDFUVMatrixXYZ (Matrix, Params); * * Computes the UV conversion parameters from the given input based on * the formula: * U = AX + BY + CZ * * Returns FALSE on any error. * *=========================================================================*/ bool DFFaceTex::l_ComputeDFUVMatrixXYZ(df3duvmatrix& Matrix, const df3duvparams_l& Params) { float Determinant; float Xi[3], Yi[3], Zi[3]; /* Compute the determinant of the coefficient matrix */ Determinant = Params.X[0]*Params.Y[1]*Params.Z[2] + Params.Y[0]*Params.Z[1]*Params.X[2] + Params.Z[0]*Params.X[1]*Params.Y[2] - Params.Z[0]*Params.Y[1]*Params.X[2] - Params.Y[0]*Params.X[1]*Params.Z[2] - Params.X[0]*Params.Z[1]*Params.Y[2]; /* Check for a singular matrix indicating no valid solution */ if (Determinant == 0) { //try a test... float Max[3]={-1000000,-1000000,-1000000}, Min[3]={1000000,1000000,1000000}; for (int i=0; i<3; i++) { if (Params.X[i] < Min[0]) Min[0]= Params.X[i]; if (Params.Y[i] < Min[1]) Min[1]= Params.Y[i]; if (Params.Z[i] < Min[2]) Min[2]= Params.Z[i]; if (Params.X[i] > Max[0]) Max[0]= Params.X[i]; if (Params.Y[i] > Max[1]) Max[1]= Params.Y[i]; if (Params.Z[i] > Max[2]) Max[2]= Params.Z[i]; } float dx = Max[0] - Min[0]; float dy = Max[1] - Min[1]; float dz = Max[2] - Min[2]; if ( dx <= dy && dx <= dz ) { bool bYZ = l_ComputeDFUVMatrixYZ(Matrix, Params); if ( bYZ == false ) { bool bXZ = l_ComputeDFUVMatrixXZ(Matrix, Params); if ( bXZ == false ) { return l_ComputeDFUVMatrixXY(Matrix, Params); } else { return true; } } else return true; } else if ( dy <= dx && dy <= dz ) { bool bXZ = l_ComputeDFUVMatrixXZ(Matrix, Params); if ( bXZ == false ) { bool bYZ = l_ComputeDFUVMatrixYZ(Matrix, Params); if ( bYZ == false ) { return l_ComputeDFUVMatrixXY(Matrix, Params); } else return true; } else return true; } else { bool bXY = l_ComputeDFUVMatrixXY(Matrix, Params); if ( bXY == false ) { bool bXZ = l_ComputeDFUVMatrixXZ(Matrix, Params); if ( bXZ == false ) { return l_ComputeDFUVMatrixYZ(Matrix, Params); } else return true; } else return true; } } /* Compute values of the the inverted XYZ matrix */ Xi[0] = ( Params.Y[1]*Params.Z[2] - Params.Y[2]*Params.Z[1]) / Determinant; Xi[1] = (-Params.X[1]*Params.Z[2] + Params.X[2]*Params.Z[1]) / Determinant; Xi[2] = ( Params.X[1]*Params.Y[2] - Params.X[2]*Params.Y[1]) / Determinant; Yi[0] = (-Params.Y[0]*Params.Z[2] + Params.Y[2]*Params.Z[0]) / Determinant; Yi[1] = ( Params.X[0]*Params.Z[2] - Params.X[2]*Params.Z[0]) / Determinant; Yi[2] = (-Params.X[0]*Params.Y[2] + Params.X[2]*Params.Y[0]) / Determinant; Zi[0] = ( Params.Y[0]*Params.Z[1] - Params.Y[1]*Params.Z[0]) / Determinant; Zi[1] = (-Params.X[0]*Params.Z[1] + Params.X[1]*Params.Z[0]) / Determinant; Zi[2] = ( Params.X[0]*Params.Y[1] - Params.X[1]*Params.Y[0]) / Determinant; /* Compute the UV conversion parameters */ Matrix.UA = (Params.U[0]*Xi[0] + Params.U[1]*Yi[0] + Params.U[2]*Zi[0]); Matrix.UB = (Params.U[0]*Xi[1] + Params.U[1]*Yi[1] + Params.U[2]*Zi[1]); Matrix.UC = (Params.U[0]*Xi[2] + Params.U[1]*Yi[2] + Params.U[2]*Zi[2]); Matrix.UD = 0.0f; Matrix.VA = (Params.V[0]*Xi[0] + Params.V[1]*Yi[0] + Params.V[2]*Zi[0]); Matrix.VB = (Params.V[0]*Xi[1] + Params.V[1]*Yi[1] + Params.V[2]*Zi[1]); Matrix.VC = (Params.V[0]*Xi[2] + Params.V[1]*Yi[2] + Params.V[2]*Zi[2]); Matrix.VD = 0.0f; return (true); } /*=========================================================================== * End of Function l_ComputeDFUVMatrixXYZ() *=========================================================================*/ /*=========================================================================== * * Local Function - boolean l_ComputeDFUVMatrixXYZ1 (Matrix, Params); * * Computes the UV conversion parameters from the given input based on * the formula: * U = AX + BY + CZ + D * * Returns FALSE on any error. Only valid for faces that have more than * 3 points. * *=========================================================================*/ bool DFFaceTex::l_ComputeDFUVMatrixXYZ1(df3duvmatrix& Matrix, const df3duvparams_l& Params) { float Determinant; float Xi[4], Yi[4], Zi[4], Ai[4]; /* Compute the determinant of the coefficient matrix */ Determinant = Params.X[0]*Params.Y[1]*Params.Z[2]-Params.X[0]*Params.Y[1]*Params.Z[3] +Params.X[0]*Params.Z[1]*Params.Y[3]-Params.X[0]*Params.Z[1]*Params.Y[2] +Params.X[0]*Params.Y[2]*Params.Z[3]-Params.X[0]*Params.Z[2]*Params.Y[3] -Params.Y[0]*Params.Z[1]*Params.X[3]+Params.Y[0]*Params.Z[1]*Params.X[2] -Params.Y[0]*Params.X[2]*Params.Z[3]+Params.Y[0]*Params.Z[2]*Params.X[3] -Params.Y[0]*Params.X[1]*Params.Z[2]+Params.Y[0]*Params.X[1]*Params.Z[3] +Params.Z[0]*Params.X[2]*Params.Y[3]-Params.Z[0]*Params.Y[2]*Params.X[3] +Params.Z[0]*Params.X[1]*Params.Y[2]-Params.Z[0]*Params.X[1]*Params.Y[3] +Params.Z[0]*Params.Y[1]*Params.X[3]-Params.Z[0]*Params.Y[1]*Params.X[2] -Params.X[1]*Params.Y[2]*Params.Z[3]+Params.X[1]*Params.Z[2]*Params.Y[3] -Params.Y[1]*Params.Z[2]*Params.X[3]+Params.Y[1]*Params.X[2]*Params.Z[3] -Params.Z[1]*Params.X[2]*Params.Y[3]+Params.Z[1]*Params.Y[2]*Params.X[3]; /* Check for a singular matrix indicating no valid solution */ if (Determinant == 0) return (false); /* Compute values of the the inverted XYZ matrix */ Xi[0] = Params.Y[1]*Params.Z[2] + Params.Z[1]*Params.Y[3] + Params.Y[2]*Params.Z[3] - Params.Y[3]*Params.Z[2] - Params.Y[2]*Params.Z[1] - Params.Y[1]*Params.Z[3]; Xi[1] =-Params.X[1]*Params.Z[2] - Params.Z[1]*Params.X[3] - Params.X[2]*Params.Z[3] + Params.X[3]*Params.Z[2] + Params.X[2]*Params.Z[1] + Params.X[1]*Params.Z[3]; Xi[2] = Params.X[1]*Params.Y[2] + Params.Y[1]*Params.X[3] + Params.X[2]*Params.Y[3] - Params.X[3]*Params.Y[2] - Params.X[2]*Params.Y[1] - Params.X[1]*Params.Y[3]; Xi[3] =-Params.X[1]*Params.Y[2]*Params.Z[3] - Params.Y[1]*Params.Z[2]*Params.X[3] - Params.Z[1]*Params.X[2]*Params.Y[3] + Params.X[3]*Params.Y[2]*Params.Z[1] + Params.X[2]*Params.Y[1]*Params.Z[3] + Params.X[1]*Params.Y[3]*Params.Z[2]; Yi[0] =-Params.Y[0]*Params.Z[2] - Params.Z[0]*Params.Y[3] - Params.Y[2]*Params.Z[3] + Params.Y[3]*Params.Z[2] + Params.Y[2]*Params.Z[0] + Params.Y[0]*Params.Z[3]; Yi[1] = Params.X[0]*Params.Z[2] + Params.Z[0]*Params.X[3] + Params.X[2]*Params.Z[3] - Params.X[3]*Params.Z[2] - Params.X[2]*Params.Z[0] - Params.X[0]*Params.Z[3]; Yi[2] =-Params.X[0]*Params.Y[2] - Params.Y[0]*Params.X[3] - Params.X[2]*Params.Y[3] + Params.X[3]*Params.Y[2] + Params.X[2]*Params.Y[0] + Params.X[0]*Params.Y[3]; Yi[3] = Params.X[0]*Params.Y[2]*Params.Z[3] + Params.Y[0]*Params.Z[2]*Params.X[3] + Params.Z[0]*Params.X[2]*Params.Y[3] - Params.X[3]*Params.Y[2]*Params.Z[0] - Params.X[2]*Params.Y[0]*Params.Z[3] - Params.X[0]*Params.Y[3]*Params.Z[2]; Zi[0] = Params.Y[0]*Params.Z[1] + Params.Z[0]*Params.Y[3] + Params.Y[1]*Params.Z[3] -Params.Y[3]*Params.Z[1] - Params.Y[0]*Params.Z[0] - Params.Y[0]*Params.Z[3]; Zi[1] =-Params.X[0]*Params.Z[1] - Params.Z[0]*Params.Y[3] - Params.X[1]*Params.Z[3] + Params.X[3]*Params.Z[1] + Params.X[1]*Params.Z[0] + Params.X[0]*Params.Z[3]; Zi[2] = Params.X[0]*Params.Y[1] + Params.Y[0]*Params.X[3] + Params.X[1]*Params.Y[3] - Params.X[3]*Params.Y[1] - Params.X[1]*Params.Y[0] - Params.X[0]*Params.Y[3]; Zi[3] =-Params.X[0]*Params.Y[1]*Params.Z[3] - Params.Y[0]*Params.Z[1]*Params.X[3] - Params.Z[0]*Params.X[1]*Params.Y[3] + Params.X[3]*Params.Y[1]*Params.Z[0] + Params.Z[1]*Params.Y[0]*Params.Z[3] + Params.X[0]*Params.Y[3]*Params.Z[1]; Ai[0] =-Params.Y[0]*Params.Z[1] - Params.Z[0]*Params.Y[2] - Params.Y[1]*Params.Z[2] + Params.Y[2]*Params.Z[1] + Params.Y[1]*Params.Z[0] + Params.Y[0]*Params.Z[2]; Ai[1] = Params.X[0]*Params.Z[1] + Params.Z[0]*Params.X[2] + Params.X[1]*Params.Z[2] - Params.X[1]*Params.Z[1] - Params.X[1]*Params.Z[0] - Params.X[0]*Params.Z[2]; Ai[2] =-Params.X[0]*Params.Y[1] - Params.Y[0]*Params.X[2] - Params.X[1]*Params.Y[2] + Params.X[2]*Params.Y[1] + Params.X[1]*Params.Y[0] + Params.X[0]*Params.Y[2]; Ai[3] = Params.X[0]*Params.Y[1]*Params.Z[2] + Params.Y[0]*Params.Z[1]*Params.X[2] + Params.Z[0]*Params.X[1]*Params.Y[2] - Params.X[2]*Params.Y[1]*Params.Z[0] - Params.X[1]*Params.Y[0]*Params.Z[2] - Params.X[0]*Params.Y[2]*Params.Z[1]; /* Compute the UV conversion parameters */ Matrix.UA = (Params.U[0]*Xi[0] + Params.U[1]*Yi[0] + Params.U[2]*Zi[0] + Params.U[3]*Ai[0]) / Determinant; Matrix.UB = (Params.U[0]*Xi[1] + Params.U[1]*Yi[1] + Params.U[2]*Zi[1] + Params.U[3]*Ai[1]) / Determinant; Matrix.UC = (Params.U[0]*Xi[2] + Params.U[1]*Yi[2] + Params.U[2]*Zi[2] + Params.U[3]*Ai[2]) / Determinant; Matrix.UD = (Params.U[0]*Xi[3] + Params.U[1]*Yi[3] + Params.U[2]*Zi[3] + Params.U[3]*Ai[3]) / Determinant; Matrix.VA = (Params.V[0]*Xi[0] + Params.V[1]*Yi[0] + Params.V[2]*Zi[0] + Params.V[3]*Ai[0]) / Determinant; Matrix.VB = (Params.V[0]*Xi[1] + Params.V[1]*Yi[1] + Params.V[2]*Zi[1] + Params.V[3]*Ai[1]) / Determinant; Matrix.VC = (Params.V[0]*Xi[2] + Params.V[1]*Yi[2] + Params.V[2]*Zi[2] + Params.V[3]*Ai[2]) / Determinant; Matrix.VD = (Params.V[0]*Xi[3] + Params.V[1]*Yi[3] + Params.V[2]*Zi[3] + Params.V[3]*Ai[3]) / Determinant; return (true); } /*=========================================================================== * End of Function l_ComputeDFUVMatrixXYZ1() *=========================================================================*/ /*=========================================================================== * * Function - boolean ComputeDFFaceTextureUVMatrix (Matrix, Face, Object); * * Calculates the transformation parameters to convert the face XYZ coordinates * to texture UV coordinates for the given face, storing in the given matrix. * Returns FALSE on any error. The function computes the A, B...F parameters * for the equations: * U = AX + BY + CZ * V = DX + EY + FZ * *=========================================================================*/ bool DFFaceTex::ComputeDFFaceTextureUVMatrix( df3duvmatrix& Matrix, ObjVertex *pFaceVerts ) { df3duvparams_l Params; bool Result; /* Initialize the conversion matrix */ Matrix.UA = 1.0f; Matrix.UB = 0.0f; Matrix.UC = 0.0f; Matrix.UD = 0.0f; Matrix.VA = 0.0f; Matrix.VB = 1.0f; Matrix.VC = 0.0f; Matrix.UD = 0.0f; /* Store the first 3 points of texture coordinates */ Params.U[0] = pFaceVerts[0].tu; Params.U[1] = pFaceVerts[1].tu; Params.U[2] = pFaceVerts[2].tu; Params.V[0] = pFaceVerts[0].tv; Params.V[1] = pFaceVerts[1].tv; Params.V[2] = pFaceVerts[2].tv; /* Get and store the 1st point coordinates in face */ Params.X[0] = pFaceVerts[0].pos.x; Params.Y[0] = pFaceVerts[0].pos.y; Params.Z[0] = pFaceVerts[0].pos.z; /* Get and store the 2nd point coordinates in face */ Params.X[1] = pFaceVerts[1].pos.x; Params.Y[1] = pFaceVerts[1].pos.y; Params.Z[1] = pFaceVerts[1].pos.z; /* Get and store the 3rd point coordinates in face */ Params.X[2] = pFaceVerts[2].pos.x; Params.Y[2] = pFaceVerts[2].pos.y; Params.Z[2] = pFaceVerts[2].pos.z; /* get and store the 4th store coordinates, if any */ // NOTE: CDaggerTool::SetFaceUV has already accounted for presence/absence of 4th point Params.X[3] = pFaceVerts[3].pos.x; Params.Y[3] = pFaceVerts[3].pos.y; Params.Z[3] = pFaceVerts[3].pos.z; Vector3 S = pFaceVerts[1].pos - pFaceVerts[0].pos; Vector3 T = pFaceVerts[2].pos - pFaceVerts[0].pos; Vector3 N; N.CrossAndNormalize(S, T); /* Compute the solution using an XZ linear equation */ if ( fabsf(N.y) >= fabsf(N.x) && fabsf(N.y) >= fabsf(N.z) )//Params.Y[0] == Params.Y[1] && Params.Y[1] == Params.Y[2]) { Result = l_ComputeDFUVMatrixXZ(Matrix, Params); } /* Compute the solution using an XY linear equation */ else if ( fabsf(N.z) >= fabsf(N.x) && fabsf(N.z) >= fabsf(N.y) )//if (Params.Z[0] == Params.Z[1] && Params.Z[1] == Params.Z[2]) { Result = l_ComputeDFUVMatrixXY(Matrix, Params); } /* Compute the solution using an YZ linear equation */ else// if (Params.X[0] == Params.X[1] && Params.X[1] == Params.X[2]) { Result = l_ComputeDFUVMatrixYZ(Matrix, Params); } /* Compute the solution using an XYZ linear equation */ /*else { Result = l_ComputeDFUVMatrixXYZ(Matrix, Params); }*/ /* Attempt to use a 4x4 matrix solution if the previous ones failed */ if (!Result) { Result = l_ComputeDFUVMatrixXYZ1(Matrix, Params); } return (Result); } /*=========================================================================== * End of Function ComputeDFFaceTextureUVMatrix() *=========================================================================*/
44.89002
132
0.517581
Pickle
20acef1fd0a9644eaf0ffa1eb7422fe27bc42720
1,098
hpp
C++
ringOS-Beta17/src/interrupts/interrupts.hpp
ElectroBoy404NotFound/ringOS
9c109828363f3dc8b957dc58ecdfd5bc8d81e1a4
[ "MIT" ]
1
2021-12-05T15:49:40.000Z
2021-12-05T15:49:40.000Z
ringOS-Beta17/src/interrupts/interrupts.hpp
ElectroBoy404NotFound/ringOS
9c109828363f3dc8b957dc58ecdfd5bc8d81e1a4
[ "MIT" ]
null
null
null
ringOS-Beta17/src/interrupts/interrupts.hpp
ElectroBoy404NotFound/ringOS
9c109828363f3dc8b957dc58ecdfd5bc8d81e1a4
[ "MIT" ]
null
null
null
#pragma once #include "../BasicRenderer.hpp" #include "../userinput/mouse.hpp" #define PIC1_COMMAND 0x20 #define PIC1_DATA 0x21 #define PIC2_COMMAND 0xA0 #define PIC2_DATA 0xA1 #define PIC_EOI 0x20 #define ICW1_INIT 0x10 #define ICW1_ICW4 0x01 #define ICW4_8086 0x01 struct interrupt_frame; __attribute__((interrupt)) void PageFault_Handler(interrupt_frame* frame, unsigned long int error_code); __attribute__((interrupt)) void DoubleFault_Handler(interrupt_frame* frame, unsigned long int error_code); __attribute__((interrupt)) void GPFault_Handler(interrupt_frame* frame, unsigned long int error_code); __attribute__((interrupt)) void TSSFault_Handler(interrupt_frame* frame, unsigned long int error_code); __attribute__((interrupt)) void DebugFault_Handler(interrupt_frame* frame); __attribute__((interrupt)) void KeyboardInt_Handler(interrupt_frame* frame); __attribute__((interrupt)) void MouseInt_Handler(interrupt_frame* frame); __attribute__((interrupt)) void PITInt_Handler(interrupt_frame* frame); void RemapPIC(); void PIC_EndMaster(); void PIC_EndSlave();
40.666667
107
0.802368
ElectroBoy404NotFound
20b3b3b5c4ec4e5b3633641a674be51d8ea7cd2b
16,421
cpp
C++
OpenGL/src/tests/TestAdvanced.cpp
ilkeraktug/OpenGL
ddf639166e75c96e02864dd92aea7a562cf36a72
[ "MIT" ]
null
null
null
OpenGL/src/tests/TestAdvanced.cpp
ilkeraktug/OpenGL
ddf639166e75c96e02864dd92aea7a562cf36a72
[ "MIT" ]
null
null
null
OpenGL/src/tests/TestAdvanced.cpp
ilkeraktug/OpenGL
ddf639166e75c96e02864dd92aea7a562cf36a72
[ "MIT" ]
null
null
null
#include "TestAdvanced.h" #include "VertexBufferLayout.h" namespace test { TestAdvanced::TestAdvanced() : camera(&m_Proj, &m_View, 1280.0f, 768.0f) { GLCall(glEnable(GL_DEPTH_TEST)); GLCall(glDepthFunc(GL_LESS)); /* glEnable(GL_PROGRAM_POINT_SIZE); GLCall(glEnable(GL_CULL_FACE)); GLCall(glCullFace(GL_BACK)); GLCall(glFrontFace(GL_CW));*/ glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); m_CubeVAO = std::make_unique<VertexArray>(); m_PlaneVAO = std::make_unique<VertexArray>(); m_SkyboxVAO = std::make_unique<VertexArray>(); m_QuadVAO = std::make_unique<VertexArray>(); float cubeVertices[] = { -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 0.0f, // bottom-right 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 1.0f, 1.0f, // top-right -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, // bottom-left -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 1.0f, // top-left // front face -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, // bottom-right 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f, // top-right -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, // top-left -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // bottom-left // left face -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right -1.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-left -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left -1.0f, -1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-left -1.0f, -1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-right -1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-right // right face 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right 1.0f, 1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, // top-right 1.0f, -1.0f, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, // bottom-right 1.0f, 1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // top-left 1.0f, -1.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, // bottom-left // bottom face -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right 1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 1.0f, // top-left 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left 1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 1.0f, 0.0f, // bottom-left -1.0f, -1.0f, 1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 0.0f, // bottom-right -1.0f, -1.0f, -1.0f, 0.0f, -1.0f, 0.0f, 0.0f, 1.0f, // top-right // top face -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left 1.0f, 1.0f , 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // top-right 1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, // bottom-right -1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // top-left -1.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f // bottom-left }; float planeVertices[] = { // positions // normals // texcoords 10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 0.0f, -10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, -10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 10.0f, 10.0f, -0.5f, 10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 0.0f, -10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 0.0f, 10.0f, 10.0f, -0.5f, -10.0f, 0.0f, 1.0f, 0.0f, 10.0f, 10.0f }; float skyboxVertices[] = { -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f }; float quadVertices[] = { // positions // texture Coords -1.0f, 1.0f, 0.0f, 0.0f, 1.0f, -1.0f, -1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 1.0f, 1.0f, -1.0f, 0.0f, 1.0f, 0.0f, }; int index = 0; float offset = 0.1f; for (int y = -10; y < 10; y += 2) { for (int x = -10; x < 10; x += 2) { glm::vec2 translation; translation.x = (float)x / 10.0f + offset; translation.y = (float)y / 10.0f + offset; translations[index++] = translation; } } m_QuadVAO->Bind(); m_QuadVBO = std::make_unique<VertexBuffer>(quadVertices, sizeof(quadVertices)); VertexBufferLayout other; other.Push<float>(3); other.Push<float>(3); other.Push<float>(2); m_QuadVAO->AddBuffer(*m_QuadVBO, other); unsigned int instanceVBO; glGenBuffers(1, &instanceVBO); glBindBuffer(GL_ARRAY_BUFFER, instanceVBO); glBufferData(GL_ARRAY_BUFFER, sizeof(glm::vec2) * 100, &translations[0], GL_STATIC_DRAW); glEnableVertexAttribArray(2); glVertexAttribPointer(2, 2, GL_FLOAT, GL_FALSE, 2 * sizeof(float), (void*)0); glVertexAttribDivisor(2, 1); m_QuadVAO->Unbind(); m_SkyboxVAO->Bind(); m_SkyboxVBO = std::make_unique<VertexBuffer>(skyboxVertices, sizeof(skyboxVertices)); VertexBufferLayout layout; layout.Push<float>(3); m_SkyboxVAO->AddBuffer(*m_SkyboxVBO, layout); m_SkyboxVAO->Unbind(); m_CubeVAO->Bind(); m_CubeVBO = std::make_unique<VertexBuffer>(cubeVertices, sizeof(cubeVertices)); layout.Push<float>(2); m_CubeVAO->AddBuffer(*m_CubeVBO, other); m_CubeVAO->Unbind(); m_PlaneVAO->Bind(); m_PlaneVBO = std::make_unique<VertexBuffer>(planeVertices, sizeof(planeVertices)); m_PlaneVAO->AddBuffer(*m_PlaneVBO, other); m_PlaneVAO->Unbind(); m_Shader = std::make_unique<Shader>("res/shaders/Advanced.shader"); m_DiffShader = std::make_unique<Shader>("res/shaders/Diff.shader"); m_BasicShader = std::make_unique<Shader>("res/shaders/Geometry.shader", 1); m_SkyboxShader = std::make_unique<Shader>("res/shaders/Skybox.shader"); m_QuadShader = std::make_unique<Shader>("res/shaders/Quad.shader"); m_NormalShader = std::make_unique<Shader>("res/shaders/Normal.shader", 1); m_LightShader = std::make_unique<Shader>("res/shaders/LightShader.shader"); m_PointLightShader = std::make_unique<Shader>("res/shaders/PointLight.shader", 1); m_SkyboxTexture = std::make_unique<CubeMap>("res/textures/skybox"); m_MetalTexture = std::make_unique<Texture>("res/obj/teapot/diffuse.jpg"); m_Textures.emplace("Marble", new Texture("res/textures/marble.jpg")); m_Textures.emplace("Wood", new Texture("res/textures/wood.png")); glTextureParameteri(m_Textures["Wood"]->GetId(), GL_TEXTURE_WRAP_S, GL_REPEAT); glTextureParameteri(m_Textures["Wood"]->GetId(), GL_TEXTURE_WRAP_T, GL_REPEAT); //loadModel = new obj::Model("res/obj/backpack/backpack.obj"); m_FrameBuffer = std::make_unique<FrameBuffer>(1280, 768); glGenFramebuffers(1, &depthMapFBO); GLCall(glGenTextures(1, &shadowTex)); GLCall(glBindTexture(GL_TEXTURE_2D, shadowTex)); GLCall(glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT, m_ShadowWidth, m_ShadowHeight, 0, GL_DEPTH_COMPONENT, GL_FLOAT, nullptr)); GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)); GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)); GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER)); GLCall(glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER)); float borderColor[] = { 1.0f, 1.0f, 1.0f, 1.0f }; glTexParameterfv(GL_TEXTURE_2D, GL_TEXTURE_BORDER_COLOR, borderColor); GLCall(glBindFramebuffer(GL_FRAMEBUFFER, depthMapFBO)); GLCall(glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowTex, 0)); GLCall(glDrawBuffer(GL_NONE)); GLCall(glReadBuffer(GL_NONE)); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE) std::cout << "Frame Buffer Succed" << std::endl; GLCall(glBindFramebuffer(GL_FRAMEBUFFER, 0)); m_PointLightTexture = std::make_unique<CubeMap>(m_ShadowWidth, m_ShadowHeight); GLCall(glGenFramebuffers(1, &pointDepthMapFBO)); GLCall(glBindFramebuffer(GL_FRAMEBUFFER, pointDepthMapFBO)); GLCall(glFramebufferTexture(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, m_PointLightTexture->GetID(), 0)); GLCall(glReadBuffer(GL_NONE)); GLCall(glDrawBuffer(GL_NONE)); if (glCheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE) std::cout << "CubeMap Frame Buffer Succed" << std::endl; GLCall(glBindFramebuffer(GL_FRAMEBUFFER, 0)); } TestAdvanced::~TestAdvanced() { } void TestAdvanced::OnRender() { camera.OnRender(); std::vector<glm::mat4> m_ShadowTransform; m_ShadowTransform.push_back(m_ShadowProjection * glm::lookAt(m_LightPosition, m_LightPosition + glm::vec3(1.0, 0.0, 0.0), glm::vec3(0.0, -1.0, 0.0))); m_ShadowTransform.push_back(m_ShadowProjection * glm::lookAt(m_LightPosition, m_LightPosition + glm::vec3(-1.0, 0.0, 0.0), glm::vec3(0.0, -1.0, 0.0))); m_ShadowTransform.push_back(m_ShadowProjection * glm::lookAt(m_LightPosition, m_LightPosition + glm::vec3(0.0, 1.0, 0.0), glm::vec3(0.0, 0.0, 1.0))); m_ShadowTransform.push_back(m_ShadowProjection * glm::lookAt(m_LightPosition, m_LightPosition + glm::vec3(0.0, -1.0, 0.0), glm::vec3(0.0, 0.0, -1.0))); m_ShadowTransform.push_back(m_ShadowProjection * glm::lookAt(m_LightPosition, m_LightPosition + glm::vec3(0.0, 0.0, 1.0), glm::vec3(0.0, -1.0, 0.0))); m_ShadowTransform.push_back(m_ShadowProjection * glm::lookAt(m_LightPosition, m_LightPosition + glm::vec3(0.0, 0.0, -1.0), glm::vec3(0.0, -1.0, 0.0))); //glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT); { glDisable(GL_DEPTH_TEST); m_SkyboxShader->Bind(); m_SkyboxVAO->Bind(); glm::mat4 mvp = m_Proj * glm::mat4(glm::mat3(m_View)); m_SkyboxShader->SetUniformMat4f("u_MVP", mvp); m_SkyboxTexture->Bind(0); glDrawArrays(GL_TRIANGLES, 0, 36); glEnable(GL_DEPTH_TEST); m_SkyboxShader->Unbind(); } { glViewport(0, 0, m_ShadowWidth, m_ShadowHeight); glBindFramebuffer(GL_FRAMEBUFFER, pointDepthMapFBO); glClear(GL_DEPTH_BUFFER_BIT); m_PointLightShader->Bind(); m_CubeVAO->Bind(); for (size_t i = 0; i < 6; i++) { m_PointLightShader->SetUniformMat4f("u_ShadowMat[" + std::to_string(i) + "]", m_ShadowTransform[i]); } m_PointLightShader->SetUniform1f("u_FarPlane", 25.0f); m_PointLightShader->SetUniformVec3f("u_LightPos", m_LightPosition); m_Model = glm::translate(glm::mat4(1.0f), CubeTranslationA); m_PointLightShader->SetUniformMat4f("u_Model", m_Model); glDrawArrays(GL_TRIANGLES, 0, 36); m_Model = glm::translate(glm::mat4(1.0f), CubeTranslationB); m_PointLightShader->SetUniformMat4f("u_Model", m_Model); glDrawArrays(GL_TRIANGLES, 0, 36); m_Model = glm::translate(glm::mat4(1.0f), CubeTranslationC); m_PointLightShader->SetUniformMat4f("u_Model", m_Model); glDrawArrays(GL_TRIANGLES, 0, 36); m_CubeVAO->Unbind(); m_PlaneVAO->Bind(); m_Model = glm::translate(glm::mat4(1.0f), PlaneTranslationA); glDrawArrays(GL_TRIANGLES, 0, 6); m_PointLightShader->SetUniformMat4f("u_Model", m_Model); m_PlaneVAO->Unbind(); m_PointLightShader->Unbind(); glBindFramebuffer(GL_FRAMEBUFFER, 0); } { glViewport(0, 0, 1280, 768); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); m_CubeVAO->Bind(); m_QuadShader->Bind(); m_Textures["Wood"]->Bind(1); m_PointLightTexture->Bind(2); m_QuadShader->SetUniform1f("u_FarPlane", 25.0f); m_Model = glm::translate(glm::mat4(1.0f), CubeTranslationA); m_QuadShader->SetUniformMat4f("u_Proj", m_Proj); m_QuadShader->SetUniformMat4f("u_View", m_View); m_QuadShader->SetUniformMat4f("u_Model", m_Model); m_QuadShader->SetUniformVec3f("u_LightPos", m_LightPosition); m_QuadShader->SetUniformVec3f("u_CamPos", camera.GetCameraPosition()); m_QuadShader->SetUniform1i("diffuseTexture", 1); m_QuadShader->SetUniform1i("cubeDepthTexture", 2); glDrawArrays(GL_TRIANGLES, 0, 36); m_Model = glm::translate(glm::mat4(1.0f), CubeTranslationB); m_QuadShader->SetUniformMat4f("u_Model", m_Model); glDrawArrays(GL_TRIANGLES, 0, 36); m_Model = glm::translate(glm::mat4(1.0f), CubeTranslationC); m_QuadShader->SetUniformMat4f("u_Model", m_Model); glDrawArrays(GL_TRIANGLES, 0, 36); m_CubeVAO->Unbind(); m_PlaneVAO->Bind(); m_Model = glm::translate(glm::mat4(1.0f), PlaneTranslationA); m_QuadShader->SetUniformMat4f("u_Model", m_Model); glDrawArrays(GL_TRIANGLES, 0, 6); m_PlaneVAO->Unbind(); m_QuadShader->Unbind(); } } void TestAdvanced::OnUpdate(float deltaTime) { camera.OnUpdate(); } void TestAdvanced::OnImGuiRender() { ImGui::Begin("Translate"); ImGui::SliderFloat3("Cube A", &CubeTranslationA.x, -50.0f, 50.0f); ImGui::SliderFloat3("Cube B", &CubeTranslationB.x, -50.0f, 50.0f); ImGui::SliderFloat3("Cube C", &CubeTranslationC.x, -50.0f, 50.0f); ImGui::SliderFloat3("Plane A", &PlaneTranslationA.x, -50.0f, 50.0f); ImGui::SliderFloat3("LightPosition", &m_LightPosition.x, -50.0f, 50.0f); if (ImGui::Button("Reset")) { CubeTranslationA = glm::vec3(4.0f, -3.5f, -27.0); CubeTranslationB = glm::vec3(2.0f, 3.0f, -24.0); CubeTranslationC = glm::vec3(7.0f, -1.0f, -22.0); PlaneTranslationA = glm::vec3(-1.0f, -4.0f, -27.0f); m_LightPosition = glm::vec3(-12.0f, -1.0f, -40.0f); } ImGui::End(); camera.OnImGuiRender(); } }
44.261456
140
0.552281
ilkeraktug
20b83187f4fb38bb0026e9567dc41efb574b4cd5
17,034
cpp
C++
game/shared/EntityClasses.cpp
xalalau/HLEnhanced
f108222ab7d303c9ed5a8e81269f9e949508e78e
[ "Unlicense" ]
83
2016-06-10T20:49:23.000Z
2022-02-13T18:05:11.000Z
game/shared/EntityClasses.cpp
xalalau/HLEnhanced
f108222ab7d303c9ed5a8e81269f9e949508e78e
[ "Unlicense" ]
26
2016-06-16T22:27:24.000Z
2019-04-30T19:25:51.000Z
game/shared/EntityClasses.cpp
xalalau/HLEnhanced
f108222ab7d303c9ed5a8e81269f9e949508e78e
[ "Unlicense" ]
58
2016-06-10T23:52:33.000Z
2021-12-30T02:30:50.000Z
#include <algorithm> #include <cstdio> #include "extdll.h" #include "util.h" #include "DefaultClassifications.h" #include "EntityClasses.h" //TODO: move to utility header - Solokiller //Taken from cppreference.com documentation for std::lower_bound - Solokiller template<class ForwardIt, class T, class Compare = std::less<>> ForwardIt binary_find( ForwardIt first, ForwardIt last, const T& value, Compare comp = {} ) { // Note: BOTH type T and the type after ForwardIt is dereferenced // must be implicitly convertible to BOTH Type1 and Type2, used in Compare. // This is stricter than lower_bound requirement (see above) first = std::lower_bound( first, last, value, comp ); return first != last && !comp( value, *first ) ? first : last; } namespace { static CEntityClassificationsManager g_EntityClassifications; } CEntityClassificationsManager& EntityClassifications() { return g_EntityClassifications; } #ifdef SERVER_DLL static void EntityClassifications_WriteToFile_ServerCommand() { if( CMD_ARGC() != 2 ) { Alert( at_console, "Usage: entityclassifications_writetofile <filename including extension>\n" ); return; } char szGameDir[ MAX_PATH ]; if( !UTIL_GetGameDir( szGameDir, ARRAYSIZE( szGameDir ) ) ) { Alert( at_console, "Couldn't get game directory\n" ); return; } char szPath[ MAX_PATH ]; if( !PrintfSuccess( snprintf( szPath, ARRAYSIZE( szPath ), "%s/%s", szGameDir, CMD_ARGV( 1 ) ), ARRAYSIZE( szPath ) ) ) { Alert( at_console, "Couldn't format file path\n" ); return; } EntityClassifications().WriteToFile( szPath ); } #endif bool CEntityClassificationData::HasRelationshipToClassification( EntityClassification_t targetClassId ) const { return binary_find( m_Relationships.begin(), m_Relationships.end(), targetClassId ) != m_Relationships.end(); } bool CEntityClassificationData::GetRelationshipToClassification( EntityClassification_t targetClassId, Relationship& outRelationship ) { auto it = binary_find( m_Relationships.begin(), m_Relationships.end(), targetClassId ); if( it == m_Relationships.end() ) { outRelationship = R_NO; return false; } outRelationship = it->m_Relationship; return true; } void CEntityClassificationData::AddRelationship( EntityClassification_t targetClassId, Relationship relationship ) { auto it = binary_find( m_Relationships.begin(), m_Relationships.end(), targetClassId ); if( it == m_Relationships.end() ) { it = std::upper_bound( m_Relationships.begin(), m_Relationships.end(), targetClassId ); m_Relationships.insert( it, CClassificationRelationship( targetClassId, relationship ) ); } else { //Already existed; update. Alert( at_aiconsole, "CEntityClassificationData::AddRelationship: Updating relationship between \"%s\" and \"%u\" from \"%u\" to \"%u\"\n", m_szName.c_str(), targetClassId, it->m_Relationship, relationship ); it->m_Relationship = relationship; } } void CEntityClassificationData::RemoveRelationship( EntityClassification_t targetClassId ) { auto it = binary_find( m_Relationships.begin(), m_Relationships.end(), targetClassId ); if( it != m_Relationships.end() ) { m_Relationships.erase( it ); } } const std::string CEntityClassificationsManager::EMPTY_STRING; void CEntityClassificationsManager::Initialize() { #ifdef SERVER_DLL g_engfuncs.pfnAddServerCommand( "entityclassifications_writetofile", &EntityClassifications_WriteToFile_ServerCommand ); #endif } void CEntityClassificationsManager::Reset() { m_ClassMap.clear(); m_ClassList.clear(); m_NoneId = AddClassification( classify::NONE ); } bool CEntityClassificationsManager::IsClassIdValid( EntityClassification_t classId ) const { return classId != INVALID_ENTITY_CLASSIFICATION && classId <= m_ClassList.size() && m_ClassList[ IdToIndex( classId ) ]; } EntityClassification_t CEntityClassificationsManager::AddClassification( std::string&& szName, Relationship defaultSourceRelationship ) { return AddClassification( std::move( szName ), defaultSourceRelationship, R_NO, false ); } EntityClassification_t CEntityClassificationsManager::AddClassification( std::string&& szName, Relationship defaultSourceRelationship, Relationship defaultTargetRelationship ) { return AddClassification( std::move( szName ), defaultSourceRelationship, defaultTargetRelationship, true ); } EntityClassification_t CEntityClassificationsManager::AddClassification( std::string&& szName, Relationship defaultSourceRelationship, Relationship defaultTargetRelationship, bool bHasDefaultTargetRelationship ) { ASSERT( !szName.empty() ); if( szName.empty() ) { Alert( at_console, "CEntityClassificationsManager::AddClassification: Cannot add classification with empty name\n" ); return INVALID_ENTITY_CLASSIFICATION; } { auto it = m_ClassMap.find( szName ); if( it != m_ClassMap.end() ) { auto& classification = m_ClassList[ it->second.first ]; if( !it->second.second ) { Alert( at_aiconsole, "CEntityClassificationsManager::AddClassification: Updating classification \"%s\"\n", szName.c_str() ); classification->m_DefaultSourceRelationship = defaultSourceRelationship; classification->m_DefaultTargetRelationship = defaultTargetRelationship; classification->m_bHasDefaultTargetRelationship = bHasDefaultTargetRelationship; } else { Alert( at_console, "CEntityClassificationsManager::AddClassification: Cannot add classification \"%s\"; an alias with that name already exists\n", szName.c_str() ); } return classification->m_ClassId; } } if( m_ClassList.size() >= MAX_ENTITY_CLASSIFICATIONS ) { Alert( at_console, "CEntityClassificationsManager::AddClassification: Couldn't add \"%s\", maximum classifications %u reached\n", szName.c_str(), MAX_ENTITY_CLASSIFICATIONS ); return GetNoneId(); } const auto classId = m_ClassList.size() + FIRST_ID_OFFSET; m_ClassList.emplace_back( std::make_unique<CEntityClassificationData>( classId, std::move( szName ), defaultSourceRelationship, defaultTargetRelationship, bHasDefaultTargetRelationship ) ); auto& data = m_ClassList.back(); m_ClassMap.emplace( data->m_szName, std::make_pair( m_ClassList.size() - 1, false ) ); return classId; } bool CEntityClassificationsManager::RemoveClassification( EntityClassification_t classId ) { if( !IsClassIdValid( classId ) ) { Alert( at_error, "CEntityClassificationsManager::RemoveClassification: Class Id (\"%u\") is invalid\n", classId ); return false; } const auto index = IdToIndex( classId ); //Erase all entries, both classifications and aliases. for( auto it = m_ClassMap.begin(); it != m_ClassMap.end(); ) { if( it->second.first == index ) { it = m_ClassMap.erase( it ); } else ++it; } m_ClassList[ index ].reset(); //Remove it from all classifications as well. for( auto& classification : m_ClassList ) { if( classification ) classification->RemoveRelationship( classId ); } //TODO: reclaim freed Ids? - Solokiller return true; } bool CEntityClassificationsManager::RemoveClassification( const std::string& szName, bool bRemoveAliases ) { auto it = m_ClassMap.find( szName ); if( it == m_ClassMap.end() ) return false; if( it->second.second && !bRemoveAliases ) return false; return RemoveClassification( IndexToId( it->second.first ) ); } EntityClassification_t CEntityClassificationsManager::GetClassificationId( const std::string& szName ) const { //The empty string is equivalent to the invalid classification. if( szName == EMPTY_STRING ) return INVALID_ENTITY_CLASSIFICATION; auto it = m_ClassMap.find( szName ); if( it == m_ClassMap.end() ) return GetNoneId(); return m_ClassList[ it->second.first ]->m_ClassId; } EntityClassification_t CEntityClassificationsManager::AddAlias( std::string&& szName, std::string&& szTarget ) { EntityClassification_t targetId = INVALID_ENTITY_CLASSIFICATION; //First get the Id for the target, inserting the classification if it doesn't exist yet. { auto it = m_ClassMap.find( szTarget ); if( it != m_ClassMap.end() ) { targetId = IndexToId( it->second.first ); } else { targetId = AddClassification( std::move( szTarget ) ); } } if( targetId == INVALID_ENTITY_CLASSIFICATION ) { //The name is only moved from if it was inserted, so this can't be an empty string. Alert( at_error, "CEntityClassificationsManager::AddAlias: Couldn't add or find classification \"%s\"\n", szTarget.c_str() ); return targetId; } //Now check if the alias exists or not. If not, add it, otherwise, change target. auto it = m_ClassMap.find( szName ); bool bInsert = false; if( it == m_ClassMap.end() ) { bInsert = true; } else { if( it->second.second ) { it->second.first = IdToIndex( targetId ); } else { //A classification with that name exists; remove classification and add as alias. RemoveClassification( szName, false ); bInsert = true; } } if( bInsert ) { m_ClassMap.emplace( std::move( szName ), std::make_pair( IdToIndex( targetId ), true ) ); } return targetId; } bool CEntityClassificationsManager::RemoveAlias( const std::string& szName ) { auto it = m_ClassMap.find( szName ); if( it == m_ClassMap.end() ) return false; //Only remove aliases. if( !it->second.second ) { return false; } m_ClassMap.erase( it ); return true; } void CEntityClassificationsManager::AddRelationship( EntityClassification_t sourceClassId, EntityClassification_t targetClassId, Relationship relationship, bool bBidirectional ) { if( !IsClassIdValid( sourceClassId ) || !IsClassIdValid( targetClassId ) ) { Alert( at_error, "CEntityClassificationsManager::AddRelationship: One or both class Ids (\"%u\" and \"%u\") are invalid\n", sourceClassId, targetClassId ); return; } auto& from = m_ClassList[ IdToIndex( sourceClassId ) ]; from->AddRelationship( targetClassId, relationship ); if( bBidirectional ) { auto& to = m_ClassList[ IdToIndex( targetClassId ) ]; to->AddRelationship( sourceClassId, relationship ); } } void CEntityClassificationsManager::AddRelationship( const std::string& sourceClassName, const std::string& targetClassName, Relationship relationship, bool bBidirectional ) { auto sourceId = GetClassificationId( sourceClassName ); auto targetId = GetClassificationId( targetClassName ); if( !IsClassIdValid( sourceId ) || !IsClassIdValid( targetId ) ) { Alert( at_error, "CEntityClassificationsManager::AddRelationship: One or both classifications (\"%s\" and \"%s\") are nonexistent\n", sourceClassName.c_str(), targetClassName.c_str() ); return; } AddRelationship( sourceId, targetId, relationship, bBidirectional ); } void CEntityClassificationsManager::RemoveRelationship( EntityClassification_t sourceClassId, EntityClassification_t targetClassId, bool bBidirectional ) { if( !IsClassIdValid( sourceClassId ) || !IsClassIdValid( targetClassId ) ) { Alert( at_error, "CEntityClassificationsManager::RemoveRelationship: One or both class Ids (\"%u\" and \"%u\") are invalid\n", sourceClassId, targetClassId ); return; } auto& from = m_ClassList[ IdToIndex( sourceClassId ) ]; from->RemoveRelationship( targetClassId ); if( bBidirectional ) { auto& to = m_ClassList[ IdToIndex( targetClassId ) ]; to->RemoveRelationship( sourceClassId ); } } void CEntityClassificationsManager::RemoveRelationship( const std::string& sourceClassName, const std::string& targetClassName, bool bBidirectional ) { auto sourceId = GetClassificationId( sourceClassName ); auto targetId = GetClassificationId( targetClassName ); if( !IsClassIdValid( sourceId ) || !IsClassIdValid( targetId ) ) { Alert( at_error, "CEntityClassificationsManager::RemoveRelationship: One or both classifications (\"%s\" and \"%s\") are nonexistent\n", sourceClassName.c_str(), targetClassName.c_str() ); return; } RemoveRelationship( sourceId, targetId, bBidirectional ); } Relationship CEntityClassificationsManager::GetRelationshipBetween( EntityClassification_t sourceClassId, EntityClassification_t targetClassId, bool bBidirectional ) const { if( !IsClassIdValid( sourceClassId ) || !IsClassIdValid( targetClassId ) ) { Alert( at_error, "CEntityClassificationsManager::GetRelationshipBetween: One or both class Ids (\"%u\" and \"%u\") are invalid\n", sourceClassId, targetClassId ); return R_NO; } Relationship result = R_NO; auto& from = m_ClassList[ IdToIndex( sourceClassId ) ]; auto& to = m_ClassList[ IdToIndex( targetClassId ) ]; //If there exists a relationship from source to target, return relationship. if( from->GetRelationshipToClassification( targetClassId, result ) ) { return result; } //No relationship from source to target, should we check for target to source? if( bBidirectional ) { //There is a relationship, return value. if( to->GetRelationshipToClassification( sourceClassId, result ) ) { return result; } } if( to->m_bHasDefaultTargetRelationship ) { return to->m_DefaultTargetRelationship; } //No explicit relationship, return default. return from->m_DefaultSourceRelationship; } Relationship CEntityClassificationsManager::GetRelationshipBetween( const std::string& sourceClassName, const std::string& targetClassName, bool bBidirectional ) const { auto sourceId = GetClassificationId( sourceClassName ); auto targetId = GetClassificationId( targetClassName ); if( !IsClassIdValid( sourceId ) || !IsClassIdValid( targetId ) ) { Alert( at_error, "CEntityClassificationsManager::GetRelationshipBetween: One or both classifications (\"%s\" and \"%s\") are nonexistent\n", sourceClassName.c_str(), targetClassName.c_str() ); return R_NO; } return GetRelationshipBetween( sourceId, targetId, bBidirectional ); } const std::string& CEntityClassificationsManager::GetClassificationName( EntityClassification_t classification ) const { if( !IsClassIdValid( classification ) ) return EMPTY_STRING; return m_ClassList[ IdToIndex( classification ) ]->m_szName; } void CEntityClassificationsManager::WriteToFile( const char* pszFilename ) const { ASSERT( pszFilename ); FILE* pFile = fopen( pszFilename, "w" ); if( !pFile ) { Alert( at_error, "CEntityClassificationsManager::WriteToFile: Couldn't open file \"%s\" for writing!\n", pszFilename ); return; } size_t uiClassCount = 0; //Calculate the longest classification name so we can align everything. size_t uiLongest = 0; for( const auto& classification : m_ClassList ) { if( !classification ) continue; ++uiClassCount; const auto uiLength = classification->m_szName.length(); if( uiLength > uiLongest ) uiLongest = uiLength; } if( LONGEST_RELATIONSHIP_PRETTY_STRING > uiLongest ) uiLongest = LONGEST_RELATIONSHIP_PRETTY_STRING; fprintf( pFile, "%u classifications\n", static_cast<unsigned int>( uiClassCount ) ); //Offset to match the first value in the matrix. fprintf( pFile, "%-*s ", static_cast<int>( uiLongest ), "" ); //Write the headers. for( const auto& classification : m_ClassList ) { if( !classification ) continue; //Align the headers so the pretty strings fit inside them. fprintf( pFile, "%-*s ", static_cast<int>( max( classification->m_szName.length(), LONGEST_RELATIONSHIP_PRETTY_STRING ) ), classification->m_szName.c_str() ); } fprintf( pFile, "\n" ); //Write the matrix of classification relationships. for( const auto& classification : m_ClassList ) { if( !classification ) continue; fprintf( pFile, "%-*s ", static_cast<int>( uiLongest ), classification->m_szName.c_str() ); for( const auto& class2 : m_ClassList ) { if( !class2 ) continue; Relationship relationship; if( !classification->GetRelationshipToClassification( class2->m_ClassId, relationship ) ) { if( class2->m_bHasDefaultTargetRelationship ) { relationship = classification->m_DefaultTargetRelationship; } else { relationship = classification->m_DefaultSourceRelationship; } } //Align with header. fprintf( pFile, "%-*s ", static_cast<int>( max( class2->m_szName.length(), LONGEST_RELATIONSHIP_PRETTY_STRING ) ), RelationshipToPrettyString( relationship ) ); } fprintf( pFile, "\n" ); } size_t uiNumAliases = 0; for( const auto& classification : m_ClassMap ) { if( classification.second.second ) ++uiNumAliases; } fprintf( pFile, "\n%u aliases\n", static_cast<unsigned int>( uiNumAliases ) ); for( const auto& classification : m_ClassMap ) { if( classification.second.second ) { fprintf( pFile, "%s->%s\n", classification.first.c_str(), m_ClassList[ classification.second.first ]->m_szName.c_str() ); } } fclose( pFile ); Alert( at_console, "Written entity classifications to file \"%s\"\n", pszFilename ); } size_t CEntityClassificationsManager::IdToIndex( EntityClassification_t classId ) { return classId - FIRST_ID_OFFSET; } EntityClassification_t CEntityClassificationsManager::IndexToId( size_t index ) { return index + FIRST_ID_OFFSET; }
29.470588
190
0.739345
xalalau
20ba2f04decb2e79b9054982b3c3ac7cad79d59e
1,631
hh
C++
include/io/rest.hh
king1600/Valk
b376a0dcce522ae03ced7d882835e4dea98df86e
[ "MIT" ]
null
null
null
include/io/rest.hh
king1600/Valk
b376a0dcce522ae03ced7d882835e4dea98df86e
[ "MIT" ]
null
null
null
include/io/rest.hh
king1600/Valk
b376a0dcce522ae03ced7d882835e4dea98df86e
[ "MIT" ]
null
null
null
#pragma once #include "http.hh" namespace io { using RestCallback = std::function<void(const json&)>; static const json JSON_EMPTY = json::parse("{}"); static const RestCallback CB_NONE = [](const json& j){}; class RestRequest { public: json data; std::string method; std::string endpoint; RestCallback callback; }; class RestRoute { private: bool limited; std::deque<RestRequest> queued; public: RestRoute(); void setLimited(bool state); const bool isLimited() const; const bool hasPending() const; void getPending(RestRequest &req); const std::size_t hasLeft() const; void addPending(const RestRequest &req); }; class RestClient { private: Service& service; std::string token; HttpParser parser; RestRoute globalRoute; std::deque<std::string> writes; std::vector<std::string> cookies; std::shared_ptr<SSLClient> client; std::map<std::string, RestRoute> routes; void _connect(); void pushRequest(const std::string &data); public: RestClient(Service &loop); void SetToken(const std::string &token); void Request(const std::string& method, const std::string &endpoint, const json &data = JSON_EMPTY, const RestCallback &cb = CB_NONE); void get(const std::string& endpoint, const json &data=JSON_EMPTY, const RestCallback &cb = CB_NONE); void post(const std::string& endpoint, const json &data=JSON_EMPTY, const RestCallback &cb = CB_NONE); void del(const std::string& endpoint, const json &data=JSON_EMPTY, const RestCallback &cb = CB_NONE); }; }
25.092308
72
0.669528
king1600
20ba5330cab4477274432ce6129c724719399f12
922
hpp
C++
plugins/help_mongo/include/help_mongo/help_mongo.hpp
myappbase/myappbase
5a405ca0c1411da48ee755874b11dfb4ee625155
[ "MIT" ]
null
null
null
plugins/help_mongo/include/help_mongo/help_mongo.hpp
myappbase/myappbase
5a405ca0c1411da48ee755874b11dfb4ee625155
[ "MIT" ]
null
null
null
plugins/help_mongo/include/help_mongo/help_mongo.hpp
myappbase/myappbase
5a405ca0c1411da48ee755874b11dfb4ee625155
[ "MIT" ]
null
null
null
/** * @file * @copyright defined in myappbase/LICENSE */ #pragma once #include <string> #include <bsoncxx/builder/basic/kvp.hpp> #include <bsoncxx/builder/basic/document.hpp> #include <bsoncxx/builder/stream/document.hpp> #include <bsoncxx/exception/exception.hpp> #include <bsoncxx/json.hpp> #include <mongocxx/client.hpp> #include <mongocxx/instance.hpp> #include <mongocxx/pool.hpp> #include <mongocxx/exception/operation_exception.hpp> #include <mongocxx/exception/logic_error.hpp> #include <help_mongo/bson.hpp> namespace my { namespace help_mongo { bsoncxx::oid make_custom_oid(); uint32_t get_last_block(mongocxx::collection &); std::vector<bsoncxx::document::view> get_objects( mongocxx::collection &col, const uint32_t); void handle_mongo_exception(const std::string &desc, int line_num); } // namespace help_mongo } // namespace my
27.117647
75
0.712581
myappbase
20baf3805dca450bd4450c313df25c6688db4669
1,324
hh
C++
XRADGUI/Sources/RasterImageFile/RasterImageFile.hh
n-kulberg/xrad
3d089cc24d942db4649f1a50defbd69f01739ae2
[ "BSD-3-Clause" ]
1
2021-04-02T16:47:00.000Z
2021-04-02T16:47:00.000Z
XRADGUI/Sources/RasterImageFile/RasterImageFile.hh
n-kulberg/xrad
3d089cc24d942db4649f1a50defbd69f01739ae2
[ "BSD-3-Clause" ]
null
null
null
XRADGUI/Sources/RasterImageFile/RasterImageFile.hh
n-kulberg/xrad
3d089cc24d942db4649f1a50defbd69f01739ae2
[ "BSD-3-Clause" ]
3
2021-08-30T11:26:23.000Z
2021-09-23T09:39:56.000Z
 #ifndef __RasterImageFile_hh //#error This file must be included from "RasterImageFile.h" only #endif XRAD_BEGIN template<class RGB_IMAGE_T> RGB_IMAGE_T RasterImageFile::rgb() { using value_type = typename RGB_IMAGE_T::value_type; ColorImageF64 buffer = rgb_internal(); double scalefactor = scalefactor_calculator<value_type>::get(m_bits_per_channel); RGB_IMAGE_T result; MakeCopy(result, buffer, [scalefactor](value_type &y, const auto &x){return y = x*scalefactor;}); return result; } template <typename IMAGE_T> IMAGE_T RasterImageFile::channel(color_channel in_channel) { using value_type = typename IMAGE_T::value_type; RealFunction2D_F64 buffer = channel_internal(in_channel); double scalefactor, offset; if(in_channel == color_channel::hue) { XRAD_ASSERT_THROW_M(numeric_limits<value_type>::max() > 360, invalid_argument, ssprintf("datatype is to small for hue")); scalefactor = 180.; offset = -1.; } else { scalefactor = value_scalefactor_calculator<value_type>::get(m_bits_per_channel); offset = 0.; } IMAGE_T result; result.MakeCopy(buffer, [scalefactor, offset](value_type &y, const auto &x){return y = (x-offset)*scalefactor;}); return result; } template <typename IMAGE_T> IMAGE_T RasterImageFile::lightness() { return channel(color_channel::lightness); } XRAD_END
24.072727
123
0.762085
n-kulberg
20bb811d1aae729460f3e6f60b4cf4d83f0c03e6
742
cpp
C++
docs/mfc/codesnippet/CPP/mfc-activex-controls-creating-an-automation-server_2.cpp
jmittert/cpp-docs
cea5a8ee2b4764b2bac4afe5d386362ffd64e55a
[ "CC-BY-4.0", "MIT" ]
14
2018-01-28T18:10:55.000Z
2021-11-16T13:21:18.000Z
docs/mfc/codesnippet/CPP/mfc-activex-controls-creating-an-automation-server_2.cpp
jmittert/cpp-docs
cea5a8ee2b4764b2bac4afe5d386362ffd64e55a
[ "CC-BY-4.0", "MIT" ]
1
2021-04-01T04:17:07.000Z
2021-04-01T04:17:07.000Z
docs/mfc/codesnippet/CPP/mfc-activex-controls-creating-an-automation-server_2.cpp
jmittert/cpp-docs
cea5a8ee2b4764b2bac4afe5d386362ffd64e55a
[ "CC-BY-4.0", "MIT" ]
2
2018-11-01T12:33:08.000Z
2021-11-16T13:21:19.000Z
void CCircDlg::OnOK() { UpdateData(); // Get the current data from the dialog box. CCirc2 circ; // Create a wrapper class for the ActiveX object. COleException e; // In case of errors // Create the ActiveX object. // The name is the control's progid; look it up using OleView if (circ.CreateDispatch(_T("CIRC.CircCtrl.1"), &e)) { // get the Caption property of your ActiveX object // get the result into m_strCaption m_strCaption = circ.GetCaption(); UpdateData(FALSE); // Display the string in the dialog box. } else { // An error TCHAR buf[255]; e.GetErrorMessage(buf, sizeof(buf) / sizeof(TCHAR)); AfxMessageBox(buf); // Display the error message. } }
35.333333
68
0.642857
jmittert
20c051b1a532c68c0f76f2ca0f302595f86136cf
1,425
cpp
C++
tests/external/libcxx/array/compare.pass.cpp
GlitterIsMe/libpmemobj-cpp
71c614ca4c8bb769cf8bb01550acc1ca1c76d6bc
[ "BSD-3-Clause" ]
1
2018-11-06T13:09:12.000Z
2018-11-06T13:09:12.000Z
tests/external/libcxx/array/compare.pass.cpp
GlitterIsMe/libpmemobj-cpp
71c614ca4c8bb769cf8bb01550acc1ca1c76d6bc
[ "BSD-3-Clause" ]
null
null
null
tests/external/libcxx/array/compare.pass.cpp
GlitterIsMe/libpmemobj-cpp
71c614ca4c8bb769cf8bb01550acc1ca1c76d6bc
[ "BSD-3-Clause" ]
null
null
null
//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // Copyright 2018, Intel Corporation // // Modified to test pmem::obj containers // #include "unittest.hpp" #include <libpmemobj++/experimental/array.hpp> #include <vector> namespace pmem_exp = pmem::obj::experimental; template <class Array> void test_compare(const Array &LHS, const Array &RHS) { typedef std::vector<typename Array::value_type> Vector; const Vector LHSV(LHS.begin(), LHS.end()); const Vector RHSV(RHS.begin(), RHS.end()); UT_ASSERT((LHS == RHS) == (LHSV == RHSV)); UT_ASSERT((LHS != RHS) == (LHSV != RHSV)); UT_ASSERT((LHS < RHS) == (LHSV < RHSV)); UT_ASSERT((LHS <= RHS) == (LHSV <= RHSV)); UT_ASSERT((LHS > RHS) == (LHSV > RHSV)); UT_ASSERT((LHS >= RHS) == (LHSV >= RHSV)); } int main() { START(); { typedef int T; typedef pmem_exp::array<T, 3> C; C c1 = {1, 2, 3}; C c2 = {1, 2, 3}; C c3 = {3, 2, 1}; C c4 = {1, 2, 1}; test_compare(c1, c2); test_compare(c1, c3); test_compare(c1, c4); } { typedef int T; typedef pmem_exp::array<T, 0> C; C c1 = {}; C c2 = {}; test_compare(c1, c2); } return 0; }
22.619048
80
0.54386
GlitterIsMe
20c3629dd29990b7bdb2273bbc8cef74b2040ff3
289,875
cpp
C++
Development/SDKs/1.7.1/SDK/AIModule_functions.cpp
ResaloliPT/HydroneerReleases
3a3501f04608cea77ccbf7229f94089295128ea7
[ "Unlicense" ]
null
null
null
Development/SDKs/1.7.1/SDK/AIModule_functions.cpp
ResaloliPT/HydroneerReleases
3a3501f04608cea77ccbf7229f94089295128ea7
[ "Unlicense" ]
null
null
null
Development/SDKs/1.7.1/SDK/AIModule_functions.cpp
ResaloliPT/HydroneerReleases
3a3501f04608cea77ccbf7229f94089295128ea7
[ "Unlicense" ]
null
null
null
// Name: Hydroneer, Version: 1.7.1 #include "../pch.h" /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Functions //--------------------------------------------------------------------------- void FAIRequestID::AfterRead() { } void FAIRequestID::BeforeDelete() { } void FAIStimulus::AfterRead() { } void FAIStimulus::BeforeDelete() { } void FActorPerceptionBlueprintInfo::AfterRead() { READ_PTR_FULL(Target, AActor); } void FActorPerceptionBlueprintInfo::BeforeDelete() { DELE_PTR_FULL(Target); } void FAIDamageEvent::AfterRead() { READ_PTR_FULL(DamagedActor, AActor); READ_PTR_FULL(Instigator, AActor); } void FAIDamageEvent::BeforeDelete() { DELE_PTR_FULL(DamagedActor); DELE_PTR_FULL(Instigator); } void FEnvOverlapData::AfterRead() { } void FEnvOverlapData::BeforeDelete() { } void FPawnActionStack::AfterRead() { READ_PTR_FULL(TopAction, UPawnAction); } void FPawnActionStack::BeforeDelete() { DELE_PTR_FULL(TopAction); } void FPawnActionEvent::AfterRead() { READ_PTR_FULL(Action, UPawnAction); } void FPawnActionEvent::BeforeDelete() { DELE_PTR_FULL(Action); } void FAIDataProviderValue::AfterRead() { READ_PTR_FULL(CachedProperty, UProperty); READ_PTR_FULL(DataBinding, UAIDataProvider); } void FAIDataProviderValue::BeforeDelete() { DELE_PTR_FULL(CachedProperty); DELE_PTR_FULL(DataBinding); } void FAIDataProviderStructValue::AfterRead() { FAIDataProviderValue::AfterRead(); } void FAIDataProviderStructValue::BeforeDelete() { FAIDataProviderValue::BeforeDelete(); } void FAISightEvent::AfterRead() { READ_PTR_FULL(SeenActor, AActor); READ_PTR_FULL(Observer, AActor); } void FAISightEvent::BeforeDelete() { DELE_PTR_FULL(SeenActor); DELE_PTR_FULL(Observer); } void FEnvQueryRequest::AfterRead() { READ_PTR_FULL(QueryTemplate, UEnvQuery); READ_PTR_FULL(Owner, UObject); READ_PTR_FULL(World, UWorld); } void FEnvQueryRequest::BeforeDelete() { DELE_PTR_FULL(QueryTemplate); DELE_PTR_FULL(Owner); DELE_PTR_FULL(World); } void FEnvQueryResult::AfterRead() { READ_PTR_FULL(itemType, UClass); } void FEnvQueryResult::BeforeDelete() { DELE_PTR_FULL(itemType); } void FGenericTeamId::AfterRead() { } void FGenericTeamId::BeforeDelete() { } void FAINoiseEvent::AfterRead() { READ_PTR_FULL(Instigator, AActor); } void FAINoiseEvent::BeforeDelete() { DELE_PTR_FULL(Instigator); } void FAIPredictionEvent::AfterRead() { READ_PTR_FULL(Requestor, AActor); READ_PTR_FULL(PredictedActor, AActor); } void FAIPredictionEvent::BeforeDelete() { DELE_PTR_FULL(Requestor); DELE_PTR_FULL(PredictedActor); } void FAITeamStimulusEvent::AfterRead() { READ_PTR_FULL(Broadcaster, AActor); READ_PTR_FULL(Enemy, AActor); } void FAITeamStimulusEvent::BeforeDelete() { DELE_PTR_FULL(Broadcaster); DELE_PTR_FULL(Enemy); } void FAITouchEvent::AfterRead() { READ_PTR_FULL(TouchReceiver, AActor); READ_PTR_FULL(OtherActor, AActor); } void FAITouchEvent::BeforeDelete() { DELE_PTR_FULL(TouchReceiver); DELE_PTR_FULL(OtherActor); } void FAISenseAffiliationFilter::AfterRead() { } void FAISenseAffiliationFilter::BeforeDelete() { } void FAIMoveRequest::AfterRead() { READ_PTR_FULL(GoalActor, AActor); } void FAIMoveRequest::BeforeDelete() { DELE_PTR_FULL(GoalActor); } void FBTDecoratorLogic::AfterRead() { } void FBTDecoratorLogic::BeforeDelete() { } void FBehaviorTreeTemplateInfo::AfterRead() { READ_PTR_FULL(Asset, UBehaviorTree); READ_PTR_FULL(Template, UBTCompositeNode); } void FBehaviorTreeTemplateInfo::BeforeDelete() { DELE_PTR_FULL(Asset); DELE_PTR_FULL(Template); } void FBlackboardEntry::AfterRead() { READ_PTR_FULL(KeyType, UBlackboardKeyType); } void FBlackboardEntry::BeforeDelete() { DELE_PTR_FULL(KeyType); } void FBTCompositeChild::AfterRead() { READ_PTR_FULL(ChildComposite, UBTCompositeNode); READ_PTR_FULL(ChildTask, UBTTaskNode); } void FBTCompositeChild::BeforeDelete() { DELE_PTR_FULL(ChildComposite); DELE_PTR_FULL(ChildTask); } void FBlackboardKeySelector::AfterRead() { READ_PTR_FULL(SelectedKeyType, UClass); } void FBlackboardKeySelector::BeforeDelete() { DELE_PTR_FULL(SelectedKeyType); } void FAIDataProviderTypedValue::AfterRead() { FAIDataProviderValue::AfterRead(); READ_PTR_FULL(PropertyType, UClass); } void FAIDataProviderTypedValue::BeforeDelete() { FAIDataProviderValue::BeforeDelete(); DELE_PTR_FULL(PropertyType); } void FAIDataProviderFloatValue::AfterRead() { FAIDataProviderTypedValue::AfterRead(); } void FAIDataProviderFloatValue::BeforeDelete() { FAIDataProviderTypedValue::BeforeDelete(); } void FAIDynamicParam::AfterRead() { } void FAIDynamicParam::BeforeDelete() { } void FEQSParametrizedQueryExecutionRequest::AfterRead() { READ_PTR_FULL(QueryTemplate, UEnvQuery); } void FEQSParametrizedQueryExecutionRequest::BeforeDelete() { DELE_PTR_FULL(QueryTemplate); } void FEnvNamedValue::AfterRead() { } void FEnvNamedValue::BeforeDelete() { } void FCrowdAvoidanceConfig::AfterRead() { } void FCrowdAvoidanceConfig::BeforeDelete() { } void FCrowdAvoidanceSamplingPattern::AfterRead() { } void FCrowdAvoidanceSamplingPattern::BeforeDelete() { } void FAIDataProviderBoolValue::AfterRead() { FAIDataProviderTypedValue::AfterRead(); } void FAIDataProviderBoolValue::BeforeDelete() { FAIDataProviderTypedValue::BeforeDelete(); } void FEnvTraceData::AfterRead() { READ_PTR_FULL(NavigationFilter, UClass); } void FEnvTraceData::BeforeDelete() { DELE_PTR_FULL(NavigationFilter); } void FAIDataProviderIntValue::AfterRead() { FAIDataProviderTypedValue::AfterRead(); } void FAIDataProviderIntValue::BeforeDelete() { FAIDataProviderTypedValue::BeforeDelete(); } void FEnvDirection::AfterRead() { READ_PTR_FULL(LineFrom, UClass); READ_PTR_FULL(LineTo, UClass); READ_PTR_FULL(Rotation, UClass); } void FEnvDirection::BeforeDelete() { DELE_PTR_FULL(LineFrom); DELE_PTR_FULL(LineTo); DELE_PTR_FULL(Rotation); } void FEnvQueryInstanceCache::AfterRead() { READ_PTR_FULL(Template, UEnvQuery); } void FEnvQueryInstanceCache::BeforeDelete() { DELE_PTR_FULL(Template); } // Function: // Offset -> 0x01F644B0 // Name -> Function AIModule.AIAsyncTaskBlueprintProxy.OnMoveCompleted // Flags -> (Final, Native, Public) // Parameters: // struct FAIRequestID RequestID (Parm, NoDestructor, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EPathFollowingResult> MovementResult (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIAsyncTaskBlueprintProxy::OnMoveCompleted(const struct FAIRequestID& RequestID, TEnumAsByte<AIModule_EPathFollowingResult> MovementResult) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIAsyncTaskBlueprintProxy.OnMoveCompleted"); UAIAsyncTaskBlueprintProxy_OnMoveCompleted_Params params {}; params.RequestID = RequestID; params.MovementResult = MovementResult; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UAIAsyncTaskBlueprintProxy::AfterRead() { UObject::AfterRead(); } void UAIAsyncTaskBlueprintProxy::BeforeDelete() { UObject::BeforeDelete(); } // Function: // Offset -> 0x01F65140 // Name -> Function AIModule.AIBlueprintHelperLibrary.UnlockAIResourcesWithAnimation // Flags -> (Final, BlueprintAuthorityOnly, Native, Static, Public, BlueprintCallable) // Parameters: // class UAnimInstance* AnimInstance (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bUnlockMovement (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool UnlockAILogic (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIBlueprintHelperLibrary::STATIC_UnlockAIResourcesWithAnimation(class UAnimInstance* AnimInstance, bool bUnlockMovement, bool UnlockAILogic) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.UnlockAIResourcesWithAnimation"); UAIBlueprintHelperLibrary_UnlockAIResourcesWithAnimation_Params params {}; params.AnimInstance = AnimInstance; params.bUnlockMovement = bUnlockMovement; params.UnlockAILogic = UnlockAILogic; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F64EF0 // Name -> Function AIModule.AIBlueprintHelperLibrary.SpawnAIFromClass // Flags -> (Final, Native, Static, Public, HasDefaults, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UClass* PawnClass (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UBehaviorTree* BehaviorTree (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector Location (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FRotator Rotation (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, NativeAccessSpecifierPublic) // bool bNoCollisionFail (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class APawn* UAIBlueprintHelperLibrary::STATIC_SpawnAIFromClass(class UObject* WorldContextObject, class UClass* PawnClass, class UBehaviorTree* BehaviorTree, const struct FVector& Location, const struct FRotator& Rotation, bool bNoCollisionFail) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.SpawnAIFromClass"); UAIBlueprintHelperLibrary_SpawnAIFromClass_Params params {}; params.WorldContextObject = WorldContextObject; params.PawnClass = PawnClass; params.BehaviorTree = BehaviorTree; params.Location = Location; params.Rotation = Rotation; params.bNoCollisionFail = bNoCollisionFail; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F64E30 // Name -> Function AIModule.AIBlueprintHelperLibrary.SimpleMoveToLocation // Flags -> (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable) // Parameters: // class AController* Controller (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector Goal (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIBlueprintHelperLibrary::STATIC_SimpleMoveToLocation(class AController* Controller, const struct FVector& Goal) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.SimpleMoveToLocation"); UAIBlueprintHelperLibrary_SimpleMoveToLocation_Params params {}; params.Controller = Controller; params.Goal = Goal; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F64D80 // Name -> Function AIModule.AIBlueprintHelperLibrary.SimpleMoveToActor // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class AController* Controller (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* Goal (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIBlueprintHelperLibrary::STATIC_SimpleMoveToActor(class AController* Controller, class AActor* Goal) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.SimpleMoveToActor"); UAIBlueprintHelperLibrary_SimpleMoveToActor_Params params {}; params.Controller = Controller; params.Goal = Goal; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F64A70 // Name -> Function AIModule.AIBlueprintHelperLibrary.SendAIMessage // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class APawn* Target (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FName Message (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UObject* MessageSource (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bSuccess (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIBlueprintHelperLibrary::STATIC_SendAIMessage(class APawn* Target, const struct FName& Message, class UObject* MessageSource, bool bSuccess) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.SendAIMessage"); UAIBlueprintHelperLibrary_SendAIMessage_Params params {}; params.Target = Target; params.Message = Message; params.MessageSource = MessageSource; params.bSuccess = bSuccess; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F63E40 // Name -> Function AIModule.AIBlueprintHelperLibrary.LockAIResourcesWithAnimation // Flags -> (Final, BlueprintAuthorityOnly, Native, Static, Public, BlueprintCallable) // Parameters: // class UAnimInstance* AnimInstance (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bLockMovement (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool LockAILogic (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIBlueprintHelperLibrary::STATIC_LockAIResourcesWithAnimation(class UAnimInstance* AnimInstance, bool bLockMovement, bool LockAILogic) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.LockAIResourcesWithAnimation"); UAIBlueprintHelperLibrary_LockAIResourcesWithAnimation_Params params {}; params.AnimInstance = AnimInstance; params.bLockMovement = bLockMovement; params.LockAILogic = LockAILogic; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F63C80 // Name -> Function AIModule.AIBlueprintHelperLibrary.IsValidAIRotation // Flags -> (Final, Native, Static, Public, HasDefaults, BlueprintCallable, BlueprintPure) // Parameters: // struct FRotator Rotation (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UAIBlueprintHelperLibrary::STATIC_IsValidAIRotation(const struct FRotator& Rotation) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.IsValidAIRotation"); UAIBlueprintHelperLibrary_IsValidAIRotation_Params params {}; params.Rotation = Rotation; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F63BF0 // Name -> Function AIModule.AIBlueprintHelperLibrary.IsValidAILocation // Flags -> (Final, Native, Static, Public, HasDefaults, BlueprintCallable, BlueprintPure) // Parameters: // struct FVector Location (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UAIBlueprintHelperLibrary::STATIC_IsValidAILocation(const struct FVector& Location) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.IsValidAILocation"); UAIBlueprintHelperLibrary_IsValidAILocation_Params params {}; params.Location = Location; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F63B60 // Name -> Function AIModule.AIBlueprintHelperLibrary.IsValidAIDirection // Flags -> (Final, Native, Static, Public, HasDefaults, BlueprintCallable, BlueprintPure) // Parameters: // struct FVector DirectionVector (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UAIBlueprintHelperLibrary::STATIC_IsValidAIDirection(const struct FVector& DirectionVector) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.IsValidAIDirection"); UAIBlueprintHelperLibrary_IsValidAIDirection_Params params {}; params.DirectionVector = DirectionVector; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F63450 // Name -> Function AIModule.AIBlueprintHelperLibrary.GetCurrentPath // Flags -> (Final, Native, Static, Public, BlueprintCallable, BlueprintPure) // Parameters: // class AController* Controller (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UNavigationPath* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UNavigationPath* UAIBlueprintHelperLibrary::STATIC_GetCurrentPath(class AController* Controller) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.GetCurrentPath"); UAIBlueprintHelperLibrary_GetCurrentPath_Params params {}; params.Controller = Controller; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F633D0 // Name -> Function AIModule.AIBlueprintHelperLibrary.GetBlackboard // Flags -> (Final, Native, Static, Public, BlueprintCallable, BlueprintPure) // Parameters: // class AActor* Target (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UBlackboardComponent* ReturnValue (ExportObject, Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UBlackboardComponent* UAIBlueprintHelperLibrary::STATIC_GetBlackboard(class AActor* Target) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.GetBlackboard"); UAIBlueprintHelperLibrary_GetBlackboard_Params params {}; params.Target = Target; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F63230 // Name -> Function AIModule.AIBlueprintHelperLibrary.GetAIController // Flags -> (Final, Native, Static, Public, BlueprintCallable, BlueprintPure) // Parameters: // class AActor* ControlledActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AAIController* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class AAIController* UAIBlueprintHelperLibrary::STATIC_GetAIController(class AActor* ControlledActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.GetAIController"); UAIBlueprintHelperLibrary_GetAIController_Params params {}; params.ControlledActor = ControlledActor; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F63070 // Name -> Function AIModule.AIBlueprintHelperLibrary.CreateMoveToProxyObject // Flags -> (Final, Native, Static, Public, HasDefaults, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* Pawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector Destination (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* TargetActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float AcceptanceRadius (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bStopOnOverlap (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UAIAsyncTaskBlueprintProxy* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UAIAsyncTaskBlueprintProxy* UAIBlueprintHelperLibrary::STATIC_CreateMoveToProxyObject(class UObject* WorldContextObject, class APawn* Pawn, const struct FVector& Destination, class AActor* TargetActor, float AcceptanceRadius, bool bStopOnOverlap) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIBlueprintHelperLibrary.CreateMoveToProxyObject"); UAIBlueprintHelperLibrary_CreateMoveToProxyObject_Params params {}; params.WorldContextObject = WorldContextObject; params.Pawn = Pawn; params.Destination = Destination; params.TargetActor = TargetActor; params.AcceptanceRadius = AcceptanceRadius; params.bStopOnOverlap = bStopOnOverlap; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UAIBlueprintHelperLibrary::AfterRead() { UBlueprintFunctionLibrary::AfterRead(); } void UAIBlueprintHelperLibrary::BeforeDelete() { UBlueprintFunctionLibrary::BeforeDelete(); } // Function: // Offset -> 0x01F652F0 // Name -> Function AIModule.AIController.UseBlackboard // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable) // Parameters: // class UBlackboardData* BlackboardAsset (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UBlackboardComponent* BlackboardComponent (Parm, OutParm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool AAIController::UseBlackboard(class UBlackboardData* BlackboardAsset, class UBlackboardComponent** BlackboardComponent) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.UseBlackboard"); AAIController_UseBlackboard_Params params {}; params.BlackboardAsset = BlackboardAsset; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (BlackboardComponent != nullptr) *BlackboardComponent = params.BlackboardComponent; return params.ReturnValue; } // Function: // Offset -> 0x01F650C0 // Name -> Function AIModule.AIController.UnclaimTaskResource // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class UClass* ResourceClass (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) void AAIController::UnclaimTaskResource(class UClass* ResourceClass) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.UnclaimTaskResource"); AAIController_UnclaimTaskResource_Params params {}; params.ResourceClass = ResourceClass; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F64C30 // Name -> Function AIModule.AIController.SetPathFollowingComponent // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class UPathFollowingComponent* NewPFComponent (Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void AAIController::SetPathFollowingComponent(class UPathFollowingComponent* NewPFComponent) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.SetPathFollowingComponent"); AAIController_SetPathFollowingComponent_Params params {}; params.NewPFComponent = NewPFComponent; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F64BA0 // Name -> Function AIModule.AIController.SetMoveBlockDetection // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // bool bEnable (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void AAIController::SetMoveBlockDetection(bool bEnable) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.SetMoveBlockDetection"); AAIController_SetMoveBlockDetection_Params params {}; params.bEnable = bEnable; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F649D0 // Name -> Function AIModule.AIController.RunBehaviorTree // Flags -> (Native, Public, BlueprintCallable) // Parameters: // class UBehaviorTree* BTAsset (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool AAIController::RunBehaviorTree(class UBehaviorTree* BTAsset) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.RunBehaviorTree"); AAIController_RunBehaviorTree_Params params {}; params.BTAsset = BTAsset; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.AIController.OnUsingBlackBoard // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class UBlackboardComponent* BlackboardComp (Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UBlackboardData* BlackboardAsset (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void AAIController::OnUsingBlackBoard(class UBlackboardComponent* BlackboardComp, class UBlackboardData* BlackboardAsset) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.OnUsingBlackBoard"); AAIController_OnUsingBlackBoard_Params params {}; params.BlackboardComp = BlackboardComp; params.BlackboardAsset = BlackboardAsset; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F643E0 // Name -> Function AIModule.AIController.OnGameplayTaskResourcesClaimed // Flags -> (Native, Public) // Parameters: // struct FGameplayResourceSet NewlyClaimed (Parm, NoDestructor, NativeAccessSpecifierPublic) // struct FGameplayResourceSet FreshlyReleased (Parm, NoDestructor, NativeAccessSpecifierPublic) void AAIController::OnGameplayTaskResourcesClaimed(const struct FGameplayResourceSet& NewlyClaimed, const struct FGameplayResourceSet& FreshlyReleased) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.OnGameplayTaskResourcesClaimed"); AAIController_OnGameplayTaskResourcesClaimed_Params params {}; params.NewlyClaimed = NewlyClaimed; params.FreshlyReleased = FreshlyReleased; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F64170 // Name -> Function AIModule.AIController.MoveToLocation // Flags -> (Final, Native, Public, HasOutParms, HasDefaults, BlueprintCallable) // Parameters: // struct FVector Dest (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float AcceptanceRadius (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bStopOnOverlap (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bUsePathfinding (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bProjectDestinationToNavigation (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bCanStrafe (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UClass* FilterClass (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bAllowPartialPath (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EPathFollowingRequestResult> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) TEnumAsByte<AIModule_EPathFollowingRequestResult> AAIController::MoveToLocation(const struct FVector& Dest, float AcceptanceRadius, bool bStopOnOverlap, bool bUsePathfinding, bool bProjectDestinationToNavigation, bool bCanStrafe, class UClass* FilterClass, bool bAllowPartialPath) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.MoveToLocation"); AAIController_MoveToLocation_Params params {}; params.Dest = Dest; params.AcceptanceRadius = AcceptanceRadius; params.bStopOnOverlap = bStopOnOverlap; params.bUsePathfinding = bUsePathfinding; params.bProjectDestinationToNavigation = bProjectDestinationToNavigation; params.bCanStrafe = bCanStrafe; params.FilterClass = FilterClass; params.bAllowPartialPath = bAllowPartialPath; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F63F50 // Name -> Function AIModule.AIController.MoveToActor // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class AActor* Goal (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float AcceptanceRadius (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bStopOnOverlap (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bUsePathfinding (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bCanStrafe (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UClass* FilterClass (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bAllowPartialPath (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EPathFollowingRequestResult> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) TEnumAsByte<AIModule_EPathFollowingRequestResult> AAIController::MoveToActor(class AActor* Goal, float AcceptanceRadius, bool bStopOnOverlap, bool bUsePathfinding, bool bCanStrafe, class UClass* FilterClass, bool bAllowPartialPath) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.MoveToActor"); AAIController_MoveToActor_Params params {}; params.Goal = Goal; params.AcceptanceRadius = AcceptanceRadius; params.bStopOnOverlap = bStopOnOverlap; params.bUsePathfinding = bUsePathfinding; params.bCanStrafe = bCanStrafe; params.FilterClass = FilterClass; params.bAllowPartialPath = bAllowPartialPath; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F63DC0 // Name -> Function AIModule.AIController.K2_SetFocus // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class AActor* NewFocus (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void AAIController::K2_SetFocus(class AActor* NewFocus) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.K2_SetFocus"); AAIController_K2_SetFocus_Params params {}; params.NewFocus = NewFocus; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F63D30 // Name -> Function AIModule.AIController.K2_SetFocalPoint // Flags -> (Final, Native, Public, HasDefaults, BlueprintCallable) // Parameters: // struct FVector FP (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void AAIController::K2_SetFocalPoint(const struct FVector& FP) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.K2_SetFocalPoint"); AAIController_K2_SetFocalPoint_Params params {}; params.FP = FP; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F63D10 // Name -> Function AIModule.AIController.K2_ClearFocus // Flags -> (Final, Native, Public, BlueprintCallable) void AAIController::K2_ClearFocus() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.K2_ClearFocus"); AAIController_K2_ClearFocus_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F63B30 // Name -> Function AIModule.AIController.HasPartialPath // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool AAIController::HasPartialPath() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.HasPartialPath"); AAIController_HasPartialPath_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F63840 // Name -> Function AIModule.AIController.GetPathFollowingComponent // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // class UPathFollowingComponent* ReturnValue (ExportObject, Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UPathFollowingComponent* AAIController::GetPathFollowingComponent() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.GetPathFollowingComponent"); AAIController_GetPathFollowingComponent_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F63810 // Name -> Function AIModule.AIController.GetMoveStatus // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // TEnumAsByte<AIModule_EPathFollowingStatus> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) TEnumAsByte<AIModule_EPathFollowingStatus> AAIController::GetMoveStatus() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.GetMoveStatus"); AAIController_GetMoveStatus_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F636E0 // Name -> Function AIModule.AIController.GetImmediateMoveDestination // Flags -> (Final, Native, Public, HasDefaults, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FVector ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) struct FVector AAIController::GetImmediateMoveDestination() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.GetImmediateMoveDestination"); AAIController_GetImmediateMoveDestination_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F636B0 // Name -> Function AIModule.AIController.GetFocusActor // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // class AActor* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class AActor* AAIController::GetFocusActor() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.GetFocusActor"); AAIController_GetFocusActor_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F63600 // Name -> Function AIModule.AIController.GetFocalPointOnActor // Flags -> (Native, Public, HasDefaults, BlueprintCallable, BlueprintPure, Const) // Parameters: // class AActor* Actor (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) struct FVector AAIController::GetFocalPointOnActor(class AActor* Actor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.GetFocalPointOnActor"); AAIController_GetFocalPointOnActor_Params params {}; params.Actor = Actor; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F635C0 // Name -> Function AIModule.AIController.GetFocalPoint // Flags -> (Final, Native, Public, HasDefaults, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FVector ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) struct FVector AAIController::GetFocalPoint() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.GetFocalPoint"); AAIController_GetFocalPoint_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F632B0 // Name -> Function AIModule.AIController.GetAIPerceptionComponent // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure) // Parameters: // class UAIPerceptionComponent* ReturnValue (ExportObject, Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UAIPerceptionComponent* AAIController::GetAIPerceptionComponent() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.GetAIPerceptionComponent"); AAIController_GetAIPerceptionComponent_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F62FF0 // Name -> Function AIModule.AIController.ClaimTaskResource // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class UClass* ResourceClass (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) void AAIController::ClaimTaskResource(class UClass* ResourceClass) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIController.ClaimTaskResource"); AAIController_ClaimTaskResource_Params params {}; params.ResourceClass = ResourceClass; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void AAIController::AfterRead() { AController::AfterRead(); READ_PTR_FULL(PathFollowingComponent, UPathFollowingComponent); READ_PTR_FULL(BrainComponent, UBrainComponent); READ_PTR_FULL(PerceptionComponent, UAIPerceptionComponent); READ_PTR_FULL(ActionsComp, UPawnActionsComponent); READ_PTR_FULL(Blackboard, UBlackboardComponent); READ_PTR_FULL(CachedGameplayTasksComponent, UGameplayTasksComponent); READ_PTR_FULL(DefaultNavigationFilterClass, UClass); } void AAIController::BeforeDelete() { AController::BeforeDelete(); DELE_PTR_FULL(PathFollowingComponent); DELE_PTR_FULL(BrainComponent); DELE_PTR_FULL(PerceptionComponent); DELE_PTR_FULL(ActionsComp); DELE_PTR_FULL(Blackboard); DELE_PTR_FULL(CachedGameplayTasksComponent); DELE_PTR_FULL(DefaultNavigationFilterClass); } void UAIDataProvider::AfterRead() { UObject::AfterRead(); } void UAIDataProvider::BeforeDelete() { UObject::BeforeDelete(); } void UAIDataProvider_QueryParams::AfterRead() { UAIDataProvider::AfterRead(); } void UAIDataProvider_QueryParams::BeforeDelete() { UAIDataProvider::BeforeDelete(); } void UAIDataProvider_Random::AfterRead() { UAIDataProvider_QueryParams::AfterRead(); } void UAIDataProvider_Random::BeforeDelete() { UAIDataProvider_QueryParams::BeforeDelete(); } void UAIHotSpotManager::AfterRead() { UObject::AfterRead(); } void UAIHotSpotManager::BeforeDelete() { UObject::BeforeDelete(); } // Function: // Offset -> 0x01F64CB0 // Name -> Function AIModule.AIPerceptionComponent.SetSenseEnabled // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class UClass* SenseClass (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bEnable (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIPerceptionComponent::SetSenseEnabled(class UClass* SenseClass, bool bEnable) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionComponent.SetSenseEnabled"); UAIPerceptionComponent_SetSenseEnabled_Params params {}; params.SenseClass = SenseClass; params.bEnable = bEnable; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F649B0 // Name -> Function AIModule.AIPerceptionComponent.RequestStimuliListenerUpdate // Flags -> (Final, Native, Public, BlueprintCallable) void UAIPerceptionComponent::RequestStimuliListenerUpdate() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionComponent.RequestStimuliListenerUpdate"); UAIPerceptionComponent_RequestStimuliListenerUpdate_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F64570 // Name -> Function AIModule.AIPerceptionComponent.OnOwnerEndPlay // Flags -> (Final, Native, Public) // Parameters: // class AActor* Actor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<Engine_EEndPlayReason> EndPlayReason (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIPerceptionComponent::OnOwnerEndPlay(class AActor* Actor, TEnumAsByte<Engine_EEndPlayReason> EndPlayReason) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionComponent.OnOwnerEndPlay"); UAIPerceptionComponent_OnOwnerEndPlay_Params params {}; params.Actor = Actor; params.EndPlayReason = EndPlayReason; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F63950 // Name -> Function AIModule.AIPerceptionComponent.GetPerceivedHostileActors // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // TArray<class AActor*> OutActors (Parm, OutParm, ZeroConstructor, NativeAccessSpecifierPublic) void UAIPerceptionComponent::GetPerceivedHostileActors(TArray<class AActor*>* OutActors) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionComponent.GetPerceivedHostileActors"); UAIPerceptionComponent_GetPerceivedHostileActors_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (OutActors != nullptr) *OutActors = params.OutActors; } // Function: // Offset -> 0x01F63860 // Name -> Function AIModule.AIPerceptionComponent.GetPerceivedActors // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // class UClass* SenseToUse (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TArray<class AActor*> OutActors (Parm, OutParm, ZeroConstructor, NativeAccessSpecifierPublic) void UAIPerceptionComponent::GetPerceivedActors(class UClass* SenseToUse, TArray<class AActor*>* OutActors) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionComponent.GetPerceivedActors"); UAIPerceptionComponent_GetPerceivedActors_Params params {}; params.SenseToUse = SenseToUse; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (OutActors != nullptr) *OutActors = params.OutActors; } // Function: // Offset -> 0x01F63720 // Name -> Function AIModule.AIPerceptionComponent.GetKnownPerceivedActors // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // class UClass* SenseToUse (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TArray<class AActor*> OutActors (Parm, OutParm, ZeroConstructor, NativeAccessSpecifierPublic) void UAIPerceptionComponent::GetKnownPerceivedActors(class UClass* SenseToUse, TArray<class AActor*>* OutActors) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionComponent.GetKnownPerceivedActors"); UAIPerceptionComponent_GetKnownPerceivedActors_Params params {}; params.SenseToUse = SenseToUse; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (OutActors != nullptr) *OutActors = params.OutActors; } // Function: // Offset -> 0x01F634D0 // Name -> Function AIModule.AIPerceptionComponent.GetCurrentlyPerceivedActors // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // class UClass* SenseToUse (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TArray<class AActor*> OutActors (Parm, OutParm, ZeroConstructor, NativeAccessSpecifierPublic) void UAIPerceptionComponent::GetCurrentlyPerceivedActors(class UClass* SenseToUse, TArray<class AActor*>* OutActors) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionComponent.GetCurrentlyPerceivedActors"); UAIPerceptionComponent_GetCurrentlyPerceivedActors_Params params {}; params.SenseToUse = SenseToUse; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (OutActors != nullptr) *OutActors = params.OutActors; } // Function: // Offset -> 0x01F632D0 // Name -> Function AIModule.AIPerceptionComponent.GetActorsPerception // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable) // Parameters: // class AActor* Actor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FActorPerceptionBlueprintInfo Info (Parm, OutParm, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UAIPerceptionComponent::GetActorsPerception(class AActor* Actor, struct FActorPerceptionBlueprintInfo* Info) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionComponent.GetActorsPerception"); UAIPerceptionComponent_GetActorsPerception_Params params {}; params.Actor = Actor; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (Info != nullptr) *Info = params.Info; return params.ReturnValue; } void UAIPerceptionComponent::AfterRead() { UActorComponent::AfterRead(); READ_PTR_FULL(DominantSense, UClass); READ_PTR_FULL(AIOwner, AAIController); } void UAIPerceptionComponent::BeforeDelete() { UActorComponent::BeforeDelete(); DELE_PTR_FULL(DominantSense); DELE_PTR_FULL(AIOwner); } void UAIPerceptionListenerInterface::AfterRead() { UInterface::AfterRead(); } void UAIPerceptionListenerInterface::BeforeDelete() { UInterface::BeforeDelete(); } // Function: // Offset -> 0x01F65270 // Name -> Function AIModule.AIPerceptionStimuliSourceComponent.UnregisterFromSense // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class UClass* SenseClass (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIPerceptionStimuliSourceComponent::UnregisterFromSense(class UClass* SenseClass) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionStimuliSourceComponent.UnregisterFromSense"); UAIPerceptionStimuliSourceComponent_UnregisterFromSense_Params params {}; params.SenseClass = SenseClass; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F65250 // Name -> Function AIModule.AIPerceptionStimuliSourceComponent.UnregisterFromPerceptionSystem // Flags -> (Final, Native, Public, BlueprintCallable) void UAIPerceptionStimuliSourceComponent::UnregisterFromPerceptionSystem() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionStimuliSourceComponent.UnregisterFromPerceptionSystem"); UAIPerceptionStimuliSourceComponent_UnregisterFromPerceptionSystem_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F64860 // Name -> Function AIModule.AIPerceptionStimuliSourceComponent.RegisterWithPerceptionSystem // Flags -> (Final, Native, Public, BlueprintCallable) void UAIPerceptionStimuliSourceComponent::RegisterWithPerceptionSystem() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionStimuliSourceComponent.RegisterWithPerceptionSystem"); UAIPerceptionStimuliSourceComponent_RegisterWithPerceptionSystem_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F646F0 // Name -> Function AIModule.AIPerceptionStimuliSourceComponent.RegisterForSense // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class UClass* SenseClass (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIPerceptionStimuliSourceComponent::RegisterForSense(class UClass* SenseClass) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionStimuliSourceComponent.RegisterForSense"); UAIPerceptionStimuliSourceComponent_RegisterForSense_Params params {}; params.SenseClass = SenseClass; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UAIPerceptionStimuliSourceComponent::AfterRead() { UActorComponent::AfterRead(); } void UAIPerceptionStimuliSourceComponent::BeforeDelete() { UActorComponent::BeforeDelete(); } void UAISubsystem::AfterRead() { UObject::AfterRead(); READ_PTR_FULL(AISystem, UAISystem); } void UAISubsystem::BeforeDelete() { UObject::BeforeDelete(); DELE_PTR_FULL(AISystem); } // Function: // Offset -> 0x01F64900 // Name -> Function AIModule.AIPerceptionSystem.ReportPerceptionEvent // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UAISenseEvent* PerceptionEvent (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIPerceptionSystem::STATIC_ReportPerceptionEvent(class UObject* WorldContextObject, class UAISenseEvent* PerceptionEvent) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionSystem.ReportPerceptionEvent"); UAIPerceptionSystem_ReportPerceptionEvent_Params params {}; params.WorldContextObject = WorldContextObject; params.PerceptionEvent = PerceptionEvent; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F64880 // Name -> Function AIModule.AIPerceptionSystem.ReportEvent // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class UAISenseEvent* PerceptionEvent (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIPerceptionSystem::ReportEvent(class UAISenseEvent* PerceptionEvent) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionSystem.ReportEvent"); UAIPerceptionSystem_ReportEvent_Params params {}; params.PerceptionEvent = PerceptionEvent; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F64770 // Name -> Function AIModule.AIPerceptionSystem.RegisterPerceptionStimuliSource // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UClass* Sense (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* Target (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UAIPerceptionSystem::STATIC_RegisterPerceptionStimuliSource(class UObject* WorldContextObject, class UClass* Sense, class AActor* Target) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionSystem.RegisterPerceptionStimuliSource"); UAIPerceptionSystem_RegisterPerceptionStimuliSource_Params params {}; params.WorldContextObject = WorldContextObject; params.Sense = Sense; params.Target = Target; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F64630 // Name -> Function AIModule.AIPerceptionSystem.OnPerceptionStimuliSourceEndPlay // Flags -> (Final, Native, Protected) // Parameters: // class AActor* Actor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<Engine_EEndPlayReason> EndPlayReason (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAIPerceptionSystem::OnPerceptionStimuliSourceEndPlay(class AActor* Actor, TEnumAsByte<Engine_EEndPlayReason> EndPlayReason) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionSystem.OnPerceptionStimuliSourceEndPlay"); UAIPerceptionSystem_OnPerceptionStimuliSourceEndPlay_Params params {}; params.Actor = Actor; params.EndPlayReason = EndPlayReason; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F63A00 // Name -> Function AIModule.AIPerceptionSystem.GetSenseClassForStimulus // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FAIStimulus Stimulus (ConstParm, Parm, OutParm, ReferenceParm, NoDestructor, NativeAccessSpecifierPublic) // class UClass* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UClass* UAIPerceptionSystem::STATIC_GetSenseClassForStimulus(class UObject* WorldContextObject, const struct FAIStimulus& Stimulus) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AIPerceptionSystem.GetSenseClassForStimulus"); UAIPerceptionSystem_GetSenseClassForStimulus_Params params {}; params.WorldContextObject = WorldContextObject; params.Stimulus = Stimulus; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UAIPerceptionSystem::AfterRead() { UAISubsystem::AfterRead(); } void UAIPerceptionSystem::BeforeDelete() { UAISubsystem::BeforeDelete(); } void UAIResourceInterface::AfterRead() { UInterface::AfterRead(); } void UAIResourceInterface::BeforeDelete() { UInterface::BeforeDelete(); } void UAIResource_Movement::AfterRead() { UGameplayTaskResource::AfterRead(); } void UAIResource_Movement::BeforeDelete() { UGameplayTaskResource::BeforeDelete(); } void UAIResource_Logic::AfterRead() { UGameplayTaskResource::AfterRead(); } void UAIResource_Logic::BeforeDelete() { UGameplayTaskResource::BeforeDelete(); } void UAISense::AfterRead() { UObject::AfterRead(); READ_PTR_FULL(PerceptionSystemInstance, UAIPerceptionSystem); } void UAISense::BeforeDelete() { UObject::BeforeDelete(); DELE_PTR_FULL(PerceptionSystemInstance); } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.AISense_Blueprint.OnUpdate // Flags -> (Event, Public, HasOutParms, BlueprintEvent) // Parameters: // TArray<class UAISenseEvent*> EventsToProcess (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, NativeAccessSpecifierPublic) // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) float UAISense_Blueprint::OnUpdate(TArray<class UAISenseEvent*> EventsToProcess) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISense_Blueprint.OnUpdate"); UAISense_Blueprint_OnUpdate_Params params {}; params.EventsToProcess = EventsToProcess; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.AISense_Blueprint.OnListenerUpdated // Flags -> (Event, Public, BlueprintEvent) // Parameters: // class AActor* ActorListener (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UAIPerceptionComponent* PerceptionComponent (Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAISense_Blueprint::OnListenerUpdated(class AActor* ActorListener, class UAIPerceptionComponent* PerceptionComponent) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISense_Blueprint.OnListenerUpdated"); UAISense_Blueprint_OnListenerUpdated_Params params {}; params.ActorListener = ActorListener; params.PerceptionComponent = PerceptionComponent; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.AISense_Blueprint.OnListenerUnregistered // Flags -> (Event, Public, BlueprintEvent) // Parameters: // class AActor* ActorListener (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UAIPerceptionComponent* PerceptionComponent (Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAISense_Blueprint::OnListenerUnregistered(class AActor* ActorListener, class UAIPerceptionComponent* PerceptionComponent) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISense_Blueprint.OnListenerUnregistered"); UAISense_Blueprint_OnListenerUnregistered_Params params {}; params.ActorListener = ActorListener; params.PerceptionComponent = PerceptionComponent; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.AISense_Blueprint.OnListenerRegistered // Flags -> (Event, Public, BlueprintEvent) // Parameters: // class AActor* ActorListener (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UAIPerceptionComponent* PerceptionComponent (Parm, ZeroConstructor, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAISense_Blueprint::OnListenerRegistered(class AActor* ActorListener, class UAIPerceptionComponent* PerceptionComponent) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISense_Blueprint.OnListenerRegistered"); UAISense_Blueprint_OnListenerRegistered_Params params {}; params.ActorListener = ActorListener; params.PerceptionComponent = PerceptionComponent; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.AISense_Blueprint.K2_OnNewPawn // Flags -> (Event, Public, BlueprintEvent) // Parameters: // class APawn* NewPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAISense_Blueprint::K2_OnNewPawn(class APawn* NewPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISense_Blueprint.K2_OnNewPawn"); UAISense_Blueprint_K2_OnNewPawn_Params params {}; params.NewPawn = NewPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F69340 // Name -> Function AIModule.AISense_Blueprint.GetAllListenerComponents // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // TArray<class UAIPerceptionComponent*> ListenerComponents (Parm, OutParm, ZeroConstructor, ContainsInstancedReference, NativeAccessSpecifierPublic) void UAISense_Blueprint::GetAllListenerComponents(TArray<class UAIPerceptionComponent*>* ListenerComponents) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISense_Blueprint.GetAllListenerComponents"); UAISense_Blueprint_GetAllListenerComponents_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (ListenerComponents != nullptr) *ListenerComponents = params.ListenerComponents; } // Function: // Offset -> 0x01F69290 // Name -> Function AIModule.AISense_Blueprint.GetAllListenerActors // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // TArray<class AActor*> ListenerActors (Parm, OutParm, ZeroConstructor, NativeAccessSpecifierPublic) void UAISense_Blueprint::GetAllListenerActors(TArray<class AActor*>* ListenerActors) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISense_Blueprint.GetAllListenerActors"); UAISense_Blueprint_GetAllListenerActors_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (ListenerActors != nullptr) *ListenerActors = params.ListenerActors; } void UAISense_Blueprint::AfterRead() { UAISense::AfterRead(); READ_PTR_FULL(ListenerDataType, UClass); } void UAISense_Blueprint::BeforeDelete() { UAISense::BeforeDelete(); DELE_PTR_FULL(ListenerDataType); } // Function: // Offset -> 0x01F69490 // Name -> Function AIModule.AISense_Damage.ReportDamageEvent // Flags -> (Final, Native, Static, Public, HasDefaults, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* DamagedActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* Instigator (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float DamageAmount (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector EventLocation (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector HitLocation (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAISense_Damage::STATIC_ReportDamageEvent(class UObject* WorldContextObject, class AActor* DamagedActor, class AActor* Instigator, float DamageAmount, const struct FVector& EventLocation, const struct FVector& HitLocation) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISense_Damage.ReportDamageEvent"); UAISense_Damage_ReportDamageEvent_Params params {}; params.WorldContextObject = WorldContextObject; params.DamagedActor = DamagedActor; params.Instigator = Instigator; params.DamageAmount = DamageAmount; params.EventLocation = EventLocation; params.HitLocation = HitLocation; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UAISense_Damage::AfterRead() { UAISense::AfterRead(); } void UAISense_Damage::BeforeDelete() { UAISense::BeforeDelete(); } void UEnvQueryNode::AfterRead() { UObject::AfterRead(); } void UEnvQueryNode::BeforeDelete() { UObject::BeforeDelete(); } void UEnvQueryTest::AfterRead() { UEnvQueryNode::AfterRead(); } void UEnvQueryTest::BeforeDelete() { UEnvQueryNode::BeforeDelete(); } void UEnvQueryTest_GameplayTags::AfterRead() { UEnvQueryTest::AfterRead(); } void UEnvQueryTest_GameplayTags::BeforeDelete() { UEnvQueryTest::BeforeDelete(); } void UEnvQueryTest_Overlap::AfterRead() { UEnvQueryTest::AfterRead(); } void UEnvQueryTest_Overlap::BeforeDelete() { UEnvQueryTest::BeforeDelete(); } void UEnvQueryTest_Pathfinding::AfterRead() { UEnvQueryTest::AfterRead(); READ_PTR_FULL(Context, UClass); READ_PTR_FULL(FilterClass, UClass); } void UEnvQueryTest_Pathfinding::BeforeDelete() { UEnvQueryTest::BeforeDelete(); DELE_PTR_FULL(Context); DELE_PTR_FULL(FilterClass); } void UEnvQueryTest_PathfindingBatch::AfterRead() { UEnvQueryTest_Pathfinding::AfterRead(); } void UEnvQueryTest_PathfindingBatch::BeforeDelete() { UEnvQueryTest_Pathfinding::BeforeDelete(); } void UEnvQueryTest_Project::AfterRead() { UEnvQueryTest::AfterRead(); } void UEnvQueryTest_Project::BeforeDelete() { UEnvQueryTest::BeforeDelete(); } void UEnvQueryTest_Random::AfterRead() { UEnvQueryTest::AfterRead(); } void UEnvQueryTest_Random::BeforeDelete() { UEnvQueryTest::BeforeDelete(); } void UEnvQueryTest_Trace::AfterRead() { UEnvQueryTest::AfterRead(); READ_PTR_FULL(Context, UClass); } void UEnvQueryTest_Trace::BeforeDelete() { UEnvQueryTest::BeforeDelete(); DELE_PTR_FULL(Context); } void UEnvQueryTypes::AfterRead() { UObject::AfterRead(); } void UEnvQueryTypes::BeforeDelete() { UObject::BeforeDelete(); } void UEQSQueryResultSourceInterface::AfterRead() { UInterface::AfterRead(); } void UEQSQueryResultSourceInterface::BeforeDelete() { UInterface::BeforeDelete(); } void UEQSRenderingComponent::AfterRead() { UPrimitiveComponent::AfterRead(); } void UEQSRenderingComponent::BeforeDelete() { UPrimitiveComponent::BeforeDelete(); } void AEQSTestingPawn::AfterRead() { ACharacter::AfterRead(); READ_PTR_FULL(QueryTemplate, UEnvQuery); } void AEQSTestingPawn::BeforeDelete() { ACharacter::BeforeDelete(); DELE_PTR_FULL(QueryTemplate); } void UGenericTeamAgentInterface::AfterRead() { UInterface::AfterRead(); } void UGenericTeamAgentInterface::BeforeDelete() { UInterface::BeforeDelete(); } void AGridPathAIController::AfterRead() { AAIController::AfterRead(); } void AGridPathAIController::BeforeDelete() { AAIController::BeforeDelete(); } // Function: // Offset -> 0x01F7C0D0 // Name -> Function AIModule.PathFollowingComponent.OnNavDataRegistered // Flags -> (Final, Native, Protected) // Parameters: // class ANavigationData* NavData (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPathFollowingComponent::OnNavDataRegistered(class ANavigationData* NavData) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PathFollowingComponent.OnNavDataRegistered"); UPathFollowingComponent_OnNavDataRegistered_Params params {}; params.NavData = NavData; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F7BF30 // Name -> Function AIModule.PathFollowingComponent.OnActorBump // Flags -> (Native, Public, HasOutParms, HasDefaults) // Parameters: // class AActor* SelfActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* OtherActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector NormalImpulse (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FHitResult Hit (ConstParm, Parm, OutParm, ReferenceParm, IsPlainOldData, NoDestructor, ContainsInstancedReference, NativeAccessSpecifierPublic) void UPathFollowingComponent::OnActorBump(class AActor* SelfActor, class AActor* OtherActor, const struct FVector& NormalImpulse, const struct FHitResult& Hit) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PathFollowingComponent.OnActorBump"); UPathFollowingComponent_OnActorBump_Params params {}; params.SelfActor = SelfActor; params.OtherActor = OtherActor; params.NormalImpulse = NormalImpulse; params.Hit = Hit; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F7BBA0 // Name -> Function AIModule.PathFollowingComponent.GetPathDestination // Flags -> (Final, Native, Public, HasDefaults, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FVector ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) struct FVector UPathFollowingComponent::GetPathDestination() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PathFollowingComponent.GetPathDestination"); UPathFollowingComponent_GetPathDestination_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F7BB70 // Name -> Function AIModule.PathFollowingComponent.GetPathActionType // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // TEnumAsByte<AIModule_EPathFollowingAction> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) TEnumAsByte<AIModule_EPathFollowingAction> UPathFollowingComponent::GetPathActionType() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PathFollowingComponent.GetPathActionType"); UPathFollowingComponent_GetPathActionType_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UPathFollowingComponent::AfterRead() { UActorComponent::AfterRead(); READ_PTR_FULL(MovementComp, UNavMovementComponent); READ_PTR_FULL(MyNavData, ANavigationData); } void UPathFollowingComponent::BeforeDelete() { UActorComponent::BeforeDelete(); DELE_PTR_FULL(MovementComp); DELE_PTR_FULL(MyNavData); } void UGridPathFollowingComponent::AfterRead() { UPathFollowingComponent::AfterRead(); READ_PTR_FULL(GridManager, UNavLocalGridManager); } void UGridPathFollowingComponent::BeforeDelete() { UPathFollowingComponent::BeforeDelete(); DELE_PTR_FULL(GridManager); } void UNavFilter_AIControllerDefault::AfterRead() { UNavigationQueryFilter::AfterRead(); } void UNavFilter_AIControllerDefault::BeforeDelete() { UNavigationQueryFilter::BeforeDelete(); } // Function: // Offset -> 0x01F7A300 // Name -> Function AIModule.NavLinkProxy.SetSmartLinkEnabled // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // bool bEnabled (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void ANavLinkProxy::SetSmartLinkEnabled(bool bEnabled) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLinkProxy.SetSmartLinkEnabled"); ANavLinkProxy_SetSmartLinkEnabled_Params params {}; params.bEnabled = bEnabled; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F7A030 // Name -> Function AIModule.NavLinkProxy.ResumePathFollowing // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class AActor* Agent (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void ANavLinkProxy::ResumePathFollowing(class AActor* Agent) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLinkProxy.ResumePathFollowing"); ANavLinkProxy_ResumePathFollowing_Params params {}; params.Agent = Agent; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.NavLinkProxy.ReceiveSmartLinkReached // Flags -> (Event, Public, HasOutParms, HasDefaults, BlueprintEvent) // Parameters: // class AActor* Agent (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector Destination (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void ANavLinkProxy::ReceiveSmartLinkReached(class AActor* Agent, const struct FVector& Destination) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLinkProxy.ReceiveSmartLinkReached"); ANavLinkProxy_ReceiveSmartLinkReached_Params params {}; params.Agent = Agent; params.Destination = Destination; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F79F10 // Name -> Function AIModule.NavLinkProxy.IsSmartLinkEnabled // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool ANavLinkProxy::IsSmartLinkEnabled() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLinkProxy.IsSmartLinkEnabled"); ANavLinkProxy_IsSmartLinkEnabled_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F79EE0 // Name -> Function AIModule.NavLinkProxy.HasMovingAgents // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool ANavLinkProxy::HasMovingAgents() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLinkProxy.HasMovingAgents"); ANavLinkProxy_HasMovingAgents_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void ANavLinkProxy::AfterRead() { AActor::AfterRead(); READ_PTR_FULL(SmartLinkComp, UNavLinkCustomComponent); } void ANavLinkProxy::BeforeDelete() { AActor::BeforeDelete(); DELE_PTR_FULL(SmartLinkComp); } // Function: // Offset -> 0x01F7A230 // Name -> Function AIModule.NavLocalGridManager.SetLocalNavigationGridDensity // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float CellSize (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UNavLocalGridManager::STATIC_SetLocalNavigationGridDensity(class UObject* WorldContextObject, float CellSize) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLocalGridManager.SetLocalNavigationGridDensity"); UNavLocalGridManager_SetLocalNavigationGridDensity_Params params {}; params.WorldContextObject = WorldContextObject; params.CellSize = CellSize; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F79F40 // Name -> Function AIModule.NavLocalGridManager.RemoveLocalNavigationGrid // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // int GridId (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bRebuildGrids (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UNavLocalGridManager::STATIC_RemoveLocalNavigationGrid(class UObject* WorldContextObject, int GridId, bool bRebuildGrids) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLocalGridManager.RemoveLocalNavigationGrid"); UNavLocalGridManager_RemoveLocalNavigationGrid_Params params {}; params.WorldContextObject = WorldContextObject; params.GridId = GridId; params.bRebuildGrids = bRebuildGrids; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F79D50 // Name -> Function AIModule.NavLocalGridManager.FindLocalNavigationGridPath // Flags -> (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector Start (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector End (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TArray<struct FVector> PathPoints (Parm, OutParm, ZeroConstructor, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UNavLocalGridManager::STATIC_FindLocalNavigationGridPath(class UObject* WorldContextObject, const struct FVector& Start, const struct FVector& End, TArray<struct FVector>* PathPoints) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLocalGridManager.FindLocalNavigationGridPath"); UNavLocalGridManager_FindLocalNavigationGridPath_Params params {}; params.WorldContextObject = WorldContextObject; params.Start = Start; params.End = End; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (PathPoints != nullptr) *PathPoints = params.PathPoints; return params.ReturnValue; } // Function: // Offset -> 0x01F79B90 // Name -> Function AIModule.NavLocalGridManager.AddLocalNavigationGridForPoints // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TArray<struct FVector> Locations (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, NativeAccessSpecifierPublic) // int Radius2D (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float Height (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bRebuildGrids (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) int UNavLocalGridManager::STATIC_AddLocalNavigationGridForPoints(class UObject* WorldContextObject, TArray<struct FVector> Locations, int Radius2D, float Height, bool bRebuildGrids) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLocalGridManager.AddLocalNavigationGridForPoints"); UNavLocalGridManager_AddLocalNavigationGridForPoints_Params params {}; params.WorldContextObject = WorldContextObject; params.Locations = Locations; params.Radius2D = Radius2D; params.Height = Height; params.bRebuildGrids = bRebuildGrids; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F799E0 // Name -> Function AIModule.NavLocalGridManager.AddLocalNavigationGridForPoint // Flags -> (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector Location (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // int Radius2D (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float Height (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bRebuildGrids (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) int UNavLocalGridManager::STATIC_AddLocalNavigationGridForPoint(class UObject* WorldContextObject, const struct FVector& Location, int Radius2D, float Height, bool bRebuildGrids) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLocalGridManager.AddLocalNavigationGridForPoint"); UNavLocalGridManager_AddLocalNavigationGridForPoint_Params params {}; params.WorldContextObject = WorldContextObject; params.Location = Location; params.Radius2D = Radius2D; params.Height = Height; params.bRebuildGrids = bRebuildGrids; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F797E0 // Name -> Function AIModule.NavLocalGridManager.AddLocalNavigationGridForCapsule // Flags -> (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector Location (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float CapsuleRadius (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float CapsuleHalfHeight (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // int Radius2D (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float Height (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bRebuildGrids (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) int UNavLocalGridManager::STATIC_AddLocalNavigationGridForCapsule(class UObject* WorldContextObject, const struct FVector& Location, float CapsuleRadius, float CapsuleHalfHeight, int Radius2D, float Height, bool bRebuildGrids) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLocalGridManager.AddLocalNavigationGridForCapsule"); UNavLocalGridManager_AddLocalNavigationGridForCapsule_Params params {}; params.WorldContextObject = WorldContextObject; params.Location = Location; params.CapsuleRadius = CapsuleRadius; params.CapsuleHalfHeight = CapsuleHalfHeight; params.Radius2D = Radius2D; params.Height = Height; params.bRebuildGrids = bRebuildGrids; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F795C0 // Name -> Function AIModule.NavLocalGridManager.AddLocalNavigationGridForBox // Flags -> (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector Location (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector Extent (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FRotator Rotation (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, NativeAccessSpecifierPublic) // int Radius2D (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float Height (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bRebuildGrids (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) int UNavLocalGridManager::STATIC_AddLocalNavigationGridForBox(class UObject* WorldContextObject, const struct FVector& Location, const struct FVector& Extent, const struct FRotator& Rotation, int Radius2D, float Height, bool bRebuildGrids) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.NavLocalGridManager.AddLocalNavigationGridForBox"); UNavLocalGridManager_AddLocalNavigationGridForBox_Params params {}; params.WorldContextObject = WorldContextObject; params.Location = Location; params.Extent = Extent; params.Rotation = Rotation; params.Radius2D = Radius2D; params.Height = Height; params.bRebuildGrids = bRebuildGrids; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UNavLocalGridManager::AfterRead() { UObject::AfterRead(); } void UNavLocalGridManager::BeforeDelete() { UObject::BeforeDelete(); } void UPathFollowingManager::AfterRead() { UObject::AfterRead(); } void UPathFollowingManager::BeforeDelete() { UObject::BeforeDelete(); } // Function: // Offset -> 0x01F7BB50 // Name -> Function AIModule.PawnAction.GetActionPriority // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure) // Parameters: // TEnumAsByte<AIModule_EAIRequestPriority> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) TEnumAsByte<AIModule_EAIRequestPriority> UPawnAction::GetActionPriority() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnAction.GetActionPriority"); UPawnAction_GetActionPriority_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x0156E990 // Name -> Function AIModule.PawnAction.Finish // Flags -> (Native, Protected, BlueprintCallable) // Parameters: // TEnumAsByte<AIModule_EPawnActionResult> WithResult (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPawnAction::Finish(TEnumAsByte<AIModule_EPawnActionResult> WithResult) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnAction.Finish"); UPawnAction_Finish_Params params {}; params.WithResult = WithResult; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F7BA90 // Name -> Function AIModule.PawnAction.CreateActionInstance // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UClass* ActionClass (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UPawnAction* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UPawnAction* UPawnAction::STATIC_CreateActionInstance(class UObject* WorldContextObject, class UClass* ActionClass) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnAction.CreateActionInstance"); UPawnAction_CreateActionInstance_Params params {}; params.WorldContextObject = WorldContextObject; params.ActionClass = ActionClass; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UPawnAction::AfterRead() { UObject::AfterRead(); READ_PTR_FULL(ChildAction, UPawnAction); READ_PTR_FULL(ParentAction, UPawnAction); READ_PTR_FULL(OwnerComponent, UPawnActionsComponent); READ_PTR_FULL(Instigator, UObject); READ_PTR_FULL(BrainComp, UBrainComponent); } void UPawnAction::BeforeDelete() { UObject::BeforeDelete(); DELE_PTR_FULL(ChildAction); DELE_PTR_FULL(ParentAction); DELE_PTR_FULL(OwnerComponent); DELE_PTR_FULL(Instigator); DELE_PTR_FULL(BrainComp); } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.PawnAction_BlueprintBase.ActionTick // Flags -> (Event, Public, BlueprintEvent) // Parameters: // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float DeltaSeconds (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPawnAction_BlueprintBase::ActionTick(class APawn* ControlledPawn, float DeltaSeconds) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnAction_BlueprintBase.ActionTick"); UPawnAction_BlueprintBase_ActionTick_Params params {}; params.ControlledPawn = ControlledPawn; params.DeltaSeconds = DeltaSeconds; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.PawnAction_BlueprintBase.ActionStart // Flags -> (Event, Public, BlueprintEvent) // Parameters: // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPawnAction_BlueprintBase::ActionStart(class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnAction_BlueprintBase.ActionStart"); UPawnAction_BlueprintBase_ActionStart_Params params {}; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.PawnAction_BlueprintBase.ActionResume // Flags -> (Event, Public, BlueprintEvent) // Parameters: // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPawnAction_BlueprintBase::ActionResume(class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnAction_BlueprintBase.ActionResume"); UPawnAction_BlueprintBase_ActionResume_Params params {}; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.PawnAction_BlueprintBase.ActionPause // Flags -> (Event, Public, BlueprintEvent) // Parameters: // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPawnAction_BlueprintBase::ActionPause(class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnAction_BlueprintBase.ActionPause"); UPawnAction_BlueprintBase_ActionPause_Params params {}; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.PawnAction_BlueprintBase.ActionFinished // Flags -> (Event, Public, BlueprintEvent) // Parameters: // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EPawnActionResult> WithResult (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPawnAction_BlueprintBase::ActionFinished(class APawn* ControlledPawn, TEnumAsByte<AIModule_EPawnActionResult> WithResult) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnAction_BlueprintBase.ActionFinished"); UPawnAction_BlueprintBase_ActionFinished_Params params {}; params.ControlledPawn = ControlledPawn; params.WithResult = WithResult; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UPawnAction_BlueprintBase::AfterRead() { UPawnAction::AfterRead(); } void UPawnAction_BlueprintBase::BeforeDelete() { UPawnAction::BeforeDelete(); } void UPawnAction_Move::AfterRead() { UPawnAction::AfterRead(); READ_PTR_FULL(GoalActor, AActor); READ_PTR_FULL(FilterClass, UClass); } void UPawnAction_Move::BeforeDelete() { UPawnAction::BeforeDelete(); DELE_PTR_FULL(GoalActor); DELE_PTR_FULL(FilterClass); } void UPawnAction_Repeat::AfterRead() { UPawnAction::AfterRead(); READ_PTR_FULL(ActionToRepeat, UPawnAction); READ_PTR_FULL(RecentActionCopy, UPawnAction); } void UPawnAction_Repeat::BeforeDelete() { UPawnAction::BeforeDelete(); DELE_PTR_FULL(ActionToRepeat); DELE_PTR_FULL(RecentActionCopy); } void UPawnAction_Sequence::AfterRead() { UPawnAction::AfterRead(); READ_PTR_FULL(RecentActionCopy, UPawnAction); } void UPawnAction_Sequence::BeforeDelete() { UPawnAction::BeforeDelete(); DELE_PTR_FULL(RecentActionCopy); } void UPawnAction_Wait::AfterRead() { UPawnAction::AfterRead(); } void UPawnAction_Wait::BeforeDelete() { UPawnAction::BeforeDelete(); } // Function: // Offset -> 0x01F7BE30 // Name -> Function AIModule.PawnActionsComponent.K2_PushAction // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class UPawnAction* NewAction (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EAIRequestPriority> Priority (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UObject* Instigator (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UPawnActionsComponent::K2_PushAction(class UPawnAction* NewAction, TEnumAsByte<AIModule_EAIRequestPriority> Priority, class UObject* Instigator) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnActionsComponent.K2_PushAction"); UPawnActionsComponent_K2_PushAction_Params params {}; params.NewAction = NewAction; params.Priority = Priority; params.Instigator = Instigator; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F7BD40 // Name -> Function AIModule.PawnActionsComponent.K2_PerformAction // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class APawn* Pawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UPawnAction* Action (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EAIRequestPriority> Priority (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UPawnActionsComponent::STATIC_K2_PerformAction(class APawn* Pawn, class UPawnAction* Action, TEnumAsByte<AIModule_EAIRequestPriority> Priority) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnActionsComponent.K2_PerformAction"); UPawnActionsComponent_K2_PerformAction_Params params {}; params.Pawn = Pawn; params.Action = Action; params.Priority = Priority; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F7BCB0 // Name -> Function AIModule.PawnActionsComponent.K2_ForceAbortAction // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class UPawnAction* ActionToAbort (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EPawnActionAbortState> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) TEnumAsByte<AIModule_EPawnActionAbortState> UPawnActionsComponent::K2_ForceAbortAction(class UPawnAction* ActionToAbort) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnActionsComponent.K2_ForceAbortAction"); UPawnActionsComponent_K2_ForceAbortAction_Params params {}; params.ActionToAbort = ActionToAbort; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F7BC20 // Name -> Function AIModule.PawnActionsComponent.K2_AbortAction // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // class UPawnAction* ActionToAbort (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EPawnActionAbortState> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) TEnumAsByte<AIModule_EPawnActionAbortState> UPawnActionsComponent::K2_AbortAction(class UPawnAction* ActionToAbort) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnActionsComponent.K2_AbortAction"); UPawnActionsComponent_K2_AbortAction_Params params {}; params.ActionToAbort = ActionToAbort; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UPawnActionsComponent::AfterRead() { UActorComponent::AfterRead(); READ_PTR_FULL(ControlledPawn, APawn); READ_PTR_FULL(CurrentAction, UPawnAction); } void UPawnActionsComponent::BeforeDelete() { UActorComponent::BeforeDelete(); DELE_PTR_FULL(ControlledPawn); DELE_PTR_FULL(CurrentAction); } // Function: // Offset -> 0x01F7C250 // Name -> Function AIModule.PawnSensingComponent.SetSensingUpdatesEnabled // Flags -> (BlueprintAuthorityOnly, Native, Public, BlueprintCallable) // Parameters: // bool bEnabled (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPawnSensingComponent::SetSensingUpdatesEnabled(bool bEnabled) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnSensingComponent.SetSensingUpdatesEnabled"); UPawnSensingComponent_SetSensingUpdatesEnabled_Params params {}; params.bEnabled = bEnabled; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F7C1D0 // Name -> Function AIModule.PawnSensingComponent.SetSensingInterval // Flags -> (BlueprintAuthorityOnly, Native, Public, BlueprintCallable) // Parameters: // float NewSensingInterval (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPawnSensingComponent::SetSensingInterval(float NewSensingInterval) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnSensingComponent.SetSensingInterval"); UPawnSensingComponent_SetSensingInterval_Params params {}; params.NewSensingInterval = NewSensingInterval; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F7C150 // Name -> Function AIModule.PawnSensingComponent.SetPeripheralVisionAngle // Flags -> (BlueprintAuthorityOnly, Native, Public, BlueprintCallable) // Parameters: // float NewPeripheralVisionAngle (ConstParm, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPawnSensingComponent::SetPeripheralVisionAngle(float NewPeripheralVisionAngle) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnSensingComponent.SetPeripheralVisionAngle"); UPawnSensingComponent_SetPeripheralVisionAngle_Params params {}; params.NewPeripheralVisionAngle = NewPeripheralVisionAngle; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> DelegateFunction AIModule.PawnSensingComponent.SeePawnDelegate__DelegateSignature // Flags -> (MulticastDelegate, Public, Delegate) // Parameters: // class APawn* Pawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPawnSensingComponent::SeePawnDelegate__DelegateSignature(class APawn* Pawn) { static UFunction* fn = UObject::FindObject<UFunction>("DelegateFunction AIModule.PawnSensingComponent.SeePawnDelegate__DelegateSignature"); UPawnSensingComponent_SeePawnDelegate__DelegateSignature_Params params {}; params.Pawn = Pawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> DelegateFunction AIModule.PawnSensingComponent.HearNoiseDelegate__DelegateSignature // Flags -> (MulticastDelegate, Public, Delegate, HasOutParms, HasDefaults) // Parameters: // class APawn* Instigator (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector Location (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float Volume (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UPawnSensingComponent::HearNoiseDelegate__DelegateSignature(class APawn* Instigator, const struct FVector& Location, float Volume) { static UFunction* fn = UObject::FindObject<UFunction>("DelegateFunction AIModule.PawnSensingComponent.HearNoiseDelegate__DelegateSignature"); UPawnSensingComponent_HearNoiseDelegate__DelegateSignature_Params params {}; params.Instigator = Instigator; params.Location = Location; params.Volume = Volume; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F7BC00 // Name -> Function AIModule.PawnSensingComponent.GetPeripheralVisionCosine // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) float UPawnSensingComponent::GetPeripheralVisionCosine() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnSensingComponent.GetPeripheralVisionCosine"); UPawnSensingComponent_GetPeripheralVisionCosine_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F7BBE0 // Name -> Function AIModule.PawnSensingComponent.GetPeripheralVisionAngle // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) float UPawnSensingComponent::GetPeripheralVisionAngle() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.PawnSensingComponent.GetPeripheralVisionAngle"); UPawnSensingComponent_GetPeripheralVisionAngle_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UPawnSensingComponent::AfterRead() { UActorComponent::AfterRead(); } void UPawnSensingComponent::BeforeDelete() { UActorComponent::BeforeDelete(); } void UVisualLoggerExtension::AfterRead() { UObject::AfterRead(); } void UVisualLoggerExtension::BeforeDelete() { UObject::BeforeDelete(); } // Function: // Offset -> 0x01F69660 // Name -> Function AIModule.AISense_Hearing.ReportNoiseEvent // Flags -> (Final, Native, Static, Public, HasDefaults, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector NoiseLocation (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float Loudness (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* Instigator (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float MaxRange (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FName Tag (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAISense_Hearing::STATIC_ReportNoiseEvent(class UObject* WorldContextObject, const struct FVector& NoiseLocation, float Loudness, class AActor* Instigator, float MaxRange, const struct FName& Tag) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISense_Hearing.ReportNoiseEvent"); UAISense_Hearing_ReportNoiseEvent_Params params {}; params.WorldContextObject = WorldContextObject; params.NoiseLocation = NoiseLocation; params.Loudness = Loudness; params.Instigator = Instigator; params.MaxRange = MaxRange; params.Tag = Tag; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UAISense_Hearing::AfterRead() { UAISense::AfterRead(); } void UAISense_Hearing::BeforeDelete() { UAISense::BeforeDelete(); } // Function: // Offset -> 0x01F69920 // Name -> Function AIModule.AISense_Prediction.RequestPawnPredictionEvent // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class APawn* Requestor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* PredictedActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float PredictionTime (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAISense_Prediction::STATIC_RequestPawnPredictionEvent(class APawn* Requestor, class AActor* PredictedActor, float PredictionTime) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISense_Prediction.RequestPawnPredictionEvent"); UAISense_Prediction_RequestPawnPredictionEvent_Params params {}; params.Requestor = Requestor; params.PredictedActor = PredictedActor; params.PredictionTime = PredictionTime; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F69820 // Name -> Function AIModule.AISense_Prediction.RequestControllerPredictionEvent // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class AAIController* Requestor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* PredictedActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float PredictionTime (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UAISense_Prediction::STATIC_RequestControllerPredictionEvent(class AAIController* Requestor, class AActor* PredictedActor, float PredictionTime) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISense_Prediction.RequestControllerPredictionEvent"); UAISense_Prediction_RequestControllerPredictionEvent_Params params {}; params.Requestor = Requestor; params.PredictedActor = PredictedActor; params.PredictionTime = PredictionTime; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UAISense_Prediction::AfterRead() { UAISense::AfterRead(); } void UAISense_Prediction::BeforeDelete() { UAISense::BeforeDelete(); } void UAISense_Sight::AfterRead() { UAISense::AfterRead(); } void UAISense_Sight::BeforeDelete() { UAISense::BeforeDelete(); } void UAISense_Team::AfterRead() { UAISense::AfterRead(); } void UAISense_Team::BeforeDelete() { UAISense::BeforeDelete(); } void UAISense_Touch::AfterRead() { UAISense::AfterRead(); } void UAISense_Touch::BeforeDelete() { UAISense::BeforeDelete(); } void UAISenseBlueprintListener::AfterRead() { UUserDefinedStruct::AfterRead(); } void UAISenseBlueprintListener::BeforeDelete() { UUserDefinedStruct::BeforeDelete(); } void UAISenseConfig::AfterRead() { UObject::AfterRead(); } void UAISenseConfig::BeforeDelete() { UObject::BeforeDelete(); } void UAISenseConfig_Blueprint::AfterRead() { UAISenseConfig::AfterRead(); READ_PTR_FULL(Implementation, UClass); } void UAISenseConfig_Blueprint::BeforeDelete() { UAISenseConfig::BeforeDelete(); DELE_PTR_FULL(Implementation); } void UAISenseConfig_Damage::AfterRead() { UAISenseConfig::AfterRead(); READ_PTR_FULL(Implementation, UClass); } void UAISenseConfig_Damage::BeforeDelete() { UAISenseConfig::BeforeDelete(); DELE_PTR_FULL(Implementation); } void UAISenseConfig_Hearing::AfterRead() { UAISenseConfig::AfterRead(); READ_PTR_FULL(Implementation, UClass); } void UAISenseConfig_Hearing::BeforeDelete() { UAISenseConfig::BeforeDelete(); DELE_PTR_FULL(Implementation); } void UAISenseConfig_Prediction::AfterRead() { UAISenseConfig::AfterRead(); } void UAISenseConfig_Prediction::BeforeDelete() { UAISenseConfig::BeforeDelete(); } void UAISenseConfig_Sight::AfterRead() { UAISenseConfig::AfterRead(); READ_PTR_FULL(Implementation, UClass); } void UAISenseConfig_Sight::BeforeDelete() { UAISenseConfig::BeforeDelete(); DELE_PTR_FULL(Implementation); } void UAISenseConfig_Team::AfterRead() { UAISenseConfig::AfterRead(); } void UAISenseConfig_Team::BeforeDelete() { UAISenseConfig::BeforeDelete(); } void UAISenseConfig_Touch::AfterRead() { UAISenseConfig::AfterRead(); } void UAISenseConfig_Touch::BeforeDelete() { UAISenseConfig::BeforeDelete(); } void UAISenseEvent::AfterRead() { UObject::AfterRead(); } void UAISenseEvent::BeforeDelete() { UObject::BeforeDelete(); } void UAISenseEvent_Damage::AfterRead() { UAISenseEvent::AfterRead(); } void UAISenseEvent_Damage::BeforeDelete() { UAISenseEvent::BeforeDelete(); } void UAISenseEvent_Hearing::AfterRead() { UAISenseEvent::AfterRead(); } void UAISenseEvent_Hearing::BeforeDelete() { UAISenseEvent::BeforeDelete(); } void UAISightTargetInterface::AfterRead() { UInterface::AfterRead(); } void UAISightTargetInterface::BeforeDelete() { UInterface::BeforeDelete(); } // Function: // Offset -> 0x01647BA0 // Name -> Function AIModule.AISystem.AILoggingVerbose // Flags -> (Exec, Native, Public) void UAISystem::AILoggingVerbose() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISystem.AILoggingVerbose"); UAISystem_AILoggingVerbose_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01CE3BE0 // Name -> Function AIModule.AISystem.AIIgnorePlayers // Flags -> (Exec, Native, Public) void UAISystem::AIIgnorePlayers() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AISystem.AIIgnorePlayers"); UAISystem_AIIgnorePlayers_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UAISystem::AfterRead() { UAISystemBase::AfterRead(); READ_PTR_FULL(BehaviorTreeManager, UBehaviorTreeManager); READ_PTR_FULL(EnvironmentQueryManager, UEnvQueryManager); READ_PTR_FULL(PerceptionSystem, UAIPerceptionSystem); READ_PTR_FULL(HotSpotManager, UAIHotSpotManager); READ_PTR_FULL(NavLocalGrids, UNavLocalGridManager); } void UAISystem::BeforeDelete() { UAISystemBase::BeforeDelete(); DELE_PTR_FULL(BehaviorTreeManager); DELE_PTR_FULL(EnvironmentQueryManager); DELE_PTR_FULL(PerceptionSystem); DELE_PTR_FULL(HotSpotManager); DELE_PTR_FULL(NavLocalGrids); } void UAITask::AfterRead() { UGameplayTask::AfterRead(); READ_PTR_FULL(OwnerController, AAIController); } void UAITask::BeforeDelete() { UGameplayTask::BeforeDelete(); DELE_PTR_FULL(OwnerController); } void UAITask_LockLogic::AfterRead() { UAITask::AfterRead(); } void UAITask_LockLogic::BeforeDelete() { UAITask::BeforeDelete(); } // Function: // Offset -> 0x01F68EF0 // Name -> Function AIModule.AITask_MoveTo.AIMoveTo // Flags -> (Final, Native, Static, Public, HasDefaults, BlueprintCallable) // Parameters: // class AAIController* Controller (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector GoalLocation (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* GoalActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float AcceptanceRadius (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EAIOptionFlag> StopOnOverlap (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EAIOptionFlag> AcceptPartialPath (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bUsePathfinding (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bLockAILogic (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bUseContinuosGoalTracking (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UAITask_MoveTo* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UAITask_MoveTo* UAITask_MoveTo::STATIC_AIMoveTo(class AAIController* Controller, const struct FVector& GoalLocation, class AActor* GoalActor, float AcceptanceRadius, TEnumAsByte<AIModule_EAIOptionFlag> StopOnOverlap, TEnumAsByte<AIModule_EAIOptionFlag> AcceptPartialPath, bool bUsePathfinding, bool bLockAILogic, bool bUseContinuosGoalTracking) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AITask_MoveTo.AIMoveTo"); UAITask_MoveTo_AIMoveTo_Params params {}; params.Controller = Controller; params.GoalLocation = GoalLocation; params.GoalActor = GoalActor; params.AcceptanceRadius = AcceptanceRadius; params.StopOnOverlap = StopOnOverlap; params.AcceptPartialPath = AcceptPartialPath; params.bUsePathfinding = bUsePathfinding; params.bLockAILogic = bLockAILogic; params.bUseContinuosGoalTracking = bUseContinuosGoalTracking; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UAITask_MoveTo::AfterRead() { UAITask::AfterRead(); } void UAITask_MoveTo::BeforeDelete() { UAITask::BeforeDelete(); } // Function: // Offset -> 0x01F69A20 // Name -> Function AIModule.AITask_RunEQS.RunEQS // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class AAIController* Controller (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UEnvQuery* QueryTemplate (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UAITask_RunEQS* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UAITask_RunEQS* UAITask_RunEQS::STATIC_RunEQS(class AAIController* Controller, class UEnvQuery* QueryTemplate) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.AITask_RunEQS.RunEQS"); UAITask_RunEQS_RunEQS_Params params {}; params.Controller = Controller; params.QueryTemplate = QueryTemplate; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UAITask_RunEQS::AfterRead() { UAITask::AfterRead(); } void UAITask_RunEQS::BeforeDelete() { UAITask::BeforeDelete(); } void UBehaviorTree::AfterRead() { UObject::AfterRead(); READ_PTR_FULL(RootNode, UBTCompositeNode); READ_PTR_FULL(BlackboardAsset, UBlackboardData); } void UBehaviorTree::BeforeDelete() { UObject::BeforeDelete(); DELE_PTR_FULL(RootNode); DELE_PTR_FULL(BlackboardAsset); } // Function: // Offset -> 0x01F6E030 // Name -> Function AIModule.BrainComponent.StopLogic // Flags -> (Native, Public, BlueprintCallable) // Parameters: // struct FString Reason (Parm, ZeroConstructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBrainComponent::StopLogic(const struct FString& Reason) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BrainComponent.StopLogic"); UBrainComponent_StopLogic_Params params {}; params.Reason = Reason; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01DA6C60 // Name -> Function AIModule.BrainComponent.RestartLogic // Flags -> (Native, Public, BlueprintCallable) void UBrainComponent::RestartLogic() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BrainComponent.RestartLogic"); UBrainComponent_RestartLogic_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F6D6A0 // Name -> Function AIModule.BrainComponent.IsRunning // Flags -> (Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBrainComponent::IsRunning() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BrainComponent.IsRunning"); UBrainComponent_IsRunning_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D670 // Name -> Function AIModule.BrainComponent.IsPaused // Flags -> (Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBrainComponent::IsPaused() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BrainComponent.IsPaused"); UBrainComponent_IsPaused_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UBrainComponent::AfterRead() { UActorComponent::AfterRead(); READ_PTR_FULL(BlackboardComp, UBlackboardComponent); READ_PTR_FULL(AIOwner, AAIController); } void UBrainComponent::BeforeDelete() { UActorComponent::BeforeDelete(); DELE_PTR_FULL(BlackboardComp); DELE_PTR_FULL(AIOwner); } // Function: // Offset -> 0x01F69AE0 // Name -> Function AIModule.BehaviorTreeComponent.SetDynamicSubtree // Flags -> (Native, Public, BlueprintCallable) // Parameters: // struct FGameplayTag InjectTag (Parm, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UBehaviorTree* BehaviorAsset (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBehaviorTreeComponent::SetDynamicSubtree(const struct FGameplayTag& InjectTag, class UBehaviorTree* BehaviorAsset) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BehaviorTreeComponent.SetDynamicSubtree"); UBehaviorTreeComponent_SetDynamicSubtree_Params params {}; params.InjectTag = InjectTag; params.BehaviorAsset = BehaviorAsset; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F693F0 // Name -> Function AIModule.BehaviorTreeComponent.GetTagCooldownEndTime // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FGameplayTag CooldownTag (Parm, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) float UBehaviorTreeComponent::GetTagCooldownEndTime(const struct FGameplayTag& CooldownTag) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BehaviorTreeComponent.GetTagCooldownEndTime"); UBehaviorTreeComponent_GetTagCooldownEndTime_Params params {}; params.CooldownTag = CooldownTag; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F69180 // Name -> Function AIModule.BehaviorTreeComponent.AddCooldownTagDuration // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // struct FGameplayTag CooldownTag (Parm, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float CooldownDuration (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool bAddToExistingDuration (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBehaviorTreeComponent::AddCooldownTagDuration(const struct FGameplayTag& CooldownTag, float CooldownDuration, bool bAddToExistingDuration) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BehaviorTreeComponent.AddCooldownTagDuration"); UBehaviorTreeComponent_AddCooldownTagDuration_Params params {}; params.CooldownTag = CooldownTag; params.CooldownDuration = CooldownDuration; params.bAddToExistingDuration = bAddToExistingDuration; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UBehaviorTreeComponent::AfterRead() { UBrainComponent::AfterRead(); } void UBehaviorTreeComponent::BeforeDelete() { UBrainComponent::BeforeDelete(); } void UBehaviorTreeManager::AfterRead() { UObject::AfterRead(); } void UBehaviorTreeManager::BeforeDelete() { UObject::BeforeDelete(); } void UBehaviorTreeTypes::AfterRead() { UObject::AfterRead(); } void UBehaviorTreeTypes::BeforeDelete() { UObject::BeforeDelete(); } // Function: // Offset -> 0x01F6DF40 // Name -> Function AIModule.BlackboardComponent.SetValueAsVector // Flags -> (Final, Native, Public, HasOutParms, HasDefaults, BlueprintCallable) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector VectorValue (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBlackboardComponent::SetValueAsVector(const struct FName& KeyName, const struct FVector& VectorValue) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.SetValueAsVector"); UBlackboardComponent_SetValueAsVector_Params params {}; params.KeyName = KeyName; params.VectorValue = VectorValue; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F6DE10 // Name -> Function AIModule.BlackboardComponent.SetValueAsString // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FString StringValue (Parm, ZeroConstructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBlackboardComponent::SetValueAsString(const struct FName& KeyName, const struct FString& StringValue) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.SetValueAsString"); UBlackboardComponent_SetValueAsString_Params params {}; params.KeyName = KeyName; params.StringValue = StringValue; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F6DD20 // Name -> Function AIModule.BlackboardComponent.SetValueAsRotator // Flags -> (Final, Native, Public, HasOutParms, HasDefaults, BlueprintCallable) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FRotator VectorValue (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, NativeAccessSpecifierPublic) void UBlackboardComponent::SetValueAsRotator(const struct FName& KeyName, const struct FRotator& VectorValue) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.SetValueAsRotator"); UBlackboardComponent_SetValueAsRotator_Params params {}; params.KeyName = KeyName; params.VectorValue = VectorValue; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F6DC50 // Name -> Function AIModule.BlackboardComponent.SetValueAsObject // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UObject* ObjectValue (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBlackboardComponent::SetValueAsObject(const struct FName& KeyName, class UObject* ObjectValue) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.SetValueAsObject"); UBlackboardComponent_SetValueAsObject_Params params {}; params.KeyName = KeyName; params.ObjectValue = ObjectValue; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F6DB80 // Name -> Function AIModule.BlackboardComponent.SetValueAsName // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FName NameValue (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBlackboardComponent::SetValueAsName(const struct FName& KeyName, const struct FName& NameValue) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.SetValueAsName"); UBlackboardComponent_SetValueAsName_Params params {}; params.KeyName = KeyName; params.NameValue = NameValue; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F6DAB0 // Name -> Function AIModule.BlackboardComponent.SetValueAsInt // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // int IntValue (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBlackboardComponent::SetValueAsInt(const struct FName& KeyName, int IntValue) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.SetValueAsInt"); UBlackboardComponent_SetValueAsInt_Params params {}; params.KeyName = KeyName; params.IntValue = IntValue; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F6D9E0 // Name -> Function AIModule.BlackboardComponent.SetValueAsFloat // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float FloatValue (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBlackboardComponent::SetValueAsFloat(const struct FName& KeyName, float FloatValue) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.SetValueAsFloat"); UBlackboardComponent_SetValueAsFloat_Params params {}; params.KeyName = KeyName; params.FloatValue = FloatValue; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F6D910 // Name -> Function AIModule.BlackboardComponent.SetValueAsEnum // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // unsigned char EnumValue (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBlackboardComponent::SetValueAsEnum(const struct FName& KeyName, unsigned char EnumValue) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.SetValueAsEnum"); UBlackboardComponent_SetValueAsEnum_Params params {}; params.KeyName = KeyName; params.EnumValue = EnumValue; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F6D840 // Name -> Function AIModule.BlackboardComponent.SetValueAsClass // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UClass* ClassValue (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBlackboardComponent::SetValueAsClass(const struct FName& KeyName, class UClass* ClassValue) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.SetValueAsClass"); UBlackboardComponent_SetValueAsClass_Params params {}; params.KeyName = KeyName; params.ClassValue = ClassValue; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F6D770 // Name -> Function AIModule.BlackboardComponent.SetValueAsBool // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool BoolValue (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBlackboardComponent::SetValueAsBool(const struct FName& KeyName, bool BoolValue) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.SetValueAsBool"); UBlackboardComponent_SetValueAsBool_Params params {}; params.KeyName = KeyName; params.BoolValue = BoolValue; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F6D6D0 // Name -> Function AIModule.BlackboardComponent.IsVectorValueSet // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBlackboardComponent::IsVectorValueSet(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.IsVectorValueSet"); UBlackboardComponent_IsVectorValueSet_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D560 // Name -> Function AIModule.BlackboardComponent.GetValueAsVector // Flags -> (Final, Native, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) struct FVector UBlackboardComponent::GetValueAsVector(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetValueAsVector"); UBlackboardComponent_GetValueAsVector_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D480 // Name -> Function AIModule.BlackboardComponent.GetValueAsString // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FString ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, HasGetValueTypeHash, NativeAccessSpecifierPublic) struct FString UBlackboardComponent::GetValueAsString(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetValueAsString"); UBlackboardComponent_GetValueAsString_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D3D0 // Name -> Function AIModule.BlackboardComponent.GetValueAsRotator // Flags -> (Final, Native, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FRotator ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, NativeAccessSpecifierPublic) struct FRotator UBlackboardComponent::GetValueAsRotator(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetValueAsRotator"); UBlackboardComponent_GetValueAsRotator_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D330 // Name -> Function AIModule.BlackboardComponent.GetValueAsObject // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UObject* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UObject* UBlackboardComponent::GetValueAsObject(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetValueAsObject"); UBlackboardComponent_GetValueAsObject_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D290 // Name -> Function AIModule.BlackboardComponent.GetValueAsName // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FName ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) struct FName UBlackboardComponent::GetValueAsName(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetValueAsName"); UBlackboardComponent_GetValueAsName_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D1F0 // Name -> Function AIModule.BlackboardComponent.GetValueAsInt // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) int UBlackboardComponent::GetValueAsInt(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetValueAsInt"); UBlackboardComponent_GetValueAsInt_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D150 // Name -> Function AIModule.BlackboardComponent.GetValueAsFloat // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) float UBlackboardComponent::GetValueAsFloat(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetValueAsFloat"); UBlackboardComponent_GetValueAsFloat_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D0B0 // Name -> Function AIModule.BlackboardComponent.GetValueAsEnum // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // unsigned char ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) unsigned char UBlackboardComponent::GetValueAsEnum(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetValueAsEnum"); UBlackboardComponent_GetValueAsEnum_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D010 // Name -> Function AIModule.BlackboardComponent.GetValueAsClass // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UClass* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UClass* UBlackboardComponent::GetValueAsClass(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetValueAsClass"); UBlackboardComponent_GetValueAsClass_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6CF70 // Name -> Function AIModule.BlackboardComponent.GetValueAsBool // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBlackboardComponent::GetValueAsBool(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetValueAsBool"); UBlackboardComponent_GetValueAsBool_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6CE80 // Name -> Function AIModule.BlackboardComponent.GetRotationFromEntry // Flags -> (Final, Native, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FRotator ResultRotation (Parm, OutParm, ZeroConstructor, IsPlainOldData, NoDestructor, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBlackboardComponent::GetRotationFromEntry(const struct FName& KeyName, struct FRotator* ResultRotation) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetRotationFromEntry"); UBlackboardComponent_GetRotationFromEntry_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (ResultRotation != nullptr) *ResultRotation = params.ResultRotation; return params.ReturnValue; } // Function: // Offset -> 0x01F6CD90 // Name -> Function AIModule.BlackboardComponent.GetLocationFromEntry // Flags -> (Final, Native, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintPure, Const) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector ResultLocation (Parm, OutParm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBlackboardComponent::GetLocationFromEntry(const struct FName& KeyName, struct FVector* ResultLocation) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.GetLocationFromEntry"); UBlackboardComponent_GetLocationFromEntry_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (ResultLocation != nullptr) *ResultLocation = params.ResultLocation; return params.ReturnValue; } // Function: // Offset -> 0x01F6CD00 // Name -> Function AIModule.BlackboardComponent.ClearValue // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable) // Parameters: // struct FName KeyName (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBlackboardComponent::ClearValue(const struct FName& KeyName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BlackboardComponent.ClearValue"); UBlackboardComponent_ClearValue_Params params {}; params.KeyName = KeyName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UBlackboardComponent::AfterRead() { UActorComponent::AfterRead(); READ_PTR_FULL(BrainComp, UBrainComponent); READ_PTR_FULL(BlackboardAsset, UBlackboardData); } void UBlackboardComponent::BeforeDelete() { UActorComponent::BeforeDelete(); DELE_PTR_FULL(BrainComp); DELE_PTR_FULL(BlackboardAsset); } void UBlackboardData::AfterRead() { UDataAsset::AfterRead(); READ_PTR_FULL(Parent, UBlackboardData); } void UBlackboardData::BeforeDelete() { UDataAsset::BeforeDelete(); DELE_PTR_FULL(Parent); } void UBlackboardKeyType::AfterRead() { UObject::AfterRead(); } void UBlackboardKeyType::BeforeDelete() { UObject::BeforeDelete(); } void UBlackboardKeyType_Bool::AfterRead() { UBlackboardKeyType::AfterRead(); } void UBlackboardKeyType_Bool::BeforeDelete() { UBlackboardKeyType::BeforeDelete(); } void UBlackboardKeyType_Class::AfterRead() { UBlackboardKeyType::AfterRead(); READ_PTR_FULL(BaseClass, UClass); } void UBlackboardKeyType_Class::BeforeDelete() { UBlackboardKeyType::BeforeDelete(); DELE_PTR_FULL(BaseClass); } void UBlackboardKeyType_Enum::AfterRead() { UBlackboardKeyType::AfterRead(); READ_PTR_FULL(EnumType, UEnum); } void UBlackboardKeyType_Enum::BeforeDelete() { UBlackboardKeyType::BeforeDelete(); DELE_PTR_FULL(EnumType); } void UBlackboardKeyType_Float::AfterRead() { UBlackboardKeyType::AfterRead(); } void UBlackboardKeyType_Float::BeforeDelete() { UBlackboardKeyType::BeforeDelete(); } void UBlackboardKeyType_Int::AfterRead() { UBlackboardKeyType::AfterRead(); } void UBlackboardKeyType_Int::BeforeDelete() { UBlackboardKeyType::BeforeDelete(); } void UBlackboardKeyType_Name::AfterRead() { UBlackboardKeyType::AfterRead(); } void UBlackboardKeyType_Name::BeforeDelete() { UBlackboardKeyType::BeforeDelete(); } void UBlackboardKeyType_NativeEnum::AfterRead() { UBlackboardKeyType::AfterRead(); READ_PTR_FULL(EnumType, UEnum); } void UBlackboardKeyType_NativeEnum::BeforeDelete() { UBlackboardKeyType::BeforeDelete(); DELE_PTR_FULL(EnumType); } void UBlackboardKeyType_Object::AfterRead() { UBlackboardKeyType::AfterRead(); READ_PTR_FULL(BaseClass, UClass); } void UBlackboardKeyType_Object::BeforeDelete() { UBlackboardKeyType::BeforeDelete(); DELE_PTR_FULL(BaseClass); } void UBlackboardKeyType_Rotator::AfterRead() { UBlackboardKeyType::AfterRead(); } void UBlackboardKeyType_Rotator::BeforeDelete() { UBlackboardKeyType::BeforeDelete(); } void UBlackboardKeyType_String::AfterRead() { UBlackboardKeyType::AfterRead(); } void UBlackboardKeyType_String::BeforeDelete() { UBlackboardKeyType::BeforeDelete(); } void UBlackboardKeyType_Vector::AfterRead() { UBlackboardKeyType::AfterRead(); } void UBlackboardKeyType_Vector::BeforeDelete() { UBlackboardKeyType::BeforeDelete(); } void UBTNode::AfterRead() { UObject::AfterRead(); READ_PTR_FULL(TreeAsset, UBehaviorTree); READ_PTR_FULL(ParentNode, UBTCompositeNode); } void UBTNode::BeforeDelete() { UObject::BeforeDelete(); DELE_PTR_FULL(TreeAsset); DELE_PTR_FULL(ParentNode); } void UBTAuxiliaryNode::AfterRead() { UBTNode::AfterRead(); } void UBTAuxiliaryNode::BeforeDelete() { UBTNode::BeforeDelete(); } void UBTCompositeNode::AfterRead() { UBTNode::AfterRead(); } void UBTCompositeNode::BeforeDelete() { UBTNode::BeforeDelete(); } void UBTComposite_Selector::AfterRead() { UBTCompositeNode::AfterRead(); } void UBTComposite_Selector::BeforeDelete() { UBTCompositeNode::BeforeDelete(); } void UBTComposite_Sequence::AfterRead() { UBTCompositeNode::AfterRead(); } void UBTComposite_Sequence::BeforeDelete() { UBTCompositeNode::BeforeDelete(); } void UBTComposite_SimpleParallel::AfterRead() { UBTCompositeNode::AfterRead(); } void UBTComposite_SimpleParallel::BeforeDelete() { UBTCompositeNode::BeforeDelete(); } void UBTDecorator::AfterRead() { UBTAuxiliaryNode::AfterRead(); } void UBTDecorator::BeforeDelete() { UBTAuxiliaryNode::BeforeDelete(); } void UBTDecorator_BlackboardBase::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_BlackboardBase::BeforeDelete() { UBTDecorator::BeforeDelete(); } void UBTDecorator_Blackboard::AfterRead() { UBTDecorator_BlackboardBase::AfterRead(); } void UBTDecorator_Blackboard::BeforeDelete() { UBTDecorator_BlackboardBase::BeforeDelete(); } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.ReceiveTickAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float DeltaSeconds (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTDecorator_BlueprintBase::ReceiveTickAI(class AAIController* OwnerController, class APawn* ControlledPawn, float DeltaSeconds) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.ReceiveTickAI"); UBTDecorator_BlueprintBase_ReceiveTickAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; params.DeltaSeconds = DeltaSeconds; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.ReceiveTick // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float DeltaSeconds (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTDecorator_BlueprintBase::ReceiveTick(class AActor* OwnerActor, float DeltaSeconds) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.ReceiveTick"); UBTDecorator_BlueprintBase_ReceiveTick_Params params {}; params.OwnerActor = OwnerActor; params.DeltaSeconds = DeltaSeconds; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.ReceiveObserverDeactivatedAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTDecorator_BlueprintBase::ReceiveObserverDeactivatedAI(class AAIController* OwnerController, class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.ReceiveObserverDeactivatedAI"); UBTDecorator_BlueprintBase_ReceiveObserverDeactivatedAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.ReceiveObserverDeactivated // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTDecorator_BlueprintBase::ReceiveObserverDeactivated(class AActor* OwnerActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.ReceiveObserverDeactivated"); UBTDecorator_BlueprintBase_ReceiveObserverDeactivated_Params params {}; params.OwnerActor = OwnerActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.ReceiveObserverActivatedAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTDecorator_BlueprintBase::ReceiveObserverActivatedAI(class AAIController* OwnerController, class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.ReceiveObserverActivatedAI"); UBTDecorator_BlueprintBase_ReceiveObserverActivatedAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.ReceiveObserverActivated // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTDecorator_BlueprintBase::ReceiveObserverActivated(class AActor* OwnerActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.ReceiveObserverActivated"); UBTDecorator_BlueprintBase_ReceiveObserverActivated_Params params {}; params.OwnerActor = OwnerActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.ReceiveExecutionStartAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTDecorator_BlueprintBase::ReceiveExecutionStartAI(class AAIController* OwnerController, class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.ReceiveExecutionStartAI"); UBTDecorator_BlueprintBase_ReceiveExecutionStartAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.ReceiveExecutionStart // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTDecorator_BlueprintBase::ReceiveExecutionStart(class AActor* OwnerActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.ReceiveExecutionStart"); UBTDecorator_BlueprintBase_ReceiveExecutionStart_Params params {}; params.OwnerActor = OwnerActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.ReceiveExecutionFinishAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EBTNodeResult> NodeResult (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTDecorator_BlueprintBase::ReceiveExecutionFinishAI(class AAIController* OwnerController, class APawn* ControlledPawn, TEnumAsByte<AIModule_EBTNodeResult> NodeResult) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.ReceiveExecutionFinishAI"); UBTDecorator_BlueprintBase_ReceiveExecutionFinishAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; params.NodeResult = NodeResult; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.ReceiveExecutionFinish // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EBTNodeResult> NodeResult (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTDecorator_BlueprintBase::ReceiveExecutionFinish(class AActor* OwnerActor, TEnumAsByte<AIModule_EBTNodeResult> NodeResult) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.ReceiveExecutionFinish"); UBTDecorator_BlueprintBase_ReceiveExecutionFinish_Params params {}; params.OwnerActor = OwnerActor; params.NodeResult = NodeResult; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.PerformConditionCheckAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBTDecorator_BlueprintBase::PerformConditionCheckAI(class AAIController* OwnerController, class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.PerformConditionCheckAI"); UBTDecorator_BlueprintBase_PerformConditionCheckAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTDecorator_BlueprintBase.PerformConditionCheck // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBTDecorator_BlueprintBase::PerformConditionCheck(class AActor* OwnerActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.PerformConditionCheck"); UBTDecorator_BlueprintBase_PerformConditionCheck_Params params {}; params.OwnerActor = OwnerActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D640 // Name -> Function AIModule.BTDecorator_BlueprintBase.IsDecoratorObserverActive // Flags -> (Final, Native, Protected, BlueprintCallable, BlueprintPure, Const) // Parameters: // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBTDecorator_BlueprintBase::IsDecoratorObserverActive() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.IsDecoratorObserverActive"); UBTDecorator_BlueprintBase_IsDecoratorObserverActive_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F6D610 // Name -> Function AIModule.BTDecorator_BlueprintBase.IsDecoratorExecutionActive // Flags -> (Final, Native, Protected, BlueprintCallable, BlueprintPure, Const) // Parameters: // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBTDecorator_BlueprintBase::IsDecoratorExecutionActive() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTDecorator_BlueprintBase.IsDecoratorExecutionActive"); UBTDecorator_BlueprintBase_IsDecoratorExecutionActive_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UBTDecorator_BlueprintBase::AfterRead() { UBTDecorator::AfterRead(); READ_PTR_FULL(AIOwner, AAIController); READ_PTR_FULL(ActorOwner, AActor); } void UBTDecorator_BlueprintBase::BeforeDelete() { UBTDecorator::BeforeDelete(); DELE_PTR_FULL(AIOwner); DELE_PTR_FULL(ActorOwner); } void UBTDecorator_CheckGameplayTagsOnActor::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_CheckGameplayTagsOnActor::BeforeDelete() { UBTDecorator::BeforeDelete(); } void UBTDecorator_CompareBBEntries::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_CompareBBEntries::BeforeDelete() { UBTDecorator::BeforeDelete(); } void UBTDecorator_ConditionalLoop::AfterRead() { UBTDecorator_Blackboard::AfterRead(); } void UBTDecorator_ConditionalLoop::BeforeDelete() { UBTDecorator_Blackboard::BeforeDelete(); } void UBTDecorator_ConeCheck::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_ConeCheck::BeforeDelete() { UBTDecorator::BeforeDelete(); } void UBTDecorator_Cooldown::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_Cooldown::BeforeDelete() { UBTDecorator::BeforeDelete(); } void UBTDecorator_DoesPathExist::AfterRead() { UBTDecorator::AfterRead(); READ_PTR_FULL(FilterClass, UClass); } void UBTDecorator_DoesPathExist::BeforeDelete() { UBTDecorator::BeforeDelete(); DELE_PTR_FULL(FilterClass); } void UBTDecorator_ForceSuccess::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_ForceSuccess::BeforeDelete() { UBTDecorator::BeforeDelete(); } void UBTDecorator_IsAtLocation::AfterRead() { UBTDecorator_BlackboardBase::AfterRead(); } void UBTDecorator_IsAtLocation::BeforeDelete() { UBTDecorator_BlackboardBase::BeforeDelete(); } void UBTDecorator_IsBBEntryOfClass::AfterRead() { UBTDecorator_BlackboardBase::AfterRead(); READ_PTR_FULL(TestClass, UClass); } void UBTDecorator_IsBBEntryOfClass::BeforeDelete() { UBTDecorator_BlackboardBase::BeforeDelete(); DELE_PTR_FULL(TestClass); } void UBTDecorator_KeepInCone::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_KeepInCone::BeforeDelete() { UBTDecorator::BeforeDelete(); } void UBTDecorator_Loop::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_Loop::BeforeDelete() { UBTDecorator::BeforeDelete(); } void UBTDecorator_ReachedMoveGoal::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_ReachedMoveGoal::BeforeDelete() { UBTDecorator::BeforeDelete(); } void UBTDecorator_SetTagCooldown::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_SetTagCooldown::BeforeDelete() { UBTDecorator::BeforeDelete(); } void UBTDecorator_TagCooldown::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_TagCooldown::BeforeDelete() { UBTDecorator::BeforeDelete(); } void UBTDecorator_TimeLimit::AfterRead() { UBTDecorator::AfterRead(); } void UBTDecorator_TimeLimit::BeforeDelete() { UBTDecorator::BeforeDelete(); } // Function: // Offset -> 0x01D61D00 // Name -> Function AIModule.BTFunctionLibrary.StopUsingExternalEvent // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_StopUsingExternalEvent(class UBTNode* NodeOwner) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.StopUsingExternalEvent"); UBTFunctionLibrary_StopUsingExternalEvent_Params params {}; params.NodeOwner = NodeOwner; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01DF0FA0 // Name -> Function AIModule.BTFunctionLibrary.StartUsingExternalEvent // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* OwningActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_StartUsingExternalEvent(class UBTNode* NodeOwner, class AActor* OwningActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.StartUsingExternalEvent"); UBTFunctionLibrary_StartUsingExternalEvent_Params params {}; params.NodeOwner = NodeOwner; params.OwningActor = OwningActor; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F72460 // Name -> Function AIModule.BTFunctionLibrary.SetBlackboardValueAsVector // Flags -> (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // struct FVector Value (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_SetBlackboardValueAsVector(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key, const struct FVector& Value) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.SetBlackboardValueAsVector"); UBTFunctionLibrary_SetBlackboardValueAsVector_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; params.Value = Value; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F722E0 // Name -> Function AIModule.BTFunctionLibrary.SetBlackboardValueAsString // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // struct FString Value (Parm, ZeroConstructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_SetBlackboardValueAsString(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key, const struct FString& Value) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.SetBlackboardValueAsString"); UBTFunctionLibrary_SetBlackboardValueAsString_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; params.Value = Value; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F721A0 // Name -> Function AIModule.BTFunctionLibrary.SetBlackboardValueAsRotator // Flags -> (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // struct FRotator Value (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_SetBlackboardValueAsRotator(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key, const struct FRotator& Value) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.SetBlackboardValueAsRotator"); UBTFunctionLibrary_SetBlackboardValueAsRotator_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; params.Value = Value; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F72060 // Name -> Function AIModule.BTFunctionLibrary.SetBlackboardValueAsObject // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // class UObject* Value (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_SetBlackboardValueAsObject(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key, class UObject* Value) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.SetBlackboardValueAsObject"); UBTFunctionLibrary_SetBlackboardValueAsObject_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; params.Value = Value; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F71F20 // Name -> Function AIModule.BTFunctionLibrary.SetBlackboardValueAsName // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // struct FName Value (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_SetBlackboardValueAsName(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key, const struct FName& Value) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.SetBlackboardValueAsName"); UBTFunctionLibrary_SetBlackboardValueAsName_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; params.Value = Value; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F71DE0 // Name -> Function AIModule.BTFunctionLibrary.SetBlackboardValueAsInt // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // int Value (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_SetBlackboardValueAsInt(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key, int Value) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.SetBlackboardValueAsInt"); UBTFunctionLibrary_SetBlackboardValueAsInt_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; params.Value = Value; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F71CA0 // Name -> Function AIModule.BTFunctionLibrary.SetBlackboardValueAsFloat // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // float Value (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_SetBlackboardValueAsFloat(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key, float Value) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.SetBlackboardValueAsFloat"); UBTFunctionLibrary_SetBlackboardValueAsFloat_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; params.Value = Value; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F71B60 // Name -> Function AIModule.BTFunctionLibrary.SetBlackboardValueAsEnum // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // unsigned char Value (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_SetBlackboardValueAsEnum(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key, unsigned char Value) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.SetBlackboardValueAsEnum"); UBTFunctionLibrary_SetBlackboardValueAsEnum_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; params.Value = Value; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F71A20 // Name -> Function AIModule.BTFunctionLibrary.SetBlackboardValueAsClass // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // class UClass* Value (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_SetBlackboardValueAsClass(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key, class UClass* Value) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.SetBlackboardValueAsClass"); UBTFunctionLibrary_SetBlackboardValueAsClass_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; params.Value = Value; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F718E0 // Name -> Function AIModule.BTFunctionLibrary.SetBlackboardValueAsBool // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // bool Value (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_SetBlackboardValueAsBool(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key, bool Value) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.SetBlackboardValueAsBool"); UBTFunctionLibrary_SetBlackboardValueAsBool_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; params.Value = Value; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F717D0 // Name -> Function AIModule.BTFunctionLibrary.GetOwnersBlackboard // Flags -> (Final, Native, Static, Public, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UBlackboardComponent* ReturnValue (ExportObject, Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UBlackboardComponent* UBTFunctionLibrary::STATIC_GetOwnersBlackboard(class UBTNode* NodeOwner) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetOwnersBlackboard"); UBTFunctionLibrary_GetOwnersBlackboard_Params params {}; params.NodeOwner = NodeOwner; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F71750 // Name -> Function AIModule.BTFunctionLibrary.GetOwnerComponent // Flags -> (Final, Native, Static, Public, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UBehaviorTreeComponent* ReturnValue (ExportObject, Parm, OutParm, ZeroConstructor, ReturnParm, InstancedReference, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UBehaviorTreeComponent* UBTFunctionLibrary::STATIC_GetOwnerComponent(class UBTNode* NodeOwner) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetOwnerComponent"); UBTFunctionLibrary_GetOwnerComponent_Params params {}; params.NodeOwner = NodeOwner; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F71640 // Name -> Function AIModule.BTFunctionLibrary.GetBlackboardValueAsVector // Flags -> (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // struct FVector ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) struct FVector UBTFunctionLibrary::STATIC_GetBlackboardValueAsVector(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetBlackboardValueAsVector"); UBTFunctionLibrary_GetBlackboardValueAsVector_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F71500 // Name -> Function AIModule.BTFunctionLibrary.GetBlackboardValueAsString // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // struct FString ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, HasGetValueTypeHash, NativeAccessSpecifierPublic) struct FString UBTFunctionLibrary::STATIC_GetBlackboardValueAsString(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetBlackboardValueAsString"); UBTFunctionLibrary_GetBlackboardValueAsString_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F713F0 // Name -> Function AIModule.BTFunctionLibrary.GetBlackboardValueAsRotator // Flags -> (Final, Native, Static, Public, HasOutParms, HasDefaults, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // struct FRotator ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, NativeAccessSpecifierPublic) struct FRotator UBTFunctionLibrary::STATIC_GetBlackboardValueAsRotator(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetBlackboardValueAsRotator"); UBTFunctionLibrary_GetBlackboardValueAsRotator_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F712F0 // Name -> Function AIModule.BTFunctionLibrary.GetBlackboardValueAsObject // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // class UObject* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UObject* UBTFunctionLibrary::STATIC_GetBlackboardValueAsObject(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetBlackboardValueAsObject"); UBTFunctionLibrary_GetBlackboardValueAsObject_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F711F0 // Name -> Function AIModule.BTFunctionLibrary.GetBlackboardValueAsName // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // struct FName ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) struct FName UBTFunctionLibrary::STATIC_GetBlackboardValueAsName(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetBlackboardValueAsName"); UBTFunctionLibrary_GetBlackboardValueAsName_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F710F0 // Name -> Function AIModule.BTFunctionLibrary.GetBlackboardValueAsInt // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // int ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) int UBTFunctionLibrary::STATIC_GetBlackboardValueAsInt(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetBlackboardValueAsInt"); UBTFunctionLibrary_GetBlackboardValueAsInt_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F70FF0 // Name -> Function AIModule.BTFunctionLibrary.GetBlackboardValueAsFloat // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) float UBTFunctionLibrary::STATIC_GetBlackboardValueAsFloat(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetBlackboardValueAsFloat"); UBTFunctionLibrary_GetBlackboardValueAsFloat_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F70EF0 // Name -> Function AIModule.BTFunctionLibrary.GetBlackboardValueAsEnum // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // unsigned char ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) unsigned char UBTFunctionLibrary::STATIC_GetBlackboardValueAsEnum(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetBlackboardValueAsEnum"); UBTFunctionLibrary_GetBlackboardValueAsEnum_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F70DF0 // Name -> Function AIModule.BTFunctionLibrary.GetBlackboardValueAsClass // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // class UClass* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UClass* UBTFunctionLibrary::STATIC_GetBlackboardValueAsClass(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetBlackboardValueAsClass"); UBTFunctionLibrary_GetBlackboardValueAsClass_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F70CF0 // Name -> Function AIModule.BTFunctionLibrary.GetBlackboardValueAsBool // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBTFunctionLibrary::STATIC_GetBlackboardValueAsBool(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetBlackboardValueAsBool"); UBTFunctionLibrary_GetBlackboardValueAsBool_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F70BF0 // Name -> Function AIModule.BTFunctionLibrary.GetBlackboardValueAsActor // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable, BlueprintPure) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) // class AActor* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class AActor* UBTFunctionLibrary::STATIC_GetBlackboardValueAsActor(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.GetBlackboardValueAsActor"); UBTFunctionLibrary_GetBlackboardValueAsActor_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F70A50 // Name -> Function AIModule.BTFunctionLibrary.ClearBlackboardValueAsVector // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_ClearBlackboardValueAsVector(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.ClearBlackboardValueAsVector"); UBTFunctionLibrary_ClearBlackboardValueAsVector_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F70A50 // Name -> Function AIModule.BTFunctionLibrary.ClearBlackboardValue // Flags -> (Final, Native, Static, Public, HasOutParms, BlueprintCallable) // Parameters: // class UBTNode* NodeOwner (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FBlackboardKeySelector Key (ConstParm, Parm, OutParm, ReferenceParm, NativeAccessSpecifierPublic) void UBTFunctionLibrary::STATIC_ClearBlackboardValue(class UBTNode* NodeOwner, const struct FBlackboardKeySelector& Key) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTFunctionLibrary.ClearBlackboardValue"); UBTFunctionLibrary_ClearBlackboardValue_Params params {}; params.NodeOwner = NodeOwner; params.Key = Key; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UBTFunctionLibrary::AfterRead() { UBlueprintFunctionLibrary::AfterRead(); } void UBTFunctionLibrary::BeforeDelete() { UBlueprintFunctionLibrary::BeforeDelete(); } void UBTService::AfterRead() { UBTAuxiliaryNode::AfterRead(); } void UBTService::BeforeDelete() { UBTAuxiliaryNode::BeforeDelete(); } void UBTService_BlackboardBase::AfterRead() { UBTService::AfterRead(); } void UBTService_BlackboardBase::BeforeDelete() { UBTService::BeforeDelete(); } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTService_BlueprintBase.ReceiveTickAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float DeltaSeconds (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTService_BlueprintBase::ReceiveTickAI(class AAIController* OwnerController, class APawn* ControlledPawn, float DeltaSeconds) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTService_BlueprintBase.ReceiveTickAI"); UBTService_BlueprintBase_ReceiveTickAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; params.DeltaSeconds = DeltaSeconds; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTService_BlueprintBase.ReceiveTick // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float DeltaSeconds (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTService_BlueprintBase::ReceiveTick(class AActor* OwnerActor, float DeltaSeconds) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTService_BlueprintBase.ReceiveTick"); UBTService_BlueprintBase_ReceiveTick_Params params {}; params.OwnerActor = OwnerActor; params.DeltaSeconds = DeltaSeconds; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTService_BlueprintBase.ReceiveSearchStartAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTService_BlueprintBase::ReceiveSearchStartAI(class AAIController* OwnerController, class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTService_BlueprintBase.ReceiveSearchStartAI"); UBTService_BlueprintBase_ReceiveSearchStartAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTService_BlueprintBase.ReceiveSearchStart // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTService_BlueprintBase::ReceiveSearchStart(class AActor* OwnerActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTService_BlueprintBase.ReceiveSearchStart"); UBTService_BlueprintBase_ReceiveSearchStart_Params params {}; params.OwnerActor = OwnerActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTService_BlueprintBase.ReceiveDeactivationAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTService_BlueprintBase::ReceiveDeactivationAI(class AAIController* OwnerController, class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTService_BlueprintBase.ReceiveDeactivationAI"); UBTService_BlueprintBase_ReceiveDeactivationAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTService_BlueprintBase.ReceiveDeactivation // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTService_BlueprintBase::ReceiveDeactivation(class AActor* OwnerActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTService_BlueprintBase.ReceiveDeactivation"); UBTService_BlueprintBase_ReceiveDeactivation_Params params {}; params.OwnerActor = OwnerActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTService_BlueprintBase.ReceiveActivationAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTService_BlueprintBase::ReceiveActivationAI(class AAIController* OwnerController, class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTService_BlueprintBase.ReceiveActivationAI"); UBTService_BlueprintBase_ReceiveActivationAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTService_BlueprintBase.ReceiveActivation // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTService_BlueprintBase::ReceiveActivation(class AActor* OwnerActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTService_BlueprintBase.ReceiveActivation"); UBTService_BlueprintBase_ReceiveActivation_Params params {}; params.OwnerActor = OwnerActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F71850 // Name -> Function AIModule.BTService_BlueprintBase.IsServiceActive // Flags -> (Final, Native, Protected, BlueprintCallable, BlueprintPure, Const) // Parameters: // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBTService_BlueprintBase::IsServiceActive() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTService_BlueprintBase.IsServiceActive"); UBTService_BlueprintBase_IsServiceActive_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UBTService_BlueprintBase::AfterRead() { UBTService::AfterRead(); READ_PTR_FULL(AIOwner, AAIController); READ_PTR_FULL(ActorOwner, AActor); } void UBTService_BlueprintBase::BeforeDelete() { UBTService::BeforeDelete(); DELE_PTR_FULL(AIOwner); DELE_PTR_FULL(ActorOwner); } void UBTService_DefaultFocus::AfterRead() { UBTService_BlackboardBase::AfterRead(); } void UBTService_DefaultFocus::BeforeDelete() { UBTService_BlackboardBase::BeforeDelete(); } void UBTService_RunEQS::AfterRead() { UBTService_BlackboardBase::AfterRead(); } void UBTService_RunEQS::BeforeDelete() { UBTService_BlackboardBase::BeforeDelete(); } void UBTTaskNode::AfterRead() { UBTNode::AfterRead(); } void UBTTaskNode::BeforeDelete() { UBTNode::BeforeDelete(); } void UBTTask_BlackboardBase::AfterRead() { UBTTaskNode::AfterRead(); } void UBTTask_BlackboardBase::BeforeDelete() { UBTTaskNode::BeforeDelete(); } // Function: // Offset -> 0x01F72620 // Name -> Function AIModule.BTTask_BlueprintBase.SetFinishOnMessageWithId // Flags -> (Final, Native, Protected, BlueprintCallable) // Parameters: // struct FName MessageName (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // int RequestID (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTTask_BlueprintBase::SetFinishOnMessageWithId(const struct FName& MessageName, int RequestID) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.SetFinishOnMessageWithId"); UBTTask_BlueprintBase_SetFinishOnMessageWithId_Params params {}; params.MessageName = MessageName; params.RequestID = RequestID; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F725A0 // Name -> Function AIModule.BTTask_BlueprintBase.SetFinishOnMessage // Flags -> (Final, Native, Protected, BlueprintCallable) // Parameters: // struct FName MessageName (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTTask_BlueprintBase::SetFinishOnMessage(const struct FName& MessageName) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.SetFinishOnMessage"); UBTTask_BlueprintBase_SetFinishOnMessage_Params params {}; params.MessageName = MessageName; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTTask_BlueprintBase.ReceiveTickAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float DeltaSeconds (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTTask_BlueprintBase::ReceiveTickAI(class AAIController* OwnerController, class APawn* ControlledPawn, float DeltaSeconds) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.ReceiveTickAI"); UBTTask_BlueprintBase_ReceiveTickAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; params.DeltaSeconds = DeltaSeconds; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTTask_BlueprintBase.ReceiveTick // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float DeltaSeconds (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTTask_BlueprintBase::ReceiveTick(class AActor* OwnerActor, float DeltaSeconds) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.ReceiveTick"); UBTTask_BlueprintBase_ReceiveTick_Params params {}; params.OwnerActor = OwnerActor; params.DeltaSeconds = DeltaSeconds; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTTask_BlueprintBase.ReceiveExecuteAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTTask_BlueprintBase::ReceiveExecuteAI(class AAIController* OwnerController, class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.ReceiveExecuteAI"); UBTTask_BlueprintBase_ReceiveExecuteAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTTask_BlueprintBase.ReceiveExecute // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTTask_BlueprintBase::ReceiveExecute(class AActor* OwnerActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.ReceiveExecute"); UBTTask_BlueprintBase_ReceiveExecute_Params params {}; params.OwnerActor = OwnerActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTTask_BlueprintBase.ReceiveAbortAI // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class APawn* ControlledPawn (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTTask_BlueprintBase::ReceiveAbortAI(class AAIController* OwnerController, class APawn* ControlledPawn) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.ReceiveAbortAI"); UBTTask_BlueprintBase_ReceiveAbortAI_Params params {}; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.BTTask_BlueprintBase.ReceiveAbort // Flags -> (Event, Protected, BlueprintEvent) // Parameters: // class AActor* OwnerActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTTask_BlueprintBase::ReceiveAbort(class AActor* OwnerActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.ReceiveAbort"); UBTTask_BlueprintBase_ReceiveAbort_Params params {}; params.OwnerActor = OwnerActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F718B0 // Name -> Function AIModule.BTTask_BlueprintBase.IsTaskExecuting // Flags -> (Final, Native, Protected, BlueprintCallable, BlueprintPure, Const) // Parameters: // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBTTask_BlueprintBase::IsTaskExecuting() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.IsTaskExecuting"); UBTTask_BlueprintBase_IsTaskExecuting_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F71880 // Name -> Function AIModule.BTTask_BlueprintBase.IsTaskAborting // Flags -> (Final, Native, Protected, BlueprintCallable, BlueprintPure, Const) // Parameters: // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UBTTask_BlueprintBase::IsTaskAborting() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.IsTaskAborting"); UBTTask_BlueprintBase_IsTaskAborting_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F70B60 // Name -> Function AIModule.BTTask_BlueprintBase.FinishExecute // Flags -> (Final, Native, Protected, BlueprintCallable) // Parameters: // bool bSuccess (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UBTTask_BlueprintBase::FinishExecute(bool bSuccess) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.FinishExecute"); UBTTask_BlueprintBase_FinishExecute_Params params {}; params.bSuccess = bSuccess; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F70B40 // Name -> Function AIModule.BTTask_BlueprintBase.FinishAbort // Flags -> (Final, Native, Protected, BlueprintCallable) void UBTTask_BlueprintBase::FinishAbort() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.BTTask_BlueprintBase.FinishAbort"); UBTTask_BlueprintBase_FinishAbort_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UBTTask_BlueprintBase::AfterRead() { UBTTaskNode::AfterRead(); READ_PTR_FULL(AIOwner, AAIController); READ_PTR_FULL(ActorOwner, AActor); } void UBTTask_BlueprintBase::BeforeDelete() { UBTTaskNode::BeforeDelete(); DELE_PTR_FULL(AIOwner); DELE_PTR_FULL(ActorOwner); } void UBTTask_FinishWithResult::AfterRead() { UBTTaskNode::AfterRead(); } void UBTTask_FinishWithResult::BeforeDelete() { UBTTaskNode::BeforeDelete(); } void UBTTask_GameplayTaskBase::AfterRead() { UBTTaskNode::AfterRead(); } void UBTTask_GameplayTaskBase::BeforeDelete() { UBTTaskNode::BeforeDelete(); } void UBTTask_MakeNoise::AfterRead() { UBTTaskNode::AfterRead(); } void UBTTask_MakeNoise::BeforeDelete() { UBTTaskNode::BeforeDelete(); } void UBTTask_MoveTo::AfterRead() { UBTTask_BlackboardBase::AfterRead(); READ_PTR_FULL(FilterClass, UClass); } void UBTTask_MoveTo::BeforeDelete() { UBTTask_BlackboardBase::BeforeDelete(); DELE_PTR_FULL(FilterClass); } void UBTTask_MoveDirectlyToward::AfterRead() { UBTTask_MoveTo::AfterRead(); } void UBTTask_MoveDirectlyToward::BeforeDelete() { UBTTask_MoveTo::BeforeDelete(); } void UBTTask_PawnActionBase::AfterRead() { UBTTaskNode::AfterRead(); } void UBTTask_PawnActionBase::BeforeDelete() { UBTTaskNode::BeforeDelete(); } void UBTTask_PlayAnimation::AfterRead() { UBTTaskNode::AfterRead(); READ_PTR_FULL(AnimationToPlay, UAnimationAsset); READ_PTR_FULL(MyOwnerComp, UBehaviorTreeComponent); READ_PTR_FULL(CachedSkelMesh, USkeletalMeshComponent); } void UBTTask_PlayAnimation::BeforeDelete() { UBTTaskNode::BeforeDelete(); DELE_PTR_FULL(AnimationToPlay); DELE_PTR_FULL(MyOwnerComp); DELE_PTR_FULL(CachedSkelMesh); } void UBTTask_PlaySound::AfterRead() { UBTTaskNode::AfterRead(); READ_PTR_FULL(SoundToPlay, USoundCue); } void UBTTask_PlaySound::BeforeDelete() { UBTTaskNode::BeforeDelete(); DELE_PTR_FULL(SoundToPlay); } void UBTTask_PushPawnAction::AfterRead() { UBTTask_PawnActionBase::AfterRead(); READ_PTR_FULL(Action, UPawnAction); } void UBTTask_PushPawnAction::BeforeDelete() { UBTTask_PawnActionBase::BeforeDelete(); DELE_PTR_FULL(Action); } void UBTTask_RotateToFaceBBEntry::AfterRead() { UBTTask_BlackboardBase::AfterRead(); } void UBTTask_RotateToFaceBBEntry::BeforeDelete() { UBTTask_BlackboardBase::BeforeDelete(); } void UBTTask_RunBehavior::AfterRead() { UBTTaskNode::AfterRead(); READ_PTR_FULL(BehaviorAsset, UBehaviorTree); } void UBTTask_RunBehavior::BeforeDelete() { UBTTaskNode::BeforeDelete(); DELE_PTR_FULL(BehaviorAsset); } void UBTTask_RunBehaviorDynamic::AfterRead() { UBTTaskNode::AfterRead(); READ_PTR_FULL(DefaultBehaviorAsset, UBehaviorTree); READ_PTR_FULL(BehaviorAsset, UBehaviorTree); } void UBTTask_RunBehaviorDynamic::BeforeDelete() { UBTTaskNode::BeforeDelete(); DELE_PTR_FULL(DefaultBehaviorAsset); DELE_PTR_FULL(BehaviorAsset); } void UBTTask_RunEQSQuery::AfterRead() { UBTTask_BlackboardBase::AfterRead(); READ_PTR_FULL(QueryTemplate, UEnvQuery); } void UBTTask_RunEQSQuery::BeforeDelete() { UBTTask_BlackboardBase::BeforeDelete(); DELE_PTR_FULL(QueryTemplate); } void UBTTask_SetTagCooldown::AfterRead() { UBTTaskNode::AfterRead(); } void UBTTask_SetTagCooldown::BeforeDelete() { UBTTaskNode::BeforeDelete(); } void UBTTask_Wait::AfterRead() { UBTTaskNode::AfterRead(); } void UBTTask_Wait::BeforeDelete() { UBTTaskNode::BeforeDelete(); } void UBTTask_WaitBlackboardTime::AfterRead() { UBTTask_Wait::AfterRead(); } void UBTTask_WaitBlackboardTime::BeforeDelete() { UBTTask_Wait::BeforeDelete(); } void UCrowdAgentInterface::AfterRead() { UInterface::AfterRead(); } void UCrowdAgentInterface::BeforeDelete() { UInterface::BeforeDelete(); } // Function: // Offset -> 0x01F75FB0 // Name -> Function AIModule.CrowdFollowingComponent.SuspendCrowdSteering // Flags -> (Native, Public, BlueprintCallable) // Parameters: // bool bSuspend (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UCrowdFollowingComponent::SuspendCrowdSteering(bool bSuspend) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.CrowdFollowingComponent.SuspendCrowdSteering"); UCrowdFollowingComponent_SuspendCrowdSteering_Params params {}; params.bSuspend = bSuspend; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UCrowdFollowingComponent::AfterRead() { UPathFollowingComponent::AfterRead(); READ_PTR_FULL(CharacterMovement, UCharacterMovementComponent); } void UCrowdFollowingComponent::BeforeDelete() { UPathFollowingComponent::BeforeDelete(); DELE_PTR_FULL(CharacterMovement); } void UCrowdManager::AfterRead() { UCrowdManagerBase::AfterRead(); READ_PTR_FULL(MyNavData, ANavigationData); } void UCrowdManager::BeforeDelete() { UCrowdManagerBase::BeforeDelete(); DELE_PTR_FULL(MyNavData); } void ADetourCrowdAIController::AfterRead() { AAIController::AfterRead(); } void ADetourCrowdAIController::BeforeDelete() { AAIController::BeforeDelete(); } void UEnvQuery::AfterRead() { UDataAsset::AfterRead(); } void UEnvQuery::BeforeDelete() { UDataAsset::BeforeDelete(); } void UEnvQueryContext::AfterRead() { UObject::AfterRead(); } void UEnvQueryContext::BeforeDelete() { UObject::BeforeDelete(); } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.EnvQueryContext_BlueprintBase.ProvideSingleLocation // Flags -> (Event, Public, HasOutParms, HasDefaults, BlueprintEvent, Const) // Parameters: // class UObject* QuerierObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* QuerierActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // struct FVector ResultingLocation (Parm, OutParm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UEnvQueryContext_BlueprintBase::ProvideSingleLocation(class UObject* QuerierObject, class AActor* QuerierActor, struct FVector* ResultingLocation) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryContext_BlueprintBase.ProvideSingleLocation"); UEnvQueryContext_BlueprintBase_ProvideSingleLocation_Params params {}; params.QuerierObject = QuerierObject; params.QuerierActor = QuerierActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (ResultingLocation != nullptr) *ResultingLocation = params.ResultingLocation; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.EnvQueryContext_BlueprintBase.ProvideSingleActor // Flags -> (Event, Public, HasOutParms, BlueprintEvent, Const) // Parameters: // class UObject* QuerierObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* QuerierActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* ResultingActor (Parm, OutParm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UEnvQueryContext_BlueprintBase::ProvideSingleActor(class UObject* QuerierObject, class AActor* QuerierActor, class AActor** ResultingActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryContext_BlueprintBase.ProvideSingleActor"); UEnvQueryContext_BlueprintBase_ProvideSingleActor_Params params {}; params.QuerierObject = QuerierObject; params.QuerierActor = QuerierActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (ResultingActor != nullptr) *ResultingActor = params.ResultingActor; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.EnvQueryContext_BlueprintBase.ProvideLocationsSet // Flags -> (Event, Public, HasOutParms, BlueprintEvent, Const) // Parameters: // class UObject* QuerierObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* QuerierActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TArray<struct FVector> ResultingLocationSet (Parm, OutParm, ZeroConstructor, NativeAccessSpecifierPublic) void UEnvQueryContext_BlueprintBase::ProvideLocationsSet(class UObject* QuerierObject, class AActor* QuerierActor, TArray<struct FVector>* ResultingLocationSet) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryContext_BlueprintBase.ProvideLocationsSet"); UEnvQueryContext_BlueprintBase_ProvideLocationsSet_Params params {}; params.QuerierObject = QuerierObject; params.QuerierActor = QuerierActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (ResultingLocationSet != nullptr) *ResultingLocationSet = params.ResultingLocationSet; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.EnvQueryContext_BlueprintBase.ProvideActorsSet // Flags -> (Event, Public, HasOutParms, BlueprintEvent, Const) // Parameters: // class UObject* QuerierObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class AActor* QuerierActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TArray<class AActor*> ResultingActorsSet (Parm, OutParm, ZeroConstructor, NativeAccessSpecifierPublic) void UEnvQueryContext_BlueprintBase::ProvideActorsSet(class UObject* QuerierObject, class AActor* QuerierActor, TArray<class AActor*>* ResultingActorsSet) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryContext_BlueprintBase.ProvideActorsSet"); UEnvQueryContext_BlueprintBase_ProvideActorsSet_Params params {}; params.QuerierObject = QuerierObject; params.QuerierActor = QuerierActor; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (ResultingActorsSet != nullptr) *ResultingActorsSet = params.ResultingActorsSet; } void UEnvQueryContext_BlueprintBase::AfterRead() { UEnvQueryContext::AfterRead(); } void UEnvQueryContext_BlueprintBase::BeforeDelete() { UEnvQueryContext::BeforeDelete(); } void UEnvQueryContext_Item::AfterRead() { UEnvQueryContext::AfterRead(); } void UEnvQueryContext_Item::BeforeDelete() { UEnvQueryContext::BeforeDelete(); } void UEnvQueryContext_Querier::AfterRead() { UEnvQueryContext::AfterRead(); } void UEnvQueryContext_Querier::BeforeDelete() { UEnvQueryContext::BeforeDelete(); } void UEnvQueryDebugHelpers::AfterRead() { UObject::AfterRead(); } void UEnvQueryDebugHelpers::BeforeDelete() { UObject::BeforeDelete(); } void UEnvQueryGenerator::AfterRead() { UEnvQueryNode::AfterRead(); READ_PTR_FULL(itemType, UClass); } void UEnvQueryGenerator::BeforeDelete() { UEnvQueryNode::BeforeDelete(); DELE_PTR_FULL(itemType); } void UEnvQueryGenerator_ActorsOfClass::AfterRead() { UEnvQueryGenerator::AfterRead(); READ_PTR_FULL(SearchedActorClass, UClass); READ_PTR_FULL(SearchCenter, UClass); } void UEnvQueryGenerator_ActorsOfClass::BeforeDelete() { UEnvQueryGenerator::BeforeDelete(); DELE_PTR_FULL(SearchedActorClass); DELE_PTR_FULL(SearchCenter); } // Function: // Offset -> 0x01F75C30 // Name -> Function AIModule.EnvQueryGenerator_BlueprintBase.GetQuerier // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // class UObject* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UObject* UEnvQueryGenerator_BlueprintBase::GetQuerier() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryGenerator_BlueprintBase.GetQuerier"); UEnvQueryGenerator_BlueprintBase_GetQuerier_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x00B73C40 // Name -> Function AIModule.EnvQueryGenerator_BlueprintBase.DoItemGeneration // Flags -> (Event, Public, HasOutParms, BlueprintEvent, Const) // Parameters: // TArray<struct FVector> ContextLocations (ConstParm, Parm, OutParm, ZeroConstructor, ReferenceParm, NativeAccessSpecifierPublic) void UEnvQueryGenerator_BlueprintBase::DoItemGeneration(TArray<struct FVector> ContextLocations) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryGenerator_BlueprintBase.DoItemGeneration"); UEnvQueryGenerator_BlueprintBase_DoItemGeneration_Params params {}; params.ContextLocations = ContextLocations; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F75B10 // Name -> Function AIModule.EnvQueryGenerator_BlueprintBase.AddGeneratedVector // Flags -> (Final, Native, Public, HasDefaults, BlueprintCallable, Const) // Parameters: // struct FVector GeneratedVector (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UEnvQueryGenerator_BlueprintBase::AddGeneratedVector(const struct FVector& GeneratedVector) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryGenerator_BlueprintBase.AddGeneratedVector"); UEnvQueryGenerator_BlueprintBase_AddGeneratedVector_Params params {}; params.GeneratedVector = GeneratedVector; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F75A90 // Name -> Function AIModule.EnvQueryGenerator_BlueprintBase.AddGeneratedActor // Flags -> (Final, Native, Public, BlueprintCallable, Const) // Parameters: // class AActor* GeneratedActor (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UEnvQueryGenerator_BlueprintBase::AddGeneratedActor(class AActor* GeneratedActor) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryGenerator_BlueprintBase.AddGeneratedActor"); UEnvQueryGenerator_BlueprintBase_AddGeneratedActor_Params params {}; params.GeneratedActor = GeneratedActor; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UEnvQueryGenerator_BlueprintBase::AfterRead() { UEnvQueryGenerator::AfterRead(); READ_PTR_FULL(Context, UClass); READ_PTR_FULL(GeneratedItemType, UClass); } void UEnvQueryGenerator_BlueprintBase::BeforeDelete() { UEnvQueryGenerator::BeforeDelete(); DELE_PTR_FULL(Context); DELE_PTR_FULL(GeneratedItemType); } void UEnvQueryGenerator_Composite::AfterRead() { UEnvQueryGenerator::AfterRead(); READ_PTR_FULL(ForcedItemType, UClass); } void UEnvQueryGenerator_Composite::BeforeDelete() { UEnvQueryGenerator::BeforeDelete(); DELE_PTR_FULL(ForcedItemType); } void UEnvQueryGenerator_ProjectedPoints::AfterRead() { UEnvQueryGenerator::AfterRead(); } void UEnvQueryGenerator_ProjectedPoints::BeforeDelete() { UEnvQueryGenerator::BeforeDelete(); } void UEnvQueryGenerator_Cone::AfterRead() { UEnvQueryGenerator_ProjectedPoints::AfterRead(); READ_PTR_FULL(CenterActor, UClass); } void UEnvQueryGenerator_Cone::BeforeDelete() { UEnvQueryGenerator_ProjectedPoints::BeforeDelete(); DELE_PTR_FULL(CenterActor); } void UEnvQueryGenerator_CurrentLocation::AfterRead() { UEnvQueryGenerator::AfterRead(); READ_PTR_FULL(QueryContext, UClass); } void UEnvQueryGenerator_CurrentLocation::BeforeDelete() { UEnvQueryGenerator::BeforeDelete(); DELE_PTR_FULL(QueryContext); } void UEnvQueryGenerator_Donut::AfterRead() { UEnvQueryGenerator_ProjectedPoints::AfterRead(); READ_PTR_FULL(Center, UClass); } void UEnvQueryGenerator_Donut::BeforeDelete() { UEnvQueryGenerator_ProjectedPoints::BeforeDelete(); DELE_PTR_FULL(Center); } void UEnvQueryGenerator_OnCircle::AfterRead() { UEnvQueryGenerator_ProjectedPoints::AfterRead(); READ_PTR_FULL(CircleCenter, UClass); } void UEnvQueryGenerator_OnCircle::BeforeDelete() { UEnvQueryGenerator_ProjectedPoints::BeforeDelete(); DELE_PTR_FULL(CircleCenter); } void UEnvQueryGenerator_SimpleGrid::AfterRead() { UEnvQueryGenerator_ProjectedPoints::AfterRead(); READ_PTR_FULL(GenerateAround, UClass); } void UEnvQueryGenerator_SimpleGrid::BeforeDelete() { UEnvQueryGenerator_ProjectedPoints::BeforeDelete(); DELE_PTR_FULL(GenerateAround); } void UEnvQueryGenerator_PathingGrid::AfterRead() { UEnvQueryGenerator_SimpleGrid::AfterRead(); READ_PTR_FULL(NavigationFilter, UClass); } void UEnvQueryGenerator_PathingGrid::BeforeDelete() { UEnvQueryGenerator_SimpleGrid::BeforeDelete(); DELE_PTR_FULL(NavigationFilter); } // Function: // Offset -> 0x01F75EE0 // Name -> Function AIModule.EnvQueryInstanceBlueprintWrapper.SetNamedParam // Flags -> (Final, Native, Public, BlueprintCallable) // Parameters: // struct FName ParamName (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float Value (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UEnvQueryInstanceBlueprintWrapper::SetNamedParam(const struct FName& ParamName, float Value) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryInstanceBlueprintWrapper.SetNamedParam"); UEnvQueryInstanceBlueprintWrapper_SetNamedParam_Params params {}; params.ParamName = ParamName; params.Value = Value; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function: // Offset -> 0x01F75E60 // Name -> Function AIModule.EnvQueryInstanceBlueprintWrapper.GetResultsAsLocations // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // TArray<struct FVector> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, NativeAccessSpecifierPublic) TArray<struct FVector> UEnvQueryInstanceBlueprintWrapper::GetResultsAsLocations() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryInstanceBlueprintWrapper.GetResultsAsLocations"); UEnvQueryInstanceBlueprintWrapper_GetResultsAsLocations_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F75DE0 // Name -> Function AIModule.EnvQueryInstanceBlueprintWrapper.GetResultsAsActors // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // TArray<class AActor*> ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, NativeAccessSpecifierPublic) TArray<class AActor*> UEnvQueryInstanceBlueprintWrapper::GetResultsAsActors() { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryInstanceBlueprintWrapper.GetResultsAsActors"); UEnvQueryInstanceBlueprintWrapper_GetResultsAsActors_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x01F75D20 // Name -> Function AIModule.EnvQueryInstanceBlueprintWrapper.GetQueryResultsAsLocations // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, Const) // Parameters: // TArray<struct FVector> ResultLocations (Parm, OutParm, ZeroConstructor, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UEnvQueryInstanceBlueprintWrapper::GetQueryResultsAsLocations(TArray<struct FVector>* ResultLocations) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryInstanceBlueprintWrapper.GetQueryResultsAsLocations"); UEnvQueryInstanceBlueprintWrapper_GetQueryResultsAsLocations_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (ResultLocations != nullptr) *ResultLocations = params.ResultLocations; return params.ReturnValue; } // Function: // Offset -> 0x01F75C60 // Name -> Function AIModule.EnvQueryInstanceBlueprintWrapper.GetQueryResultsAsActors // Flags -> (Final, Native, Public, HasOutParms, BlueprintCallable, Const) // Parameters: // TArray<class AActor*> ResultActors (Parm, OutParm, ZeroConstructor, NativeAccessSpecifierPublic) // bool ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) bool UEnvQueryInstanceBlueprintWrapper::GetQueryResultsAsActors(TArray<class AActor*>* ResultActors) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryInstanceBlueprintWrapper.GetQueryResultsAsActors"); UEnvQueryInstanceBlueprintWrapper_GetQueryResultsAsActors_Params params {}; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; if (ResultActors != nullptr) *ResultActors = params.ResultActors; return params.ReturnValue; } // Function: // Offset -> 0x01F75BA0 // Name -> Function AIModule.EnvQueryInstanceBlueprintWrapper.GetItemScore // Flags -> (Final, Native, Public, BlueprintCallable, BlueprintPure, Const) // Parameters: // int ItemIndex (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // float ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) float UEnvQueryInstanceBlueprintWrapper::GetItemScore(int ItemIndex) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryInstanceBlueprintWrapper.GetItemScore"); UEnvQueryInstanceBlueprintWrapper_GetItemScore_Params params {}; params.ItemIndex = ItemIndex; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } // Function: // Offset -> 0x00B73C40 // Name -> DelegateFunction AIModule.EnvQueryInstanceBlueprintWrapper.EQSQueryDoneSignature__DelegateSignature // Flags -> (MulticastDelegate, Public, Delegate) // Parameters: // class UEnvQueryInstanceBlueprintWrapper* QueryInstance (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EEnvQueryStatus> QueryStatus (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) void UEnvQueryInstanceBlueprintWrapper::EQSQueryDoneSignature__DelegateSignature(class UEnvQueryInstanceBlueprintWrapper* QueryInstance, TEnumAsByte<AIModule_EEnvQueryStatus> QueryStatus) { static UFunction* fn = UObject::FindObject<UFunction>("DelegateFunction AIModule.EnvQueryInstanceBlueprintWrapper.EQSQueryDoneSignature__DelegateSignature"); UEnvQueryInstanceBlueprintWrapper_EQSQueryDoneSignature__DelegateSignature_Params params {}; params.QueryInstance = QueryInstance; params.QueryStatus = QueryStatus; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } void UEnvQueryInstanceBlueprintWrapper::AfterRead() { UObject::AfterRead(); READ_PTR_FULL(itemType, UClass); } void UEnvQueryInstanceBlueprintWrapper::BeforeDelete() { UObject::BeforeDelete(); DELE_PTR_FULL(itemType); } void UEnvQueryItemType::AfterRead() { UObject::AfterRead(); } void UEnvQueryItemType::BeforeDelete() { UObject::BeforeDelete(); } void UEnvQueryItemType_VectorBase::AfterRead() { UEnvQueryItemType::AfterRead(); } void UEnvQueryItemType_VectorBase::BeforeDelete() { UEnvQueryItemType::BeforeDelete(); } void UEnvQueryItemType_ActorBase::AfterRead() { UEnvQueryItemType_VectorBase::AfterRead(); } void UEnvQueryItemType_ActorBase::BeforeDelete() { UEnvQueryItemType_VectorBase::BeforeDelete(); } void UEnvQueryItemType_Actor::AfterRead() { UEnvQueryItemType_ActorBase::AfterRead(); } void UEnvQueryItemType_Actor::BeforeDelete() { UEnvQueryItemType_ActorBase::BeforeDelete(); } void UEnvQueryItemType_Direction::AfterRead() { UEnvQueryItemType_VectorBase::AfterRead(); } void UEnvQueryItemType_Direction::BeforeDelete() { UEnvQueryItemType_VectorBase::BeforeDelete(); } void UEnvQueryItemType_Point::AfterRead() { UEnvQueryItemType_VectorBase::AfterRead(); } void UEnvQueryItemType_Point::BeforeDelete() { UEnvQueryItemType_VectorBase::BeforeDelete(); } // Function: // Offset -> 0x01F7A0B0 // Name -> Function AIModule.EnvQueryManager.RunEQSQuery // Flags -> (Final, Native, Static, Public, BlueprintCallable) // Parameters: // class UObject* WorldContextObject (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UEnvQuery* QueryTemplate (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UObject* Querier (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // TEnumAsByte<AIModule_EEnvQueryRunMode> RunMode (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UClass* WrapperClass (Parm, ZeroConstructor, IsPlainOldData, NoDestructor, AdvancedDisplay, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic) // class UEnvQueryInstanceBlueprintWrapper* ReturnValue (Parm, OutParm, ZeroConstructor, ReturnParm, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic) class UEnvQueryInstanceBlueprintWrapper* UEnvQueryManager::STATIC_RunEQSQuery(class UObject* WorldContextObject, class UEnvQuery* QueryTemplate, class UObject* Querier, TEnumAsByte<AIModule_EEnvQueryRunMode> RunMode, class UClass* WrapperClass) { static UFunction* fn = UObject::FindObject<UFunction>("Function AIModule.EnvQueryManager.RunEQSQuery"); UEnvQueryManager_RunEQSQuery_Params params {}; params.WorldContextObject = WorldContextObject; params.QueryTemplate = QueryTemplate; params.Querier = Querier; params.RunMode = RunMode; params.WrapperClass = WrapperClass; auto flags = fn->FunctionFlags; fn->FunctionFlags |= 0x00000400; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; return params.ReturnValue; } void UEnvQueryManager::AfterRead() { UAISubsystem::AfterRead(); } void UEnvQueryManager::BeforeDelete() { UAISubsystem::BeforeDelete(); } void UEnvQueryOption::AfterRead() { UObject::AfterRead(); READ_PTR_FULL(Generator, UEnvQueryGenerator); } void UEnvQueryOption::BeforeDelete() { UObject::BeforeDelete(); DELE_PTR_FULL(Generator); } void UEnvQueryTest_Distance::AfterRead() { UEnvQueryTest::AfterRead(); READ_PTR_FULL(DistanceTo, UClass); } void UEnvQueryTest_Distance::BeforeDelete() { UEnvQueryTest::BeforeDelete(); DELE_PTR_FULL(DistanceTo); } void UEnvQueryTest_Dot::AfterRead() { UEnvQueryTest::AfterRead(); } void UEnvQueryTest_Dot::BeforeDelete() { UEnvQueryTest::BeforeDelete(); } } #ifdef _MSC_VER #pragma pack(pop) #endif
36.7815
350
0.689304
ResaloliPT
20c8ee434e3d61bfed242485685487def4f3d90c
21,599
cpp
C++
src/modules/hip/kernel/canny_edge_detector.cpp
shobana-mcw/rpp
e4a5eb622b9abd0a5a936bf7174a84a5e2470b59
[ "MIT" ]
26
2019-09-04T17:48:41.000Z
2022-02-23T17:04:24.000Z
src/modules/hip/kernel/canny_edge_detector.cpp
shobana-mcw/rpp
e4a5eb622b9abd0a5a936bf7174a84a5e2470b59
[ "MIT" ]
57
2019-09-06T21:37:34.000Z
2022-03-09T02:13:46.000Z
src/modules/hip/kernel/canny_edge_detector.cpp
shobana-mcw/rpp
e4a5eb622b9abd0a5a936bf7174a84a5e2470b59
[ "MIT" ]
24
2019-09-04T23:12:07.000Z
2022-03-30T02:06:22.000Z
#include <hip/hip_runtime.h> #include "rpp_hip_host_decls.hpp" #define RPPABS(a) ((a < 0) ? (-a) : (a)) #define saturate_8u(value) ((value) > 255 ? 255 : ((value) < 0 ? 0 : (value))) extern "C" __global__ void canny_ced_pln3_to_pln1(unsigned char *input, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; if (id_x >= width || id_y >= height) { return; } int IPpixIdx = id_x + id_y * width; int ch = height * width; float value = ((input[IPpixIdx] + input[IPpixIdx + ch] + input[IPpixIdx + ch * 2]) / 3); output[IPpixIdx] = (unsigned char)value; } extern "C" __global__ void canny_ced_pkd3_to_pln1(unsigned char *input, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; if (id_x >= width || id_y >= height) { return; } int OPpixIdx = id_x + id_y * width; int IPpixIdx = id_x * channel + id_y * width * channel; float value = (input[IPpixIdx] + input[IPpixIdx + 1] + input[IPpixIdx + 2]) / 3; output[OPpixIdx] = (unsigned char)value; } extern "C" __global__ void canny_ced_pln1_to_pln3(unsigned char *input, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; if (id_x >= width || id_y >= height) { return; } int IPpixIdx = id_x + id_y * width; int ch = height * width; output[IPpixIdx] = input[IPpixIdx]; output[IPpixIdx + ch] = input[IPpixIdx]; output[IPpixIdx + ch * 2] = input[IPpixIdx]; } extern "C" __global__ void canny_ced_pln1_to_pkd3(unsigned char *input, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; if (id_x >= width || id_y >= height) { return; } int IPpixIdx = id_x + id_y * width; int OPpixIdx = id_x * channel + id_y * width * channel; output[OPpixIdx] = input[IPpixIdx]; output[OPpixIdx + 1] = input[IPpixIdx]; output[OPpixIdx + 2] = input[IPpixIdx]; } extern "C" __global__ void ced_pln3_to_pln1_batch(unsigned char *input, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel, const unsigned long batchIndex) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; if (id_x >= width || id_y >= height) { return; } unsigned long IPpixIdx = (unsigned long)batchIndex + (unsigned long)id_x + (unsigned long)id_y * (unsigned long)width; unsigned long OPpixIdx = (unsigned long)id_x + (unsigned long)id_y * (unsigned long)width; int ch = height * width; float value = ((input[IPpixIdx] + input[IPpixIdx + ch] + input[IPpixIdx + ch * 2]) / 3); output[OPpixIdx] = (unsigned char)value; } extern "C" __global__ void ced_pkd3_to_pln1_batch(unsigned char *input, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel, const unsigned long batchIndex) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; if (id_x >= width || id_y >= height) { return; } unsigned long OPpixIdx = (unsigned long)id_x + (unsigned long)id_y * (unsigned long)width; unsigned long IPpixIdx = (unsigned long)batchIndex + (unsigned long)id_x * (unsigned long)channel + (unsigned long)id_y * (unsigned long)width * (unsigned long)channel; float value = (input[IPpixIdx] + input[IPpixIdx + 1] + input[IPpixIdx + 2]) / 3; output[OPpixIdx] = (unsigned char)value; } extern "C" __global__ void ced_pln1_to_pln3_batch(unsigned char *input, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel, const unsigned long batchIndex) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; if (id_x >= width || id_y >= height) { return; } unsigned long IPpixIdx = (unsigned long)id_x + (unsigned long)id_y * (unsigned long)width; unsigned long OPpixIdx = (unsigned long)batchIndex + (unsigned long)id_x + (unsigned long)id_y * (unsigned long)width; int ch = height * width; output[OPpixIdx] = input[IPpixIdx]; output[OPpixIdx + ch] = input[IPpixIdx]; output[OPpixIdx + ch * 2] = input[IPpixIdx]; } extern "C" __global__ void ced_pln1_to_pkd3_batch(unsigned char *input, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel, const unsigned long batchIndex) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; if (id_x >= width || id_y >= height) { return; } unsigned long IPpixIdx = (unsigned long)id_x + (unsigned long)id_y * (unsigned long)width; unsigned long OPpixIdx = (unsigned long)batchIndex + (unsigned long)id_x * (unsigned long)channel + (unsigned long)id_y * (unsigned long)width * (unsigned long)channel; output[OPpixIdx] = input[IPpixIdx]; output[OPpixIdx + 1] = input[IPpixIdx]; output[OPpixIdx + 2] = input[IPpixIdx]; } extern "C" __global__ void ced_non_max_suppression(unsigned char *input, unsigned char *input1, unsigned char *input2, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel, const unsigned char min, const unsigned char max) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; int id_z = hipBlockIdx_z * hipBlockDim_z + hipThreadIdx_z; if (id_x >= width || id_y >= height || id_z >= channel) { return; } int pixIdx = id_y * channel * width + id_x * channel + id_z; float gradient = atan((float)input1[pixIdx] / (float)input2[pixIdx]); unsigned char pixel1, pixel2; if (RPPABS(gradient) > 1.178097) { if(id_x != 0) pixel1 = input[pixIdx - 1]; else pixel1 = 0; if(id_x != width - 1) pixel2 = input[pixIdx + 1]; else pixel2 = 0; } else if (gradient > 0.392699) { if(id_x != 0 && id_y !=0) pixel1 = input[pixIdx - width - 1]; else pixel1 = 0; if(id_x != width - 1 && id_y != height - 1) pixel2 = input[pixIdx + width + 1]; else pixel2 = 0; } else if (gradient < -0.392699) { if(id_x != width - 1 && id_y !=0) pixel1 = input[pixIdx - width + 1]; else pixel1 = 0; if(id_x != 0 && id_y != height - 1) pixel2 = input[pixIdx + width - 1]; else pixel2 = 0; } else { if(id_y != 0) pixel1 = input[pixIdx - width]; else pixel1 = 0; if(id_y != height - 1) pixel2 = input[pixIdx + width]; else pixel2 = 0; } if(input[pixIdx] >= pixel1 && input[pixIdx] >= pixel2) { if(input[pixIdx] >= max) output[pixIdx] = 255; else if(input[pixIdx] <= min) output[pixIdx] = 0; else output[pixIdx] = 128; } else output[pixIdx] = 0; } extern "C" __global__ void ced_non_max_suppression_batch(unsigned char *input, unsigned char *input1, unsigned char *input2, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel, const unsigned char min, const unsigned char max) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; int id_z = hipBlockIdx_z * hipBlockDim_z + hipThreadIdx_z; if (id_x >= width || id_y >= height || id_z >= channel) { return; } int pixIdx = id_y * channel * width + id_x * channel + id_z; float gradient = atan((float)input1[pixIdx] / (float)input2[pixIdx]); unsigned char pixel1, pixel2; if (RPPABS(gradient) > 1.178097) { if(id_x != 0) pixel1 = input[pixIdx - 1]; else pixel1 = 0; if(id_x != width - 1) pixel2 = input[pixIdx + 1]; else pixel2 = 0; } else if (gradient > 0.392699) { if(id_x != 0 && id_y !=0) pixel1 = input[pixIdx - width - 1]; else pixel1 = 0; if(id_x != width - 1 && id_y != height - 1) pixel2 = input[pixIdx + width + 1]; else pixel2 = 0; } else if (gradient < -0.392699) { if(id_x != width - 1 && id_y !=0) pixel1 = input[pixIdx - width + 1]; else pixel1 = 0; if(id_x != 0 && id_y != height - 1) pixel2 = input[pixIdx + width - 1]; else pixel2 = 0; } else { if(id_y != 0) pixel1 = input[pixIdx - width]; else pixel1 = 0; if(id_y != height - 1) pixel2 = input[pixIdx + width]; else pixel2 = 0; } if(input[pixIdx] >= pixel1 && input[pixIdx] >= pixel2) { if(input[pixIdx] >= max) output[pixIdx] = 255; else if(input[pixIdx] <= min) output[pixIdx] = 0; else output[pixIdx] = 128; } else output[pixIdx] = 0; } extern "C" __global__ void canny_edge(unsigned char *input, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel, const unsigned char min, const unsigned char max) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; int id_z = hipBlockIdx_z * hipBlockDim_z + hipThreadIdx_z; int pixIdx = id_y * width + id_x + id_z * width * height; if (id_x >= width || id_y >= height || id_z >= channel) { return; } if(input[pixIdx] == 0 || input[pixIdx] == 255) { output[pixIdx] = input[pixIdx]; } else { for(int i = -1; i <= 1; i++) { for(int j = -1; j <= 1; j++) { if(id_x != 0 && id_x != width - 1 && id_y != 0 && id_y != height -1) { unsigned int index = pixIdx + j + (i * width); if(input[index] == 255) { output[pixIdx] = 255; break; } } } } } } extern "C" __global__ void canny_edge_batch(unsigned char *input, unsigned char *output, const unsigned int height, const unsigned int width, const unsigned int channel, const unsigned char min, const unsigned char max, const unsigned long batchIndex, const unsigned int originalChannel) { int id_x = hipBlockIdx_x * hipBlockDim_x + hipThreadIdx_x; int id_y = hipBlockIdx_y * hipBlockDim_y + hipThreadIdx_y; int id_z = hipBlockIdx_z * hipBlockDim_z + hipThreadIdx_z; if (id_x >= width || id_y >= height || id_z >= channel) { return; } unsigned long IPpixIdx, OPpixIdx; IPpixIdx = (unsigned long)id_y * (unsigned long)width + (unsigned long)id_x; if(originalChannel == 1) { OPpixIdx = (unsigned long)batchIndex + (unsigned long)id_y * (unsigned long)width + (unsigned long)id_x; } else { OPpixIdx = (unsigned long)IPpixIdx; } if(input[IPpixIdx] == 0 || input[IPpixIdx] == 255) { output[OPpixIdx] = input[IPpixIdx]; } else { for(int i = -1; i <= 1; i++) { for(int j = -1; j <= 1; j++) { if(id_x != 0 && id_x != width - 1 && id_y != 0 && id_y != height -1) { unsigned long index = (unsigned long)IPpixIdx + (unsigned long)j + ((unsigned long)i * (unsigned long)width); if(input[index] == 255) { output[OPpixIdx] = 255; break; } } } } } } RppStatus hip_exec_canny_ced_pln3_to_pln1(Rpp8u *srcPtr, Rpp8u *gsin, Rpp32u height, Rpp32u width, rpp::Handle& handle, Rpp32u channel) { int localThreads_x = 32; int localThreads_y = 32; int localThreads_z = 1; int globalThreads_x = width; int globalThreads_y = height; int globalThreads_z = 1; hipLaunchKernelGGL(canny_ced_pln3_to_pln1, dim3(ceil((float)globalThreads_x/localThreads_x), ceil((float)globalThreads_y/localThreads_y), ceil((float)globalThreads_z/localThreads_z)), dim3(localThreads_x, localThreads_y, localThreads_z), 0, handle.GetStream(), srcPtr, gsin, height, width, channel); return RPP_SUCCESS; } RppStatus hip_exec_canny_ced_pkd3_to_pln1(Rpp8u *srcPtr, Rpp8u *gsin, Rpp32u height, Rpp32u width, rpp::Handle& handle, Rpp32u channel) { int localThreads_x = 32; int localThreads_y = 32; int localThreads_z = 1; int globalThreads_x = width; int globalThreads_y = height; int globalThreads_z = 1; hipLaunchKernelGGL(canny_ced_pkd3_to_pln1, dim3(ceil((float)globalThreads_x/localThreads_x), ceil((float)globalThreads_y/localThreads_y), ceil((float)globalThreads_z/localThreads_z)), dim3(localThreads_x, localThreads_y, localThreads_z), 0, handle.GetStream(), srcPtr, gsin, height, width, channel); return RPP_SUCCESS; } RppStatus hip_exec_canny_ced_pln1_to_pkd3(Rpp8u *gsout, Rpp8u *dstPtr, Rpp32u height, Rpp32u width, rpp::Handle& handle, Rpp32u channel) { int localThreads_x = 32; int localThreads_y = 32; int localThreads_z = 1; int globalThreads_x = width; int globalThreads_y = height; int globalThreads_z = 1; hipLaunchKernelGGL(canny_ced_pln1_to_pkd3, dim3(ceil((float)globalThreads_x/localThreads_x), ceil((float)globalThreads_y/localThreads_y), ceil((float)globalThreads_z/localThreads_z)), dim3(localThreads_x, localThreads_y, localThreads_z), 0, handle.GetStream(), gsout, dstPtr, height, width, channel); return RPP_SUCCESS; } RppStatus hip_exec_canny_ced_pln1_to_pln3(Rpp8u *gsout, Rpp8u *dstPtr, Rpp32u height, Rpp32u width, rpp::Handle& handle, Rpp32u channel) { int localThreads_x = 32; int localThreads_y = 32; int localThreads_z = 1; int globalThreads_x = width; int globalThreads_y = height; int globalThreads_z = 1; hipLaunchKernelGGL(canny_ced_pln1_to_pln3, dim3(ceil((float)globalThreads_x/localThreads_x), ceil((float)globalThreads_y/localThreads_y), ceil((float)globalThreads_z/localThreads_z)), dim3(localThreads_x, localThreads_y, localThreads_z), 0, handle.GetStream(), gsout, dstPtr, height, width, channel); return RPP_SUCCESS; } RppStatus hip_exec_ced_non_max_suppression(Rpp8u *srcPtr, Rpp8u *sobelX, Rpp8u *sobelY, Rpp8u *dstPtr, Rpp32u height, Rpp32u width, rpp::Handle& handle, Rpp32u channel, Rpp32s i) { int localThreads_x = 32; int localThreads_y = 32; int localThreads_z = 1; int globalThreads_x = width; int globalThreads_y = height; int globalThreads_z = 1; hipLaunchKernelGGL(ced_non_max_suppression, dim3(ceil((float)globalThreads_x/localThreads_x), ceil((float)globalThreads_y/localThreads_y), ceil((float)globalThreads_z/localThreads_z)), dim3(localThreads_x, localThreads_y, localThreads_z), 0, handle.GetStream(), srcPtr, sobelX, sobelY, dstPtr, height, width, channel, handle.GetInitHandle()->mem.mcpu.ucharArr[0].ucharmem[i], handle.GetInitHandle()->mem.mcpu.ucharArr[1].ucharmem[i]); return RPP_SUCCESS; } RppStatus hip_exec_canny_edge(Rpp8u *srcPtr, Rpp8u *dstPtr, Rpp32u height, Rpp32u width, rpp::Handle& handle, Rpp32u channel, Rpp32s i) { int localThreads_x = 32; int localThreads_y = 32; int localThreads_z = 1; int globalThreads_x = width; int globalThreads_y = height; int globalThreads_z = 1; hipLaunchKernelGGL(canny_edge, dim3(ceil((float)globalThreads_x/localThreads_x), ceil((float)globalThreads_y/localThreads_y), ceil((float)globalThreads_z/localThreads_z)), dim3(localThreads_x, localThreads_y, localThreads_z), 0, handle.GetStream(), srcPtr, dstPtr, height, width, channel, handle.GetInitHandle()->mem.mcpu.ucharArr[0].ucharmem[i], handle.GetInitHandle()->mem.mcpu.ucharArr[1].ucharmem[i]); return RPP_SUCCESS; }
36.795571
178
0.499097
shobana-mcw
20ccd2fede826b3d29e1aba3d5e679cb814a3688
6,628
cpp
C++
ModelGenerator/src/model_generator_tests.cpp
adam-lafontaine/AugmentedAI
a4736ce59963ee86313a5936aaf09f0f659e4184
[ "MIT" ]
null
null
null
ModelGenerator/src/model_generator_tests.cpp
adam-lafontaine/AugmentedAI
a4736ce59963ee86313a5936aaf09f0f659e4184
[ "MIT" ]
null
null
null
ModelGenerator/src/model_generator_tests.cpp
adam-lafontaine/AugmentedAI
a4736ce59963ee86313a5936aaf09f0f659e4184
[ "MIT" ]
null
null
null
/* Copyright (c) 2021 Adam Lafontaine */ #include "../src/ModelGenerator.hpp" #include "../src/pixel_conversion.hpp" #include "../../utils/dirhelper.hpp" #include "../../utils/test_dir.hpp" #include <string> #include <iostream> #include <algorithm> #include <numeric> #include <cmath> #include <cstdio> namespace dir = dirhelper; namespace gen = model_generator; std::string src_fail_root; std::string src_pass_root; std::string data_fail_root; std::string data_pass_root; std::string model_root; bool get_directories() { TestDirConfig config; if (!config.has_all_keys()) return false; src_fail_root = config.get(TestDir::SRC_FAIL_ROOT); src_pass_root = config.get(TestDir::SRC_PASS_ROOT); data_fail_root = config.get(TestDir::DATA_FAIL_ROOT); data_pass_root = config.get(TestDir::DATA_PASS_ROOT); model_root = config.get(TestDir::MODEL_ROOT); return true; } const auto img_ext = ".png"; bool data_fail_exists_test(); bool data_pass_exists_test(); bool model_exists_test(); bool data_fail_files_test(); bool data_pass_files_test(); bool no_class_data_test(); bool add_class_data_test(); bool add_class_data_one_class_test(); bool purge_class_data_test(); bool save_model_no_data_test(); bool save_model_one_class_test(); bool save_model_one_file_test(); bool pixel_conversion_test(); bool save_model_active_test(); int main() { const auto run_test = [&](const char* name, const auto& test) { std::cout << name << ": " << (test() ? "Pass" : "Fail") << '\n'; }; if (!get_directories()) { std::cout << "Failed to get directories from configuration file\n"; return EXIT_FAILURE; } run_test("data_fail_exists_test() dir exists", data_fail_exists_test); run_test("data_pass_exists_test() dir exists", data_pass_exists_test); run_test("model_exists_test() dir exists", model_exists_test); run_test("data_fail_files_test() files exist", data_fail_files_test); run_test("data_pass_files_test() files exist", data_pass_files_test); run_test("no_class_data_test() ", no_class_data_test); run_test("add_class_data_test() ", add_class_data_test); run_test("add_class_data_one_class_test() ", add_class_data_one_class_test); run_test("purge_class_data_test() ", purge_class_data_test); run_test("save_model_no_data_test() ", save_model_no_data_test); run_test("save_model_one_class_test() ", save_model_one_class_test); run_test("save_model_one_file_test() ", save_model_one_file_test); run_test("save_model_active_test() ", save_model_active_test); run_test("pixel_conversion_test() ", pixel_conversion_test); std::cout << "\nTests complete."; } //======= HELPERS ================= bool is_directory(std::string const& path) { return fs::exists(path) && fs::is_directory(path); } bool image_files_exist(std::string const& dir) { return dir::get_files_of_type(dir, img_ext).size() > 0; } void delete_files(std::string const& dir) { for (auto const& entry : fs::directory_iterator(dir)) { fs::remove_all(entry); } } //======= TESTS ============== bool data_fail_exists_test() { return is_directory(data_fail_root); } bool data_pass_exists_test() { return is_directory(data_pass_root); } bool model_exists_test() { return is_directory(model_root); } bool data_fail_files_test() { return image_files_exist(data_fail_root); } bool data_pass_files_test() { return image_files_exist(data_pass_root); } // detect if data has not yet been added bool no_class_data_test() { gen::ModelGenerator gen; return !gen.has_class_data(); } // data present after adding bool add_class_data_test() { gen::ModelGenerator gen; gen.add_class_data(data_pass_root.c_str(), MLClass::Pass); gen.add_class_data(data_fail_root.c_str(), MLClass::Fail); return gen.has_class_data(); } // has_class_data() returns false if not all classes have data bool add_class_data_one_class_test() { gen::ModelGenerator gen; gen.add_class_data(data_pass_root.c_str(), MLClass::Pass); return !gen.has_class_data(); } // no class data after purging bool purge_class_data_test() { gen::ModelGenerator gen; gen.add_class_data(data_pass_root.c_str(), MLClass::Pass); gen.add_class_data(data_fail_root.c_str(), MLClass::Fail); gen.purge_class_data(); return !gen.has_class_data(); } // no model file is created when no class data is available bool save_model_no_data_test() { delete_files(model_root); gen::ModelGenerator gen; gen.save_model(model_root.c_str()); return dir::get_files_of_type(model_root, img_ext).empty(); } // all classes need to have data before a model file is created bool save_model_one_class_test() { delete_files(model_root); gen::ModelGenerator gen; gen.add_class_data(data_pass_root.c_str(), MLClass::Pass); gen.save_model(model_root.c_str()); return dir::get_files_of_type(model_root, img_ext).empty(); } // one file is created when generating a model bool save_model_one_file_test() { delete_files(model_root); gen::ModelGenerator gen; gen.add_class_data(data_pass_root.c_str(), MLClass::Pass); gen.add_class_data(data_fail_root.c_str(), MLClass::Fail); gen.save_model(model_root.c_str()); return dir::get_files_of_type(model_root, img_ext).size() == 1;; } // at least one item in centroid is flagged as active bool save_model_active_test() { // make sure a model file exists if (!save_model_one_file_test()) return false; const auto model_file = dir::get_files_of_type(model_root, img_ext)[0]; img::image_t model; img::read_image_from_file(model_file, model); const auto view = img::make_view(model); unsigned active_count = 0; const auto row = img::row_view(view, 0); auto ptr = row.row_begin(0); for (u32 x = 0; x < row.width; ++x) { const auto value = gen::model_pixel_to_model_value(ptr[x]); active_count += gen::is_relevant(value); } return active_count > 0; } // convert back and forth between model pixels and values bool pixel_conversion_test() { // make sure a model file exists if (!save_model_one_file_test()) return false; const auto model_file = dir::get_files_of_type(model_root, img_ext)[0]; img::image_t model; img::read_image_from_file(model_file, model); const auto view = img::make_view(model); const auto row = img::row_view(view, 0); auto ptr = row.row_begin(0); for (u32 x = 0; x < row.width; ++x) { const auto value = gen::model_pixel_to_model_value(ptr[x]); if (!gen::is_relevant(value)) continue; const auto pixel = gen::model_value_to_model_pixel(value); if (gen::model_pixel_to_model_value(pixel) != value) return false; } return true; }
22.855172
80
0.731895
adam-lafontaine
20cfddaafc69172e6bfe621cc5d77802b557bf0c
315
hpp
C++
library/ATF/PIMAGE_RESOURCE_DIRECTORY_ENTRY.hpp
lemkova/Yorozuya
f445d800078d9aba5de28f122cedfa03f26a38e4
[ "MIT" ]
29
2017-07-01T23:08:31.000Z
2022-02-19T10:22:45.000Z
library/ATF/PIMAGE_RESOURCE_DIRECTORY_ENTRY.hpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
90
2017-10-18T21:24:51.000Z
2019-06-06T02:30:33.000Z
library/ATF/PIMAGE_RESOURCE_DIRECTORY_ENTRY.hpp
kotopes/Yorozuya
605c97d3a627a8f6545cc09f2a1b0a8afdedd33a
[ "MIT" ]
44
2017-12-19T08:02:59.000Z
2022-02-24T23:15:01.000Z
// This file auto generated by plugin for ida pro. Generated code only for x64. Please, dont change manually #pragma once #include <common/common.h> #include <_IMAGE_RESOURCE_DIRECTORY_ENTRY.hpp> START_ATF_NAMESPACE typedef _IMAGE_RESOURCE_DIRECTORY_ENTRY *PIMAGE_RESOURCE_DIRECTORY_ENTRY; END_ATF_NAMESPACE
28.636364
108
0.828571
lemkova
20d0ec7f70f575369ab03c9eb8e0c00aac6c65dd
17,083
cpp
C++
tests/one/arcus/arcus.cpp
i3D-net/ONE-GameHosting-SDK
060473173136b2c8d9bc43aaad0eb487870dc115
[ "BSD-3-Clause" ]
6
2020-07-03T09:18:04.000Z
2021-01-07T17:50:06.000Z
tests/one/arcus/arcus.cpp
i3D-net/ONE-GameHosting-SDK
060473173136b2c8d9bc43aaad0eb487870dc115
[ "BSD-3-Clause" ]
null
null
null
tests/one/arcus/arcus.cpp
i3D-net/ONE-GameHosting-SDK
060473173136b2c8d9bc43aaad0eb487870dc115
[ "BSD-3-Clause" ]
null
null
null
#include <catch.hpp> #include <tests/one/arcus/util.h> #include <functional> #include <utility> #include <one/arcus/array.h> #include <one/arcus/internal/codec.h> #include <one/arcus/internal/connection.h> #include <one/arcus/internal/socket.h> #include <one/arcus/internal/version.h> #include <one/arcus/error.h> #include <one/arcus/message.h> #include <one/arcus/object.h> #include <one/arcus/opcode.h> #include <one/arcus/c_platform.h> #include <one/arcus/types.h> using namespace i3d::one; TEST_CASE("current arcus version", "[arcus]") { REQUIRE(arcus_protocol::current_version() == ArcusVersion::V2); } TEST_CASE("opcode version V2 validation", "[arcus]") { REQUIRE(is_opcode_supported_v2(Opcode::health)); REQUIRE(is_opcode_supported_v2(Opcode::hello)); REQUIRE(is_opcode_supported_v2(Opcode::soft_stop)); REQUIRE(is_opcode_supported_v2(Opcode::allocated)); REQUIRE(is_opcode_supported_v2(Opcode::metadata)); REQUIRE(is_opcode_supported_v2(Opcode::reverse_metadata)); REQUIRE(is_opcode_supported_v2(Opcode::host_information)); REQUIRE(is_opcode_supported_v2(Opcode::application_instance_information)); REQUIRE(is_opcode_supported_v2(Opcode::application_instance_status)); REQUIRE(is_opcode_supported_v2(Opcode::custom_command)); REQUIRE(is_opcode_supported_v2(Opcode::invalid) == false); } TEST_CASE("opcode current version validation", "[arcus]") { REQUIRE(is_opcode_supported(Opcode::health)); REQUIRE(is_opcode_supported(Opcode::hello)); REQUIRE(is_opcode_supported(Opcode::soft_stop)); REQUIRE(is_opcode_supported(Opcode::allocated)); REQUIRE(is_opcode_supported(Opcode::metadata)); REQUIRE(is_opcode_supported(Opcode::reverse_metadata)); REQUIRE(is_opcode_supported(Opcode::host_information)); REQUIRE(is_opcode_supported(Opcode::application_instance_information)); REQUIRE(is_opcode_supported(Opcode::application_instance_status)); REQUIRE(is_opcode_supported(Opcode::custom_command)); REQUIRE(is_opcode_supported(Opcode::invalid) == false); } //------------------------------------------------------------------------------ // Message tests. TEST_CASE("message handling", "[arcus]") { Message m; const String payload = "{\"timeout\":1000}"; REQUIRE(!is_error(m.init(Opcode::soft_stop, {payload.c_str(), payload.size()}))); REQUIRE(m.code() == Opcode::soft_stop); REQUIRE(m.payload().is_empty() == false); REQUIRE(is_error(m.init(Opcode::soft_stop, {nullptr, 0}))); m.reset(); REQUIRE(m.code() == Opcode::invalid); REQUIRE(m.payload().is_empty()); REQUIRE(!is_error(m.init(Opcode::soft_stop, {"{}", 2}))); REQUIRE(m.code() == Opcode::soft_stop); REQUIRE(m.payload().is_empty()); m.reset(); REQUIRE(m.code() == Opcode::invalid); REQUIRE(m.payload().is_empty()); } //------------------------------------------------------------------------------ // Socket and Connection tests. void wait_ready_for_read(Socket &socket) { bool is_ready; REQUIRE(!is_error(socket.ready_for_read(0.1f, is_ready))); REQUIRE(is_ready); }; void wait_ready_for_send(Socket &socket) { bool is_ready; REQUIRE(!is_error(socket.ready_for_send(0.1f, is_ready))); REQUIRE(is_ready); }; void listen(Socket &server, unsigned int &port) { REQUIRE(!is_error(server.init())); REQUIRE(!is_error(server.bind(0))); String server_ip; REQUIRE(!is_error(server.address(server_ip, port))); REQUIRE(server_ip.length() > 0); REQUIRE(port != 0); REQUIRE(!is_error(server.listen(1))); } void connect(Socket &client, unsigned int port) { client.init(); REQUIRE(!is_error(client.connect("127.0.0.1", port))); } void accept(Socket &server, Socket &in_client) { // Accept client on server. wait_ready_for_read(server); String client_ip; unsigned int client_port; REQUIRE(!is_error(server.accept(in_client, client_ip, client_port))); REQUIRE(client_ip.length() > 0); REQUIRE(client_port != 0); } // Socket and Connection normal external behavior. TEST_CASE("connection", "[arcus]") { init_socket_system(); Socket server; //----------- // Lifecycle. REQUIRE(server.is_initialized() == false); REQUIRE(!is_error(server.init())); REQUIRE(server.is_initialized() == true); REQUIRE(!is_error(server.close())); REQUIRE(server.is_initialized() == false); //--------------- // Server listen. unsigned int server_port; listen(server, server_port); #ifdef ONE_WINDOWS // On linux, listen may succeed even if already listened on. // Confirm a second server listen on same port fails appropriately. { Socket server_b; REQUIRE(!is_error(server_b.init())); REQUIRE(server_b.bind(server_port) == ONE_ERROR_SOCKET_BIND_FAILED); } #endif // Confirm no incoming connections. Socket in_client; String client_ip; unsigned int client_port; REQUIRE(!is_error(server.accept(in_client, client_ip, client_port))); REQUIRE(in_client.is_initialized() == false); //-------------------------- // Client connect to server. // Init client socket. Socket out_client; connect(out_client, server_port); // Accept client on server. accept(server, in_client); //------------------ // Send and receive. // Send to server. wait_ready_for_send(out_client); const unsigned char out_data = 'a'; size_t sent = 0; auto result = out_client.send(&out_data, 1, sent); REQUIRE(!is_error(result)); REQUIRE(sent == 1); // Receive on accepted server-side client socket. wait_ready_for_read(in_client); unsigned char in_data[128] = {0}; size_t received = 0; result = in_client.receive(in_data, 128, received); REQUIRE(!is_error(result)); REQUIRE(received == 1); REQUIRE(in_data[0] == out_data); //------------- // Handshaking. // Arcus connections around the server-side and client-side sockets that // are connected to each other. Connection server_connection(2, 2); server_connection.init(in_client); Connection client_connection(2, 2); client_connection.init(out_client); server_connection.initiate_handshake(); for (auto i = 0; i < 10; ++i) { REQUIRE(server_connection.update() == ONE_ERROR_NONE); REQUIRE(client_connection.update() == ONE_ERROR_NONE); sleep(10); if (server_connection.status() == Connection::Status::ready && client_connection.status() == Connection::Status::ready) break; } REQUIRE(server_connection.status() == Connection::Status::ready); REQUIRE(client_connection.status() == Connection::Status::ready); // After handshake, the connection is ready to send and receive only // Messages. Sending an invalid message should result in a error on server // connection. wait_ready_for_send(out_client); // Send at last the size of a full message header or else the data will // just wait in incoming buffer and be be processed. const unsigned char bad_data[codec::header_size()] = {0xF}; auto err = out_client.send(&bad_data, codec::header_size(), sent); REQUIRE(!is_error(err)); REQUIRE(sent == codec::header_size()); bool received_bad_header_error = false; for_sleep(10, 10, [&]() { err = server_connection.update(); // The update may succeed if the message isn't read during this update, // or it should fail with the invalid message code. received_bad_header_error = received_bad_header_error || (err == ONE_ERROR_CODEC_INVALID_HEADER); const bool is_expected = (err == ONE_ERROR_CODEC_INVALID_HEADER) || (err == ONE_ERROR_NONE); REQUIRE(is_expected); if (server_connection.status() == Connection::Status::error) return true; return false; }); REQUIRE(received_bad_header_error); REQUIRE(server_connection.status() == Connection::Status::error); server.close(); out_client.close(); in_client.close(); shutdown_socket_system(); } struct ClientServerTestObjects { Socket server; Socket out_client; Socket in_client; Connection *server_connection; Connection *client_connection; unsigned int server_port; }; void init_client_server_test(ClientServerTestObjects &objects, size_t message_queue_length) { init_socket_system(); listen(objects.server, objects.server_port); connect(objects.out_client, objects.server_port); accept(objects.server, objects.in_client); objects.server_connection = new Connection(message_queue_length, message_queue_length); objects.server_connection->init(objects.in_client); objects.client_connection = new Connection(message_queue_length, message_queue_length); objects.client_connection->init(objects.out_client); } void shutdown_client_server_test(ClientServerTestObjects &objects) { delete objects.server_connection; delete objects.client_connection; objects.server.close(); objects.out_client.close(); objects.in_client.close(); shutdown_socket_system(); } void handshake_client_server_test(ClientServerTestObjects &objects) { objects.server_connection->initiate_handshake(); for_sleep(10, 1, [&]() { REQUIRE(!is_error(objects.server_connection->update())); REQUIRE(!is_error(objects.client_connection->update())); if (objects.server_connection->status() == Connection::Status::ready && objects.client_connection->status() == Connection::Status::ready) return true; return false; }); REQUIRE(objects.server_connection->status() == Connection::Status::ready); REQUIRE(objects.client_connection->status() == Connection::Status::ready); } TEST_CASE("handshake early hello", "[arcus]") { ClientServerTestObjects objects; init_client_server_test(objects, 2); objects.server_connection->initiate_handshake(); wait_ready_for_send(objects.out_client); codec::Hello hello = codec::valid_hello(); size_t sent = 0; auto result = objects.out_client.send(&hello, codec::hello_size(), sent); REQUIRE(!is_error(result)); REQUIRE(sent == codec::hello_size()); auto err = ONE_ERROR_NONE; for (int i = 0; i < 5; i++) { err = objects.server_connection->update(); if (is_error(err)) break; sleep(10); } REQUIRE(is_error(err)); shutdown_client_server_test(objects); } TEST_CASE("handshake hello bad response", "[arcus]") { ClientServerTestObjects objects; init_client_server_test(objects, 2); // Wait for server to enter sent state. objects.server_connection->initiate_handshake(); for (int i = 0; i < 10; i++) { REQUIRE(!is_error(objects.server_connection->update())); if (objects.server_connection->status() == Connection::Status::handshake_hello_sent) { break; } sleep(1); } REQUIRE(objects.server_connection->status() == Connection::Status::handshake_hello_sent); // Receive the hello from server. codec::Hello hello = {0}; size_t received = 0; auto result = objects.out_client.receive(&hello, codec::hello_size(), received); REQUIRE(!is_error(result)); REQUIRE(received == codec::hello_size()); REQUIRE(codec::validate_hello(hello)); // Send wrong opcode back. static codec::Header hello_header = {0}; hello_header.opcode = static_cast<char>(Opcode::soft_stop); size_t sent = 0; result = objects.out_client.send(&hello_header, codec::header_size(), sent); REQUIRE(!is_error(result)); REQUIRE(sent == codec::header_size()); // Ensure the server connection enters an error state. OneError err; for (int i = 0; i < 10; i++) { err = (objects.server_connection->update()); if (is_error(err)) { break; } sleep(1); } REQUIRE(err == ONE_ERROR_CONNECTION_HELLO_MESSAGE_REPLY_INVALID); shutdown_client_server_test(objects); } //-------------------------- // Test - handshake timeout. TEST_CASE("handshake timeout", "[arcus]") {} //-------------------------------- // Message send and receive tests. TEST_CASE("message send and receive", "[arcus]") { ClientServerTestObjects objects; constexpr size_t queue_length = 1024; init_client_server_test(objects, queue_length); handshake_client_server_test(objects); // Ensure no messages waiting anywhere. unsigned int count = 0; REQUIRE(!is_error(objects.server_connection->incoming_count(count))); REQUIRE(count == 0); REQUIRE(!is_error(objects.client_connection->incoming_count(count))); REQUIRE(count == 0); auto err = objects.server_connection->remove_incoming( [](const Message &) { return ONE_ERROR_NONE; }); REQUIRE(err == ONE_ERROR_CONNECTION_QUEUE_EMPTY); err = objects.client_connection->remove_incoming( [](const Message &) { return ONE_ERROR_NONE; }); REQUIRE(err == ONE_ERROR_CONNECTION_QUEUE_EMPTY); // Send a message from client to server. Message message; messages::prepare_soft_stop(1000, message); err = objects.client_connection->add_outgoing(message); const auto pump_messages = [&]() { for_sleep(10, 1, [&]() { REQUIRE(!is_error(objects.server_connection->update())); REQUIRE(!is_error(objects.client_connection->update())); return false; }); }; pump_messages(); // Check it on server. REQUIRE(!is_error(objects.server_connection->incoming_count(count))); REQUIRE(count == 1); // Message pointer was consumed by client connection, can re-use var safely without // leak. err = objects.server_connection->remove_incoming([](const Message &message) { REQUIRE(message.code() == Opcode::soft_stop); int timeout = 0; REQUIRE(!is_error(message.payload().val_int("timeout", timeout))); REQUIRE(timeout == 1000); return ONE_ERROR_NONE; }); REQUIRE(!is_error(err)); // Fill up the outgoing messages. for (unsigned int i = 0; i < queue_length; ++i) { Message message; messages::prepare_soft_stop(1000, message); err = objects.client_connection->add_outgoing(message); REQUIRE(!is_error(err)); } // Add one more message, which should not fit in the outgoing message queue. Array array; messages::prepare_allocated(array, message); err = objects.client_connection->add_outgoing(message); REQUIRE(err == ONE_ERROR_CONNECTION_OUTGOING_QUEUE_INSUFFICIENT_SPACE); // Ensure server received the initial messages and not the dropped one. pump_messages(); REQUIRE(!is_error(objects.server_connection->incoming_count(count))); REQUIRE(count == queue_length); for (unsigned int i = 0; i < queue_length; ++i) { err = objects.server_connection->remove_incoming([](const Message &message) { REQUIRE(message.code() == Opcode::soft_stop); int timeout = 0; REQUIRE(!is_error(message.payload().val_int("timeout", timeout))); REQUIRE(timeout == 1000); return ONE_ERROR_NONE; }); REQUIRE(!is_error(err)); } shutdown_client_server_test(objects); } TEST_CASE("message send bad json", "[arcus]") { ClientServerTestObjects objects; constexpr size_t queue_length = 1024; init_client_server_test(objects, queue_length); handshake_client_server_test(objects); // Ensure no messages waiting anywhere. unsigned int count = 0; REQUIRE(!is_error(objects.server_connection->incoming_count(count))); REQUIRE(count == 0); REQUIRE(!is_error(objects.client_connection->incoming_count(count))); REQUIRE(count == 0); auto err = objects.server_connection->remove_incoming( [](const Message &) { return ONE_ERROR_NONE; }); REQUIRE(err == ONE_ERROR_CONNECTION_QUEUE_EMPTY); err = objects.client_connection->remove_incoming( [](const Message &) { return ONE_ERROR_NONE; }); REQUIRE(err == ONE_ERROR_CONNECTION_QUEUE_EMPTY); // Send a message from client to server. const String invalid_json = "{\"invalid_json\":true"; Message message; err = message.init(Opcode::metadata, {invalid_json.c_str(), invalid_json.size()}); err = objects.client_connection->add_outgoing(message); const auto pump_messages = [&]() { for_sleep(10, 1, [&]() { REQUIRE(!is_error(objects.server_connection->update())); auto error = objects.client_connection->update(); if (is_error(error)) { REQUIRE(error == ONE_ERROR_CODEC_INVALID_HEADER); return true; } return false; }); }; pump_messages(); // Check it on server. REQUIRE(!is_error(objects.server_connection->incoming_count(count))); REQUIRE(count == 0); shutdown_client_server_test(objects); }
35.295455
87
0.667447
i3D-net
20d5b08375dcb27748e86b9323cc50884bb0e90b
84
cpp
C++
src/test/unit/multiple_translation_units1.cpp
drezap/stan
9b319ed125e2a7d14d0c9c246d2f462dad668537
[ "BSD-3-Clause" ]
1
2019-07-05T01:40:40.000Z
2019-07-05T01:40:40.000Z
src/test/unit/multiple_translation_units1.cpp
drezap/stan
9b319ed125e2a7d14d0c9c246d2f462dad668537
[ "BSD-3-Clause" ]
null
null
null
src/test/unit/multiple_translation_units1.cpp
drezap/stan
9b319ed125e2a7d14d0c9c246d2f462dad668537
[ "BSD-3-Clause" ]
1
2018-08-28T12:09:08.000Z
2018-08-28T12:09:08.000Z
#include <stan/model/model_header.hpp> stan::math::var function1() { return 0; }
14
38
0.690476
drezap
20d603ef9954fc79b5eb3e03dd4911a8b7d6748c
2,138
hpp
C++
include/hogl/detail/internal.hpp
maxk-org/hogl
07a714da00075125cbf930bfacb59645493ad313
[ "BSD-2-Clause" ]
14
2015-08-25T20:17:16.000Z
2021-08-24T11:28:02.000Z
include/hogl/detail/internal.hpp
maxk-org/hogl
07a714da00075125cbf930bfacb59645493ad313
[ "BSD-2-Clause" ]
8
2016-06-15T16:49:01.000Z
2019-10-05T19:12:12.000Z
include/hogl/detail/internal.hpp
maxk-org/hogl
07a714da00075125cbf930bfacb59645493ad313
[ "BSD-2-Clause" ]
6
2015-09-30T00:00:12.000Z
2021-08-02T20:43:56.000Z
/* Copyright (c) 2015-2020 Max Krasnyansky <max.krasnyansky@gmail.com> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * @file hogl/detail/internal.h * Internal parts (log areas and sections, etc) */ #ifndef HOGL_DETAIL_INTERNAL_HPP #define HOGL_DETAIL_INTERNAL_HPP #include <hogl/detail/compiler.hpp> #include <stdint.h> #include <time.h> __HOGL_PRIV_NS_OPEN__ namespace hogl { namespace internal { /** * Internal section ids */ enum section_ids { INFO, WARN, ERROR, DROPMARK, TSOFULLMARK, ENGINE_DEBUG, AREA_DEBUG, RING_DEBUG, TLS_DEBUG }; /** * Internal section names */ extern const char *section_names[]; /** * Internal special record types */ enum special_records { SPR_FLUSH, SPR_TIMESOURCE_CHANGE }; } // namespace internal } // namespace hogl __HOGL_PRIV_NS_CLOSE__ #endif // HOGL_DETAIL_INTERNAL_HPP
27.063291
85
0.755847
maxk-org
20ddfc4d3bd4bc8693b5372cce680ca590fb96f5
2,385
cpp
C++
Labs/d6t2.cpp
Chalkydoge/FDU_DS
8d2dec307d8dd641fbe3bcfa633cede9e1a45252
[ "MIT" ]
1
2020-09-16T06:17:14.000Z
2020-09-16T06:17:14.000Z
Labs/d6t2.cpp
Chalkydoge/FDU_DS
8d2dec307d8dd641fbe3bcfa633cede9e1a45252
[ "MIT" ]
null
null
null
Labs/d6t2.cpp
Chalkydoge/FDU_DS
8d2dec307d8dd641fbe3bcfa633cede9e1a45252
[ "MIT" ]
null
null
null
#include <iostream> #include <vector> #include <queue> #include <stack> using namespace std; struct TreeNode{ int val; TreeNode *left, *right; TreeNode(int v) : val(v), left(NULL), right(NULL){} }; TreeNode* buildTree(vector<int>& nums){ if(nums.size() == 0) return NULL; TreeNode *root = new TreeNode(nums.front()); queue<TreeNode *> q; q.push(root); int i = 1; while(!q.empty() && (i < (int)nums.size())){ TreeNode *node = q.front(); q.pop(); if(node){ TreeNode *lc = (nums[i] != -1) ? new TreeNode(nums[i]) : NULL; TreeNode *rc = (i + 1 < (int)nums.size() && nums[i + 1] != -1) ? new TreeNode(nums[i + 1]) : NULL; node->left = lc; node->right = rc; q.push(lc); q.push(rc); i += 2; } } return root; } void pre_trav(TreeNode* root){ stack<TreeNode *> st; while(root || !st.empty()){ if(root){ cout << root->val << " "; st.push(root); root = root->left; } else{ root = st.top(); st.pop(); root = root->right; } } } void trav(TreeNode* root){ if(!root) return; cout << root->val << endl; trav(root->left); trav(root->right); } // t2-recursion void dfs(TreeNode* root, int level, vector<int>& level_sums, vector<int>& cnt){ if(!root) return; if(level < (int)level_sums.size()){ level_sums[level] += root->val; ++cnt[level]; } else{ level_sums.push_back(root->val); cnt.push_back(1); } dfs(root->left, level + 1, level_sums, cnt); dfs(root->right, level + 1, level_sums, cnt); } vector<double> get_averageII(TreeNode* root){ vector<int> level_sums, cnt; dfs(root, 0, level_sums, cnt); vector<double> res; for (int i = 0; i < (int)level_sums.size(); ++i){ res.push_back((double)level_sums[i] / cnt[i]); } return res; } int main(){ int v; vector<int> nums; while(cin >> v){ nums.push_back(v); if(cin.get() == '\n') break; } TreeNode *root = buildTree(nums); // trav(root); vector<double> res = get_averageII(root); for (int i = 0; i < (int)res.size(); ++i){ cout << res[i] << " "; } return 0; }
22.5
110
0.501468
Chalkydoge
221401a6eff107280df2b62b14a5c9d0b852a75a
7,945
cc
C++
Cassie_Example/opt_two_step/periodic/c_code/src/gen/Js_ddh_LeftToeBottom_cassie.cc
prem-chand/Cassie_CFROST
da4bd51442f86e852cbb630cc91c9a380a10b66d
[ "BSD-3-Clause" ]
null
null
null
Cassie_Example/opt_two_step/periodic/c_code/src/gen/Js_ddh_LeftToeBottom_cassie.cc
prem-chand/Cassie_CFROST
da4bd51442f86e852cbb630cc91c9a380a10b66d
[ "BSD-3-Clause" ]
null
null
null
Cassie_Example/opt_two_step/periodic/c_code/src/gen/Js_ddh_LeftToeBottom_cassie.cc
prem-chand/Cassie_CFROST
da4bd51442f86e852cbb630cc91c9a380a10b66d
[ "BSD-3-Clause" ]
null
null
null
/* * Automatically Generated from Mathematica. * Fri 5 Nov 2021 09:03:12 GMT-04:00 */ #include <stdio.h> #include <stdlib.h> #include <math.h> #include "frost/gen/Js_ddh_LeftToeBottom_cassie.hh" #ifdef _MSC_VER #define INLINE __forceinline /* use __forceinline (VC++ specific) */ #else #define INLINE inline /* use standard inline */ #endif /** * Copied from Wolfram Mathematica C Definitions file mdefs.hpp * Changed marcos to inline functions (Eric Cousineau) */ INLINE double Power(double x, double y) { return pow(x, y); } INLINE double Sqrt(double x) { return sqrt(x); } INLINE double Abs(double x) { return fabs(x); } INLINE double Exp(double x) { return exp(x); } INLINE double Log(double x) { return log(x); } INLINE double Sin(double x) { return sin(x); } INLINE double Cos(double x) { return cos(x); } INLINE double Tan(double x) { return tan(x); } INLINE double ArcSin(double x) { return asin(x); } INLINE double ArcCos(double x) { return acos(x); } //INLINE double ArcTan(double x) { return atan(x); } /* update ArcTan function to use atan2 instead. */ INLINE double ArcTan(double x, double y) { return atan2(y,x); } INLINE double Sinh(double x) { return sinh(x); } INLINE double Cosh(double x) { return cosh(x); } INLINE double Tanh(double x) { return tanh(x); } #define E 2.71828182845904523536029 #define Pi 3.14159265358979323846264 #define Degree 0.01745329251994329576924 INLINE double Sec(double x) { return 1/cos(x); } INLINE double Csc(double x) { return 1/sin(x); } /* * Sub functions */ static void output1(double *p_output1,const double *var1) { double _NotUsed; NULL; p_output1[0]=1; p_output1[1]=1; p_output1[2]=1; p_output1[3]=1; p_output1[4]=1; p_output1[5]=1; p_output1[6]=1; p_output1[7]=1; p_output1[8]=1; p_output1[9]=1; p_output1[10]=1; p_output1[11]=1; p_output1[12]=1; p_output1[13]=1; p_output1[14]=1; p_output1[15]=1; p_output1[16]=1; p_output1[17]=1; p_output1[18]=1; p_output1[19]=1; p_output1[20]=1; p_output1[21]=1; p_output1[22]=1; p_output1[23]=1; p_output1[24]=1; p_output1[25]=1; p_output1[26]=1; p_output1[27]=1; p_output1[28]=1; p_output1[29]=1; p_output1[30]=1; p_output1[31]=1; p_output1[32]=1; p_output1[33]=1; p_output1[34]=2; p_output1[35]=2; p_output1[36]=2; p_output1[37]=2; p_output1[38]=2; p_output1[39]=2; p_output1[40]=2; p_output1[41]=2; p_output1[42]=2; p_output1[43]=2; p_output1[44]=2; p_output1[45]=2; p_output1[46]=2; p_output1[47]=2; p_output1[48]=2; p_output1[49]=2; p_output1[50]=2; p_output1[51]=2; p_output1[52]=2; p_output1[53]=2; p_output1[54]=2; p_output1[55]=2; p_output1[56]=2; p_output1[57]=2; p_output1[58]=2; p_output1[59]=2; p_output1[60]=2; p_output1[61]=2; p_output1[62]=2; p_output1[63]=2; p_output1[64]=2; p_output1[65]=2; p_output1[66]=2; p_output1[67]=2; p_output1[68]=3; p_output1[69]=3; p_output1[70]=3; p_output1[71]=3; p_output1[72]=3; p_output1[73]=3; p_output1[74]=3; p_output1[75]=3; p_output1[76]=3; p_output1[77]=3; p_output1[78]=3; p_output1[79]=3; p_output1[80]=3; p_output1[81]=3; p_output1[82]=3; p_output1[83]=3; p_output1[84]=3; p_output1[85]=3; p_output1[86]=3; p_output1[87]=3; p_output1[88]=3; p_output1[89]=3; p_output1[90]=3; p_output1[91]=3; p_output1[92]=3; p_output1[93]=3; p_output1[94]=3; p_output1[95]=3; p_output1[96]=3; p_output1[97]=3; p_output1[98]=3; p_output1[99]=4; p_output1[100]=4; p_output1[101]=4; p_output1[102]=4; p_output1[103]=4; p_output1[104]=4; p_output1[105]=4; p_output1[106]=4; p_output1[107]=4; p_output1[108]=4; p_output1[109]=4; p_output1[110]=4; p_output1[111]=4; p_output1[112]=4; p_output1[113]=4; p_output1[114]=4; p_output1[115]=4; p_output1[116]=4; p_output1[117]=4; p_output1[118]=4; p_output1[119]=4; p_output1[120]=4; p_output1[121]=4; p_output1[122]=4; p_output1[123]=4; p_output1[124]=4; p_output1[125]=4; p_output1[126]=4; p_output1[127]=4; p_output1[128]=5; p_output1[129]=5; p_output1[130]=5; p_output1[131]=5; p_output1[132]=5; p_output1[133]=5; p_output1[134]=5; p_output1[135]=5; p_output1[136]=5; p_output1[137]=5; p_output1[138]=5; p_output1[139]=5; p_output1[140]=5; p_output1[141]=5; p_output1[142]=5; p_output1[143]=5; p_output1[144]=5; p_output1[145]=5; p_output1[146]=5; p_output1[147]=5; p_output1[148]=5; p_output1[149]=5; p_output1[150]=5; p_output1[151]=5; p_output1[152]=5; p_output1[153]=5; p_output1[154]=1; p_output1[155]=4; p_output1[156]=5; p_output1[157]=6; p_output1[158]=7; p_output1[159]=8; p_output1[160]=9; p_output1[161]=10; p_output1[162]=11; p_output1[163]=12; p_output1[164]=13; p_output1[165]=21; p_output1[166]=24; p_output1[167]=25; p_output1[168]=26; p_output1[169]=27; p_output1[170]=28; p_output1[171]=29; p_output1[172]=30; p_output1[173]=31; p_output1[174]=32; p_output1[175]=33; p_output1[176]=41; p_output1[177]=44; p_output1[178]=45; p_output1[179]=46; p_output1[180]=47; p_output1[181]=48; p_output1[182]=49; p_output1[183]=50; p_output1[184]=51; p_output1[185]=52; p_output1[186]=53; p_output1[187]=61; p_output1[188]=2; p_output1[189]=4; p_output1[190]=5; p_output1[191]=6; p_output1[192]=7; p_output1[193]=8; p_output1[194]=9; p_output1[195]=10; p_output1[196]=11; p_output1[197]=12; p_output1[198]=13; p_output1[199]=22; p_output1[200]=24; p_output1[201]=25; p_output1[202]=26; p_output1[203]=27; p_output1[204]=28; p_output1[205]=29; p_output1[206]=30; p_output1[207]=31; p_output1[208]=32; p_output1[209]=33; p_output1[210]=42; p_output1[211]=44; p_output1[212]=45; p_output1[213]=46; p_output1[214]=47; p_output1[215]=48; p_output1[216]=49; p_output1[217]=50; p_output1[218]=51; p_output1[219]=52; p_output1[220]=53; p_output1[221]=62; p_output1[222]=3; p_output1[223]=5; p_output1[224]=6; p_output1[225]=7; p_output1[226]=8; p_output1[227]=9; p_output1[228]=10; p_output1[229]=11; p_output1[230]=12; p_output1[231]=13; p_output1[232]=23; p_output1[233]=25; p_output1[234]=26; p_output1[235]=27; p_output1[236]=28; p_output1[237]=29; p_output1[238]=30; p_output1[239]=31; p_output1[240]=32; p_output1[241]=33; p_output1[242]=43; p_output1[243]=45; p_output1[244]=46; p_output1[245]=47; p_output1[246]=48; p_output1[247]=49; p_output1[248]=50; p_output1[249]=51; p_output1[250]=52; p_output1[251]=53; p_output1[252]=63; p_output1[253]=5; p_output1[254]=6; p_output1[255]=7; p_output1[256]=8; p_output1[257]=9; p_output1[258]=10; p_output1[259]=11; p_output1[260]=12; p_output1[261]=13; p_output1[262]=24; p_output1[263]=25; p_output1[264]=26; p_output1[265]=27; p_output1[266]=28; p_output1[267]=29; p_output1[268]=30; p_output1[269]=31; p_output1[270]=32; p_output1[271]=33; p_output1[272]=44; p_output1[273]=45; p_output1[274]=46; p_output1[275]=47; p_output1[276]=49; p_output1[277]=50; p_output1[278]=51; p_output1[279]=52; p_output1[280]=53; p_output1[281]=64; p_output1[282]=4; p_output1[283]=5; p_output1[284]=6; p_output1[285]=7; p_output1[286]=8; p_output1[287]=9; p_output1[288]=10; p_output1[289]=11; p_output1[290]=12; p_output1[291]=13; p_output1[292]=24; p_output1[293]=25; p_output1[294]=26; p_output1[295]=27; p_output1[296]=28; p_output1[297]=29; p_output1[298]=30; p_output1[299]=31; p_output1[300]=32; p_output1[301]=33; p_output1[302]=44; p_output1[303]=45; p_output1[304]=46; p_output1[305]=47; p_output1[306]=48; p_output1[307]=65; } void frost::gen::Js_ddh_LeftToeBottom_cassie(double *p_output1, const double *var1) { // Call Subroutines output1(p_output1, var1); }
21.130319
83
0.663436
prem-chand
22145a726afc6e780537042e0710486590beb861
1,810
cpp
C++
src/algebra/curves/edwards/edwards_pp.cpp
amiller/libsnark
d34b477ed9c0e36f74c78946012658bdecde0c00
[ "MIT" ]
null
null
null
src/algebra/curves/edwards/edwards_pp.cpp
amiller/libsnark
d34b477ed9c0e36f74c78946012658bdecde0c00
[ "MIT" ]
null
null
null
src/algebra/curves/edwards/edwards_pp.cpp
amiller/libsnark
d34b477ed9c0e36f74c78946012658bdecde0c00
[ "MIT" ]
null
null
null
/** @file ***************************************************************************** * @author This file is part of libsnark, developed by SCIPR Lab * and contributors (see AUTHORS). * @copyright MIT license (see LICENSE file) *****************************************************************************/ #include "algebra/curves/edwards/edwards_pp.hpp" namespace libsnark { template<> void init_public_params<edwards_pp>() { init_edwards_params(); } template<> edwards_GT final_exponentiation<edwards_pp>(const edwards_Fq6 &elt) { return edwards_final_exponentiation(elt); } template<> edwards_G1_precomp precompute_G1<edwards_pp>(const edwards_G1 &P) { return edwards_precompute_G1(P); } template<> edwards_G2_precomp precompute_G2<edwards_pp>(const edwards_G2 &Q) { return edwards_precompute_G2(Q); } template<> edwards_Fq6 miller_loop<edwards_pp>(const edwards_G1_precomp &prec_P, const edwards_G2_precomp &prec_Q) { return edwards_miller_loop(prec_P, prec_Q); } template<> edwards_Fq6 double_miller_loop<edwards_pp>(const edwards_G1_precomp &prec_P1, const edwards_G2_precomp &prec_Q1, const edwards_G1_precomp &prec_P2, const edwards_G2_precomp &prec_Q2) { return edwards_double_miller_loop(prec_P1, prec_Q1, prec_P2, prec_Q2); } template<> edwards_Fq6 pairing<edwards_pp>(const edwards_G1 &P, const edwards_G2 &Q) { return edwards_pairing(P, Q); } template<> edwards_Fq6 reduced_pairing<edwards_pp>(const edwards_G1 &P, const edwards_G2 &Q) { return edwards_reduced_pairing(P, Q); } } // libsnark
27.014925
79
0.599448
amiller
2214a8bab85388c389cbc2c0f8a6122974a0e905
2,153
cpp
C++
src/Emulators/nestopiaue/core/board/NstBoardJalecoJf17.cpp
slajerek/RetroDebugger
e761e4f9efd103a05e65ef283423b142fa4324c7
[ "Apache-2.0", "MIT" ]
34
2021-05-29T07:04:17.000Z
2022-03-10T20:16:03.000Z
src/Emulators/nestopiaue/core/board/NstBoardJalecoJf17.cpp
slajerek/RetroDebugger
e761e4f9efd103a05e65ef283423b142fa4324c7
[ "Apache-2.0", "MIT" ]
6
2021-12-25T13:05:21.000Z
2022-01-19T17:35:17.000Z
src/Emulators/nestopiaue/core/board/NstBoardJalecoJf17.cpp
slajerek/RetroDebugger
e761e4f9efd103a05e65ef283423b142fa4324c7
[ "Apache-2.0", "MIT" ]
6
2021-12-24T18:37:41.000Z
2022-02-06T23:06:02.000Z
//////////////////////////////////////////////////////////////////////////////////////// // // Nestopia - NES/Famicom emulator written in C++ // // Copyright (C) 2003-2008 Martin Freij // // This file is part of Nestopia. // // Nestopia is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // Nestopia is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with Nestopia; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // //////////////////////////////////////////////////////////////////////////////////////// #include "NstBoard.hpp" #include "../NstSoundPlayer.hpp" #include "NstBoardJalecoJf17.hpp" namespace Nes { namespace Core { namespace Boards { namespace Jaleco { #ifdef NST_MSVC_OPTIMIZE #pragma optimize("s", on) #endif Jf17::Jf17(const Context& c) : Board (c), sound (Sound::Player::Create(*c.apu,c.chips,L"D7756C",board == Type::JALECO_JF17 ? Sound::Player::GAME_MOERO_PRO_TENNIS : Sound::Player::GAME_UNKNOWN,32)) { } Jf17::~Jf17() { Sound::Player::Destroy( sound ); } void Jf17::SubReset(bool) { Map( 0x8000U, 0xFFFFU, &Jf17::Poke_8000 ); } #ifdef NST_MSVC_OPTIMIZE #pragma optimize("", on) #endif NES_POKE_AD(Jf17,8000) { data = GetBusData(address,data); if (data & 0x40) { ppu.Update(); chr.SwapBank<SIZE_8K,0x0000>( data & 0xF ); } if (data & 0x80) prg.SwapBank<SIZE_16K,0x0000>( data & 0xF ); if (sound && (data & 0x30) == 0x20) sound->Play( address & 0x1F ); } } } } }
26.256098
159
0.570831
slajerek
2214d19b7d70c44ade25603a62fff62bdda90e63
3,584
cc
C++
tests/test_sha256.cc
lichray/macrofree-demo
dabe03b3be4f0d5e05f4bb28cf253619ee223ad5
[ "BSD-2-Clause" ]
3
2019-10-15T01:42:33.000Z
2019-11-15T05:12:28.000Z
tests/test_sha256.cc
lichray/macrofree-demo
dabe03b3be4f0d5e05f4bb28cf253619ee223ad5
[ "BSD-2-Clause" ]
null
null
null
tests/test_sha256.cc
lichray/macrofree-demo
dabe03b3be4f0d5e05f4bb28cf253619ee223ad5
[ "BSD-2-Clause" ]
null
null
null
#include <doctest/doctest.h> #include <macrofree_demo/sha256.h> #include <macrofree_demo/sha256_implementations.h> #include <string_view> using namespace macrofree_demo; using namespace std::literals; TYPE_TO_STRING(sha256_openssl); TYPE_TO_STRING(sha256_cng); SCENARIO_TEMPLATE_DEFINE ("feed sha256 inputs", T, test_sha256) { auto h2 = sha256(std::in_place_type<T>); GIVEN ("a sha256 function in initial state") { auto h = sha256(std::in_place_type<T>); WHEN ("we feed no input") { THEN ("it gives a known message digest") { REQUIRE(h.hexdigest() == "e3b0c44298fc1c149afbf4c8996fb92427ae" "41e4649b934ca495991b7852b855"); } AND_THEN ("the message digest is that of an empty string") { h2.update(""); REQUIRE(h.digest() == h2.digest()); } } WHEN ("we feed some input") { h.update("Atelier Ryza"); THEN ("the message digest is not as same as that of no input") { REQUIRE(h.digest() != h2.digest()); } AND_THEN ("nor as same as that of a different input") { h2.update("Ever Darkness & the Secret Hideout"); REQUIRE(h.digest() != h2.digest()); } } WHEN ("we feed multiple inputs") { h.update("macrofree"); h.update("-"); h.update("demo"); THEN ("the input is as-if concatenated") { h2.update("macrofree-demo"); REQUIRE(h.digest() == h2.digest()); } } WHEN ("we feed input with embedded zero") { h.update("Re:\0 - Starting Life in Another World"sv); THEN ("it gives a known message digest") { REQUIRE(h.hexdigest() == "c3e6cddc055c28268d52b9046db8b3d28a81" "912c434b17d25514507db0eef6d0"); } AND_THEN ("the message is not treated as truncated") { h2.update("Re:"sv); REQUIRE(h.digest() != h2.digest()); } } } } TEST_CASE_TEMPLATE_APPLY(test_sha256, sha256_implementations); SCENARIO_TEMPLATE_DEFINE ("retrieve sha256 message digest multiple times", T, test_sha256_multiple) { auto h2 = sha256(std::in_place_type<T>); GIVEN ("a sha256 function in initial state") { auto h = sha256(std::in_place_type<T>); WHEN ("we've accessed its message digest") { auto md = h.digest(); THEN ("we can access it again and get the same result") { REQUIRE(h.digest() == md); } } WHEN ("we've feed some input and accessed its message digest") { h.update("macrofree"); h.update("-"); auto md = h.digest(); THEN ("we can add more input and get the whole result") { h.update("demo"); h2.update("macrofree-demo"sv); REQUIRE(h.digest() == h2.digest()); } AND_THEN ("the intermediate result was correct") { h2.update("macrofree-"sv); REQUIRE(md == h2.digest()); } } } } TEST_CASE_TEMPLATE_APPLY(test_sha256_multiple, sha256_implementations);
26.352941
79
0.504743
lichray
22221e66f35f6c6059c1ade5dbd101fcbb4c4b47
514
cpp
C++
SourceCode/Chapter 15/GradedActivity Version 3/PassFailActivity.cpp
aceiro/poo2019
0f93d22296f43a8b024a346f510c00314817d2cf
[ "MIT" ]
1
2019-04-09T18:29:38.000Z
2019-04-09T18:29:38.000Z
SourceCode/Chapter 15/PassFailActivity/PassFailActivity.cpp
aceiro/poo2019
0f93d22296f43a8b024a346f510c00314817d2cf
[ "MIT" ]
null
null
null
SourceCode/Chapter 15/PassFailActivity/PassFailActivity.cpp
aceiro/poo2019
0f93d22296f43a8b024a346f510c00314817d2cf
[ "MIT" ]
null
null
null
#include "PassFailActivity.h" //****************************************************** // Member function PassFailActivity::getLetterGrade * // This function returns 'P' if the score is passing, * // otherwise it returns 'F'. * //****************************************************** char PassFailActivity::getLetterGrade() const { char letterGrade; if (score >= minPassingScore) letterGrade = 'P'; else letterGrade = 'F'; return letterGrade; }
27.052632
56
0.480545
aceiro
2224fa53d15ae417f12d204ef9c7acb15b06e6b5
2,224
hpp
C++
include/gridtools/boundaries/direction.hpp
tehrengruber/gridtools
92bbbf65174d440c28a33babffde41b46ed943de
[ "BSD-3-Clause" ]
null
null
null
include/gridtools/boundaries/direction.hpp
tehrengruber/gridtools
92bbbf65174d440c28a33babffde41b46ed943de
[ "BSD-3-Clause" ]
null
null
null
include/gridtools/boundaries/direction.hpp
tehrengruber/gridtools
92bbbf65174d440c28a33babffde41b46ed943de
[ "BSD-3-Clause" ]
null
null
null
/* * GridTools * * Copyright (c) 2014-2019, ETH Zurich * All rights reserved. * * Please, refer to the LICENSE file in the root directory. * SPDX-License-Identifier: BSD-3-Clause */ #pragma once /** @file @brief definition of direction in a 3D cartesian grid */ namespace gridtools { namespace boundaries { /** \ingroup Boundary-Conditions * @{ */ /** @brief Enum defining the directions in a discrete Cartesian grid */ enum sign { any_ = -2, minus_ = -1, zero_, plus_ }; /** \ingroup Boundary-Conditions @brief Class defining a direction in a cartesian 3D grid. The directions correspond to the following: - all the three template parameters are either plus or minus: identifies a node on the cell \verbatim e.g. direction<minus_, plus_, minus_> corresponds to: .____. / /| o____. | | | . z | |/ x__/ .____. | y \endverbatim - there is one zero parameter: identifies one edge \verbatim e.g. direction<zero_, plus_, minus_> corresponds to: .____. / /| .####. | | | . | |/ .____. \endverbatim - there are 2 zero parameters: identifies one face \verbatim e.g. direction<zero_, zero_, minus_> corresponds to: .____. / /| .____. | |####| . |####|/ .####. \endverbatim - the case in which all three are zero does not belong to the boundary and is excluded. \tparam I_ Orientation in the I dimension \tparam J_ Orientation in the J dimension \tparam K_ Orientation in the K dimension */ template <sign I_, sign J_, sign K_> struct direction { static constexpr sign i = I_; static constexpr sign j = J_; static constexpr sign k = K_; }; } // namespace boundaries } // namespace gridtools
28.151899
102
0.503597
tehrengruber
2226718a81a4b52ad987ff20dcc7882042d03526
424
cpp
C++
_includes/leet022/leet022_1.cpp
mingdaz/leetcode
64f2e5ad0f0446d307e23e33a480bad5c9e51517
[ "MIT" ]
null
null
null
_includes/leet022/leet022_1.cpp
mingdaz/leetcode
64f2e5ad0f0446d307e23e33a480bad5c9e51517
[ "MIT" ]
8
2019-12-19T04:46:05.000Z
2022-02-26T03:45:22.000Z
_includes/leet022/leet022_1.cpp
mingdaz/leetcode
64f2e5ad0f0446d307e23e33a480bad5c9e51517
[ "MIT" ]
null
null
null
class Solution { public: vector<string> generateParenthesis(int n) { vector<string> res; helper("",n,0,res); return res; } void helper(string cur, int left, int right,vector<string>& res){ if(!left&&!right) res.push_back(cur); else{ if(left>0) helper(cur+"(",left-1,right+1,res); if(right>0) helper(cur+")",left,right-1,res); } } };
26.5
72
0.537736
mingdaz
2227f9972117dce06a1507be79c5659f570d265c
360
cpp
C++
SimCore/model/Chip/Chip.cpp
kino-6/BuiltInSystemSimulator
63d447f89c0c9166b93a96844d2d103f9d00a4b2
[ "Apache-2.0" ]
null
null
null
SimCore/model/Chip/Chip.cpp
kino-6/BuiltInSystemSimulator
63d447f89c0c9166b93a96844d2d103f9d00a4b2
[ "Apache-2.0" ]
null
null
null
SimCore/model/Chip/Chip.cpp
kino-6/BuiltInSystemSimulator
63d447f89c0c9166b93a96844d2d103f9d00a4b2
[ "Apache-2.0" ]
null
null
null
#include "Chip.h" SFR g_sfr; Chip::Chip(void) { this->Reset(); } Chip::~Chip(void) { } void Chip::Main(void) { this->fetch_sfr(); this->sfr.TMR += 1; this->reflect_sfr(); } void Chip::reflect_sfr(void) { g_sfr = this->sfr; } void Chip::fetch_sfr(void) { this->sfr = g_sfr; } void Chip::Reset(void) { this->sfr = { 0 }; g_sfr = this->sfr; }
10.285714
30
0.591667
kino-6
22285afe5975218c2971ec1b925c6f10700cb402
5,913
cpp
C++
src/map/generator/modules/Water.cpp
Yukkurigame/Yukkuri
3c8440b6b4e4d14cf6eec5685504839e4e714036
[ "MIT" ]
2
2017-05-15T19:28:37.000Z
2018-03-31T01:10:19.000Z
src/map/generator/modules/Water.cpp
Yukkurigame/Yukkuri
3c8440b6b4e4d14cf6eec5685504839e4e714036
[ "MIT" ]
null
null
null
src/map/generator/modules/Water.cpp
Yukkurigame/Yukkuri
3c8440b6b4e4d14cf6eec5685504839e4e714036
[ "MIT" ]
null
null
null
/* * Water.cpp * * Created on: 13.04.2013 */ #include "map/generator/modules/Water.h" #include "debug.h" #include "hacks.h" namespace MapWater { void redistributeMoisture( list< Corner* >& ); void calculateWatersheds( ); void createRivers( ); void assignCornerMoisture( ); void assignPolygonMoisture( ); MapProto* proto; GeneratorModule module = { &init, &clean, &process }; } void MapWater::init( ) { proto = NULL; } void MapWater::process( MapProto* pr ) { proto = pr; Debug::debug( Debug::MAP, "Assign moisture...\n" ); // Determine watersheds: for every corner, where does it flow // out into the ocean? calculateWatersheds(); // Create rivers. createRivers(); // Determine moisture at corners, starting at rivers // and lakes, but not oceans. Then redistribute // moisture to cover the entire range evenly from 0.0 // to 1.0. Then assign polygon moisture as the average // of the corner moisture. assignCornerMoisture(); list< Corner* > cnrs = MapGenerator::landCorners( proto ); redistributeMoisture( cnrs ); assignPolygonMoisture(); } void MapWater::clean( ) { proto = NULL; } GeneratorModule* MapWater::get_module() { return &module; } bool compareMoisture( const Corner* a, const Corner* b ) { return a->moisture < b->moisture; } /** * Change the overall distribution of moisture to be evenly distributed. */ void MapWater::redistributeMoisture( list< Corner* >& locations ) { locations.sort( compareMoisture ); float length = locations.count; int index = 0; ITER_LIST( Corner*, locations ){ double m = (double)index / length; it->data->moisture = m; index++; } } /** * Calculate the watershed of every land point. The watershed is * the last downstream land point in the downslope graph. * TODO: watersheds are currently calculated on corners, but it'd * be more useful to compute them on polygon centers so that every * polygon can be marked as being in one watershed. */ void MapWater::calculateWatersheds( ) { // Initially the watershed pointer points downslope one step. Corner* q; FOREACH1( q, proto->corners ) { q->watershed = q; if( !q->ocean && !q->coast ) q->watershed = q->downslope; } // Follow the downslope pointers to the coast. Limit to 100 // iterations although most of the time with NUM_POINTS=2000 it // only takes 20 iterations because most points are not far from // a coast. TODO: can run faster by looking at // p.watershed.watershed instead of p.downslope.watershed. for( int i = 0, changed = 0; i < 100; ++i, changed = 0 ){ Corner* q; FOREACH1( q, proto->corners ) { if( !q->ocean && !q->coast && !q->watershed->coast ){ Corner* r = q->downslope->watershed; //Corner* r = q->downslope->watershed; if( !r->ocean ) q->watershed = r; changed++; } } if( !changed ) break; } // How big is each watershed? FOREACH1( q, proto->corners ) { Corner* r = q->watershed; r->watershed_size++; } int min_watershed = 20; for( int i = 0, changed = 0; i < 100; ++i, changed = 0 ){ FOREACH1( q, proto->corners ) { if( q->watershed->watershed_size > min_watershed ) continue; ITER_LIST( Corner*, q->adjacent ){ Corner* r = it->data->watershed; if( r->watershed_size > min_watershed ){ q->watershed = r->watershed; changed = true; break; } } } if( !changed ) break; } } /** * Create rivers along edges. Pick a random corner point, then * move downslope. Mark the edges and corners as rivers. */ void MapWater::createRivers( ) { int length = proto->corners.size(); if( !length ) return; list< Corner* > river_sources; for( int i = 0; i < GENERATOR_SIZE / 2; i++ ){ // FIXME: this place prevents from usnig list for corners Corner* q = proto->corners[proto->mapRandom.nextInt( 0, length - 1 )]; if( q->ocean || q->elevation < 0.3 || q->elevation > 0.9 ) continue; river_sources.push(q); // Bias rivers to go west: if (q.downslope.x > q.x) continue; while( !q->coast ){ if( q == q->downslope ) break; Edge* edge = MapGenerator::lookupEdgeFromCorner( q, q->downslope ); edge->river++; q->river++; q->downslope->river++; // TODO: fix double count q = q->downslope; } } // Make all rivers end at lakes or another rivers while( river_sources.count > 0 ){ Corner* source = river_sources.pop(); Corner* q = source; while( !q->coast && q != q->downslope && q->downslope->river ) q = q->downslope; if( q->coast ) continue; if( q->river > 3 ) q->downslope->touches.head->data->water = true; // TODO: connect to another rivers } } /** * Calculate moisture. Freshwater sources spread moisture: rivers * and lakes (not oceans). Saltwater sources have moisture but do * not spread it (we set it at the end, after propagation). */ void MapWater::assignCornerMoisture( ) { list< Corner* > queue; // Fresh water Corner* q; FOREACH1( q, proto->corners ) { if( ( q->water || q->river > 0 ) && !q->ocean ){ q->moisture = q->river > 0 ? std::min( 3.0, 0.2 * (double)q->river ) : 1.0; queue.push_back( q ); }else{ q->moisture = 0.0; } } while( queue.count > 0 ){ Corner* q = queue.pop(); ITER_LIST( Corner*, q->adjacent ){ Corner* r = it->data; double newMoisture = q->moisture * 0.9; if( newMoisture > r->moisture ){ r->moisture = newMoisture; queue.push_back( r ); } } } // Salt water FOREACH1( q, proto->corners ) { if( q->ocean || q->coast ) q->moisture = 1.0; } } /** * Polygon moisture is the average of the moisture at corners */ void MapWater::assignPolygonMoisture( ) { Center* p; FOREACH1( p, proto->centers ) { double sumMoisture = 0.0; double count = p->corners.count; ITER_LIST( Corner*, p->corners ){ Corner* q = it->data; if( q->moisture > 1.0 ) q->moisture = 1.0; sumMoisture += q->moisture; } p->moisture = sumMoisture / count; } }
22.655172
72
0.643666
Yukkurigame
222860ac5e12896f94c5162e06f71dbb82925e31
4,386
cpp
C++
extsamp/company.cpp
OS2World/DEV-SAMPLES-SOM-IBM
083a80ccf1c7afe2518f3cbf90998ccc5cf44391
[ "BSD-3-Clause" ]
null
null
null
extsamp/company.cpp
OS2World/DEV-SAMPLES-SOM-IBM
083a80ccf1c7afe2518f3cbf90998ccc5cf44391
[ "BSD-3-Clause" ]
null
null
null
extsamp/company.cpp
OS2World/DEV-SAMPLES-SOM-IBM
083a80ccf1c7afe2518f3cbf90998ccc5cf44391
[ "BSD-3-Clause" ]
null
null
null
/* * * 25H7912 (C) COPYRIGHT International Business Machines Corp. 1992,1996,1996 * All Rights Reserved * Licensed Materials - Property of IBM * US Government Users Restricted Rights - Use, duplication or * disclosure restricted by GSA ADP Schedule Contract with IBM Corp. * * * * DISCLAIMER OF WARRANTIES. * The following [enclosed] code is sample code created by IBM * Corporation. This sample code is not part of any standard or IBM * product and is provided to you solely for the purpose of assisting * you in the development of your applications. The code is provided * "AS IS". IBM MAKES NO WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT * NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS * FOR A PARTICULAR PURPOSE, REGARDING THE FUNCTION OR PERFORMANCE OF * THIS CODE. IBM shall not be liable for any damages arising out of * your use of the sample code, even if they have been advised of the * possibility of such damages. * * DISTRIBUTION. * This sample code can be freely distributed, copied, altered, and * incorporated into other software, provided that it bears the above * Copyright notice and DISCLAIMER intact. * */ #ifndef lint static char *sccsid = "%Z% %I% %W% %G% %U% [%H% %T%]"; #endif /* * COMPANY.CPP * * NOTE * Please read the README file before inspecting this code. It provides * a context to enhance your understanding of how the Externalization * Service can be used to your advantage. * * DESCRIPTION: * * This program creates a company object on an object server named * objServer. The object is created their because it is the only * server that has the VeryBigCo interface registered with it. This * company object is processed by the clients (client1 and client2) * packaged with this sample. * * COMPANY ALGORITHM -- main() * 1. Create remote object * 2. Bind the object to a name. This allows clients to use the * Name Service to resolve a reference to the object by using the name. * end algorithm */ #include <iostream.h> #include <somd.xh> #include <somnm.xh> // Usage binding for Name Service #include "util.hpp" // Utilities for the samples #include "samobj.xh" // Usage bindings of the sample object void main(int argc, char **argv) { Environment *ev = somGetGlobalEnvironment(); OESSample_VeryBigCo * companyObj, *tmpCo; SOM_InitEnvironment(ev); // Setup for processing SOMD_Init(ev); tmpCo = (OESSample_VeryBigCo *) (void *) somdCreate(ev, "OESSample::VeryBigCo", FALSE); checkException(ev, "Company -- Creating the company object"); companyObj = (OESSample_VeryBigCo *) (void *) tmpCo->init_for_object_creation(ev); checkException(ev, "Company -- Initializing the company object"); ((SOMDObject *)tmpCo)->release(ev); checkException(ev, "Company -- Dis-associating pointer from company object storage"); companyObj->populate(ev); somPrintf("******* REMOTE OBJECT CREATED ON THE OBJSERVER ********\n"); ExtendedNaming_ExtendedNamingContext *nameContext; char *kind = "object interface"; // Define the name char *id = "Dept45"; // for the Department CosNaming_NameComponent nameComponent = {id, kind}; // 45 object that is CosNaming_Name name = { 1, 1, &nameComponent }; // embedded in companyObj nameContext = (ExtendedNaming_ExtendedNamingContext*) SOMD_ORBObject->resolve_initial_references(ev, "NameService"); checkException(ev, "Company -- Fetch reference to root naming context"); // Register the Department 45 object with the Naming Server. nameContext->bind(ev, &name, (SOMObject*) ((void *) companyObj->_get_dept45(ev)) ); if (ev->_major == USER_EXCEPTION) { if(strcmp(ev->exception._exception_name, "::CosNaming::NamingContext::AlreadyBound") == 0) { somExceptionFree(ev); nameContext->unbind(ev, &name); nameContext->bind(ev, &name, (SOMObject*) ((void *) companyObj->_get_dept45(ev)) ); } else { somPrintf("Department 45 object bind failed\n"); exit(1); } } somPrintf("******* REMOTE OBJECT REGISTERED WITH THE NAME SERVER ********\n"); somPrintf("******* You may now run client1 and/or client2 ********\n"); } 
37.487179
98
0.676471
OS2World
222a48a800ee9eae152891fa0360f5c680a2fb93
3,441
cpp
C++
CPP_Files/Button.cpp
Yaters/Knightmare
4440fafb910054cc70bc2d01994435011226061f
[ "MIT" ]
null
null
null
CPP_Files/Button.cpp
Yaters/Knightmare
4440fafb910054cc70bc2d01994435011226061f
[ "MIT" ]
null
null
null
CPP_Files/Button.cpp
Yaters/Knightmare
4440fafb910054cc70bc2d01994435011226061f
[ "MIT" ]
null
null
null
#include "Button.h" Button::Button() { size = glm::vec2(0, 0); pos = glm::vec2(0, 0); charSize = 0; stringSize = glm::vec2(0,0); boxTitle = "Button"; } //Basic constructor sets values Button::Button(std::string text, glm::vec2 size, glm::vec2 pos, GLfloat charSize): text(text) { this->size = size; this->pos = pos; this->charSize = charSize; StringSize(); boxTitle = "Button"; } Button::Button(std::string text, glm::vec2 size, glm::vec2 pos, GLfloat charSize, TextMode mode) : text(text) { this->mode = mode; this->size = size; this->pos = pos; this->charSize = charSize; StringSize(); boxTitle = "Button"; } void Button::setTextColor(glm::vec3 mainColor) { this->textColor = mainColor; } void Button::setTextColor(glm::vec3 mainColor, glm::vec3 outsideColor) { this->textColor = mainColor; this->textOutsideColor = outsideColor; } void Button::setTextOutsideColor(glm::vec3 outsideColor) { this->textOutsideColor = outsideColor; } void Button::StringSize() { std::string::const_iterator c; FontGlyph ch; GLfloat sizeX = 0; GLfloat sizeY = 0; GLfloat scale = charSize / 10.f; GLint num = 0; GLfloat avgHeight = 0; // / 10.f is from random downsize in string draw method for (c = this->text.begin(); c != this->text.end(); c++, num++) { ch = Resource_manager::GetFont("Arial").getGlyph((unsigned char) *c); sizeX += ch.Advance * scale; //TODO: Make the size (here and in draw string) dynamic w/ button size //Alright, here's the deal. X works perfectly. For y, I have no clue what to do. //This is not exact. In fact, it's probaby mathematical nonsense. But it gets the //ballpark, so I'm happy. I'm sorry all you OCD people out there GLfloat test = ch.Size.y * scale + ch.Bearing.y * scale; test *= -1; avgHeight += test; } avgHeight /= (float)num; sizeY = avgHeight; this->stringSize = glm::vec2(sizeX, sizeY); } //Basic draw function, draws the button texture with the given size and pos //If the mouse is in the button, changes the button color and updates isSelected //Will need to update once text feature is up and running void Button::Draw(glm::vec2 cursorPos, SpriteRender* renderer) { //This pos is top left, string pos is bottom left // - - - - - - - - - - - - - - - - - - - - - //| LABEL | // - - - - - - - - - - - - - - - - - - - - - glm::vec2 stringPos = this->pos; stringPos.y += (this->size.y + this->stringSize.y) / 2.f; stringPos.x += (this->size.x - this->stringSize.x) / 2.f; if (!Collider::checkPointRecCol(cursorPos, *this)) { //Normal button blue words if not selected renderer->DrawSprite(Resource_manager::GetTexture(boxTitle), pos, size, glm::vec2(0, -1), glm::vec4(1, 1, 1, 1)); //renderer->DrawString(text, "Arial", stringPos, this->charSize, glm::vec3(0.0, 0.0, 1.0)); //Draw blue if selected renderer->DrawString(text, "Arial", stringPos, this->charSize, this->textColor, this->textOutsideColor, this->mode); isSelected = GL_FALSE; } else { //Blue button Red words if not selected renderer->DrawSprite(Resource_manager::GetTexture(boxTitle), pos, size, glm::vec2(0, -1), glm::vec4(0.5, 0.5, 1.0, 1.0)); //renderer->DrawString(text, "Arial", stringPos, this->charSize, glm::vec3(0.540, 0.062, 0.109)); //Draw blue if selected renderer->DrawString(text, "Arial", stringPos, this->charSize, 1.0f - this->textColor, 1.0f - this->textOutsideColor, this->mode); isSelected = GL_TRUE; } }
36.606383
132
0.66347
Yaters
222f8e1a3a058234efb038ca7dec8660bb15a64a
1,350
cpp
C++
karum/DeleteList.cpp
shivanib01/codes
f0761472a4b4bea3667c0c13b1c9bcfe5b2597a3
[ "MIT" ]
null
null
null
karum/DeleteList.cpp
shivanib01/codes
f0761472a4b4bea3667c0c13b1c9bcfe5b2597a3
[ "MIT" ]
null
null
null
karum/DeleteList.cpp
shivanib01/codes
f0761472a4b4bea3667c0c13b1c9bcfe5b2597a3
[ "MIT" ]
null
null
null
#include<iostream> #include<cstdlib> using namespace std; class Node{ public: int data; Node *next; Node(){} Node(int d){ data=d; next=NULL; } Node *insertElement(Node *head,int d){ Node *np=new Node(d); Node *tmp=head; if(head==NULL) return np; else while(tmp->next) tmp=tmp->next; tmp->next=np; return head; } void deleteList(Node *head){ while(head->next!=NULL){ Node *t=head; cout<<"Freeing "<<t->data<<".\n"; head=head->next; free(t); } cout<<"Freeing "<<head->data<<".\n"; free(head); cout<<"The list is empty now.\n"; } }; int main() { int n,p; Node np; Node *head=NULL; cout<<"Enter the size of linked list: "; cin>>n; for(int i=0;i<n;i++){ cout<<"\nEnter element "<<i+1<<": "; cin>>p; head=np.insertElement(head,p); } np.deleteList(head); }
21.774194
60
0.36
shivanib01
22386e73c247825f89ce2ead691d0f9f15e97948
3,536
hpp
C++
Include/Events/Receiver.hpp
igorlev91/DemoEngine
8aaef0d3504826c9dcabe0a826a54613fca81c87
[ "Apache-2.0" ]
null
null
null
Include/Events/Receiver.hpp
igorlev91/DemoEngine
8aaef0d3504826c9dcabe0a826a54613fca81c87
[ "Apache-2.0" ]
null
null
null
Include/Events/Receiver.hpp
igorlev91/DemoEngine
8aaef0d3504826c9dcabe0a826a54613fca81c87
[ "Apache-2.0" ]
null
null
null
#pragma once #include "Common/Debug.hpp" #include "Events/Dispatcher.hpp" #include "Events/Delegate.hpp" // Forward declarations. namespace Common { template<typename Type> class DispatcherBase; template<typename Type> class ReceiverInvoker; } /* Receiver Invokes a delegate after receiving a signal from a dispatcher. Single receiver instance can be subscribed to only one dispatcher. See Dispatcher template class for more information. */ namespace Common { template<typename Type> class Receiver; template<typename ReturnType, typename... Arguments> class Receiver<ReturnType(Arguments...)> : public Delegate<ReturnType(Arguments...)> { public: // Friend declarations. friend DispatcherBase<ReturnType(Arguments...)>; friend ReceiverInvoker<ReturnType(Arguments...)>; public: // Constructor. Receiver() : m_dispatcher(nullptr), m_previous(nullptr), m_next(nullptr) { } // Destructor. virtual ~Receiver() { // Unsubscribe from the dispatcher. this->Unsubscribe(); } // Disallow copying. Receiver(const Receiver& other) = delete; Receiver& operator=(const Receiver& other) = delete; // Move operations. Receiver(Receiver&& other) : Receiver() { // Call the assignment operator. *this = std::move(other); } Receiver& operator=(Receiver&& other) { // Swap class members. std::swap(m_dispatcher, other.m_dispatcher); std::swap(m_previous, other.m_previous); std::swap(m_next, other.m_next); // Do not swap the underlying delegate. // We only want to swap the dispatcher subscription. return *this; } // Subscribes to a dispatcher. bool Subscribe(DispatcherBase<ReturnType(Arguments...)>& dispatcher, bool unsubscribeReceiver = true) { return dispatcher.Subscribe(*this, unsubscribeReceiver); } // Unsubscribes from the current dispatcher. void Unsubscribe() { if(m_dispatcher != nullptr) { m_dispatcher->Unsubscribe(*this); ASSERT(m_dispatcher == nullptr, "Dispatcher did not unsubscribe this receiver properly!"); ASSERT(m_previous == nullptr, "Dispatcher did not unsubscribe this receiver properly!"); ASSERT(m_next == nullptr, "Dispatcher did not unsubscribe this receiver properly!"); } } private: // Receives an event and invokes a bound function. ReturnType Receive(Arguments... arguments) { ASSERT(m_dispatcher, "Invoked a receiver without it being subscribed!"); return this->Invoke(std::forward<Arguments>(arguments)...); } // Make derived invoke method private. // We do not want other classes calling this. ReturnType Invoke(Arguments... arguments) { return Delegate<ReturnType(Arguments...)>::Invoke(std::forward<Arguments>(arguments)...); } private: // Intrusive double linked list element. DispatcherBase<ReturnType(Arguments...)>* m_dispatcher; Receiver<ReturnType(Arguments...)>* m_previous; Receiver<ReturnType(Arguments...)>* m_next; }; }
29.22314
109
0.595871
igorlev91
22453f62f0865c998d1e6f2b5ba708fbfa6b2622
4,965
cpp
C++
example/distances.cpp
mjtrautmann/AnalyticalGeometry
86213d68c5ecfc1b0743ab90b91f4e1cb42f7ca9
[ "MIT" ]
null
null
null
example/distances.cpp
mjtrautmann/AnalyticalGeometry
86213d68c5ecfc1b0743ab90b91f4e1cb42f7ca9
[ "MIT" ]
null
null
null
example/distances.cpp
mjtrautmann/AnalyticalGeometry
86213d68c5ecfc1b0743ab90b91f4e1cb42f7ca9
[ "MIT" ]
null
null
null
// MIT License // // Copyright (c) 2022 mjtrautmann // // 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. // // #include "../src/AnalyticalGeometry.h" #include <iostream> #include <cstdlib> int main() { std::cout << "Exmples for Analytical Geometry Library" << std::endl; { analyticalgeom::Coordinate p0(0, 1, 0); analyticalgeom::Coordinate p1(2, 1, 0); analyticalgeom::Coordinate p2(1, 2, 1); analyticalgeom::Coordinate p3(1, 2, 1.00001); analyticalgeom::Coordinate p4(1, 2, 1.0000001); std::cout << "The distance between " << p0 << " and " << p1 << " is " << (p1 - p0).length() << std::endl; std::cout << "The distance between " << p0 << " and " << p2 << " is " << (p2-p0).length() << std::endl << std::endl; std::cout << "The points " << p2 << " and " << p3 << " are " << ((p2==p3)? " identical " : " different ") << std::endl; std::cout << "The points " << p2 << " and " << p4 << " are " << ((p2==p4)? " identical " : " different ") << std::endl; analyticalgeom::Line line(p0, p1); std::cout << "The line through point " << p0 << " and " << p1 << " is " << line << std::endl; std::cout << "The projection of point " << p2 << " on line " << line << " is point " << analyticalgeom::AnalyticalGeometry::projection(line, p2) << std::endl; std::cout << "The shortest distance between line " << line << " and point " << p2 << " is " << analyticalgeom::AnalyticalGeometry::distance(line, p2) << std::endl << std::endl; analyticalgeom::Plane plane(p0, p1, p2); std::cout << "The points " << p0 << ", " << p1 << " and " << p2 << " form the plane " << plane << std::endl; std::cout << "The projection of " << p3 << " on the plane " << plane << " is " << analyticalgeom::AnalyticalGeometry::projection(plane, p3) << std::endl; std::cout << "The distance between point " << p3 << " and plane " << plane << " is " << analyticalgeom::AnalyticalGeometry::distance(plane, p3) << std::endl << std::endl; analyticalgeom::Plane plane2(p0 + plane.n(), plane.n()); std::cout << "The plane " << plane << " shifted in normal direction by 1 unit produces the plane " << plane2 << std::endl; std::cout << "The planes are " << (analyticalgeom::AnalyticalGeometry::isParallel(plane, plane2) ? std::string("parallel") : std::string("not parallel")) << std::endl; analyticalgeom::Plane plane3(p0, p1, p3); std::cout << acrossb(plane.n(), plane3.n()) << std::endl; std::cout << "The planes " << plane << " and " << plane3 << " are " << (analyticalgeom::AnalyticalGeometry::isParallel(plane, plane3) ? std::string("parallel") : std::string("not parallel")) << std::endl; analyticalgeom::Plane plane4(p0, p1, p4); std::cout << acrossb(plane.n(), plane4.n()) << std::endl; std::cout << "The planes " << plane << " and " << plane4 << " are " << (analyticalgeom::AnalyticalGeometry::isParallel(plane, plane4) ? std::string("parallel") : std::string("not parallel")) << std::endl; } std::cout << std::endl << std::endl; { analyticalgeom::Coordinate2D p0(0, 1); analyticalgeom::Coordinate2D p1(2, 1); analyticalgeom::Coordinate2D p2(1, 2); analyticalgeom::Coordinate2D p3(1, 2.01); std::cout << "The distance between " << p0 << " and " << p1 << " is " << (p1 - p0).length() << std::endl; std::cout << "The distance between " << p0 << " and " << p2 << " is " << (p2-p0).length() << std::endl << std::endl; analyticalgeom::Line2D line(p0, p1); std::cout << "The line through point " << p0 << " and " << p1 << " is " << line << std::endl; std::cout << "The projection of point " << p2 << " on line " << line << " is point " << analyticalgeom::AnalyticalGeometry::projection(line, p2) << std::endl; std::cout << "The shortest distance between line " << line << " and point " << p2 << " is " << analyticalgeom::AnalyticalGeometry::distance(line, p2) << std::endl << std::endl; } return 0; }
56.420455
207
0.622961
mjtrautmann
22470115de1902158dd1566b554579148025e1b7
1,925
cpp
C++
tests/unit/typegen_implicit.cpp
joyliu37/coreir
d7e68a1f17b8925965180e08dd5ecf9397bc057e
[ "BSD-3-Clause" ]
null
null
null
tests/unit/typegen_implicit.cpp
joyliu37/coreir
d7e68a1f17b8925965180e08dd5ecf9397bc057e
[ "BSD-3-Clause" ]
null
null
null
tests/unit/typegen_implicit.cpp
joyliu37/coreir
d7e68a1f17b8925965180e08dd5ecf9397bc057e
[ "BSD-3-Clause" ]
null
null
null
#include "coreir.h" using namespace std; using namespace CoreIR; int main() { Context* c = newContext(); Namespace* g = c->getGlobal(); //Declare an implicit TypeGenerator TypeGen* tg = TypeGenImplicit::make( g, "add_type", //name for the typegen {{"width",c->Int()}} //generater parameters ); Generator* add = g->newGeneratorDecl("add",tg,{{"width",c->Int()}}); { Module* m5 = add->getModule( {{"width",Const::make(c,5)}}, c->Record({ {"in0",c->BitIn()->Arr(5)}, {"in1",c->BitIn()->Arr(5)}, {"out",c->Bit()->Arr(5)} }) ); ModuleDef* def = m5->newModuleDef(); def->addInstance("i0","coreir.add",{{"width",Const::make(c,5)}}); def->connect("self","i0"); } { Module* m9 = add->getModule( {{"width",Const::make(c,9)}}, c->Record({ {"in0",c->BitIn()->Arr(9)}, {"in1",c->BitIn()->Arr(9)}, {"out",c->Bit()->Arr(9)} }) ); ModuleDef* def = m9->newModuleDef(); def->addInstance("i0","coreir.add",{{"width",Const::make(c,9)}}); def->connect("self","i0"); } // Define Add12 Module Module* top = g->newModuleDecl("top",c->Record()); ModuleDef* def = top->newModuleDef(); def->addInstance("add5","global.add",{{"width",Const::make(c,5)}}); def->addInstance("add9","global.add",{{"width",Const::make(c,9)}}); top->setDef(def); top->print(); cout << "Checking saving and loading postgen" << endl; if (!saveToFile(g, "_typegen_implicit.json",top)) { cout << "Could not save to json!!" << endl; c->die(); } deleteContext(c); c = newContext(); top = nullptr; if (!loadFromFile(c,"_typegen_implicit.json", &top)) { cout << "Could not Load from json!!" << endl; c->die(); } ASSERT(top, "Could not load top: typegen_implicit"); top->print(); c->runPasses({"rungenerators","flatten"}); top->print(); }
23.765432
71
0.54961
joyliu37
2249453ec0f3b2c4062157997d230cd6a0a13a14
1,965
cc
C++
stack/basic_calculator.cc
windscope/Cracking
0db01f531ff56428bafff72aaea1d046dbc14112
[ "Apache-2.0" ]
null
null
null
stack/basic_calculator.cc
windscope/Cracking
0db01f531ff56428bafff72aaea1d046dbc14112
[ "Apache-2.0" ]
null
null
null
stack/basic_calculator.cc
windscope/Cracking
0db01f531ff56428bafff72aaea1d046dbc14112
[ "Apache-2.0" ]
null
null
null
#include <vector> #include <stack> #include <string> #include <cctype> #include <iostream> #include <cassert> using namespace std; class Solution { public: int calculate(string s) { stack<int> signs; // signs record the predefine sign: signs*1() signs.push(1); // treat a as (a) int sign = 1; int accum = 0; int num = 0; s.push_back(')'); for (auto c : s) { if (c == '+' || c == '-') { accum += num * sign * signs.top(); sign = c == '+' ? 1 : -1; num = 0; } else if (c == '(') { // flip signs if neccesary signs.push(sign * signs.top()); sign = 1; } else if (c == ')') { // calcuate the result if necessary accum += num * sign * signs.top(); signs.pop(); sign = 1; num = 0; } else if (isdigit(c)) { num = num * 10 + c - '0'; } else if (c == ' ') { continue; } else { // unreachable return 0; } } return accum; } }; int main() { vector<string> test_cases = { "0", "10", "5+2-3", "8-(3+5)+(3+2)", "(10)+2", "1-(100+3-2+4-3)", "10+32-(3+2-4+44-33)+(22+3-21+3)-(3232+333-222)+3-32-21-2", " 30", "(3-(2-(5-(9-(4)))))" }; vector<int> results = { 0, 10, 4, 5, 12, -101, -3358, 30, 1 }; Solution s; for (int i = 0; i < static_cast<int>(test_cases.size()); ++i) { // cout << "calculated: " << s.calculate(test_cases[i]) << ", real: " <<results[i] << endl; assert(s.calculate(test_cases[i]) == results[i]); } cout << "You Passed" << endl; return 0; }
23.392857
99
0.384733
windscope
224e8bd287ec00157d536cc395b5589a0d0d0fe7
2,412
cc
C++
src/cpu/backend.cc
aj7tesh/CTranslate2
8e424efdbcf40c89dca7e237a249464a95eeaf74
[ "MIT" ]
null
null
null
src/cpu/backend.cc
aj7tesh/CTranslate2
8e424efdbcf40c89dca7e237a249464a95eeaf74
[ "MIT" ]
null
null
null
src/cpu/backend.cc
aj7tesh/CTranslate2
8e424efdbcf40c89dca7e237a249464a95eeaf74
[ "MIT" ]
null
null
null
#include "backend.h" #ifdef CT2_WITH_MKL # include <mkl.h> #endif #include "ctranslate2/utils.h" #include "cpu_info.h" namespace ctranslate2 { namespace cpu { #ifdef CT2_WITH_MKL static inline bool mkl_has_fast_int_gemm() { # if __INTEL_MKL__ > 2019 || (__INTEL_MKL__ == 2019 && __INTEL_MKL_UPDATE__ >= 5) // Intel MKL 2019.5 added optimized integers GEMM for SSE4.2 and AVX (in addition to // the existing AVX2 and AVX512), so it is virtually optimized for all target platforms. return true; # else return mkl_cbwr_get_auto_branch() >= MKL_CBWR_AVX2; # endif } #endif static bool mayiuse_mkl_init() { const std::string use_mkl_env = read_string_from_env("CT2_USE_MKL"); if (use_mkl_env.empty()) { #ifdef CT2_WITH_MKL return cpu_is_intel(); #else return false; #endif } else { const bool use_mkl = string_to_bool(use_mkl_env); #ifndef CT2_WITH_MKL if (use_mkl) throw std::invalid_argument("This CTranslate2 binary was not compiled with Intel MKL"); #endif return use_mkl; } } bool mayiuse_mkl() { static const bool mayiuse = mayiuse_mkl_init(); return mayiuse; } std::string gemm_backend_to_str(GemmBackend gemm_backend) { switch (gemm_backend) { case GemmBackend::MKL: return "MKL"; case GemmBackend::DNNL: return "DNNL"; default: return "NONE"; } } GemmBackend get_gemm_backend(ComputeType compute_type) { #ifdef CT2_WITH_DNNL if (!mayiuse_mkl()) { if (compute_type != ComputeType::INT16) return GemmBackend::DNNL; else return GemmBackend::NONE; } #endif #ifdef CT2_WITH_MKL if (compute_type == ComputeType::FLOAT || mkl_has_fast_int_gemm()) { return GemmBackend::MKL; } #endif return GemmBackend::NONE; } bool has_gemm_backend(ComputeType compute_type) { return get_gemm_backend(compute_type) != GemmBackend::NONE; } bool prefer_u8s8s32_gemm() { const auto gemm_s8_backend = get_gemm_backend(ComputeType::INT8); return gemm_s8_backend == cpu::GemmBackend::MKL || gemm_s8_backend == cpu::GemmBackend::DNNL; } bool should_pack_gemm_weights() { static const bool should_pack = read_bool_from_env("CT2_USE_EXPERIMENTAL_PACKED_GEMM"); return should_pack; } } }
25.935484
99
0.660862
aj7tesh
224f46a12acd0c706f28ddfe9f6303cc7363e10d
7,332
cpp
C++
src/mapclear.cpp
SenhorGatinho/kale
a4e1819c568c3925cd7e94a8b06608e1c233ebf9
[ "MIT" ]
32
2015-03-02T05:40:42.000Z
2022-02-21T04:13:02.000Z
src/mapclear.cpp
SenhorGatinho/kale
a4e1819c568c3925cd7e94a8b06608e1c233ebf9
[ "MIT" ]
null
null
null
src/mapclear.cpp
SenhorGatinho/kale
a4e1819c568c3925cd7e94a8b06608e1c233ebf9
[ "MIT" ]
3
2017-02-03T05:01:51.000Z
2022-01-10T01:38:13.000Z
#include "mapclear.h" #include "romfile.h" #include "level.h" #include <cstdint> #include <cstdio> #include <QSpinBox> std::vector<QRect> mapClearData[7][16]; const romaddr_t ptrMapClearL = {0x12, 0x9C7E}; const romaddr_t ptrMapClearH = {0x12, 0x9CEE}; const uint ptrMapClearB = 0x12; const romaddr_t mapClearStart = {0x12, 0x9D5E}; void loadMapClearData(ROMFile& rom, uint map, uint width) { for (uint level = 0; level < 16; level++) { mapClearData[map][level].clear(); uint8_t bytes[4] = {0}; romaddr_t addr = rom.readShortPointer(ptrMapClearL, ptrMapClearH, ptrMapClearB, (map * 16) + level); if (!addr.addr) continue; do { rom.readBytes(addr, 4, bytes); addr.addr += 4; uint screen = bytes[0] & 0xF; uint x = (screen % width * SCREEN_WIDTH) + (bytes[1] & 0xF); uint y = (screen / width * SCREEN_HEIGHT) + (bytes[1] >> 4); mapClearData[map][level].push_back(QRect(x, y, bytes[2], bytes[3])); } while (bytes[0] < 0x80); } } void saveMapClearData(ROMFile& rom, const leveldata_t *levelData, uint num) { romaddr_t addr = mapClearStart; // get address to write clear data to based on how many rects were written // for previous levels for (uint map = 0; map < num; map++) for (uint level = 0; level < 0x10; level++) addr.addr += 4 * mapClearData[map][level].size(); for (uint level = 0; level < 0x10; level++) { std::vector<QRect>& rects = mapClearData[num][level]; if (!rects.size()) { rom.writeToShortPointer(ptrMapClearL, ptrMapClearH, {0, 0}, 0, NULL, num * 16 + level); continue; } rom.writeToShortPointer(ptrMapClearL, ptrMapClearH, addr, 0, NULL, num * 16 + level); uint numRects = rects.size(); for (std::vector<QRect>::const_iterator i = rects.begin(); i != rects.end(); i++) { uint8_t bytes[4]; // byte 0: screen bytes[0] = (i->y() / SCREEN_HEIGHT * levelData->header.screensH) + (i->x() / SCREEN_WIDTH); // and last rect flag if (--numRects == 0) bytes[0] |= 0x80; // byte 1: Y/X coords bytes[1] = ((i->y() % SCREEN_HEIGHT) << 4) | (i->x() % SCREEN_WIDTH); // bytes 2-3: width/height bytes[2] = i->width(); bytes[3] = i->height(); // write it rom.writeBytes(addr, 4, bytes); addr.addr += 4; } } } MapClearDelegate::MapClearDelegate(QObject *parent) : QItemDelegate(parent) {} QWidget* MapClearDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem&, const QModelIndex& index) const { QSpinBox *editor = new QSpinBox(parent); int col = index.column(); editor->setMinimum(0); switch (col) { case MapClearModel::columnX: editor->setMaximum(16 * SCREEN_WIDTH - 1); break; case MapClearModel::columnY: editor->setMaximum(16 * SCREEN_HEIGHT - 1); break; default: editor->setMaximum(255); break; } return editor; } void MapClearDelegate::setEditorData(QWidget *editor, const QModelIndex& index) const { int val = index.model()->data(index).toInt(); QSpinBox *box = static_cast<QSpinBox*>(editor); box->setValue(val); } void MapClearDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex& index) const { QSpinBox *box = static_cast<QSpinBox*>(editor); box->interpretText(); model->setData(index, box->value()); } void MapClearDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem& option, const QModelIndex &) const { editor->setGeometry(option.rect); } MapClearModel::MapClearModel(QObject *parent) : QAbstractTableModel(parent), level(0), rects(NULL) {} int MapClearModel::rowCount(const QModelIndex&) const { // return number of rects for this stage if (rects) return rects->size(); return 0; } int MapClearModel::columnCount(const QModelIndex&) const { return 4; } Qt::ItemFlags MapClearModel::flags(const QModelIndex&) const { return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsEditable; } QVariant MapClearModel::data(const QModelIndex& index, int role) const { switch (role) { case Qt::DisplayRole: if (!rects) return 0; int col = index.column(); int row = index.row(); QRect rect = rects->at(row); switch (col) { case columnX: return rect.x(); case columnY: return rect.y(); case columnWidth: return rect.width(); case columnHeight: return rect.height(); default: return QVariant(); } break; } return QVariant(); } QVariant MapClearModel::headerData(int section, Qt::Orientation orientation, int role) const { switch (role) { case Qt::DisplayRole: if (orientation == Qt::Horizontal) { switch (section) { case columnX: return QString("X"); case columnY: return QString("Y"); case columnWidth: return QString("Width"); case columnHeight: return QString("Height"); default: return QVariant(); } } else { return section + 1; } break; } return QVariant(); } bool MapClearModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (role == Qt::EditRole) { int row = index.row(); int col = index.column(); QRect& rect = rects->at(row); bool ok; uint val = value.toUInt(&ok); if (!ok) return false; switch (col) { case columnX: rect.moveLeft(val); break; case columnY: rect.moveTop(val); break; case columnWidth: rect.setWidth(val); break; case columnHeight: rect.setHeight(val); break; default: return false; } emit dataChanged(index, index); return true; } return false; } bool MapClearModel::insertRow(int row, const QModelIndex &parent) { if (rects && (uint)row < rects->size()) { beginInsertRows(parent, row, row); rects->insert(rects->begin() + row, QRect()); endInsertRows(); return true; } else if (rects) { beginInsertRows(parent, row, row); rects->push_back(QRect()); endInsertRows(); return true; } return false; } bool MapClearModel::removeRow(int row, const QModelIndex &parent) { if (rects && (uint)row < rects->size()) { beginRemoveRows(parent, row, row); rects->erase(rects->begin() + row); endRemoveRows(); return true; } return false; } void MapClearModel::setRects(std::vector<QRect> *newRects) { if (newRects) { beginResetModel(); rects = newRects; endResetModel(); } }
25.109589
125
0.563557
SenhorGatinho
2254e220fb9dcba2d2970100b007d57cf6fe7e40
4,801
cpp
C++
src/World.cpp
aebarber/LD41
9501e3bd4de5e617a36f4065f4e6ab3f898abe4c
[ "MIT" ]
null
null
null
src/World.cpp
aebarber/LD41
9501e3bd4de5e617a36f4065f4e6ab3f898abe4c
[ "MIT" ]
null
null
null
src/World.cpp
aebarber/LD41
9501e3bd4de5e617a36f4065f4e6ab3f898abe4c
[ "MIT" ]
null
null
null
#include "../include/World.hpp" World::World () { m_grassTexture.loadFromImage(*aw::AssetStore::getImage("grass")); m_gravelTexture.loadFromImage(*aw::AssetStore::getImage("gravel")); m_waterTexture.loadFromImage(*aw::AssetStore::getImage("water")); m_mudTexture.loadFromImage(*aw::AssetStore::getImage("mud")); m_bushTexture.loadFromImage(*aw::AssetStore::getImage("bush")); m_treeTexture.loadFromImage(*aw::AssetStore::getImage("tree")); m_mountainTexture.loadFromImage(*aw::AssetStore::getImage("mountain")); m_grassPrinter = sf::Sprite(m_grassTexture); m_gravelPrinter = sf::Sprite(m_gravelTexture); m_waterPrinter = sf::Sprite(m_waterTexture); m_mudPrinter = sf::Sprite(m_mudTexture); m_bushPrinter = sf::Sprite(m_bushTexture); m_treePrinter = sf::Sprite(m_treeTexture); m_mountainPrinter = sf::Sprite(m_mountainTexture); m_player = std::make_unique<Player>(this); generateTerrain(); } Player* World::getPlayer () { return m_player.get(); } void setCamera (double x, double y) { m_cameraX = x; m_cameraY = y; } void moveCamera (double x, double y) { m_cameraX += x; m_cameraY += y; } void World::render () { auto size = Window::getContext()->getSize(); double centerX = size.x * 0.5; double centerY = size.y * 0.5; double topLeftCoordinateX = cameraX - centerX; double topLeftCoordinateY = cameraY - centerY; double bottomRightCoordinateX = cameraX + centerX; double bottomRightCoordinateY = cameraY + centerY; auto topLeftTileX = static_cast<unsigned int>(topLeftCoordinateX / 32.0); auto topLeftTileY = static_cast<unsigned int>(topLeftCoordinateY / 32.0); auto bottomRightTileX = static_cast<unsigned int>(bottomRightCoordinateX / 32.0); auto bottomRightTileY = static_cast<unsigned int>(bottomRightCoordinateY / 32.0); double topLeftTileTopLeftCoordinateX = static_cast<double>(topLeftCoordinateX) * 32.0; double topLeftTileTopLeftCoordinateY = static_cast<double>(topLeftCoordinateY) * 32.0; for (unsigned int y = topLeftTileY; y < bottomRightTileY; ++y) { for (unsigned int x = topLeftTileX; x < bottomRightTileX; ++x) { switch (m_tilePlane.get(x, y)) { case TileType::Grass: m_grassSprite.setPosition(topLeftTileTopLeftCoordinateX - topLeftCoordinateX + (32 * (x - topLeftTileX)), topLeftTileTopLeftCoordinateY - topLeftCoordinateY + (32 * (y - topLeftTileY))); case TileType::Gravel: m_grassSprite.setPosition(topLeftTileTopLeftCoordinateX - topLeftCoordinateX + (32 * (x - topLeftTileX)), topLeftTileTopLeftCoordinateY - topLeftCoordinateY + (32 * (y - topLeftTileY))); case TileType::Water: m_grassSprite.setPosition(topLeftTileTopLeftCoordinateX - topLeftCoordinateX + (32 * (x - topLeftTileX)), topLeftTileTopLeftCoordinateY - topLeftCoordinateY + (32 * (y - topLeftTileY))); case TileType::Mud: m_grassSprite.setPosition(topLeftTileTopLeftCoordinateX - topLeftCoordinateX + (32 * (x - topLeftTileX)), topLeftTileTopLeftCoordinateY - topLeftCoordinateY + (32 * (y - topLeftTileY))); case TileType::Bush: m_grassSprite.setPosition(topLeftTileTopLeftCoordinateX - topLeftCoordinateX + (32 * (x - topLeftTileX)), topLeftTileTopLeftCoordinateY - topLeftCoordinateY + (32 * (y - topLeftTileY))); case TileType::Tree: m_grassSprite.setPosition(topLeftTileTopLeftCoordinateX - topLeftCoordinateX + (32 * (x - topLeftTileX)), topLeftTileTopLeftCoordinateY - topLeftCoordinateY + (32 * (y - topLeftTileY))); case TileType::Mountain:\ m_grassSprite.setPosition(topLeftTileTopLeftCoordinateX - topLeftCoordinateX + (32 * (x - topLeftTileX)), topLeftTileTopLeftCoordinateY - topLeftCoordinateY + (32 * (y - topLeftTileY))); case TileType::Player: m_grassSprite.setPosition(topLeftTileTopLeftCoordinateX - topLeftCoordinateX + (32 * (x - topLeftTileX)), topLeftTileTopLeftCoordinateY - topLeftCoordinateY + (32 * (y - topLeftTileY))); case TileType::Enemy: m_grassSprite.setPosition(topLeftTileTopLeftCoordinateX - topLeftCoordinateX + (32 * (x - topLeftTileX)), topLeftTileTopLeftCoordinateY - topLeftCoordinateY + (32 * (y - topLeftTileY))); case TileType::Target: m_grassSprite.setPosition(topLeftTileTopLeftCoordinateX - topLeftCoordinateX + (32 * (x - topLeftTileX)), topLeftTileTopLeftCoordinateY - topLeftCoordinateY + (32 * (y - topLeftTileY))); default: break; } } } }
42.486726
206
0.676317
aebarber
225e95d5ffaf77e76ad6478fe5bc386ae7f65369
626
cpp
C++
main.cpp
ArionasMC/TicTacToe
998585ca415c7d263eeb73e43840fbf98d9a4c99
[ "Apache-2.0" ]
3
2019-02-23T18:20:24.000Z
2019-02-23T18:30:18.000Z
main.cpp
ArionasMC/TicTacToe
998585ca415c7d263eeb73e43840fbf98d9a4c99
[ "Apache-2.0" ]
null
null
null
main.cpp
ArionasMC/TicTacToe
998585ca415c7d263eeb73e43840fbf98d9a4c99
[ "Apache-2.0" ]
null
null
null
#include "SDL.h" #include "Game.h" #include <iostream> using namespace std; Game *game = NULL; int main(int argc, char *argv[]) { const int FPS = 60; const int frameDelay = 1000 / FPS; Uint32 frameStart; int frameTime; game = new Game(); game->init("Tic Tac Toe", 800, 600, false); while (game->running()) { frameStart = SDL_GetTicks(); game->handleEvents(); game->update(); game->render(); frameTime = SDL_GetTicks() - frameStart; if(frameDelay > frameTime) { SDL_Delay(frameDelay - frameTime); } } game->clean(); return 0; }
16.473684
47
0.58147
ArionasMC
226737397de0b16688a5798449b86f3abf42e80d
6,083
cpp
C++
Algorithm/arcsim/adaptiveCloth/constraint.cpp
dolphin-li/ClothDesigner
82b186d6db320b645ac67a4d32d7746cc9bdd391
[ "MIT" ]
32
2016-12-13T05:49:12.000Z
2022-02-04T06:15:47.000Z
Algorithm/arcsim/adaptiveCloth/constraint.cpp
dolphin-li/ClothDesigner
82b186d6db320b645ac67a4d32d7746cc9bdd391
[ "MIT" ]
2
2019-07-30T02:01:16.000Z
2020-03-12T15:06:51.000Z
Algorithm/arcsim/adaptiveCloth/constraint.cpp
dolphin-li/ClothDesigner
82b186d6db320b645ac67a4d32d7746cc9bdd391
[ "MIT" ]
18
2017-11-16T13:37:06.000Z
2022-03-11T08:13:46.000Z
/* Copyright ©2013 The Regents of the University of California (Regents). All Rights Reserved. Permission to use, copy, modify, and distribute this software and its documentation for educational, research, and not-for-profit purposes, without fee and without a signed licensing agreement, is hereby granted, provided that the above copyright notice, this paragraph and the following two paragraphs appear in all copies, modifications, and distributions. Contact The Office of Technology Licensing, UC Berkeley, 2150 Shattuck Avenue, Suite 510, Berkeley, CA 94720-1620, (510) 643-7201, for commercial licensing opportunities. IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS IS". REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. */ #include "constraint.hpp" #include "cloth\LevelSet3D.h" #include "magic.hpp" using namespace std; namespace arcsim { double EqCon::value(int *sign) { if (sign) *sign = 0; return dot(n, node->x - x); } MeshGrad EqCon::gradient() { MeshGrad grad; grad[node] = n; return grad; } MeshGrad EqCon::project() { return MeshGrad(); } double EqCon::energy(double value) { return stiff*sq(value) / 2.; } double EqCon::energy_grad(double value) { return stiff*value; } double EqCon::energy_hess(double value) { return stiff; } MeshGrad EqCon::friction(double dt, MeshHess &jac) { return MeshGrad(); } double GlueCon::value(int *sign) { if (sign) *sign = 0; return dot(n, nodes[1]->x - nodes[0]->x); } MeshGrad GlueCon::gradient() { MeshGrad grad; grad[nodes[0]] = -n; grad[nodes[1]] = n; return grad; } MeshGrad GlueCon::project() { return MeshGrad(); } double GlueCon::energy(double value) { return stiff*sq(value) / 2.; } double GlueCon::energy_grad(double value) { return stiff*value; } double GlueCon::energy_hess(double value) { return stiff; } MeshGrad GlueCon::friction(double dt, MeshHess &jac) { return MeshGrad(); } double IneqCon::value(int *sign) { if (sign) *sign = 1; double d = 0; for (int i = 0; i < 4; i++) d += w[i] * dot(n, nodes[i]->x); d -= arcsim::magic.repulsion_thickness; return d; } MeshGrad IneqCon::gradient() { MeshGrad grad; for (int i = 0; i < 4; i++) grad[nodes[i]] = w[i] * n; return grad; } MeshGrad IneqCon::project() { double d = value() + arcsim::magic.repulsion_thickness - arcsim::magic.projection_thickness; if (d >= 0) return MeshGrad(); double inv_mass = 0; for (int i = 0; i < 4; i++) if (free[i]) inv_mass += sq(w[i]) / nodes[i]->m; MeshGrad dx; for (int i = 0; i < 4; i++) if (free[i]) dx[nodes[i]] = -(w[i] / nodes[i]->m) / inv_mass*n*d; return dx; } double violation(double value) { return std::max(-value, 0.); } double IneqCon::energy(double value) { double v = violation(value); return stiff*v*v*v / arcsim::magic.repulsion_thickness / 6; } double IneqCon::energy_grad(double value) { return -stiff*sq(violation(value)) / arcsim::magic.repulsion_thickness / 2; } double IneqCon::energy_hess(double value) { return stiff*violation(value) / arcsim::magic.repulsion_thickness; } MeshGrad IneqCon::friction(double dt, MeshHess &jac) { if (mu == 0) return MeshGrad(); double fn = abs(energy_grad(value())); if (fn == 0) return MeshGrad(); Vec3 v = Vec3(0); double inv_mass = 0; for (int i = 0; i < 4; i++) { v += w[i] * nodes[i]->v; if (free[i]) inv_mass += sq(w[i]) / nodes[i]->m; } Mat3x3 T = Mat3x3(1) - outer(n, n); double vt = norm(T*v); double f_by_v = std::min(mu*fn / vt, 1 / (dt*inv_mass)); // double f_by_v = mu*fn/max(vt, 1e-1); MeshGrad force; for (int i = 0; i < 4; i++) { if (free[i]) { force[nodes[i]] = -w[i] * f_by_v*T*v; for (int j = 0; j < 4; j++) { if (free[j]) { jac[make_pair(nodes[i], nodes[j])] = -w[i] * w[j] * f_by_v*T; } } } } return force; } ///////////////////////////////////////////////////////////////////////////// double IneqConLvSet::value(int *sign) { if (sign) *sign = 1; double d = obj->globalValue(node->x[0], node->x[1], node->x[2]); d -= arcsim::magic.repulsion_thickness; return d; } MeshGrad IneqConLvSet::gradient() { MeshGrad grad; grad[node] = n; return grad; } MeshGrad IneqConLvSet::project() { double d = value() + arcsim::magic.repulsion_thickness - arcsim::magic.projection_thickness; if (d >= 0) return MeshGrad(); double inv_mass = 0; if (free) inv_mass += 1 / node->m; MeshGrad dx; if (free) { dx[node] = -(1 / node->m) / inv_mass*n*d; } return dx; } double IneqConLvSet::energy(double value) { double v = violation(value); return stiff*v*v*v / arcsim::magic.repulsion_thickness / 6; } double IneqConLvSet::energy_grad(double value) { return -stiff*sq(violation(value)) / arcsim::magic.repulsion_thickness / 2; } double IneqConLvSet::energy_hess(double value) { return stiff*violation(value) / arcsim::magic.repulsion_thickness; } MeshGrad IneqConLvSet::friction(double dt, MeshHess &jac) { if (mu == 0) return MeshGrad(); double fn = abs(energy_grad(value())); if (fn == 0) return MeshGrad(); Vec3 v = Vec3(0); double inv_mass = 0; v += node->v; if (free) inv_mass += 1 / node->m; Mat3x3 T = Mat3x3(1) - outer(n, n); double vt = norm(T*v); double f_by_v = std::min(mu*fn / vt, 1 / (dt*inv_mass)); // double f_by_v = mu*fn/max(vt, 1e-1); MeshGrad force; if (free) { force[node] = -f_by_v*T*v; jac[make_pair(node, node)] = -f_by_v*T; } return force; } }
27.278027
94
0.644583
dolphin-li
226b322b2b0aae123a65e38fa7bb009e25e34675
44,252
cpp
C++
EasyCpp/Net/Curl.cpp
Thalhammer/EasyCpp
6b9886fecf0aa363eaf03741426fd3462306c211
[ "MIT" ]
3
2018-02-06T05:12:41.000Z
2020-05-12T20:57:32.000Z
EasyCpp/Net/Curl.cpp
Thalhammer/EasyCpp
6b9886fecf0aa363eaf03741426fd3462306c211
[ "MIT" ]
41
2016-07-11T12:19:10.000Z
2017-08-08T07:43:12.000Z
EasyCpp/Net/Curl.cpp
Thalhammer/EasyCpp
6b9886fecf0aa363eaf03741426fd3462306c211
[ "MIT" ]
2
2019-08-02T10:24:36.000Z
2020-09-11T01:45:12.000Z
#include "Curl.h" #include <curl/curl.h> #include <string> #include <stdexcept> #include <map> #include <cstring> #include "../StringAlgorithm.h" // Fix for missing macro in old versions #ifndef CURL_AT_LEAST_VERSION #define CURL_VERSION_BITS(x,y,z) ((x)<<16|(y)<<8|z) #define CURL_AT_LEAST_VERSION(x,y,z) \ (LIBCURL_VERSION_NUM >= CURL_VERSION_BITS(x, y, z)) #endif namespace EasyCpp { namespace Net { Curl::Curl() { _handle = curl_easy_init(); _error_buffer = (char*)malloc(CURL_ERROR_SIZE); reset(); } Curl::~Curl() { std::unique_lock<std::mutex> lck(_handle_lock); curl_easy_cleanup(_handle); free(_error_buffer); } void Curl::perform() { std::unique_lock<std::mutex> lck(_handle_lock); checkCode(curl_easy_perform(_handle)); } bool Curl::receive(void * buffer, size_t buflen, size_t & bytes_read) { std::unique_lock<std::mutex> lck(_handle_lock); CURLcode code = curl_easy_recv(_handle, buffer, buflen, &bytes_read); if (code == CURLE_AGAIN) return false; checkCode(code); return true; } bool Curl::send(void * buffer, size_t buflen, size_t & bytes_send) { std::unique_lock<std::mutex> lck(_handle_lock); checkCode(curl_easy_send(_handle, buffer, buflen, &bytes_send)); return true; } bool Curl::wait(bool recv, uint64_t timeout_ms) { curl_socket_t sock = getActiveSocket(); struct timeval tv; fd_set infd, outfd, errfd; int res; tv.tv_sec = timeout_ms / 1000; tv.tv_usec = (timeout_ms % 1000) * 1000; FD_ZERO(&infd); FD_ZERO(&outfd); FD_ZERO(&errfd); FD_SET(sock, &errfd); /* always check for error */ if (recv) { FD_SET(sock, &infd); } else { FD_SET(sock, &outfd); } /* select() returns the number of signalled sockets or -1 */ res = select(sock + 1, &infd, &outfd, &errfd, &tv); return res != 0; } void Curl::reset() { { std::unique_lock<std::mutex> lck(_handle_lock); curl_easy_reset(_handle); } setOption(CURLOPT_NOSIGNAL, true); setOption(CURLOPT_ERRORBUFFER, _error_buffer); memset(_error_buffer, 0x00, CURL_ERROR_SIZE); } void Curl::setOption(CurlOption option, void * val) { std::unique_lock<std::mutex> lck(_handle_lock); checkCode(curl_easy_setopt(_handle, (CURLoption)option, val)); } void Curl::setOption(CurlOption option, bool val) { setOption(option, (long)(val ? 1 : 0)); } void Curl::setOption(CurlOption option, long val) { std::unique_lock<std::mutex> lck(_handle_lock); checkCode(curl_easy_setopt(_handle, (CURLoption)option, val)); } void Curl::setOption(CurlOption option, long long val) { std::unique_lock<std::mutex> lck(_handle_lock); checkCode(curl_easy_setopt(_handle, (CURLoption)option, val)); } void Curl::setOption(CurlOption option, const std::string & val) { std::unique_lock<std::mutex> lck(_handle_lock); checkCode(curl_easy_setopt(_handle, (CURLoption)option, val.c_str())); } void Curl::getInfo(CurlInfo info, long & val) { std::unique_lock<std::mutex> lck(_handle_lock); checkCode(curl_easy_getinfo(_handle, (CURLINFO)info, &val)); } void Curl::getInfo(CurlInfo info, std::string & val) { std::unique_lock<std::mutex> lck(_handle_lock); char* ptr = nullptr; checkCode(curl_easy_getinfo(_handle, (CURLINFO)info, &ptr)); if (ptr != nullptr) val = std::string(ptr); } void Curl::getInfo(CurlInfo info, std::vector<std::string>& val) { std::unique_lock<std::mutex> lck(_handle_lock); struct curl_slist* slist = nullptr; checkCode(curl_easy_getinfo(_handle, (CURLINFO)info, &slist)); val = fromSList(slist); curl_slist_free_all(slist); } void Curl::getInfo(CurlInfo info, double & val) { std::unique_lock<std::mutex> lck(_handle_lock); checkCode(curl_easy_getinfo(_handle, (CURLINFO)info, &val)); } void Curl::getInfo(CurlInfo info, void ** val) { std::unique_lock<std::mutex> lck(_handle_lock); checkCode(curl_easy_getinfo(_handle, (CURLINFO)info, val)); } void Curl::setVerbose(bool v) { setOption(CURLOPT_VERBOSE, v); } void Curl::setHeader(bool v) { setOption(CURLOPT_HEADER, v); } void Curl::setNoProgress(bool v) { setOption(CURLOPT_NOPROGRESS, v); } void Curl::setWildcardMatch(bool v) { setOption(CURLOPT_WILDCARDMATCH, v); } void Curl::setURL(const std::string & url) { setOption(CURLOPT_URL, url); } void Curl::setURL(const URI & uri) { setURL(uri.str()); } void Curl::setPathAsIs(bool v) { #if CURL_AT_LEAST_VERSION(7,42,0) setOption(CURLOPT_PATH_AS_IS, v); #else throw std::runtime_error("Not supported by compiled curl version"); #endif } void Curl::setProtocols(const std::string & protocols) { setOption(CURLOPT_PROTOCOLS, getProtocolMask(protocols)); } void Curl::setRedirectProtocols(const std::string & protocols) { setOption(CURLOPT_REDIR_PROTOCOLS, getProtocolMask(protocols)); } void Curl::setDefaultProtocol(const std::string & protocol) { #if CURL_AT_LEAST_VERSION(7,45,0) setOption(CURLOPT_DEFAULT_PROTOCOL, protocol); #else throw std::runtime_error("Not supported by compiled curl version"); #endif } void Curl::setProxy(const std::string & proxy) { setOption(CURLOPT_PROXY, proxy); } void Curl::setProxyPort(uint16_t port) { setOption(CURLOPT_PROXYPORT, (long)port); } void Curl::setProxyType(ProxyType type) { long ctype; switch (type) { case ProxyType::HTTP: ctype = CURLPROXY_HTTP; break; case ProxyType::HTTP_1_0: ctype = CURLPROXY_HTTP_1_0; break; case ProxyType::SOCKS4: ctype = CURLPROXY_SOCKS4; break; case ProxyType::SOCKS4A: ctype = CURLPROXY_SOCKS4A; break; case ProxyType::SOCKS5: ctype = CURLPROXY_SOCKS5; break; case ProxyType::SOCKS5_HOSTNAME: ctype = CURLPROXY_SOCKS5_HOSTNAME; break; default: ctype = CURLPROXY_HTTP; break; } setOption(CURLOPT_PROXYTYPE, ctype); } void Curl::setNoProxy(const std::string & hosts) { setOption(CURLOPT_NOPROXY, hosts); } void Curl::setHTTPProxyTunnel(bool v) { setOption(CURLOPT_HTTPPROXYTUNNEL, v); } void Curl::setConnectTo(const std::vector<std::string>& list) { #if CURL_AT_LEAST_VERSION(7,49,0) setOption(CURLOPT_CONNECT_TO, nullptr); { std::unique_lock<std::mutex> lck(_handle_lock); _slist_connect_to = toSList(list); } setOption(CURLOPT_CONNECT_TO, _slist_connect_to.get()); #else throw std::runtime_error("Not supported by compiled curl version"); #endif } void Curl::setSocks5GSSAPINegotiationProtection(bool v) { setOption(CURLOPT_SOCKS5_GSSAPI_NEC, v); } void Curl::setProxyServiceName(const std::string & service) { #if CURL_AT_LEAST_VERSION(7,43,0) setOption(CURLOPT_PROXY_SERVICE_NAME, service); #else throw std::runtime_error("Not supported by compiled curl version"); #endif } void Curl::setAuthenticationServiceName(const std::string & name) { #if CURL_AT_LEAST_VERSION(7,43,0) setOption(CURLOPT_SERVICE_NAME, name); #else throw std::runtime_error("Not supported by compiled curl version"); #endif } void Curl::setInterface(const std::string & str) { if (str != "") setOption(CURLOPT_INTERFACE, str); else setOption(CURLOPT_INTERFACE, nullptr); } void Curl::setLocalPort(uint16_t port) { setOption(CURLOPT_LOCALPORT, (long)port); } void Curl::setLocalPortRange(uint16_t range) { setOption(CURLOPT_LOCALPORTRANGE, (long)range); } void Curl::setDNSCacheTimeout(long timeout) { setOption(CURLOPT_DNS_CACHE_TIMEOUT, timeout); } void Curl::setBufferSize(long size) { setOption(CURLOPT_BUFFERSIZE, size); } void Curl::setPort(uint16_t port) { setOption(CURLOPT_PORT, (long)port); } void Curl::setTCPFastOpen(bool v) { #if defined(CURLOPT_TCP_FASTOPEN) setOption(CURLOPT_TCP_FASTOPEN, v); #else throw std::runtime_error("Not supported by this CURL version"); #endif } void Curl::setTCPNoDelay(bool v) { setOption(CURLOPT_TCP_NODELAY, v); } void Curl::setAddressScope(long scope) { setOption(CURLOPT_ADDRESS_SCOPE, scope); } void Curl::setTCPKeepAlive(bool v) { setOption(CURLOPT_TCP_KEEPALIVE, v); } void Curl::setTCPKeepAliveIdleTime(long time) { setOption(CURLOPT_TCP_KEEPIDLE, time); } void Curl::setTCPKeepAliveInterval(long time) { setOption(CURLOPT_TCP_KEEPINTVL, time); } void Curl::setUnixSocketPath(const std::string & path) { #if CURL_AT_LEAST_VERSION(7,40,0) if (path == "") setOption(CURLOPT_UNIX_SOCKET_PATH, nullptr); else setOption(CURLOPT_UNIX_SOCKET_PATH, path); #else throw std::runtime_error("Not supported by compiled curl version"); #endif } void Curl::setNETRC(bool read, bool required) { if (read) { if (required) setOption(CURLOPT_NETRC, (long)CURL_NETRC_REQUIRED); else setOption(CURLOPT_NETRC, (long)CURL_NETRC_OPTIONAL); } else setOption(CURLOPT_NETRC, (long)CURL_NETRC_IGNORED); } void Curl::setNETRCFilename(const std::string & name) { setOption(CURLOPT_NETRC_FILE, name); } void Curl::setUsername(const std::string & user) { setOption(CURLOPT_USERNAME, user); } void Curl::setPassword(const std::string & pass) { setOption(CURLOPT_PASSWORD, pass); } void Curl::setProxyUsername(const std::string & user) { setOption(CURLOPT_PROXYUSERNAME, user); } void Curl::setProxyPassword(const std::string & password) { setOption(CURLOPT_PROXYPASSWORD, password); } void Curl::setLoginOptions(const std::string & options) { setOption(CURLOPT_LOGIN_OPTIONS, options); } void Curl::setHTTPAuth(const std::string & methods) { long bitmask = 0; for (const std::string& str : stringSplit(" ", methods)) { if (str == "basic") bitmask |= CURLAUTH_BASIC; else if (str == "digest") bitmask |= CURLAUTH_DIGEST; else if (str == "digest_ie") bitmask |= CURLAUTH_DIGEST_IE; else if (str == "negotiate") bitmask |= CURLAUTH_NEGOTIATE; else if (str == "gssnegotiate") bitmask |= CURLAUTH_GSSNEGOTIATE; else if (str == "ntlm") bitmask |= CURLAUTH_NTLM; else if (str == "ntlm_wb") bitmask |= CURLAUTH_NTLM_WB; else if (str == "any") bitmask |= CURLAUTH_ANY; else if (str == "anysafe") bitmask |= CURLAUTH_ANYSAFE; else if (str == "only") bitmask |= CURLAUTH_ONLY; } setOption(CURLOPT_HTTPAUTH, bitmask); } void Curl::setTLSAuthUsername(const std::string & user) { setOption(CURLOPT_TLSAUTH_USERNAME, user); } void Curl::setTLSAuthPassword(const std::string & pass) { setOption(CURLOPT_TLSAUTH_PASSWORD, pass); } void Curl::setTLSAuthType(const std::string & type) { setOption(CURLOPT_TLSAUTH_TYPE, type); } void Curl::setProxyAuth(const std::string & methods) { long bitmask = 0; for (const std::string& str : stringSplit(" ", methods)) { if (str == "basic") bitmask |= CURLAUTH_BASIC; else if (str == "digest") bitmask |= CURLAUTH_DIGEST; else if (str == "digest_ie") bitmask |= CURLAUTH_DIGEST_IE; else if (str == "negotiate") bitmask |= CURLAUTH_NEGOTIATE; else if (str == "gssnegotiate") bitmask |= CURLAUTH_GSSNEGOTIATE; else if (str == "ntlm") bitmask |= CURLAUTH_NTLM; else if (str == "ntlm_wb") bitmask |= CURLAUTH_NTLM_WB; else if (str == "any") bitmask |= CURLAUTH_ANY; else if (str == "anysafe") bitmask |= CURLAUTH_ANYSAFE; else if (str == "only") bitmask |= CURLAUTH_ONLY; } setOption(CURLOPT_PROXYAUTH, bitmask); } void Curl::setSASLIR(bool v) { setOption(CURLOPT_SASL_IR, v); } void Curl::setXOAuth2Bearer(const std::string & token) { setOption(CURLOPT_XOAUTH2_BEARER, token); } void Curl::setWriteFunction(std::function<uint64_t(char*, uint64_t)> fn) { _write_fn = fn; setOption(CURLOPT_WRITEFUNCTION, (void*)&_s_write_callback); setOption(CURLOPT_WRITEDATA, this); } void Curl::setReadFunction(std::function<uint64_t(char*, uint64_t)> fn) { _read_fn = fn; setOption(CURLOPT_READFUNCTION, (void*)&_s_read_callback); setOption(CURLOPT_READDATA, this); } void Curl::setStreamRestartFunction(std::function<bool()> fn) { _ioctl_restart_fn = fn; setOption(CURLOPT_IOCTLFUNCTION, (void*)&_s_ioctl_callback); setOption(CURLOPT_IOCTLDATA, this); } void Curl::setSeekFunction(std::function<bool(uint64_t, int)> fn) { _seek_fn = fn; setOption(CURLOPT_SEEKFUNCTION, (void*)&_s_seek_callback); setOption(CURLOPT_SEEKDATA, this); } void Curl::setXferInfoFunction(std::function<void(uint64_t, uint64_t, uint64_t, uint64_t)> fn) { _xferinfo_fn = fn; setOption(CURLOPT_XFERINFOFUNCTION, (void*)&_s_xferinfo_callback); setOption(CURLOPT_XFERINFODATA, this); } void Curl::setHeaderFunction(std::function<void(std::string)> fn) { _header_fn = fn; setOption(CURLOPT_HEADERFUNCTION, (void*)&_s_header_callback); setOption(CURLOPT_HEADERDATA, this); } void Curl::setDebugFunction(std::function<void(InfoType, char*, size_t)> fn) { _debug_fn = fn; setOption(CURLOPT_DEBUGFUNCTION, (void*)&_s_debug_callback); setOption(CURLOPT_DEBUGDATA, this); } void Curl::setMatchFunction(std::function<bool(const std::string&pattern, const std::string&string)> fn) { _match_fn = fn; setOption(CURLOPT_FNMATCH_FUNCTION, (void*)&_s_fnmatch_callback); setOption(CURLOPT_FNMATCH_DATA, this); } void Curl::setDebugString(std::string & debug) { this->setDebugFunction([&debug](auto type, auto data, auto len) { if (type == InfoType::Text) debug += data; }); } void Curl::setFailOnError(bool v) { setOption(CURLOPT_FAILONERROR, v); } std::string Curl::getErrorBuffer() const { return std::string(_error_buffer); } void Curl::setMailFrom(const std::string & from) { setOption(CURLOPT_MAIL_FROM, from); } void Curl::setMailRecipients(const std::vector<std::string> & rcpt) { setOption(CURLOPT_MAIL_RCPT, nullptr); { std::unique_lock<std::mutex> lck(_handle_lock); _slist_mail_rcpt = toSList(rcpt); } setOption(CURLOPT_MAIL_RCPT, _slist_mail_rcpt.get()); } void Curl::setMailAuth(const std::string & auth) { setOption(CURLOPT_MAIL_AUTH, auth); } void Curl::setTelnetOptions(const std::vector<std::string> & options) { setOption(CURLOPT_TELNETOPTIONS, nullptr); { std::unique_lock<std::mutex> lck(_handle_lock); _slist_telnet_options = toSList(options); } setOption(CURLOPT_TELNETOPTIONS, _slist_telnet_options.get()); } void Curl::setNewFilePerms(long mode) { setOption(CURLOPT_NEW_FILE_PERMS, mode); } void Curl::setNewDirectoryPerms(long mode) { setOption(CURLOPT_NEW_DIRECTORY_PERMS, mode); } void Curl::setTFTPBlockSize(long size) { setOption(CURLOPT_TFTP_BLKSIZE, size); } void Curl::setTFTPNoOptions(bool v) { #if defined(CURLOPT_TFTP_NO_OPTIONS) setOption(CURLOPT_TFTP_NO_OPTIONS, v); #else throw std::runtime_error("Not supported by this CURL version"); #endif } void Curl::setRTSPRequest(RTSPRequest req) { long request = 0; switch (req) { case RTSPRequest::Announce: request = CURL_RTSPREQ_ANNOUNCE; break; case RTSPRequest::Describe: request = CURL_RTSPREQ_DESCRIBE; break; case RTSPRequest::GetParameter: request = CURL_RTSPREQ_GET_PARAMETER; break; case RTSPRequest::Options: request = CURL_RTSPREQ_OPTIONS; break; case RTSPRequest::Pause: request = CURL_RTSPREQ_PAUSE; break; case RTSPRequest::Play: request = CURL_RTSPREQ_PLAY; break; case RTSPRequest::Receive: request = CURL_RTSPREQ_RECEIVE; break; case RTSPRequest::Record: request = CURL_RTSPREQ_RECORD; break; case RTSPRequest::SetParameter: request = CURL_RTSPREQ_SET_PARAMETER; break; case RTSPRequest::Setup: request = CURL_RTSPREQ_SETUP; break; case RTSPRequest::Teardown: request = CURL_RTSPREQ_TEARDOWN; break; } setOption(CURLOPT_RTSP_REQUEST, request); } void Curl::setRTSPSessionID(const std::string & id) { setOption(CURLOPT_RTSP_SESSION_ID, id); } void Curl::setRTSPStreamURI(const std::string & uri) { setOption(CURLOPT_RTSP_STREAM_URI, uri); } void Curl::setRTSPTransport(const std::string & str) { setOption(CURLOPT_RTSP_TRANSPORT, str); } void Curl::setRTSPClientCSEQ(long seq) { setOption(CURLOPT_RTSP_CLIENT_CSEQ, seq); } void Curl::setRTSPServerCSEQ(long seq) { setOption(CURLOPT_RTSP_SERVER_CSEQ, seq); } void Curl::setSSHAuthTypes(const std::string & types) { long bitmask = 0; for (const std::string& str : stringSplit(" ", types)) { if (str == "publickey") bitmask |= CURLSSH_AUTH_PUBLICKEY; else if (str == "password") bitmask |= CURLSSH_AUTH_PASSWORD; else if (str == "host") bitmask |= CURLSSH_AUTH_HOST; else if (str == "keyboard") bitmask |= CURLSSH_AUTH_KEYBOARD; else if (str == "agent") bitmask |= CURLSSH_AUTH_AGENT; else if (str == "any") bitmask |= CURLSSH_AUTH_ANY; } setOption(CURLOPT_SSH_AUTH_TYPES, bitmask); } void Curl::setSSHHostPublicKeyMD5(const std::string & md5) { setOption(CURLOPT_SSH_HOST_PUBLIC_KEY_MD5, md5); } void Curl::setSSHPublicKeyFile(const std::string & path) { setOption(CURLOPT_SSH_PUBLIC_KEYFILE, path); } void Curl::setSSHPrivateKeyFile(const std::string & path) { setOption(CURLOPT_SSH_PRIVATE_KEYFILE, path); } void Curl::setSSHKnownHostsFile(const std::string & path) { setOption(CURLOPT_SSH_KNOWNHOSTS, path); } void Curl::setSSHKeyFunction(std::function<SSHKeyStatus(const SSHKey&, const SSHKey&, SSHKeyMatch)> fn) { _ssh_key_match_fn = fn; setOption(CURLOPT_SSH_KEYFUNCTION, (void*)&_s_ssh_keycallback); setOption(CURLOPT_SSH_KEYDATA, this); } void Curl::setAutoReferer(bool v) { setOption(CURLOPT_AUTOREFERER, v); } void Curl::setAcceptEncoding(const std::string & str) { setOption(CURLOPT_ACCEPT_ENCODING, str); } void Curl::setTransferEncoding(const std::string & str) { setOption(CURLOPT_TRANSFER_ENCODING, str); } void Curl::setFollowLocation(bool v) { setOption(CURLOPT_FOLLOWLOCATION, v); } void Curl::setUnrestrictedAuth(bool v) { setOption(CURLOPT_UNRESTRICTED_AUTH, v); } void Curl::setMaxRedirections(long m) { setOption(CURLOPT_MAXREDIRS, m); } void Curl::setPostRedirection(const std::string & str) { long bitmask = 0; for (const std::string& s : stringSplit(" ", str)) { if (s == "301") bitmask |= CURL_REDIR_POST_301; else if (s == "302") bitmask |= CURL_REDIR_POST_302; else if (s == "303") bitmask |= CURL_REDIR_POST_303; else if (s == "all") bitmask |= CURL_REDIR_POST_ALL; } } void Curl::setPOST(bool v) { setOption(CURLOPT_POST, v); } void Curl::setPOSTFields(const std::string & str) { setPOSTFieldSize(str.size()); setOption(CURLOPT_COPYPOSTFIELDS, str); } void Curl::setPOSTFieldSize(size_t size) { curl_off_t csize = size; setOption(CURLOPT_POSTFIELDSIZE_LARGE, csize); } void Curl::setReferer(const std::string & referer) { setOption(CURLOPT_REFERER, referer); } void Curl::setUserAgent(const std::string & ua) { setOption(CURLOPT_USERAGENT, ua); } void Curl::setHeaders(const std::multimap<std::string, std::string>& headers) { std::vector<std::string> sheaders; for (auto elem : headers) { sheaders.push_back(elem.first + ": " + elem.second); } setOption(CURLOPT_HTTPHEADER, nullptr); { std::unique_lock<std::mutex> lck(_handle_lock); _slist_headers = toSList(sheaders); } setOption(CURLOPT_HTTPHEADER, _slist_headers.get()); } void Curl::setHeaderOpt(bool v) { if (v) setOption(CURLOPT_HEADEROPT, (long)CURLHEADER_UNIFIED); else setOption(CURLOPT_HEADEROPT, (long)CURLHEADER_SEPARATE); } void Curl::setProxyHeaders(const std::multimap<std::string, std::string>& headers) { std::vector<std::string> sheaders; for (auto elem : headers) { sheaders.push_back(elem.first + ": " + elem.second); } setOption(CURLOPT_PROXYHEADER, nullptr); { std::unique_lock<std::mutex> lck(_handle_lock); _slist_proxyheaders = toSList(sheaders); } setOption(CURLOPT_PROXYHEADER, _slist_proxyheaders.get()); } void Curl::setHTTP200Aliases(const std::vector<std::string>& aliases) { setOption(CURLOPT_HTTP200ALIASES, nullptr); { std::unique_lock<std::mutex> lck(_handle_lock); _slist_200_aliases = toSList(aliases); } setOption(CURLOPT_HTTP200ALIASES, _slist_200_aliases.get()); } void Curl::setCookie(const std::string & cookie) { setOption(CURLOPT_COOKIE, cookie); } void Curl::setCookieFile(const std::string & cookiefile) { setOption(CURLOPT_COOKIEFILE, cookiefile); } void Curl::setCookieJar(const std::string & cookiejar) { setOption(CURLOPT_COOKIEJAR, cookiejar); } void Curl::setCookieSession(bool v) { setOption(CURLOPT_COOKIESESSION, v); } void Curl::setCookieList(const std::string & cookie) { setOption(CURLOPT_COOKIELIST, cookie); } void Curl::setHTTPGet(bool v) { setOption(CURLOPT_HTTPGET, v); } void Curl::setHTTPVersion(HTTPVersion v) { long version; switch (v) { case HTTPVersion::V1_0: version = CURL_HTTP_VERSION_1_0; break; case HTTPVersion::V1_1: version = CURL_HTTP_VERSION_1_1; break; case HTTPVersion::V2_0: version = CURL_HTTP_VERSION_2_0; break; #if CURL_AT_LEAST_VERSION(7,47,0) case HTTPVersion::V2TLS: version = CURL_HTTP_VERSION_2TLS; break; #else case HTTPVersion::V2TLS: throw std::runtime_error("Not supported by compiled curl version"); #endif default: version = CURL_HTTP_VERSION_NONE; break; } setOption(CURLOPT_HTTP_VERSION, version); } void Curl::setIgnoreContentLength(bool v) { setOption(CURLOPT_IGNORE_CONTENT_LENGTH, v); } void Curl::setContentDecoding(bool v) { setOption(CURLOPT_HTTP_CONTENT_DECODING, v); } void Curl::setTransferDecoding(bool v) { setOption(CURLOPT_HTTP_TRANSFER_DECODING, v); } void Curl::setExpect100TimeoutMs(long ms) { setOption(CURLOPT_EXPECT_100_TIMEOUT_MS, ms); } void Curl::setPipeWait(long wait) { #if CURL_AT_LEAST_VERSION(7,43,0) setOption(CURLOPT_PIPEWAIT, wait); #else throw std::runtime_error("Not supported by compiled curl version"); #endif } void Curl::setStreamWeight(long w) { #if CURL_AT_LEAST_VERSION(7,46,0) setOption(CURLOPT_STREAM_WEIGHT, w); #else throw std::runtime_error("Not supported by compiled curl version"); #endif } void Curl::setFTPPort(const std::string & spec) { setOption(CURLOPT_FTPPORT, spec); } void Curl::setQuote(const std::vector<std::string>& str) { setOption(CURLOPT_QUOTE, nullptr); { std::unique_lock<std::mutex> lck(_handle_lock); _slist_ftp_quote = toSList(str); } setOption(CURLOPT_QUOTE, _slist_ftp_quote.get()); } void Curl::setPOSTQuote(const std::vector<std::string>& str) { setOption(CURLOPT_POSTQUOTE, nullptr); { std::unique_lock<std::mutex> lck(_handle_lock); _slist_ftp_postquote = toSList(str); } setOption(CURLOPT_POSTQUOTE, _slist_ftp_postquote.get()); } void Curl::setPREQuote(const std::vector<std::string>& str) { setOption(CURLOPT_PREQUOTE, nullptr); { std::unique_lock<std::mutex> lck(_handle_lock); _slist_ftp_prequote = toSList(str); } setOption(CURLOPT_PREQUOTE, _slist_ftp_prequote.get()); } void Curl::setFTPAppend(bool v) { setOption(CURLOPT_APPEND, v); } void Curl::setFTPUseEPRT(bool v) { setOption(CURLOPT_FTP_USE_EPRT, v); } void Curl::setFTPUseEPSV(bool v) { setOption(CURLOPT_FTP_USE_EPSV, v); } void Curl::setFTPUsePRET(bool v) { setOption(CURLOPT_FTP_USE_PRET, v); } void Curl::setFTPCreateDir(FTPCreateDir dir) { long option; switch (dir) { case FTPCreateDir::ALL: option = CURLFTP_CREATE_DIR; break; case FTPCreateDir::RETRY: option = CURLFTP_CREATE_DIR_RETRY; break; case FTPCreateDir::NONE: default: option = CURLFTP_CREATE_DIR_NONE; break; } setOption(CURLOPT_FTP_CREATE_MISSING_DIRS, option); } void Curl::setFTPResponseTimeout(long timeout) { setOption(CURLOPT_FTP_RESPONSE_TIMEOUT, timeout); } void Curl::setFTPAlternativeToUser(const std::string & alt) { setOption(CURLOPT_FTP_ALTERNATIVE_TO_USER, alt); } void Curl::setFTPSkipPASVIp(bool v) { setOption(CURLOPT_FTP_SKIP_PASV_IP, v); } void Curl::setFTPSSLAuth(FTPAuth auth) { long option; switch (auth) { case FTPAuth::TLS: option = CURLFTPAUTH_TLS; break; case FTPAuth::SSL: option = CURLFTPAUTH_SSL; break; case FTPAuth::DEFAULT: default: option = CURLFTPAUTH_DEFAULT; break; } setOption(CURLOPT_FTPSSLAUTH, option); } void Curl::setFTPSSLClearCommandChannel(FTPCCC ccc) { long option; switch (ccc) { case FTPCCC::PASSIVE: option = CURLFTPSSL_CCC_PASSIVE; break; case FTPCCC::ACTIVE: option = CURLFTPSSL_CCC_ACTIVE; break; case FTPCCC::NONE: default: option = CURLFTPSSL_CCC_NONE; break; } setOption(CURLOPT_FTP_SSL_CCC, option); } void Curl::setFTPAccount(const std::string & str) { setOption(CURLOPT_FTP_ACCOUNT, str); } void Curl::setFTPFileMethod(FTPFileMethod fm) { long option; switch (fm) { case FTPFileMethod::MULTICWD: option = CURLFTPMETHOD_MULTICWD; break; case FTPFileMethod::NOCWD: option = CURLFTPMETHOD_NOCWD; break; case FTPFileMethod::SINGLECWD: option = CURLFTPMETHOD_SINGLECWD; break; default: option = CURLFTPMETHOD_DEFAULT; break; } setOption(CURLOPT_FTP_FILEMETHOD, option); } void Curl::setTransferText(bool v) { setOption(CURLOPT_TRANSFERTEXT, v); } void Curl::setProxyTransferText(bool v) { setOption(CURLOPT_PROXY_TRANSFER_MODE, v); } void Curl::setConvertNewLine(bool v) { setOption(CURLOPT_CRLF, v); } void Curl::setRangeRequest(const std::string & str) { setOption(CURLOPT_RANGE, str); } void Curl::setResumeFrom(size_t s) { setOption(CURLOPT_RESUME_FROM_LARGE, (long)s); } void Curl::setCustomRequest(const std::string & req) { setOption(CURLOPT_CUSTOMREQUEST, req); } void Curl::setFileTime(bool v) { setOption(CURLOPT_FILETIME, v); } void Curl::setDirListOnly(bool v) { setOption(CURLOPT_DIRLISTONLY, v); } void Curl::setNoBody(bool v) { setOption(CURLOPT_NOBODY, v); } void Curl::setInFileSize(size_t s) { setOption(CURLOPT_INFILESIZE_LARGE, (long)s); } void Curl::setUpload(bool v) { setOption(CURLOPT_UPLOAD, v); } void Curl::setMaxFileSize(size_t s) { setOption(CURLOPT_MAXFILESIZE_LARGE, (long)s); } void Curl::setTimeCondition(TimeCondition tc) { long option; switch (tc) { case TimeCondition::MODSINCE: option = CURL_TIMECOND_IFMODSINCE; break; case TimeCondition::UNMODSINCE: option = CURL_TIMECOND_IFUNMODSINCE; break; case TimeCondition::LASTMOD: option = CURL_TIMECOND_LASTMOD; break; case TimeCondition::NONE: default: option = CURL_TIMECOND_NONE; break; } setOption(CURLOPT_TIMECONDITION, option); } void Curl::setTimeValue(long tv) { setOption(CURLOPT_TIMEVALUE, tv); } void Curl::setTimeout(long ms) { setOption(CURLOPT_TIMEOUT_MS, ms); } void Curl::setLowSpeedLimit(long bps) { setOption(CURLOPT_LOW_SPEED_LIMIT, bps); } void Curl::setLowSpeedTime(long s) { setOption(CURLOPT_LOW_SPEED_TIME, s); } void Curl::setMaxSendSpeed(long bps) { setOption(CURLOPT_MAX_SEND_SPEED_LARGE, bps); } void Curl::setMaxRecvSpeed(long bps) { setOption(CURLOPT_MAX_RECV_SPEED_LARGE, bps); } void Curl::setMaxConnections(long cnt) { setOption(CURLOPT_MAXCONNECTS, cnt); } void Curl::setFreshConnect(bool fresh) { setOption(CURLOPT_FRESH_CONNECT, fresh); } void Curl::setForbidReuse(bool close) { setOption(CURLOPT_FORBID_REUSE, close); } void Curl::setConnectTimeout(long timeoutms) { setOption(CURLOPT_CONNECTTIMEOUT_MS, timeoutms); } void Curl::setIPResolve(IPResolve res) { long option = CURL_IPRESOLVE_WHATEVER; switch (res) { case IPResolve::Whatever: option = CURL_IPRESOLVE_WHATEVER; break; case IPResolve::IPV4: option = CURL_IPRESOLVE_V4; break; case IPResolve::IPV6: option = CURL_IPRESOLVE_V6; break; } setOption(CURLOPT_IPRESOLVE, option); } void Curl::setConnectOnly(bool only) { setOption(CURLOPT_CONNECT_ONLY, only); } void Curl::setUseSSL(SSLLevel l) { long option; switch (l) { default: case SSLLevel::NONE: option = CURLUSESSL_NONE; break; case SSLLevel::OPT: option = CURLUSESSL_TRY; break; case SSLLevel::CONTROL: option = CURLUSESSL_CONTROL; break; case SSLLevel::ALL: option = CURLUSESSL_ALL; break; } setOption(CURLOPT_USE_SSL, option); } void Curl::setResolve(const std::vector<std::string>& list) { setOption(CURLOPT_RESOLVE, nullptr); { std::unique_lock<std::mutex> lck(_handle_lock); _slist_resolve = toSList(list); } setOption(CURLOPT_RESOLVE, _slist_resolve.get()); } void Curl::setDNSInterface(const std::string& iface) { setOption(CURLOPT_DNS_INTERFACE, iface); } void Curl::setDNSLocalIPv4(const std::string& address) { setOption(CURLOPT_DNS_LOCAL_IP4, address); } void Curl::setDNSLocalIPv6(const std::string& address) { setOption(CURLOPT_DNS_LOCAL_IP6, address); } void Curl::setDNSServers(const std::string& servers) { setOption(CURLOPT_DNS_SERVERS, servers); } void Curl::setAcceptTimeout(long ms) { setOption(CURLOPT_ACCEPTTIMEOUT_MS, ms); } void Curl::setSSLCertificate(const std::string& file) { setOption(CURLOPT_SSLCERT, file); } void Curl::setSSLCertificateType(const std::string& type) { setOption(CURLOPT_SSLCERTTYPE, type); } void Curl::setSSLKey(const std::string& key) { setOption(CURLOPT_SSLKEY, key); } void Curl::setSSLKeyType(const std::string& type) { setOption(CURLOPT_SSLKEYTYPE, type); } void Curl::setSSLKeyPassword(const std::string& pass) { setOption(CURLOPT_KEYPASSWD, pass); } void Curl::setSSLEnableALPN(bool v) { setOption(CURLOPT_SSL_ENABLE_ALPN, v); } void Curl::setSSLEnableNPN(bool v) { setOption(CURLOPT_SSL_ENABLE_NPN, v); } void Curl::setSSLEngine(const std::string& str) { setOption(CURLOPT_SSLENGINE, str); } void Curl::setSSLEngineDefault(bool v) { setOption(CURLOPT_SSLENGINE_DEFAULT, v); } void Curl::setSSLFalseStart(bool v) { #if CURL_AT_LEAST_VERSION(7,42,0) setOption(CURLOPT_SSL_FALSESTART, v); #else throw std::runtime_error("Not supported by compiled curl version"); #endif } void Curl::setSSLVersion(SSLVersion v) { setOption(CURLOPT_SSLVERSION, (long)v); } void Curl::setSSLVerifyHost(bool v) { setOption(CURLOPT_SSL_VERIFYHOST, (long)(v ? 2 : 0)); } void Curl::setSSLVerifyPeer(bool v) { setOption(CURLOPT_SSL_VERIFYPEER, v); } void Curl::setSSLVerifyStatus(bool v) { #if CURL_AT_LEAST_VERSION(7,41,0) setOption(CURLOPT_SSL_VERIFYSTATUS, v); #else throw std::runtime_error("Not supported by compiled curl version"); #endif } void Curl::setSSLCABundle(const std::string& path) { setOption(CURLOPT_CAINFO, path); } void Curl::setSSLIssuerCert(const std::string& path) { setOption(CURLOPT_ISSUERCERT, path); } void Curl::setSSLCAPath(const std::string& path) { setOption(CURLOPT_CAPATH, path); } void Curl::setSSLCRList(const std::string& file) { setOption(CURLOPT_CRLFILE, file); } void Curl::setSSLCertInfo(bool v) { setOption(CURLOPT_CERTINFO, v); } void Curl::setSSLPinnedPublicKey(const std::string& ppk) { #if CURL_AT_LEAST_VERSION(7,39,0) setOption(CURLOPT_PINNEDPUBLICKEY, ppk); #else throw std::runtime_error("Not supported by compiled curl version"); #endif } void Curl::setSSLRandomFile(const std::string& file) { setOption(CURLOPT_RANDOM_FILE, file); } void Curl::setSSLEGDSocket(const std::string& socket) { setOption(CURLOPT_EGDSOCKET, socket); } void Curl::setSSLCipherList(const std::string& list) { setOption(CURLOPT_SSL_CIPHER_LIST, list); } void Curl::setSSLSessionIDCache(bool enabled) { setOption(CURLOPT_SSL_SESSIONID_CACHE, enabled); } void Curl::setSSLKRBLevel(const std::string& level) { setOption(CURLOPT_KRBLEVEL, level); } std::string Curl::getEffectiveURL() { std::string res; getInfo(CURLINFO_EFFECTIVE_URL, res); return res; } int Curl::getResponseCode() { long res; getInfo(CURLINFO_RESPONSE_CODE, res); return (int)res; } int Curl::getHTTPConnectCode() { long res; getInfo(CURLINFO_HTTP_CONNECTCODE, res); return (int)res; } long Curl::getFileTime() { long res; getInfo(CURLINFO_FILETIME, res); return res; } double Curl::getTotalTime() { double res; getInfo(CURLINFO_TOTAL_TIME, res); return res; } double Curl::getNameLookupTime() { double res; getInfo(CURLINFO_NAMELOOKUP_TIME, res); return res; } double Curl::getConnectTime() { double res; getInfo(CURLINFO_CONNECT_TIME, res); return res; } double Curl::getAppConnectTime() { double res; getInfo(CURLINFO_APPCONNECT_TIME, res); return res; } double Curl::getPreTransferTime() { double res; getInfo(CURLINFO_PRETRANSFER_TIME, res); return res; } double Curl::getStartTransferTime() { double res; getInfo(CURLINFO_STARTTRANSFER_TIME, res); return res; } double Curl::getRedirectTime() { double res; getInfo(CURLINFO_REDIRECT_TIME, res); return res; } long Curl::getRedirectCount() { long res; getInfo(CURLINFO_REDIRECT_COUNT, res); return res; } std::string Curl::getRedirectUrl() { std::string res; getInfo(CURLINFO_REDIRECT_URL, res); return res; } double Curl::getSizeUpload() { double res; getInfo(CURLINFO_SIZE_UPLOAD, res); return res; } double Curl::getSizeDownload() { double res; getInfo(CURLINFO_SIZE_DOWNLOAD, res); return res; } double Curl::getSpeedUpload() { double res; getInfo(CURLINFO_SPEED_UPLOAD, res); return res; } double Curl::getSpeedDownload() { double res; getInfo(CURLINFO_SPEED_DOWNLOAD, res); return res; } long Curl::getHeaderSize() { long res; getInfo(CURLINFO_HEADER_SIZE, res); return res; } long Curl::getRequestSize() { long res; getInfo(CURLINFO_REQUEST_SIZE, res); return res; } long Curl::getSSLVerifyResult() { long res; getInfo(CURLINFO_SSL_VERIFYRESULT, res); return res; } std::vector<std::string> Curl::getSSLEngines() { std::vector<std::string> res; getInfo(CURLINFO_SSL_ENGINES, res); return res; } double Curl::getContentLengthDownload() { double res; getInfo(CURLINFO_CONTENT_LENGTH_DOWNLOAD, res); return res; } double Curl::getContentLengthUpload() { double res; getInfo(CURLINFO_CONTENT_LENGTH_UPLOAD, res); return res; } std::string Curl::getContentType() { std::string res; getInfo(CURLINFO_CONTENT_TYPE, res); return res; } std::string Curl::getHTTPAuthAvailable() { std::string res; long info; getInfo(CURLINFO_HTTPAUTH_AVAIL, info); if (info & CURLAUTH_BASIC) res += "basic "; if (info & CURLAUTH_DIGEST) res += "digest "; if (info & CURLAUTH_DIGEST_IE) res += "digest_ie "; if (info & CURLAUTH_NEGOTIATE) res += "negotiate "; if (info & CURLAUTH_GSSNEGOTIATE) res += "gssnegotiate "; if (info & CURLAUTH_NTLM) res += "ntlm "; if (info & CURLAUTH_NTLM_WB) res += "ntlm_wb "; if (res != "" && res[res.size() - 1] == ' ') res.erase(res.begin() + res.size() - 1); return res; } std::string Curl::getProxyAuthAvailable() { std::string res; long info; getInfo(CURLINFO_PROXYAUTH_AVAIL, info); if (info & CURLAUTH_BASIC) res += "basic "; if (info & CURLAUTH_DIGEST) res += "digest "; if (info & CURLAUTH_DIGEST_IE) res += "digest_ie "; if (info & CURLAUTH_NEGOTIATE) res += "negotiate "; if (info & CURLAUTH_GSSNEGOTIATE) res += "gssnegotiate "; if (info & CURLAUTH_NTLM) res += "ntlm "; if (info & CURLAUTH_NTLM_WB) res += "ntlm_wb "; if (res != "" && res[res.size() - 1] == ' ') res.erase(res.begin() + res.size() - 1); return res; } long Curl::getOSErrorNumber() { long res; getInfo(CURLINFO_OS_ERRNO, res); return res; } long Curl::getNumConnects() { long res; getInfo(CURLINFO_NUM_CONNECTS, res); return res; } std::string Curl::getPrimaryIP() { std::string res; getInfo(CURLINFO_PRIMARY_IP, res); return res; } uint16_t Curl::getPrimaryPort() { long res; getInfo(CURLINFO_PRIMARY_PORT, res); return (uint16_t)res; } std::string Curl::getLocalIP() { std::string res; getInfo(CURLINFO_LOCAL_IP, res); return res; } uint16_t Curl::getLocalPort() { long res; getInfo(CURLINFO_LOCAL_PORT, res); return (uint16_t)res; } std::vector<std::string> Curl::getCookieList() { std::vector<std::string> res; getInfo(CURLINFO_COOKIELIST, res); return res; } uint64_t Curl::getActiveSocket() { #if CURL_AT_LEAST_VERSION(7,45,0) curl_socket_t t; getInfo(CURLINFO_ACTIVESOCKET, (void**)&t); return t; #else long t; getInfo(CURLINFO_LASTSOCKET, t); return (uint64_t)t; #endif } std::string Curl::getFTPEntryPath() { std::string res; getInfo(CURLINFO_FTP_ENTRY_PATH, res); return res; } std::vector<std::multimap<std::string, std::string>> Curl::getCertInfo() { std::vector<std::multimap<std::string, std::string>> res; struct curl_certinfo* info; getInfo(CURLINFO_CERTINFO, (void**)&info); for (int i = 0; i < info->num_of_certs; i++) { std::multimap<std::string, std::string> entry; struct curl_slist* list = info->certinfo[i]; while (list != nullptr) { std::string line = list->data; auto pos = line.find_first_of(':'); entry.insert({ line.substr(0,pos),line.substr(pos + 1) }); list = list->next; } res.push_back(entry); } return res; } void Curl::setOutputString(std::string & str) { this->setWriteFunction([&str](auto data, auto len) { str += std::string(data, data + len); return len; }); } void Curl::setInputString(const std::string & str) { this->setReadFunction([&str, pos = 0](auto data, auto len) mutable { std::string substr = str.substr(pos, (size_t)len); memcpy(data, substr.data(), substr.size()); pos += substr.size(); return substr.size(); }); this->setPOSTFieldSize(str.size()); } void Curl::checkCode(int code) { if (code != CURLE_OK) throw std::runtime_error( "Curl returned error: " + std::string(curl_easy_strerror((CURLcode)code) + std::string(" (") + std::to_string(code) + std::string(")"))); } size_t Curl::_s_write_callback(char * ptr, size_t size, size_t nmemb, void * userdata) { Curl* instance = (Curl*)userdata; if (!instance->_write_fn) return 0; return (size_t)instance->_write_fn(ptr, size*nmemb); } size_t Curl::_s_read_callback(char * ptr, size_t size, size_t nitems, void * userdata) { Curl* instance = (Curl*)userdata; if (!instance->_read_fn) return 0; return (size_t)instance->_read_fn(ptr, size*nitems); } int Curl::_s_ioctl_callback(void * handle, int cmd, void * userdata) { if (cmd != CURLIOCMD_RESTARTREAD) return CURLIOE_UNKNOWNCMD; Curl* instance = (Curl*)userdata; if (!instance->_ioctl_restart_fn) return CURLIOE_FAILRESTART; return instance->_ioctl_restart_fn() ? CURLIOE_OK : CURLIOE_FAILRESTART; } int Curl::_s_seek_callback(void * userdata, long long offset, int origin) { Curl* instance = (Curl*)userdata; try { return instance->_seek_fn(offset, origin) ? CURL_SEEKFUNC_OK : CURL_SEEKFUNC_CANTSEEK; } catch (std::exception) { return CURL_SEEKFUNC_FAIL; } } int Curl::_s_xferinfo_callback(void * userdata, long long dltotal, long long dlnow, long long ultotal, long long ulnow) { try { Curl* instance = (Curl*)userdata; if (instance->_xferinfo_fn) { instance->_xferinfo_fn(dltotal, dlnow, ultotal, ulnow); } return 0; } catch (std::exception) { return 1; } } size_t Curl::_s_header_callback(char * buffer, size_t size, size_t nitems, void * userdata) { try { Curl* instance = (Curl*)userdata; if (instance->_header_fn) { std::string str(buffer, buffer + (size*nitems)); instance->_header_fn(str); } return size*nitems; } catch (std::exception) { return 0; } } int Curl::_s_debug_callback(void* handle, int type, char * data, size_t size, void *userdata) { Curl* instance = (Curl*)userdata; if (instance->_debug_fn) instance->_debug_fn((InfoType)type, data, size); return 0; } int Curl::_s_fnmatch_callback(void * ptr, const char * pattern, const char * string) { Curl* instance = (Curl*)ptr; try { return instance->_match_fn(pattern, string) ? CURL_FNMATCHFUNC_MATCH : CURL_FNMATCHFUNC_NOMATCH; } catch (std::exception) { return CURL_FNMATCHFUNC_FAIL; } } int Curl::_s_ssh_keycallback(void * curl, const void * knownkey, const void * foundkey, int khmatch, void * userdata) { Curl* instance = (Curl*)userdata; const struct curl_khkey* known = (const struct curl_khkey*)knownkey; const struct curl_khkey* found = (const struct curl_khkey*)foundkey; SSHKey key_known, key_found; key_known._data = known->len == 0 ? std::string(known->key) : std::string(known->key, known->key + known->len); key_found._data = found->len == 0 ? std::string(found->key) : std::string(found->key, found->key + found->len); key_known._type = (SSHKeyType)known->keytype; key_found._type = (SSHKeyType)found->keytype; return (int)(instance->_ssh_key_match_fn(key_known, key_found, (SSHKeyMatch)khmatch)); } long Curl::getProtocolMask(const std::string & mask) { static std::map<std::string, long> names = { { "http", CURLPROTO_HTTP }, { "https", CURLPROTO_HTTPS }, { "ftp", CURLPROTO_FTP }, { "ftps", CURLPROTO_FTPS }, { "scp", CURLPROTO_SCP }, { "sftp", CURLPROTO_SFTP }, { "telnet", CURLPROTO_TELNET }, { "ldap", CURLPROTO_LDAP }, { "ldaps", CURLPROTO_LDAPS }, { "dict", CURLPROTO_DICT }, { "file", CURLPROTO_FILE }, { "tftp", CURLPROTO_TFTP }, { "imap", CURLPROTO_IMAP }, { "imaps", CURLPROTO_IMAPS }, { "pop3", CURLPROTO_POP3 }, { "pop3s", CURLPROTO_POP3S }, { "smtp", CURLPROTO_SMTP }, { "smtps", CURLPROTO_SMTPS }, { "rtsp", CURLPROTO_RTSP }, { "rtmp", CURLPROTO_RTMP }, { "rtmpt", CURLPROTO_RTMPT }, { "rtmpe", CURLPROTO_RTMPE }, { "rtmpte", CURLPROTO_RTMPTE }, { "rtmps",CURLPROTO_RTMPS }, { "rtmpts", CURLPROTO_RTMPTS }, { "gopher", CURLPROTO_GOPHER }, #if CURL_AT_LEAST_VERSION(7,40,0) { "smb", CURLPROTO_SMB }, { "smbs", CURLPROTO_SMBS }, #endif { "all", CURLPROTO_ALL } }; long result = 0; for (const std::string& name : stringSplit(" ", mask)) result |= names[name]; return result; } std::shared_ptr<void> Curl::toSList(const std::vector<std::string>& vector) { curl_slist* list = nullptr; for (const std::string& str : vector) { list = curl_slist_append(list, str.c_str()); } return std::shared_ptr<void>(list, [](void* ptr) { curl_slist_free_all((curl_slist*)ptr); }); } std::vector<std::string> Curl::fromSList(void * list) { struct curl_slist* slist = (struct curl_slist*)list; std::vector<std::string> res; while (slist != nullptr) { res.push_back(slist->data); slist = slist->next; } return res; } Curl::CurlGlobalInit Curl::_auto_init; Curl::CurlGlobalInit::CurlGlobalInit() { curl_global_init(CURL_GLOBAL_ALL); } Curl::CurlGlobalInit::~CurlGlobalInit() { curl_global_cleanup(); } } }
23.907077
121
0.684783
Thalhammer
226d4baca5f63f97260efa9e2d9c7ef2d2703612
4,404
cc
C++
src/thirdparty/acg_localizer/src/solver/solverbase.cc
rajvishah/ms-sfm
0de1553c471c416ce5ca3d19c65abe36d8e17a07
[ "MIT" ]
null
null
null
src/thirdparty/acg_localizer/src/solver/solverbase.cc
rajvishah/ms-sfm
0de1553c471c416ce5ca3d19c65abe36d8e17a07
[ "MIT" ]
null
null
null
src/thirdparty/acg_localizer/src/solver/solverbase.cc
rajvishah/ms-sfm
0de1553c471c416ce5ca3d19c65abe36d8e17a07
[ "MIT" ]
null
null
null
/*===========================================================================*\ * * * ACG Localizer * * Copyright (C) 2011 by Computer Graphics Group, RWTH Aachen * * www.rwth-graphics.de * * * *---------------------------------------------------------------------------* * This file is part of ACG Localizer * * * * ACG Localizer is free software: you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation, either version 3 of the License, or * * (at your option) any later version. * * * * ACG Localizer is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with ACG Localizer. If not, see <http://www.gnu.org/licenses/>. * * * \*===========================================================================*/ /* * Definition of Solver base class * * Author: Martin Habbecke <M.Habbecke@gmx.de> * Version: Revision: 1.8 * Date: 2011-10-03 17:30 */ #include <float.h> #include <math.h> #include "solverbase.hh" using namespace Util::Math; namespace Util { namespace CorrSolver { SolverBase::SolverBase() { } SolverBase::~SolverBase() { } void SolverBase::clear( void ) { mv_corresp.clear(); mv_correspScaled.clear(); } void SolverBase::scaleCorrespondences( void ) { CorrespondenceVec::iterator cIter, cEnd; cEnd = mv_corresp.end(); Vector2D feat1, feat2; double n; m_center1 = Vector2D( 0.0, 0.0 ); m_center2 = Vector2D( 0.0, 0.0 ); ////////////////////////////////////////////// // determine c.o.g. in both images and also x- and y-ranges n = 1.0; for( cIter = mv_corresp.begin(); cIter != cEnd; ++cIter ) { m_center1 = cIter->m_feature1 * (1.0/n) + m_center1 * ((n-1.0) / n); m_center2 = cIter->m_feature2 * (1.0/n) + m_center2 * ((n-1.0) / n); n += 1.0f; } /////////////////////////////////////////////// // move features to COG and compute scaling factors mv_correspScaled.clear(); n = 1.0; m_scale1 = m_scale2 = 0.0; for( cIter = mv_corresp.begin(); cIter != cEnd; ++cIter ) { feat1 = cIter->m_feature1 - m_center1; feat2 = cIter->m_feature2 - m_center2; m_scale1 = m_scale1 * ((n-1.0) / n) + feat1.norm() * (1.0 / n); m_scale2 = m_scale2 * ((n-1.0) / n) + feat2.norm() * (1.0 / n); mv_correspScaled.push_back( Correspondence( feat1, feat2 ) ); n += 1.0f; } m_scale1 = 1.41421 / m_scale1; m_scale2 = 1.41421 / m_scale2; ////////////////////////////////////////////// // scale coords in both images cEnd = mv_correspScaled.end(); for( cIter = mv_correspScaled.begin(); cIter != cEnd; ++cIter ) { cIter->m_feature1 *= m_scale1; cIter->m_feature2 *= m_scale2; } //////////////////////////////////////////// // create scaling matrices that will be multiplied // to result matrix m_matScale1.clear(); m_matScale1( 0, 0 ) = m_scale1; m_matScale1( 1, 1 ) = m_scale1; m_matScale1( 0, 2 ) = -m_center1[ 0 ] * m_scale1; m_matScale1( 1, 2 ) = -m_center1[ 1 ] * m_scale1; m_matScale1( 2, 2 ) = 1.0; m_matScale2T.clear(); m_matScale2T( 0, 0 ) = m_scale2; m_matScale2T( 1, 1 ) = m_scale2; m_matScale2T( 2, 0 ) = -m_center2[ 0 ] * m_scale2; m_matScale2T( 2, 1 ) = -m_center2[ 1 ] * m_scale2; m_matScale2T( 2, 2 ) = 1.0; } } }
27.873418
80
0.45663
rajvishah
226efccb72784f9e6191e7a3795c1b4c7b162605
1,691
cpp
C++
Classes/Foundation/NSObject.cpp
duranamu/Foundation
5569fb52cb93ef11dcf4f779a2d1ea4b8cfeb0df
[ "MIT" ]
2
2015-06-29T06:49:20.000Z
2016-10-30T04:25:35.000Z
Classes/Foundation/NSObject.cpp
duranamu/Foundation
5569fb52cb93ef11dcf4f779a2d1ea4b8cfeb0df
[ "MIT" ]
null
null
null
Classes/Foundation/NSObject.cpp
duranamu/Foundation
5569fb52cb93ef11dcf4f779a2d1ea4b8cfeb0df
[ "MIT" ]
null
null
null
/**************************************************************************** Foundation OpenSource Project 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. ****************************************************************************/ #include <Foundation/NSObject.h> #include <Foundation/NSCopying.h> #include <Foundation/NSException.h> #include <Foundation/NSString.h> void NSObject::dealloc() { } vid NSObject::copy() { if(copying) { return copying->copyWithZone(self); }else{ throw NSException::exceptionWithName_reason_userInfo( NSSTR("Panic"),NSSTR("Not Implementation for copyWithZone"),nil); } } NSString* NSObject::description() { return NSSTR("NSObject"); }
38.431818
77
0.698995
duranamu
227365972f4cb42f159fc1c6f7cdf04f407e28a0
646
cpp
C++
poj/3438/main.cpp
nimitz871016/acm
a59aba6333e48473f9ef3c3702965b5ba2c4d741
[ "MIT" ]
null
null
null
poj/3438/main.cpp
nimitz871016/acm
a59aba6333e48473f9ef3c3702965b5ba2c4d741
[ "MIT" ]
null
null
null
poj/3438/main.cpp
nimitz871016/acm
a59aba6333e48473f9ef3c3702965b5ba2c4d741
[ "MIT" ]
null
null
null
// // main.cpp // 3438 // 水题 // Created by Nimitz_007 on 16/7/31. // Copyright © 2016年 Fujian Ruijie Networks Co., Ltd. All rights reserved. // #include <iostream> int main(int argc, const char * argv[]) { int n, count; char c,pre; scanf("%d\n",&n); while(n--){ count = 1; scanf("%c",&pre); while(scanf("%c",&c) && c != '\n'){ if(c != pre){ printf("%d%c",count,pre); pre = c; count = 1; continue; }else{ count++; } } printf("%d%c\n",count,pre); } return 0; }
20.1875
75
0.417957
nimitz871016
22790e90761843a29aec9854856aa2efcfa93323
1,438
cpp
C++
1_Practice_CPP/_CPP_LEARNING__Switch_Operations.cpp
CyberThulhu22/CPP-Projects
d5ed94d45988e5b18ebdff3d19658af87d94a2df
[ "MIT" ]
null
null
null
1_Practice_CPP/_CPP_LEARNING__Switch_Operations.cpp
CyberThulhu22/CPP-Projects
d5ed94d45988e5b18ebdff3d19658af87d94a2df
[ "MIT" ]
null
null
null
1_Practice_CPP/_CPP_LEARNING__Switch_Operations.cpp
CyberThulhu22/CPP-Projects
d5ed94d45988e5b18ebdff3d19658af87d94a2df
[ "MIT" ]
1
2022-01-05T04:18:05.000Z
2022-01-05T04:18:05.000Z
// Switch Operations // // NAME: switchoperation.cpp // VERSION: 0.0.0 // AUTHOR: Jesse Leverett (CyberThulhu) // STATUS: Work In Progress // DESCRIPTION: Basic Program That Teaches Switch Operations // TO-DO: Build Initial Code Framework // USAGE: switchoperation.exe // COPYRIGHT © 2021 Jesse Leverett #include <iostream> using namespace std; /* Learning how to use Switch Operations! Useful when you have multiple "If Statements" and need to test a variable against multiple conditions switch (expression) { case value1: statement(s); break; case value2: statement(s); break; case valueN: statement(s); break; } */ int main() { // Example of Case and Switch Statement(s) int age = 42; // Initial 'age' is set to 42 switch (age) { case 16: // If 'age' is equal to 16 std::cout << "Too Young" << std::endl; break; case 42: // If 'age' is equal to 42 std::cout << "Adult" << std::endl; break; case 70: // If 'age' is equal to 70 std::cout << "Senior" << std::endl; break; default: // Default case can be used to perform a task when none of the cases are "True" std::cout << "This is the default case" << std::endl; break; } return 0; }
26.145455
105
0.552156
CyberThulhu22
22839c7c3a288dc0d1ee45357a36dee0ff3a1deb
706
hpp
C++
Code/include/OE/Engine/Transform.hpp
mlomb/OrbitEngine
41f053626f05782e81c2e48f5c87b04972f9be2c
[ "Apache-2.0" ]
21
2018-06-26T16:37:36.000Z
2022-01-11T01:19:42.000Z
Code/include/OE/Engine/Transform.hpp
mlomb/OrbitEngine
41f053626f05782e81c2e48f5c87b04972f9be2c
[ "Apache-2.0" ]
null
null
null
Code/include/OE/Engine/Transform.hpp
mlomb/OrbitEngine
41f053626f05782e81c2e48f5c87b04972f9be2c
[ "Apache-2.0" ]
3
2019-10-01T14:10:50.000Z
2021-11-19T20:30:18.000Z
#ifndef ENGINE_TRANSFORM_HPP #define ENGINE_TRANSFORM_HPP #include "OE/Config.hpp" #include "OE/Engine/Component.hpp" #include "OE/Math/Vec3.hpp" #include "OE/Math/Mat4.hpp" namespace OrbitEngine { namespace Engine { class Transform : public Component { NATIVE_REFLECTION public: Transform(); ~Transform(); Math::Vec3f GetPosition() const; Math::Vec3f GetRotation() const; Math::Vec3f GetScale() const; Math::Mat4 getMatrix(); void SetPosition(const Math::Vec3f& pos); void SetRotation(const Math::Vec3f& rot); void SetScale(const Math::Vec3f& scale); private: Math::Mat4 m_Matrix; Math::Vec3f m_Position; Math::Vec3f m_Rotation; Math::Vec3f m_Scale; }; } } #endif
19.081081
43
0.719547
mlomb
22841b4dac3d8081a32c55ba564bf19e5a34d857
15,614
cpp
C++
src/vidhrdw/mermaid.cpp
gameblabla/mame_nspire
83dfe1606aba906bd28608f2cb8f0754492ac3da
[ "Unlicense" ]
8
2020-05-01T15:15:16.000Z
2021-05-30T18:49:15.000Z
src/vidhrdw/mermaid.cpp
gameblabla/mame_nspire
83dfe1606aba906bd28608f2cb8f0754492ac3da
[ "Unlicense" ]
null
null
null
src/vidhrdw/mermaid.cpp
gameblabla/mame_nspire
83dfe1606aba906bd28608f2cb8f0754492ac3da
[ "Unlicense" ]
5
2020-05-07T18:38:11.000Z
2021-08-03T12:57:41.000Z
/*************************************************************************** vidhrdw.c Functions to emulate the video hardware of the machine. ***************************************************************************/ #include "driver.h" #include "tilemap.h" #include "vidhrdw/generic.h" unsigned char* mermaid_background_videoram; unsigned char* mermaid_foreground_videoram; unsigned char* mermaid_foreground_colorram; unsigned char* mermaid_background_scrollram; unsigned char* mermaid_foreground_scrollram; static struct osd_bitmap *helper; static struct osd_bitmap *helper2; static struct tilemap *bg_tilemap, *fg_tilemap; static int coll_bit0,coll_bit1,coll_bit2,coll_bit3,coll_bit6 = 0; static int mermaid_flipscreen_x, mermaid_flipscreen_y; static int rougien_gfxbank1, rougien_gfxbank2; static struct rectangle spritevisiblearea = { 0*8, 26*8-1, 2*8, 30*8-1 }; WRITE_HANDLER( mermaid_background_videoram_w ) { mermaid_background_videoram[offset] = data; tilemap_mark_tile_dirty(bg_tilemap, offset); } WRITE_HANDLER( mermaid_foreground_videoram_w ) { mermaid_foreground_videoram[offset] = data; tilemap_mark_tile_dirty(fg_tilemap, offset); } WRITE_HANDLER( mermaid_foreground_colorram_w ) { mermaid_foreground_colorram[offset] = data; tilemap_mark_tile_dirty(fg_tilemap, offset); } WRITE_HANDLER( mermaid_flip_screen_x_w ) { mermaid_flipscreen_x = data & 0x01; } WRITE_HANDLER( mermaid_flip_screen_y_w ) { mermaid_flipscreen_y = data & 0x01; } WRITE_HANDLER( mermaid_bg_scroll_w ) { mermaid_background_scrollram[offset] = data; tilemap_set_scrolly(bg_tilemap, offset, data); } WRITE_HANDLER( mermaid_fg_scroll_w ) { mermaid_foreground_scrollram[offset] = data; tilemap_set_scrolly(fg_tilemap, offset, data); } WRITE_HANDLER( rougien_gfxbankswitch1_w ) { rougien_gfxbank1 = data & 0x01; } WRITE_HANDLER( rougien_gfxbankswitch2_w ) { rougien_gfxbank2 = data & 0x01; } READ_HANDLER( mermaid_collision_r ) { /* collision register active LOW: with coll = spriteram[offs + 2] & 0xc0 Bit 0 - Sprite (coll = 0x40) - Sprite (coll = 0x00) Bit 1 - Sprite (coll = 0x40) - Foreground Bit 2 - Sprite (coll = 0x40) - Background Bit 3 - Sprite (coll = 0x80) - Sprite (coll = 0x00) Bit 4 Bit 5 Bit 6 - Sprite (coll = 0x40) - Sprite (coll = 0x80) Bit 7 */ int collision = 0xff; if(coll_bit0) collision &= 0xfe; if(coll_bit1) collision &= 0xfd; if(coll_bit2) collision &= 0xfb; if(coll_bit3) collision &= 0xf7; if(coll_bit6) collision &= 0xbf; return collision; } /*************************************************************************** Convert the color PROMs into a more useable format. I'm not sure about the resistor value, I'm using the Galaxian ones. ***************************************************************************/ void mermaid_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom) { #define TOTAL_COLORS(gfxn) (Machine->gfx[gfxn]->total_colors * Machine->gfx[gfxn]->color_granularity) #define COLOR(gfxn,offs) (colortable[Machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs]) int i; /* first, the char acter/sprite palette */ for (i = 0;i < TOTAL_COLORS(0); i++) { int bit0,bit1,bit2; /* red component */ bit0 = (*color_prom >> 0) & 0x01; bit1 = (*color_prom >> 1) & 0x01; bit2 = (*color_prom >> 2) & 0x01; *(palette++) = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; /* green component */ bit0 = (*color_prom >> 3) & 0x01; bit1 = (*color_prom >> 4) & 0x01; bit2 = (*color_prom >> 5) & 0x01; *(palette++) = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; /* blue component */ bit0 = 0; bit1 = (*color_prom >> 6) & 0x01; bit2 = (*color_prom >> 7) & 0x01; *(palette++) = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; color_prom++; } /* blue background */ *(palette++) = 0; *(palette++) = 0; *(palette++) = 0xff; /* set up background palette */ COLOR(2,0) = 32; COLOR(2,1) = 33; COLOR(2,2) = 64; COLOR(2,3) = 33; } void rougien_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom) { #define TOTAL_COLORS(gfxn) (Machine->gfx[gfxn]->total_colors * Machine->gfx[gfxn]->color_granularity) #define COLOR(gfxn,offs) (colortable[Machine->drv->gfxdecodeinfo[gfxn].color_codes_start + offs]) int i; /* first, the char acter/sprite palette */ for (i = 0;i < TOTAL_COLORS(0); i++) { int bit0,bit1,bit2; /* red component */ bit0 = (*color_prom >> 0) & 0x01; bit1 = (*color_prom >> 1) & 0x01; bit2 = (*color_prom >> 2) & 0x01; *(palette++) = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; /* green component */ bit0 = (*color_prom >> 3) & 0x01; bit1 = (*color_prom >> 4) & 0x01; bit2 = (*color_prom >> 5) & 0x01; *(palette++) = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; /* blue component */ bit0 = 0; bit1 = (*color_prom >> 6) & 0x01; bit2 = (*color_prom >> 7) & 0x01; *(palette++) = 0x21 * bit0 + 0x47 * bit1 + 0x97 * bit2; color_prom++; } /* black background */ *(palette++) = 0; *(palette++) = 0; *(palette++) = 0; /* set up background palette */ COLOR(2,0) = 0x40; COLOR(2,1) = 0x00; COLOR(2,2) = 0x00; COLOR(2,3) = 0x02; } static void draw_sprites(struct osd_bitmap *dest_bitmap) { int offs; /* draw the sprites */ for (offs = spriteram_size - 4;offs >= 0;offs -= 4) { int flipx,flipy,sx,sy,code,bank,attr,color; attr = spriteram[offs + 2]; color = attr & 0x0f; bank = (attr & 0x30) >> 4; code = (spriteram[offs] & 0x3f) | (bank << 6); code |= rougien_gfxbank1 * 0x2800; code |= rougien_gfxbank2 * 0x2400; sx = spriteram[offs + 3] + 1; if (sx >= 0xf0) sx -= 256; sy = 240 - spriteram[offs + 1]; flipx = spriteram[offs + 0] & 0x40; flipy = spriteram[offs + 0] & 0x80; drawgfx(dest_bitmap,Machine->gfx[1], code, color, flipx, flipy, sx, sy, &spritevisiblearea,TRANSPARENCY_PEN,0); } } static void get_bg_tile_info (int tile_index) { int code = mermaid_background_videoram[tile_index]; int sx = tile_index % 32; int color = (sx >= 26) ? 0 : 1; SET_TILE_INFO(2, code, color); } static void get_fg_tile_info (int tile_index) { int attr = mermaid_foreground_colorram[tile_index]; int code = mermaid_foreground_videoram[tile_index] + ((attr & 0x30) << 4); int color = attr & 0x0f; code |= rougien_gfxbank1 * 0x2800; code |= rougien_gfxbank2 * 0x2400; SET_TILE_INFO(0, code, color); tile_info.flags = TILE_FLIPYX((attr & 0xc0) >> 6); } static unsigned char mermaid_colcheck(int bit, const struct rectangle* rect) { unsigned char data = 0; int x; int y; for (y = rect->min_y; y <= rect->max_y; y++) { for (x = rect->min_x; x <= rect->max_x; x++) { unsigned int pa = read_pixel(helper, x, y); unsigned int pb = read_pixel(helper2, x, y); //a[x- rect->min_x] = pa; //b[x- rect->min_x] = pb; if (pb != 0) if ((pa != 0) & (pa != 0x40)) data |= 0x01; } } return data; } void mermaid_vh_eof(void) { const struct rectangle *visarea = &Machine->visible_area; int offs,offs2; coll_bit1 = 0; coll_bit2 = 0; coll_bit3 = 0; coll_bit6 = 0; coll_bit0 = 0; // check for bit 0 (sprite-sprite), 1 (sprite-foreground), 2 (sprite-background) for (offs = spriteram_size - 4; offs >= 0; offs -= 4) { int attr = spriteram[offs + 2]; int bank = (attr & 0x30) >> 4; int coll = (attr & 0xc0) >> 6; int code = (spriteram[offs] & 0x3f) | (bank << 6); int flipx = spriteram[offs] & 0x40; int flipy = spriteram[offs] & 0x80; int sx = spriteram[offs + 3] + 1; int sy = 240 - spriteram[offs + 1]; struct rectangle rect; if (coll != 1) continue; code |= rougien_gfxbank1 * 0x2800; code |= rougien_gfxbank2 * 0x2400; #if 0 if (mermaid_flipscreen_x) { flipx = !flipx; sx = 240 - sx; } if (mermaid_flipscreen_y) { flipy = !flipy; sy = 240 - sy; } #endif rect.min_x = sx; rect.min_y = sy; rect.max_x = sx + Machine->gfx[1]->width - 1; rect.max_y = sy + Machine->gfx[1]->height - 1; if (rect.min_x < visarea->min_x) rect.min_x = visarea->min_x; if (rect.min_y < visarea->min_y) rect.min_y = visarea->min_y; if (rect.max_x > visarea->max_x) rect.max_x = visarea->max_x; if (rect.max_y > visarea->max_y) rect.max_y = visarea->max_y; tilemap_set_clip(bg_tilemap, &rect); tilemap_set_clip(fg_tilemap, &rect); // check collision sprite - background fillbitmap(helper,0,&rect); fillbitmap(helper2,0,&rect); tilemap_draw(helper, bg_tilemap, 0); drawgfx(helper2, Machine->gfx[1], code, 0, flipx, flipy, sx, sy, &rect,TRANSPARENCY_PEN, 0); coll_bit2 |= mermaid_colcheck(2, &rect); // check collision sprite - foreground fillbitmap(helper,0,&rect); fillbitmap(helper2,0,&rect); tilemap_draw(helper, fg_tilemap, 0); drawgfx(helper2, Machine->gfx[1], code, 0, flipx, flipy, sx, sy, &rect,TRANSPARENCY_PEN, 0); coll_bit1 |= mermaid_colcheck(1, &rect); // check collision sprite - sprite fillbitmap(helper,0,&rect); fillbitmap(helper2,0,&rect); for (offs2 = spriteram_size - 4; offs2 >= 0; offs2 -= 4) if (offs != offs2) { int attr2 = spriteram[offs2 + 2]; int bank2 = (attr2 & 0x30) >> 4; int coll2 = (attr2 & 0xc0) >> 6; int code2 = (spriteram[offs2] & 0x3f) | (bank2 << 6); int flipx2 = spriteram[offs2] & 0x40; int flipy2 = spriteram[offs2] & 0x80; int sx2 = spriteram[offs2 + 3] + 1; int sy2 = 240 - spriteram[offs2 + 1]; if (coll2 != 0) continue; code2 |= rougien_gfxbank1 * 0x2800; code2 |= rougien_gfxbank2 * 0x2400; #if 0 if (mermaid_flip_screen_x) { flipx2 = !flipx2; sx2 = 240 - sx2; } if (mermaid_flip_screen_y) { flipy2 = !flipy2; sy2 = 240 - sy2; } #endif drawgfx(helper, Machine->gfx[1], code2, 0, flipx2, flipy2, sx2, sy2, &rect,TRANSPARENCY_PEN, 0); } drawgfx(helper2, Machine->gfx[1], code, 0, flipx, flipy, sx, sy, &rect,TRANSPARENCY_PEN, 0); coll_bit0 |= mermaid_colcheck(0, &rect); } // check for bit 3 (sprite-sprite) for (offs = spriteram_size - 4; offs >= 0; offs -= 4) { int attr = spriteram[offs + 2]; int bank = (attr & 0x30) >> 4; int coll = (attr & 0xc0) >> 6; int code = (spriteram[offs] & 0x3f) | (bank << 6); int flipx = spriteram[offs] & 0x40; int flipy = spriteram[offs] & 0x80; int sx = spriteram[offs + 3] + 1; int sy = 240 - spriteram[offs + 1]; struct rectangle rect; if (coll != 2) continue; code |= rougien_gfxbank1 * 0x2800; code |= rougien_gfxbank2 * 0x2400; #if 0 if (mermaid_flipscreen_x) { flipx = !flipx; sx = 240 - sx; } if (mermaid_flipscreen_y) { flipy = !flipy; sy = 240 - sy; } #endif rect.min_x = sx; rect.min_y = sy; rect.max_x = sx + Machine->gfx[1]->width - 1; rect.max_y = sy + Machine->gfx[1]->height - 1; if (rect.min_x < visarea->min_x) rect.min_x = visarea->min_x; if (rect.min_y < visarea->min_y) rect.min_y = visarea->min_y; if (rect.max_x > visarea->max_x) rect.max_x = visarea->max_x; if (rect.max_y > visarea->max_y) rect.max_y = visarea->max_y; // check collision sprite - sprite fillbitmap(helper,0,&rect); fillbitmap(helper2,0,&rect); for (offs2 = spriteram_size - 4; offs2 >= 0; offs2 -= 4) if (offs != offs2) { int attr2 = spriteram[offs2 + 2]; int bank2 = (attr2 & 0x30) >> 4; int coll2 = (attr2 & 0xc0) >> 6; int code2 = (spriteram[offs2] & 0x3f) | (bank2 << 6); int flipx2 = spriteram[offs2] & 0x40; int flipy2 = spriteram[offs2] & 0x80; int sx2 = spriteram[offs2 + 3] + 1; int sy2 = 240 - spriteram[offs2 + 1]; if (coll2 != 0) continue; code2 |= rougien_gfxbank1 * 0x2800; code2 |= rougien_gfxbank2 * 0x2400; #if 0 if (mermaid_flipscreen_x) { flipx = !flipx; sx = 240 - sx; } if (mermaid_flipscreen_y) { flipy = !flipy; sy = 240 - sy; } #endif drawgfx(helper, Machine->gfx[1], code2, 0, flipx2, flipy2, sx2, sy2, &rect,TRANSPARENCY_PEN, 0); } drawgfx(helper2, Machine->gfx[1], code, 0, flipx, flipy, sx, sy, &rect,TRANSPARENCY_PEN, 0); coll_bit3 |= mermaid_colcheck(3, &rect); } // check for bit 6 for (offs = spriteram_size - 4; offs >= 0; offs -= 4) { int attr = spriteram[offs + 2]; int bank = (attr & 0x30) >> 4; int coll = (attr & 0xc0) >> 6; int code = (spriteram[offs] & 0x3f) | (bank << 6); int flipx = spriteram[offs] & 0x40; int flipy = spriteram[offs] & 0x80; int sx = spriteram[offs + 3] + 1; int sy = 240 - spriteram[offs + 1]; struct rectangle rect; if (coll != 1) continue; code |= rougien_gfxbank1 * 0x2800; code |= rougien_gfxbank2 * 0x2400; #if 0 if (mermaid_flipscreen_x) { flipx = !flipx; sx = 240 - sx; } if (mermaid_flipscreen_y) { flipy = !flipy; sy = 240 - sy; } #endif rect.min_x = sx; rect.min_y = sy; rect.max_x = sx + Machine->gfx[1]->width - 1; rect.max_y = sy + Machine->gfx[1]->height - 1; if (rect.min_x < visarea->min_x) rect.min_x = visarea->min_x; if (rect.min_y < visarea->min_y) rect.min_y = visarea->min_y; if (rect.max_x > visarea->max_x) rect.max_x = visarea->max_x; if (rect.max_y > visarea->max_y) rect.max_y = visarea->max_y; // check collision sprite - sprite fillbitmap(helper,0,&rect); fillbitmap(helper2,0,&rect); for (offs2 = spriteram_size - 4; offs2 >= 0; offs2 -= 4) if (offs != offs2) { int attr2 = spriteram[offs2 + 2]; int bank2 = (attr2 & 0x30) >> 4; int coll2 = (attr2 & 0xc0) >> 6; int code2 = (spriteram[offs2] & 0x3f) | (bank2 << 6); int flipx2 = spriteram[offs2] & 0x40; int flipy2 = spriteram[offs2] & 0x80; int sx2 = spriteram[offs2 + 3] + 1; int sy2 = 240 - spriteram[offs2 + 1]; if (coll2 != 2) continue; code2 |= rougien_gfxbank1 * 0x2800; code2 |= rougien_gfxbank2 * 0x2400; #if 0 if (mermaid_flipscreen_x) { flipx = !flipx; sx = 240 - sx; } if (mermaid_flipscreen_y) { flipy = !flipy; sy = 240 - sy; } #endif drawgfx(helper, Machine->gfx[1], code2, 0, flipx2, flipy2, sx2, sy2, &rect,TRANSPARENCY_PEN, 0); } drawgfx(helper2, Machine->gfx[1], code, 0, flipx, flipy, sx, sy, &rect,TRANSPARENCY_PEN, 0); coll_bit6 |= mermaid_colcheck(6, &rect); } } int mermaid_vh_start(void) { helper = bitmap_alloc(Machine->drv->screen_width, Machine->drv->screen_height); if (!helper) return 1; helper2 = bitmap_alloc(Machine->drv->screen_width, Machine->drv->screen_height); if (!helper2) { free (helper); helper = 0; return 1; } bg_tilemap = tilemap_create(get_bg_tile_info, tilemap_scan_rows, TILEMAP_OPAQUE, 8, 8, 32, 32); tilemap_set_scroll_cols(bg_tilemap, 32); fg_tilemap = tilemap_create(get_fg_tile_info, tilemap_scan_rows, TILEMAP_TRANSPARENT, 8, 8, 32, 32); tilemap_set_scroll_cols(fg_tilemap, 32); tilemap_set_transparent_pen(fg_tilemap, 0); if (bg_tilemap && fg_tilemap) return 0; else return 1; } void mermaid_vh_stop(void) { if (helper) { free (helper); helper = 0; } if (helper2) { free (helper2); helper2 = 0; } } void mermaid_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh) { tilemap_set_clip(bg_tilemap, &Machine->visible_area); tilemap_set_clip(fg_tilemap, &Machine->visible_area); tilemap_update(ALL_TILEMAPS); tilemap_render(ALL_TILEMAPS); tilemap_draw(bitmap, bg_tilemap, 0); tilemap_draw(bitmap, fg_tilemap, 0); draw_sprites(bitmap); }
23.444444
118
0.626937
gameblabla
22866855db221634cabad0169bdeab827220463b
128
cpp
C++
engine/Source.cpp
LHolmberg/L3D
6020222700f3ee70cfbf02601bd93bfd59a8fb34
[ "MIT" ]
null
null
null
engine/Source.cpp
LHolmberg/L3D
6020222700f3ee70cfbf02601bd93bfd59a8fb34
[ "MIT" ]
null
null
null
engine/Source.cpp
LHolmberg/L3D
6020222700f3ee70cfbf02601bd93bfd59a8fb34
[ "MIT" ]
null
null
null
#include "TESTSAMPLEFILE.h" int main() { Game::Startup(); while (running) Game::Update(); Game::Shutdown(); return 0; }
11.636364
27
0.632813
LHolmberg
2288a9f0d5ffd36fe1a4e2e1cc2289293258d161
662
cpp
C++
SourceCode/Chapter 12/Pr12-4.cpp
aceiro/poo2019
0f93d22296f43a8b024a346f510c00314817d2cf
[ "MIT" ]
1
2019-04-09T18:29:38.000Z
2019-04-09T18:29:38.000Z
SourceCode/Chapter 12/Pr12-4.cpp
aceiro/poo2019
0f93d22296f43a8b024a346f510c00314817d2cf
[ "MIT" ]
null
null
null
SourceCode/Chapter 12/Pr12-4.cpp
aceiro/poo2019
0f93d22296f43a8b024a346f510c00314817d2cf
[ "MIT" ]
null
null
null
// This program writes three rows of numbers to a file. #include<iostream> #include<fstream> #include<iomanip> using namespace std; int main() { const int ROWS = 3; // Rows to write const int COLS = 3; // Columns to write int nums[ROWS][COLS] = { 2897, 5, 837, 34, 7, 1623, 390, 3456, 12 }; fstream outFile("table.txt", ios::out); // Write the three rows of numbers with each // number in a field of 8 character spaces. for (int row = 0; row < ROWS; row++) { for (int col = 0; col < COLS; col++) { outFile << setw(8) << nums[row][col]; } outFile << endl; } outFile.close(); cout << "Done.\n"; return 0; }
22.827586
55
0.595166
aceiro
228e98e9c38d2139893a515586219984c9e0031b
113
hpp
C++
redvoid/src/DLL.hpp
fictionalist/RED-VOID
01bacd893f095748d784e494c80a6a9c96481acc
[ "MIT" ]
1
2021-01-04T01:31:34.000Z
2021-01-04T01:31:34.000Z
redvoid/src/DLL.hpp
fictionalist/RED-VOID
01bacd893f095748d784e494c80a6a9c96481acc
[ "MIT" ]
null
null
null
redvoid/src/DLL.hpp
fictionalist/RED-VOID
01bacd893f095748d784e494c80a6a9c96481acc
[ "MIT" ]
1
2021-01-05T00:55:47.000Z
2021-01-05T00:55:47.000Z
#pragma once #include <Windows.h> namespace DLL { void init(); void quit(); DWORD WINAPI main(LPVOID lp); }
11.3
30
0.672566
fictionalist
228f97ad7c8a18ceeaf766bfe8470114312b1d06
12,309
cpp
C++
SDL2/SDL2Engine/SDL2Engine/Player.cpp
functard/INK.-A-SDL-2-GAME
2b65706c65ba38fa909c8b7726863f3c4e835748
[ "MIT" ]
1
2022-02-22T13:42:44.000Z
2022-02-22T13:42:44.000Z
SDL2/SDL2Engine/SDL2Engine/Player.cpp
functard/INK.-A-SDL-2-GAME
2b65706c65ba38fa909c8b7726863f3c4e835748
[ "MIT" ]
null
null
null
SDL2/SDL2Engine/SDL2Engine/Player.cpp
functard/INK.-A-SDL-2-GAME
2b65706c65ba38fa909c8b7726863f3c4e835748
[ "MIT" ]
null
null
null
#pragma region project include #include "Player.h" #include "Input.h" #include "Engine.h" #include "Renderer.h" #include "ContentManagement.h" #include "Config.h" #include "Bullet.h" #include "MenuScene.h" #include "MainScene.h" #include "Animation.h" #include "Sound.h" #include "Texture.h" #include "Config.h" #include "Time.h" #include "MoveEnemy.h" #include "Text.h" #include "Game.h" #pragma endregion //Made by Ege, Iman GPlayer* GPlayer::pPlayer = nullptr; #pragma region public function // initialize player void GPlayer::Init() { pPlayer = this; #pragma region Ege, Iman //create take damage animation m_pTakaDamageAnim = new CAnimation(SVector2(GConfig::s_PlayerSrcRectWidth * 8, 0), SVector2(GConfig::s_PlayerSrcRectWidth, 165), 2); //set take damage animation time m_pTakaDamageAnim->SetAnimationTime(0.5f); // create idle animation m_pIdleAnim = new CAnimation(SVector2(0.0f, 0.0f), SVector2(GConfig::s_PlayerSrcRectWidth , 165), 1); //create shoot animation m_pShootAnim = new CAnimation(SVector2(0, 219), SVector2(GConfig::s_PlayerSrcRectWidth, 155), 5); //set shoot animation time m_pShootAnim->SetAnimationTime(0.5f); // create run animation m_pRunAnim = new CAnimation(SVector2(0,0), SVector2(GConfig::s_PlayerSrcRectWidth, GConfig::s_PlayerSrcRectHeight), 8); //set run animation time m_pRunAnim->SetAnimationTime(0.5f); // set idle to current animation m_pCurrentAnim = m_pIdleAnim; // create shot sound m_pShot = new CSound("Audio/S_Shot.wav"); //create fox attack sound m_pFoxAttack = new CSound("Audio/S_WolfAttack.wav"); //create form changing sound m_Fox = new CSound("Audio/M_Fox.wav"); #pragma endregion } #pragma endregion #pragma region public override function // update every frame void GPlayer::Update(float _deltaSeconds) { #pragma region Ege // if cooldown start if (m_startCooldown) { // set invulnerability to true; m_invulnerability = true; // decrease invulnerability timer m_invulnerabilityTimer -= _deltaSeconds; //set current animation to take damage m_pCurrentAnim = m_pTakaDamageAnim; } // when timer hits zero if (m_invulnerabilityTimer <= 0) { //reset timer m_invulnerabilityTimer = 2.0f; //stop cooldown m_startCooldown = false; //set invulnerability to false m_invulnerability = false; } //when shoot animation finishes if (m_pShootAnim->GetAnimationPercentage() == 100) { //can idle m_canIdle = true; //can run m_canRun = true; //reset animation percantage m_pShootAnim->ResetAnimationPercentage(); } //when shoot animation finishes if (m_pTakaDamageAnim->GetAnimationPercentage() == 100) { //reset animation percantage m_pTakaDamageAnim->ResetAnimationPercentage(); //can idle m_canIdle = true; //can run m_canRun = true; } //if hit by boss bullet and not invulnerable if (m_pColTarget && m_pColTarget->GetTag() == "BossBullet" && !m_invulnerability) { //remove bullet CTM->RemoveObject(m_pColTarget); //player take damage m_playerHealth -= 50; //start invulnerability timer m_startCooldown = true; //player invulnerable m_invulnerability = true; //set animation to take damage animation m_pCurrentAnim = m_pTakaDamageAnim; } // if collides when falling if (m_pColFallTarget) { // if collides with fire and not invulnerable if (m_pColFallTarget->GetTag() == "Fire" && !m_invulnerability) { //delays for 2 sec SDL_Delay(2000); //change scene ENGINE->ChangeScene(new GMenuScene()); } } // if key space is pressed down and is human form jump if (CInput::GetKeyDown(SDL_SCANCODE_SPACE) && m_grounded && m_isHumanForm) { //player jump SetFallTime(-GConfig::s_PlayerJump); canJump = false; } // if key space is pressed down and is fox form jump if (CInput::GetKeyDown(SDL_SCANCODE_SPACE) && m_grounded && !m_isHumanForm) { //fox currently jumping isJumping = true; //set current animation to jump animation m_pCurrentAnim = m_pJumpAnim; //fox jump SetFallTime(-GConfig::s_PlayerJump); //set can jump to false canJump = false; } // fox form double jump else if (CInput::GetKeyDown(SDL_SCANCODE_SPACE) && !m_grounded && !canJump && !m_isHumanForm) { //fox currently jumping isJumping = true; //set current animation to jump animation m_pCurrentAnim = m_pJumpAnim; //fox double jump SetFallTime(-GConfig::s_PlayerJump); //set can jump to true canJump = true; } // if key r pressed spawn ice bullet if (CInput::GetKeyDown(SDL_SCANCODE_R) && m_isHumanForm) { //can idle m_canIdle = false; //can run m_canRun = false; //sets current animation to shoot animation m_pCurrentAnim = m_pShootAnim; // create ice bullet GBullet* pBullet = new GBullet(SVector2(), SVector2(8, 8), "Texture/Bullet/T_IceBullet.png"); // spawn left (-1) or right (1) from player int spawnSide = 1; // if mirror set spawn side left if (m_mirror.X) spawnSide = -1; // set values pBullet->SetPosition(SVector2(m_position.X + 20 + spawnSide * m_rect.w, m_position.Y + m_rect.h * 0.25f)); pBullet->SetColType(ECollisionType::WALL); pBullet->SetSpeed(GConfig::s_BulletSpeed); pBullet->SetMovement(SVector2(spawnSide, 0.0f)); pBullet->SetTag("Bullet"); // add bullet to content management CTM->AddPersistantObject(pBullet); // play shot sound m_pShot->Play(); } // if key space spawn ice bullet if (CInput::GetKeyDown(SDL_SCANCODE_RETURN) && m_isHumanForm) { //can idle m_canIdle = false; //can run m_canRun = false; //set current animation to run m_pCurrentAnim = m_pShootAnim; // create bullet GBullet* pBullet = new GBullet(SVector2(), SVector2(8, 8), "Texture/Bullet/T_Bullet.png"); // spawn left (-1) or right (1) from player int spawnSide = 1; // if mirror set spawn side left if (m_mirror.X) spawnSide = -1; // set values pBullet->SetPosition(SVector2(m_position.X + 20 + spawnSide * m_rect.w, m_position.Y + m_rect.h * 0.25f)); pBullet->SetColType(ECollisionType::WALL); pBullet->SetSpeed(GConfig::s_BulletSpeed); pBullet->SetMovement(SVector2(spawnSide, 0.0f)); pBullet->SetTag("Bullet"); // add bullet to content management CTM->AddPersistantObject(pBullet); // play shot sound m_pShot->Play(); // if current animation finishes if (m_pCurrentAnim->GetAnimationPercentage() == 100) m_canIdle = true; // can idle } #pragma endregion #pragma region Iman, Ege //if f pressed and is human if ((CInput::GetKeyUp(SDL_SCANCODE_F) && m_isHumanForm)) { //fox texture m_pTexture = new CTexture("Texture/Player/T_Fox.png"); //not human m_isHumanForm = false; //play form change sound m_Fox->Play(); // create idle animation m_pIdleAnim = new CAnimation(SVector2(0, 0), SVector2(210, GConfig::s_FoxSrcRectHeight), 1); // set idle animation time m_pIdleAnim->SetAnimationTime(2.0f); // create walk animation m_pRunAnim = new CAnimation(SVector2(0,145), SVector2(GConfig::s_FoxSrcRectWidth, GConfig::s_FoxSrcRectHeight), 6); // set walk animation time m_pRunAnim->SetAnimationTime(0.5f); // create wolf attack animation m_pAttackAnim = new CAnimation(SVector2(0, 451), SVector2(230,170), 5); // set attack animation time m_pAttackAnim->SetAnimationTime(1.0f); // create wolf jump animation m_pJumpAnim = new CAnimation(SVector2(0, 310), SVector2(230, 137),10); // set jump animation time m_pJumpAnim->SetAnimationTime(0.5f); } #pragma endregion #pragma region Iman //if f pressed and is fox else if ((CInput::GetKeyUp(SDL_SCANCODE_F) && !m_isHumanForm)) { //can run m_canRun = true; //set player texture m_pTexture = new CTexture("Texture/Player/T_Player.png"); //is human m_isHumanForm = true; // create idle animation m_pIdleAnim = new CAnimation(SVector2(0.0f, 0), SVector2(GConfig::s_PlayerSrcRectWidth, GConfig::s_PlayerSrcRectHeight), 1); // create walk animation m_pRunAnim = new CAnimation(SVector2(0.0f, 0.0f), SVector2(GConfig::s_PlayerSrcRectWidth, GConfig::s_PlayerSrcRectHeight), 8); // set walk animation time m_pRunAnim->SetAnimationTime(0.5f); // create shoot animation m_pShootAnim = new CAnimation(SVector2(0,219), SVector2(GConfig::s_PlayerSrcRectWidth, 155), 5); //set shoot animation time m_pShootAnim->SetAnimationTime(0.5f); // create jump animation m_pJumpAnim = new CAnimation(SVector2(0.0f, GConfig::s_PlayerSrcRectHeight * 2), SVector2(GConfig::s_PlayerSrcRectWidth, GConfig::s_PlayerSrcRectHeight), 8); } #pragma endregion #pragma region Ege //if fox form and enter pressed if (CInput::GetKeyDown(SDL_SCANCODE_RETURN) && !m_isHumanForm) { //can run m_canRun = false; //starts attack m_isAttacking = true; //if facing right if(m_mirror.X == 0) m_movement = 3.0f; // move right else m_movement = -3.0f; // move left //play fox attack sound m_pFoxAttack->Play(); } // if jump animation finishes if (m_pJumpAnim && m_pJumpAnim->GetAnimationPercentage() == 100) { //is jumping isJumping = false; //reset animation percentage m_pJumpAnim->ResetAnimationPercentage(); } // if key a is pressed and not attacking if (CInput::GetKey(SDL_SCANCODE_A) && m_isAttacking == false && m_canRun) { // set negative x movement and mirror horizontal m_movement.X = -10.0f; m_mirror.X = 1.0f; // set current animation to run if(!isJumping )//c) m_pCurrentAnim = m_pRunAnim; //can idle m_canIdle = true; } // if key d is pressed and not attacking else if (CInput::GetKey(SDL_SCANCODE_D) && m_isAttacking == false && m_canRun) { // set positive x movement and mirror none //set movement m_movement.X = 10.0f; //set direction m_mirror.X = 0.0f; //if is jumping if (!isJumping) m_pCurrentAnim = m_pRunAnim; // set current animation to run //can idle m_canIdle = true; } // if fox attack else if (m_isAttacking) { // set attack animation m_pCurrentAnim = m_pAttackAnim; //if animation finishes if (m_pCurrentAnim->GetAnimationPercentage() == 100) { //reset animation percentage m_pCurrentAnim->ResetAnimationPercentage(); //is attacking m_isAttacking = false; //can run m_canRun = true; } } // else no x movement else { m_movement.X = 0.0f; if (!isJumping && m_canIdle) { //reset shoot animation m_pShootAnim->ResetAnimationPercentage(); // set current animation to idle m_pCurrentAnim = m_pIdleAnim; } } // update animation m_pCurrentAnim->Update(_deltaSeconds); // set source from animation m_srcRect = SRect( m_pCurrentAnim->GetSize().X, m_pCurrentAnim->GetSize().Y, m_pCurrentAnim->GetCurrentTexturePosition().X, m_pCurrentAnim->GetCurrentTexturePosition().Y ); // if collision target valid and is enemy and not attacking destroy all and back to menu if (m_pColTarget && m_pColTarget->GetTag() == "Enemy" && !m_isAttacking) { if (!m_invulnerability) m_playerHealth -= 50; //can idle m_canIdle = false; //can run m_canRun = false; //invulnerable m_invulnerability = true; //start invulnerability timer m_startCooldown = true; } // if collision target valid and is enemy and not attacking destroy all and back to menu if (m_pColTarget && m_pColTarget->GetTag() == "Boss" && !m_isAttacking) { // if not invulnerable if (!m_invulnerability) m_playerHealth -= 50; // player get damage //can idle m_canIdle = false; //can run m_canRun = false; //is invulnerable m_invulnerability = true; //start invulnerability timer m_startCooldown = true; } //if player dies if (m_playerHealth <= 0) { //delays for 2 sec SDL_Delay(2000); //change scene ENGINE->ChangeScene(new GMenuScene()); } // if collision target valid and is enemy and is attacking else if (m_pColTarget && (m_pColTarget->GetTag() == "Enemy" || m_pColTarget->GetTag() == "Boss") && m_isAttacking) { //damage enemy GMoveEnemy::Get()->m_health -= 20; } // update parent CMoveEntity::Update(_deltaSeconds); // parent camera to player RENDERER->SetCamera(m_position); } #pragma endregion // render every frame void GPlayer::Render() { CMoveEntity::Render(); } #pragma endregion
20.79223
115
0.699488
functard
22941298dfcca580c5dc668974c30d6ed6b491c1
397
hpp
C++
Parser/includes/RapidJsonErrorHandler.hpp
LiardeauxQ/r-type
8a77164c276b2d5958cd3504a9ea34f1cf6823cf
[ "MIT" ]
2
2020-02-12T12:02:00.000Z
2020-12-23T15:31:59.000Z
Parser/includes/RapidJsonErrorHandler.hpp
LiardeauxQ/r-type
8a77164c276b2d5958cd3504a9ea34f1cf6823cf
[ "MIT" ]
null
null
null
Parser/includes/RapidJsonErrorHandler.hpp
LiardeauxQ/r-type
8a77164c276b2d5958cd3504a9ea34f1cf6823cf
[ "MIT" ]
2
2020-02-12T12:02:03.000Z
2020-12-23T15:32:55.000Z
// // Created by Quentin Liardeaux on 11/18/19. // #ifndef R_TYPE_RAPIDJSONERRORHANDLER_HPP #define R_TYPE_RAPIDJSONERRORHANDLER_HPP #include <string> #include "ParseError.hpp" #include "rapidjson/document.h" class RapidJsonErrorHandler { public: static const rapidjson::Value &getValidValue(rapidjson::Value const &value, const string &id); }; #endif //R_TYPE_RAPIDJSONERRORHANDLER_HPP
19.85
98
0.783375
LiardeauxQ
2294966034f0c3b8f277cccd7cae798cfcec69a5
14,328
cpp
C++
CT/CT_PhysX.cpp
ca1773130n/CubeTop
15059ad1c82723738d6c2bfb529663eb0796ff50
[ "MIT" ]
null
null
null
CT/CT_PhysX.cpp
ca1773130n/CubeTop
15059ad1c82723738d6c2bfb529663eb0796ff50
[ "MIT" ]
null
null
null
CT/CT_PhysX.cpp
ca1773130n/CubeTop
15059ad1c82723738d6c2bfb529663eb0796ff50
[ "MIT" ]
null
null
null
#include "stdafx.h" #include "CT_PhysX.h" #include "CT_Object.h" #include "NxCooking.h" #include "Stream.h" #include <vector> /*************************************************************************************************************************************************************/ /* 피직스 클래스 */ /*************************************************************************************************************************************************************/ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * \brief 메인 초기화 함수 PhysX 환경을 초기화 하는 함수이다. SDK를 초기화 하고 기본 파라미터를 설정한다. * \param VOID 없음 * \return 없음 */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// BOOL CtPhysX::Init( VOID ) { NxPhysicsSDKDesc desc; NxSDKCreateError errorCode = NXCE_NO_ERROR; m_pPhysXSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, NULL, NULL, desc, &errorCode ); if( !m_pPhysXSDK ) { MessageBox( 0, L"PhysX SDK를 초기화하지 못했습니다.", 0, 0 ); return false; } NxHWVersion hwCheck = m_pPhysXSDK->getHWVersion(); m_bHasHW = (hwCheck != NX_HW_VERSION_NONE); // PhysX 파라미터 설정 m_pPhysXSDK->setParameter( NX_SKIN_WIDTH, 0.005f ); m_pPhysXSDK->setParameter( NX_ASYNCHRONOUS_MESH_CREATION, 1.0f ); m_bSimulation = TRUE; // 쿠킹 초기화 if( !NxInitCooking() ) { MessageBox(0,L"NxInitCooking 실패!",0,0); exit(0); } return true; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * \brief PhysX 씬 생성 함수 큐브 마다 할당되는 기본 씬 객체를 생성하는 함수이다. 이 함수는 한개의 ground plane static actor를 갖는 기본 씬을 생성한다. 또 이 기본 씬은 기본 및 고마찰력 피직스 재질 및 기본 collision group들을 갖는다. * \note 씬을 생성할 때 NxSceneDesc 작성시 flags 값에 유의할 것. 멀티쓰레딩 시 원하지 않는 결과를 얻을 수 있다. * \param VOID 없음 * \return 없음 */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// NxScene* CtPhysX::CreateScene( VOID ) { NxBounds3 bounds; bounds.max = NxVec3( -32, -32, -32 ); bounds.min = NxVec3( 32, 32, 32 ); NxSceneDesc sceneDesc; sceneDesc.simType = ( m_bHasHW ? NX_SIMULATION_HW : NX_SIMULATION_SW ); sceneDesc.gravity = NxVec3( 0.0f, -20.0f, 0.f ); sceneDesc.maxBounds = &bounds; sceneDesc.flags |= NX_SF_RESTRICTED_SCENE; sceneDesc.flags |= NX_SF_ENABLE_MULTITHREAD; //sceneDesc.flags &= ~NX_SF_SIMULATE_SEPARATE_THREAD; NxScene *scene = m_pPhysXSDK->createScene( sceneDesc ); if( !scene ) { MessageBox( 0, L"PhysX Scene 생성 에러", 0, 0 ); return NULL; } // 기본 재질 설정 NxMaterial* defaultMaterial = scene->getMaterialFromIndex( 0 ); defaultMaterial->setRestitution( 0.0f ); defaultMaterial->setStaticFriction( 0.4f ); defaultMaterial->setDynamicFriction( 0.2f ); NxMaterialDesc mDesc; mDesc.staticFriction = 1000.0f; mDesc.dynamicFriction = 1000.0f; mDesc.restitution = 0.f; scene->createMaterial( mDesc ); scene->setGroupCollisionFlag( ACTOR_GROUP_DEFAULT, ACTOR_GROUP_TEMPPLANE, FALSE ); scene->setGroupCollisionFlag( ACTOR_GROUP_DEFAULT, ACTOR_GROUP_BREAKINGCHIP, FALSE ); scene->setGroupCollisionFlag( ACTOR_GROUP_BREAKINGCHIP, ACTOR_GROUP_BREAKINGCHIP, FALSE ); // 이벤트 처리를 위한 user notify, contact report 등록 scene->setUserNotify( &m_PhysXUserNotify ); scene->setUserContactReport( &m_PhysXContactReport ); // 큐브 내부 6면 액터 생성 NxPlaneShapeDesc planeDesc; NxActorDesc actorDesc; planeDesc.normal = NxVec3( 0, 1, 0 ); planeDesc.d = 0; actorDesc.shapes.pushBack( &planeDesc ); scene->createActor( actorDesc ); return scene; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * \brief 객체 정리 함수 * \param VOID 없음 * \return 없음 */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// VOID CtPhysX::Exit( VOID ) { if(m_pPhysXSDK != NULL) { NxReleasePhysicsSDK(m_pPhysXSDK); m_pPhysXSDK = NULL; } } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * \brief 지정한 씬의 두 액터 사이에 고정 조인트를 생성하는 함수 * \param pScene 씬 포인터 * \param a0 액터1 포인터 * \param a1 액터2 포인터 * \return 생성한 조인트 포인터 */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// NxFixedJoint* CtPhysX::CreateFixedJoint( NxScene* pScene, NxActor* a0, NxActor* a1 ) { NxFixedJointDesc jointDesc; jointDesc.jointFlags |= NX_JPM_LINEAR_MINDIST; jointDesc.actor[0] = a0; jointDesc.actor[1] = a1; NxFixedJoint *joint = (NxFixedJoint*)pScene->createJoint(jointDesc); return joint; } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * \brief 박스 등 기본도형이 아닌 실제 메시의 액터를 생성하는 함수이다. * @param bScaling 액터를 생성할때 객체의 스케일 정보를 사용할 것인지 여부 * @warning PhysX 기본 도형 간 및 기본 도형과 TriangleMesh 액터 간의 충돌처리는 제대로 되나 TriangleMesh 간의 충돌처리는 완전하지 않다. 이것을 위해서는 Pmap을 사용하여야 한다. Pmap를 사용하려면 최초 1번은 메시 파일에 대한 Pmap 파일을 작성하여야 하며, 비용이 크다. 한번 Pmap 파일을 작성하였으면 다음부터는 그것을 불러들여 사용하면 되고 비용은 거의 들지 않는다. Pmap을 사용하더라도 TriangleMesh간의 충돌처리는 완전하지 않다. TriangleMesh가 실제 메시를 많이 단순화시키기 때문이다. Pmap의 하드웨어 지원은 아직 되지 않고 있다. * \param pObject CT객체 포인터 * \param bScaling TRUE이면 객체의 스케일 벡터에 따라 스케일링된 피직스 메시 생성, FALSE면 그대로 생성 */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// VOID CtPhysX::GenerateTriangleMesh( VOID* pObject, bool bScaling ) { CtObjectBase* pObj = (CtObjectBase*)pObject; LPD3DXMESH pMesh = pObj->GetDXUTMesh()->m_pMesh; DWORD NumVerticies = pMesh->GetNumVertices(); DWORD NumTriangles = pMesh->GetNumFaces(); NxVec3* verts = new NxVec3[NumVerticies]; WORD*pIndices = new WORD[NumTriangles*3]; FLOAT maxX = 0, maxY = 0, maxZ = 0; // 부피 추정을 위한 값들 BYTE* DXMeshPtr; pMesh->LockVertexBuffer(D3DLOCK_READONLY, (VOID**)&DXMeshPtr); ////////////////////////////////////////////////////////////////////////// // 버텍스 버퍼 채움 ////////////////////////////////////////////////////////////////////////// NxVec3 vScale = pObj->GetScale(); DWORD perByte = pMesh->GetNumBytesPerVertex(); for(DWORD i = 0; i < NumVerticies; i++) { MESHVERTEX *DXMeshFVF = (MESHVERTEX*)DXMeshPtr; verts[i] = NxVec3(DXMeshFVF->pos.x * vScale.x, DXMeshFVF->pos.y * vScale.y, DXMeshFVF->pos.z * vScale.z); if( maxX < verts[i].x ) maxX = verts[i].x; if( maxY < verts[i].y ) maxY = verts[i].y; if( maxZ < verts[i].z ) maxZ = verts[i].z; DXMeshPtr += perByte; } pMesh->UnlockVertexBuffer(); ////////////////////////////////////////////////////////////////////////// // 인덱스 버퍼 채움 ////////////////////////////////////////////////////////////////////////// WORD *pIB = 0; pMesh->LockIndexBuffer(D3DLOCK_READONLY, (VOID**)&pIB); memcpy( pIndices, pIB, sizeof(WORD)*NumTriangles*3 ); pMesh->UnlockIndexBuffer(); NxTriangleMeshDesc TriMeshDesc; TriMeshDesc.numVertices = NumVerticies; TriMeshDesc.numTriangles = NumTriangles; TriMeshDesc.pointStrideBytes = 3 * sizeof(float); TriMeshDesc.triangleStrideBytes = 3 * sizeof(WORD); TriMeshDesc.points = verts; TriMeshDesc.triangles = pIndices; TriMeshDesc.flags = NX_MF_16_BIT_INDICES; // 메모리 버퍼에 메시를 쿠킹 MemoryWriteBuffer buf; bool status = NxCookTriangleMesh(TriMeshDesc, buf); if( !status ) { MessageBox( 0, L"PhysX cooking failed!", 0, 0 ); if( verts ) delete[] verts; if( pIndices ) delete[] pIndices; return; } // 기존 메쉬와 액터를 삭제한다 NxActor* pActor = pObj->GetActor(); NxTriangleMesh* pActorMesh = pObj->GetActorMesh(); if( pActor ) pObj->GetParentCube()->GetScene()->releaseActor( *pActor ); if( pActorMesh ) m_pPhysXSDK->releaseTriangleMesh( *pActorMesh ); pActorMesh = m_pPhysXSDK->createTriangleMesh(MemoryReadBuffer(buf.data)); NxTriangleMeshShapeDesc ShapeDesc; // 바디 설정 NxBodyDesc bodyDesc; bodyDesc.angularDamping = 0.5f; bodyDesc.maxAngularVelocity = 1.f; bodyDesc.linearVelocity = NxVec3(0,0,0); // 액터 설정 NxActorDesc actorDesc; ShapeDesc.meshData = pActorMesh; actorDesc.shapes.pushBack(&ShapeDesc); actorDesc.body = &bodyDesc; actorDesc.density = 50.0f; if( bScaling ) actorDesc.globalPose = pObj->GetPose(); else actorDesc.globalPose.t = NxVec3( pObj->GetPose().t.x, pObj->GetPose().t.y, 0 ); // TriangleMesh 액터 생성 pObj->SetActor( pActor = pObj->GetParentCube()->GetScene()->createActor(actorDesc) ); pActor->userData = (VOID*)this; pActor->setMass( maxX * maxY * maxZ ); if( verts ) delete[] verts; if( pIndices ) delete[] pIndices; buf.clear(); } /*************************************************************************************************************************************************************/ /* 피직스 UserNotify를 위한 클래스 */ /*************************************************************************************************************************************************************/ CtPhysXUserNotify::CtPhysXUserNotify( void ) { } CtPhysXUserNotify::~CtPhysXUserNotify( void ) { } /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * \brief PhysX 객체 sleep 이벤트 핸들러 sleep 모드로 진입하는 객체가 있을 경우 발생하는 이벤트 핸들러 함수이다. CtObjectBase::OnSleep 함수로 연결시킨다 * \param **actors sleep 되는 액터들의 배열 * \param count 액터들의 수(배열 크기) * \return 없음 */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// VOID CtPhysXUserNotify::onSleep( NxActor **actors, NxU32 count ) { CtObjectBase* pObj; for( int i=0; i < count; i++ ) ((CtObjectBase*)actors[i]->userData)->OnSleep(); } /*************************************************************************************************************************************************************/ /* 피직스 UserContactReport를 위한 클래스 */ /*************************************************************************************************************************************************************/ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * \brief 객체 간 충돌 이벤트 발생시 호출되는 함수이다. 이 함수를 사용하여 다양한 충돌 이벤트 발생시에 UI의 기능으로 활용할 수 있다.(ex: 클립보드에 충돌->클립보드 추가, Pile에 충돌->Pile에 추가 등) * \param pair contact pair 객체. 충돌한 액터 및 기타 정보를 가진다 * \param events 발생 이벤트 정보. 터치 시작인지 중인지 끝인지 여부와 threshold 값등을 알려줌. SDK참고. * \return 없음 */ /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// VOID CtPhysXContactReport::onContactNotify( NxContactPair& pair, NxU32 events ) { CtObjectBase* pObj1 = (CtObjectBase*)pair.actors[0]->userData; CtObjectBase* pObj2 = (CtObjectBase*)pair.actors[1]->userData; ////////////////////////////////////////////////////////////////////////// // Pile과 칩 객체의 충돌시 ////////////////////////////////////////////////////////////////////////// if( !pObj1 || !pObj2 ) return;//|| pair.sumNormalForce.magnitude() < CONTACT_FORCE_THRESHOLD_ADDCHIP_TO_PILE ) return; bool bPile1, bPile2; bPile1 = pObj1->IsPiled(); bPile2 = pObj2->IsPiled(); // 둘중 하나만 piled인 경우만 해당 if( pObj1->IsChip() && pObj2->IsChip() && (bPile1 ^ bPile2) ) { CtObjectChip* pPile = bPile1 ? (CtObjectChip*)pObj1 : (CtObjectChip*)pObj2; CtObjectChip* pChip = bPile1 ? (CtObjectChip*)pObj2 : (CtObjectChip*)pObj1; if( !pChip->IsForced() ) return; NxMat34 matPose; NxActor* pActor1; NxActor* pActor2 = pChip->GetActor(); while( pPile->GetNext() ) pPile = pPile->GetNext(); pActor1 = pPile->GetActor(); // 포인터 연결 및 기타 설정 pChip->SetPileJointNext( NULL ); pPile->SetBoundaryOfPile( FALSE ); pChip->SetBoundaryOfPile( TRUE ); pChip->SetPileOrder( pPile->GetPileOrder() + 1 ); ////////////////////////////////////////////////////////////////////////// // 타겟 포즈를 구한다 ////////////////////////////////////////////////////////////////////////// matPose = pActor1->getGlobalPose(); NxVec3 vUp = matPose.M.getColumn( 1 ); vUp.normalize(); D3DXVECTOR3 vScale1 = pPile->GetScale(); D3DXVECTOR3 vScale2 = pChip->GetScale(); vUp *= ( (CHIP_THICKNESS * vScale1.z) / 2.f ) + ( (CHIP_THICKNESS * vScale2.z) / 2.f); matPose.t += vUp; pChip->SetCollisionGroup( ACTOR_GROUP_BREAKINGCHIP ); pActor2->raiseActorFlag( NX_AF_DISABLE_COLLISION ); pChip->RaiseStateFlag( OBJECT_STATE_PILED ); pChip->SetPoseTransition( matPose, pChip->GetScale(), 0.6f, 0.8f ); pChip->SetPrev( pPile ); pChip->SetNext( NULL ); pPile->SetNext( pChip ); pPile->GetActor()->setLinearVelocity( NxVec3(0,0,0) ); GetCTmain()->m_stStateFlags.bPilingAddModeDone = TRUE; } // 큐브에 충돌시 bool bCube1 = pObj1->IsCube(); bool bCube2 = pObj2->IsCube(); if( bCube1 || bCube2 ) { CtObjectCube* pCube = bCube1 ? (CtObjectCube*)pObj1 : (CtObjectCube*)pObj2; CtObjectChip* pChip = bCube1 ? (CtObjectChip*)pObj2 : (CtObjectChip*)pObj1; if( !pChip->IsForced() ) return; // 파일을 이동 CString newPath = pCube->GetFilePath(); newPath += L"\\" + pChip->GetFileInfo()->lpszFileName; MoveFile( pChip->GetFilePath(), newPath ); // 현재 큐브에서 해당 큐브로 객체 이동 GetCTmain()->MoveObject( pChip, GetCTmain()->m_pCurrentCube, pCube ); pCube->GetActor()->setLinearVelocity( NxVec3(0,0,0) ); } }
34.277512
159
0.490717
ca1773130n
22956c2e81ae51d0c6242c8b621d1af1d84506f4
3,022
cpp
C++
Source/ThirdParty/embree/kernels/bvh/bvh_intersector_stream_bvh4.cpp
vinhig/rbfx
884de45c623d591f346a2abd5e52edaa84bcc137
[ "MIT" ]
441
2018-12-26T14:50:23.000Z
2021-11-05T03:13:27.000Z
Source/ThirdParty/embree/kernels/bvh/bvh_intersector_stream_bvh4.cpp
vinhig/rbfx
884de45c623d591f346a2abd5e52edaa84bcc137
[ "MIT" ]
221
2018-12-29T17:40:23.000Z
2021-11-06T21:41:55.000Z
Source/ThirdParty/embree/kernels/bvh/bvh_intersector_stream_bvh4.cpp
vinhig/rbfx
884de45c623d591f346a2abd5e52edaa84bcc137
[ "MIT" ]
101
2018-12-29T13:08:10.000Z
2021-11-02T09:58:37.000Z
// Copyright 2009-2020 Intel Corporation // SPDX-License-Identifier: Apache-2.0 #include "bvh_intersector_stream.cpp" namespace embree { namespace isa { //////////////////////////////////////////////////////////////////////////////// /// General BVHIntersectorStreamPacketFallback Intersector //////////////////////////////////////////////////////////////////////////////// DEFINE_INTERSECTORN(BVH4IntersectorStreamPacketFallback,BVHNIntersectorStreamPacketFallback<SIMD_MODE(4)>); //////////////////////////////////////////////////////////////////////////////// /// BVH4IntersectorStream Definitions //////////////////////////////////////////////////////////////////////////////// IF_ENABLED_TRIS(DEFINE_INTERSECTORN(BVH4Triangle4iIntersectorStreamMoeller, BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA false COMMA Triangle4iIntersectorStreamMoeller<true>>)); IF_ENABLED_TRIS(DEFINE_INTERSECTORN(BVH4Triangle4vIntersectorStreamPluecker, BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA true COMMA Triangle4vIntersectorStreamPluecker<true>>)); IF_ENABLED_TRIS(DEFINE_INTERSECTORN(BVH4Triangle4iIntersectorStreamPluecker, BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA true COMMA Triangle4iIntersectorStreamPluecker<true>>)); IF_ENABLED_TRIS(DEFINE_INTERSECTORN(BVH4Triangle4IntersectorStreamMoeller, BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA false COMMA Triangle4IntersectorStreamMoeller<true>>)); IF_ENABLED_TRIS(DEFINE_INTERSECTORN(BVH4Triangle4IntersectorStreamMoellerNoFilter, BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA false COMMA Triangle4IntersectorStreamMoeller<false>>)); IF_ENABLED_QUADS(DEFINE_INTERSECTORN(BVH4Quad4vIntersectorStreamMoeller, BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA false COMMA Quad4vIntersectorStreamMoeller<true>>)); IF_ENABLED_QUADS(DEFINE_INTERSECTORN(BVH4Quad4vIntersectorStreamMoellerNoFilter,BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA false COMMA Quad4vIntersectorStreamMoeller<false>>)); IF_ENABLED_QUADS(DEFINE_INTERSECTORN(BVH4Quad4iIntersectorStreamMoeller, BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA false COMMA Quad4iIntersectorStreamMoeller<true>>)); IF_ENABLED_QUADS(DEFINE_INTERSECTORN(BVH4Quad4vIntersectorStreamPluecker, BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA true COMMA Quad4vIntersectorStreamPluecker<true>>)); IF_ENABLED_QUADS(DEFINE_INTERSECTORN(BVH4Quad4iIntersectorStreamPluecker, BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA true COMMA Quad4iIntersectorStreamPluecker<true>>)); IF_ENABLED_USER(DEFINE_INTERSECTORN(BVH4VirtualIntersectorStream,BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA false COMMA ObjectIntersectorStream>)); IF_ENABLED_INSTANCE(DEFINE_INTERSECTORN(BVH4InstanceIntersectorStream,BVHNIntersectorStream<SIMD_MODE(4) COMMA BVH_AN1 COMMA false COMMA InstanceIntersectorStream>)); } }
81.675676
199
0.747849
vinhig
2296489d805f3296218ed09ab0eef7438d470912
1,181
hpp
C++
include/NGGMergeOperator.hpp
NikolasGialitsis/NGramGraphParallel
26427e7ff39ba591a8c7eedd0ace458f1821a876
[ "Apache-2.0" ]
1
2021-09-17T08:51:55.000Z
2021-09-17T08:51:55.000Z
include/NGGMergeOperator.hpp
NikolasGialitsis/NGramGraphParallel
26427e7ff39ba591a8c7eedd0ace458f1821a876
[ "Apache-2.0" ]
1
2021-05-24T10:36:50.000Z
2021-05-24T10:36:50.000Z
include/NGGMergeOperator.hpp
NikolasGialitsis/NGramGraphParallel
26427e7ff39ba591a8c7eedd0ace458f1821a876
[ "Apache-2.0" ]
1
2021-05-09T16:00:52.000Z
2021-05-09T16:00:52.000Z
#ifndef NGGMERGEOPERATOR_H #define NGGMERGEOPERATOR_H #include "BinaryOperator.hpp" #include "NGGUpdateOperator.hpp" #include "NGramGraph.hpp" //TODO Add an NGGUpdateOperator object as a member field, and set it's operands in the apply(). /* * \class Implements the merge operator for NGramGraph objects. * The operator doesn't alter it's operands, but creates a new NGramGraph object to hold the result. */ class NGGMergeOperator : public BinaryOperator<NGramGraph, NGramGraph> { public: /* * Constructor * \param operand1 Pointer to the first NGramGraph operand. * \param operand2 Pointer to the second NGramGraph operand. */ NGGMergeOperator(NGramGraph *operand1, NGramGraph *operand2) : BinaryOperator(operand1, operand2) {} /* * Implementation of the merge operator. * \return The new merged NGramGraph object. */ NGramGraph apply() override; private: /* * Utility function to find the small and the big graph among the operands w.r.t. the number of edges. * \return A pair of NGramGraph pointers, in ascending order w.r.t. number of edges. */ std::pair<NGramGraph *, NGramGraph *> findSmallAndBigGraphs(); }; #endif // NGGMERGEOPERATOR_H
29.525
103
0.748518
NikolasGialitsis
229a78f7772aecb1f99d4f1a67c4c40bba56a308
2,610
cpp
C++
src/InputFileParser/AuxDataParser.cpp
dgoldri25/WaterPaths
08f098e5f8baf93bc25098aa450650a4632c7eb6
[ "Apache-2.0" ]
11
2018-07-30T01:47:55.000Z
2021-07-28T22:17:07.000Z
src/InputFileParser/AuxDataParser.cpp
bernardoct/RevampedTriangleModel
122116eb5b32efd35f4212f09511cd68528462be
[ "Apache-2.0" ]
26
2018-06-26T15:48:20.000Z
2021-01-12T15:48:59.000Z
src/InputFileParser/AuxDataParser.cpp
bernardoct/RevampedTriangleModel
122116eb5b32efd35f4212f09511cd68528462be
[ "Apache-2.0" ]
9
2018-12-08T02:47:39.000Z
2021-07-26T15:34:22.000Z
// // Created by bernardo on 11/27/19. // #include <algorithm> #include "AuxDataParser.h" #include "../Utils/Utils.h" #include "AuxParserFunctions.h" vector<vector<int>> AuxDataParser::parseReservoirUtilityConnectivityMatrix( vector<vector<string>> &block, const map<string, int> &ws_name_to_id, const map<string, int> &utility_name_to_id, const string &tag, int l) { for (auto line : block) { AuxParserFunctions::replaceNameById(block, tag, l, line[0], 1, ws_name_to_id); AuxParserFunctions::replaceNameById(block, tag, l, line[0], 0, utility_name_to_id); } vector<vector<int>> reservoir_utility_connectivity_matrix(block.size()); for (auto &line : block) { vector<int> utilitys_sources; Utils::tokenizeString(line[1], utilitys_sources, ','); reservoir_utility_connectivity_matrix[stoi(line[0])] = utilitys_sources; } return reservoir_utility_connectivity_matrix; } vector<vector<double>> AuxDataParser::tableStorageShiftParser(vector<vector<string>> &block, const map<string, int> &ws_name_to_id, const map<string, int> &utility_name_to_id, const string &tag, int l) { for (vector<string> &line : block) { try { line[0] = to_string(utility_name_to_id.at(line[0])); line[1] = to_string(ws_name_to_id.at(line[1])); } catch (const std::out_of_range &e) { char error[500]; sprintf(error, "Wrong name in %s in line %d. Are either %s or %s mispelled " "in either in storage shift table or in utility/water " "source?", tag.c_str(), l, line[0].c_str(), line[1].c_str() ); throw invalid_argument(error); } } try { vector<vector<double>> table_storage_shift( AuxParserFunctions::getMax(utility_name_to_id).second + 1, vector<double>( AuxParserFunctions::getMax(ws_name_to_id).second + 1, 0)); for (auto line : block) { vector<int> v = {stoi(line[0]), stoi(line[1])}; table_storage_shift[v[0]][v[1]] = stod(line[2]); } return table_storage_shift; } catch (...) { char error[128]; sprintf(error, "Something is wrong with %s in line %d", tag.c_str(), l); throw invalid_argument(error); } }
37.285714
82
0.560536
dgoldri25
229ac60f794443c7a788c4501ceb9f18de1e7ff9
8,201
cc
C++
gen_secondary_antiproton_source.cc
bjbuckman/galprop_bb_
076b168f7475b3ba9fb198b6ec2df7be66b1763c
[ "MIT" ]
null
null
null
gen_secondary_antiproton_source.cc
bjbuckman/galprop_bb_
076b168f7475b3ba9fb198b6ec2df7be66b1763c
[ "MIT" ]
null
null
null
gen_secondary_antiproton_source.cc
bjbuckman/galprop_bb_
076b168f7475b3ba9fb198b6ec2df7be66b1763c
[ "MIT" ]
null
null
null
//**.****|****.****|****.****|****.****|****.****|****.****|****.****|****.****| // * gen_secondary_antiproton_source.cc * galprop package * 2001/05/11 //**"****!****"****!****"****!****"****!****"****!****"****!****"****!****"****| //**"****!****"****!****"****!****"****!****"****!****"****!****"****!****"****| // The routine to calculate the antiproton source function. // // CR density gcr.cr_density is in c/4pi * n(E) [cm s^-1 sr^-1 cm^-3 MeV^-1] // // The routine ANTIPROTON written in FORTRAN-77 is designed to calculate // the antiproton (+antineutron) production spectrum vs. momentum (barn/GeV). // Antiproton momentum and nucleus momentum (GeV) per nucleon are used as input // parameters as well as beam and target nuclei atomic numbers. // // The antiproton source function [cm^-2 s^-2 sr^-1 MeV^-1] as used in galprop is // defined as following (c/4pi * q) [q = cm^-3 s^-1 MeV^-1]: // ___ ___ // c \ \ / c d sigma_ij(p,p') // q(p) * --- = c /__ n_i /__ \ dp' beta n_j(p') --- --------------- , // 4pi i=H,He j / 4pi dp // // where n_i is the gas density, d sigma_ij(p,p')/dp is // the production cross section, n_j(p') is the CR species density, // and p' is the total momentum of a nucleus. // Substitution of dp' with d(log Ekin) gives: // ___ ___ // c \ / \ c d sigma_ij(p,Ekin) // q(p)*--- = c A /__ n_i \ d(log Ekin) Ekin /__ n_j(Ekin) --- ----------------- // 4pi i=H,He / j 4pi dp // ___ ___ ___ // \ \ \ c d sigma_ij(p,Ekin) // = c A /\(log Ekin) /__ n_i /__ Ekin /__ n_j(Ekin) --- -----------------, // i=H,He Ekin j 4pi dp // // where /\=Delta, and we used dp'=1/beta A Ekin d(log Ekin). // // To transfer to units cm^2/MeV we need a factor= 1.0e-24 *1.0e-3. // Ref.: Moskalenko I.V. et al. 2002, ApJ 565, 280 //=="====!===="====!===="====!===="====!===="====!===="====!===="====!===="====! using namespace std;//AWS20050624 #include"galprop_classes.h" #include"galprop_internal.h" #include <fort_interface.h> #include <cstring> //**.****|****.****|****.****|****.****|****.****|****.****|****.****|****.****| int Galprop::gen_secondary_antiproton_source(Particle &particle) { if(galdef.verbose>=1) cout<<"gen_secondary_antiproton_source"<<endl; if(galdef.verbose>=1) cout<<"generating "<<particle.name<<" source function for n_spatial_dimensions=" <<gcr[0].n_spatial_dimensions<<endl; if(strcmp(particle.name,"secondary_antiprotons")!=0) { cout<<"invalid particle "<<particle.name<<endl; return 2; } int stat=0, iprotons=-1, iHelium =-1, Z1, A1, Z2, A2; float cs_p_HI, cs_p_He, cs_He_HI, cs_He_He; Distribution protons; // IMOS20000606.6 // identify CR protons // IMOS20000606.7 if(galdef.n_spatial_dimensions==2) protons.init(gcr[0].n_rgrid, gcr[0].n_zgrid, gcr[0].n_pgrid); if(galdef.n_spatial_dimensions==3) protons.init(gcr[0].n_xgrid, gcr[0].n_ygrid, gcr[0].n_zgrid, gcr[0].n_pgrid); protons=0.; for(int i=0; i<n_species; i++) if(101==100*gcr[i].Z+gcr[i].A) { iprotons=i; protons+=gcr[iprotons].cr_density; if(galdef.verbose>=1) cout<<" CR protons found as species #"<<iprotons<<endl; } if(iprotons==-1) { cout<<"CR protons not found!"<<endl; return 1; } // identify CR Helium for(int i=0; i<n_species; i++) if(204 == 100*gcr[i].Z+gcr[i].A) iHelium =i; if(iHelium ==-1) { cout<<"CR Helium not found!"<<endl; return 1; } else if(galdef.verbose>=1) cout<<" CR Helium found as species #"<<iHelium <<endl; //Gulli20070821 #pragma omp parallel for schedule(dynamic) default(shared) private(Z1,Z2,A1,A2,cs_p_HI,cs_He_HI,cs_p_He,cs_He_He) for(int ip_sec=0; ip_sec<particle.n_pgrid; ip_sec++) { for(int ip=0; ip<gcr[iprotons].n_pgrid; ip++) { Z1=gcr[iprotons].Z; A1=gcr[iprotons].A; Z2=1; A2=1; // beam+target: p+HI cs_p_HI =antiproton_cc(galdef.total_cross_section,particle.p[ip_sec]*1.e-3, gcr[iprotons].p[ip]*1.e-3, Z1,A1,Z2,A2); // IMOS20010511 IMOS20000601 // secondary_antiprotons =1 uses scaling to calc.; =2 uses factors by Simon et al. 1998 if(galdef.secondary_antiprotons == 2) { // IMOS20000802.2 cs_p_HI*=0.12/pow(particle.Ekin[ip_sec]/1000,1.67)+1.78; cs_He_HI = cs_p_He = cs_He_He = 0.; } else { Z1=gcr[iprotons].Z; A1=gcr[iprotons].A; Z2=2; A2=4; // beam+target: p+He cs_p_He =antiproton_cc(galdef.total_cross_section,particle.p[ip_sec]*1.e-3, gcr[iprotons].p[ip]*1.e-3, Z1,A1,Z2,A2); // IMOS20010511 IMOS20000601 Z1=gcr[iHelium ].Z; A1=gcr[iHelium ].A; Z2=1; A2=1; // beam+target: He+HI cs_He_HI=antiproton_cc(galdef.total_cross_section,particle.p[ip_sec]*1.e-3, gcr[iHelium ].p[ip]*1.e-3, Z1,A1,Z2,A2); // IMOS20010511 IMOS20000601 Z1=gcr[iHelium ].Z; A1=gcr[iHelium ].A; Z2=2; A2=4; // beam+target: He+He cs_He_He=antiproton_cc(galdef.total_cross_section,particle.p[ip_sec]*1.e-3, gcr[iHelium ].p[ip]*1.e-3, Z1,A1,Z2,A2); // IMOS20010511 IMOS20000601 } if(galaxy.n_spatial_dimensions==2) { for(int ir=0; ir<gcr[iprotons].n_rgrid; ir++) { for(int iz=0; iz<gcr[iprotons].n_zgrid; iz++) { particle.secondary_source_function.d2[ir][iz].s[ip_sec ]+= (galaxy.n_HI.d2[ir][iz].s[0]+2.0*galaxy.n_H2.d2[ir][iz].s[0]+galaxy.n_HII.d2[ir][iz].s[0]) *( (cs_p_HI +cs_p_He *galdef.He_H_ratio) *protons.d2[ir][iz].s[ip] *gcr[iprotons].Ekin[ip] // IMOS20000606.8 +(cs_He_HI +cs_He_He*galdef.He_H_ratio) *gcr[iHelium ].cr_density.d2[ir][iz].s[ip] *gcr[iHelium ].Ekin[ip] *gcr[iHelium].A ); } // iz } // ir } // particle.n_spatial_dimensions==2 if(galaxy.n_spatial_dimensions==3) { for(int ix=0; ix<gcr[iprotons].n_xgrid; ix++) { for(int iy=0; iy<gcr[iprotons].n_ygrid; iy++) { for(int iz=0; iz<gcr[iprotons].n_zgrid; iz++) { particle.secondary_source_function.d3[ix][iy][iz].s[ip_sec ]+= (galaxy.n_HI.d3[ix][iy][iz].s[0]+2.0*galaxy.n_H2.d3[ix][iy][iz].s[0]+galaxy.n_HII.d3[ix][iy][iz].s[0]) *( (cs_p_HI +cs_p_He *galdef.He_H_ratio) *protons.d3[ix][iy][iz].s[ip] *gcr[iprotons].Ekin[ip] // IMOS20000606.9 +(cs_He_HI +cs_He_He*galdef.He_H_ratio) *gcr[iHelium ].cr_density.d3[ix][iy][iz].s[ip] *gcr[iHelium ].Ekin[ip] *gcr[iHelium].A ); } // iz } // iy } // ix } // particle.n_spatial_dimensions==3 } // ip } // ip_sec double factor=1.e-24 *1.e-3 *C *log(galdef.Ekin_factor); // transformation to cm2/MeV and constant factors particle.secondary_source_function *= factor; protons.delete_array(); // IMOS20000606.10 if(galdef.verbose>=2) { cout<<" particle.secondary_source_function for "<<particle.name<<endl; particle.secondary_source_function.print(); } if(galdef.verbose>=1) cout<<" <<<< gen_secondary_antiproton_source"<<endl; return stat; }
50.006098
161
0.501524
bjbuckman
229bd1555a21376df233101267fa45a6458335b0
742
hpp
C++
boost/sequence/traits/size_type.hpp
ericniebler/time_series
4040119366cc21f25c7734bb355e4a647296a96d
[ "BSL-1.0" ]
11
2015-02-21T11:23:44.000Z
2021-08-15T03:39:29.000Z
boost/sequence/traits/size_type.hpp
ericniebler/time_series
4040119366cc21f25c7734bb355e4a647296a96d
[ "BSL-1.0" ]
null
null
null
boost/sequence/traits/size_type.hpp
ericniebler/time_series
4040119366cc21f25c7734bb355e4a647296a96d
[ "BSL-1.0" ]
3
2015-05-09T02:25:42.000Z
2019-11-02T13:39:29.000Z
// Copyright David Abrahams 2006. Distributed under the Boost // Software License, Version 1.0. (See accompanying // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) #ifndef BOOST_SEQUENCE_TRAITS_SIZE_TYPE_DWA200658_HPP # define BOOST_SEQUENCE_TRAITS_SIZE_TYPE_DWA200658_HPP # include <boost/utility/result_of.hpp> # include <boost/sequence/size.hpp> # include <boost/type_traits/add_reference.hpp> namespace boost { namespace sequence { namespace traits { // Don't specialize this. template<typename S> struct size_type : result_of< op::size(typename add_reference<S>::type) > {}; }}} // namespace boost::sequence::traits #endif // BOOST_SEQUENCE_TRAITS_SIZE_TYPE_DWA200658_HPP
30.916667
73
0.752022
ericniebler
229e2ab063f6b8b391d4ea89f759e538bc49d474
2,823
hpp
C++
src/libs/io/binary_output_stream.hpp
jdmclark/gorc
a03d6a38ab7684860c418dd3d2e77cbe6a6d9fc8
[ "Apache-2.0" ]
97
2015-02-24T05:09:24.000Z
2022-01-23T12:08:22.000Z
src/libs/io/binary_output_stream.hpp
annnoo/gorc
1889b4de6380c30af6c58a8af60ecd9c816db91d
[ "Apache-2.0" ]
8
2015-03-27T23:03:23.000Z
2020-12-21T02:34:33.000Z
src/libs/io/binary_output_stream.hpp
annnoo/gorc
1889b4de6380c30af6c58a8af60ecd9c816db91d
[ "Apache-2.0" ]
10
2016-03-24T14:32:50.000Z
2021-11-13T02:38:53.000Z
#pragma once #include <type_traits> #include <string> #include "output_stream.hpp" #include "utility/service_registry.hpp" #include "utility/time.hpp" #include "utility/flag_set.hpp" namespace gorc { class binary_output_stream : public output_stream { private: output_stream &stream; public: service_registry const &services; explicit binary_output_stream(output_stream &stream); binary_output_stream(output_stream &stream, service_registry const &services); template <typename T> typename std::enable_if<std::is_fundamental<T>::value, void>::type write_value(T &out) { stream.write(&out, sizeof(T)); } void write_string(std::string const &str); virtual size_t write_some(void const *src, size_t size) override; }; template <typename T> typename std::enable_if<std::is_fundamental<T>::value, void>::type binary_serialize(binary_output_stream &os, T const &value) { os.write_value(value); } template <typename T> typename std::enable_if<std::is_same<std::string, T>::value, void>::type binary_serialize(binary_output_stream &os, T const &value) { os.write_string(value); } template <typename T> auto binary_serialize(binary_output_stream &os, T const &value) -> typename std::conditional<true, void, decltype(value.binary_serialize_object(os))>::type { value.binary_serialize_object(os); } template <typename T> typename std::enable_if<std::is_enum<T>::value, void>::type binary_serialize(binary_output_stream &os, T const &value) { binary_serialize(os, static_cast<typename std::underlying_type<T>::type>(value)); } template <typename T> typename std::enable_if<std::is_same<time_delta, T>::value, void>::type binary_serialize(binary_output_stream &os, T const &value) { binary_serialize<double>(os, value.count()); } template <typename U> typename std::enable_if<std::is_enum<U>::value, void>::type binary_serialize(binary_output_stream &os, flag_set<U> const &value) { binary_serialize(os, static_cast<U>(value)); } template <typename RangeT, typename FmtFnT> void binary_serialize_range(binary_output_stream &os, RangeT const &rng, FmtFnT fn) { binary_serialize<size_t>(os, rng.size()); for(auto const &em : rng) { fn(os, em); } } template <typename RangeT> void binary_serialize_range(binary_output_stream &os, RangeT const &rng) { binary_serialize<size_t>(os, rng.size()); for(auto const &em : rng) { binary_serialize(os, em); } } }
29.40625
99
0.639391
jdmclark
22a1e69931c23ffe346ef76c330301268dc9137c
669
hpp
C++
asyncnet.hpp
Chingyat/asyncnet
e012b64fcf38c9fba15dee52e467d98772926b81
[ "MIT" ]
null
null
null
asyncnet.hpp
Chingyat/asyncnet
e012b64fcf38c9fba15dee52e467d98772926b81
[ "MIT" ]
null
null
null
asyncnet.hpp
Chingyat/asyncnet
e012b64fcf38c9fba15dee52e467d98772926b81
[ "MIT" ]
1
2020-11-10T05:33:25.000Z
2020-11-10T05:33:25.000Z
// // Created by lince on 11/6/20. // #ifndef ASYNCNET_HPP #define ASYNCNET_HPP #include <asyncnet/associated_allocator.hpp> #include <asyncnet/associated_executor.hpp> #include <asyncnet/async_completion.hpp> #include <asyncnet/async_result.hpp> #include <asyncnet/defer.hpp> #include <asyncnet/dispatch.hpp> #include <asyncnet/execution_context.hpp> #include <asyncnet/executor.hpp> #include <asyncnet/executor_binder.hpp> #include <asyncnet/executor_work_guard.hpp> #include <asyncnet/io_context.hpp> #include <asyncnet/post.hpp> #include <asyncnet/service.hpp> #include <asyncnet/system_context.hpp> #include <asyncnet/system_executor.hpp> #endif// ASYNCNET_HPP
26.76
44
0.796712
Chingyat
22a3a012de375dda73818b93c8777d79f20248d9
10,125
cpp
C++
CrystalCavern/Plugins/VRM4U/Source/VRM4U/Private/VrmUtil.cpp
NikkoBertoa/test
6e27eb89ae8fddb41535a73617704cb1c8f6e125
[ "Apache-2.0" ]
null
null
null
CrystalCavern/Plugins/VRM4U/Source/VRM4U/Private/VrmUtil.cpp
NikkoBertoa/test
6e27eb89ae8fddb41535a73617704cb1c8f6e125
[ "Apache-2.0" ]
null
null
null
CrystalCavern/Plugins/VRM4U/Source/VRM4U/Private/VrmUtil.cpp
NikkoBertoa/test
6e27eb89ae8fddb41535a73617704cb1c8f6e125
[ "Apache-2.0" ]
null
null
null
// VRM4U Copyright (c) 2019 Haruyoshi Yamamoto. This software is released under the MIT License. #pragma once #include "VrmUtil.h" #include "CoreMinimal.h" #include "UObject/ObjectMacros.h" void FImportOptionData::init() { } const TArray<VRMUtil::VRMBoneTable> VRMUtil::table_ue4_vrm = { {"Root",""}, {"Pelvis","hips"}, {"spine_01","spine"}, {"spine_02","chest"}, {"spine_03","upperChest"}, {"clavicle_l","leftShoulder"}, {"UpperArm_L","leftUpperArm"}, {"lowerarm_l","leftLowerArm"}, {"Hand_L","leftHand"}, {"index_01_l","leftIndexProximal"}, {"index_02_l","leftIndexIntermediate"}, {"index_03_l","leftIndexDistal"}, {"middle_01_l","leftMiddleProximal"}, {"middle_02_l","leftMiddleIntermediate"}, {"middle_03_l","leftMiddleDistal"}, {"pinky_01_l","leftLittleProximal"}, {"pinky_02_l","leftLittleIntermediate"}, {"pinky_03_l","leftLittleDistal"}, {"ring_01_l","leftRingProximal"}, {"ring_02_l","leftRingIntermediate"}, {"ring_03_l","leftRingDistal"}, {"thumb_01_l","leftThumbProximal"}, {"thumb_02_l","leftThumbIntermediate"}, {"thumb_03_l","leftThumbDistal"}, {"lowerarm_twist_01_l",""}, {"upperarm_twist_01_l",""}, {"clavicle_r","rightShoulder"}, {"UpperArm_R","rightUpperArm"}, {"lowerarm_r","rightLowerArm"}, {"Hand_R","rightHand"}, {"index_01_r","rightIndexProximal"}, {"index_02_r","rightIndexIntermediate"}, {"index_03_r","rightIndexDistal"}, {"middle_01_r","rightMiddleProximal"}, {"middle_02_r","rightMiddleIntermediate"}, {"middle_03_r","rightMiddleDistal"}, {"pinky_01_r","rightLittleProximal"}, {"pinky_02_r","rightLittleIntermediate"}, {"pinky_03_r","rightLittleDistal"}, {"ring_01_r","rightRingProximal"}, {"ring_02_r","rightRingIntermediate"}, {"ring_03_r","rightRingDistal"}, {"thumb_01_r","rightThumbProximal"}, {"thumb_02_r","rightThumbIntermediate"}, {"thumb_03_r","rightThumbDistal"}, {"lowerarm_twist_01_r",""}, {"upperarm_twist_01_r",""}, {"neck_01","neck"}, {"head","head"}, {"Thigh_L","leftUpperLeg"}, {"calf_l","leftLowerLeg"}, {"calf_twist_01_l",""}, {"Foot_L","leftFoot"}, {"ball_l","leftToes"}, {"thigh_twist_01_l",""}, {"Thigh_R","rightUpperLeg"}, {"calf_r","rightLowerLeg"}, {"calf_twist_01_r",""}, {"Foot_R","rightFoot"}, {"ball_r","rightToes"}, {"thigh_twist_01_r",""}, {"ik_foot_root",""}, {"ik_foot_l",""}, {"ik_foot_r",""}, {"ik_hand_root",""}, {"ik_hand_gun",""}, {"ik_hand_l",""}, {"ik_hand_r",""}, {"Custom_1",""}, {"Custom_2",""}, {"Custom_3",""}, {"Custom_4",""}, {"Custom_5",""}, }; const TArray<VRMUtil::VRMBoneTable> VRMUtil::table_ue4_pmx = { {"Root",TEXT("全ての親")}, {"Pelvis",TEXT("センター")}, {"spine_01",TEXT("上半身")}, {"spine_02",TEXT("上半身")}, {"spine_03",TEXT("上半身2")}, {"clavicle_l",TEXT("左肩")}, {"UpperArm_L",TEXT("左腕")}, {"lowerarm_l",TEXT("左ひじ")}, {"Hand_L",TEXT("左手首")}, {"index_01_l",TEXT("左人指1")}, {"index_02_l",TEXT("左人指2")}, {"index_03_l",TEXT("左人指3")}, {"middle_01_l",TEXT("左中指1")}, {"middle_02_l",TEXT("左中指2")}, {"middle_03_l",TEXT("左中指3")}, {"pinky_01_l",TEXT("左小指1")}, {"pinky_02_l",TEXT("左小指2")}, {"pinky_03_l",TEXT("左小指3")}, {"ring_01_l",TEXT("左薬指1")}, {"ring_02_l",TEXT("左薬指2")}, {"ring_03_l",TEXT("左薬指3")}, {"thumb_01_l",TEXT("左親指1")}, {"thumb_02_l",TEXT("左親指1")}, {"thumb_03_l",TEXT("左親指2")}, {"lowerarm_twist_01_l",TEXT("")}, {"upperarm_twist_01_l",TEXT("")}, {"clavicle_r",TEXT("右肩")}, {"UpperArm_R",TEXT("右腕")}, {"lowerarm_r",TEXT("右ひじ")}, {"Hand_R",TEXT("右手首")}, {"index_01_r",TEXT("右人指1")}, {"index_02_r",TEXT("右人指2")}, {"index_03_r",TEXT("右人指3")}, {"middle_01_r",TEXT("右中指1")}, {"middle_02_r",TEXT("右中指2")}, {"middle_03_r",TEXT("右中指3")}, {"pinky_01_r",TEXT("右小指1")}, {"pinky_02_r",TEXT("右小指2")}, {"pinky_03_r",TEXT("右小指3")}, {"ring_01_r",TEXT("右薬指1")}, {"ring_02_r",TEXT("右薬指2")}, {"ring_03_r",TEXT("右薬指3")}, {"thumb_01_r",TEXT("右親指1")}, {"thumb_02_r",TEXT("右親指1")}, {"thumb_03_r",TEXT("右親指2")}, {"lowerarm_twist_01_r",TEXT("")}, {"upperarm_twist_01_r",TEXT("")}, {"neck_01",TEXT("首")}, {"head",TEXT("頭")}, {"Thigh_L",TEXT("左足")}, {"calf_l",TEXT("左ひざ")}, {"calf_twist_01_l",TEXT("")}, {"Foot_L",TEXT("左足首")}, {"ball_l",TEXT("左つま先")}, {"thigh_twist_01_l",TEXT("")}, {"Thigh_R",TEXT("右足")}, {"calf_r",TEXT("右ひざ")}, {"calf_twist_01_r",TEXT("")}, {"Foot_R",TEXT("右足首")}, {"ball_r",TEXT("右つま先")}, {"thigh_twist_01_r",TEXT("")}, {"ik_foot_root",TEXT("")}, {"ik_foot_l",TEXT("")}, {"ik_foot_r",TEXT("")}, {"ik_hand_root",TEXT("")}, {"ik_hand_gun",TEXT("")}, {"ik_hand_l",TEXT("")}, {"ik_hand_r",TEXT("")}, {"Custom_1",TEXT("")}, {"Custom_2",TEXT("")}, {"Custom_3",TEXT("")}, {"Custom_4",TEXT("")}, {"Custom_5",TEXT("")}, }; const TArray<FString> VRMUtil::vrm_humanoid_bone_list = { "hips", "leftUpperLeg", "rightUpperLeg", "leftLowerLeg", "rightLowerLeg", "leftFoot", "rightFoot", "spine", "chest", "neck", "head", "leftShoulder", "rightShoulder", "leftUpperArm", "rightUpperArm", "leftLowerArm", "rightLowerArm", "leftHand", "rightHand", "leftToes", "rightToes", "leftEye", "rightEye", "jaw", "leftThumbProximal", "leftThumbIntermediate", "leftThumbDistal", "leftIndexProximal", "leftIndexIntermediate", "leftIndexDistal", "leftMiddleProximal", "leftMiddleIntermediate", "leftMiddleDistal", "leftRingProximal", "leftRingIntermediate", "leftRingDistal", "leftLittleProximal", "leftLittleIntermediate", "leftLittleDistal", "rightThumbProximal", "rightThumbIntermediate", "rightThumbDistal", "rightIndexProximal", "rightIndexIntermediate", "rightIndexDistal", "rightMiddleProximal", "rightMiddleIntermediate", "rightMiddleDistal", "rightRingProximal", "rightRingIntermediate", "rightRingDistal", "rightLittleProximal", "rightLittleIntermediate", "rightLittleDistal", "upperChest" }; const TArray<FName> VRMUtil::vrm_humanoid_bone_list_name = { "hips", "leftUpperLeg", "rightUpperLeg", "leftLowerLeg", "rightLowerLeg", "leftFoot", "rightFoot", "spine", "chest", "neck", "head", "leftShoulder", "rightShoulder", "leftUpperArm", "rightUpperArm", "leftLowerArm", "rightLowerArm", "leftHand", "rightHand", "leftToes", "rightToes", "leftEye", "rightEye", "jaw", "leftThumbProximal", // 24 "leftThumbIntermediate", "leftThumbDistal", "leftIndexProximal", "leftIndexIntermediate", "leftIndexDistal", "leftMiddleProximal", "leftMiddleIntermediate", "leftMiddleDistal", "leftRingProximal", "leftRingIntermediate", "leftRingDistal", "leftLittleProximal", "leftLittleIntermediate", "leftLittleDistal", "rightThumbProximal", "rightThumbIntermediate", "rightThumbDistal", "rightIndexProximal", "rightIndexIntermediate", "rightIndexDistal", "rightMiddleProximal", "rightMiddleIntermediate", "rightMiddleDistal", "rightRingProximal", "rightRingIntermediate", "rightRingDistal", "rightLittleProximal", "rightLittleIntermediate", "rightLittleDistal", "upperChest" }; const TArray<FString> VRMUtil::vrm_humanoid_parent_list = { "", //"hips", "hips",//"leftUpperLeg", "hips",//"rightUpperLeg", "leftUpperLeg",//"leftLowerLeg", "rightUpperLeg",//"rightLowerLeg", "leftLowerLeg",//"leftFoot", "rightLowerLeg",//"rightFoot", "hips",//"spine", "spine",//"chest", "chest",//"neck", "neck",//"head", "chest",//"leftShoulder", // <-- upper.. "chest",//"rightShoulder", "leftShoulder",//"leftUpperArm", "rightShoulder",//"rightUpperArm", "leftUpperArm",//"leftLowerArm", "rightUpperArm",//"rightLowerArm", "leftLowerArm",//"leftHand", "rightLowerArm",//"rightHand", "leftLowerLeg",//"leftToes", "rightLowerLeg",//"rightToes", "head",//"leftEye", "head",//"rightEye", "head",//"jaw", "leftHand",//"leftThumbProximal", "leftThumbProximal",//"leftThumbIntermediate", "leftThumbIntermediate",//"leftThumbDistal", "leftHand",//"leftIndexProximal", "leftIndexProximal",//"leftIndexIntermediate", "leftIndexIntermediate",//"leftIndexDistal", "leftHand",//"leftMiddleProximal", "leftMiddleProximal",//"leftMiddleIntermediate", "leftMiddleIntermediate",//"leftMiddleDistal", "leftHand",//"leftRingProximal", "leftRingProximal",//"leftRingIntermediate", "leftRingIntermediate",//"leftRingDistal", "leftHand",//"leftLittleProximal", "leftLittleProximal",//"leftLittleIntermediate", "leftLittleIntermediate",//"leftLittleDistal", "rightHand",//"rightThumbProximal", "rightThumbProximal",//"rightThumbIntermediate", "rightThumbIntermediate",//"rightThumbDistal", "rightHand",//"rightIndexProximal", "rightIndexProximal",//"rightIndexIntermediate", "rightIndexIntermediate",//"rightIndexDistal", "rightHand",//"rightMiddleProximal", "rightMiddleProximal",//"rightMiddleIntermediate", "rightMiddleIntermediate",//"rightMiddleDistal", "rightHand",//"rightRingProximal", "rightRingProximal",//"rightRingIntermediate", "rightRingIntermediate",//"rightRingDistal", "rightHand",//"rightLittleProximal", "rightLittleProximal",//"rightLittleIntermediate", "rightLittleIntermediate",//"rightLittleDistal", "chest",//"upperChest" }; // const TArray<FString> VRMUtil::ue4_humanoid_bone_list = { "Root", "Pelvis", "spine_01", "spine_02", "spine_03", "clavicle_l", "UpperArm_L", "lowerarm_l", "Hand_L","leftHand", "index_01_l", "index_02_l", "index_03_l", "middle_01_l", "middle_02_l", "middle_03_l", "pinky_01_l", "pinky_02_l", "pinky_03_l", "ring_01_l", "ring_02_l", "ring_03_l", "thumb_01_l", "thumb_02_l", "thumb_03_l", "lowerarm_twist_01_l", "upperarm_twist_01_l", "clavicle_r", "UpperArm_R", "lowerarm_r", "Hand_R", "index_01_r", "index_02_r", "index_03_r", "middle_01_r", "middle_02_r", "middle_03_r", "pinky_01_r", "pinky_02_r", "pinky_03_r", "ring_01_r", "ring_02_r", "ring_03_r", "thumb_01_r", "thumb_02_r", "thumb_03_r", "lowerarm_twist_01_r", "upperarm_twist_01_r", "neck_01", "head", "Thigh_L", "calf_l", "calf_twist_01_l", "Foot_L", "ball_l", "thigh_twist_01_l", "Thigh_R", "calf_r", "calf_twist_01_r", "Foot_R", "ball_r", "thigh_twist_01_r", "ik_foot_root", "ik_foot_l", "ik_foot_r", "ik_hand_root", "ik_hand_gun", "ik_hand_l", "ik_hand_r", "Custom_1", "Custom_2", "Custom_3", "Custom_4", "Custom_5", };
24.049881
97
0.679111
NikkoBertoa
22a7bd433656a096e6e21118b963d5287106c662
433
cpp
C++
src/atta/uiSystem/layers/editor/windows/logWindow.cpp
brenocq/atta
dc0f3429c26be9b0a340e63076f00f996e9282cc
[ "MIT" ]
5
2021-11-18T02:44:45.000Z
2021-12-21T17:46:10.000Z
src/atta/uiSystem/layers/editor/windows/logWindow.cpp
Brenocq/RobotSimulator
dc0f3429c26be9b0a340e63076f00f996e9282cc
[ "MIT" ]
1
2021-11-18T02:56:14.000Z
2021-12-04T15:09:16.000Z
src/atta/uiSystem/layers/editor/windows/logWindow.cpp
Brenocq/RobotSimulator
dc0f3429c26be9b0a340e63076f00f996e9282cc
[ "MIT" ]
3
2020-09-10T07:17:00.000Z
2020-11-05T10:24:41.000Z
//-------------------------------------------------- // Atta UI System // logWindow.cpp // Date: 2021-12-28 // By Breno Cunha Queiroz //-------------------------------------------------- #include <atta/uiSystem/layers/editor/windows/logWindow.h> #include <imgui.h> namespace atta::ui { void LogWindow::render() { ImGui::Begin("Log"); ImGui::Text("Logging not implemented yet"); ImGui::End(); } }
22.789474
58
0.471132
brenocq
22a81895bc47a1df94e35679c5d89285e4847a96
1,332
cpp
C++
CSE 225L Data Structures and Algorithms/Resources/Codes Previous/Spring-2019-CSE225 1/Lab 14 ( Recursion)/main(2).cpp
diptu/Teaching
20655bb2c688ae29566b0a914df4a3e5936a2f61
[ "MIT" ]
null
null
null
CSE 225L Data Structures and Algorithms/Resources/Codes Previous/Spring-2019-CSE225 1/Lab 14 ( Recursion)/main(2).cpp
diptu/Teaching
20655bb2c688ae29566b0a914df4a3e5936a2f61
[ "MIT" ]
null
null
null
CSE 225L Data Structures and Algorithms/Resources/Codes Previous/Spring-2019-CSE225 1/Lab 14 ( Recursion)/main(2).cpp
diptu/Teaching
20655bb2c688ae29566b0a914df4a3e5936a2f61
[ "MIT" ]
null
null
null
#include<iostream> using namespace std; int fibonacci(int n) { if((n==1)||(n==0)) { return(n); } else { return(fibonacci(n-1)+fibonacci(n-2)); } } int factorial(int n) { if(n==1) return 1; else return n*factorial (n-1); } int add(int n) { if(n != 0) return n + add(n - 1); return 0; } int findmin(const int a[], int n) { if(n == 0) return a[0]; else { if(a[n-1] < findmin(a,(n-1))) return a[n-1]; else return findmin(a,(n-1)); } } int find(int decimal_number) { if (decimal_number == 0) return 0; else return (decimal_number % 2 + 10 *find(decimal_number / 2)); } float sumSeries(int n) if(n==0) return 1; else return( sumSeries(1/pow(2,n)))+sumSeris(1/pow(2/(n-1))))) int main() { int n,i=0; int A[5]={2,3,1,6,9}; int decimal_number = 10; cout<<"Input the number of terms for Fibonacci Series:"; cin>>n; cout<<"\nFibonacci Series is as follows\n"; while(i<n) { cout<<" "<<fibonacci(i); i++; } cout<<"factorial of"<<n<<factorial(n); cout<<"Sum of"<<n <<" is" <<add(n); cout<<"Minimum number is A is "<<findmin(A,5); cout<<find(decimal_number); cout<<(Sumofseries); return 0; }
14.021053
67
0.511261
diptu
22ac6edc23e3ee23a1513a485413b9f292131d90
27,483
cc
C++
src/messages.cc
qian-long/TileDB-multinode
ba2a38b2cc6169935c73b76af8c53e8544c11300
[ "MIT" ]
null
null
null
src/messages.cc
qian-long/TileDB-multinode
ba2a38b2cc6169935c73b76af8c53e8544c11300
[ "MIT" ]
null
null
null
src/messages.cc
qian-long/TileDB-multinode
ba2a38b2cc6169935c73b76af8c53e8544c11300
[ "MIT" ]
null
null
null
#include "messages.h" #include <assert.h> #include <cstring> #include <functional> #include "debug.h" /****************************************************** *********************** MESSAGE ********************** ******************************************************/ std::pair<char*, uint64_t> Msg::serialize() { throw MessageException("Bad function call"); } Msg* deserialize_msg(int type, char* buf, uint64_t length){ switch(type){ case GET_TAG: return GetMsg::deserialize(buf, length); case DEFINE_ARRAY_TAG: return DefineArrayMsg::deserialize(buf, length); case LOAD_TAG: return LoadMsg::deserialize(buf, length); case SUBARRAY_TAG: return SubarrayMsg::deserialize(buf, length); case FILTER_TAG: return FilterMsg::deserialize(buf, length); case AGGREGATE_TAG: return AggregateMsg::deserialize(buf, length); case PARALLEL_LOAD_TAG: return ParallelLoadMsg::deserialize(buf, length); case JOIN_TAG: return JoinMsg::deserialize(buf, length); case ACK_TAG: return AckMsg::deserialize(buf, length); } throw MessageException("trying to deserailze msg of unknown type"); } /****************************************************** ******************* SubArray MESSAGE ***************** ******************************************************/ SubarrayMsg::SubarrayMsg(std::string result_name, ArraySchema schema, std::vector<double> ranges) : Msg(SUBARRAY_TAG) { result_array_name_ = result_name; ranges_ = ranges; array_schema_ = schema; } std::pair<char*, uint64_t> SubarrayMsg::serialize() { uint64_t buffer_size = 0, pos = 0; char* buffer; uint64_t length; // serialize relevant sub components std::pair<char*, uint64_t> as_pair = array_schema_.serialize(); // calculating buffer_size buffer_size += sizeof(size_t); // result arrayname length buffer_size += result_array_name_.size(); // result_arrayname buffer_size += sizeof(uint64_t); // array schema length buffer_size += as_pair.second; // array schema buffer_size += ranges_.size(); // ranges length for (int i = 0; i < ranges_.size(); ++i) { buffer_size += sizeof(double); // add each range part } // creating buffer buffer = new char[buffer_size]; // serialize filename length = result_array_name_.size(); memcpy(&buffer[pos], &length, sizeof(size_t)); pos += sizeof(size_t); memcpy(&buffer[pos], result_array_name_.c_str(), length); pos += length; // serialize array schema length = as_pair.second; memcpy(&buffer[pos], &length, sizeof(size_t)); pos += sizeof(size_t); memcpy(&buffer[pos], as_pair.first, length); pos += length; // serialize ranges length = ranges_.size(); memcpy(&buffer[pos], &length, sizeof(size_t)); pos += sizeof(size_t); std::vector<double>::iterator it = ranges_.begin(); for (; it != ranges_.end(); it++, pos += sizeof(double)) { double extent = *it; memcpy(&buffer[pos], &extent, sizeof(double)); } return std::pair<char*, uint64_t>(buffer, buffer_size); } SubarrayMsg* SubarrayMsg::deserialize(char* buffer, uint64_t buffer_length){ uint64_t counter = 0; std::stringstream ss; std::vector<double> ranges; // deserialize array name size_t filename_length; memcpy(&filename_length, &buffer[counter], sizeof(size_t)); counter += sizeof(size_t); ss.write(&buffer[counter], filename_length); std::string array_name = ss.str(); // first arg counter += filename_length; //deserailize schema uint64_t arrayschema_length; memcpy(&arrayschema_length, &buffer[counter], sizeof(uint64_t)); counter += sizeof(uint64_t); ArraySchema* schema = new ArraySchema(); schema->deserialize(&buffer[counter], arrayschema_length); counter += arrayschema_length; //deserialize vector size_t num_doubles; memcpy(&num_doubles, &buffer[counter], sizeof(size_t)); counter += sizeof(size_t); for (size_t i = 0; i < num_doubles; i++) { double extent; memcpy(&extent, &buffer[counter], sizeof(double)); ranges.push_back(extent); counter += sizeof(double); } return new SubarrayMsg(array_name, *schema, ranges); } /****************************************************** ********************* LOAD MESSAGE ******************* ******************************************************/ LoadMsg::LoadMsg() : Msg(LOAD_TAG) { } LoadMsg::LoadMsg(const std::string filename, ArraySchema& array_schema, PartitionType type, LoadMethod method, uint64_t num_samples) :Msg(LOAD_TAG) { filename_ = filename; array_schema_ = array_schema; type_ = type; method_ = method; num_samples_ = num_samples; } std::pair<char*, uint64_t> LoadMsg::serialize() { uint64_t buffer_size = 0; uint64_t pos = 0; char* buffer; uint64_t length; // serialize relevant components std::pair<char*, uint64_t> as_pair = array_schema_.serialize(); // calculate buffer size buffer_size += sizeof(size_t); // filename length buffer_size += filename_.size(); // filename buffer_size += sizeof(uint64_t); // array schema length buffer_size += as_pair.second; // array schema buffer_size += sizeof(PartitionType); // partition type buffer_size += sizeof(LoadMethod); // load method (sort or sample) buffer_size += sizeof(uint64_t); // num_samples buffer = new char[buffer_size]; // serialize filename length = filename_.size(); memcpy(&buffer[pos], &length, sizeof(size_t)); pos += sizeof(size_t); memcpy(&buffer[pos], filename_.c_str(), length); pos += length; // serialize array schema length = as_pair.second; memcpy(&buffer[pos], &length, sizeof(uint64_t)); pos += sizeof(uint64_t); memcpy(&buffer[pos], as_pair.first, length); pos += length; // serialize partition type memcpy(&buffer[pos], (char *) &type_, sizeof(PartitionType)); pos += sizeof(PartitionType); // serialize load method memcpy(&buffer[pos], (char *) &method_, sizeof(LoadMethod)); pos += sizeof(LoadMethod); // serialize num_samples memcpy(&buffer[pos], (char *) &num_samples_, sizeof(uint64_t)); assert(pos + sizeof(uint64_t) == buffer_size); return std::pair<char*, uint64_t>(buffer, buffer_size); } LoadMsg* LoadMsg::deserialize(char* buffer, uint64_t buffer_length) { std::string filename; std::stringstream ss; uint64_t counter = 0; size_t filename_length; memcpy(&filename_length, &buffer[counter], sizeof(size_t)); counter += sizeof(size_t); ss.write(&buffer[counter], filename_length); filename = ss.str(); // first arg counter += filename_length; uint64_t arrayschema_length; memcpy(&arrayschema_length, &buffer[counter], sizeof(uint64_t)); counter += sizeof(uint64_t); // this is creating space for it on the heap. ArraySchema* schema = new ArraySchema(); schema->deserialize(&buffer[counter], arrayschema_length); // second arg counter += arrayschema_length; // partition type PartitionType type; memcpy(&type, &buffer[counter], sizeof(PartitionType)); counter += sizeof(PartitionType); // load method LoadMethod method; memcpy(&method, &buffer[counter], sizeof(LoadMethod)); counter += sizeof(LoadMethod); // num samples uint64_t num_samples; memcpy(&num_samples, &buffer[counter], sizeof(uint64_t)); counter += sizeof(uint64_t); // sanity check assert(counter == buffer_length); return new LoadMsg(filename, *schema, type, method, num_samples); } /****************************************************** ********************* GET MESSAGE ******************** ******************************************************/ GetMsg::GetMsg() : Msg(GET_TAG) {}; GetMsg::GetMsg(std::string array_name) : Msg(GET_TAG) { array_name_ = array_name; } std::pair<char*, uint64_t> GetMsg::serialize() { uint64_t buffer_size = 0, pos = 0; char* buffer; size_t length = array_name_.size(); buffer_size += sizeof(size_t); buffer_size += length; buffer = new char[buffer_size]; memcpy(&buffer[pos], &length, sizeof(size_t)); pos += sizeof(size_t); memcpy(&buffer[pos], array_name_.c_str(), length); assert(pos + length == buffer_size); return std::pair<char*, uint64_t>(buffer, buffer_size); } GetMsg* GetMsg::deserialize(char* buffer, uint64_t buffer_length) { //getmsg args std::string arrayname; std::stringstream ss; uint64_t counter = 0; size_t array_name_length; memcpy(&array_name_length, &buffer[counter], sizeof(size_t)); counter += sizeof(size_t); ss.write(&buffer[counter], array_name_length); arrayname = ss.str(); // first arg return new GetMsg(arrayname); } /****************************************************** *************** ARRAYSCHEMA MESSAGE ****************** ******************************************************/ DefineArrayMsg::DefineArrayMsg() : Msg(DEFINE_ARRAY_TAG) {}; DefineArrayMsg::DefineArrayMsg(ArraySchema& schema) : Msg(DEFINE_ARRAY_TAG) { array_schema_ = schema; } std::pair<char*, uint64_t> DefineArrayMsg::serialize() { return array_schema_.serialize(); } DefineArrayMsg* DefineArrayMsg::deserialize(char* buffer, uint64_t buffer_length) { ArraySchema* schema = new ArraySchema(); schema->deserialize(buffer, buffer_length); return new DefineArrayMsg(*schema); } /****************************************************** ****************** FILTER MESSAGE ******************** ******************************************************/ FilterMsg::FilterMsg() : Msg(FILTER_TAG) {} FilterMsg::FilterMsg( std::string& array_name, std::string& expression, std::string& result_array_name) : Msg(FILTER_TAG) { array_name_ = array_name; expr_ = expression; result_array_name_ = result_array_name; } std::pair<char*, uint64_t> FilterMsg::serialize() { uint64_t buffer_size = 0; uint64_t pos = 0; char* buffer; uint64_t length; // calculate buffer size buffer_size += sizeof(size_t); // result array name length buffer_size += result_array_name_.size(); // result array name buffer_size += sizeof(size_t); // expr str length buffer_size += expr_.size(); // expr str buffer_size += sizeof(size_t); // array name length buffer_size += array_name_.size(); // array name // creating buffer buffer = new char[buffer_size]; // serialize resulting array name length = result_array_name_.size(); memcpy(&buffer[pos], &length, sizeof(size_t)); pos += sizeof(size_t); memcpy(&buffer[pos], result_array_name_.c_str(), length); pos += length; // serialize expr str length = expr_.size(); memcpy(&buffer[pos], &length, sizeof(size_t)); pos += sizeof(size_t); memcpy(&buffer[pos], expr_.c_str(), length); pos += length; // serialize array name length = array_name_.size(); memcpy(&buffer[pos], &length, sizeof(size_t)); pos += sizeof(size_t); memcpy(&buffer[pos], array_name_.c_str(), length); assert(pos + length == buffer_size); return std::pair<char*, uint64_t>(buffer, buffer_size); } FilterMsg* FilterMsg::deserialize(char* buffer, uint64_t buf_length) { std::stringstream ss; uint64_t pos = 0; // parse result array name size_t length; memcpy(&length, &buffer[pos], sizeof(size_t)); pos += sizeof(size_t); ss.write(&buffer[pos], length); std::string result_array_name = ss.str(); // first arg pos += length; ss.str(std::string()); // parse expr str memcpy(&length, &buffer[pos], sizeof(size_t)); pos += sizeof(size_t); ss.write(&buffer[pos], length); std::string expr = ss.str(); pos += length; ss.str(std::string()); // parse array name length = (size_t) buffer[pos]; pos += sizeof(size_t); ss.write(&buffer[pos], length); std::string array_name = ss.str(); // finished parsing assert(length + pos == buf_length); return new FilterMsg(array_name, expr, result_array_name); } /********************************************************* ***************** PARALLEL LOAD MESSAGE ***************** *********************************************************/ ParallelLoadMsg::ParallelLoadMsg() : Msg(PARALLEL_LOAD_TAG) {} ParallelLoadMsg::ParallelLoadMsg( std::string filename, PartitionType type, ArraySchema& array_schema, uint64_t num_samples) : Msg(PARALLEL_LOAD_TAG) { filename_ = filename; type_ = type; array_schema_ = array_schema; num_samples_ = num_samples; } std::pair<char*, uint64_t> ParallelLoadMsg::serialize() { uint64_t buffer_size = 0, pos = 0; char* buffer; // serialize relevant components std::pair<char*, uint64_t> as_pair = array_schema_.serialize(); // calculate buffer size buffer_size += sizeof(size_t); // filename length buffer_size += filename_.size(); // filename buffer_size += sizeof(PartitionType); // load type buffer_size += sizeof(uint64_t); // array schema length buffer_size += as_pair.second; // array schema buffer_size += sizeof(uint64_t); // num samples // creating buffer buffer = new char[buffer_size]; // serialize filename size_t length = filename_.size(); memcpy(&buffer[pos], &length, sizeof(size_t)); pos += sizeof(size_t); memcpy(&buffer[pos], filename_.c_str(), length); pos += length; // serialize load type memcpy(&buffer[pos], (char *) &type_, sizeof(PartitionType)); pos += sizeof(PartitionType); // serialize array schema uint64_t schema_length = as_pair.second; memcpy(&buffer[pos], &schema_length, sizeof(uint64_t)); pos += sizeof(uint64_t); memcpy(&buffer[pos], as_pair.first, schema_length); pos += schema_length; // serialize num samples memcpy(&buffer[pos], &num_samples_, sizeof(uint64_t)); assert(pos + sizeof(uint64_t) == buffer_size); return std::pair<char*, uint64_t>(buffer, buffer_size); } ParallelLoadMsg* ParallelLoadMsg::deserialize(char* buffer, uint64_t buffer_size) { std::string filename; uint64_t pos = 0; // filename size_t length; memcpy(&length, &buffer[pos], sizeof(size_t)); pos += sizeof(size_t); filename = std::string(&buffer[pos], length); pos += length; // load type PartitionType type = static_cast<PartitionType>(buffer[pos]); pos += sizeof(PartitionType); // array schema memcpy(&length, &buffer[pos], sizeof(uint64_t)); pos += sizeof(uint64_t); ArraySchema* schema = new ArraySchema(); schema->deserialize(&buffer[pos], length); pos += length; // num samples uint64_t num_samples; memcpy(&num_samples, &buffer[pos], sizeof(uint64_t)); assert(pos + sizeof(uint64_t) == buffer_size); return new ParallelLoadMsg(filename, type, *schema, num_samples); } /****************************************************** ******************* AGGREGATE MESSAGE **************** ******************************************************/ AggregateMsg::AggregateMsg() : Msg(AGGREGATE_TAG) {}; AggregateMsg::AggregateMsg(std::string array_name, int attr_index): Msg(AGGREGATE_TAG) { attr_index_ = attr_index; array_name_ = array_name; } std::pair<char*, uint64_t> AggregateMsg::serialize() { uint64_t buffer_size = 0, pos = 0; char* buffer; // calculate buffer size buffer_size += sizeof(uint64_t); // array name size buffer_size += array_name_.size(); // array name buffer_size += sizeof(int); // attr index buffer = new char[buffer_size]; // serialize array name uint64_t length = array_name_.size(); memcpy(&buffer[pos], &length, sizeof(uint64_t)); pos += sizeof(uint64_t); memcpy(&buffer[pos], array_name_.c_str(), length); pos += length; // serialize attr int memcpy(&buffer[pos], &attr_index_, sizeof(int)); assert(pos += sizeof(int) == buffer_size); return std::pair<char*, uint64_t>(buffer, buffer_size); } AggregateMsg* AggregateMsg::deserialize(char* buf, uint64_t len) { uint64_t pos = 0; // deserialize array name uint64_t length = (uint64_t) buf[pos]; pos += sizeof(uint64_t); std::string array_name = std::string(&buf[pos], length); pos += length; // deserialize attribute index int attr_index = (int) buf[pos]; assert(pos + sizeof(int) == len); return new AggregateMsg(array_name, attr_index); } /****************************************************** ********************* JOIN MESSAGE ******************* ******************************************************/ JoinMsg::JoinMsg() : Msg(JOIN_TAG) {}; JoinMsg::JoinMsg(std::string array_name_A, std::string array_name_B, std::string result_array_name) : Msg(JOIN_TAG) { array_name_A_ = array_name_A; array_name_B_ = array_name_B; result_array_name_ = result_array_name; } std::pair<char*, uint64_t> JoinMsg::serialize() { uint64_t buffer_size = 0, pos = 0; char* buffer; // Compute lengths size_t A_length = array_name_A_.size(); size_t B_length = array_name_B_.size(); size_t result_length = result_array_name_.size(); buffer_size += sizeof(size_t); buffer_size += A_length; buffer_size += sizeof(size_t); buffer_size += B_length; buffer_size += sizeof(size_t); buffer_size += result_length; // creating buffer buffer = new char[buffer_size]; // Serializing array_name_A_ memcpy(&buffer[pos], &A_length, sizeof(size_t)); pos += sizeof(size_t); memcpy(&buffer[pos], array_name_A_.c_str(), A_length); pos += A_length; // Serializing array_name_B_ memcpy(&buffer[pos], &B_length, sizeof(size_t)); pos += sizeof(size_t); memcpy(&buffer[pos], array_name_B_.c_str(), B_length); pos += B_length; // Serializing result_array_name_ memcpy(&buffer[pos], &result_length, sizeof(size_t)); pos += sizeof(size_t); memcpy(&buffer[pos], result_array_name_.c_str(), result_length); assert(pos + result_length == buffer_size); return std::pair<char*, uint64_t>(buffer, buffer_size); } JoinMsg* JoinMsg::deserialize(char* buffer, uint64_t buffer_length) { std::string array_name_A; std::string array_name_B; std::string result_array_name; uint64_t pos = 0; std::stringstream ss; // deserializing array_name_A_ size_t length; memcpy(&length, &buffer[pos], sizeof(size_t)); pos += sizeof(size_t); ss.write(&buffer[pos], length); pos += length; array_name_A = ss.str(); ss.str(std::string()); // deserializing array_name_B_ memcpy(&length, &buffer[pos], sizeof(size_t)); pos += sizeof(size_t); ss.write(&buffer[pos], length); pos += length; array_name_B = ss.str(); ss.str(std::string()); // deserializing result_array_name_ memcpy(&length, &buffer[pos], sizeof(size_t)); pos += sizeof(size_t); ss.write(&buffer[pos], length); result_array_name = ss.str(); assert(pos + length == buffer_length); return new JoinMsg(array_name_A, array_name_B, result_array_name); } /****************************************************** ******************** ACK MESSAGE ********************* ******************************************************/ AckMsg::AckMsg() : Msg(ACK_TAG) {}; AckMsg::AckMsg(Result r, int tag, double time) : Msg(ACK_TAG) { result_ = r; tag_ = tag; time_ = time; } std::pair<char*, uint64_t> AckMsg::serialize() { uint64_t buffer_size = 0, pos = 0; char* buffer; buffer_size = sizeof(Result); // result buffer_size += sizeof(int); // tag buffer_size += sizeof(double); // time buffer = new char[buffer_size]; // serialize result memcpy(&buffer[pos], &result_, sizeof(Result)); pos += sizeof(Result); // serialize tag memcpy(&buffer[pos], &tag_, sizeof(int)); pos += sizeof(int); // serialize time memcpy(&buffer[pos], &time_, sizeof(double)); pos += sizeof(double); assert(pos == buffer_size); return std::pair<char*, uint64_t>(buffer, buffer_size); } AckMsg* AckMsg::deserialize(char* buffer, uint64_t buffer_length) { // getmsg args int pos = 0; // deserialize result Result result; memcpy(&result, &buffer[pos], sizeof(Result)); pos += sizeof(Result); // deserialize tag int tag; memcpy(&tag, &buffer[pos], sizeof(int)); pos += sizeof(int); // deserialize time double time; memcpy(&time, &buffer[pos], sizeof(double)); pos += sizeof(double); // sanity check assert(pos == buffer_length); return new AckMsg(result, tag, time); } std::string AckMsg::to_string() { std::stringstream ss; switch (tag_) { case GET_TAG: ss << "GET"; break; case DEFINE_ARRAY_TAG: ss << "DEFINE_ARRAY_TAG"; break; case LOAD_TAG: ss << "LOAD"; break; case SUBARRAY_TAG: ss << "SUBARRAY"; break; case FILTER_TAG: ss << "FILTER"; break; case AGGREGATE_TAG: ss << "AGGREGATE"; break; case PARALLEL_LOAD_TAG: ss << "PARALLEL_LOAD"; break; case JOIN_TAG: ss << "JOIN_TAG"; break; default: break; } if (result_ == DONE) { ss << "[DONE]"; } else { assert(result_ == ERROR); ss << "[ERROR]"; } ss << " Time[" << time_ << " secs]"; return ss.str(); } /****************************************************** ******************* Samples MESSAGE ****************** ******************************************************/ SamplesMsg::SamplesMsg() : Msg(SAMPLES_TAG) {}; SamplesMsg::SamplesMsg(std::vector<uint64_t> samples) : Msg(SAMPLES_TAG) { samples_ = samples; } std::pair<char*, uint64_t> SamplesMsg::serialize() { uint64_t buffer_size = 0, pos = 0; char* buffer; buffer_size = sizeof(uint64_t) * samples_.size(); buffer = new char[buffer_size]; for (std::vector<uint64_t>::iterator it = samples_.begin(); it != samples_.end(); ++it, pos += sizeof(uint64_t)) { uint64_t sample = *it; memcpy(&buffer[pos], &sample, sizeof(uint64_t)); } assert(pos == buffer_size); return std::pair<char*, uint64_t>(buffer, buffer_size); } SamplesMsg* SamplesMsg::deserialize(char* buffer, uint64_t buffer_length) { std::vector<uint64_t> samples; uint64_t pos; assert(buffer_length % 8 == 0); for (pos = 0; pos < buffer_length; pos += sizeof(uint64_t)) { uint64_t sample; memcpy(&sample, &buffer[pos], sizeof(uint64_t)); samples.push_back(sample); } assert(samples.size() * 8 == buffer_length); return new SamplesMsg(samples); } /****************************************************** *************** Bounding Coords MESSAGE ************** ******************************************************/ BoundingCoordsMsg::BoundingCoordsMsg() : Msg(BOUNDING_COORDS_TAG) {}; BoundingCoordsMsg::BoundingCoordsMsg( StorageManager::BoundingCoordinates bounding_coords) : Msg(BOUNDING_COORDS_TAG) { bounding_coords_ = bounding_coords; } std::pair<char*, uint64_t> BoundingCoordsMsg::serialize() { uint64_t buffer_size = 0, pos = 0; char* buffer; int num_dim = 0; if (bounding_coords_.size() > 0) { num_dim = bounding_coords_[0].first.size(); } buffer_size = sizeof(int); // number of dimensions buffer_size += 2 * num_dim * bounding_coords_.size() * sizeof(double); // size of bounding coordinates buffer = new char[buffer_size]; // serialize num dim memcpy(&buffer[pos], &num_dim, sizeof(int)); pos += sizeof(int); // serialize bounding coordinates for (int i = 0; i < bounding_coords_.size(); ++i) { // serialize first coords in pair for (std::vector<double>::iterator it = bounding_coords_[i].first.begin(); it != bounding_coords_[i].first.end(); ++it) { double coord = *it; memcpy(&buffer[pos], &coord, sizeof(double)); pos += sizeof(double); } // serialize second coords in pair for (std::vector<double>::iterator it = bounding_coords_[i].second.begin(); it != bounding_coords_[i].second.end(); ++it) { double coord = *it; memcpy(&buffer[pos], &coord, sizeof(double)); pos += sizeof(double); } } assert(pos == buffer_size); return std::pair<char*, uint64_t>(buffer, buffer_size); } BoundingCoordsMsg* BoundingCoordsMsg::deserialize(char* buffer, uint64_t buffer_length) { StorageManager::BoundingCoordinates bounding_coords; uint64_t pos = 0; // deserialize num_dim int num_dim; memcpy(&num_dim, &buffer[pos], sizeof(int)); pos += sizeof(int); // deserialize all bounding coords for (; pos < buffer_length; pos += 2 * num_dim * sizeof(double)) { std::vector<double> coords1; std::vector<double> coords2; for (int i = 0; i < num_dim; ++i) { double coord; memcpy(&coord, &buffer[pos + i*sizeof(double)], sizeof(double)); coords1.push_back(coord); } int offset = num_dim * sizeof(double); for (int i = 0; i < num_dim; ++i) { double coord; memcpy(&coord, &buffer[pos + i*sizeof(double) + offset], sizeof(double)); coords2.push_back(coord); } bounding_coords.push_back( StorageManager::BoundingCoordinatesPair(coords1, coords2)); } // TODO fix when buffer is empty... if (buffer_length > 0) { assert(pos == buffer_length); } return new BoundingCoordsMsg(bounding_coords); } /****************************************************** ******************** TILE MESSAGE ******************** ******************************************************/ TileMsg::TileMsg() : Msg(BOUNDING_COORDS_TAG) {}; TileMsg::TileMsg(std::string array_name, int attr_id, const char* payload, uint64_t num_cells, uint64_t cell_size) : Msg(TILE_TAG) { array_name_ = array_name; attr_id_ = attr_id; payload_ = payload; num_cells_ = num_cells; cell_size_ = cell_size; } std::pair<char*, uint64_t> TileMsg::serialize() { uint64_t buffer_size = 0, pos = 0; char* buffer; buffer_size = sizeof(int); // array_name length buffer_size += array_name_.size(); // array_name buffer_size += sizeof(int); // attr_id buffer_size += sizeof(uint64_t); // num_cells buffer_size += sizeof(uint64_t); // cell_size buffer_size += payload_size(); // payload size buffer = new char[buffer_size]; // serialize array name int length = array_name_.size(); memcpy(&buffer[pos], &length, sizeof(int)); pos += sizeof(int); memcpy(&buffer[pos], array_name_.c_str(), length); pos += length; // serialize attr id memcpy(&buffer[pos], &attr_id_, sizeof(int)); pos += sizeof(int); // serialize num cells memcpy(&buffer[pos], &num_cells_, sizeof(uint64_t)); pos += sizeof(uint64_t); // serialize cell size memcpy(&buffer[pos], &cell_size_, sizeof(uint64_t)); pos += sizeof(uint64_t); // serialize payload memcpy(&buffer[pos], payload_, payload_size()); pos += payload_size(); assert(pos == buffer_size); return std::pair<char*, uint64_t>(buffer, buffer_size); } TileMsg* TileMsg::deserialize(char* buffer, uint64_t buffer_length) { std::stringstream ss; uint64_t pos = 0; // deserialize array name int length; memcpy(&length, &buffer[pos], sizeof(int)); pos += sizeof(int); ss.write(&buffer[pos], length); std::string array_name = ss.str(); pos += length; ss.str(std::string()); // deserialize attr id int attr_id; memcpy(&attr_id, &buffer[pos], sizeof(int)); pos += sizeof(int); // deserialize num cells uint64_t num_cells; memcpy(&num_cells, &buffer[pos], sizeof(uint64_t)); pos += sizeof(uint64_t); // deserialize cell size uint64_t cell_size; memcpy(&cell_size, &buffer[pos], sizeof(uint64_t)); pos += sizeof(uint64_t); // deserialize payload uint64_t payload_size = cell_size * num_cells; assert(payload_size < buffer_length); const char *payload = new char[payload_size]; memcpy((char *)payload, &buffer[pos], payload_size); pos += payload_size; assert(pos == buffer_length); return new TileMsg(array_name, attr_id, payload, num_cells, cell_size); }
28.12999
119
0.632573
qian-long
22b2b4b3c01f94a387aa9b5836834c4e2d2f1e88
59,332
cpp
C++
src/fw/asdxApp.cpp
ProjectAsura/asdx12
359f7288557ea3e83775864f69a85b6ad11f7f62
[ "MIT" ]
2
2021-06-17T02:27:43.000Z
2022-01-30T09:06:05.000Z
src/fw/asdxApp.cpp
ProjectAsura/asdx12
359f7288557ea3e83775864f69a85b6ad11f7f62
[ "MIT" ]
null
null
null
src/fw/asdxApp.cpp
ProjectAsura/asdx12
359f7288557ea3e83775864f69a85b6ad11f7f62
[ "MIT" ]
null
null
null
//----------------------------------------------------------------------------- // File : asdxApp.cpp // Desc : Application Module. // Copyright(c) Project Asura. All right reserved. //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- #include <list> #include <cassert> #include <fnd/asdxMacro.h> #include <fnd/asdxMath.h> #include <fnd/asdxLogger.h> #include <fw/asdxApp.h> #include <gfx/asdxCommandQueue.h> namespace /* anonymous */ { /////////////////////////////////////////////////////////////////////////////// // ApplicationList class /////////////////////////////////////////////////////////////////////////////// class ApplicationList { //========================================================================= // list of friend classes and methods. //========================================================================= /* NOTHING */ public: //========================================================================= // public variables. //========================================================================= typedef std::list< asdx::Application* > List; typedef std::list< asdx::Application* >::iterator ListItr; typedef std::list< asdx::Application* >::const_iterator ListCItr; //========================================================================= // public methods. //========================================================================= //------------------------------------------------------------------------- //! @brief コンストラクタです. //------------------------------------------------------------------------- ApplicationList() { m_List.clear(); } //------------------------------------------------------------------------- //! @brief デストラクタです. //------------------------------------------------------------------------- ~ApplicationList() { m_List.clear(); } //------------------------------------------------------------------------- //! @brief push_back()のラッパー関数です. //------------------------------------------------------------------------- void PushBack( asdx::Application* pApp ) { m_List.push_back( pApp ); } //------------------------------------------------------------------------- //! @brief push_front()のラッパー関数です. //------------------------------------------------------------------------- void PushFront( asdx::Application* pApp ) { m_List.push_front( pApp ); } //------------------------------------------------------------------------- //! @brief pop_back()のラッパー関数です. //------------------------------------------------------------------------- void PopBack() { m_List.pop_back(); } //------------------------------------------------------------------------- //! @brief pop_front()のラッパー関数です. //------------------------------------------------------------------------- void PopFront() { m_List.pop_front(); } //------------------------------------------------------------------------- //! @brief clear()のラッパー関数です. //------------------------------------------------------------------------- void Clear() { m_List.clear(); } //------------------------------------------------------------------------- //! @brief remove()のラッパー関数です. //------------------------------------------------------------------------- void Remove( asdx::Application* pApp ) { m_List.remove( pApp ); } //------------------------------------------------------------------------- //! @brief begin()のラッパー関数です. //------------------------------------------------------------------------- ListItr Begin() { return m_List.begin(); } //------------------------------------------------------------------------- //! @brief begin()のラッパー関数です(const版). //------------------------------------------------------------------------- ListCItr Begin() const { return m_List.begin(); } //------------------------------------------------------------------------- //! @brief end()のラッパー関数です. //------------------------------------------------------------------------- ListItr End() { return m_List.end(); } //------------------------------------------------------------------------- //! @brief end()のラッパー関数です(const版). //------------------------------------------------------------------------- ListCItr End() const { return m_List.end(); } private: //========================================================================= // private variables. //========================================================================= List m_List; //!< リストです. //========================================================================= // private methods. //========================================================================= /* NOTHING */ }; /////////////////////////////////////////////////////////////////////////////// // AllocationTypeTable structure /////////////////////////////////////////////////////////////////////////////// struct AllocationTypeTable { D3D12_DRED_ALLOCATION_TYPE Type; const char* Tag; }; // アプリケーションリスト. ApplicationList g_AppList; // オペレーションテーブル. static const char* g_BreadcrumTable[] = { "SETMARKER", // 0 "BEGINEVENT", // 1 "ENDEVENT", // 2 "DRAWINSTANCED", // 3 "DRAWINDEXEDINSTANCED", // 4 "EXECUTEINDIRECT", // 5 "DISPATCH", // 6 "COPYBUFFERREGION", // 7 "COPYTEXTUREREGION", // 8 "COPYRESOURCE", // 9 "COPYTILES", // 10 "RESOLVESUBRESOURCE", // 11 "CLEARRENDERTARGETVIEW", // 12 "CLEARUNORDEREDACCESSVIEW", // 13 "CLEARDEPTHSTENCILVIEW", // 14 "RESOURCEBARRIER", // 15 "EXECUTEBUNDLE", // 16 "PRESENT", // 17 "RESOLVEQUERYDATA", // 18 "BEGINSUBMISSION", // 19 "ENDSUBMISSION", // 20 "DECODEFRAME", // 21 "PROCESSFRAMES", // 22 "ATOMICCOPYBUFFERUINT", // 23 "ATOMICCOPYBUFFERUINT64", // 24 "RESOLVESUBRESOURCEREGION", // 25 "WRITEBUFFERIMMEDIATE", // 26 "DECODEFRAME1", // 27 "SETPROTECTEDRESOURCESESSION", // 28 "DECODEFRAME2", // 29 "PROCESSFRAMES1", // 30 "BUILDRAYTRACINGACCELERATIONSTRUCTURE", // 31 "EMITRAYTRACINGACCELERATIONSTRUCTUREPOSTBUILDINFO", // 32 "COPYRAYTRACINGACCELERATIONSTRUCTURE", // 33 "DISPATCHRAYS", // 34 "INITIALIZEMETACOMMAND", // 35 "EXECUTEMETACOMMAND", // 36 "ESTIMATEMOTION", // 37 "RESOLVEMOTIONVECTORHEAP", // 38 "SETPIPELINESTATE1", // 39 "INITIALIZEEXTENSIONCOMMAND", // 40 "EXECUTEEXTENSIONCOMMAND", // 41 "DISPATCHMESH", // 42 }; // アロケーションタイプテーブル. static const AllocationTypeTable g_AllocationTypeTable[] = { { D3D12_DRED_ALLOCATION_TYPE_COMMAND_QUEUE , "COMMAND_QUEUE" }, // 19 { D3D12_DRED_ALLOCATION_TYPE_COMMAND_ALLOCATOR , "COMMAND_ALLOCATOR" }, // 20 { D3D12_DRED_ALLOCATION_TYPE_PIPELINE_STATE , "PIPELINE_STATE" }, // 21 { D3D12_DRED_ALLOCATION_TYPE_COMMAND_LIST , "COMMAND_LIST" }, // 22 { D3D12_DRED_ALLOCATION_TYPE_FENCE , "FENCE" }, // 23 { D3D12_DRED_ALLOCATION_TYPE_DESCRIPTOR_HEAP , "DESCRIPTOR_HEAP" }, // 24 { D3D12_DRED_ALLOCATION_TYPE_HEAP , "HEAP" }, // 25 { D3D12_DRED_ALLOCATION_TYPE_QUERY_HEAP , "QUERY_HEAP" }, // 27 { D3D12_DRED_ALLOCATION_TYPE_COMMAND_SIGNATURE , "COMMAND_SIGNATURE" }, // 28 { D3D12_DRED_ALLOCATION_TYPE_PIPELINE_LIBRARY , "PIPELINE_LIBRARY" }, // 29 { D3D12_DRED_ALLOCATION_TYPE_VIDEO_DECODER , "VIDEO_DECODER" }, // 30 { D3D12_DRED_ALLOCATION_TYPE_VIDEO_PROCESSOR , "VIDEO_PROCESSOR" }, // 32 { D3D12_DRED_ALLOCATION_TYPE_RESOURCE , "RESOURCE" }, // 34 { D3D12_DRED_ALLOCATION_TYPE_PASS , "PASS" }, // 35 { D3D12_DRED_ALLOCATION_TYPE_CRYPTOSESSION , "CRYPTOSESSION" }, // 36 { D3D12_DRED_ALLOCATION_TYPE_CRYPTOSESSIONPOLICY , "CRYPTOSESSIONPOLICY" }, // 37 { D3D12_DRED_ALLOCATION_TYPE_PROTECTEDRESOURCESESSION , "PROTECTEDRESOURCESESSION" }, // 38 { D3D12_DRED_ALLOCATION_TYPE_VIDEO_DECODER_HEAP , "VIDEO_DECODER_HEAP" }, // 39 { D3D12_DRED_ALLOCATION_TYPE_COMMAND_POOL , "COMMAND_POOL" }, // 40 { D3D12_DRED_ALLOCATION_TYPE_COMMAND_RECORDER , "COMMAND_RECORDER" }, // 41 { D3D12_DRED_ALLOCATION_TYPE_STATE_OBJECT , "STATE_OBJECT" }, // 42 { D3D12_DRED_ALLOCATION_TYPE_METACOMMAND , "METACOMMAND" }, // 43 { D3D12_DRED_ALLOCATION_TYPE_SCHEDULINGGROUP , "SCHEDULINGGROUP" }, // 44 { D3D12_DRED_ALLOCATION_TYPE_VIDEO_MOTION_ESTIMATOR , "VIDEO_MOTION_ESTIMATOR" }, // 45 { D3D12_DRED_ALLOCATION_TYPE_VIDEO_MOTION_VECTOR_HEAP , "VIDEO_MOTION_VECTOR_HEAP" }, // 46 { D3D12_DRED_ALLOCATION_TYPE_VIDEO_EXTENSION_COMMAND , "VIDEO_EXTENSION_COMMAND" }, // 47 { D3D12_DRED_ALLOCATION_TYPE_INVALID , "INVALID" }, // 0xffffffff }; //----------------------------------------------------------------------------- // 領域の交差を計算します. //----------------------------------------------------------------------------- inline int ComputeIntersectionArea ( int ax1, int ay1, int ax2, int ay2, int bx1, int by1, int bx2, int by2 ) { return asdx::Max(0, asdx::Min(ax2, bx2) - asdx::Max(ax1, bx1)) * asdx::Max(0, asdx::Min(ay2, by2) - asdx::Max(ay1, by1)); } //----------------------------------------------------------------------------- // nullptrかどうかを考慮してdeleteします. //----------------------------------------------------------------------------- template<typename T> void SafeDelete(T*& ptr) { if (ptr != nullptr) { delete ptr; ptr = nullptr; } } //----------------------------------------------------------------------------- // nullptrかどうかを考慮してdelete[]します. //----------------------------------------------------------------------------- template<typename T> void SafeDeleteArray(T*& ptr) { if (ptr != nullptr) { delete[] ptr; ptr = nullptr; } } //----------------------------------------------------------------------------- // nullptrかどうかを考慮して解放処理を行います. //----------------------------------------------------------------------------- template<typename T> void SafeRelease(T*& ptr) { if (ptr != nullptr) { ptr->Release(); ptr = nullptr; } } //----------------------------------------------------------------------------- // 色度を変換した値を取得します. //----------------------------------------------------------------------------- inline UINT GetCoord(float value) { return static_cast<UINT>(value * 50000.0f); } //----------------------------------------------------------------------------- // 輝度を変換した値を取得します. //----------------------------------------------------------------------------- inline UINT GetLuma(float value) { return static_cast<UINT>(value * 10000.0f); } //----------------------------------------------------------------------------- // D3D12_AUTO_BREADCRUMB_OPに対応する文字列を取得します. //----------------------------------------------------------------------------- const char* ToString(D3D12_AUTO_BREADCRUMB_OP value) { return g_BreadcrumTable[value]; } //----------------------------------------------------------------------------- // D3D12_DREAD_ALLOCATION_TYPEに対応する文字列を取得します. //----------------------------------------------------------------------------- const char* ToString(D3D12_DRED_ALLOCATION_TYPE value) { auto count = sizeof(g_AllocationTypeTable) / sizeof(g_AllocationTypeTable[0]); for(auto i=0; i<count; ++i) { if (value == g_AllocationTypeTable[i].Type) { return g_AllocationTypeTable[i].Tag; } } // バージョンアップとかで列挙体が増えた場合にここに来る可能性がある. return "UNKNOWN"; } //----------------------------------------------------------------------------- // ログ出力を行います. //----------------------------------------------------------------------------- void OutputLog(const D3D12_AUTO_BREADCRUMB_NODE1* pNode) { if (pNode == nullptr) { return; } ILOGA("Breadcrumb Node 0x%x :", pNode); ILOGA(" pCommandListDebugNameA = %s" , pNode->pCommandListDebugNameA); ILOGW(" pCommandListDebugNameW = %ls" , pNode->pCommandListDebugNameW); ILOGA(" pCommandQueueDebugNameA = %s" , pNode->pCommandQueueDebugNameA); ILOGW(" pCommandQueueDebugNameW = %ls" , pNode->pCommandQueueDebugNameW); ILOGA(" pCommandList = 0x%x" , pNode->pCommandList); ILOGA(" pCommandQueue = 0x%x" , pNode->pCommandQueue); ILOGA(" BreadcrumbCount = %u" , pNode->BreadcrumbCount); ILOGA(" BreadcrumbContextCount = %u" , pNode->BreadcrumbContextsCount); ILOGA(" pLastBreadcrumbValue = 0x%x (%u)", pNode->pLastBreadcrumbValue, *pNode->pLastBreadcrumbValue); ILOGA(" pCommandHistory : "); for(auto i=0u; i<pNode->BreadcrumbCount; ++i) { ILOGA(" %c Op[%u] = %s", ((i == *pNode->pLastBreadcrumbValue) ? '*' : ' '), i, ToString(pNode->pCommandHistory[i])); } for(auto i=0u; i<pNode->BreadcrumbContextsCount; ++i) { auto ctx = pNode->pBreadcrumbContexts[i]; ILOGA(" Bredcrumb index = %u, string = %ls", ctx.BreadcrumbIndex, ctx.pContextString); } ILOGA(" pNext = 0x%x" , pNode->pNext); } //----------------------------------------------------------------------------- // ログ出力を行います. //----------------------------------------------------------------------------- void OutputLog(const D3D12_DRED_ALLOCATION_NODE1* pNode) { if (pNode == nullptr) { return; } ILOGA("Allocation Node 0x%x : " , pNode); ILOGA(" ObjectNameA = %s" , pNode->ObjectNameA); ILOGW(" ObjectNameW = %ls" , pNode->ObjectNameW); ILOGA(" AllcationType = %s" , ToString(pNode->AllocationType)); ILOGA(" pNext = 0x%x", pNode->pNext); } //----------------------------------------------------------------------------- // デバイス削除にエラーメッセージを表示します. //----------------------------------------------------------------------------- void DeviceRemovedHandler(ID3D12Device* pDevice) { asdx::RefPtr<ID3D12DeviceRemovedExtendedData1> pDred; auto hr = pDevice->QueryInterface(IID_PPV_ARGS(pDred.GetAddress())); if (FAILED(hr)) { ELOG("Error : ID3D12Device::QueryInterface() Failed. errcode = 0x%x", hr); return; } D3D12_DRED_AUTO_BREADCRUMBS_OUTPUT1 autoBreadcrumbsOutput = {}; hr = pDred->GetAutoBreadcrumbsOutput1(&autoBreadcrumbsOutput); if (SUCCEEDED(hr)) { auto pNode = autoBreadcrumbsOutput.pHeadAutoBreadcrumbNode; while(pNode != nullptr) { OutputLog(pNode); pNode = pNode->pNext; } } D3D12_DRED_PAGE_FAULT_OUTPUT1 pageFaultOutput = {}; hr = pDred->GetPageFaultAllocationOutput1(&pageFaultOutput); if (SUCCEEDED(hr)) { auto pNode = pageFaultOutput.pHeadRecentFreedAllocationNode; while(pNode != nullptr) { OutputLog(pNode); pNode = pNode->pNext; } pNode = pageFaultOutput.pHeadExistingAllocationNode; while(pNode != nullptr) { OutputLog(pNode); pNode = pNode->pNext; } } } //----------------------------------------------------------------------------- // sRGBフォーマットかどうかチェックします. //----------------------------------------------------------------------------- bool IsSRGBFormat(DXGI_FORMAT value) { bool result = false; switch(value) { case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: { result = true; } break; case DXGI_FORMAT_BC1_UNORM_SRGB: { result = true; } break; case DXGI_FORMAT_BC2_UNORM_SRGB: { result = true; } break; case DXGI_FORMAT_BC3_UNORM_SRGB: { result = true; } break; case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: { result = true; } break; case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: { result = true; } break; case DXGI_FORMAT_BC7_UNORM_SRGB: { result = true; } break; } return result; } //----------------------------------------------------------------------------- // 非sRGBフォーマットに変換します. //----------------------------------------------------------------------------- DXGI_FORMAT GetNoSRGBFormat(DXGI_FORMAT value) { DXGI_FORMAT result = value; switch( value ) { case DXGI_FORMAT_R8G8B8A8_UNORM_SRGB: { result = DXGI_FORMAT_R8G8B8A8_UNORM; } break; case DXGI_FORMAT_BC1_UNORM_SRGB: { result = DXGI_FORMAT_BC1_UNORM; } break; case DXGI_FORMAT_BC2_UNORM_SRGB: { result = DXGI_FORMAT_BC2_UNORM; } break; case DXGI_FORMAT_BC3_UNORM_SRGB: { result = DXGI_FORMAT_BC3_UNORM; } break; case DXGI_FORMAT_B8G8R8A8_UNORM_SRGB: { result = DXGI_FORMAT_B8G8R8A8_UNORM; } break; case DXGI_FORMAT_B8G8R8X8_UNORM_SRGB: { result = DXGI_FORMAT_B8G8R8X8_UNORM; } break; case DXGI_FORMAT_BC7_UNORM_SRGB: { result = DXGI_FORMAT_BC7_UNORM; } break; } return result; } } // namespace /* anonymous */ namespace asdx { // ウィンドウクラス名です. #ifndef ASDX_WND_CLASSNAME #define ASDX_WND_CLASSNAME TEXT("asdxWindowClass") #endif//ASDX_WND_CLAASNAME /////////////////////////////////////////////////////////////////////////////////////////////////// // Application class /////////////////////////////////////////////////////////////////////////////////////////////////// //----------------------------------------------------------------------------- // コンストラクタです. //----------------------------------------------------------------------------- Application::Application() : m_hInst ( nullptr ) , m_hWnd ( nullptr ) , m_AllowTearing ( false ) , m_MultiSampleCount ( 1 ) , m_MultiSampleQuality ( 0 ) , m_SwapChainCount ( 2 ) , m_SwapChainFormat ( DXGI_FORMAT_R10G10B10A2_UNORM ) , m_DepthStencilFormat ( DXGI_FORMAT_D32_FLOAT ) , m_pSwapChain4 ( nullptr ) , m_SampleMask ( 0 ) , m_StencilRef ( 0 ) , m_Width ( 960 ) , m_Height ( 540 ) , m_AspectRatio ( 1.7777f ) , m_Title ( L"asdxApplication" ) , m_Timer () , m_FrameCount ( 0 ) , m_FPS ( 0.0f ) , m_LatestUpdateTime ( 0.0f ) , m_IsStopRendering ( false ) , m_IsStandbyMode ( false ) , m_hIcon ( nullptr ) , m_hMenu ( nullptr ) , m_hAccel ( nullptr ) { // Corn Flower Blue. m_ClearColor[0] = 0.392156899f; m_ClearColor[1] = 0.584313750f; m_ClearColor[2] = 0.929411829f; m_ClearColor[3] = 1.000000000f; m_DeviceDesc.EnableDebug = ASDX_DEV_VAR(true, false); m_DeviceDesc.MaxColorTargetCount = 128; m_DeviceDesc.MaxDepthTargetCount = 128; m_DeviceDesc.MaxSamplerCount = 128; m_DeviceDesc.MaxShaderResourceCount = 4096; } //----------------------------------------------------------------------------- // 引数付きコンストラクタです. //----------------------------------------------------------------------------- Application::Application( LPCWSTR title, UINT width, UINT height, HICON hIcon, HMENU hMenu, HACCEL hAccel ) : m_hInst ( nullptr ) , m_hWnd ( nullptr ) , m_AllowTearing ( false ) , m_MultiSampleCount ( 1 ) , m_MultiSampleQuality ( 0 ) , m_SwapChainCount ( 2 ) , m_SwapChainFormat ( DXGI_FORMAT_R10G10B10A2_UNORM ) , m_DepthStencilFormat ( DXGI_FORMAT_D32_FLOAT ) , m_pSwapChain4 ( nullptr ) , m_Width ( width ) , m_Height ( height ) , m_AspectRatio ( (float)width/(float)height ) , m_Title ( title ) , m_Timer () , m_FrameCount ( 0 ) , m_FPS ( 0.0f ) , m_LatestUpdateTime ( 0.0f ) , m_IsStopRendering ( false ) , m_IsStandbyMode ( false ) , m_hIcon ( hIcon ) , m_hMenu ( hMenu ) { // Corn Flower Blue. m_ClearColor[0] = 0.392156899f; m_ClearColor[1] = 0.584313750f; m_ClearColor[2] = 0.929411829f; m_ClearColor[3] = 1.000000000f; m_DeviceDesc.EnableDebug = ASDX_DEV_VAR(true, false); m_DeviceDesc.MaxColorTargetCount = 128; m_DeviceDesc.MaxDepthTargetCount = 128; m_DeviceDesc.MaxSamplerCount = 128; m_DeviceDesc.MaxShaderResourceCount = 4096; } //----------------------------------------------------------------------------- // デストラクタです. //----------------------------------------------------------------------------- Application::~Application() { TermApp(); } //----------------------------------------------------------------------------- // 描画停止フラグを設定します. //----------------------------------------------------------------------------- void Application::SetStopRendering( bool isStopRendering ) { std::lock_guard<std::mutex> locker(m_Mutex); m_IsStopRendering = isStopRendering; } //----------------------------------------------------------------------------- // 描画停止フラグを取得します. //----------------------------------------------------------------------------- bool Application::IsStopRendering() { std::lock_guard<std::mutex> locker(m_Mutex); return m_IsStopRendering; } //----------------------------------------------------------------------------- // フレームカウントを取得します. //----------------------------------------------------------------------------- DWORD Application::GetFrameCount() { std::lock_guard<std::mutex> locker(m_Mutex); return m_FrameCount; } //----------------------------------------------------------------------------- // FPSを取得します. //----------------------------------------------------------------------------- FLOAT Application::GetFPS() { std::lock_guard<std::mutex> locker(m_Mutex); return m_FPS; } //----------------------------------------------------------------------------- // アプリケーションを初期化します. //----------------------------------------------------------------------------- bool Application::InitApp() { // COMライブラリの初期化. HRESULT hr = CoInitialize( nullptr ); if ( FAILED(hr) ) { DLOG( "Error : Com Library Initialize Failed." ); return false; } // COMライブラリのセキュリティレベルを設定. hr = CoInitializeSecurity( NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_DEFAULT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL); // セキュリティ設定の結果をチェック. if ( FAILED(hr) ) { DLOG( "Error : Com Library Initialize Security Failed." ); return false; } // ウィンドウの初期化. if ( !InitWnd() ) { DLOG( "Error : InitWnd() Failed." ); return false; } // Direct3Dの初期化. if ( !InitD3D() ) { DLOG( "Error : InitD3D() Failed." ); return false; } // アプリケーション固有の初期化. if ( !OnInit() ) { ELOG( "Error : OnInit() Failed." ); return false; } // ウィンドウを表示します. ShowWindow( m_hWnd, SW_SHOWNORMAL ); UpdateWindow( m_hWnd ); // フォーカスを設定します. SetFocus( m_hWnd ); // 正常終了. return true; } //----------------------------------------------------------------------------- // アプリケーションの終了処理. //----------------------------------------------------------------------------- void Application::TermApp() { // コマンドの完了を待機. SystemWaitIdle(); // アプリケーション固有の終了処理. OnTerm(); // Direct3Dの終了処理. TermD3D(); // ウィンドウの終了処理. TermWnd(); // COMライブラリの終了処理. CoUninitialize(); } //----------------------------------------------------------------------------- // ウィンドウの初期化処理. //----------------------------------------------------------------------------- bool Application::InitWnd() { // インスタンスハンドルを取得. HINSTANCE hInst = GetModuleHandle( nullptr ); if ( !hInst ) { DLOG( "Error : GetModuleHandle() Failed. "); return false; } // アイコンなしの場合はロード. if ( m_hIcon == nullptr ) { // 最初にみつかったものをアイコンとして設定する. WCHAR exePath[MAX_PATH]; GetModuleFileName( NULL, exePath, MAX_PATH ); m_hIcon = ExtractIcon( hInst, exePath, 0 ); // それでも見つからなった場合. if (m_hIcon == nullptr) { m_hIcon = LoadIcon( hInst, IDI_APPLICATION ); } } // 拡張ウィンドウクラスの設定. WNDCLASSEXW wc; wc.cbSize = sizeof( WNDCLASSEXW ); wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = MsgProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = hInst; wc.hIcon = m_hIcon; wc.hCursor = LoadCursor( NULL, IDC_ARROW ); wc.hbrBackground = (HBRUSH)( COLOR_WINDOW + 1 ); wc.lpszMenuName = NULL; wc.lpszClassName = ASDX_WND_CLASSNAME; wc.hIconSm = m_hIcon; // ウィンドウクラスを登録します. if ( !RegisterClassExW( &wc ) ) { // エラーログ出力. DLOG( "Error : RegisterClassEx() Failed." ); // 異常終了. return false; } // インスタンスハンドルを設定. m_hInst = hInst; // 矩形の設定. RECT rc = { 0, 0, static_cast<LONG>(m_Width), static_cast<LONG>(m_Height) }; #if 0 // リサイズしたくない場合. //DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MAXIMIZEBOX | WS_MINIMIZEBOX; #else // リサイズ許可. DWORD style = WS_OVERLAPPEDWINDOW; #endif // 指定されたクライアント領域を確保するために必要なウィンドウ座標を計算します. AdjustWindowRect( &rc, style, FALSE ); // ウィンドウを生成します. m_hWnd = CreateWindowW( ASDX_WND_CLASSNAME, m_Title, style, CW_USEDEFAULT, CW_USEDEFAULT, ( rc.right - rc.left ), ( rc.bottom - rc.top ), NULL, m_hMenu, hInst, NULL ); // 生成チェック. if ( !m_hWnd ) { // エラーログ出力. DLOG( "Error : CreateWindow() Failed." ); // 異常終了. return false; } // アプリケーションリストに登録します. g_AppList.PushBack( this ); // タイマーを開始します. m_Timer.Start(); // 開始時刻を取得. m_LatestUpdateTime = m_Timer.GetElapsedSec(); // 正常終了. return true; } //----------------------------------------------------------------------------- // ウィンドウの終了処理. //----------------------------------------------------------------------------- void Application::TermWnd() { // タイマーを止めます. m_Timer.Stop(); // ウィンドウクラスの登録を解除. if ( m_hInst != nullptr ) { UnregisterClass( ASDX_WND_CLASSNAME, m_hInst ); } if ( m_hAccel ) { DestroyAcceleratorTable( m_hAccel ); } if ( m_hMenu ) { DestroyMenu( m_hMenu ); } if ( m_hIcon ) { DestroyIcon( m_hIcon ); } // タイトル名をクリア. m_Title = nullptr; // ハンドルをクリア. m_hInst = nullptr; m_hWnd = nullptr; m_hIcon = nullptr; m_hMenu = nullptr; m_hAccel = nullptr; // アプリケーションリストから削除します. g_AppList.Remove( this ); } //----------------------------------------------------------------------------- // Direct3Dの初期化処理. //----------------------------------------------------------------------------- bool Application::InitD3D() { HRESULT hr = S_OK; // ウィンドウサイズを取得します. RECT rc; GetClientRect( m_hWnd, &rc ); UINT w = rc.right - rc.left; UINT h = rc.bottom - rc.top; // 取得したサイズを設定します. m_Width = w; m_Height = h; // アスペクト比を算出します. m_AspectRatio = (FLOAT)w / (FLOAT)h; // デバイスの初期化. if (!SystemInit(m_DeviceDesc)) { ELOG("Error : GraphicsDeivce::Init() Failed."); return false; } auto isSRGB = IsSRGBFormat(m_SwapChainFormat); // スワップチェインの初期化 { DXGI_RATIONAL refreshRate; GetDisplayRefreshRate(refreshRate); // スワップチェインの構成設定. DXGI_SWAP_CHAIN_DESC1 desc = {}; desc.Width = w; desc.Height = h; desc.Format = GetNoSRGBFormat(m_SwapChainFormat); desc.Stereo = FALSE; desc.SampleDesc.Count = m_MultiSampleCount; desc.SampleDesc.Quality = m_MultiSampleQuality; desc.BufferCount = m_SwapChainCount; desc.Scaling = DXGI_SCALING_STRETCH; desc.SwapEffect = DXGI_SWAP_EFFECT_FLIP_DISCARD; desc.Flags = (m_AllowTearing) ? DXGI_SWAP_CHAIN_FLAG_ALLOW_TEARING : 0; DXGI_SWAP_CHAIN_FULLSCREEN_DESC fullScreenDesc = {}; fullScreenDesc.RefreshRate = refreshRate; fullScreenDesc.ScanlineOrdering = DXGI_MODE_SCANLINE_ORDER_UNSPECIFIED; fullScreenDesc.Scaling = DXGI_MODE_SCALING_STRETCHED; fullScreenDesc.Windowed = TRUE; RefPtr<IDXGISwapChain1> pSwapChain1; auto pQueue = GetGraphicsQueue()->GetQueue(); hr = GetDXGIFactory()->CreateSwapChainForHwnd(pQueue, m_hWnd, &desc, &fullScreenDesc, nullptr, pSwapChain1.GetAddress()); if (FAILED(hr)) { ELOG("Error : IDXGIFactory2::CreateSwapChainForHwnd() Failed. errcode = 0x%x", hr); return false; } if (m_AllowTearing) { GetDXGIFactory()->MakeWindowAssociation(m_hWnd, DXGI_MWA_NO_ALT_ENTER); } // IDXGISwapChain4にキャスト. hr = pSwapChain1->QueryInterface(IID_PPV_ARGS(m_pSwapChain4.GetAddress())); if ( FAILED( hr ) ) { m_pSwapChain4.Reset(); ELOG( "Warning : IDXGISwapChain4 Conversion Faild."); return false; } else { wchar_t name[] = L"asdxSwapChain4\0"; m_pSwapChain4->SetPrivateData(WKPDID_D3DDebugObjectNameW, sizeof(name), name); // HDR出力チェック. CheckSupportHDR(); } } // カラーターゲットの初期化. { m_ColorTarget.resize(m_SwapChainCount); for(auto i=0u; i<m_SwapChainCount; ++i) { if (!m_ColorTarget[i].Init(m_pSwapChain4.GetPtr(), i, isSRGB)) { ELOG("Error : ColorTarget::Init() Failed."); return false; } } } // 深度ターゲットの初期化. { TargetDesc desc; desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; desc.Alignment = 0; desc.Width = w; desc.Height = h; desc.DepthOrArraySize = 1; desc.MipLevels = 1; desc.Format = m_DepthStencilFormat; desc.SampleDesc.Count = 1; desc.SampleDesc.Quality = 0; desc.InitState = D3D12_RESOURCE_STATE_DEPTH_WRITE; if (!m_DepthTarget.Init(&desc)) { ELOG("Error : DepthTarget::Init() Failed."); return false; } } if (!m_GfxCmdList.Init(GetD3D12Device(), D3D12_COMMAND_LIST_TYPE_DIRECT)) { ELOG("Error : CommandList::Init() Failed."); return false; } if (!m_CopyCmdList.Init(GetD3D12Device(), D3D12_COMMAND_LIST_TYPE_COPY)) { ELOG("Error : CommandList::Init() Failed."); return false; } // ビューポートの設定. m_Viewport.Width = (FLOAT)w; m_Viewport.Height = (FLOAT)h; m_Viewport.MinDepth = 0.0f; m_Viewport.MaxDepth = 1.0f; m_Viewport.TopLeftX = 0; m_Viewport.TopLeftY = 0; // シザー矩形の設定. m_ScissorRect.left = 0; m_ScissorRect.right = w; m_ScissorRect.top = 0; m_ScissorRect.bottom = h; return true; } //----------------------------------------------------------------------------- // Direct3Dの終了処理. //----------------------------------------------------------------------------- void Application::TermD3D() { for(size_t i=0; i<m_ColorTarget.size(); ++i) { m_ColorTarget[i].Term(); } m_ColorTarget.clear(); m_DepthTarget.Term(); m_pSwapChain4.Reset(); m_CopyCmdList.Term(); m_GfxCmdList.Term(); SystemTerm(); } //----------------------------------------------------------------------------- // メインループ処理. //----------------------------------------------------------------------------- void Application::MainLoop() { MSG msg = { 0 }; FrameEventArgs frameEventArgs; auto frameCount = 0; while( WM_QUIT != msg.message ) { auto gotMsg = PeekMessage( &msg, nullptr, 0, 0, PM_REMOVE ); if ( gotMsg ) { auto ret = TranslateAccelerator( m_hWnd, m_hAccel, &msg ); if ( 0 == ret ) { TranslateMessage( &msg ); DispatchMessage( &msg ); } } else { double time; double absTime; double elapsedTime; // 時間を取得. m_Timer.GetValues( time, absTime, elapsedTime ); // 0.5秒ごとにFPSを更新. auto interval = float( time - m_LatestUpdateTime ); if ( interval > 0.5 ) { // FPSを算出. m_FPS = frameCount / interval; // 更新時間を設定. m_LatestUpdateTime = time; frameCount = 0; } frameEventArgs.FPS = 1.0f / (float)elapsedTime; // そのフレームにおけるFPS. frameEventArgs.Time = time; frameEventArgs.ElapsedTime = elapsedTime; frameEventArgs.IsStopDraw = m_IsStopRendering; // フレーム遷移処理. OnFrameMove( frameEventArgs ); // 描画停止フラグが立っていない場合. if ( !IsStopRendering() ) { // フレーム描画処理. OnFrameRender( frameEventArgs ); // フレームカウントをインクリメント. m_FrameCount++; } frameCount++; } } } //----------------------------------------------------------------------------- // アプリケーションを実行します. //----------------------------------------------------------------------------- void Application::Run() { // アプリケーションの初期化処理. if ( InitApp() ) { // メインループ処理. MainLoop(); } // アプリケーションの終了処理. TermApp(); } //----------------------------------------------------------------------------- // キーイベント処理. //----------------------------------------------------------------------------- void Application::KeyEvent( const KeyEventArgs& param ) { // キーイベント呼び出し. OnKey( param ); } //----------------------------------------------------------------------------- // リサイズイベント処理. //----------------------------------------------------------------------------- void Application::ResizeEvent( const ResizeEventArgs& param ) { if (m_pSwapChain4.GetPtr() == nullptr) { return; } if (m_ColorTarget.empty()) { return; } if (m_DepthTarget.GetResource() == nullptr) { return; } // マルチサンプル数以下になるとハングすることがあるので,処理をスキップする. if ( param.Width <= m_MultiSampleCount || param.Height <= m_MultiSampleCount) { return; } m_Width = param.Width; m_Height = param.Height; m_AspectRatio = param.AspectRatio; // ビューポートの設定. m_Viewport.Width = (FLOAT)m_Width; m_Viewport.Height = (FLOAT)m_Height; m_Viewport.MinDepth = 0.0f; m_Viewport.MaxDepth = 1.0f; m_Viewport.TopLeftX = 0; m_Viewport.TopLeftY = 0; // シザー矩形の設定. m_ScissorRect.left = 0; m_ScissorRect.right = m_Width; m_ScissorRect.top = 0; m_ScissorRect.bottom = m_Height; if ( m_pSwapChain4 != nullptr ) { // コマンドの完了を待機. SystemWaitIdle(); // 描画ターゲットを解放. for(size_t i=0; i<m_ColorTarget.size(); ++i) { m_ColorTarget[i].Term(); } // 深度ステンシルバッファを解放. m_DepthTarget.Term(); // 強制破棄. ClearDisposer(); HRESULT hr = S_OK; auto isSRGB = IsSRGBFormat(m_SwapChainFormat); auto format = GetNoSRGBFormat(m_SwapChainFormat); // バッファをリサイズ. hr = m_pSwapChain4->ResizeBuffers( m_SwapChainCount, m_Width, m_Height, format, 0 ); if ( FAILED( hr ) ) { DLOG( "Error : IDXGISwapChain::ResizeBuffer() Failed. errcode = 0x%x", hr ); } for(auto i=0u; i<m_SwapChainCount; ++i) { if (!m_ColorTarget[i].Init(m_pSwapChain4.GetPtr(), i, isSRGB)) { DLOG("Error : ColorTarget::Init() Failed."); } } TargetDesc desc; desc.Dimension = D3D12_RESOURCE_DIMENSION_TEXTURE2D; desc.Alignment = 0; desc.Width = m_Width; desc.Height = m_Height; desc.DepthOrArraySize = 1; desc.MipLevels = 1; desc.Format = m_DepthStencilFormat; desc.SampleDesc.Count = 1; desc.SampleDesc.Quality = 0; desc.InitState = D3D12_RESOURCE_STATE_DEPTH_WRITE; if ( !m_DepthTarget.Init(&desc)) { DLOG( "Error : DepthStencilTarget::Create() Failed." ); } } // リサイズイベント呼び出し. OnResize( param ); } //----------------------------------------------------------------------------- // マウスイベント処理. //----------------------------------------------------------------------------- void Application::MouseEvent( const MouseEventArgs& param ) { OnMouse( param ); } //----------------------------------------------------------------------------- // ドロップイベント処理. //------------------------------------------------------------------------------ void Application::DropEvent( const wchar_t** dropFiles, uint32_t fileNum ) { OnDrop( dropFiles, fileNum ); } //----------------------------------------------------------------------------- // ウィンドウプロシージャ. //----------------------------------------------------------------------------- LRESULT CALLBACK Application::MsgProc( HWND hWnd, UINT uMsg, WPARAM wp, LPARAM lp ) { PAINTSTRUCT ps; HDC hdc; if ( ( uMsg == WM_KEYDOWN ) || ( uMsg == WM_SYSKEYDOWN ) || ( uMsg == WM_KEYUP ) || ( uMsg == WM_SYSKEYUP ) ) { bool isKeyDown = ( uMsg == WM_KEYDOWN || uMsg == WM_SYSKEYDOWN ); DWORD mask = ( 1 << 29 ); bool isAltDown =( ( lp & mask ) != 0 ); KeyEventArgs args; args.KeyCode = uint32_t( wp ); args.IsAltDown = isAltDown; args.IsKeyDown = isKeyDown; for( ApplicationList::ListItr itr = g_AppList.Begin(); itr != g_AppList.End(); itr++ ) { (*itr)->KeyEvent( args ); } } // 古いWM_MOUSEWHEELの定義. const UINT OLD_WM_MOUSEWHEEL = 0x020A; if ( ( uMsg == WM_LBUTTONDOWN ) || ( uMsg == WM_LBUTTONUP ) || ( uMsg == WM_LBUTTONDBLCLK ) || ( uMsg == WM_MBUTTONDOWN ) || ( uMsg == WM_MBUTTONUP ) || ( uMsg == WM_MBUTTONDBLCLK ) || ( uMsg == WM_RBUTTONDOWN ) || ( uMsg == WM_RBUTTONUP ) || ( uMsg == WM_RBUTTONDBLCLK ) || ( uMsg == WM_XBUTTONDOWN ) || ( uMsg == WM_XBUTTONUP ) || ( uMsg == WM_XBUTTONDBLCLK ) || ( uMsg == WM_MOUSEHWHEEL ) // このWM_MOUSEWHEELは0x020Eを想定. || ( uMsg == WM_MOUSEMOVE ) || ( uMsg == OLD_WM_MOUSEWHEEL ) ) { int x = (short)LOWORD( lp ); int y = (short)HIWORD( lp ); int wheelDelta = 0; if ( ( uMsg == WM_MOUSEHWHEEL ) || ( uMsg == OLD_WM_MOUSEWHEEL ) ) { POINT pt; pt.x = x; pt.y = y; ScreenToClient( hWnd, &pt ); x = pt.x; y = pt.y; wheelDelta += (short)HIWORD( wp ); } int buttonState = LOWORD( wp ); bool isLeftButtonDown = ( ( buttonState & MK_LBUTTON ) != 0 ); bool isRightButtonDown = ( ( buttonState & MK_RBUTTON ) != 0 ); bool isMiddleButtonDown = ( ( buttonState & MK_MBUTTON ) != 0 ); bool isSideButton1Down = ( ( buttonState & MK_XBUTTON1 ) != 0 ); bool isSideButton2Down = ( ( buttonState & MK_XBUTTON2 ) != 0 ); MouseEventArgs args; args.X = x; args.Y = y; args.IsLeftButtonDown = isLeftButtonDown; args.IsMiddleButtonDown = isMiddleButtonDown; args.IsRightButtonDown = isRightButtonDown; args.IsSideButton1Down = isSideButton1Down; args.IsSideButton2Down = isSideButton2Down; for( ApplicationList::ListItr itr = g_AppList.Begin(); itr != g_AppList.End(); itr++ ) { (*itr)->MouseEvent( args ); } } switch( uMsg ) { case WM_CREATE: { // ドラッグアンドドロップ可能. DragAcceptFiles(hWnd, TRUE); } break; case WM_PAINT: { hdc = BeginPaint( hWnd, &ps ); EndPaint( hWnd, &ps ); } break; case WM_DESTROY: { PostQuitMessage( 0 ); } break; case WM_SIZE: { UINT w = (UINT)LOWORD( lp ); UINT h = (UINT)HIWORD( lp ); // ウインドウ非表示状態に移行する時に縦横1ピクセルのリサイズイベントが発行される // マルチサンプル等の関係で縦横1ピクセルは問題が起こるので最少サイズを設定 ResizeEventArgs args; args.Width = asdx::Max( w, (uint32_t)8 ); args.Height = asdx::Max( h, (uint32_t)8 ); args.AspectRatio = float( args.Width ) / args.Height; for( ApplicationList::ListItr itr = g_AppList.Begin(); itr != g_AppList.End(); itr++ ) { (*itr)->ResizeEvent( args ); } } break; case WM_DROPFILES: { // ドロップされたファイル数を取得. uint32_t numFiles = DragQueryFileW((HDROP)wp, 0xFFFFFFFF, NULL, 0); // 作業用のバッファを確保. const WCHAR** dropFiles = new const WCHAR*[ numFiles ]; for (uint32_t i=0; i < numFiles; i++) { // ドロップされたファイル名を取得. WCHAR* dropFile = new WCHAR[ MAX_PATH ]; DragQueryFileW((HDROP)wp, i, dropFile, MAX_PATH); dropFiles[ i ] = dropFile; } // アプリケーションに通知. for( ApplicationList::ListItr itr = g_AppList.Begin(); itr != g_AppList.End(); itr++ ) { (*itr)->DropEvent( dropFiles, numFiles ); } // 作業用のバッファを解放. for (uint32_t i=0; i < numFiles; i++) { SafeDelete( dropFiles[ i ] ); } SafeDelete( dropFiles ); DragFinish((HDROP)wp); } break; case WM_MOVE: { for( ApplicationList::ListItr itr = g_AppList.Begin(); itr != g_AppList.End(); itr++ ) { (*itr)->CheckSupportHDR(); } } break; case WM_DISPLAYCHANGE: { for( ApplicationList::ListItr itr = g_AppList.Begin(); itr != g_AppList.End(); itr++ ) { (*itr)->CheckSupportHDR(); } } break; case WM_CHAR: { auto keyCode = static_cast<uint32_t>( wp ); for( ApplicationList::ListItr itr = g_AppList.Begin(); itr != g_AppList.End(); itr++ ) { (*itr)->OnTyping( keyCode ); } } break; //case MM_MCINOTIFY: // { // // サウンドマネージャのコールバック. // SndMgr::GetInstance().OnNofity( (uint32_t)lp, (uint32_t)wp ); // } // break; } // ユーザーカスタマイズ用に呼び出し. for( ApplicationList::ListItr itr = g_AppList.Begin(); itr != g_AppList.End(); itr++ ) { (*itr)->OnMsgProc( hWnd, uMsg, wp, lp ); } return DefWindowProc( hWnd, uMsg, wp, lp ); } //----------------------------------------------------------------------------- // 初期化時の処理. //----------------------------------------------------------------------------- bool Application::OnInit() { /* DO_NOTHING */ return true; } //----------------------------------------------------------------------------- // 終了時の処理. //----------------------------------------------------------------------------- void Application::OnTerm() { /* DO_NOTHING */ } //----------------------------------------------------------------------------- // フレーム遷移時の処理. //----------------------------------------------------------------------------- void Application::OnFrameMove( FrameEventArgs& ) { /* DO_NOTHING */ } //----------------------------------------------------------------------------- // フレーム描画字の処理. //----------------------------------------------------------------------------- void Application::OnFrameRender( FrameEventArgs& ) { /* DO_NOTHING */ } //----------------------------------------------------------------------------- // コマンドを実行して,画面に表示します. //----------------------------------------------------------------------------- void Application::Present( uint32_t syncInterval ) { HRESULT hr = S_OK; // スタンバイモードかどうかチェック. if ( m_IsStandbyMode ) { // テストする. hr = m_pSwapChain4->Present( syncInterval, DXGI_PRESENT_TEST ); // スタンバイモードが解除されたかをチェック. if ( hr == S_OK ) { m_IsStandbyMode = false; } // 処理を中断. return; } // 画面更新する. hr = m_pSwapChain4->Present( syncInterval, 0 ); switch( hr ) { // デバイスがリセットされた場合(=コマンドが正しくない場合) case DXGI_ERROR_DEVICE_RESET: { // エラーログ出力. ELOG( "Fatal Error : IDXGISwapChain::Present() Failed. ErrorCode = DXGI_ERROR_DEVICE_RESET." ); // エラー表示. DeviceRemovedHandler(GetD3D12Device()); // 続行できないのでダイアログを表示. MessageBoxW( m_hWnd, L"A Fatal Error Occured. Shutting down.", L"FATAL ERROR", MB_OK | MB_ICONERROR ); // 終了メッセージを送る. PostQuitMessage( 1 ); } break; // デバイスが削除された場合(=GPUがぶっこ抜かれた場合かドライバーアップデート中,またはGPUクラッシュ時.) case DXGI_ERROR_DEVICE_REMOVED: { // エラーログ出力. ELOG( "Fatal Error : IDXGISwapChain::Present() Failed. ErrorCode = DXGI_ERROR_DEVICE_REMOVED." ); // エラー表示. DeviceRemovedHandler(GetD3D12Device()); // 続行できないのでダイアログを表示. MessageBoxW( m_hWnd, L"A Fatal Error Occured. Shutting down.", L"FATAL ERROR", MB_OK | MB_ICONERROR ); // 終了メッセージを送る. PostQuitMessage( 2 ); } break; // 表示領域がなければスタンバイモードに入る. case DXGI_STATUS_OCCLUDED: { m_IsStandbyMode = true; } break; // 現在のフレームバッファを表示する場合. case S_OK: { /* DO_NOTHING */ } break; } } //----------------------------------------------------------------------------- // ディスプレイがHDR出力をサポートしているかどうかチェックします. //----------------------------------------------------------------------------- void Application::CheckSupportHDR() { HRESULT hr = S_OK; // ウィンドウ領域を取得. RECT rect; GetWindowRect(m_hWnd, &rect); RefPtr<IDXGIAdapter1> pAdapter; hr = GetDXGIFactory()->EnumAdapters1(0, pAdapter.GetAddress()); if (FAILED(hr)) { ELOG("Error : IDXGIFactory1::EnumAdapters1() Failed."); return; } UINT i = 0; RefPtr<IDXGIOutput> currentOutput; RefPtr<IDXGIOutput> bestOutput; int bestIntersectArea = -1; // 各ディスプレイを調べる. while (pAdapter->EnumOutputs(i, currentOutput.ReleaseAndGetAddress()) != DXGI_ERROR_NOT_FOUND) { auto ax1 = rect.left; auto ay1 = rect.top; auto ax2 = rect.right; auto ay2 = rect.bottom; // ディスプレイの設定を取得. DXGI_OUTPUT_DESC desc; hr = currentOutput->GetDesc(&desc); if (FAILED(hr)) { return; } auto bx1 = desc.DesktopCoordinates.left; auto by1 = desc.DesktopCoordinates.top; auto bx2 = desc.DesktopCoordinates.right; auto by2 = desc.DesktopCoordinates.bottom; // 領域が一致するかどうか調べる. int intersectArea = ComputeIntersectionArea(ax1, ay1, ax2, ay2, bx1, by1, bx2, by2); if (intersectArea > bestIntersectArea) { bestOutput = currentOutput; bestIntersectArea = intersectArea; } i++; } // 一番適しているディスプレイ. RefPtr<IDXGIOutput6> pOutput6; hr = bestOutput->QueryInterface(IID_PPV_ARGS(pOutput6.GetAddress())); if (FAILED(hr)) { ELOG("Error : IDXGIOutput6 Conversion Failed."); return; } // 出力設定を取得. hr = pOutput6->GetDesc1(&m_DisplayDesc); if (FAILED(hr)) { ELOG("Error : IDXGIOutput6::GetDesc() Failed."); return; } // 正常終了. } //----------------------------------------------------------------------------- // HDR出力をサポートしているかどうかチェックします. //----------------------------------------------------------------------------- bool Application::IsSupportHDR() const { return m_DisplayDesc.ColorSpace == DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020; } //----------------------------------------------------------------------------- // ディスプレイ設定を取得します. //----------------------------------------------------------------------------- DXGI_OUTPUT_DESC1 Application::GetDisplayDesc() const { return m_DisplayDesc; } //----------------------------------------------------------------------------- // 色空間を設定します //----------------------------------------------------------------------------- bool Application::SetColorSpace(COLOR_SPACE value) { if (m_pSwapChain4.GetPtr() == nullptr) { return false; } DXGI_HDR_METADATA_HDR10 metaData = {}; DXGI_COLOR_SPACE_TYPE colorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; metaData.MinMasteringLuminance = GetLuma(m_DisplayDesc.MinLuminance); metaData.MaxMasteringLuminance = GetLuma(m_DisplayDesc.MaxLuminance); switch (value) { case COLOR_SPACE_NONE: { colorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; metaData.RedPrimary[0] = GetCoord(m_DisplayDesc.RedPrimary[0]); metaData.RedPrimary[1] = GetCoord(m_DisplayDesc.RedPrimary[1]); metaData.GreenPrimary[0] = GetCoord(m_DisplayDesc.GreenPrimary[0]); metaData.GreenPrimary[1] = GetCoord(m_DisplayDesc.GreenPrimary[1]); metaData.BluePrimary[0] = GetCoord(m_DisplayDesc.BluePrimary[0]); metaData.BluePrimary[1] = GetCoord(m_DisplayDesc.BluePrimary[1]); metaData.WhitePoint[0] = GetCoord(m_DisplayDesc.WhitePoint[0]); metaData.WhitePoint[1] = GetCoord(m_DisplayDesc.WhitePoint[1]); } break; case COLOR_SPACE_SRGB: { colorSpace = DXGI_COLOR_SPACE_RGB_FULL_G22_NONE_P709; metaData.RedPrimary[0] = GetCoord(0.64000f); metaData.RedPrimary[1] = GetCoord(0.33000f); metaData.GreenPrimary[0] = GetCoord(0.30000f); metaData.GreenPrimary[1] = GetCoord(0.60000f); metaData.BluePrimary[0] = GetCoord(0.15000f); metaData.BluePrimary[1] = GetCoord(0.06000f); metaData.WhitePoint[0] = GetCoord(0.31270f); metaData.WhitePoint[1] = GetCoord(0.32900f); } break; case COLOR_SPACE_BT709: { colorSpace = DXGI_COLOR_SPACE_RGB_STUDIO_G24_NONE_P709; metaData.RedPrimary[0] = GetCoord(0.64000f); metaData.RedPrimary[1] = GetCoord(0.33000f); metaData.GreenPrimary[0] = GetCoord(0.30000f); metaData.GreenPrimary[1] = GetCoord(0.60000f); metaData.BluePrimary[0] = GetCoord(0.15000f); metaData.BluePrimary[1] = GetCoord(0.06000f); metaData.WhitePoint[0] = GetCoord(0.31270f); metaData.WhitePoint[1] = GetCoord(0.32900f); } break; case COLOR_SPACE_BT2100_PQ: { colorSpace = DXGI_COLOR_SPACE_RGB_FULL_G2084_NONE_P2020; metaData.RedPrimary[0] = GetCoord(0.70800f); metaData.RedPrimary[1] = GetCoord(0.29200f); metaData.GreenPrimary[0] = GetCoord(0.17000f); metaData.GreenPrimary[1] = GetCoord(0.79700f); metaData.BluePrimary[0] = GetCoord(0.13100f); metaData.BluePrimary[1] = GetCoord(0.04600f); metaData.WhitePoint[0] = GetCoord(0.31270f); metaData.WhitePoint[1] = GetCoord(0.32900f); } break; case COLOR_SPACE_BT2100_HLG: { colorSpace = DXGI_COLOR_SPACE_YCBCR_FULL_GHLG_TOPLEFT_P2020; metaData.RedPrimary[0] = GetCoord(0.70800f); metaData.RedPrimary[1] = GetCoord(0.29200f); metaData.GreenPrimary[0] = GetCoord(0.17000f); metaData.GreenPrimary[1] = GetCoord(0.79700f); metaData.BluePrimary[0] = GetCoord(0.13100f); metaData.BluePrimary[1] = GetCoord(0.04600f); metaData.WhitePoint[0] = GetCoord(0.31270f); metaData.WhitePoint[1] = GetCoord(0.32900f); } break; } UINT flag = 0; auto hr = m_pSwapChain4->CheckColorSpaceSupport(colorSpace, &flag); if (FAILED(hr)) { ELOG("Error : ISwapChain4::CheckColorSpaceSupport() Failed. errcode = 0x%x", hr); return false; } if ((flag & DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT) != DXGI_SWAP_CHAIN_COLOR_SPACE_SUPPORT_FLAG_PRESENT) { return false; } hr = m_pSwapChain4->SetHDRMetaData(DXGI_HDR_METADATA_TYPE_HDR10, sizeof(metaData), &metaData); if (FAILED(hr)) { ELOG("Error : ISwapChain4::SetHDRMetaData() Failed. errcode = 0x%x", hr); return false; } hr = m_pSwapChain4->SetColorSpace1(colorSpace); if (FAILED(hr)) { ELOG("Error : ISwapChain4::SetColorSpace1() Failed. errcode = 0x%x", hr); return false; } return true; } //----------------------------------------------------------------------------- // ディスプレイのリフレッシュレートを取得します. //----------------------------------------------------------------------------- bool Application::GetDisplayRefreshRate(DXGI_RATIONAL& result) const { auto hMonitor = MonitorFromWindow(m_hWnd, MONITOR_DEFAULTTONEAREST); MONITORINFOEX monitorInfo; monitorInfo.cbSize = sizeof(monitorInfo); auto ret = GetMonitorInfo(hMonitor, &monitorInfo); if (ret == 0) { ELOG("Error : GetMonitorInfo() Failed."); return false; } DEVMODE devMode; devMode.dmSize = sizeof(devMode); devMode.dmDriverExtra = 0; ret = EnumDisplaySettings(monitorInfo.szDevice, ENUM_CURRENT_SETTINGS, &devMode); if (ret == 0) { ELOG("Error : EnumDisplaySettings() Failed."); return false; } auto useDefaultRefreshRate = (1 == devMode.dmDisplayFrequency) || (0 == devMode.dmDisplayFrequency); result.Numerator = (useDefaultRefreshRate) ? 0 : devMode.dmDisplayFrequency; result.Denominator = (useDefaultRefreshRate) ? 0 : 1; return true; } //----------------------------------------------------------------------------- // スワップチェインのバックバッファ番号を取得します. //----------------------------------------------------------------------------- uint32_t Application::GetCurrentBackBufferIndex() const { if (m_pSwapChain4.GetPtr() == nullptr) { return 0; } return m_pSwapChain4->GetCurrentBackBufferIndex(); } //----------------------------------------------------------------------------- // リサイズ時の処理. //----------------------------------------------------------------------------- void Application::OnResize( const ResizeEventArgs& ) { /* DO_NOTHING */ } //----------------------------------------------------------------------------- // キーイベント時の処理. //----------------------------------------------------------------------------- void Application::OnKey( const KeyEventArgs& ) { /* DO_NOTHING */ } //----------------------------------------------------------------------------- // マウスイベント時の処理. //----------------------------------------------------------------------------- void Application::OnMouse( const MouseEventArgs& ) { /* DO_NOTHING */ } //----------------------------------------------------------------------------- // タイピングイベント時の処理. //----------------------------------------------------------------------------- void Application::OnTyping( uint32_t ) { /* DO_NOTHING */ } //----------------------------------------------------------------------------- // ドロップ時の処理. //------------------------------------------------------------------------------ void Application::OnDrop( const wchar_t**, uint32_t ) { /* DO_NOTHING */ } //----------------------------------------------------------------------------- // メッセージプロシージャの処理. //----------------------------------------------------------------------------- void Application::OnMsgProc( HWND, UINT, WPARAM, LPARAM ) { /* DO_NOTHING */ } //----------------------------------------------------------------------------- // フォーカスを持つかどうか判定します. //----------------------------------------------------------------------------- bool Application::HasFocus() const { return ( GetActiveWindow() == m_hWnd ); } //------------------------------------------------------------------------------ // スタンバイモードかどうかチェックします. //------------------------------------------------------------------------------ bool Application::IsStandByMode() const { return m_IsStandbyMode; } } // namespace asdx
32.980545
132
0.450718
ProjectAsura
22baf5c6472ce3fb08d66673fcc75c6206009eb6
727
cpp
C++
src/ofxPixelObject.cpp
BlueJayLouche/ofxSACN_led_mapper
a8f889c78d654c16fe4acae1b98b26e266707257
[ "MIT" ]
null
null
null
src/ofxPixelObject.cpp
BlueJayLouche/ofxSACN_led_mapper
a8f889c78d654c16fe4acae1b98b26e266707257
[ "MIT" ]
null
null
null
src/ofxPixelObject.cpp
BlueJayLouche/ofxSACN_led_mapper
a8f889c78d654c16fe4acae1b98b26e266707257
[ "MIT" ]
null
null
null
// // ofxPixelObject.cpp // sACN_Mapped // // Created by bluejaylouche on 19/7/21. // // Adapted from: https://github.com/DHaylock/ofxOPC #include "ofxPixelObject.hpp" //-------------------------------------------------------------- vector <ofColor> ofxPixelObject::colorData() { // Transmit Data return colors; } //-------------------------------------------------------------- vector<glm::vec2> ofxPixelObject::getPixelCoordinates() { colors.clear(); return pos; } //-------------------------------------------------------------- void ofxPixelObject::drawGrabRegion(bool hideArea) { } //-------------------------------------------------------------- void ofxPixelObject::draw(int x, int y) { }
22.71875
64
0.440165
BlueJayLouche