hexsha stringlengths 40 40 | size int64 19 11.4M | ext stringclasses 13
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 270 | max_stars_repo_name stringlengths 5 110 | max_stars_repo_head_hexsha stringlengths 40 40 | max_stars_repo_licenses listlengths 1 9 | max_stars_count float64 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 3 270 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 9 | max_issues_count float64 1 67k ⌀ | 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 3 270 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 9 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 19 11.4M | avg_line_length float64 1.93 229k | max_line_length int64 12 688k | alphanum_fraction float64 0.07 0.99 | matches listlengths 1 10 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
052af606b815e04b09750b243038edb8a78cac6a | 1,358 | cpp | C++ | atcoder/corp/codefes2016_fd.cpp | knuu/competitive-programming | 16bc68fdaedd6f96ae24310d697585ca8836ab6e | [
"MIT"
] | 1 | 2018-11-12T15:18:55.000Z | 2018-11-12T15:18:55.000Z | atcoder/corp/codefes2016_fd.cpp | knuu/competitive-programming | 16bc68fdaedd6f96ae24310d697585ca8836ab6e | [
"MIT"
] | null | null | null | atcoder/corp/codefes2016_fd.cpp | knuu/competitive-programming | 16bc68fdaedd6f96ae24310d697585ca8836ab6e | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
typedef pair<ll, ll> Pll;
typedef vector<int> Vi;
//typedef tuple<int, int, int> T;
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++)
#define REP(i,x) FOR(i,0,x)
#define ALL(c) c.begin(), c.end()
#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
const int dr[4] = {-1, 0, 1, 0};
const int dc[4] = {0, 1, 0, -1};
int main() {
// use scanf in CodeForces!
cin.tie(0);
ios_base::sync_with_stdio(false);
int N, M; cin >> N >> M;
vector<int> X(N); REP(i, N) cin >> X[i];
vector<int> counter(100010, 0);
for (int x : X) counter[x]++;
vector<vector<int>> mod_counter(M, vector<int>(2, 0));
REP(i, 100001) {
mod_counter[i % M][0] += counter[i] % 2;
mod_counter[i % M][1] += counter[i] / 2;
}
int ans = mod_counter[0][0] / 2 + mod_counter[0][1];
if (M % 2 == 0) ans += mod_counter[M / 2][0] / 2 + mod_counter[M / 2][1];
for (int i = 1, j = M - 1; i < j; i++, j--) {
int p = min(mod_counter[i][0], mod_counter[j][0]);
ans += p;
mod_counter[i][0] -= p, mod_counter[j][0] -= p;
int res1 = min(mod_counter[i][1], mod_counter[j][0] / 2);
ans += res1 + mod_counter[i][1];
int res2 = min(mod_counter[j][1], mod_counter[i][0] / 2);
ans += res2 + mod_counter[j][1];
}
cout << ans << endl;
return 0;
}
| 27.714286 | 75 | 0.553019 | [
"vector"
] |
052e325190079a160705d56839b297c94585c923 | 473 | cpp | C++ | 0001-0100/0078.cpp | YKR/LeetCode2019 | e4c6346eae5c7b85ba53249c46051700a73dd95e | [
"MIT"
] | null | null | null | 0001-0100/0078.cpp | YKR/LeetCode2019 | e4c6346eae5c7b85ba53249c46051700a73dd95e | [
"MIT"
] | null | null | null | 0001-0100/0078.cpp | YKR/LeetCode2019 | e4c6346eae5c7b85ba53249c46051700a73dd95e | [
"MIT"
] | null | null | null | class Solution {
public:
vector<vector<int>> ret;
vector<int> cur;
void recurse(vector<int> & nums, int curp)
{
if (curp == nums.size())
{
ret.push_back(cur);
return;
}
recurse(nums, curp + 1);
cur.push_back(nums[curp]);
recurse(nums, curp + 1);
cur.pop_back();
}
vector<vector<int>> subsets(vector<int>& nums) {
recurse(nums, 0);
return ret;
}
}; | 20.565217 | 52 | 0.494715 | [
"vector"
] |
05311f3eb4e3403b72ad251e0f8c5785efa63a58 | 13,983 | cpp | C++ | src/ukf.cpp | bilalelsheemy/bilalelsheemy-Object-Tracking-in-2D-Using-Unscented-Kalman-Filter | a40004b0abac77d4f5b199120d00e37ea170e5dc | [
"MIT"
] | null | null | null | src/ukf.cpp | bilalelsheemy/bilalelsheemy-Object-Tracking-in-2D-Using-Unscented-Kalman-Filter | a40004b0abac77d4f5b199120d00e37ea170e5dc | [
"MIT"
] | null | null | null | src/ukf.cpp | bilalelsheemy/bilalelsheemy-Object-Tracking-in-2D-Using-Unscented-Kalman-Filter | a40004b0abac77d4f5b199120d00e37ea170e5dc | [
"MIT"
] | null | null | null | #include "ukf.h"
#include "Eigen/Dense"
#include <iostream>
using namespace std;
using Eigen::MatrixXd;
using Eigen::VectorXd;
using std::vector;
/**
* Initializing Unscented Kalman filter parameters
* This is scaffolding, do not modify
*/
UKF::UKF() {
// set it initially to false
is_initialized_ = false;
// if this is false, laser measurements will be ignored (except during init)
use_laser_ = true;
// if this is false, radar measurements will be ignored (except during init)
use_radar_ = true;
// time stamp initialization
time_us_ = 0;
// Process noise standard deviation longitudinal acceleration in m/s^2 (This value is tunable)
std_a_ = 1;
// Process noise standard deviation yaw acceleration in rad/s^2 (This value is tunable)
std_yawdd_ = 0.3;
//DO NOT MODIFY measurement noise values below these are provided by the sensor manufacturer.
// Laser measurement noise standard deviation position1 in m
std_laspx_ = 0.15;
// Laser measurement noise standard deviation position2 in m
std_laspy_ = 0.15;
// Radar measurement noise standard deviation radius in m
std_radr_ = 0.3;
// Radar measurement noise standard deviation angle in rad
std_radphi_ = 0.03;
// Radar measurement noise standard deviation radius change in m/s
std_radrd_ = 0.3;
//DO NOT MODIFY measurement noise values above these are provided by the sensor manufacturer.
/**
TODO:
Complete the initialization. See ukf.h for other member properties.
Hint: one or more values initialized above might be wildly off...
*/
//Initializing number of state vector length
n_x_ = 5;
//Initializing number of augmented state vector length
n_aug_ = 7;
// Initializing spreading parameter lambda
lambda_ = 3 - n_aug_;
// Declaring state vector and augmented state vector
x_ = VectorXd::Zero(5);
// initial covariance matrix and augmented covariance matrix
P_ = MatrixXd::Zero(5, 5);
// Calculating Sigma points weights
weights_ = VectorXd::Zero(2*n_aug_+1);
double weight_0 = lambda_/(lambda_+n_aug_);
weights_(0) = weight_0;
for (int i=1; i<2*n_aug_+1; i++)
{ //2n+1 weights
double weight = 0.5/(n_aug_+lambda_);
weights_(i) = weight;
}
// Current NIS for radar
NIS_radar_ = 0.0;
// Current NIS for laser
NIS_laser_ = 0.0;
}
UKF::~UKF() {}
// Creating UKF instance to use it in the Initialization, Prediction and Updating
//UKF ukf_;
/**
* @param {MeasurementPackage} meas_package The latest measurement data of
* either radar or laser.
*/
void UKF::ProcessMeasurement(MeasurementPackage meas_package){
/**
TODO:
Complete this function! Make sure you switch between lidar and radar
measurements.
*/
// skip processing if the both sensors are ignored
if ((meas_package.sensor_type_ == MeasurementPackage::RADAR && use_radar_) ||
(meas_package.sensor_type_ == MeasurementPackage::LASER && use_laser_))
{
double delta_t;
// Updating timestamp
delta_t = (meas_package.timestamp_ - time_us_)/1000000.0;
time_us_ = meas_package.timestamp_;
if (is_initialized_ != true)
{
// Initlaizing delta_t
delta_t = 0.05;
// State vector initialization
if (meas_package.sensor_type_ == MeasurementPackage::RADAR && use_radar_)
{
double rho = meas_package.raw_measurements_(0);
double phi = meas_package.raw_measurements_(1);
x_ << rho*cos(phi),
rho*sin(phi),
1,
1,
0.1;
// skip initialization step in the next times
is_initialized_ = true;
}
else if(meas_package.sensor_type_ == MeasurementPackage::LASER && use_laser_)
{
x_ << meas_package.raw_measurements_(0),
meas_package.raw_measurements_(1),
1,
1,
0;
// skip initialization step in the next times
is_initialized_ = true;
}
// Process covariance initialization
P_ << 0.15,0,0,0,0,
0,0.15,0,0,0,
0,0,1,0,0,
0,0,0,1,0,
0,0,0,0,1;
return;
}
///* For normal case (Not initializing case)
// Prediction step
Prediction(delta_t);
// State update using Laser sensor readings
if(use_laser_ == true && meas_package.sensor_type_ == MeasurementPackage::LASER)
{
UpdateLidar(meas_package);
}
//// State update using Radar sensor readings
if(use_radar_ == true && meas_package.sensor_type_ == MeasurementPackage::RADAR)
{
UpdateRadar(meas_package);
}
}
else
{
return;
}
}
/**
* Predicts sigma points, the state, and the state covariance matrix.
* @param {double} delta_t the change in time (in seconds) between the last
* measurement and this one.
*/
void UKF::Prediction(double delta_t) {
/**
TODO:
Complete this function! Estimate the object's location. Modify the state
vector, x_. Predict sigma points, the state, and the state covariance matrix.
*/
VectorXd state_update = VectorXd::Zero(5);
MatrixXd P_root;
double px;
double py;
double vel;
double yaw;
double yawrate;
double nu_a;
double nu_yawacc;
double px_update;
double py_update;
double vel_update;
double yaw_update;
double yawrate_update;
//1- calculating augmented mean state
x_aug = VectorXd::Zero(n_aug_);
x_aug.head(5) = x_;
x_aug(5) = 0;
x_aug(6) = 0;
//1- calculating augmented covariance matrix
P_aug = MatrixXd::Zero(n_aug_, n_aug_);
P_aug.topLeftCorner(n_x_,n_x_) = P_;
P_aug(5,5) = std_a_*std_a_;
P_aug(6,6) = std_yawdd_*std_yawdd_;
// Calculating the square root of the process noise
P_root = P_aug.llt().matrixL();
// Generate the sigma points for the initialized state
MatrixXd Xsig_aug = MatrixXd::Zero(n_aug_, 2*n_aug_+1);
Xsig_aug.col(0) = x_aug;
for (int i=0; i<n_aug_; i++)
{
Xsig_aug.col(i+1) = (x_aug + (sqrt(lambda_+n_aug_) * P_root.col(i)));
Xsig_aug.col(i+1 + n_aug_) = (x_aug - (sqrt(lambda_+n_aug_) * P_root.col(i)));
}
// Plugging the generated Sigma points to the model to predict the new mean state & its covariance
Xsig_pred_ = MatrixXd::Zero(5, 2*n_aug_+1);
for(int i =0; i < (2*n_aug_ +1); i++)
{
px = Xsig_aug(0, i);
py = Xsig_aug(1, i);
vel = Xsig_aug(2, i);
yaw = Xsig_aug(3, i);
yawrate = Xsig_aug(4, i);
nu_a = Xsig_aug(5, i);
nu_yawacc = Xsig_aug(6, i);
//avoid division by zero
if (fabs(yawrate) > 0.001) {
px_update = px + (vel/yawrate)*(sin(yaw+yawrate*delta_t) - sin(yaw)) + (0.5*(delta_t*delta_t)*cos(yaw)*nu_a);
py_update = py + (vel/yawrate)*(-cos(yaw+yawrate*delta_t) + cos(yaw)) + (0.5*(delta_t*delta_t)*sin(yaw)*nu_a);
}
else {
px_update = px + (vel*cos(yaw)*delta_t) + (0.5*(delta_t*delta_t)*cos(yaw)*nu_a);
py_update = py + (vel*sin(yaw)*delta_t) + (0.5*(delta_t*delta_t)*sin(yaw)*nu_a);
}
vel_update = vel + (delta_t*nu_a);
yaw_update = yaw + (yawrate*delta_t) + (0.5*(delta_t*delta_t)*nu_yawacc);
yawrate_update = yawrate + delta_t*nu_yawacc;
// Predicting new state sigma points
Xsig_pred_.col(i) << px_update,
py_update,
vel_update,
yaw_update,
yawrate_update;
}
// Predict state mean
x_.fill(0.0);
for (int i = 0; i < 2 * n_aug_ + 1; i++) //iterate over sigma points
{
x_ = x_+ weights_(i) * Xsig_pred_.col(i);
}
// Predicted state covariance matrix
P_.fill(0.0);
for (int i = 0; i < 2 * n_aug_ + 1; i++) //iterate over sigma points
{
// State difference
VectorXd x_diff = VectorXd::Zero(3);
x_diff = Xsig_pred_.col(i) - x_;
// Phi angle normalization
if(x_diff(3) > M_PI) x_diff(3)-=2.*M_PI;
if(x_diff(3) < -M_PI) x_diff(3)+=2.*M_PI;
P_ = P_ + weights_(i) * x_diff * x_diff.transpose() ;
}
}
void UKF::UpdateLidar(MeasurementPackage meas_package) {
/**
TODO:
Complete this function! Use lidar data to update the belief about the object's
position. Modify the state vector, x_, and covariance, P_.
You'll also need to calculate the lidar NIS.
*/
/**
TODO:
* update the state by using Kalman Filter equations
*/
double px_meas, py_meas, px, py;
px_meas = meas_package.raw_measurements_(0);
py_meas = meas_package.raw_measurements_(1);
VectorXd lidar_meas = VectorXd::Zero(2);
lidar_meas << px_meas,
py_meas;
MatrixXd Zsig = MatrixXd::Zero(2, 2*n_aug_+1);
// Using the Predicted Sigma points from the state space to fill the measurement space sigma points.
for (int i=0; i<(2*n_aug_ +1); i++)
{
px = Xsig_pred_(0, i);
py = Xsig_pred_(1, i);
Zsig(0, i) = px;
Zsig(1, i) = py;
}
// Calculate Measurement mean and covariance
VectorXd lidarmeas_mean = VectorXd::Zero(2);
MatrixXd lidarmeas_covariance = MatrixXd::Zero(2,2);
VectorXd Z_diff = VectorXd::Zero(2);
// Cross correlation betweem sigma points in both state and measurement spaces
MatrixXd Tsig_cross = MatrixXd::Zero(5,2);
// Laser Measurement Mean
for (int i=0; i<(2*n_aug_ +1); i++)
{
lidarmeas_mean = lidarmeas_mean + (weights_(i) * Zsig.col(i));
}
// Measurement Covariance
for (int i=0; i<(2*n_aug_ +1); i++)
{
Z_diff = Zsig.col(i) - lidarmeas_mean;
lidarmeas_covariance = lidarmeas_covariance + (weights_(i) * (Z_diff) * (Z_diff.transpose()));
}
// Adding the radar measurement linear noise
MatrixXd laser_noise_cov(2,2);
laser_noise_cov << std_laspx_*std_laspx_, 0,
0, std_laspy_*std_laspy_;
lidarmeas_covariance = lidarmeas_covariance + laser_noise_cov;
// Cross-correlation between measurement & state spaces sigma points
Z_diff.fill(0.0);
for (int i=0; i<(2*n_aug_ +1); i++)
{
Z_diff = Zsig.col(i) - lidarmeas_mean;
Tsig_cross = Tsig_cross + (weights_(i) * (Xsig_pred_.col(i) - x_) * (Z_diff.transpose()));
}
// State mean & covariance update due to new Radar measurements
// 1- Kalman Gain calculation
MatrixXd KG = MatrixXd::Zero(5,2);
KG = Tsig_cross * lidarmeas_covariance.inverse();
// Measurement Difference
VectorXd meas_diff = VectorXd::Zero(3);
meas_diff = lidar_meas - lidarmeas_mean;
// LIDAR NIS
NIS_laser_ = meas_diff.transpose() * lidarmeas_covariance.inverse() * meas_diff;
// State Mean Update
x_ = x_ + KG * (meas_diff);
// State Covariance Update
P_ = P_ - (KG * lidarmeas_covariance * KG.transpose());
}
void UKF::UpdateRadar(MeasurementPackage meas_package) {
/**
TODO:
Complete this function! Use radar data to update the belief about the object's
position. Modify the state vector, x_, and covariance, P_.
You'll also need to calculate the radar NIS.
*/
// Update radar_meas with the new measurements
double rho_meas = meas_package.raw_measurements_(0);
double phi_meas = meas_package.raw_measurements_(1);
double rhorate_meas = meas_package.raw_measurements_(2);
VectorXd radar_meas = VectorXd::Zero(3);
radar_meas << rho_meas,
phi_meas,
rhorate_meas;
// Calculate rho, phi, rhorate as per the predicted Sigma points in order to compare them with the new measurement
//to calculate the measurement covariance matrix then.
double px, py, vel, yaw;
double rho, phi, rho_rate;
MatrixXd Zsig = MatrixXd::Zero(3, 2*n_aug_+1);
// Using the Predicted Sigma points from the state space to fill the measurement space sigma points.
for (int i=0; i<(2*n_aug_ +1); i++)
{
px = Xsig_pred_(0, i);
py = Xsig_pred_(1, i);
vel = Xsig_pred_(2, i);
yaw = Xsig_pred_(3, i);
rho = sqrt((px*px) + (py*py));
phi = atan2(py,px);
rho_rate = (((px*cos(yaw)*vel)+(py*sin(yaw)*vel))/(sqrt((px*px) + (py*py))));
Zsig(0, i) = rho;
Zsig(1, i) = phi;
Zsig(2, i) = rho_rate;
}
// Calculate Measurement mean and covariance
VectorXd radarmeas_mean = VectorXd::Zero(3);
MatrixXd radarmeas_covariance = MatrixXd::Zero(3,3);
VectorXd Z_diff = VectorXd::Zero(3);
// Cross correlation betweem sigma points in both state and measurement spaces
MatrixXd Tsig_cross = MatrixXd::Zero(5,3);
// Measurement Mean
for (int i=0; i<(2*n_aug_ +1); i++)
{
radarmeas_mean = radarmeas_mean + (weights_(i) * Zsig.col(i));
}
// Measurement Covariance
for (int i=0; i<(2*n_aug_ +1); i++)
{
Z_diff = Zsig.col(i) - radarmeas_mean;
// Phi angle normalization
if(Z_diff(1) > M_PI) Z_diff(1) -= 2.*M_PI;
if(Z_diff(1) < -M_PI) Z_diff(1) += 2.*M_PI;
radarmeas_covariance = radarmeas_covariance + (weights_(i) * (Z_diff) * (Z_diff.transpose()));
}
// Measurement noise covariance matrix
MatrixXd radar_noise_cov(3, 3);
radar_noise_cov << std_radr_*std_radr_, 0, 0,
0, std_radphi_*std_radphi_, 0,
0, 0, std_radrd_*std_radrd_;
// Adding the radar measurement linear noise
radarmeas_covariance = radarmeas_covariance + radar_noise_cov;
// Cross-correlation between measurement & state spaces sigma points
for (int i=0; i<(2*n_aug_ +1); i++)
{
Z_diff = Zsig.col(i) - radarmeas_mean;
// Phi angle normalization
if(Z_diff(1) > M_PI) Z_diff(1) -= 2.*M_PI;
if(Z_diff(1) < -M_PI) Z_diff(1) += 2.*M_PI;
Tsig_cross = Tsig_cross + (weights_(i) * (Xsig_pred_.col(i) - x_) * (Z_diff.transpose()));
}
// State mean & covariance update due to new Radar measurements
// 1- Kalman Gain calculation
MatrixXd KG = MatrixXd::Zero(5,3);
KG = Tsig_cross * radarmeas_covariance.inverse();
// Measurement state delta
VectorXd meas_diff = VectorXd::Zero(3);
meas_diff = radar_meas - radarmeas_mean;
// Phi angle normalization
if(meas_diff(1) > M_PI) meas_diff(1) -= 2.*M_PI;
if(meas_diff(1) < -M_PI) meas_diff(1) += 2.*M_PI;
// Radar NIS
NIS_radar_ = meas_diff.transpose() * radarmeas_covariance.inverse() * meas_diff;
// State Mean Update
x_ = x_ + KG * (meas_diff);
// State covariance update
P_ = P_ - (KG * radarmeas_covariance * KG.transpose());
}
| 28.420732 | 119 | 0.658728 | [
"object",
"vector",
"model"
] |
0534a27b2aaa28b512ac7ca5619d6346ab0e1b01 | 811 | cpp | C++ | datasets/github_cpp_10/5/14.cpp | yijunyu/demo-fast | 11c0c84081a3181494b9c469bda42a313c457ad2 | [
"BSD-2-Clause"
] | 1 | 2019-05-03T19:27:45.000Z | 2019-05-03T19:27:45.000Z | datasets/github_cpp_10/5/14.cpp | yijunyu/demo-vscode-fast | 11c0c84081a3181494b9c469bda42a313c457ad2 | [
"BSD-2-Clause"
] | null | null | null | datasets/github_cpp_10/5/14.cpp | yijunyu/demo-vscode-fast | 11c0c84081a3181494b9c469bda42a313c457ad2 | [
"BSD-2-Clause"
] | null | null | null |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef string st;
typedef vector<int> vi;
#define rep(i, n) for(int i = 0; i < n; ++i)
#define fogg(i,a,b) for(int i = (a); i <= (b); ++i)
#define ford(i,a,b) for(int i = (a); i >= (b); --i)
#define test int test_case; cin >> test_case; while(test_case--)
#define debug(x) cout << '>' << #x << ':' << x << "\n";
#define endl '\n'
#define off ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define mxx (ll)1000000007
void solve(int n, char source, char helper, char dest) {
if (n == 0)
return;
solve(n-1, source, dest, helper);
cout << "Move " << n << "th disk from " << source << " to " << dest << endl;
solve(n-1, helper, source, dest);
}
int main() {
off;
ll n;
cin >> n;
solve(n, 'A', 'B', 'C');
return 0;
} | 21.918919 | 77 | 0.573366 | [
"vector"
] |
053b5e37b8c469f5a494cd9260235b8f9d037dfc | 10,097 | cpp | C++ | ddtrlibrary/ddtrLibrary/tree-testing/tree-testing.cpp | mkatsa/DDTR_DRAM_NVM | 6efa624a8a3d75436ed4e416b965ff4cf9429c42 | [
"Apache-2.0"
] | null | null | null | ddtrlibrary/ddtrLibrary/tree-testing/tree-testing.cpp | mkatsa/DDTR_DRAM_NVM | 6efa624a8a3d75436ed4e416b965ff4cf9429c42 | [
"Apache-2.0"
] | null | null | null | ddtrlibrary/ddtrLibrary/tree-testing/tree-testing.cpp | mkatsa/DDTR_DRAM_NVM | 6efa624a8a3d75436ed4e416b965ff4cf9429c42 | [
"Apache-2.0"
] | null | null | null | //
// tree-testing.cpp
// tree-testing
//
// Created by Christos Baloukas on 14/4/21.
//
#include <iostream>
#include <sstream>
#include <random>
#include <chrono>
#include "../../definitions.h"
#include "../../config.h"
void print_map(std::string_view comment, const std::map<std::string, int>& m)
{
std::cout << comment;
for (const auto& [key, value] : m) {
std::cout << key << " = " << value << "; ";
}
std::cout << "\n";
}
void print_map(std::string_view comment, const DDTLibrary::map<std::string, int>& m)
{
std::cout << comment;
for (const auto& [key, value] : m) {
std::cout << key << " = " << value << "; ";
}
std::cout << "\n";
}
void print_map(std::string_view comment, const DDTLibrary::mapAVL<std::string, int>& m)
{
std::cout << comment;
for (const auto& [key, value] : m) {
std::cout << key << " = " << value << "; ";
}
std::cout << "\n";
}
class A {
public:
class B {
public:
int data[100];
B() {
std::cout << "B()" << std::endl;
for (int i = 0; i < 100; i++) {
data[i] = 2;
}
}
~B() {
std::cout << "~B()" << std::endl;
}
};
A() {
std::cout << "A()" << std::endl;
bPointer = new B;
}
~A() {
std::cout << "~A()" << std::endl;
}
B* bPointer;
};
#define MAX_TREE_ELEMENTS 100 // 10.000
#define NUM_RANDOM_LOOPS 100 // 100.000
int main(int argc, const char * argv[]) {
auto start = std::chrono::high_resolution_clock::now();
auto currentTimeCheck = std::chrono::high_resolution_clock::now();
auto prevTimeCheck = std::chrono::high_resolution_clock::now();
auto durationCheck = std::chrono::duration_cast<std::chrono::microseconds>(currentTimeCheck - start);
// insert code here...
Tracing::DDTRLogger::getInstance()->setLogFileName(LOGFILENAME);
Tracing::DDTRLogger::getInstance()->setSamplingPercentage(SAMPLING_PERCENTAGE);
ddt_helper<std::pair<int, std::string>, 10>::BINARYTREE binaryTree;
ddt_helper<std::pair<int, std::string>, 10>::REDBLACKTREE redBlackTree;
typedef std::pair<int, std::string> pair1;
std::vector< pair1 > v1;
std::cout << "v1 fill with " << MAX_TREE_ELEMENTS << std::endl;
prevTimeCheck = std::chrono::high_resolution_clock::now();
for (int i = 0; i < MAX_TREE_ELEMENTS; i++) {
std::stringstream ss1;
ss1 << "test" << i;
v1.push_back(pair1(i, ss1.str()));
}
currentTimeCheck = std::chrono::high_resolution_clock::now();
durationCheck = std::chrono::duration_cast<std::chrono::microseconds>(currentTimeCheck - prevTimeCheck);
std::cout << "v1 fill time taken = " << durationCheck.count() << std::endl;
// ---------------------
std::cout << "binary tree fill with " << MAX_TREE_ELEMENTS << std::endl;
prevTimeCheck = std::chrono::high_resolution_clock::now();
for (auto it = v1.begin(); it != v1.end(); it++) {
binaryTree.push_back(*it);
}
currentTimeCheck = std::chrono::high_resolution_clock::now();
durationCheck = std::chrono::duration_cast<std::chrono::microseconds>(currentTimeCheck - prevTimeCheck);
std::cout << "binary tree fill with - time taken = " << durationCheck.count() << std::endl;
// ------------------
std::cout << "red black tree fill with " << MAX_TREE_ELEMENTS << std::endl;
prevTimeCheck = std::chrono::high_resolution_clock::now();
for (auto it = v1.begin(); it != v1.end(); it++) {
redBlackTree.push_back(*it);
}
currentTimeCheck = std::chrono::high_resolution_clock::now();
durationCheck = std::chrono::duration_cast<std::chrono::microseconds>(currentTimeCheck - prevTimeCheck);
std::cout << "red black tree fill - time taken = " << durationCheck.count() << std::endl;
std::default_random_engine generator;
std::uniform_int_distribution<int> distribution(0, MAX_TREE_ELEMENTS - 1);
std::cout << "random_indexes" << std::endl;
std::cout << "binary tree random index #" << NUM_RANDOM_LOOPS << std::endl;
prevTimeCheck = std::chrono::high_resolution_clock::now();
for (int i = 0; i < NUM_RANDOM_LOOPS; i++) {
int random_index = distribution(generator);
binaryTree[random_index];
}
currentTimeCheck = std::chrono::high_resolution_clock::now();
durationCheck = std::chrono::duration_cast<std::chrono::microseconds>(currentTimeCheck - prevTimeCheck);
std::cout << "binary tree random time taken = " << durationCheck.count() << std::endl;
std::cout << "redblack tree random index #" << NUM_RANDOM_LOOPS << std::endl;
prevTimeCheck = std::chrono::high_resolution_clock::now();
for (int i = 0; i < NUM_RANDOM_LOOPS; i++) {
int random_index = distribution(generator);
redBlackTree[random_index];
}
currentTimeCheck = std::chrono::high_resolution_clock::now();
durationCheck = std::chrono::duration_cast<std::chrono::microseconds>(currentTimeCheck - prevTimeCheck);
std::cout << "redblack tree random time taken = " << durationCheck.count() << std::endl;
/*
for (auto i = binaryTree.begin(); i != binaryTree.end(); i++) {
std::cout << "first = " << i->first << " second = " << i->second << std::endl;
}*/
//binaryTree.Print();
//Testing map implementation
std::map<std::string, int> m;
DDTLibrary::map<std::string, int> m2;
m["string1"] = 0;
m["string2"] = 10;
m["string3"] = 5;
m["string4"] = 20;
m["abc"] = 20;
m2["string1"] = 0;
m2["string2"] = 10;
m2["string3"] = 5;
m2["string4"] = 20;
m2["abc"] = 20;
DDTLibrary::mapAVL<std::string, int> m3;
m3["string1"] = 0;
m3["string2"] = 10;
m3["string3"] = 5;
print_map("map m: ", m);
print_map("map m2: ", m2);
print_map("map m3: ", m3);
// ---------------------------------------
// Testing more functions std::map
std::map<std::string, int> mapOfWords;
DDTLibrary::map<std::string, int> mapOfWords2;
// Inserting data in std::map
mapOfWords.insert(std::make_pair("earth", 1));
mapOfWords.insert(std::make_pair("moon", 2));
mapOfWords["sun"] = 3;
// Will replace the value of already added key i.e. earth
mapOfWords["earth"] = 4;
// Iterate through all elements in std::map
std::map<std::string, int>::iterator it = mapOfWords.begin();
while(it != mapOfWords.end())
{
std::cout<<it->first<<" :: "<<it->second<<std::endl;
it++;
}
// Check if insertion is successful or not
if(mapOfWords.insert(std::make_pair("earth", 1)).second == false)
{
std::cout<<"Element with key 'earth' not inserted because already existed"<<std::endl;
}
// Searching element in std::map by key.
if(mapOfWords.find("sun") != mapOfWords.end())
std::cout<<"word 'sun' found"<<std::endl;
if(mapOfWords.find("mars") == mapOfWords.end())
std::cout<<"word 'mars' not found"<<std::endl;
// ---------------------------------------
// Testing more functions DDTRLibrary::map
mapOfWords2.insert(std::make_pair("earth", 1));
mapOfWords2.insert(std::make_pair("moon", 2));
mapOfWords2["sun"] = 3;
// Will replace the value of already added key i.e. earth
mapOfWords2["earth"] = 4;
// Iterate through all elements in std::map
DDTLibrary::map<std::string, int>::iterator it2 = mapOfWords2.begin();
while(it2 != mapOfWords2.end())
{
std::cout << it2->first <<" :: "<< it2->second << std::endl;
it2++;
}
// Check if insertion is successful or not
if(mapOfWords2.insert(std::make_pair("earth", 1)).second == false)
{
std::cout<<"Element with key 'earth' not inserted because already existed"<<std::endl;
}
// Searching element in std::map by key.
//if(mapOfWords2.find("sun") != mapOfWords2.end())
// std::cout<<"word 'sun' found"<<std::endl;
//if(mapOfWords2.find("mars") == mapOfWords2.end())
// std::cout<<"word 'mars' not found"<<std::endl;
//
// Testing emplace_back
/*
std::vector<compositeObject> vTest1;
vTest1.reserve(5);
vTest1.push_back(compositeObject());
vTest1.emplace_back();
//ddt_helper<std::pair<unsigned int, double>, 10>::REDBLACKTREE redTree1;
//redTree1[5] = 30.40;
std::vector<compositeObject> vTest2;
std::list<compositeObject> vTest3;
int testSize = 1000000;
std::cout << "pushing back " << testSize << " elements" << std::endl;
prevTimeCheck = std::chrono::high_resolution_clock::now();
for (int i = 0; i < testSize; i++) {
vTest2.emplace_back();
}
currentTimeCheck = std::chrono::high_resolution_clock::now();
durationCheck = std::chrono::duration_cast<std::chrono::microseconds>(currentTimeCheck - prevTimeCheck);
std::cout << "push_back time = " << durationCheck.count() << std::endl;
vTest2.clear();
vTest2.shrink_to_fit();
prevTimeCheck = std::chrono::high_resolution_clock::now();
for (int i = 0; i < testSize; i++) {
vTest3.emplace_back();
}
currentTimeCheck = std::chrono::high_resolution_clock::now();
durationCheck = std::chrono::duration_cast<std::chrono::microseconds>(currentTimeCheck - prevTimeCheck);
std::cout << "emplace_back time = " << durationCheck.count() << std::endl;
//-------------------------
// Testing error in emulator
ddt_helper<int>::SLLROVINGLIST myList1;
for (int i = 0; i < 10; i++) {
myList1.push_back(i);
}
myList1.erase(myList1.begin() + 2);
//-------------------------
A* a = new A;
A::B* bPointer = a->bPointer;
delete a;
std::cout << "bPointer->[data[2] = " << bPointer->data[2] << std::endl;
delete a->bPointer;
//---------------------
*/
return 0;
}
| 33.54485 | 108 | 0.578885 | [
"vector"
] |
05425ab09bd89707ffec93287bfe6dcdc80cca3c | 1,457 | cpp | C++ | Titan/src/Renderer/PostProcessTonemap.cpp | KyleKaiWang/titan | c420f1b476bd85193bcc3a493d115ac2a321a9ac | [
"Apache-2.0"
] | null | null | null | Titan/src/Renderer/PostProcessTonemap.cpp | KyleKaiWang/titan | c420f1b476bd85193bcc3a493d115ac2a321a9ac | [
"Apache-2.0"
] | null | null | null | Titan/src/Renderer/PostProcessTonemap.cpp | KyleKaiWang/titan | c420f1b476bd85193bcc3a493d115ac2a321a9ac | [
"Apache-2.0"
] | null | null | null | #include "tpch.h"
#include "PostProcessTonemap.h"
#include "Shader.h"
#include "Application.h"
#include "DeferredRendering.h"
#include "FrameBuffer.h"
#include "../ImGui/imgui.h"
#include "../Utility/Random.h"
#include <glad/glad.h>
namespace Titan {
static std::shared_ptr<Shader> tonemapShader;
float exposure = 0.5f;
float sceneFactor = 0.5f;
float bloomFactor = 0.5f;
void PostProcessTonemap::Init()
{
tonemapShader = Shader::Create("shaders/DrawQuad.vs", "shaders/Tonemap.fs");
tonemapShader->SetInt("scene", 0);
tonemapShader->SetInt("sceneBloomBlur", 1);
}
void PostProcessTonemap::Render(std::shared_ptr<Texture2D>& sceneTex, std::shared_ptr<Texture2D>& sceneBloomBlur)
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
tonemapShader->Bind();
sceneTex->Bind(0);
sceneBloomBlur->Bind(1);
tonemapShader->SetInt("enableBloom", true);
tonemapShader->SetFloat("exposure", 0.5f);
tonemapShader->SetFloat("sceneFactor", 1.0f);
tonemapShader->SetFloat("bloomFactor", 1.0f);
DeferredRendering::DrawQuad();
tonemapShader->Unbind();
}
void PostProcessTonemap::RenderDebug()
{
ImGui::Begin("Bloom", 0, ImGuiWindowFlags_NoCollapse);
ImGui::BeginChild("Bloom");
ImGui::SliderFloat("Exposure", &Titan::exposure, 0.0f, 10.0f);
ImGui::SliderFloat("Scene Factor", &Titan::sceneFactor, 0.0f, 10.0f);
ImGui::SliderFloat("Bloom Factor", &Titan::bloomFactor, 0.0f, 10.0f);
ImGui::EndChild();
ImGui::End();
}
}
| 29.734694 | 114 | 0.719286 | [
"render"
] |
0542fb21c196ede35ce10a10548fb7f3f93ddc51 | 2,086 | cpp | C++ | Qv2ray/src/common/QvTranslator.cpp | DWXXX/cnRepo | 3e54581699e4bf4d0d2d8a7c85fe340ebbbb8eef | [
"Apache-2.0"
] | null | null | null | Qv2ray/src/common/QvTranslator.cpp | DWXXX/cnRepo | 3e54581699e4bf4d0d2d8a7c85fe340ebbbb8eef | [
"Apache-2.0"
] | null | null | null | Qv2ray/src/common/QvTranslator.cpp | DWXXX/cnRepo | 3e54581699e4bf4d0d2d8a7c85fe340ebbbb8eef | [
"Apache-2.0"
] | null | null | null | #include "QvTranslator.hpp"
#include "base/Qv2rayBase.hpp"
#include "common/QvHelpers.hpp"
using namespace Qv2ray::base;
// path searching list.
QStringList getLanguageSearchPaths()
{
// Configuration Path
QStringList list = Qv2rayAssetsPaths("lang");
#ifdef EMBED_TRANSLATIONS
// If the translations have been embedded.
list << QString(":/translations/");
#endif
#ifdef QV2RAY_TRANSLATION_PATH
// Platform-specific dir, if specified.
list << QString(QV2RAY_TRANSLATION_PATH);
#endif
return list;
}
namespace Qv2ray::common
{
QvTranslator::QvTranslator()
{
GetAvailableLanguages();
}
QStringList QvTranslator::GetAvailableLanguages()
{
languages.clear();
for (const auto &path : getLanguageSearchPaths())
{
languages << QDir(path).entryList(QStringList{ "*.qm" }, QDir::Hidden | QDir::Files);
}
std::transform(languages.begin(), languages.end(), languages.begin(), [](QString &fileName) { return fileName.replace(".qm", ""); });
languages.removeDuplicates();
DEBUG(MODULE_UI, "Found translations: " + languages.join(" "))
return languages;
}
bool QvTranslator::InstallTranslation(const QString &code)
{
for (const auto &path : getLanguageSearchPaths())
{
if (FileExistsIn(QDir(path), code + ".qm"))
{
DEBUG(MODULE_UI, "Found " + code + " in folder: " + path)
QTranslator *translatorNew = new QTranslator();
translatorNew->load(code + ".qm", path);
if (pTranslator)
{
LOG(MODULE_UI, "Removed translations")
qApp->removeTranslator(pTranslator.get());
}
this->pTranslator.reset(translatorNew);
qApp->installTranslator(pTranslator.get());
LOG(MODULE_UI, "Successfully installed a translator for " + code)
return true;
}
}
return false;
}
} // namespace Qv2ray::common
| 31.134328 | 141 | 0.59348 | [
"transform"
] |
05439546822aa2d8706946cf871e46a9fd17a3e7 | 5,864 | cxx | C++ | Applications/ResampleTubes/ResampleTubes.cxx | cdeepakroy/TubeTK | c39d1065bf10736a36a845cbd68749ff363f733f | [
"Apache-2.0"
] | 1 | 2016-09-08T21:34:25.000Z | 2016-09-08T21:34:25.000Z | Applications/ResampleTubes/ResampleTubes.cxx | cdeepakroy/TubeTK | c39d1065bf10736a36a845cbd68749ff363f733f | [
"Apache-2.0"
] | null | null | null | Applications/ResampleTubes/ResampleTubes.cxx | cdeepakroy/TubeTK | c39d1065bf10736a36a845cbd68749ff363f733f | [
"Apache-2.0"
] | null | null | null | /*=========================================================================
Library: TubeTK
Copyright 2010 Kitware Inc. 28 Corporate Drive,
Clifton Park, NY, 12065, USA.
All rights reserved.
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 "itktubeSubSampleTubeTreeSpatialObjectFilter.h"
#include "itktubeTubeToTubeTransformFilter.h"
#include "tubeCLIFilterWatcher.h"
#include "tubeCLIProgressReporter.h"
#include "tubeMessage.h"
#include <itkSpatialObjectReader.h>
#include <itkSpatialObjectWriter.h>
#include <itkTimeProbesCollectorBase.h>
#include <itkVesselTubeSpatialObject.h>
#include <itkImageFileReader.h>
#include <itkDisplacementFieldTransform.h>
#include <itkTransformFileReader.h>
#include <itktubeResampleTubesFilter.h>
#include "ResampleTubesCLP.h"
template< unsigned int Dimension >
void WriteOutput( typename itk::GroupSpatialObject<Dimension>::Pointer
tubesGroup, const char * fileName )
{
typedef itk::SpatialObjectWriter< Dimension > SpatialObjectWriterType;
typename SpatialObjectWriterType::Pointer writer =
SpatialObjectWriterType::New();
writer->SetInput( tubesGroup );
writer->SetFileName( fileName );
writer->Update();
}
template< unsigned int Dimension >
int DoIt( int argc, char * argv[] )
{
PARSE_ARGS;
typedef itk::tube::ResampleTubesFilter< Dimension > FilterType;
typename FilterType::Pointer filter = FilterType::New();
typedef typename FilterType::TubeGroupType GroupSpatialObjectType;
double progress = 0.0;
itk::TimeProbesCollectorBase timeCollector;
tube::CLIProgressReporter progressReporter( "TubeTransform",
CLPProcessInformation );
progressReporter.Start();
progressReporter.Report( progress );
// Read in the tubes
timeCollector.Start( "Read tubes" );
typename GroupSpatialObjectType::Pointer tubesGroup =
GroupSpatialObjectType::New();
typedef itk::SpatialObjectReader< Dimension > SpatialObjectReaderType;
typename SpatialObjectReaderType::Pointer reader =
SpatialObjectReaderType::New();
reader->SetFileName( inputTubeFile.c_str() );
reader->Update();
tubesGroup = reader->GetGroup();
if( tubesGroup.IsNotNull() )
{
tubesGroup->ComputeObjectToWorldTransform();
filter->SetInput( tubesGroup );
filter->SetInputSpatialObject( tubesGroup );
}
else
{
std::cerr << "Cannot read tubes from file: " << inputTubeFile
<< std::endl;
return EXIT_FAILURE;
}
timeCollector.Stop( "Read tubes" );
progress = 0.3;
progressReporter.Report( progress );
timeCollector.Start( "Read Parameters" );
if( !matchImage.empty() )
{
typedef itk::Image< char, Dimension > ImageType;
typedef itk::ImageFileReader< ImageType> ImageReaderType;
typename ImageReaderType::Pointer reader = ImageReaderType::New();
reader->SetFileName( matchImage.c_str() );
reader->Update();
filter->SetMatchImage( reader->GetOutput() );
}
if( !loadDisplacementField.empty() )
{
typedef typename FilterType::DisplacementFieldType DisplacementFieldType;
typedef typename itk::ImageFileReader< DisplacementFieldType >
DisplacementFieldReaderType;
// Read the displacement field
typename DisplacementFieldReaderType::Pointer dfReader =
DisplacementFieldReaderType::New();
dfReader->SetFileName( loadDisplacementField.c_str() );
dfReader->Update();
filter->SetDisplacementField( dfReader->GetOutput() );
}
itk::TransformFileReader::Pointer transformReader =
itk::TransformFileReader::New();
if( !loadTransform.empty() )
{
// Read transform from file
transformReader->SetFileName( loadTransform.c_str() );
transformReader->Update();
filter->SetReadTransformList( transformReader->GetTransformList() );
filter->SetUseInverseTransform( useInverseTransform );
}
filter->SetSamplingFactor( samplingFactor );
timeCollector.Stop( "Read Parameters" );
progress = 0.4;
progressReporter.Report( progress );
timeCollector.Start( "Run Filter");
filter->Update();
timeCollector.Stop( "Run Filter" );
progress = 0.9;
progressReporter.Report( progress );
timeCollector.Start( "Write output");
WriteOutput< Dimension >( filter->GetOutput(), outputTubeFile.c_str() );
timeCollector.Stop( "Write output" );
progress = 1.0;
progressReporter.Report( progress );
progressReporter.End();
timeCollector.Report();
return EXIT_SUCCESS;
}
int main( int argc, char * argv[] )
{
try
{
PARSE_ARGS;
}
catch( const std::exception & err )
{
tube::ErrorMessage( err.what() );
return EXIT_FAILURE;
}
PARSE_ARGS;
MetaScene *mScene = new MetaScene;
mScene->Read( inputTubeFile.c_str() );
if( mScene->GetObjectList()->empty() )
{
tubeWarningMacro( << "Input TRE file has no spatial objects" );
delete mScene;
return EXIT_SUCCESS;
}
switch( mScene->GetObjectList()->front()->NDims() )
{
case 3:
{
bool result = DoIt<3>( argc, argv );
delete mScene;
return result;
break;
}
default:
{
tubeErrorMacro(
<< "Error: Only 3D data is currently supported." );
delete mScene;
return EXIT_FAILURE;
break;
}
}
return EXIT_FAILURE;
}
| 28.604878 | 79 | 0.690314 | [
"transform",
"3d"
] |
054a0ef39baeb4739f50d249b1449a883679520c | 4,925 | hpp | C++ | include/mango/math/vector128_int8x16.hpp | galek/mango | 975b438ac9a22ed3a849da6187e1fdf3d547c926 | [
"Zlib"
] | 1 | 2021-08-06T09:27:45.000Z | 2021-08-06T09:27:45.000Z | include/mango/math/vector128_int8x16.hpp | galek/mango | 975b438ac9a22ed3a849da6187e1fdf3d547c926 | [
"Zlib"
] | null | null | null | include/mango/math/vector128_int8x16.hpp | galek/mango | 975b438ac9a22ed3a849da6187e1fdf3d547c926 | [
"Zlib"
] | 1 | 2021-07-10T11:41:01.000Z | 2021-07-10T11:41:01.000Z | /*
MANGO Multimedia Development Platform
Copyright (C) 2012-2017 Twilight Finland 3D Oy Ltd. All rights reserved.
*/
#pragma once
#include "vector.hpp"
namespace mango
{
template <>
struct Vector<int8, 16> : VectorBase<int8, 16>
{
using vector_type = simd::int8x16;
simd::int8x16 m;
explicit Vector() = default;
explicit Vector(int8 s)
: m(simd::int8x16_set1(s))
{
}
Vector(simd::int8x16 v)
: m(v)
{
}
Vector& operator = (simd::int8x16 v)
{
m = v;
return *this;
}
Vector& operator = (int8 s)
{
m = simd::int8x16_set1(s);
return *this;
}
operator simd::int8x16 () const
{
return m;
}
operator simd::int8x16 ()
{
return m;
}
};
static inline const Vector<int8, 16> operator + (Vector<int8, 16> v)
{
return v;
}
static inline Vector<int8, 16> operator - (Vector<int8, 16> v)
{
return simd::sub(simd::int8x16_zero(), v);
}
static inline Vector<int8, 16>& operator += (Vector<int8, 16>& a, Vector<int8, 16> b)
{
a = simd::add(a, b);
return a;
}
static inline Vector<int8, 16>& operator += (Vector<int8, 16>& a, int8 b)
{
a = simd::add(a, b);
return a;
}
static inline Vector<int8, 16>& operator -= (Vector<int8, 16>& a, Vector<int8, 16> b)
{
a = simd::sub(a, b);
return a;
}
static inline Vector<int8, 16>& operator -= (Vector<int8, 16>& a, int8 b)
{
a = simd::sub(a, b);
return a;
}
static inline Vector<int8, 16> operator + (Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::add(a, b);
}
static inline Vector<int8, 16> operator + (Vector<int8, 16> a, int8 b)
{
return simd::add(a, b);
}
static inline Vector<int8, 16> operator + (int8 a, Vector<int8, 16> b)
{
return simd::add(a, b);
}
static inline Vector<int8, 16> operator - (Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::sub(a, b);
}
static inline Vector<int8, 16> operator - (Vector<int8, 16> a, int8 b)
{
return simd::sub(a, b);
}
static inline Vector<int8, 16> operator - (int8 a, Vector<int8, 16> b)
{
return simd::sub(a, b);
}
static inline Vector<int8, 16> nand(Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::bitwise_nand(a, b);
}
static inline Vector<int8, 16> operator & (Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::bitwise_and(a, b);
}
static inline Vector<int8, 16> operator | (Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::bitwise_or(a, b);
}
static inline Vector<int8, 16> operator ^ (Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::bitwise_xor(a, b);
}
static inline Vector<int8, 16> operator ~ (Vector<int8, 16> a)
{
return simd::bitwise_not(a);
}
static inline Vector<int8, 16> abs(Vector<int8, 16> a)
{
return simd::abs(a);
}
static inline Vector<int8, 16> adds(Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::adds(a, b);
}
static inline Vector<int8, 16> subs(Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::subs(a, b);
}
static inline Vector<int8, 16> min(Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::min(a, b);
}
static inline Vector<int8, 16> max(Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::max(a, b);
}
static inline Vector<int8, 16> clamp(Vector<int8, 16> a, Vector<int8, 16> amin, Vector<int8, 16> amax)
{
return simd::clamp(a, amin, amax);
}
static inline Vector<int8, 16> operator > (Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::compare_gt(a, b);
}
static inline Vector<int8, 16> operator >= (Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::compare_ge(a, b);
}
static inline Vector<int8, 16> operator < (Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::compare_lt(a, b);
}
static inline Vector<int8, 16> operator <= (Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::compare_le(a, b);
}
static inline Vector<int8, 16> operator == (Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::compare_eq(a, b);
}
static inline Vector<int8, 16> operator != (Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::compare_neq(a, b);
}
static inline Vector<int8, 16> select(Vector<int8, 16> mask, Vector<int8, 16> a, Vector<int8, 16> b)
{
return simd::select(mask, a, b);
}
} // namespace mango
| 23.677885 | 106 | 0.539695 | [
"vector",
"3d"
] |
d7295b63a1fa215f3efe357e20e33b65e97c6468 | 2,579 | cpp | C++ | src/ogdl_read.cpp | eivinsam/ogdl-cpp | f37ca09eea65c9585fbf10c6450732133209156f | [
"MIT"
] | null | null | null | src/ogdl_read.cpp | eivinsam/ogdl-cpp | f37ca09eea65c9585fbf10c6450732133209156f | [
"MIT"
] | null | null | null | src/ogdl_read.cpp | eivinsam/ogdl-cpp | f37ca09eea65c9585fbf10c6450732133209156f | [
"MIT"
] | null | null | null | #include <ogdl.h>
#include <fstream>
using namespace ogdl;
class Reader
{
static constexpr char EOT = 4;
std::istream& _in;
char _current;
char _advance()
{
const auto res = _current;
_in.get(_current);
if (!_in.good())
_current = EOT;
return res;
}
size_t _skip_space()
{
size_t result = 0;
while (_current == ' ' || _current == '\t')
{
result += 1;
_advance();
}
return result;
}
void _handle_CR()
{
if (_in.peek() == '\n')
_advance();
}
NodePtr _read_node()
{
NodePtr result;
{
std::string name;
_skip_space();
switch (_current)
{
case '\r': _handle_CR();
case '\n':
case EOT:
break;
case '\'':
case '"':
{
const auto delim = _advance();
while (_current != delim && _current >= ' ')
name.push_back(_advance());
if (_current != delim)
throw std::runtime_error(std::string("expected string delimiter ") + char(delim));
_advance();
break;
}
default:
while (_current > ' ' && _current != ',')
name.push_back(_advance());
break;
}
if (name.empty())
return nullptr;
result = Node::make(std::move(name));
}
for (;;) switch (_current)
{
case '\r': _handle_CR(); // fallthrough
case '\n':
case ',':
case EOT:
return result;
case ' ': case '\t':
_advance();
continue;
default:
if (_current < ' ')
return result;
result->push(_read_node());
continue;
}
}
struct Partial
{
size_t next_indent = 0;
std::vector<NodePtr> nodes;
};
Partial _read_sub(const size_t indent)
{
Partial result;
for (;;)
{
if (const auto node = _read_node())
{
result.nodes.emplace_back(node);
switch (_current)
{
case ',':
_advance();
continue;
case '\r': _handle_CR(); // fallthrough
case '\n':
{
_advance();
result.next_indent = _skip_space();
if (result.next_indent > indent)
{
auto sub = _read_sub(result.next_indent);
for (auto&& n : sub.nodes)
result.nodes.back()->push(std::move(n));
result.next_indent = sub.next_indent;
}
if (result.next_indent == indent)
continue;
else
break;
}
case EOT:
result.next_indent = 0;
break;
default:
throw std::runtime_error("unexpected character after reading node");
}
}
return result;
}
}
public:
Reader(std::istream& in) : _in(in) { _advance(); }
std::vector<NodePtr> read()
{
return _read_sub(0).nodes;
}
};
std::vector<NodePtr> ogdl::read(std::istream& in)
{
return Reader(in).read();
} | 17.308725 | 87 | 0.572703 | [
"vector"
] |
d72e3c3858a9d0116d40c8650aaaa95ed6a037f0 | 3,516 | cpp | C++ | hphp/util/test/brotli-test.cpp | Tiththa/hhvm | d6f984c858544ae716c12413048772f831959307 | [
"PHP-3.01",
"Zend-2.0"
] | 7 | 2015-08-28T06:20:50.000Z | 2021-11-08T09:48:24.000Z | hphp/util/test/brotli-test.cpp | alisha/hhvm | 523dc33b444bd5b59695eff2b64056629b0ed523 | [
"PHP-3.01",
"Zend-2.0"
] | 1 | 2020-01-19T19:06:32.000Z | 2020-01-19T19:06:32.000Z | hphp/util/test/brotli-test.cpp | alisha/hhvm | 523dc33b444bd5b59695eff2b64056629b0ed523 | [
"PHP-3.01",
"Zend-2.0"
] | 3 | 2018-01-23T20:44:59.000Z | 2021-05-06T12:45:31.000Z | /*
+----------------------------------------------------------------------+
| HipHop for PHP |
+----------------------------------------------------------------------+
| Copyright (c) 2010-present Facebook, Inc. (http://www.facebook.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
*/
#include "hphp/util/brotli.h"
#include <dec/decode.h>
#include <enc/encode.h>
#include <folly/ScopeGuard.h>
#include <folly/Range.h>
#include <gtest/gtest.h>
using namespace brotli;
using namespace std;
using namespace folly;
namespace HPHP {
TEST(BrotliTest, Chunks) {
vector<string> chunks = {
"<!DOCTYPE html>\n"
"<html>\n"
" <head>\n"
" <meta http-equiv=\"Content-Type\" content=\"text/html; "
"charset=UTF-8\">\n"
" <title>Title</title>\n"
" </head>\n"
"<body>\n"
"Sending data chunk 1 of 1000 <br />\r\n",
"Sending data chunk 2 of 1000 <br />\r\n",
"Sending data chunk 3 of 1000 <br />\r\n",
"Sending data chunk 4 of 1000 <br />\r\n",
"Sending data chunk 5 of 1000 <br />\r\n"
" </body>\n"
"</html>\n",
};
BrotliState state;
BrotliStateInit(&state);
SCOPE_EXIT{ BrotliStateCleanup(&state); };
size_t total = 0;
brotli::BrotliCompressor compressor{BrotliParams()};
// generate a huge chunk
size_t hugeSize = compressor.input_block_size() + 20;
string hugeChunk;
hugeChunk.reserve(hugeSize);
string filler = "The quick brown fox jumps over the lazy dog.";
while (hugeChunk.size() != hugeSize) {
hugeChunk.append(
filler, 0, std::min(filler.size(), hugeSize - hugeChunk.size()));
}
chunks.emplace_back(std::move(hugeChunk));
int i = 0;
for (auto& chunk : chunks) {
size_t size = chunk.size();
bool last = ++i == chunks.size();
auto compressed = compressBrotli(&compressor, chunk.data(), size, last);
EXPECT_TRUE(compressed != nullptr);
SCOPE_EXIT { free((void*)compressed); };
size_t decompressedBufferSize = chunk.size();
auto decompressedBuffer = new uint8_t[decompressedBufferSize];
SCOPE_EXIT{ delete[] decompressedBuffer; };
uint8_t* decompressedPos = decompressedBuffer;
size_t decompressedAvailable = decompressedBufferSize;
const uint8_t* compressedPos = (const uint8_t*)compressed;
BrotliDecompressBufferStreaming(&size,
&compressedPos,
0,
&decompressedAvailable,
&decompressedPos,
&total,
&state);
EXPECT_EQ(size, 0);
EXPECT_EQ(chunk,
StringPiece((char*)decompressedBuffer,
decompressedPos - decompressedBuffer));
}
}
}
| 34.470588 | 76 | 0.527873 | [
"vector"
] |
d72f3150fa275c3d8c8195fba2deb38fe3939912 | 9,422 | cpp | C++ | source/sill/components/animation-component.cpp | Breush/lava | 1b1b1f0785300b93b4a9f35fca4490502fea6552 | [
"MIT"
] | 15 | 2018-02-26T08:20:03.000Z | 2022-03-06T03:25:46.000Z | source/sill/components/animation-component.cpp | Breush/lava | 1b1b1f0785300b93b4a9f35fca4490502fea6552 | [
"MIT"
] | 32 | 2018-02-26T08:26:38.000Z | 2020-09-12T17:09:38.000Z | source/sill/components/animation-component.cpp | Breush/lava | 1b1b1f0785300b93b4a9f35fca4490502fea6552 | [
"MIT"
] | null | null | null | #include <lava/sill/components/animation-component.hpp>
#include <lava/sill/components/transform-component.hpp>
#include <lava/sill/entity.hpp>
using namespace lava::chamber;
using namespace lava::sill;
AnimationComponent::AnimationComponent(Entity& entity)
: IComponent(entity)
{
}
void AnimationComponent::update(float dt)
{
PROFILE_FUNCTION(PROFILER_COLOR_UPDATE);
for (auto& iAnimationInfos : m_animationsInfos) {
auto& animationInfos = iAnimationInfos.second;
for (auto iAnimationInfo = animationInfos.rbegin(); iAnimationInfo != animationInfos.rend(); ++iAnimationInfo) {
auto& animationInfo = *iAnimationInfo;
animationInfo.timeSpent += dt;
if (animationInfo.needUpdate) {
updateInterpolation(iAnimationInfos.first, animationInfo);
// Remove all animations that need to be removed.
if (animationInfo.autoStop && !animationInfo.needUpdate) {
animationInfos.erase(std::next(iAnimationInfo).base());
}
}
}
}
}
// ----- Control
void AnimationComponent::start(AnimationFlags flags, float time, bool autoStop)
{
if (flags & AnimationFlag::Transform) {
auto& animationInfo = findOrCreateAnimationInfo(AnimationFlag::Transform);
animationInfo.autoStop = autoStop;
animationInfo.timeSpent = 0.f;
animationInfo.totalTime = time;
animationInfo.startValue = m_entity.get<TransformComponent>().transform();
animationInfo.targetValue = animationInfo.startValue;
animationInfo.needUpdate = true;
}
else if (flags & AnimationFlag::WorldTransform) {
auto& animationInfo = findOrCreateAnimationInfo(AnimationFlag::WorldTransform);
animationInfo.autoStop = autoStop;
animationInfo.timeSpent = 0.f;
animationInfo.totalTime = time;
animationInfo.startValue = m_entity.get<TransformComponent>().worldTransform();
animationInfo.targetValue = animationInfo.startValue;
animationInfo.needUpdate = true;
}
}
void AnimationComponent::start(AnimationFlags flags, magma::Material& material, const std::string& uniformName, float time, bool autoStop)
{
if (flags & AnimationFlag::MaterialUniform) {
const auto& attribute = material.attributes().at(uniformName);
auto& animationInfo = findOrCreateAnimationInfo(AnimationFlag::MaterialUniform, material, uniformName);
animationInfo.autoStop = autoStop;
animationInfo.timeSpent = 0.f;
animationInfo.totalTime = time;
animationInfo.startValue = attribute.value;
animationInfo.uniformType = attribute.type;
animationInfo.targetValue = animationInfo.startValue;
animationInfo.needUpdate = true;
}
}
void AnimationComponent::stop(AnimationFlags flags)
{
if (flags & AnimationFlag::Transform) {
m_animationsInfos.erase(AnimationFlag::Transform);
}
else if (flags & AnimationFlag::WorldTransform) {
m_animationsInfos.erase(AnimationFlag::WorldTransform);
}
}
void AnimationComponent::target(AnimationFlag flag, const lava::Transform& target)
{
auto animationInfo = findAnimationInfo(flag);
if (animationInfo == nullptr) {
logger.error("sill.components.animation") << "Targeting an non-existing animation." << std::endl;
}
animationInfo->targetValue = target;
animationInfo->needUpdate = true;
}
void AnimationComponent::target(AnimationFlag flag, magma::Material& material, const std::string& uniformName,
const glm::vec4& target)
{
auto animationInfo = findAnimationInfo(flag, material, uniformName);
if (animationInfo == nullptr) {
logger.error("sill.components.animation") << "Targeting an non-existing animation." << std::endl;
}
animationInfo->targetValue = target;
animationInfo->needUpdate = true;
}
void AnimationComponent::target(AnimationFlag flag, magma::Material& material, const std::string& uniformName,
float target)
{
auto& animationInfo = findOrCreateAnimationInfo(flag, material, uniformName);
animationInfo.targetValue = target;
animationInfo.needUpdate = true;
}
// ----- Internal
AnimationComponent::AnimationInfo* AnimationComponent::findAnimationInfo(AnimationFlag flag)
{
auto animationInfosIt = m_animationsInfos.find(flag);
if (animationInfosIt == m_animationsInfos.end()) {
return nullptr;
}
if (flag == AnimationFlag::Transform) {
if (animationInfosIt->second.size() == 0) {
return nullptr;
}
return &animationInfosIt->second.at(0);
}
else if (flag == AnimationFlag::WorldTransform) {
if (animationInfosIt->second.size() == 0) {
return nullptr;
}
return &animationInfosIt->second.at(0);
}
return nullptr;
}
AnimationComponent::AnimationInfo* AnimationComponent::findAnimationInfo(AnimationFlag flag,
magma::Material& material,
const std::string& uniformName)
{
auto animationInfosIt = m_animationsInfos.find(flag);
if (animationInfosIt == m_animationsInfos.end()) {
return nullptr;
}
for (auto& animationInfo : animationInfosIt->second) {
if (animationInfo.material == &material && animationInfo.uniformName == uniformName) {
return &animationInfo;
}
}
return nullptr;
}
AnimationComponent::AnimationInfo& AnimationComponent::findOrCreateAnimationInfo(AnimationFlag flag)
{
if (flag == AnimationFlag::Transform) {
auto& animationInfos = m_animationsInfos[AnimationFlag::Transform];
animationInfos.resize(1);
return animationInfos[0];
}
else if (flag == AnimationFlag::WorldTransform) {
auto& animationInfos = m_animationsInfos[AnimationFlag::WorldTransform];
animationInfos.resize(1);
return animationInfos[0];
}
// Should not happen.
return m_animationsInfos[AnimationFlag::None][0];
}
AnimationComponent::AnimationInfo& AnimationComponent::findOrCreateAnimationInfo(AnimationFlag flag,
magma::Material& material,
const std::string& uniformName)
{
auto pAnimationInfo = findAnimationInfo(flag, material, uniformName);
if (pAnimationInfo != nullptr) {
return *pAnimationInfo;
}
auto& animationInfos = m_animationsInfos[flag];
auto& animationInfo = animationInfos.emplace_back();
animationInfo.material = &material;
animationInfo.uniformName = uniformName;
return animationInfo;
}
void AnimationComponent::updateInterpolation(AnimationFlag flag, AnimationInfo& animationInfo)
{
float timeRatio = animationInfo.timeSpent / animationInfo.totalTime;
// We need to update next loop, because animation is not over yet.
animationInfo.needUpdate = (timeRatio < 1.f);
if (flag == AnimationFlag::Transform) {
const auto& startValue = std::get<lava::Transform>(animationInfo.startValue);
const auto& targetValue = std::get<lava::Transform>(animationInfo.targetValue);
lava::Transform value = targetValue;
if (animationInfo.needUpdate) value = chamber::interpolate(startValue, targetValue, timeRatio, InterpolationEase::In, InterpolationEase::None, InterpolationEase::In);
m_entity.get<TransformComponent>().transform(value, TransformComponent::ChangeReasonFlag::Animation);
}
else if (flag == AnimationFlag::WorldTransform) {
const auto& startValue = std::get<lava::Transform>(animationInfo.startValue);
const auto& targetValue = std::get<lava::Transform>(animationInfo.targetValue);
lava::Transform value = targetValue;
if (animationInfo.needUpdate) value = chamber::interpolate(startValue, targetValue, timeRatio, InterpolationEase::In, InterpolationEase::None, InterpolationEase::In);
m_entity.get<TransformComponent>().worldTransform(value, TransformComponent::ChangeReasonFlag::Animation);
}
else if (flag == AnimationFlag::MaterialUniform) {
if (animationInfo.uniformType == magma::UniformType::Float) {
auto startValue = std::get<magma::UniformFallback>(animationInfo.startValue).floatValue;
auto targetValue = std::get<magma::UniformFallback>(animationInfo.targetValue).floatValue;
auto value = targetValue;
if (animationInfo.needUpdate) value = chamber::interpolateLinear(startValue, targetValue, timeRatio);
animationInfo.material->set(animationInfo.uniformName, value);
}
else if (animationInfo.uniformType == magma::UniformType::Vec4) {
const auto& startValue = std::get<magma::UniformFallback>(animationInfo.startValue).vec4Value;
const auto& targetValue = std::get<magma::UniformFallback>(animationInfo.targetValue).vec4Value;
auto value = targetValue;
if (animationInfo.needUpdate) value = chamber::interpolateLinear(startValue, targetValue, timeRatio);
animationInfo.material->set(animationInfo.uniformName, value);
}
}
}
| 40.437768 | 174 | 0.673212 | [
"transform"
] |
d7329c4135c5c5ab89c6375c7f1c62a28dfb3fd6 | 1,682 | cpp | C++ | Recursion and Backtracking/36. Valid Sudoku.cpp | ankitapuri/LeetCode-Solutions | 16d9b6a992663a19db373f207b23b95225f56c28 | [
"MIT"
] | 18 | 2021-11-07T06:45:25.000Z | 2022-03-03T10:37:01.000Z | Recursion and Backtracking/36. Valid Sudoku.cpp | ankitapuri/LeetCode-Solutions | 16d9b6a992663a19db373f207b23b95225f56c28 | [
"MIT"
] | 1 | 2021-10-12T15:32:27.000Z | 2021-11-06T11:48:11.000Z | Recursion and Backtracking/36. Valid Sudoku.cpp | ankitapuri/LeetCode-Solutions | 16d9b6a992663a19db373f207b23b95225f56c28 | [
"MIT"
] | 2 | 2021-11-25T10:25:44.000Z | 2021-12-31T15:16:47.000Z | class Solution {
public:
bool solveSudoku(vector<vector<char>> &board, int row, int col) {
// If the position is now at the end of the 9*9 grid
if(row == 8 and col == 9) return true;
// if column has reached upper bound
if(col==9) {
row++;
col=0;
}
// For characters other than dot move to the next position
if(board[row][col]=='.') return solveSudoku(board,row,col+1);
char num=board[row][col];
if(isValid(board, row, col, num)) {
if(solveSudoku(board,row,col+1)) return true;
}
return false;
}
bool isValid(vector<vector<char>> &board, int row, int col, char num) {
int i,j;
/* Checking if its duplicated on the same row */
for(i=0; i<9; i++) {
if(i!= col && board[row][i] == num) {
return false;
}
}
/* Checking if its duplicated on the same col */
for(i=0; i<9; i++) {
if(i!=row && board[i][col] == num) {
return false;
}
}
/* Checking if its duplicated inside the 3*3 grid */
int rowOffset=row-(row%3);
int colOffset=col-(col%3);
for(i=0; i<3;i++) {
for(j=0;j<3;j++) {
if((rowOffset+i)!=row && (colOffset+j)!=col && board[rowOffset+i][colOffset+j] == num) {
return false;
}
}
}
return true;
}
bool isValidSudoku(vector<vector<char>>& board) {
if(solveSudoku(board, 0, 0)) return true;
return false;
}
}; | 34.326531 | 105 | 0.470273 | [
"vector"
] |
d733646ab9a78dd6304e870fcd3e432fb1e5d010 | 2,569 | cpp | C++ | src/backend/base/base_chunk.cpp | ViewFaceCore/TenniS | c1d21a71c1cd025ddbbe29924c8b3296b3520fc0 | [
"BSD-2-Clause"
] | null | null | null | src/backend/base/base_chunk.cpp | ViewFaceCore/TenniS | c1d21a71c1cd025ddbbe29924c8b3296b3520fc0 | [
"BSD-2-Clause"
] | null | null | null | src/backend/base/base_chunk.cpp | ViewFaceCore/TenniS | c1d21a71c1cd025ddbbe29924c8b3296b3520fc0 | [
"BSD-2-Clause"
] | null | null | null | //
// Created by kier on 2019-04-15.
//
#include "backend/base/base_chunk.h"
#include "backend/name.h"
#include "core/tensor_builder.h"
#include "utils/box.h"
namespace ts {
namespace base {
Chunk::Chunk() {
field(name::chunks, REQUIRED);
field(name::dim, OPTIONAL, tensor::from<int32_t>(-2));
}
void Chunk::init() {
supper::init();
m_chunks = tensor::to_int(get(name::chunks));
m_dim = tensor::to_int(get(name::dim));
TS_AUTO_CHECK(m_chunks > 0);
}
static int infer_return_dim(Stack &stack, int m_chunks, int m_dim, std::vector<Tensor::Prototype> &output) {
TS_AUTO_CHECK(stack.size() == 1);
auto &x = stack[0];
int input_dims = int(x.dims());
int fixed_dim = m_dim >= 0 ? m_dim : input_dims + m_dim;
if (fixed_dim < 0 || fixed_dim >= input_dims) {
TS_LOG_ERROR << "Chunk dim must in [-"
<< input_dims << ", "
<< input_dims << ")" << eject;
}
int dim_size = x.size(fixed_dim);
if (dim_size < m_chunks) {
TS_LOG_ERROR << "Chunk size must greater " << m_chunks << eject;
}
auto bins = split_bins(0, dim_size, m_chunks);
output.resize(m_chunks);
for (int i = 0; i < m_chunks; ++i) {
DTYPE proto_dtype = x.dtype();
Shape proto_shape = x.sizes();
proto_shape[fixed_dim] = bins[i].second - bins[i].first;
output[i] = Tensor::Prototype(proto_dtype, proto_shape);
}
return fixed_dim;
}
int Chunk::infer(Stack &stack, std::vector<Tensor::Prototype> &output) {
infer_return_dim(stack, m_chunks, m_dim, output);
return m_chunks;
}
int Chunk::run(Stack &stack) {
std::vector<Tensor::Prototype> output_protos;
int fixed_dim = infer_return_dim(stack, m_chunks, m_dim, output_protos);
auto memory_device = running_memory_device();
auto x = stack[0].view(memory_device);
std::vector<Tensor> out;
for (auto &proto : output_protos) {
out.emplace_back(*stack.push(proto, memory_device));
}
chunk(x, m_chunks, fixed_dim, out);
Tensor packed;
packed.pack(out);
stack.push(packed);
return 1;
}
}
}
| 28.230769 | 116 | 0.515765 | [
"shape",
"vector"
] |
d73481278c28cfacdc7b06cd93d6a5c58bd57a63 | 1,852 | cpp | C++ | ugene/src/corelibs/U2Gui/src/options_panel/GroupOptionsWidget.cpp | iganna/lspec | c75cba3e4fa9a46abeecbf31b5d467827cf4fec0 | [
"MIT"
] | null | null | null | ugene/src/corelibs/U2Gui/src/options_panel/GroupOptionsWidget.cpp | iganna/lspec | c75cba3e4fa9a46abeecbf31b5d467827cf4fec0 | [
"MIT"
] | null | null | null | ugene/src/corelibs/U2Gui/src/options_panel/GroupOptionsWidget.cpp | iganna/lspec | c75cba3e4fa9a46abeecbf31b5d467827cf4fec0 | [
"MIT"
] | null | null | null | /**
* UGENE - Integrated Bioinformatics Tools.
* Copyright (C) 2008-2012 UniPro <ugene@unipro.ru>
* http://ugene.unipro.ru
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*/
#include "GroupOptionsWidget.h"
namespace U2 {
GroupOptionsWidget::GroupOptionsWidget(const QString& _groupId, const QString& _title, QWidget* _widget)
: groupId(_groupId),
widget(_widget),
title(_title)
{
setStyleSheet("font-size: 11px;");
titleWidget = new QLabel(title);
titleWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed);
titleWidget->setMinimumWidth(WIDGET_WIDTH);
titleWidget->setStyleSheet(
"background: palette(midlight);"
"border-style: solid;"
"border-width: 1px;"
"border-color: palette(mid);"
"padding: 2px;"
"margin: 5px;");
widget->setContentsMargins(10, 5, 5, 5);
// Layout and "parent" the widgets
mainLayout = new QVBoxLayout();
mainLayout->setContentsMargins(0, 0, 0, 15);
mainLayout->setSpacing(0);
mainLayout->addWidget(titleWidget);
mainLayout->addWidget(widget);
setLayout(mainLayout);
setFocusProxy(widget);
}
} // namespace
| 30.360656 | 104 | 0.699784 | [
"solid"
] |
d738a07ec2e7710bb0814c84c3167904ef673a1e | 31,190 | cpp | C++ | src/gromacs/mdlib/updategroups.cpp | hejamu/gromacs | 4f4b9e4b197ae78456faada74c9f4cab7d128de6 | [
"BSD-2-Clause"
] | 384 | 2015-01-02T19:44:15.000Z | 2022-03-27T15:13:15.000Z | src/gromacs/mdlib/updategroups.cpp | hejamu/gromacs | 4f4b9e4b197ae78456faada74c9f4cab7d128de6 | [
"BSD-2-Clause"
] | 9 | 2015-04-07T20:48:00.000Z | 2022-01-24T21:29:26.000Z | src/gromacs/mdlib/updategroups.cpp | hejamu/gromacs | 4f4b9e4b197ae78456faada74c9f4cab7d128de6 | [
"BSD-2-Clause"
] | 258 | 2015-01-19T11:19:57.000Z | 2022-03-18T08:59:52.000Z | /*
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2018,2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* GROMACS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* GROMACS 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GROMACS; if not, see
* http://www.gnu.org/licenses, or write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* If you want to redistribute modifications to GROMACS, please
* consider that scientific software is very special. Version
* control is crucial - bugs must be traceable. We will be happy to
* consider code for inclusion in the official distribution, but
* derived work must not be called official GROMACS. Details are found
* in the README & COPYING files - if they are missing, get the
* official version at http://www.gromacs.org.
*
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
/* \internal \file
*
* \brief Implements functions for generating update groups
*
* \author Berk Hess <hess@kth.se>
* \ingroup module_mdlib
*/
#include "gmxpre.h"
#include "updategroups.h"
#include <cmath>
#include <unordered_map>
#include "gromacs/math/functions.h"
#include "gromacs/math/units.h"
#include "gromacs/math/utilities.h"
#include "gromacs/mdlib/constr.h"
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/topology/idef.h"
#include "gromacs/topology/ifunc.h"
#include "gromacs/topology/mtop_util.h"
#include "gromacs/topology/topology.h"
#include "gromacs/utility/listoflists.h"
#include "gromacs/utility/logger.h"
#include "gromacs/utility/message_string_collector.h"
namespace gmx
{
/*! \brief Returns whether \p moltype contains flexible constraints */
static bool hasFlexibleConstraints(const gmx_moltype_t& moltype, gmx::ArrayRef<const t_iparams> iparams)
{
for (auto& ilist : extractILists(moltype.ilist, IF_CONSTRAINT))
{
if (ilist.functionType != F_SETTLE)
{
for (size_t i = 0; i < ilist.iatoms.size(); i += ilistStride(ilist))
{
if (isConstraintFlexible(iparams, ilist.iatoms[i]))
{
return true;
}
}
}
}
return false;
}
/*! \brief Returns whether moltype has incompatible vsites.
*
* For simplicity the only compatible vsites are linear 2 or 3 atom sites
* that are constructed in between the 2 or 3 contructing atoms,
*/
static bool hasIncompatibleVsites(const gmx_moltype_t& moltype, gmx::ArrayRef<const t_iparams> iparams)
{
bool hasIncompatibleVsites = false;
for (auto& ilist : extractILists(moltype.ilist, IF_VSITE))
{
if (ilist.functionType == F_VSITE2 || ilist.functionType == F_VSITE3)
{
for (size_t i = 0; i < ilist.iatoms.size(); i += ilistStride(ilist))
{
const t_iparams& iparam = iparams[ilist.iatoms[i]];
real coeffMin;
real coeffSum;
if (ilist.functionType == F_VSITE2)
{
coeffMin = iparam.vsite.a;
coeffSum = iparam.vsite.a;
}
else
{
coeffMin = std::min(iparam.vsite.a, iparam.vsite.b);
coeffSum = iparam.vsite.a + iparam.vsite.b;
}
if (coeffMin < 0 || coeffSum > 1)
{
hasIncompatibleVsites = true;
break;
}
}
}
else
{
hasIncompatibleVsites = true;
break;
}
}
return hasIncompatibleVsites;
}
/*! \brief Returns a merged list with constraints of all types */
static InteractionList jointConstraintList(const gmx_moltype_t& moltype)
{
InteractionList ilistCombined;
std::vector<int>& iatoms = ilistCombined.iatoms;
for (auto& ilist : extractILists(moltype.ilist, IF_CONSTRAINT))
{
if (ilist.functionType == F_SETTLE)
{
for (size_t i = 0; i < ilist.iatoms.size(); i += ilistStride(ilist))
{
iatoms.push_back(-1);
iatoms.push_back(ilist.iatoms[i + 1]);
iatoms.push_back(ilist.iatoms[i + 2]);
iatoms.push_back(-1);
iatoms.push_back(ilist.iatoms[i + 1]);
iatoms.push_back(ilist.iatoms[i + 3]);
iatoms.push_back(-1);
iatoms.push_back(ilist.iatoms[i + 2]);
iatoms.push_back(ilist.iatoms[i + 3]);
}
}
else
{
GMX_RELEASE_ASSERT(NRAL(ilist.functionType) == 2,
"Can only handle two-atom non-SETTLE constraints");
iatoms.insert(iatoms.end(), ilist.iatoms.begin(), ilist.iatoms.end());
}
}
return ilistCombined;
}
/*! \brief Struct for returning an atom range */
struct AtomIndexExtremes
{
int minAtom; //!< The minimum atom index
int maxAtom; //!< The maximum atom index
};
/*! \brief Returns the range of constructing atom for vsite with atom index \p a */
static AtomIndexExtremes vsiteConstructRange(int a, const gmx_moltype_t& moltype)
{
AtomIndexExtremes extremes = { -1, -1 };
for (auto& ilist : extractILists(moltype.ilist, IF_VSITE))
{
for (size_t i = 0; i < ilist.iatoms.size(); i += ilistStride(ilist))
{
if (ilist.iatoms[i + 1] == a)
{
extremes.minAtom = ilist.iatoms[i + 2];
extremes.maxAtom = ilist.iatoms[i + 2];
for (size_t j = i + 3; j < i + ilistStride(ilist); j++)
{
extremes.minAtom = std::min(extremes.minAtom, ilist.iatoms[j]);
extremes.maxAtom = std::max(extremes.maxAtom, ilist.iatoms[j]);
}
return extremes;
}
}
}
GMX_RELEASE_ASSERT(false, "If a is a vsite, we should have found constructing atoms");
return extremes;
}
/*! \brief Returns the range of atoms constrained to atom \p a (including \p a itself) */
static AtomIndexExtremes constraintAtomRange(int a,
const ListOfLists<int>& at2con,
const InteractionList& ilistConstraints)
{
AtomIndexExtremes extremes = { a, a };
for (const int constraint : at2con[a])
{
for (int j = 0; j < 2; j++)
{
int atomJ = ilistConstraints.iatoms[constraint * 3 + 1 + j];
extremes.minAtom = std::min(extremes.minAtom, atomJ);
extremes.maxAtom = std::max(extremes.maxAtom, atomJ);
}
}
return extremes;
}
/*! \brief Returns a list that tells whether atoms in \p moltype are vsites */
static std::vector<bool> buildIsParticleVsite(const gmx_moltype_t& moltype)
{
std::vector<bool> isVsite(moltype.atoms.nr);
for (auto& ilist : extractILists(moltype.ilist, IF_VSITE))
{
for (size_t i = 0; i < ilist.iatoms.size(); i += ilistStride(ilist))
{
int vsiteAtom = ilist.iatoms[i + 1];
isVsite[vsiteAtom] = true;
}
}
return isVsite;
}
/*! \brief Returns the size of the update group starting at \p firstAtom or 0 when criteria (see updategroups.h) are not met */
static int detectGroup(int firstAtom,
const gmx_moltype_t& moltype,
const ListOfLists<int>& at2con,
const InteractionList& ilistConstraints)
{
/* We should be using moltype.atoms.atom[].ptype for checking whether
* a particle is a vsite. But the test code can't fill t_atoms,
* because it uses C pointers which get double freed.
*/
std::vector<bool> isParticleVsite = buildIsParticleVsite(moltype);
/* A non-vsite atom without constraints is an update group by itself */
if (!isParticleVsite[firstAtom] && at2con[firstAtom].empty())
{
return 1;
}
/* A (potential) update group starts at firstAtom and should consist
* of two or more atoms and possibly vsites. At least one atom should
* have constraints with all other atoms and vsites should have all
* constructing atoms inside the group. Here we increase lastAtom until
* the criteria are fulfilled or exit when criteria cannot be met.
*/
int numAtomsWithConstraints = 0;
int maxConstraintsPerAtom = 0;
int lastAtom = firstAtom;
int a = firstAtom;
while (a <= lastAtom)
{
if (isParticleVsite[a])
{
AtomIndexExtremes extremes = vsiteConstructRange(a, moltype);
if (extremes.minAtom < firstAtom)
{
/* A constructing atom is outside the group,
* we can not use update groups.
*/
return 0;
}
lastAtom = std::max(lastAtom, extremes.maxAtom);
}
else
{
const int numConstraints = at2con[a].ssize();
if (numConstraints == 0)
{
/* We can not have unconstrained atoms in an update group */
return 0;
}
/* This atom has at least one constraint.
* Check whether all constraints are within the group
* and whether we need to extend the group.
*/
numAtomsWithConstraints += 1;
maxConstraintsPerAtom = std::max(maxConstraintsPerAtom, numConstraints);
AtomIndexExtremes extremes = constraintAtomRange(a, at2con, ilistConstraints);
if (extremes.minAtom < firstAtom)
{
/* Constraint to atom outside the "group" */
return 0;
}
lastAtom = std::max(lastAtom, extremes.maxAtom);
}
a++;
}
/* lastAtom might be followed by a vsite that is constructed from atoms
* with index <= lastAtom. Handle this case.
*/
if (lastAtom + 1 < moltype.atoms.nr && isParticleVsite[lastAtom + 1])
{
AtomIndexExtremes extremes = vsiteConstructRange(lastAtom + 1, moltype);
if (extremes.minAtom < firstAtom)
{ // NOLINT bugprone-branch-clone
/* Constructing atom precedes the group */
return 0;
}
else if (extremes.maxAtom <= lastAtom)
{
/* All constructing atoms are in the group, add the vsite to the group */
lastAtom++;
}
else if (extremes.minAtom <= lastAtom)
{
/* Some, but not all constructing atoms are in the group */
return 0;
}
}
GMX_RELEASE_ASSERT(maxConstraintsPerAtom < numAtomsWithConstraints,
"We have checked that atoms are only constrained to atoms within the group,"
"so each atom should have fewer constraints than the number of atoms");
/* Check that at least one atom is constrained to all others */
if (maxConstraintsPerAtom != numAtomsWithConstraints - 1)
{
return 0;
}
return lastAtom - firstAtom + 1;
}
/*! \brief Returns a list of update groups for \p moltype */
static RangePartitioning makeUpdateGroupingsPerMoleculeType(const gmx_moltype_t& moltype,
gmx::ArrayRef<const t_iparams> iparams)
{
RangePartitioning groups;
/* Update groups are not compatible with flexible constraints.
* Without dynamics the flexible constraints are ignored,
* but since performance for EM/NM is less critical, we do not
* use update groups to keep the code here simpler.
*/
if (hasFlexibleConstraints(moltype, iparams) || hasIncompatibleVsites(moltype, iparams))
{
return groups;
}
/* Combine all constraint ilists into a single one */
std::array<InteractionList, F_NRE> ilistsCombined;
ilistsCombined[F_CONSTR] = jointConstraintList(moltype);
/* We "include" flexible constraints, but none are present (checked above) */
const ListOfLists<int> at2con = make_at2con(
moltype.atoms.nr, ilistsCombined, iparams, FlexibleConstraintTreatment::Include);
bool satisfiesCriteria = true;
int firstAtom = 0;
while (satisfiesCriteria && firstAtom < moltype.atoms.nr)
{
int numAtomsInGroup = detectGroup(firstAtom, moltype, at2con, ilistsCombined[F_CONSTR]);
if (numAtomsInGroup == 0)
{
satisfiesCriteria = false;
}
else
{
groups.appendBlock(numAtomsInGroup);
}
firstAtom += numAtomsInGroup;
}
if (!satisfiesCriteria)
{
/* Make groups empty, to signal not satisfying the criteria */
groups.clear();
}
return groups;
}
std::vector<RangePartitioning> makeUpdateGroupingsPerMoleculeType(const gmx_mtop_t& mtop)
{
std::vector<RangePartitioning> updateGroupingsPerMoleculeType;
bool systemSatisfiesCriteria = true;
for (const gmx_moltype_t& moltype : mtop.moltype)
{
updateGroupingsPerMoleculeType.push_back(
makeUpdateGroupingsPerMoleculeType(moltype, mtop.ffparams.iparams));
if (updateGroupingsPerMoleculeType.back().numBlocks() == 0)
{
systemSatisfiesCriteria = false;
}
}
if (!systemSatisfiesCriteria)
{
updateGroupingsPerMoleculeType.clear();
}
return updateGroupingsPerMoleculeType;
}
/*! \brief Returns a map of angles ilist.iatoms indices with the middle atom as key */
static std::unordered_multimap<int, int> getAngleIndices(const gmx_moltype_t& moltype)
{
const InteractionList& angles = moltype.ilist[F_ANGLES];
std::unordered_multimap<int, int> indices(angles.size());
for (int i = 0; i < angles.size(); i += 1 + NRAL(F_ANGLES))
{
indices.insert({ angles.iatoms[i + 2], i });
}
return indices;
}
/*! \brief When possible, computes the maximum radius of constrained atom in an update group
*
* Supports groups with 2 or 3 atoms where all partner atoms are connected to
* each other by angle potentials. The temperature is used to compute a radius
* that is not exceeded with a chance of 10^-9. Note that this computation
* assumes there are no other strong forces working on these angular
* degrees of freedom.
* The return value is -1 when all partners are not connected to each other
* by one angle potential, when a potential is perturbed or when an angle
* could reach more than 180 degrees.
*/
template<int numPartnerAtoms>
static real constraintGroupRadius(const gmx_moltype_t& moltype,
gmx::ArrayRef<const t_iparams> iparams,
const int centralAtom,
const ListOfLists<int>& at2con,
const std::unordered_multimap<int, int>& angleIndices,
const real constraintLength,
const real temperature)
{
const int numConstraints = at2con[centralAtom].ssize();
GMX_RELEASE_ASSERT(numConstraints == numPartnerAtoms,
"We expect as many constraints as partner atoms here");
std::array<int, numPartnerAtoms> partnerAtoms;
for (int i = 0; i < numPartnerAtoms; i++)
{
const int ind = at2con[centralAtom][i] * 3;
if (ind >= moltype.ilist[F_CONSTR].size())
{
/* This is a flexible constraint, we don't optimize for that */
return -1;
}
const int a1 = moltype.ilist[F_CONSTR].iatoms[ind + 1];
const int a2 = moltype.ilist[F_CONSTR].iatoms[ind + 2];
partnerAtoms[i] = (a1 == centralAtom ? a2 : a1);
}
const InteractionList& angles = moltype.ilist[F_ANGLES];
auto range = angleIndices.equal_range(centralAtom);
int angleType = -1;
std::array<int, numPartnerAtoms> numAngles = { 0 };
bool areSameType = true;
for (auto it = range.first; it != range.second; ++it)
{
/* Check if the outer atoms in the angle are both partner atoms */
int numAtomsFound = 0;
for (int ind = it->second + 1; ind < it->second + 4; ind += 2)
{
for (const int& partnerAtom : partnerAtoms)
{
if (angles.iatoms[ind] == partnerAtom)
{
numAtomsFound++;
}
}
}
if (numAtomsFound == 2)
{
/* Check that the angle potentials have the same type */
if (angleType == -1)
{
angleType = angles.iatoms[it->second];
}
else if (angles.iatoms[it->second] != angleType)
{
areSameType = false;
}
/* Count the number of angle interactions per atoms */
for (int ind = it->second + 1; ind < it->second + 4; ind += 2)
{
for (size_t i = 0; i < partnerAtoms.size(); i++)
{
if (angles.iatoms[ind] == partnerAtoms[i])
{
numAngles[i]++;
}
}
}
}
}
bool criteriaSatisfied = areSameType;
for (int i = 0; i < numPartnerAtoms; i++)
{
if (numAngles[i] != numPartnerAtoms - 1)
{
criteriaSatisfied = false;
}
}
/* We don't bother optimizing the perturbed angle case */
const t_iparams& angleParams = iparams[angleType];
if (criteriaSatisfied && angleParams.harmonic.rB == angleParams.harmonic.rA
&& angleParams.harmonic.krB == angleParams.harmonic.krA)
{
/* Set number of stddevs such that change of exceeding < 10^-9 */
constexpr real c_numSigma = 6.0;
/* Compute the maximally stretched angle */
const real eqAngle = angleParams.harmonic.rA * gmx::c_deg2Rad;
const real fc = angleParams.harmonic.krA;
const real maxAngle =
eqAngle + c_numSigma * gmx::c_boltz * temperature / ((numPartnerAtoms - 1) * fc);
if (maxAngle >= M_PI)
{
return -1;
}
if (numPartnerAtoms == 2)
{
/* With two atoms constrainted to a cental atom we have a triangle
* with two equal sides because the constraint type is equal.
* Return the distance from the COG to the farthest two corners,
* i.e. the partner atoms.
*/
real distMidPartner = std::sin(0.5 * maxAngle) * constraintLength;
real distCentralMid = std::cos(0.5 * maxAngle) * constraintLength;
real distCogMid = distCentralMid * numPartnerAtoms / (numPartnerAtoms + 1);
real distCogPartner = std::sqrt(gmx::square(distMidPartner) + gmx::square(distCogMid));
return distCogPartner;
}
else if (numPartnerAtoms == 3)
{
/* With three atoms constrainted to a cental atom we have the
* largest COG-atom distance when one partner atom (the outlier)
* moves out by stretching its two angles by an equal amount.
* The math here gets a bit more involved, but it is still
* rather straightforward geometry.
* We first compute distances in the plane of the three partners.
* Here we have two "equilibrium" partners and one outlier.
* We make use of the "Mid" point between the two "Eq" partners.
* We project the central atom on this plane.
* Then we compute the distance of the central atom to the plane.
* The distance of the COG to the ourlier is returned.
*/
real halfDistEqPartner = std::sin(0.5 * eqAngle) * constraintLength;
real distPartnerOutlier = 2 * std::sin(0.5 * maxAngle) * constraintLength;
real distMidOutlier =
std::sqrt(gmx::square(distPartnerOutlier) - gmx::square(halfDistEqPartner));
real distMidCenterInPlane =
0.5 * (distMidOutlier - gmx::square(halfDistEqPartner) / distMidOutlier);
real distCentralToPlane =
std::sqrt(gmx::square(constraintLength) - gmx::square(halfDistEqPartner)
- gmx::square(distMidCenterInPlane));
real distCogOutlierH = distCentralToPlane / (numPartnerAtoms + 1);
real distCogOutlierP =
distMidOutlier - (distMidOutlier + distMidCenterInPlane) / (numPartnerAtoms + 1);
real distCogOutlier = std::sqrt(gmx::square(distCogOutlierH) + gmx::square(distCogOutlierP));
return distCogOutlier;
}
else
{
GMX_RELEASE_ASSERT(false, "Only 2 or 3 constraints are supported here");
}
}
return -1;
}
/*! \brief Returns the maximum update group radius for \p moltype */
static real computeMaxUpdateGroupRadius(const gmx_moltype_t& moltype,
gmx::ArrayRef<const t_iparams> iparams,
const RangePartitioning& updateGrouping,
real temperature)
{
GMX_RELEASE_ASSERT(!hasFlexibleConstraints(moltype, iparams),
"Flexible constraints are not supported here");
const InteractionList& settles = moltype.ilist[F_SETTLE];
const ListOfLists<int> at2con = make_at2con(moltype, iparams, FlexibleConstraintTreatment::Include);
const auto angleIndices = getAngleIndices(moltype);
real maxRadius = 0;
for (int group = 0; group < updateGrouping.numBlocks(); group++)
{
if (updateGrouping.block(group).size() == 1)
{
/* Single atom group, radius is zero */
continue;
}
/* Find the atom maxAtom with the maximum number of constraints */
int maxNumConstraints = 0;
int maxAtom = -1;
for (int a : updateGrouping.block(group))
{
const int numConstraints = at2con[a].ssize();
if (numConstraints > maxNumConstraints)
{
maxNumConstraints = numConstraints;
maxAtom = a;
}
}
GMX_ASSERT(maxAtom >= 0 || !settles.empty(),
"We should have at least two atoms in the group with constraints");
if (maxAtom < 0)
{
continue;
}
bool allTypesAreEqual = true;
int constraintType = -1;
real maxConstraintLength = 0;
real sumConstraintLengths = 0;
bool isFirstConstraint = true;
for (const int constraint : at2con[maxAtom])
{
int conIndex = constraint * (1 + NRAL(F_CONSTR));
int iparamsIndex;
if (conIndex < moltype.ilist[F_CONSTR].size())
{
iparamsIndex = moltype.ilist[F_CONSTR].iatoms[conIndex];
}
else
{
iparamsIndex =
moltype.ilist[F_CONSTRNC].iatoms[conIndex - moltype.ilist[F_CONSTR].size()];
}
if (isFirstConstraint)
{
constraintType = iparamsIndex;
isFirstConstraint = false;
}
else if (iparamsIndex != constraintType)
{
allTypesAreEqual = false;
}
/* Here we take the maximum constraint length of the A and B
* topology, which assumes lambda is between 0 and 1 for
* free-energy runs.
*/
real constraintLength =
std::max(iparams[iparamsIndex].constr.dA, iparams[iparamsIndex].constr.dB);
maxConstraintLength = std::max(maxConstraintLength, constraintLength);
sumConstraintLengths += constraintLength;
}
int numConstraints = at2con[maxAtom].ssize();
real radius;
if (numConstraints == 1)
{
/* Single constraint: the radius is the distance from the midpoint */
radius = 0.5_real * maxConstraintLength;
}
else
{
radius = -1;
/* With 2 constraints the maximum possible radius is the
* constraint length, so we can use that for the 0 K case.
*/
if (numConstraints == 2 && allTypesAreEqual && temperature > 0)
{
radius = constraintGroupRadius<2>(
moltype, iparams, maxAtom, at2con, angleIndices, maxConstraintLength, temperature);
}
/* With 3 constraints the maximum possible radius is 1.4 times
* the constraint length, so it is worth computing a smaller
* radius to enable update groups for systems in a small box.
*/
if (numConstraints == 3 && allTypesAreEqual && temperature >= 0)
{
radius = constraintGroupRadius<3>(
moltype, iparams, maxAtom, at2con, angleIndices, maxConstraintLength, temperature);
if (temperature == 0 && radius >= 0)
{
/* Add a 10% margin for deviation at 0 K */
radius *= 1.1_real;
}
}
if (radius < 0)
{
/* Worst case: atom with the longest constraint on one side
* of the center, all others on the opposite side
*/
radius = maxConstraintLength
+ (sumConstraintLengths - 2 * maxConstraintLength) / (numConstraints + 1);
}
}
maxRadius = std::max(maxRadius, radius);
}
for (int i = 0; i < settles.size(); i += 1 + NRAL(F_SETTLE))
{
const real dOH = iparams[settles.iatoms[i]].settle.doh;
const real dHH = iparams[settles.iatoms[i]].settle.dhh;
/* Compute distance^2 from center of geometry to O and H */
const real dCO2 = (4 * dOH * dOH - dHH * dHH) / 9;
const real dCH2 = (dOH * dOH + 2 * dHH * dHH) / 9;
const real dCAny = std::sqrt(std::max(dCO2, dCH2));
maxRadius = std::max(maxRadius, dCAny);
}
return maxRadius;
}
real computeMaxUpdateGroupRadius(const gmx_mtop_t& mtop,
gmx::ArrayRef<const RangePartitioning> updateGroupingsPerMoleculeType,
real temperature)
{
if (updateGroupingsPerMoleculeType.empty())
{
return 0;
}
GMX_RELEASE_ASSERT(updateGroupingsPerMoleculeType.size() == mtop.moltype.size(),
"We need one update group entry per moleculetype");
real maxRadius = 0;
for (size_t moltype = 0; moltype < mtop.moltype.size(); moltype++)
{
const real radiusOfThisMoleculeType = computeMaxUpdateGroupRadius(
mtop.moltype[moltype], mtop.ffparams.iparams, updateGroupingsPerMoleculeType[moltype], temperature);
maxRadius = std::max(maxRadius, radiusOfThisMoleculeType);
}
return maxRadius;
}
real computeCutoffMargin(PbcType pbcType, matrix box, const real rlist)
{
return std::sqrt(max_cutoff2(pbcType, box)) - rlist;
}
UpdateGroups::UpdateGroups(std::vector<RangePartitioning>&& updateGroupingPerMoleculeType,
const real maxUpdateGroupRadius) :
useUpdateGroups_(true),
updateGroupingPerMoleculeType_(std::move(updateGroupingPerMoleculeType)),
maxUpdateGroupRadius_(maxUpdateGroupRadius)
{
}
bool systemHasConstraintsOrVsites(const gmx_mtop_t& mtop)
{
IListRange ilistRange(mtop);
return std::any_of(ilistRange.begin(), ilistRange.end(), [](const auto& ilists) {
return !extractILists(ilists.list(), IF_CONSTRAINT | IF_VSITE).empty();
});
}
UpdateGroups makeUpdateGroups(const gmx::MDLogger& mdlog,
std::vector<RangePartitioning>&& updateGroupingPerMoleculeType,
const real maxUpdateGroupRadius,
const bool useDomainDecomposition,
const bool systemHasConstraintsOrVsites,
const real cutoffMargin)
{
MessageStringCollector messages;
messages.startContext("When checking whether update groups are usable:");
messages.appendIf(!useDomainDecomposition,
"Domain decomposition is not active, so there is no need for update groups");
messages.appendIf(!systemHasConstraintsOrVsites,
"No constraints or virtual sites are in use, so it is best not to use update "
"groups");
messages.appendIf(
updateGroupingPerMoleculeType.empty(),
"At least one moleculetype does not conform to the requirements for using update "
"groups");
messages.appendIf(
getenv("GMX_NO_UPDATEGROUPS") != nullptr,
"Environment variable GMX_NO_UPDATEGROUPS prohibited the use of update groups");
// To use update groups, the large domain-to-domain cutoff
// distance should be compatible with the box size.
messages.appendIf(2 * maxUpdateGroupRadius >= cutoffMargin,
"The combination of rlist and box size prohibits the use of update groups");
if (!messages.isEmpty())
{
// Log why we can't use update groups
GMX_LOG(mdlog.info).appendText(messages.toString());
return UpdateGroups();
}
// Success!
return UpdateGroups(std::move(updateGroupingPerMoleculeType), maxUpdateGroupRadius);
}
} // namespace gmx
| 37.897934 | 127 | 0.58118 | [
"geometry",
"vector"
] |
d73d0c461f2dba23742dfa9e10aa2bbae67a5362 | 6,913 | cc | C++ | Alignment/CommonAlignment/src/AlignableBeamSpot.cc | samarendran23/cmssw | 849dd9897db9b894ca83e1b630a3c1eecafd6097 | [
"Apache-2.0"
] | 6 | 2017-09-08T14:12:56.000Z | 2022-03-09T23:57:01.000Z | Alignment/CommonAlignment/src/AlignableBeamSpot.cc | samarendran23/cmssw | 849dd9897db9b894ca83e1b630a3c1eecafd6097 | [
"Apache-2.0"
] | 545 | 2017-09-19T17:10:19.000Z | 2022-03-07T16:55:27.000Z | Alignment/CommonAlignment/src/AlignableBeamSpot.cc | p2l1pfp/cmssw | 9bda22bf33ecf18dd19a3af2b3a8cbdb1de556a9 | [
"Apache-2.0"
] | 14 | 2017-10-04T09:47:21.000Z | 2019-10-23T18:04:45.000Z | /** \file AlignableBeamSpot
*
* Original author: Andreas Mussgiller, August 2010
*
* $Date: 2010/10/26 19:53:53 $
* $Revision: 1.2 $
* (last update by $Author: flucke $)
*/
#include "Alignment/CommonAlignment/interface/AlignableDetUnit.h"
#include "CondFormats/Alignment/interface/Alignments.h"
#include "CondFormats/Alignment/interface/AlignmentErrorsExtended.h"
#include "CLHEP/Vector/RotationInterfaces.h"
#include "DataFormats/TrackingRecHit/interface/AlignmentPositionError.h"
#include "Alignment/CommonAlignment/interface/AlignableBeamSpot.h"
#include "FWCore/Utilities/interface/Exception.h"
#include "FWCore/MessageLogger/interface/MessageLogger.h"
//__________________________________________________________________________________________________
AlignableBeamSpot::AlignableBeamSpot()
: Alignable(AlignableBeamSpot::detId().rawId(), AlignableSurface()),
theAlignmentPositionError(nullptr),
theInitializedFlag(false) {}
//__________________________________________________________________________________________________
AlignableBeamSpot::~AlignableBeamSpot() { delete theAlignmentPositionError; }
//__________________________________________________________________________________________________
void AlignableBeamSpot::move(const GlobalVector& displacement) {
theSurface.move(displacement);
this->addDisplacement(displacement);
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::rotateInGlobalFrame(const RotationType& rotation) {
theSurface.rotate(rotation);
this->addRotation(rotation);
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::setAlignmentPositionError(const AlignmentPositionError& ape, bool propagateDown) {
if (!theAlignmentPositionError)
theAlignmentPositionError = new AlignmentPositionError(ape);
else
*theAlignmentPositionError = ape;
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::addAlignmentPositionError(const AlignmentPositionError& ape, bool propagateDown) {
if (!theAlignmentPositionError) {
theAlignmentPositionError = new AlignmentPositionError(ape);
} else {
*theAlignmentPositionError += ape;
}
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::addAlignmentPositionErrorFromRotation(const RotationType& rot, bool propagateDown) {}
//__________________________________________________________________________________________________
/// Adds the AlignmentPositionError (in x,y,z coordinates) that would result
/// on the various components from a possible Rotation of a composite the
/// rotation matrix is in interpreted in LOCAL coordinates of the composite
void AlignableBeamSpot::addAlignmentPositionErrorFromLocalRotation(const RotationType& rot, bool propagateDown) {}
//__________________________________________________________________________________________________
void AlignableBeamSpot::setSurfaceDeformation(const SurfaceDeformation*, bool) {
edm::LogInfo("Alignment") << "@SUB=AlignableBeamSpot::setSurfaceDeformation"
<< "Useless method for beam spot, do nothing.";
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::addSurfaceDeformation(const SurfaceDeformation*, bool) {
edm::LogInfo("Alignment") << "@SUB=AlignableBeamSpot::addSurfaceDeformation"
<< "Useless method for beam spot, do nothing.";
}
//__________________________________________________________________________________________________
void AlignableBeamSpot::dump(void) const {
// Dump this
LocalVector lv(0.0, 0.0, 1.0);
GlobalVector gv = theSurface.toGlobal(lv);
edm::LogInfo("AlignableDump") << " Alignable of type " << this->alignableObjectId() << " has 0 components"
<< std::endl
<< " position = " << this->globalPosition() << ", orientation:" << std::endl
<< std::flush << this->globalRotation() << std::endl
<< std::flush << " dxdz = " << gv.x() / gv.z() << " dydz = " << gv.y() / gv.z()
<< std::endl;
}
//__________________________________________________________________________________________________
Alignments* AlignableBeamSpot::alignments() const {
Alignments* m_alignments = new Alignments();
RotationType rot(this->globalRotation());
// Get position, rotation, detId
CLHEP::Hep3Vector clhepVector(globalPosition().x(), globalPosition().y(), globalPosition().z());
CLHEP::HepRotation clhepRotation(
CLHEP::HepRep3x3(rot.xx(), rot.xy(), rot.xz(), rot.yx(), rot.yy(), rot.yz(), rot.zx(), rot.zy(), rot.zz()));
uint32_t detId = theId;
AlignTransform transform(clhepVector, clhepRotation, detId);
// Add to alignments container
m_alignments->m_align.push_back(transform);
return m_alignments;
}
//__________________________________________________________________________________________________
AlignmentErrorsExtended* AlignableBeamSpot::alignmentErrors(void) const {
AlignmentErrorsExtended* m_alignmentErrors = new AlignmentErrorsExtended();
// Add associated alignment position error
uint32_t detId = theId;
CLHEP::HepSymMatrix clhepSymMatrix(6, 0);
if (theAlignmentPositionError) // Might not be set
clhepSymMatrix = asHepMatrix(theAlignmentPositionError->globalError().matrix());
AlignTransformErrorExtended transformError(clhepSymMatrix, detId);
m_alignmentErrors->m_alignError.push_back(transformError);
return m_alignmentErrors;
}
//______________________________________________________________________________
void AlignableBeamSpot::initialize(double x, double y, double z, double dxdz, double dydz) {
if (theInitializedFlag)
return;
GlobalVector gv(x, y, z);
theSurface.move(gv);
double angleY = std::atan(dxdz);
double angleX = -std::atan(dydz);
align::RotationType rotY(std::cos(angleY), 0., -std::sin(angleY), 0., 1., 0., std::sin(angleY), 0., std::cos(angleY));
align::RotationType rotX(1., 0., 0., 0., std::cos(angleX), std::sin(angleX), 0., -std::sin(angleX), std::cos(angleX));
theSurface.rotate(rotY * rotX);
this->dump();
theInitializedFlag = true;
}
//______________________________________________________________________________
void AlignableBeamSpot::reset() {
Alignable::update(this->id(), AlignableSurface());
delete theAlignmentPositionError;
theAlignmentPositionError = nullptr;
theInitializedFlag = false;
}
//______________________________________________________________________________
const align::Alignables AlignableBeamSpot::emptyComponents_{};
| 43.20625 | 120 | 0.772458 | [
"vector",
"transform"
] |
d73df6418ddeb1fd65e5ce7901dc80206d2885b8 | 16,348 | cpp | C++ | src/qt/qtbase/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.cpp | viewdy/phantomjs | eddb0db1d253fd0c546060a4555554c8ee08c13c | [
"BSD-3-Clause"
] | 513 | 2015-09-27T15:16:57.000Z | 2022-03-08T09:26:35.000Z | src/qt/qtbase/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.cpp | mrampersad/phantomjs | dca6f77a36699eb4e1c46f7600cca618f01b0ac3 | [
"BSD-3-Clause"
] | 133 | 2015-09-28T23:41:42.000Z | 2021-06-21T03:59:11.000Z | src/qt/qtbase/src/3rdparty/angle/src/libGLESv2/renderer/d3d9/Blit.cpp | mrampersad/phantomjs | dca6f77a36699eb4e1c46f7600cca618f01b0ac3 | [
"BSD-3-Clause"
] | 40 | 2016-01-18T16:56:36.000Z | 2022-02-27T13:03:51.000Z | #include "precompiled.h"
//
// Copyright (c) 2002-2010 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Blit.cpp: Surface copy utility class.
#include "libGLESv2/renderer/d3d9/Blit.h"
#include "libGLESv2/main.h"
#include "libGLESv2/renderer/d3d9/renderer9_utils.h"
#include "libGLESv2/renderer/d3d9/TextureStorage9.h"
#include "libGLESv2/renderer/d3d9/RenderTarget9.h"
#include "libGLESv2/renderer/d3d9/Renderer9.h"
#include "libGLESv2/Framebuffer.h"
#include "libGLESv2/Renderbuffer.h"
namespace
{
#include "libGLESv2/renderer/d3d9/shaders/compiled/standardvs.h"
#include "libGLESv2/renderer/d3d9/shaders/compiled/flipyvs.h"
#include "libGLESv2/renderer/d3d9/shaders/compiled/passthroughps.h"
#include "libGLESv2/renderer/d3d9/shaders/compiled/luminanceps.h"
#include "libGLESv2/renderer/d3d9/shaders/compiled/componentmaskps.h"
const BYTE* const g_shaderCode[] =
{
g_vs20_standardvs,
g_vs20_flipyvs,
g_ps20_passthroughps,
g_ps20_luminanceps,
g_ps20_componentmaskps
};
const size_t g_shaderSize[] =
{
sizeof(g_vs20_standardvs),
sizeof(g_vs20_flipyvs),
sizeof(g_ps20_passthroughps),
sizeof(g_ps20_luminanceps),
sizeof(g_ps20_componentmaskps)
};
}
namespace rx
{
Blit::Blit(rx::Renderer9 *renderer)
: mRenderer(renderer), mQuadVertexBuffer(NULL), mQuadVertexDeclaration(NULL), mSavedStateBlock(NULL), mSavedRenderTarget(NULL), mSavedDepthStencil(NULL)
{
initGeometry();
memset(mCompiledShaders, 0, sizeof(mCompiledShaders));
}
Blit::~Blit()
{
if (mSavedStateBlock) mSavedStateBlock->Release();
if (mQuadVertexBuffer) mQuadVertexBuffer->Release();
if (mQuadVertexDeclaration) mQuadVertexDeclaration->Release();
for (int i = 0; i < SHADER_COUNT; i++)
{
if (mCompiledShaders[i])
{
mCompiledShaders[i]->Release();
}
}
}
void Blit::initGeometry()
{
static const float quad[] =
{
-1, -1,
-1, 1,
1, -1,
1, 1
};
IDirect3DDevice9 *device = mRenderer->getDevice();
HRESULT result = device->CreateVertexBuffer(sizeof(quad), D3DUSAGE_WRITEONLY, 0, D3DPOOL_DEFAULT, &mQuadVertexBuffer, NULL);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return gl::error(GL_OUT_OF_MEMORY);
}
void *lockPtr = NULL;
result = mQuadVertexBuffer->Lock(0, 0, &lockPtr, 0);
if (FAILED(result) || lockPtr == NULL)
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return gl::error(GL_OUT_OF_MEMORY);
}
memcpy(lockPtr, quad, sizeof(quad));
mQuadVertexBuffer->Unlock();
static const D3DVERTEXELEMENT9 elements[] =
{
{ 0, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },
D3DDECL_END()
};
result = device->CreateVertexDeclaration(elements, &mQuadVertexDeclaration);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return gl::error(GL_OUT_OF_MEMORY);
}
}
template <class D3DShaderType>
bool Blit::setShader(ShaderId source, const char *profile,
D3DShaderType *(rx::Renderer9::*createShader)(const DWORD *, size_t length),
HRESULT (WINAPI IDirect3DDevice9::*setShader)(D3DShaderType*))
{
IDirect3DDevice9 *device = mRenderer->getDevice();
D3DShaderType *shader;
if (mCompiledShaders[source] != NULL)
{
shader = static_cast<D3DShaderType*>(mCompiledShaders[source]);
}
else
{
const BYTE* shaderCode = g_shaderCode[source];
size_t shaderSize = g_shaderSize[source];
shader = (mRenderer->*createShader)(reinterpret_cast<const DWORD*>(shaderCode), shaderSize);
if (!shader)
{
ERR("Failed to create shader for blit operation");
return false;
}
mCompiledShaders[source] = shader;
}
HRESULT hr = (device->*setShader)(shader);
if (FAILED(hr))
{
ERR("Failed to set shader for blit operation");
return false;
}
return true;
}
bool Blit::setVertexShader(ShaderId shader)
{
return setShader<IDirect3DVertexShader9>(shader, "vs_2_0", &rx::Renderer9::createVertexShader, &IDirect3DDevice9::SetVertexShader);
}
bool Blit::setPixelShader(ShaderId shader)
{
return setShader<IDirect3DPixelShader9>(shader, "ps_2_0", &rx::Renderer9::createPixelShader, &IDirect3DDevice9::SetPixelShader);
}
RECT Blit::getSurfaceRect(IDirect3DSurface9 *surface) const
{
D3DSURFACE_DESC desc;
surface->GetDesc(&desc);
RECT rect;
rect.left = 0;
rect.top = 0;
rect.right = desc.Width;
rect.bottom = desc.Height;
return rect;
}
bool Blit::boxFilter(IDirect3DSurface9 *source, IDirect3DSurface9 *dest)
{
IDirect3DTexture9 *texture = copySurfaceToTexture(source, getSurfaceRect(source));
if (!texture)
{
return false;
}
IDirect3DDevice9 *device = mRenderer->getDevice();
saveState();
device->SetTexture(0, texture);
device->SetRenderTarget(0, dest);
setVertexShader(SHADER_VS_STANDARD);
setPixelShader(SHADER_PS_PASSTHROUGH);
setCommonBlitState();
device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
setViewport(getSurfaceRect(dest), 0, 0);
render();
texture->Release();
restoreState();
return true;
}
bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterface2D *storage, GLint level)
{
RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *source = NULL;
gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(0);
if (colorbuffer)
{
renderTarget = RenderTarget9::makeRenderTarget9(colorbuffer->getRenderTarget());
}
if (renderTarget)
{
source = renderTarget->getSurface();
}
if (!source)
{
ERR("Failed to retrieve the render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
}
TextureStorage9_2D *storage9 = TextureStorage9_2D::makeTextureStorage9_2D(storage->getStorageInstance());
IDirect3DSurface9 *destSurface = storage9->getSurfaceLevel(level, true);
bool result = false;
if (destSurface)
{
result = copy(source, sourceRect, destFormat, xoffset, yoffset, destSurface);
destSurface->Release();
}
source->Release();
return result;
}
bool Blit::copy(gl::Framebuffer *framebuffer, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, TextureStorageInterfaceCube *storage, GLenum target, GLint level)
{
RenderTarget9 *renderTarget = NULL;
IDirect3DSurface9 *source = NULL;
gl::Renderbuffer *colorbuffer = framebuffer->getColorbuffer(0);
if (colorbuffer)
{
renderTarget = RenderTarget9::makeRenderTarget9(colorbuffer->getRenderTarget());
}
if (renderTarget)
{
source = renderTarget->getSurface();
}
if (!source)
{
ERR("Failed to retrieve the render target.");
return gl::error(GL_OUT_OF_MEMORY, false);
}
TextureStorage9_Cube *storage9 = TextureStorage9_Cube::makeTextureStorage9_Cube(storage->getStorageInstance());
IDirect3DSurface9 *destSurface = storage9->getCubeMapSurface(target, level, true);
bool result = false;
if (destSurface)
{
result = copy(source, sourceRect, destFormat, xoffset, yoffset, destSurface);
destSurface->Release();
}
source->Release();
return result;
}
bool Blit::copy(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
{
if (!dest)
{
return false;
}
IDirect3DDevice9 *device = mRenderer->getDevice();
D3DSURFACE_DESC sourceDesc;
D3DSURFACE_DESC destDesc;
source->GetDesc(&sourceDesc);
dest->GetDesc(&destDesc);
if (sourceDesc.Format == destDesc.Format && destDesc.Usage & D3DUSAGE_RENDERTARGET &&
d3d9_gl::IsFormatChannelEquivalent(destDesc.Format, destFormat)) // Can use StretchRect
{
RECT destRect = {xoffset, yoffset, xoffset + (sourceRect.right - sourceRect.left), yoffset + (sourceRect.bottom - sourceRect.top)};
HRESULT result = device->StretchRect(source, &sourceRect, dest, &destRect, D3DTEXF_POINT);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return gl::error(GL_OUT_OF_MEMORY, false);
}
}
else
{
return formatConvert(source, sourceRect, destFormat, xoffset, yoffset, dest);
}
return true;
}
bool Blit::formatConvert(IDirect3DSurface9 *source, const RECT &sourceRect, GLenum destFormat, GLint xoffset, GLint yoffset, IDirect3DSurface9 *dest)
{
IDirect3DTexture9 *texture = copySurfaceToTexture(source, sourceRect);
if (!texture)
{
return false;
}
IDirect3DDevice9 *device = mRenderer->getDevice();
saveState();
device->SetTexture(0, texture);
device->SetRenderTarget(0, dest);
setViewport(sourceRect, xoffset, yoffset);
setCommonBlitState();
if (setFormatConvertShaders(destFormat))
{
render();
}
texture->Release();
restoreState();
return true;
}
bool Blit::setFormatConvertShaders(GLenum destFormat)
{
bool okay = setVertexShader(SHADER_VS_STANDARD);
switch (destFormat)
{
default: UNREACHABLE();
case GL_RGBA:
case GL_BGRA_EXT:
case GL_RGB:
case GL_ALPHA:
okay = okay && setPixelShader(SHADER_PS_COMPONENTMASK);
break;
case GL_LUMINANCE:
case GL_LUMINANCE_ALPHA:
okay = okay && setPixelShader(SHADER_PS_LUMINANCE);
break;
}
if (!okay)
{
return false;
}
enum { X = 0, Y = 1, Z = 2, W = 3 };
// The meaning of this constant depends on the shader that was selected.
// See the shader assembly code above for details.
float psConst0[4] = { 0, 0, 0, 0 };
switch (destFormat)
{
default: UNREACHABLE();
case GL_RGBA:
case GL_BGRA_EXT:
psConst0[X] = 1;
psConst0[Z] = 1;
break;
case GL_RGB:
psConst0[X] = 1;
psConst0[W] = 1;
break;
case GL_ALPHA:
psConst0[Z] = 1;
break;
case GL_LUMINANCE:
psConst0[Y] = 1;
break;
case GL_LUMINANCE_ALPHA:
psConst0[X] = 1;
break;
}
mRenderer->getDevice()->SetPixelShaderConstantF(0, psConst0, 1);
return true;
}
IDirect3DTexture9 *Blit::copySurfaceToTexture(IDirect3DSurface9 *surface, const RECT &sourceRect)
{
if (!surface)
{
return NULL;
}
IDirect3DDevice9 *device = mRenderer->getDevice();
D3DSURFACE_DESC sourceDesc;
surface->GetDesc(&sourceDesc);
// Copy the render target into a texture
IDirect3DTexture9 *texture;
HRESULT result = device->CreateTexture(sourceRect.right - sourceRect.left, sourceRect.bottom - sourceRect.top, 1, D3DUSAGE_RENDERTARGET, sourceDesc.Format, D3DPOOL_DEFAULT, &texture, NULL);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
return gl::error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
}
IDirect3DSurface9 *textureSurface;
result = texture->GetSurfaceLevel(0, &textureSurface);
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
texture->Release();
return gl::error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
}
mRenderer->endScene();
result = device->StretchRect(surface, &sourceRect, textureSurface, NULL, D3DTEXF_NONE);
textureSurface->Release();
if (FAILED(result))
{
ASSERT(result == D3DERR_OUTOFVIDEOMEMORY || result == E_OUTOFMEMORY);
texture->Release();
return gl::error(GL_OUT_OF_MEMORY, (IDirect3DTexture9*)NULL);
}
return texture;
}
void Blit::setViewport(const RECT &sourceRect, GLint xoffset, GLint yoffset)
{
IDirect3DDevice9 *device = mRenderer->getDevice();
D3DVIEWPORT9 vp;
vp.X = xoffset;
vp.Y = yoffset;
vp.Width = sourceRect.right - sourceRect.left;
vp.Height = sourceRect.bottom - sourceRect.top;
vp.MinZ = 0.0f;
vp.MaxZ = 1.0f;
device->SetViewport(&vp);
float halfPixelAdjust[4] = { -1.0f/vp.Width, 1.0f/vp.Height, 0, 0 };
device->SetVertexShaderConstantF(0, halfPixelAdjust, 1);
}
void Blit::setCommonBlitState()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
device->SetDepthStencilSurface(NULL);
device->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
device->SetRenderState(D3DRS_ALPHATESTENABLE, FALSE);
device->SetRenderState(D3DRS_ALPHABLENDENABLE, FALSE);
device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
device->SetRenderState(D3DRS_CLIPPLANEENABLE, 0);
device->SetRenderState(D3DRS_COLORWRITEENABLE, D3DCOLORWRITEENABLE_ALPHA | D3DCOLORWRITEENABLE_BLUE | D3DCOLORWRITEENABLE_GREEN | D3DCOLORWRITEENABLE_RED);
device->SetRenderState(D3DRS_SRGBWRITEENABLE, FALSE);
device->SetRenderState(D3DRS_SCISSORTESTENABLE, FALSE);
device->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_POINT);
device->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_POINT);
device->SetSamplerState(0, D3DSAMP_SRGBTEXTURE, FALSE);
device->SetSamplerState(0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP);
device->SetSamplerState(0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP);
RECT scissorRect = {0}; // Scissoring is disabled for flipping, but we need this to capture and restore the old rectangle
device->SetScissorRect(&scissorRect);
for(int i = 0; i < gl::MAX_VERTEX_ATTRIBS; i++)
{
device->SetStreamSourceFreq(i, 1);
}
}
void Blit::render()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
HRESULT hr = device->SetStreamSource(0, mQuadVertexBuffer, 0, 2 * sizeof(float));
hr = device->SetVertexDeclaration(mQuadVertexDeclaration);
mRenderer->startScene();
hr = device->DrawPrimitive(D3DPT_TRIANGLESTRIP, 0, 2);
}
void Blit::saveState()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
HRESULT hr;
device->GetDepthStencilSurface(&mSavedDepthStencil);
device->GetRenderTarget(0, &mSavedRenderTarget);
if (mSavedStateBlock == NULL)
{
hr = device->BeginStateBlock();
ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
setCommonBlitState();
static const float dummyConst[4] = { 0, 0, 0, 0 };
device->SetVertexShader(NULL);
device->SetVertexShaderConstantF(0, dummyConst, 1);
device->SetPixelShader(NULL);
device->SetPixelShaderConstantF(0, dummyConst, 1);
D3DVIEWPORT9 dummyVp;
dummyVp.X = 0;
dummyVp.Y = 0;
dummyVp.Width = 1;
dummyVp.Height = 1;
dummyVp.MinZ = 0;
dummyVp.MaxZ = 1;
device->SetViewport(&dummyVp);
device->SetTexture(0, NULL);
device->SetStreamSource(0, mQuadVertexBuffer, 0, 0);
device->SetVertexDeclaration(mQuadVertexDeclaration);
hr = device->EndStateBlock(&mSavedStateBlock);
ASSERT(SUCCEEDED(hr) || hr == D3DERR_OUTOFVIDEOMEMORY || hr == E_OUTOFMEMORY);
}
ASSERT(mSavedStateBlock != NULL);
if (mSavedStateBlock != NULL)
{
hr = mSavedStateBlock->Capture();
ASSERT(SUCCEEDED(hr));
}
}
void Blit::restoreState()
{
IDirect3DDevice9 *device = mRenderer->getDevice();
device->SetDepthStencilSurface(mSavedDepthStencil);
if (mSavedDepthStencil != NULL)
{
mSavedDepthStencil->Release();
mSavedDepthStencil = NULL;
}
device->SetRenderTarget(0, mSavedRenderTarget);
if (mSavedRenderTarget != NULL)
{
mSavedRenderTarget->Release();
mSavedRenderTarget = NULL;
}
ASSERT(mSavedStateBlock != NULL);
if (mSavedStateBlock != NULL)
{
mSavedStateBlock->Apply();
}
}
}
| 27.42953 | 193 | 0.669868 | [
"render"
] |
d73dfc638e88634dd127c7cc0aa2106ef63fac6e | 2,893 | cpp | C++ | Muriel/MuShader.cpp | MurielSoftware/Muriel | 169ab5a96e1cf70b47f7892906a3dca2d6481ae3 | [
"Apache-2.0"
] | 1 | 2017-03-01T12:15:27.000Z | 2017-03-01T12:15:27.000Z | Muriel/MuShader.cpp | MurielSoftware/Muriel | 169ab5a96e1cf70b47f7892906a3dca2d6481ae3 | [
"Apache-2.0"
] | 1 | 2017-03-01T12:19:17.000Z | 2017-03-01T12:19:52.000Z | Muriel/MuShader.cpp | MurielSoftware/Muriel | 169ab5a96e1cf70b47f7892906a3dca2d6481ae3 | [
"Apache-2.0"
] | null | null | null | #include "stdafx.h"
#include "MuShader.h"
#include "MuFileUtils.h"
#include "MuException.h"
#include "MuLog.h"
namespace Muriel
{
Shader::Shader()
{
}
Shader::Shader(const string& name, const string& path)
: Object(name)
{
//_shaderId = glCreateProgram();
//glAttachShader(_shaderId, vertexShader);
//glAttachShader(_shaderId, pixelShader);
//glLinkProgram(_shaderId);
string fileName = FileUtils::GET_FILE_NAME(path);
string vertexShaderPath = FileUtils::GET_PATH(path) + fileName + ".vert";
string fragmentShaderPath = FileUtils::GET_PATH(path) + fileName + ".frag";
_programId = GL::CreateProgram();
_vertexShaderId = CompileShader(ShaderType::VertexShader(), vertexShaderPath);
_fragmentShaderId = CompileShader(ShaderType::FragmentShader(), fragmentShaderPath);
GL::AttachShaderToProgram(_programId, _vertexShaderId);
GL::AttachShaderToProgram(_programId, _fragmentShaderId);
GL::LinkProgram(_programId);
if (!GL::CheckProgramLinkerStatus(_programId))
{
LOG_ERROR("Linking of failed.");
}
}
Shader::~Shader()
{
GL::DeleteProgram(_programId);
}
void Shader::Activate()
{
GL::UseShader(_programId);
}
void Shader::Deactivate()
{
GL::UseShader(0);
}
unsigned Shader::GetUniformLocation(const string& name)
{
return GL::GetUniformLocation(_programId, name.c_str());
}
void Shader::Uniform1i(const string& name, unsigned location, const int i)
{
GL::SetUniform(location, i);
}
void Shader::Uniform1f(const string& name, unsigned location, const float f)
{
GL::SetUniform(location, f);
}
void Shader::Uniform2f(const string& name, unsigned location, const Glml::Vec2& v)
{
GL::SetUniform(location, v);
}
void Shader::Uniform3f(const string& name, unsigned location, const Glml::Vec3& v)
{
GL::SetUniform(location, v);
}
void Shader::Uniform4f(const string& name, unsigned location, const Glml::Color& c)
{
GL::SetUniform(location, c);
}
void Shader::UniformArray(const string& name, unsigned location, float* values, int size)
{
GL::SetUniform(location, size, values);
}
void Shader::UniformMat3x3(const string& name, unsigned location, bool transpose, const Glml::Mat3x3& m)
{
GL::SetUniform(location, transpose, m);
}
void Shader::UniformMat4x4(const string& name, unsigned location, bool transpose, const Glml::Mat4x4& m)
{
GL::SetUniform(location, transpose, m);
}
unsigned Shader::CompileShader(ShaderType shaderType, const string& path)
{
string shaderData = FileUtils::READ_FILE(path);
unsigned shader = GL::CreateShader(shaderType);
GL::SetShaderDataSource(shader, 1, shaderData.c_str(), NULL);
GL::CompileShader(shader);
if (!GL::CheckShaderCompileStatus(shader, shaderType))
{
LOG_ERROR("Compile of failed.");
}
return shader;
}
} | 26.3 | 106 | 0.692707 | [
"object"
] |
d73e077675108a0504515325fef5796b17ffee94 | 12,972 | cxx | C++ | main/autodoc/source/ary/cpp/usedtype.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 679 | 2015-01-06T06:34:58.000Z | 2022-03-30T01:06:03.000Z | main/autodoc/source/ary/cpp/usedtype.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 102 | 2017-11-07T08:51:31.000Z | 2022-03-17T12:13:49.000Z | main/autodoc/source/ary/cpp/usedtype.cxx | Grosskopf/openoffice | 93df6e8a695d5e3eac16f3ad5e9ade1b963ab8d7 | [
"Apache-2.0"
] | 331 | 2015-01-06T11:40:55.000Z | 2022-03-14T04:07:51.000Z | /**************************************************************
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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 <precomp.h>
#include <ary/cpp/usedtype.hxx>
// NOT FULLY DEFINED SERVICES
#include <cosv/tpl/tpltools.hxx>
#include <ary/symtreenode.hxx>
#include <ary/cpp/c_ce.hxx>
#include <ary/cpp/c_class.hxx>
#include <ary/cpp/c_namesp.hxx>
#include <ary/cpp/c_slntry.hxx>
#include <ary/cpp/c_tydef.hxx>
#include <ary/cpp/c_traits.hxx>
#include <ary/cpp/c_types4cpp.hxx>
#include <ary/cpp/c_gate.hxx>
#include <ary/cpp/cp_ce.hxx>
#include <ary/cpp/cp_type.hxx>
#include <ary/doc/d_oldcppdocu.hxx>
#include <ary/getncast.hxx>
#include "tplparam.hxx"
namespace
{
using namespace ::ary::cpp;
typedef std::vector< ary::cpp::E_ConVol > PtrLevelVector;
inline bool
result2bool( intt i_nResult )
{ return i_nResult < 0; }
intt compare_PtrLevelVector(
const PtrLevelVector &
i_r1,
const PtrLevelVector &
i_r2 );
inline intt
compare_ConVol( E_ConVol i_e1,
E_ConVol i_e2 )
{ return intt(i_e1) - intt(i_e2); }
inline intt
compare_bool( bool i_b1,
bool i_b2 )
{ return i_b1 == i_b2
? 0
: i_b1
? -1
: +1; }
inline intt
compare_Specialisation( E_TypeSpecialisation i_e1,
E_TypeSpecialisation i_e2 )
{ return intt(i_e1) - intt(i_e2); }
inline bool
is_const( E_ConVol i_eCV )
{ return ( intt(i_eCV) & intt(CONVOL_const) ) != 0; }
inline bool
is_volatile( E_ConVol i_eCV )
{ return ( intt(i_eCV) & intt(CONVOL_volatile) ) != 0; }
intt
compare_PtrLevelVector( const PtrLevelVector & i_r1,
const PtrLevelVector & i_r2 )
{
intt nResult = i_r1.size() - i_r2.size();
if ( nResult != 0 )
return nResult;
PtrLevelVector::const_iterator it1 = i_r1.begin();
PtrLevelVector::const_iterator it1End = i_r1.end();
PtrLevelVector::const_iterator it2 = i_r2.begin();
for ( ; it1 != it1End; ++it1, ++it2 )
{
nResult = compare_ConVol(*it1, *it2);
if ( nResult != 0 )
return nResult;
}
return 0;
}
} // anonymous namespace
namespace ary
{
namespace cpp
{
typedef symtree::Node<CeNode_Traits> CeNode;
typedef ut::NameChain::const_iterator nc_iter;
Ce_id CheckForRelatedCe_inNode(
const CeNode & i_node,
const StringVector& i_qualification,
const String & i_name );
UsedType::UsedType(Ce_id i_scope )
: aPath(),
aPtrLevels(),
eConVol_Type(CONVOL_none),
bIsReference(false),
bIsAbsolute(false),
bRefers2BuiltInType(false),
eTypeSpecialisation(TYSP_none),
nRelatedCe(0),
nScope(i_scope)
{
}
UsedType::~UsedType()
{
}
bool
UsedType::operator<( const UsedType & i_rType ) const
{
intt nResult = compare_bool( bIsAbsolute, i_rType.bIsAbsolute );
if ( nResult != 0 )
return result2bool(nResult);
nResult = static_cast<intt>(nScope.Value())
-
static_cast<intt>(i_rType.nScope.Value());
if ( nResult != 0 )
return result2bool(nResult);
nResult = aPath.Compare( i_rType.aPath );
if ( nResult != 0 )
return result2bool(nResult);
nResult = compare_ConVol( eConVol_Type, i_rType.eConVol_Type );
if ( nResult != 0 )
return result2bool(nResult);
nResult = compare_PtrLevelVector( aPtrLevels, i_rType.aPtrLevels );
if ( nResult != 0 )
return result2bool(nResult);
nResult = compare_bool( bIsReference, i_rType.bIsReference );
if ( nResult != 0 )
return result2bool(nResult);
nResult = compare_Specialisation( eTypeSpecialisation, i_rType.eTypeSpecialisation );
if ( nResult != 0 )
return result2bool(nResult);
return false;
}
void
UsedType::Set_Absolute()
{
bIsAbsolute = true;
}
void
UsedType::Add_NameSegment( const char * i_sSeg )
{
aPath.Add_Segment(i_sSeg);
}
ut::List_TplParameter &
UsedType::Enter_Template()
{
return aPath.Templatize_LastSegment();
}
void
UsedType::Set_Unsigned()
{
eTypeSpecialisation = TYSP_unsigned;
}
void
UsedType::Set_Signed()
{
eTypeSpecialisation = TYSP_signed;
}
void
UsedType::Set_BuiltIn( const char * i_sType )
{
aPath.Add_Segment(i_sType);
bRefers2BuiltInType = true;
}
void
UsedType::Set_Const()
{
if (PtrLevel() == 0)
eConVol_Type = E_ConVol(eConVol_Type | CONVOL_const);
else
aPtrLevels.back() = E_ConVol(aPtrLevels.back() | CONVOL_const);
}
void
UsedType::Set_Volatile()
{
if (PtrLevel() == 0)
eConVol_Type = E_ConVol(eConVol_Type | CONVOL_volatile);
else
aPtrLevels.back() = E_ConVol(aPtrLevels.back() | CONVOL_volatile);
}
void
UsedType::Add_PtrLevel()
{
aPtrLevels.push_back(CONVOL_none);
}
void
UsedType::Set_Reference()
{
bIsReference = true;
}
inline bool
IsInternal(const ary::cpp::CodeEntity & i_ce)
{
const ary::doc::OldCppDocu *
docu = dynamic_cast< const ary::doc::OldCppDocu* >(i_ce.Docu().Data());
if (docu != 0)
return docu->IsInternal();
return false;
}
void
UsedType::Connect2Ce( const CePilot & i_ces)
{
StringVector
qualification;
String
name;
Get_NameParts(qualification, name);
for ( const CeNode * scope_node = CeNode_Traits::NodeOf_(
i_ces.Find_Ce(nScope));
scope_node != 0;
scope_node = scope_node->Parent() )
{
nRelatedCe = CheckForRelatedCe_inNode(*scope_node, qualification, name);
if ( nRelatedCe.IsValid() )
{
if ( IsInternal(i_ces.Find_Ce(nRelatedCe)) )
nRelatedCe = Ce_id(0);
return;
}
} // end for
}
void
UsedType::Connect2CeOnlyKnownViaBaseClass(const Gate & i_gate)
{
csv_assert(nScope.IsValid());
CesResultList
instances = i_gate.Ces().Search_TypeName( LocalName() );
// If there are no matches, or only one match that was already
// accepted, all work is done.
if ( (nRelatedCe.IsValid() AND instances.size() == 1)
OR instances.size() == 0 )
return;
StringVector
qualification;
String
name;
Get_NameParts(qualification, name);
const CodeEntity &
scopece = i_gate.Ces().Find_Ce(nScope);
// Else search for declaration in own class and then in base classes.
// These would be of higher priority than those in parent namespaces.
Ce_id
foundce = RecursiveSearchCe_InBaseClassesOf(
scopece, qualification, name, i_gate);
if (foundce.IsValid())
nRelatedCe = foundce;
if ( nRelatedCe.IsValid() AND IsInternal(i_gate.Ces().Find_Ce(nRelatedCe)) )
{
nRelatedCe = Ce_id(0);
}
}
bool
UsedType::IsBuiltInType() const
{
return bRefers2BuiltInType
AND aPtrLevels.size() == 0
AND NOT bIsReference
AND eConVol_Type == ary::cpp::CONVOL_none;
}
const String &
UsedType::LocalName() const
{
return aPath.LastSegment();
}
E_TypeSpecialisation
UsedType::TypeSpecialisation() const
{
return eTypeSpecialisation;
}
void
UsedType::do_Accept(csv::ProcessorIfc & io_processor) const
{
csv::CheckedCall(io_processor,*this);
}
ary::ClassId
UsedType::get_AryClass() const
{
return class_id;
}
Rid
UsedType::inq_RelatedCe() const
{
return nRelatedCe.Value();
}
bool
UsedType::inq_IsConst() const
{
if ( is_const(eConVol_Type) )
return true;
for ( PtrLevelVector::const_iterator it = aPtrLevels.begin();
it != aPtrLevels.end();
++it )
{
if ( is_const(*it) )
return true;
}
return false;
}
void
UsedType::inq_Get_Text( StreamStr & o_rPreName,
StreamStr & o_rName,
StreamStr & o_rPostName,
const Gate & i_rGate ) const
{
if ( is_const(eConVol_Type) )
o_rPreName << "const ";
if ( is_volatile(eConVol_Type) )
o_rPreName << "volatile ";
if ( bIsAbsolute )
o_rPreName << "::";
aPath.Get_Text( o_rPreName, o_rName, o_rPostName, i_rGate );
for ( PtrLevelVector::const_iterator it = aPtrLevels.begin();
it != aPtrLevels.end();
++it )
{
o_rPostName << " *";
if ( is_const(*it) )
o_rPostName << " const";
if ( is_volatile(*it) )
o_rPostName << " volatile";
}
if ( bIsReference )
o_rPostName << " &";
}
Ce_id
UsedType::RecursiveSearchCe_InBaseClassesOf( const CodeEntity & i_mayBeClass,
const StringVector & i_myQualification,
const String & i_myName,
const Gate & i_gate ) const
{
// Find in this class?
const CeNode *
basenode = CeNode_Traits::NodeOf_(i_mayBeClass);
if (basenode == 0)
return Ce_id(0);
Ce_id
found = CheckForRelatedCe_inNode(*basenode, i_myQualification, i_myName);
if (found.IsValid())
return found;
const Class *
cl = ary_cast<Class>(&i_mayBeClass);
if (cl == 0)
return Ce_id(0);
for ( List_Bases::const_iterator it = cl->BaseClasses().begin();
it != cl->BaseClasses().end();
++it )
{
csv_assert((*it).nId.IsValid());
Ce_id
base = i_gate.Types().Find_Type((*it).nId).RelatedCe();
while (base.IsValid() AND is_type<Typedef>(i_gate.Ces().Find_Ce(base)) )
{
base = i_gate.Types().Find_Type(
ary_cast<Typedef>(i_gate.Ces().Find_Ce(base))
.DescribingType() )
.RelatedCe();
}
if (base.IsValid())
{
const CodeEntity &
basece = i_gate.Ces().Find_Ce(base);
found = RecursiveSearchCe_InBaseClassesOf(
basece, i_myQualification, i_myName, i_gate);
if (found.IsValid())
return found;
}
} // end for
return Ce_id(0);
}
void
UsedType::Get_NameParts( StringVector & o_qualification,
String & o_name )
{
nc_iter nit = aPath.begin();
nc_iter nit_end = aPath.end();
csv_assert(nit != nit_end); // Each UsedType has to have a local name.
--nit_end;
o_name = (*nit_end).Name();
for ( ;
nit != nit_end;
++nit )
{
o_qualification.push_back( (*nit).Name() );
}
}
Ce_id
CheckForRelatedCe_inNode( const CeNode & i_node,
const StringVector & i_qualification,
const String & i_name )
{
if (i_qualification.size() > 0)
{
Ce_id
ret(0);
i_node.SearchBelow( ret,
i_qualification.begin(),
i_qualification.end(),
i_name );
return ret;
}
else
{
return i_node.Search(i_name);
}
}
namespace ut
{
List_TplParameter::List_TplParameter()
: aTplParameters()
{
}
List_TplParameter::~List_TplParameter()
{
csv::erase_container_of_heap_ptrs(aTplParameters);
}
void
List_TplParameter::AddParam_Type( Type_id i_nType )
{
aTplParameters.push_back( new TplParameter_Type(i_nType) );
}
void
List_TplParameter::Get_Text( StreamStr & o_rOut,
const ary::cpp::Gate & i_rGate ) const
{
Vector_TplArgument::const_iterator it = aTplParameters.begin();
Vector_TplArgument::const_iterator itEnd = aTplParameters.end();
if ( it == itEnd )
{
o_rOut << "<>";
return;
}
o_rOut << "< ";
(*it)->Get_Text( o_rOut, i_rGate );
for ( ++it; it != itEnd; ++it )
{
o_rOut << ", ";
(*it)->Get_Text( o_rOut, i_rGate );
}
o_rOut << " >";
}
intt
List_TplParameter::Compare( const List_TplParameter & i_rOther ) const
{
intt nResult = intt(aTplParameters.size()) - intt(i_rOther.aTplParameters.size());
if (nResult != 0)
return nResult;
Vector_TplArgument::const_iterator it1 = aTplParameters.begin();
Vector_TplArgument::const_iterator it1End = aTplParameters.end();
Vector_TplArgument::const_iterator it2 = i_rOther.aTplParameters.begin();
for ( ; it1 != it1End; ++it1, ++it2 )
{
nResult = (*it1)->Compare( *(*it2) );
if (nResult != 0)
return nResult;
}
return 0;
}
} // namespace ut
} // namespace cpp
} // namespace ary
| 22.757895 | 86 | 0.62288 | [
"vector"
] |
d73e4e55c72c2a0968090100bfec7a0cbc93611a | 16,095 | cpp | C++ | cpp-projects/exvr-designer/widgets/dialogs/resources_manager_dialog.cpp | FlorianLance/exvr | 4d210780737479e9576c90e9c80391c958787f44 | [
"MIT"
] | null | null | null | cpp-projects/exvr-designer/widgets/dialogs/resources_manager_dialog.cpp | FlorianLance/exvr | 4d210780737479e9576c90e9c80391c958787f44 | [
"MIT"
] | null | null | null | cpp-projects/exvr-designer/widgets/dialogs/resources_manager_dialog.cpp | FlorianLance/exvr | 4d210780737479e9576c90e9c80391c958787f44 | [
"MIT"
] | null | null | null |
/***********************************************************************************
** exvr-designer **
** MIT License **
** Copyright (c) [2018] [Florian Lance][EPFL-LNCO] **
** 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 "resources_manager_dialog.hpp"
// Qt
#include <QInputDialog>
#include <QDesktopServices>
// qt-utility
#include "qt_ui.hpp"
// local
#include "utility/path_utility.hpp"
using namespace tool::ex;
ResourcesManagerDialog::ResourcesManagerDialog(){
m_ui.setupUi(this);
m_ui.twCategories->tabBar()->setStyle(new VerticalTextTabWidgetStyle());
setWindowTitle("Resources manager");
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
setWindowIcon(QIcon(":/icons/Resources"));
connect(m_ui.cbReloadAudio, &QCheckBox::clicked, this, &ResourcesManagerDialog::update_resources_to_reload);
connect(m_ui.cbReloadImages, &QCheckBox::clicked, this, &ResourcesManagerDialog::update_resources_to_reload);
connect(m_ui.cbReloadMeshes, &QCheckBox::clicked, this, &ResourcesManagerDialog::update_resources_to_reload);
connect(m_ui.cbReloadClouds, &QCheckBox::clicked, this, &ResourcesManagerDialog::update_resources_to_reload);
connect(m_ui.cbReloadTextes, &QCheckBox::clicked, this, &ResourcesManagerDialog::update_resources_to_reload);
connect(m_ui.cbReloadVideos, &QCheckBox::clicked, this, &ResourcesManagerDialog::update_resources_to_reload);
connect(m_ui.cbReloadAssetBundles, &QCheckBox::clicked, this, &ResourcesManagerDialog::update_resources_to_reload);
connect(m_ui.cbReloadCSharpScripts, &QCheckBox::clicked, this, &ResourcesManagerDialog::update_resources_to_reload);
connect(m_ui.cbReloadPythonScripts, &QCheckBox::clicked, this, &ResourcesManagerDialog::update_resources_to_reload);
connect(m_ui.cbReloadScanerVideos, &QCheckBox::clicked, this, &ResourcesManagerDialog::update_resources_to_reload);
connect(m_ui.cbReloadPlots, &QCheckBox::clicked, this, &ResourcesManagerDialog::update_resources_to_reload);
for(const auto &type : Resource::get_types()){
auto tabW = new QWidget();
const QString name = from_view(Resource::get_name(type));
const QString iconPath = from_view(Resource::get_icon_path(type));
const QString displayName = from_view(Resource::get_display_name(type));
const bool canOpen = Resource::can_open(type);
const bool canGenerate = Resource::can_generate(type);
QString filters = std::string(Resource::get_filters(type)).c_str();
Ui::ResourceTypeW typeUi;
typeUi.setupUi(tabW);
typeUi.laTitle->setText(QString("All files with extensions: ") + filters);
auto lw = typeUi.lwFiles;
connect(typeUi.pbAdd, &QPushButton::clicked, this, [=]{
QString resourceDir;
switch (type) {
case Resource::Type::AssetBundle:
resourceDir = Paths::assetsBundlesDir;
break;
case Resource::Type::CSharpScript:
resourceDir = Paths::scriptsCSharpDir;
break;
case Resource::Type::PythonScript:
resourceDir = Paths::scriptsPythonDir;
break;
case Resource::Type::ScanerVideo:
// resourceDir = Paths::scriptsPythonDir;
break;
default:
break;
}
if(type == Resource::Type::Directory){
auto directoryPath = QFileDialog::getExistingDirectory(nullptr, "Select resource directory to add", resourceDir);
if(directoryPath.length() > 0){
emit add_resources_signal(type, {directoryPath});
}
return;
}else{
auto filesPath = QFileDialog::getOpenFileNames(nullptr, "Selection resources files to add", resourceDir, QString(name) + " " + filters);
if(filesPath.size() > 0){
emit add_resources_signal(type, filesPath);
}
}
});
connect(typeUi.pbRemove, &QPushButton::clicked, this, [=]{
if(auto id = lw->currentRow(); id >= 0){
emit remove_resource_signal(type, to_unsigned(id));
}
});
connect(typeUi.pbClear, &QPushButton::clicked, this, [=]{
emit clean_resources_signal(type);
});
if(type == Resource::Type::Directory){
connect(typeUi.pbFind, &QPushButton::clicked, this, [=]{
auto currentPath = typeUi.laPath->text();
auto newPath = QFileDialog::getExistingDirectory(nullptr, "Find selected resource directory", currentPath);
if(newPath.length() > 0){
emit update_resource_path_signal(currentPath, newPath);
}
});
}else{
connect(typeUi.pbFind, &QPushButton::clicked, this, [=]{
auto currentPath = typeUi.laPath->text();
auto newPath = QFileDialog::getOpenFileName(nullptr, "Find selected resource", currentPath, QString(name) + " " + filters, nullptr);
if(newPath.length() > 0){
emit update_resource_path_signal(currentPath, newPath);
}
});
}
connect(typeUi.pbSetAlias, &QPushButton::clicked, this, [=]{
auto currentAlias = typeUi.laAlias->text();
bool ok;
QString newAlias = QInputDialog::getText(
this, tr("Resource alias"),
tr("Enter new alias name:"), QLineEdit::Normal,
currentAlias, &ok);
if(ok && !newAlias.isEmpty()){
emit update_resource_alias_signal(currentAlias, newAlias);
}
});
if(type == Resource::Type::Directory){
typeUi.pbOpenFile->setEnabled(false);
}else{
connect(typeUi.pbOpenFile, &QPushButton::clicked, this, [=]{
auto currentPath = typeUi.laPath->text().remove('\n');
if(currentPath.length() > 0){
if(QFileInfo(currentPath).exists()){
QDesktopServices::openUrl(QUrl::fromLocalFile(currentPath));
}
}
});
}
connect(typeUi.pbOpenDir, &QPushButton::clicked, this, [=]{
auto currentPath = typeUi.laPath->text().remove('\n');
if(currentPath.length() > 0){
if(QDir(currentPath).exists()){
QDesktopServices::openUrl(QUrl::fromLocalFile(currentPath));
}else{
QDesktopServices::openUrl(QUrl::fromLocalFile(QFileInfo(currentPath).absolutePath()));
}
}
});
connect(lw, &QListWidget::currentItemChanged, this, [=]{
if(auto id = lw->currentIndex().row(); id >= 0){
emit resource_selected_signal(type, to_unsigned(id));
}
});
if(type == Resource::Type::CSharpScript){
connect(typeUi.pbGenerate, &QPushButton::clicked, this, &ResourcesManagerDialog::generate_csharp_script);
typeUi.pbGenerate->setText("Generate script");
}else if(type == Resource::Type::Text){
// TODO: ...
}
// typeUi.pbOpenFile->setEnabled(canOpen);
typeUi.pbOpenFile->setVisible(canOpen);
typeUi.pbGenerate->setVisible(canGenerate);
m_typesW[type] = std::make_tuple(std::move(typeUi),tabW);
m_tabsIdW[type] = m_ui.twCategories->count();
m_ui.twCategories->addTab(tabW, displayName);
m_ui.twCategories->setTabIcon(m_ui.twCategories->count()-1, QIcon(iconPath));
if(
type == Resource::Type::Mesh ||
type == Resource::Type::PythonScript){
tabW->setEnabled(false);
}
}
}
void ResourcesManagerDialog::update_from_resources_manager(const ResourcesManager *resM){
auto code = resM->reload_code();
ui::w_blocking(m_ui.cbReloadAudio)->setChecked(code & reloadAudioCode);
ui::w_blocking(m_ui.cbReloadImages)->setChecked(code & reloadImagesCode);
ui::w_blocking(m_ui.cbReloadMeshes)->setChecked(code & reloadMeshesCode);
ui::w_blocking(m_ui.cbReloadTextes)->setChecked(code & reloadTextesCode);
ui::w_blocking(m_ui.cbReloadVideos)->setChecked(code & reloadVideosCode);
ui::w_blocking(m_ui.cbReloadAssetBundles)->setChecked(code & reloadAssetBundlesCode);
ui::w_blocking(m_ui.cbReloadCSharpScripts)->setChecked(code & reloadCSharpScriptsCode);
ui::w_blocking(m_ui.cbReloadPythonScripts)->setChecked(code & reloadPythonScriptsCode);
// reset display info
for(const auto type : Resource::get_types()){
auto &ui = std::get<0>(m_typesW[type]);
ui.pbSetAlias->setEnabled(false);
ui.laPath->setEnabled(false);
ui.pbFind->setEnabled(false);
ui.pbOpenDir->setEnabled(false);
if(type != Resource::Type::Directory){
ui.pbOpenFile->setEnabled(false);
}
ui.laAlias->setText("...");
ui.laPath->setText("...");
ui.lwFiles->clear();
}
for(const auto type : Resource::get_types()){
auto &ui = std::get<0>(m_typesW[type]);
auto idSelected = resM->get_type_selected_id(type);
// add items in list
ui.lwFiles->blockSignals(true);
auto resources = resM->get_resources(type);
for(auto resource : resources){
auto info = QFileInfo(resource->path);
ui.lwFiles->addItem(resource->display_name());
ui.lwFiles->item(ui.lwFiles->count()-1)->setForeground(info.exists() ? Qt::darkGreen : Qt::red);
}
if(to_signed(idSelected) < ui.lwFiles->count()){
ui.lwFiles->setCurrentRow(to_signed(idSelected));
}
ui.lwFiles->blockSignals(false);
// update resource displayed info
if(idSelected < resources.size()){
const auto selectedResource = resources[idSelected];
ui.laAlias->setText(selectedResource->alias);
auto newP = selectedResource->path;
for(int ii = 0; ii < selectedResource->path.length()/100; ++ii){
newP.insert((ii+1)*100, '\n');
}
ui.laPath->setText(newP);
ui.laPath->setEnabled(true);
ui.pbFind->setEnabled(true);
ui.pbSetAlias->setEnabled(true);
ui.pbOpenDir->setEnabled(true);
if(type != Resource::Type::Directory){
ui.pbOpenFile->setEnabled(true);
}
}
}
}
void ResourcesManagerDialog::update_resources_to_reload(){
const int reloadAudio = m_ui.cbReloadAudio->isChecked() ? reloadAudioCode : 0;
const int reloadImages = m_ui.cbReloadImages->isChecked() ? reloadImagesCode : 0;
const int reloadMeshes = m_ui.cbReloadMeshes->isChecked() ? reloadMeshesCode : 0;
const int reloadTextes = m_ui.cbReloadTextes->isChecked() ? reloadTextesCode : 0;
const int reloadVideos = m_ui.cbReloadVideos->isChecked() ? reloadVideosCode : 0;
const int reloadAssetBundles = m_ui.cbReloadAssetBundles->isChecked() ? reloadAssetBundlesCode : 0;
const int reloadCSharpScripts = m_ui.cbReloadCSharpScripts->isChecked() ? reloadCSharpScriptsCode : 0;
const int reloadPythonScripts = m_ui.cbReloadPythonScripts->isChecked() ? reloadPythonScriptsCode : 0;
const int reloadClouds = m_ui.cbReloadClouds->isChecked()? reloadCloudsCode : 0;
const int reloadScanerVideos = m_ui.cbReloadScanerVideos->isChecked()? reloadScanerVideosCode : 0;
const int reloadPlots = m_ui.cbReloadPlots->isChecked()? reloadPlotsCode : 0;
const int reloadCode = reloadAudio | reloadImages | reloadMeshes | reloadTextes | reloadVideos | reloadAssetBundles | reloadCSharpScripts | reloadPythonScripts | reloadClouds;
emit update_reload_resource_code_signal(reloadCode);
}
void ResourcesManagerDialog::generate_csharp_script(){
bool ok;
auto componentName = QInputDialog::getText(this, tr("Set custom csharp script component name"), tr("Name:"), QLineEdit::Normal, "TemplateComponent", &ok);
if(!ok){
return;
}
QString filePath = QFileDialog::getSaveFileName(nullptr, "Define the CSharp script file to be generated", Paths::scriptsCSharpDir, "CSharp scirpt (*.cs)");
if(filePath.size() == 0){
return;
}
QFile defaultScript(Paths::templateCSharpScript);
if(!defaultScript.open(QFile::ReadOnly)){
QtLogger::error("Cannot find template C# script file to copy.");
return;
}
QTextStream in(&defaultScript);
QString content = in.readAll();
content = content.replace("DefaultNameComponent", componentName);
QFile output(filePath);
if(!output.open(QFile::WriteOnly)){
QtLogger::error("Cannot create new C# script file.");
return;
}
QTextStream w(&output);
w << content;
emit add_resources_signal(Resource::Type::CSharpScript, {filePath});
}
void ResourcesManagerDialog::show_section(Resource::Type type){
if(type != Resource::Type::SizeEnum){
m_ui.twCategories->setCurrentIndex(m_tabsIdW[type]);
}
show();
raise();
}
QSize VerticalTextTabWidgetStyle::sizeFromContents(QStyle::ContentsType type, const QStyleOption *option, const QSize &size, const QWidget *widget) const {
QSize s = QProxyStyle::sizeFromContents(type, option, size, widget);
if (type == QStyle::CT_TabBarTab) {
s.transpose();
}
return s;
}
void VerticalTextTabWidgetStyle::drawControl(QStyle::ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget) const {
if (element == CE_TabBarTabLabel) {
if (const QStyleOptionTab* tab = qstyleoption_cast<const QStyleOptionTab*>(option)) {
QStyleOptionTab opt(*tab);
opt.shape = QTabBar::RoundedNorth;
QProxyStyle::drawControl(element, &opt, painter, widget);
return;
}
}
QProxyStyle::drawControl(element, option, painter, widget);
}
#include "moc_resources_manager_dialog.cpp"
| 44.708333 | 179 | 0.606275 | [
"mesh",
"shape"
] |
d73efe63e16185a1b87c120fbe249d129876b91f | 2,461 | cpp | C++ | Zork/controller.cpp | bar0net/Zork | d2cca0cbc28b1f60165069dc080fa6f37634d616 | [
"MIT"
] | null | null | null | Zork/controller.cpp | bar0net/Zork | d2cca0cbc28b1f60165069dc080fa6f37634d616 | [
"MIT"
] | null | null | null | Zork/controller.cpp | bar0net/Zork | d2cca0cbc28b1f60165069dc080fa6f37634d616 | [
"MIT"
] | null | null | null | #include "controller.h"
Controller::Controller()
{
// associate key words with allowed action
translate["look"] = LOOK;
translate["read"] = LOOK;
translate["glance"] = LOOK;
translate["go"] = GO;
translate["walk"] = GO;
translate["run"] = GO;
translate["cross"] = GO;
translate["open"] = OPEN;
translate["close"] = CLOSE;
translate["use"] = USE;
translate["employ"] = USE;
translate["take"] = TAKE;
translate["grab"] = TAKE;
translate["pick"] = TAKE;
translate["drop"] = DROP;
translate["put"] = DROP;
translate["leave"] = DROP;
translate["place"] = DROP;
translate["inventory"] = INVENTORY;
translate["help"] = HELP;
translate["rock"] = ROCK;
translate["paper"] = PAPER;
translate["scissors"] = SCISSORS;
for (map<string, Actions>::iterator it = translate.begin(); it != translate.cend(); ++it)
this->commands.push_back(it->first);
}
Controller::~Controller()
{
}
// Transform input text to a convinient format
// #input: lowercase input text
// #targets: list of visible entities that can be the target of the action
// @returns: conviniently formated input
ParsedInput Controller::Parse(string input, list<string> targets)
{
ParsedInput output;
string rest;
// Get the action
// we asume the action is the first word of the input
for (list<string>::iterator it = commands.begin(); it != commands.cend(); ++it)
{
unsigned int length = (*it).size();
if (input.size() < length) continue;
if (input.substr(0, length) != (*it)) continue;
output.action = translate[(*it)];
rest = input.substr(length, string::npos);
break;
}
if (output.action == NONE) return output;
// Find the target
// TODO: Create a new action for when you input too many targets (?)
// TODO: Check actions that want 1 and actions that want 2 targets.
unsigned int index = string::npos;
for (list<string>::iterator it = targets.begin(); it != targets.cend(); ++it)
{
size_t found = rest.find((*it));
if (found != string::npos)
{
if (output.target == "")
{
output.target = (*it);
index = found;
}
else if (output.target != "" && output.interactor != "")
{
output.action = NONE;
return output;
}
else if (output.target != "" && found <= index)
{
output.interactor = output.target;
output.target = (*it);
index = -1;
}
else if (output.target != "" && found > index)
{
output.interactor = (*it);
index = -1;
}
}
}
return output;
}
| 22.577982 | 90 | 0.631044 | [
"transform"
] |
d745d76afc67d9f005a0d75759e7937f6aa34a92 | 7,751 | cc | C++ | Modules/Plexil/src/app-framework/DarwinTimeAdapter.cc | 5nefarious/icarous | bfd759d88a47d9ee079fe35deaa6cf6d4459dcd8 | [
"Unlicense"
] | null | null | null | Modules/Plexil/src/app-framework/DarwinTimeAdapter.cc | 5nefarious/icarous | bfd759d88a47d9ee079fe35deaa6cf6d4459dcd8 | [
"Unlicense"
] | null | null | null | Modules/Plexil/src/app-framework/DarwinTimeAdapter.cc | 5nefarious/icarous | bfd759d88a47d9ee079fe35deaa6cf6d4459dcd8 | [
"Unlicense"
] | null | null | null | /* Copyright (c) 2006-2016, Universities Space Research Association (USRA).
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of the Universities Space Research Association nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY USRA ``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 USRA 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.
*/
//
// *** Ignore this file on systems that implement POSIX timers
//
#include "plexil-config.h"
#include <unistd.h>
#if defined(HAVE_SETITIMER) && (!defined(_POSIX_TIMERS) || (((_POSIX_TIMERS - 200112L) < 0L) && !defined(PLEXIL_ANDROID)))
#include "DarwinTimeAdapter.hh"
#include "AdapterExecInterface.hh"
#include "Debug.hh"
#include "InterfaceError.hh"
#include "TimeAdapter.hh"
#include "timeval-utils.hh"
#include <cerrno>
#include <cmath> // for modf
#include <iomanip>
#include <mach/kern_return.h> // for KERN_ABORTED
#include <sys/time.h> // for gettimeofday, itimerval
namespace PLEXIL
{
/**
* @brief Constructor.
* @param execInterface Reference to the parent AdapterExecInterface object.
*/
DarwinTimeAdapter::DarwinTimeAdapter(AdapterExecInterface& execInterface)
: TimeAdapterImpl(execInterface)
{
}
/**
* @brief Constructor from configuration XML.
* @param execInterface Reference to the parent AdapterExecInterface object.
* @param xml A const reference to the XML element describing this adapter
* @note The instance maintains a shared pointer to the XML.
*/
DarwinTimeAdapter::DarwinTimeAdapter(AdapterExecInterface& execInterface,
pugi::xml_node const xml)
: TimeAdapterImpl(execInterface, xml)
{
}
/**
* @brief Destructor.
*/
DarwinTimeAdapter::~DarwinTimeAdapter()
{
}
/**
* @brief Get the current time from the operating system.
* @return A double representing the current time.
*/
double DarwinTimeAdapter::getCurrentTime()
throw (InterfaceError)
{
timeval tv;
int status = gettimeofday(&tv, NULL);
checkInterfaceError(status == 0,
"getCurrentTime: gettimeofday() failed, errno = " << errno);
double tym = timevalToDouble(tv);
debugMsg("TimeAdapter:getCurrentTime", " returning " << std::setprecision(15) << tym);
return tym;
}
/**
* @brief Initialize signal handling for the process.
* @return True if successful, false otherwise.
*/
bool DarwinTimeAdapter::configureSignalHandling()
{
// block SIGALRM and SIGUSR1 for the process as a whole
sigset_t processSigset, originalSigset;
if (0 != sigemptyset(&processSigset)) {
warn("DarwinTimeAdapter: sigemptyset failed!");
return false;
}
int errnum = sigaddset(&processSigset, SIGALRM);
errnum = errnum | sigaddset(&processSigset, SIGUSR1);
if (errnum != 0) {
warn("DarwinTimeAdapter: sigaddset failed!");
return false;
}
if (0 != sigprocmask(SIG_BLOCK, &processSigset, &originalSigset)) {
warn("DarwinTimeAdapter: sigprocmask failed!, errno = " << errno);
return false;
}
return true;
}
/**
* @brief Construct and initialize the timer as required.
* @return True if successful, false otherwise.
*/
bool DarwinTimeAdapter::initializeTimer()
{
return true; // nothing to do
}
/**
* @brief Set the timer.
* @param date The Unix-epoch wakeup time, as a double.
* @return True if the timer was set, false if clock time had already passed the wakeup time.
*/
bool DarwinTimeAdapter::setTimer(double date)
throw (InterfaceError)
{
// Convert to timeval
timeval dateval = doubleToTimeval(date);
// Get the current time
timeval now;
int status = gettimeofday(&now, NULL);
checkInterfaceError(status == 0,
"TimeAdapter:setTimer: gettimeofday() failed, errno = " << errno);
// Compute the interval
itimerval myItimerval = {{0, 0}, {0, 0}};
myItimerval.it_value = dateval - now;
if (myItimerval.it_value.tv_usec < 0 || myItimerval.it_value.tv_sec < 0) {
// Already past the scheduled time, submit wakeup
debugMsg("TimeAdapter:setTimer",
" new value " << std::setprecision(15) << date << " is in past");
return false;
}
// Set the timer
checkInterfaceError(0 == setitimer(ITIMER_REAL, &myItimerval, NULL),
"TimeAdapter:setTimer: setitimer failed, errno = " << errno);
debugMsg("TimeAdapter:setTimer",
" timer set for " << std::setprecision(15) << date);
return true;
}
/**
* @brief Stop the timer.
* @return True if successful, false otherwise.
*/
bool DarwinTimeAdapter::stopTimer()
{
static itimerval const sl_disableItimerval = {{0, 0}, {0, 0}};
int status = setitimer(ITIMER_REAL, & sl_disableItimerval, NULL);
condDebugMsg(status != 0,
"TimeAdapter:stopTimer",
" setitimer() failed, errno = " << errno);
return status == 0;
}
/**
* @brief Shut down and delete the timer as required.
* @return True if successful, false otherwise.
*/
bool DarwinTimeAdapter::deleteTimer()
{
return true; // nothing to do
}
/**
* @brief Initialize the wait thread signal mask.
* @return True if successful, false otherwise.
*/
bool DarwinTimeAdapter::configureWaitThreadSigmask(sigset_t* mask)
{
if (0 != sigemptyset(mask)) {
warn("DarwinTimeAdapter: sigemptyset failed!");
return false;
}
int errnum = sigaddset(mask, SIGINT);
errnum = errnum | sigaddset(mask, SIGHUP);
errnum = errnum | sigaddset(mask, SIGQUIT);
errnum = errnum | sigaddset(mask, SIGTERM);
errnum = errnum | sigaddset(mask, SIGUSR2);
if (errnum != 0) {
warn("DarwinTimeAdapter: sigaddset failed!");
}
return errnum == 0;
}
/**
* @brief Initialize the sigwait mask.
* @param Pointer to the mask.
* @return True if successful, false otherwise.
*/
bool DarwinTimeAdapter::initializeSigwaitMask(sigset_t* mask)
{
// listen for SIGALRM and SIGUSR1
if (0 != sigemptyset(mask)) {
warn("DarwinTimeAdapter: sigemptyset failed!");
return false;
}
int status = sigaddset(mask, SIGUSR1);
status = status | sigaddset(mask, SIGALRM);
if (0 != status) {
warn("DarwinTimeAdapter: sigaddset failed!");
}
return 0 == status;
}
}
#endif // defined(HAVE_SETITIMER) && (!defined(_POSIX_TIMERS) || (((_POSIX_TIMERS - 200112L) < 0L) && !defined(PLEXIL_ANDROID)))
| 32.704641 | 128 | 0.673074 | [
"object"
] |
d749a282ceca94811f09c1d56f1f4e7d0aaf601a | 748 | cpp | C++ | Algorithmic Toolbox/Week 2/Last_Digit_of_the_Sum_of_Fibonacci_Numbers.cpp | fuboki10/Data-Structures-and-Algorithms-Specialization | 1f2dc9aded51fdb0268cbdf67d2d16d62ac6bd95 | [
"MIT"
] | null | null | null | Algorithmic Toolbox/Week 2/Last_Digit_of_the_Sum_of_Fibonacci_Numbers.cpp | fuboki10/Data-Structures-and-Algorithms-Specialization | 1f2dc9aded51fdb0268cbdf67d2d16d62ac6bd95 | [
"MIT"
] | null | null | null | Algorithmic Toolbox/Week 2/Last_Digit_of_the_Sum_of_Fibonacci_Numbers.cpp | fuboki10/Data-Structures-and-Algorithms-Specialization | 1f2dc9aded51fdb0268cbdf67d2d16d62ac6bd95 | [
"MIT"
] | null | null | null | // Fub0ki
#define _CRT_SECURE_NO_WARNINGS
#include <bits/stdc++.h>
#include <unordered_map>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define mp make_pair
#define pb push_back
#define bn begin()
#define nd end()
#define all(v) v.begin(), v.end()
#define allr(v) v.rbegin(), v.rend()
#define EPS 1e-7
long long calc_fib(long long n) {
n = (n+2)%60;
ll first = 0;
ll second = 1;
ll res = 1;
for (int i = 2; i <= n; ++i)
{
res = (first%10 + second%10)%10;
first = second;
second = res;
}
if (res == 0) return 9;
return res%10 - 1;
}
int main()
{
//freopen("simple.in", "r", stdin);
ll n;
cin >> n;
cout << calc_fib(n) << endl;
return 0;
}
| 17.809524 | 40 | 0.566845 | [
"vector"
] |
d74ac9cdabc39436bcf9843f42ffde1abc62dd31 | 741 | hpp | C++ | src/include/execution/operator/join/physical_comparison_join.hpp | mweisgut/duckdb | 4cff1d7957ce895dd9984a87aa20aef67f5986e6 | [
"MIT"
] | 1 | 2019-08-01T08:21:33.000Z | 2019-08-01T08:21:33.000Z | src/include/execution/operator/join/physical_comparison_join.hpp | mweisgut/duckdb | 4cff1d7957ce895dd9984a87aa20aef67f5986e6 | [
"MIT"
] | null | null | null | src/include/execution/operator/join/physical_comparison_join.hpp | mweisgut/duckdb | 4cff1d7957ce895dd9984a87aa20aef67f5986e6 | [
"MIT"
] | 1 | 2019-09-06T09:58:14.000Z | 2019-09-06T09:58:14.000Z | //===----------------------------------------------------------------------===//
// DuckDB
//
// execution/operator/join/physical_comparison_join.hpp
//
//
//===----------------------------------------------------------------------===//
#pragma once
#include "execution/operator/join/physical_join.hpp"
namespace duckdb {
//! PhysicalJoin represents the base class of the join operators
class PhysicalComparisonJoin : public PhysicalJoin {
public:
PhysicalComparisonJoin(LogicalOperator &op, PhysicalOperatorType type, vector<JoinCondition> cond,
JoinType join_type);
vector<JoinCondition> conditions;
public:
string ExtraRenderInformation() const override;
};
} // namespace duckdb
| 26.464286 | 99 | 0.566802 | [
"vector"
] |
d7513784761a423636a62e7f24d4e2e689ad90dc | 4,212 | hpp | C++ | include/Mono/Net/Security/ServerCertValidationCallbackWrapper.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | include/Mono/Net/Security/ServerCertValidationCallbackWrapper.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | include/Mono/Net/Security/ServerCertValidationCallbackWrapper.hpp | darknight1050/BeatSaber-Quest-Codegen | a6eeecc3f0e8f6079630f9a9a72b3121ac7b2032 | [
"Unlicense"
] | null | null | null | // Autogenerated from CppHeaderCreator
// Created by Sc2ad
// =========================================================================
#pragma once
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: System.MulticastDelegate
#include "System/MulticastDelegate.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-methods.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-properties.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils-fields.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Begin forward declares
// Forward declaring namespace: System::Net
namespace System::Net {
// Forward declaring type: ServerCertValidationCallback
class ServerCertValidationCallback;
}
// Forward declaring namespace: System::Security::Cryptography::X509Certificates
namespace System::Security::Cryptography::X509Certificates {
// Forward declaring type: X509Certificate
class X509Certificate;
// Forward declaring type: X509Chain
class X509Chain;
}
// Forward declaring namespace: Mono::Security::Interface
namespace Mono::Security::Interface {
// Forward declaring type: MonoSslPolicyErrors
struct MonoSslPolicyErrors;
}
// Forward declaring namespace: System
namespace System {
// Forward declaring type: IAsyncResult
class IAsyncResult;
// Forward declaring type: AsyncCallback
class AsyncCallback;
}
// Completed forward declares
// Type namespace: Mono.Net.Security
namespace Mono::Net::Security {
// Size: 0x70
#pragma pack(push, 1)
// Autogenerated type: Mono.Net.Security.ServerCertValidationCallbackWrapper
class ServerCertValidationCallbackWrapper : public System::MulticastDelegate {
public:
// Creating value type constructor for type: ServerCertValidationCallbackWrapper
ServerCertValidationCallbackWrapper() noexcept {}
// public System.Void .ctor(System.Object object, System.IntPtr method)
// Offset: 0x15DC31C
template<::il2cpp_utils::CreationType creationType = ::il2cpp_utils::CreationType::Temporary>
static ServerCertValidationCallbackWrapper* New_ctor(::Il2CppObject* object, System::IntPtr method) {
static auto ___internal__logger = ::Logger::get().WithContext("Mono::Net::Security::ServerCertValidationCallbackWrapper::.ctor");
return THROW_UNLESS((::il2cpp_utils::New<ServerCertValidationCallbackWrapper*, creationType>(object, method)));
}
// public System.Boolean Invoke(System.Net.ServerCertValidationCallback callback, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, Mono.Security.Interface.MonoSslPolicyErrors sslPolicyErrors)
// Offset: 0x15D742C
bool Invoke(System::Net::ServerCertValidationCallback* callback, System::Security::Cryptography::X509Certificates::X509Certificate* certificate, System::Security::Cryptography::X509Certificates::X509Chain* chain, Mono::Security::Interface::MonoSslPolicyErrors sslPolicyErrors);
// public System.IAsyncResult BeginInvoke(System.Net.ServerCertValidationCallback callback, System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Security.Cryptography.X509Certificates.X509Chain chain, Mono.Security.Interface.MonoSslPolicyErrors sslPolicyErrors, System.AsyncCallback __callback, System.Object object)
// Offset: 0x15DC32C
System::IAsyncResult* BeginInvoke(System::Net::ServerCertValidationCallback* callback, System::Security::Cryptography::X509Certificates::X509Certificate* certificate, System::Security::Cryptography::X509Certificates::X509Chain* chain, Mono::Security::Interface::MonoSslPolicyErrors sslPolicyErrors, System::AsyncCallback* __callback, ::Il2CppObject* object);
// public System.Boolean EndInvoke(System.IAsyncResult result)
// Offset: 0x15DC3DC
bool EndInvoke(System::IAsyncResult* result);
}; // Mono.Net.Security.ServerCertValidationCallbackWrapper
#pragma pack(pop)
}
DEFINE_IL2CPP_ARG_TYPE(Mono::Net::Security::ServerCertValidationCallbackWrapper*, "Mono.Net.Security", "ServerCertValidationCallbackWrapper");
| 61.043478 | 363 | 0.775404 | [
"object"
] |
d752404832945a2e4fcf178561d2ed610f02681f | 7,297 | cc | C++ | projects/packages/fitted-R-MAXQ/Environment/Taxi.cc | litlpoet/rl-library | b81cb3f9045756e031c30c8d8262c9b6e5c5d9c2 | [
"Apache-2.0"
] | null | null | null | projects/packages/fitted-R-MAXQ/Environment/Taxi.cc | litlpoet/rl-library | b81cb3f9045756e031c30c8d8262c9b6e5c5d9c2 | [
"Apache-2.0"
] | null | null | null | projects/packages/fitted-R-MAXQ/Environment/Taxi.cc | litlpoet/rl-library | b81cb3f9045756e031c30c8d8262c9b6e5c5d9c2 | [
"Apache-2.0"
] | 1 | 2020-08-02T11:58:51.000Z | 2020-08-02T11:58:51.000Z | // env_ function prototypes types
#include <rlglue/Environment_common.h>
// helpful functions for allocating structs and cleaning them up
#include <rlglue/utils/C/RLStruct_util.h>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <vector>
#include "Random.h"
#include "gridworld.hh"
namespace {
// Declare RL Glue variables.
observation_t current_observation;
reward_observation_terminal_t ro;
// Declare Taxi helper functions and types.
enum taxi_action_t {NORTH, SOUTH, EAST, WEST, PICKUP, PUTDOWN};
typedef std::pair<double,double> coord_t;
// Declare Taxi configuration variables.
const bool nonMarkov = false;
const bool noisy = false;
Random rng;
const Gridworld *grid = NULL;
std::vector<coord_t> landmarks;
// Declare Taxi state variables.
int ns, ew, pass, dest;
bool fickle = false;
}
const Gridworld *create_default_map();
int add_noise(int action);
void apply_fickle_passenger();
double apply(int action);
const char *env_init()
{
grid = create_default_map();
landmarks.push_back(coord_t(4.,0.));
landmarks.push_back(coord_t(0.,3.));
landmarks.push_back(coord_t(4.,4.));
landmarks.push_back(coord_t(0.,0.));
// Handle RL Glue stuff.
allocateRLStruct(¤t_observation, 4, 0, 0);
std::fill(current_observation.intArray,
current_observation.intArray + current_observation.numInts,
0);
ro.observation = ¤t_observation;
ro.terminal = 0;
ro.reward = 0.0;
std::stringstream response;
response << "VERSION RL-Glue-3.0 PROBLEMTYPE episodic DISCOUNTFACTOR 1 ";
response << "OBSERVATIONS INTS (3 0 4) (0 3) ";
response << "ACTIONS INTS (0 5) ";
response << "REWARDS (-10 20) ";
response << "EXTRA Taxi implemented by Nicholas K. Jong.";
static std::string buffer;
buffer = response.str();
return buffer.c_str();
}
void env_cleanup()
{
clearRLStruct(¤t_observation);
delete grid;
grid = NULL;
landmarks.clear();
}
const observation_t *env_start()
{
ns = rng.uniformDiscrete(1, grid->height()) - 1;
ew = rng.uniformDiscrete(1, grid->width()) - 1;
pass = rng.uniformDiscrete(1, landmarks.size()) - 1;
do dest = rng.uniformDiscrete(1, landmarks.size()) - 1;
while (dest == pass);
fickle = false;
current_observation.intArray[0] = ns;
current_observation.intArray[1] = ew;
current_observation.intArray[2] = pass;
current_observation.intArray[3] = dest;
ro.reward = 0.0;
ro.terminal = 0;
// std::cout << ns << " " << ew << " " << pass << " " << dest << "\n";
return ¤t_observation;
}
const reward_observation_terminal_t *env_step(const action_t *a)
{
ro.reward = apply(a->intArray[0]);
ro.terminal = (pass == dest) ? 1 : 0;
current_observation.intArray[0] = ns;
current_observation.intArray[1] = ew;
current_observation.intArray[2] = pass;
current_observation.intArray[3] = dest;
//std::cout << a->intArray[0] << " -> "
//<< ns << " " << ew << " " << pass << " " << dest << "\n";
return &ro;
}
const char* env_message(const char* _inMessage) {
std::stringstream response;
std::stringstream message(_inMessage);
// Tokenize the message
std::istream_iterator<std::string> it(message);
std::istream_iterator<std::string> end;
while (it != end) {
std::string command(*it++);
if (command.compare("set-random-seed") == 0) {
if (it == end) {
response << "Taxi received set-random-seed with no argument.\n";
} else {
std::string seed_string(*it++);
int seed = atoi(seed_string.c_str());
rng.reset(seed);
response << "Taxi set random seed to " << seed << ".\n";
}
} else {
response << "Taxi did not understand '" << command << "'.\n";
}
}
static std::string buffer;
buffer = response.str();
return buffer.c_str();
}
const Gridworld *create_default_map() {
std::vector<std::vector<bool> > nsv(5, std::vector<bool>(4,false));
std::vector<std::vector<bool> > ewv(5, std::vector<bool>(4,false));
ewv[0][0] = true;
ewv[0][2] = true;
ewv[1][0] = true;
ewv[1][2] = true;
ewv[3][1] = true;
ewv[4][1] = true;
return new Gridworld(5,5,nsv,ewv);
}
int add_noise(int action) {
switch(action) {
case NORTH:
case SOUTH:
return rng.bernoulli(0.8) ? action : (rng.bernoulli(0.5) ? EAST : WEST);
case EAST:
case WEST:
return rng.bernoulli(0.8) ? action : (rng.bernoulli(0.5) ? NORTH : SOUTH);
default:
return action;
}
}
void apply_fickle_passenger() {
if (fickle) {
fickle = false;
if (rng.bernoulli(0.3)) {
dest += rng.uniformDiscrete(1, landmarks.size() - 1);
dest = dest % landmarks.size();
}
}
}
double apply(int action) {
const int effect = noisy ? add_noise(action) : action;
switch(effect) {
case NORTH:
if (!grid->wall(static_cast<unsigned>(ns),
static_cast<unsigned>(ew),
effect))
{
++ns;
apply_fickle_passenger();
}
return -1;
case SOUTH:
if (!grid->wall(static_cast<unsigned>(ns),
static_cast<unsigned>(ew),
effect))
{
--ns;
apply_fickle_passenger();
}
return -1;
case EAST:
if (!grid->wall(static_cast<unsigned>(ns),
static_cast<unsigned>(ew),
effect))
{
++ew;
apply_fickle_passenger();
}
return -1;
case WEST:
if (!grid->wall(static_cast<unsigned>(ns),
static_cast<unsigned>(ew),
effect))
{
--ew;
apply_fickle_passenger();
}
return -1;
case PICKUP: {
if (pass < static_cast<int>(landmarks.size())
&& coord_t(ns,ew) == landmarks[static_cast<unsigned>(pass)])
{
pass = landmarks.size();
fickle = nonMarkov && noisy;
return -1;
} else
return -10;
}
case PUTDOWN:
if (pass == static_cast<int>(landmarks.size())
&& coord_t(ns,ew) == landmarks[static_cast<unsigned>(dest)]) {
pass = dest;
return 20;
} else
return -10;
}
std::cerr << "Unreachable point reached in Taxi::apply!!!\n";
return 0; // unreachable, I hope
}
// #include "taxi.hh"
// std::ostream &operator<<(std::ostream &out, const Taxi &taxi) {
// out << "map:\n" << *taxi.grid << "landmarks:\n";
// for (unsigned i = 0; i < taxi.landmarks.size(); ++i)
// out << "row " << taxi.landmarks[i].first
// << ", column " << taxi.landmarks[i].second << "\n";
// return out;
// }
// void Taxi::randomize_landmarks() {
// std::vector<unsigned> indices(landmarks.size());
// const unsigned n = grid->height() * grid->width();
// for (unsigned i = 0; i < indices.size(); ++i) {
// unsigned index;
// bool duplicate;
// do {
// index = rng.uniformDiscrete(1,n) - 1;
// duplicate = false;
// for (unsigned j = 0; j < i; ++j)
// if (index == indices[j])
// duplicate = true;
// } while (duplicate);
// indices[i] = index;
// }
// for (unsigned i = 0; i < indices.size(); ++i)
// landmarks[i] = coord_t(indices[i] / grid->width(),
// indices[i] % grid->width());
// }
// void Taxi::randomize_landmarks_to_corners() {
// for (unsigned i = 0; i < landmarks.size(); ++i) {
// int ns = rng.uniformDiscrete(0,1);
// int ew = rng.uniformDiscrete(0,1);
// if (1 == i/2)
// ns = grid->height() - ns - 1;
// if (1 == i%2)
// ew = grid->width() - ew - 1;
// landmarks[i] = coord_t(ns,ew);
// }
// }
| 25.967972 | 78 | 0.617103 | [
"vector"
] |
d75395b755b4c315b5a187d3c759ee0915bc165a | 4,792 | cpp | C++ | aplcore/src/graphic/graphicelementcontainer.cpp | tschaffter/apl-core-library | 3a05342ba0fa2432c320476795c13e8cd990e8ee | [
"Apache-2.0"
] | 28 | 2019-11-05T12:23:01.000Z | 2022-03-22T10:01:53.000Z | aplcore/src/graphic/graphicelementcontainer.cpp | alexa/apl-core-library | b0859273851c4f62290d1f85c42bf22eb087fb35 | [
"Apache-2.0"
] | 7 | 2020-03-28T12:44:08.000Z | 2022-01-23T17:02:27.000Z | aplcore/src/graphic/graphicelementcontainer.cpp | tschaffter/apl-core-library | 3a05342ba0fa2432c320476795c13e8cd990e8ee | [
"Apache-2.0"
] | 15 | 2019-12-25T10:15:52.000Z | 2021-12-30T03:50:00.000Z | /**
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0/
*
* or in the "license" file accompanying this file. This file 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 "apl/graphic/graphicelementcontainer.h"
#include "apl/graphic/graphicpropdef.h"
#include "apl/utils/session.h"
namespace apl {
GraphicElementPtr
GraphicElementContainer::create(const GraphicPtr& graphic,
const ContextPtr& context,
const Object& json)
{
auto container = std::make_shared<GraphicElementContainer>(graphic, context);
if (!container->initialize(graphic, json))
return nullptr;
return container;
}
const GraphicPropDefSet&
GraphicElementContainer::propDefSet() const
{
static GraphicPropDefSet sContainerProperties = GraphicPropDefSet()
.add({
{kGraphicPropertyHeightActual, Dimension(0), nullptr, kPropOut},
{kGraphicPropertyHeightOriginal, Dimension(100), asAbsoluteDimension, kPropIn | kPropRequired},
{kGraphicPropertyLang, "", asString, kPropInOut},
{kGraphicPropertyLayoutDirection, kGraphicLayoutDirectionLTR, sGraphicLayoutDirectionBimap, kPropInOut},
{kGraphicPropertyScaleTypeHeight, kGraphicScaleNone, sGraphicScaleBimap, kPropIn},
{kGraphicPropertyScaleTypeWidth, kGraphicScaleNone, sGraphicScaleBimap, kPropIn},
{kGraphicPropertyViewportHeightActual, 0.0, nullptr, kPropOut},
{kGraphicPropertyViewportWidthActual, 0.0, nullptr, kPropOut},
{kGraphicPropertyVersion, kGraphicVersion12, sGraphicVersionBimap, kPropIn | kPropRequired},
{kGraphicPropertyViewportHeightOriginal, 0, asNonNegativeNumber, kPropIn},
{kGraphicPropertyViewportWidthOriginal, 0, asNonNegativeNumber, kPropIn},
{kGraphicPropertyWidthActual, Dimension(0), nullptr, kPropOut},
{kGraphicPropertyWidthOriginal, Dimension(100), asAbsoluteDimension, kPropIn | kPropRequired}
});
return sContainerProperties;
}
bool
GraphicElementContainer::initialize(const GraphicPtr& graphic, const Object& json)
{
if (!GraphicElement::initialize(graphic, json))
return false;
auto height = mValues.get(kGraphicPropertyHeightOriginal).getAbsoluteDimension();
if (height <= 0) {
CONSOLE_CTP(mContext) << "Invalid graphic height - must be positive";
return false;
}
auto width = mValues.get(kGraphicPropertyWidthOriginal).getAbsoluteDimension();
if (width <= 0) {
CONSOLE_CTP(mContext) << "Invalid graphic width - must be positive";
return false;
}
// Configure the original output values. A later "layout" pass may update these
mValues.set(kGraphicPropertyHeightActual, Dimension(height));
mValues.set(kGraphicPropertyWidthActual, Dimension(width));
// Update the viewport values. If the viewport original values weren't set, we use the width/height
double viewportHeight = mValues.get(kGraphicPropertyViewportHeightOriginal).getDouble();
double viewportWidth = mValues.get(kGraphicPropertyViewportWidthOriginal).getDouble();
if (viewportHeight <= 0) {
viewportHeight = height;
mValues.set(kGraphicPropertyViewportHeightOriginal, viewportHeight);
}
if (viewportWidth <= 0) {
viewportWidth = width;
mValues.set(kGraphicPropertyViewportWidthOriginal, viewportWidth);
}
// Configure the viewport actuals to match the originals
mValues.set(kGraphicPropertyViewportHeightActual, viewportHeight);
mValues.set(kGraphicPropertyViewportWidthActual, viewportWidth);
// Update the context to include width and height (these are the viewport width and height)
mContext->systemUpdateAndRecalculate("width", viewportWidth, false);
mContext->systemUpdateAndRecalculate("height", viewportHeight, false);
return true;
}
} // namespace apl
| 43.963303 | 134 | 0.653589 | [
"object"
] |
d7552803b8baabf7a4238e76b2c97838b24c4748 | 25,578 | cc | C++ | AICamera/app/src/main/cpp/caffe2/contrib/script/compiler.cc | blackxer/AICamera | 4f0a6a09a2288da2ec7140744b5c2862df114c78 | [
"MIT"
] | 1 | 2020-01-10T02:56:03.000Z | 2020-01-10T02:56:03.000Z | AICamera/app/src/main/cpp/caffe2/contrib/script/compiler.cc | blackxer/AICamera | 4f0a6a09a2288da2ec7140744b5c2862df114c78 | [
"MIT"
] | null | null | null | AICamera/app/src/main/cpp/caffe2/contrib/script/compiler.cc | blackxer/AICamera | 4f0a6a09a2288da2ec7140744b5c2862df114c78 | [
"MIT"
] | null | null | null | #include "caffe2/core/net.h"
#include "caffe2/utils/proto_utils.h"
#include "compiler.h"
#include "parser.h"
namespace caffe2 {
namespace script {
namespace {
static std::unordered_set<std::string> ops_containing_nets = {
"If",
"While",
"RecurrentNetwork",
};
// record of defined function
// NetDef + metadata
struct FunctionDefinition {
explicit FunctionDefinition(Def tree)
: tree(new Def(tree)), net_def(new NetDef()) {}
explicit FunctionDefinition(std::unique_ptr<NetDef> def)
: tree(nullptr), net_def(std::move(def)) {
// we coop extern_inputs/extern_outputs to be the inputs/outputs to
// this net as a function
// but we _dont_ set these when creating the net in the workspace
// because they require the net to have valid inputs/outputs
inputs.insert(
inputs.begin(),
net_def->external_input().begin(),
net_def->external_input().end());
outputs.insert(
outputs.begin(),
net_def->external_output().begin(),
net_def->external_output().end());
net_def->clear_external_output();
net_def->clear_external_input();
}
bool isExtern() const {
return tree == nullptr;
}
std::unique_ptr<Def> tree;
std::unique_ptr<NetDef> net_def;
std::vector<std::string> inputs;
std::vector<std::string> outputs;
};
} // namespace
using SymbolTable = std::unordered_map<std::string, FunctionDefinition>;
struct DefCompiler {
DefCompiler(FunctionDefinition& def, SymbolTable& symbol_table)
: def(def),
net_def_stack({def.net_def.get()}),
symbol_table(symbol_table) {}
void run() {
auto& tree = *def.tree;
cur().set_name(tree.name().name());
for (auto input : tree.params()) {
auto& name = input.ident().name();
map(name, name);
def.inputs.push_back(name);
}
for (auto output : tree.returns()) {
auto& name = output.ident().name();
map(name, name);
def.outputs.push_back(name);
}
emitStatements(tree.statements());
}
void emitExpressionStatement(TreeRef stmt) {
// expression with no used outputs
emit(stmt, {});
}
void emitStatements(const ListView<TreeRef>& statements) {
for (auto stmt : statements) {
switch (stmt->kind()) {
case TK_IF:
emitIf(If(stmt));
break;
case TK_WHILE:
emitWhile(While(stmt));
break;
case TK_ASSIGN:
emitAssignment(Assign(stmt));
break;
case TK_GLOBAL:
for (auto ident : stmt->trees()) {
auto name = Ident(ident).name();
map(name, name);
}
break;
default:
emitExpressionStatement(stmt);
break;
}
}
}
void map(const std::string& name, const std::string& value) {
env[name] = value;
}
const std::string& lookup(const Ident& ident) {
if (env.count(ident.name()) == 0)
throw ErrorReport(ident) << "undefined value " << ident.name();
return env[ident.name()];
}
void emitAssignment(const Assign& stmt) {
std::vector<std::string> outputs;
for (auto lhs : stmt.lhs()) {
std::string name = getLHS(lhs);
// use of "_" gets renamed in Caffe2 graphs so that two uses
// don't unintentionally interfere with each other
if (name == "_") {
name = fresh();
}
outputs.push_back(name);
}
if (stmt.reduction() != '=') {
if (stmt.lhs().size() != 1) {
throw ErrorReport(stmt)
<< "reductions are only allow when there is a single variable "
<< "on the left-hand side.";
}
auto lhs = stmt.lhs()[0];
auto expr =
Compound::create(stmt.reduction(), stmt.range(), {lhs, stmt.rhs()});
emit(expr, outputs);
} else {
emit(stmt.rhs(), outputs);
}
int i = 0;
for (auto ident : stmt.lhs()) {
if (ident->kind() == TK_IDENT)
map(Ident(ident).name(), outputs.at(i));
i++;
}
}
void emitIf(const If& stmt) {
auto cond = getValue(stmt.cond());
auto op = cur().add_op();
op->set_type("If");
op->add_input(cond);
auto true_branch = op->add_arg();
true_branch->set_name("then_net");
auto nd = true_branch->mutable_n();
net_def_stack.push_back(nd);
emitStatements(stmt.trueBranch());
net_def_stack.pop_back();
if (stmt.falseBranch().size() > 0) {
auto false_branch = op->add_arg();
false_branch->set_name("else_net");
auto nd = false_branch->mutable_n();
net_def_stack.push_back(nd);
emitStatements(stmt.falseBranch());
net_def_stack.pop_back();
}
}
void emitWhile(const While& stmt) {
std::string loop_var = fresh();
emitConst(0, loop_var, "i"); // it needs a definition before loop
auto op = cur().add_op();
op->set_type("While");
auto cond = op->add_arg();
cond->set_name("cond_net");
auto cond_net = cond->mutable_n();
net_def_stack.push_back(cond_net);
emit(stmt.cond(), {loop_var});
net_def_stack.pop_back();
op->add_input(loop_var);
auto body = op->add_arg();
body->set_name("loop_net");
auto body_net = body->mutable_n();
net_def_stack.push_back(body_net);
emitStatements(stmt.body());
net_def_stack.pop_back();
}
std::string getLHS(const TreeRef& tree) {
switch (tree->kind()) {
case TK_IDENT: {
return Ident(tree).name();
} break;
case '.': {
auto sel = Select(tree);
std::string lhs = getValue(sel.value());
// TODO: check whether this subname exists in object lhs
return lhs + "/" + sel.selector().name();
} break;
default: {
throw ErrorReport(tree)
<< "This expression cannot appear on the left-hand size of an assignment";
} break;
}
}
std::string getValue(const TreeRef& tree) {
switch (tree->kind()) {
case TK_IDENT: {
return lookup(Ident(tree));
} break;
case '.': {
auto sel = Select(tree);
std::string lhs = getValue(sel.value());
// TODO: check whether this subname exists in object lhs
return lhs + "/" + sel.selector().name();
} break;
default: {
std::string name = fresh();
emit(tree, {name});
return name;
} break;
}
}
std::string fresh(std::string prefix = "$t") {
return std::string(prefix) + c10::to_string(next_fresh++);
}
const char* operatorName(int kind, int ninputs) {
switch (kind) {
case '+':
return "Add";
case '-':
if (ninputs == 1)
return "Negative";
else
return "Sub";
case '*':
return "Mul";
case '/':
return "Div";
case TK_NE:
return "NE";
case TK_EQ:
return "EQ";
case '<':
return "LT";
case '>':
return "GT";
case TK_LE:
return "LE";
case TK_GE:
return "GE";
case TK_IF_EXPR:
return "Conditional";
case TK_AND:
return "And";
case TK_OR:
return "Or";
case TK_NOT:
return "Not";
default:
throw std::runtime_error("unknown kind " + c10::to_string(kind));
}
}
void fillArg(Argument* arg, const Attribute& attr) {
std::string name = attr.name().name();
arg->set_name(name);
auto value = attr.value();
// TODO: handle non-float attributes
switch (value->kind()) {
case TK_CONST: {
auto v = value->tree(0)->doubleValue();
auto f = value->tree(1)->stringValue();
if (f == "f")
arg->set_f(v);
else
arg->set_i(v);
} break;
case TK_LIST:
for (auto t : value->trees()) {
auto v = t->tree(0)->doubleValue();
auto f = t->tree(1)->stringValue();
if (f == "f")
arg->add_floats(v);
else
arg->add_ints(v);
}
break;
}
}
template <typename Trees>
std::vector<std::string> getValues(const Trees& trees) {
std::vector<std::string> result;
for (const auto& tree : trees) {
result.push_back(getValue(tree));
}
return result;
}
bool renameLookup(
std::unordered_map<std::string, std::string>& rename_map,
const std::string& name,
std::string& rename) {
// first look for name in the map directly
auto it = rename_map.find(name);
if (it != rename_map.end()) {
rename = it->second;
return true;
}
// otherwise if we have a rename entry like a => b and a name "a/foo/bar"
// then replace it with "b/foo/bar"
auto p = name.find("/");
if (p == std::string::npos)
return false;
it = rename_map.find(name.substr(0, p));
if (it != rename_map.end()) {
rename = it->second + name.substr(p);
return true;
}
return false;
}
void renameOp(
std::unordered_map<std::string, std::string>& rename_map,
const Apply& apply,
const std::string& prefix,
bool isExtern,
OperatorDef* new_op) {
for (size_t i = 0; i < new_op->input().size(); i++) {
auto& name = new_op->input(i);
std::string renamed;
bool defined = renameLookup(rename_map, name, renamed);
if (!isExtern && !defined) {
throw ErrorReport(apply)
<< " unexpected undefined name '" << name
<< "' while attempting to inline '" << apply.name().name() << "'";
} else if (!defined) {
// extern function using a global name, assign it an identity mapping
rename_map[name] = name;
}
new_op->set_input(i, renamed);
}
for (size_t i = 0; i < new_op->output().size(); i++) {
auto& name = new_op->output(i);
std::string renamed;
if (!renameLookup(rename_map, name, renamed)) {
renamed = prefix + name;
rename_map[name] = renamed;
}
new_op->set_output(i, renamed);
}
// handle control flow inside the op as well
if (ops_containing_nets.count(new_op->type()) > 0) {
for (size_t i = 0; i < new_op->arg_size(); i++) {
auto* arg = new_op->mutable_arg(i);
if (arg->has_n()) {
auto* n = arg->mutable_n();
for (size_t j = 0; j < n->op_size(); j++) {
renameOp(rename_map, apply, prefix, isExtern, n->mutable_op(j));
}
}
}
}
}
bool hasBypassRename(const Apply& apply) {
for (auto attr : apply.attributes()) {
if (attr.name().name() == "rename") {
if (attr.value()->kind() != TK_CONST) {
throw ErrorReport(attr.value()) << "expected a single constant";
}
return attr.value()->tree(0)->doubleValue() == 0;
}
}
return false;
}
// emit a function call by inlining the function's NetDef into our
// net def, renaming temporaries func_name<unique_id>/orig_name
// renaming only happens for values defined by the function
// that are not marked outputs
// inputs/outputs are passed by reference
void emitFunctionCall(Apply& apply, const std::vector<std::string>& outputs) {
std::string fname = apply.name().name();
std::string prefix = fresh(fname) + "/";
auto& fn = symbol_table.at(apply.name().name());
bool isExtern = fn.isExtern();
auto inputs = getValues(apply.inputs());
std::unordered_map<std::string, std::string> rename_map;
if (inputs.size() != fn.inputs.size()) {
throw ErrorReport(apply) << fname << " expected " << fn.inputs.size()
<< " values but received " << inputs.size();
}
for (size_t i = 0; i < inputs.size(); i++) {
rename_map[fn.inputs[i]] = inputs[i];
}
if (outputs.size() != fn.outputs.size()) {
throw ErrorReport(apply) << fname << " expected " << fn.outputs.size()
<< " values but received " << outputs.size();
}
for (size_t i = 0; i < outputs.size(); i++) {
rename_map[fn.outputs[i]] = outputs[i];
}
for (auto& op : fn.net_def->op()) {
auto new_op = cur().add_op();
new_op->CopyFrom(op);
if (hasBypassRename(apply)) {
prefix = "";
}
renameOp(rename_map, apply, prefix, isExtern, new_op);
}
}
void expectOutputs(
const TreeRef& tree,
const std::vector<std::string>& outputs,
size_t size) {
if (outputs.size() != size) {
throw ErrorReport(tree)
<< "expected operator to produce " << outputs.size()
<< " outputs but it produced " << size;
}
}
void appendOutputs(
const TreeRef& tree,
OperatorDef* op,
const std::vector<std::string>& outputs,
size_t size) {
expectOutputs(tree, outputs, size);
for (size_t i = 0; i < size; i++) {
op->add_output(outputs[i]);
}
}
void emitOperator(
const Apply& apply,
const OpSchema* schema,
const std::vector<std::string>& outputs) {
// must be before add_op
auto values = getValues(apply.inputs());
if (values.size() < schema->min_input() ||
values.size() > schema->max_input()) {
if (schema->min_input() == schema->max_input()) {
throw ErrorReport(apply) << "operator expects " << schema->min_input()
<< " inputs but found " << values.size();
} else {
throw ErrorReport(apply)
<< "operator takes between " << schema->min_input() << " and "
<< schema->max_input() << " inputs but found " << values.size()
<< ".";
}
}
auto numActualOutputs = schema->CalculateOutput(values.size());
if (numActualOutputs != kCannotComputeNumOutputs &&
outputs.size() != numActualOutputs) {
throw ErrorReport(apply)
<< "operator produces " << numActualOutputs
<< " outputs but matched to " << outputs.size() << " outputs";
}
auto op = cur().add_op();
op->set_type(apply.name().name());
for (auto& v : values) {
op->add_input(v);
}
// assume 1 output unless matched to more
appendOutputs(apply, op, outputs, outputs.size());
for (auto attribute : apply.attributes()) {
fillArg(op->add_arg(), attribute);
}
// Ok, we checked the stuff where we can easily give a friendly error
// message, now verify against the schema and report the error at the line
if (!schema->Verify(*op)) {
throw ErrorReport(apply) << "failed schema checking";
}
}
// Emit an operation, writing results into 'outputs'.
// This will _always_ compute something, unlike 'getValue' which simply
// returns an already computed reference if possible.
// So if 'tree' is an identifier or nested identifier (foo.bar)
// this will cause it to be _copied_ into outputs.
void emit(const TreeRef& tree, const std::vector<std::string>& outputs) {
switch (tree->kind()) {
case TK_IDENT:
case '.': {
auto op = cur().add_op();
op->set_type("Copy");
op->add_input(getValue(tree));
appendOutputs(tree, op, outputs, 1);
} break;
case TK_NE:
case TK_EQ:
case '<':
case '>':
case TK_LE:
case TK_GE:
case '-':
case '*':
case '/':
case '+':
case TK_AND:
case TK_OR:
case TK_NOT:
case TK_IF_EXPR: {
// must be before add_op
auto values = getValues(tree->trees());
auto op = cur().add_op();
op->set_type(operatorName(tree->kind(), tree->trees().size()));
for (auto& v : values) {
op->add_input(v);
}
appendOutputs(tree, op, outputs, 1);
auto broadcast = op->add_arg();
broadcast->set_name("broadcast");
broadcast->set_i(1);
} break;
case TK_APPLY: {
auto apply = Apply(tree);
// Handle built-ins like zeros, ones, etc
if (builtins.count(apply.name().name()) > 0) {
builtins[apply.name().name()](this, apply, outputs);
break;
}
if (symbol_table.count(apply.name().name()) > 0) {
emitFunctionCall(apply, outputs);
break;
}
auto schema = OpSchemaRegistry::Schema(apply.name().name());
if (schema) {
emitOperator(apply, schema, outputs);
break;
}
throw ErrorReport(apply)
<< "attempting to call unknown operation or function '"
<< apply.name().name() << "'";
} break;
case TK_CAST: {
auto cast = Cast(tree);
auto c2type = getType(cast.type());
auto input = getValue(cast.input());
auto op = cur().add_op();
op->set_type("Cast");
op->add_input(input);
appendOutputs(tree, op, outputs, 1);
auto arg = op->add_arg();
arg->set_name("to");
arg->set_i(c2type);
} break;
case TK_CONST: {
expectOutputs(tree, outputs, 1);
emitConst(
tree->tree(0)->doubleValue(),
outputs[0],
tree->tree(1)->stringValue());
} break;
case TK_GATHER: {
const auto gather = Gather(tree);
desugarAndEmitOperator(
"Gather",
gather.range(),
{gather.value(), gather.indices()},
outputs);
break;
}
case TK_SLICE: {
const auto slice = Slice(tree);
desugarAndEmitOperator(
"Slice",
slice.range(),
{slice.value(), slice.startOr(0), slice.endOr(-1)},
outputs);
break;
}
default:
throw ErrorReport(tree) << "NYI: " << tree;
break;
}
}
// Desugars constructs that are syntactic sugar and emits the corresponding
// operator invocation, e.g. tensor[indices] -> tensor.Gather(indices).
void desugarAndEmitOperator(
const std::string& operatorName,
const SourceRange& range,
TreeList&& inputs,
const std::vector<std::string>& outputs) {
const auto applyName = Ident::create(range, operatorName);
const auto applyInputs =
Compound::create(TK_LIST, range, std::move(inputs));
const auto applyAttributes = Compound::create(TK_LIST, range, {});
const auto apply =
Apply::create(range, applyName, applyInputs, applyAttributes);
const auto schema = OpSchemaRegistry::Schema(operatorName);
assert(schema != nullptr);
emitOperator(Apply(apply), schema, outputs);
}
TensorProto_DataType getType(int type) {
switch (type) {
case TK_INT:
return TensorProto_DataType_INT32;
case TK_FLOAT:
return TensorProto_DataType_FLOAT;
case TK_LONG:
return TensorProto_DataType_INT64;
case TK_BOOL:
return TensorProto_DataType_BOOL;
default:
throw std::runtime_error(
"expected type token: " + c10::to_string(type));
}
}
OperatorDef* emitConst(
double v,
const std::string& output,
const std::string& type_ident) {
auto op = cur().add_op();
op->set_type("ConstantFill");
auto dtype = op->add_arg();
dtype->set_name("dtype");
auto value = op->add_arg();
value->set_name("value");
if (type_ident == "f") {
dtype->set_i(TensorProto_DataType_FLOAT);
value->set_f(v);
} else if (type_ident == "LL") {
dtype->set_i(TensorProto_DataType_INT64);
value->set_i(v);
} else if (type_ident == "b") {
dtype->set_i(TensorProto_DataType_BOOL);
value->set_i(v != 0);
} else if (type_ident == "i") {
dtype->set_i(TensorProto_DataType_INT32);
value->set_i(v);
} else {
throw std::runtime_error("unknown type_ident " + type_ident);
}
auto shape = op->add_arg();
shape->set_name("shape");
shape->add_ints(1);
op->add_output(output);
return op;
}
NetDef& cur() {
return *net_def_stack.back();
}
FunctionDefinition& def; // the def being constructed
std::unordered_map<std::string, std::string>
env; // map from name in Def to name in NetDef
std::vector<NetDef*> net_def_stack;
SymbolTable& symbol_table;
int next_fresh = 0;
private:
void emitFillOp(const Apply& apply, const std::vector<std::string>& outputs) {
auto builtin_type = apply.name().name();
auto values = getValues(apply.inputs());
if (values.size() > 1) {
throw ErrorReport(apply)
<< "Built-in " << builtin_type << " accepts 0 or 1 inputs.";
}
bool has_shape = false;
for (const auto& attribute : apply.attributes()) {
if (attribute.name().name() == "shape") {
has_shape = true;
} else {
throw ErrorReport(apply)
<< "Unrecognized attribute " << attribute.name().name()
<< " for built-in " << builtin_type;
}
}
if (builtin_type == "zeros" || builtin_type == "ones") {
if ((values.size() != 1) && !has_shape) {
throw ErrorReport(apply)
<< "Built-in " << builtin_type
<< " requires either 1 input or 1 shape attribute";
}
} else {
// zeros_like or ones_like
if (values.size() != 1) {
throw ErrorReport(apply)
<< "Built-in " << builtin_type << " requires 1 input";
}
}
auto op = cur().add_op();
op->set_type("ConstantFill");
if (values.size()) {
op->add_input(values[0]);
auto* input_as_shape = op->add_arg();
input_as_shape->set_name("input_as_shape");
if (builtin_type.find("_like") != std::string::npos) {
// zeros_like, ones_like take the shape of the input as constant
// tensor shape
input_as_shape->set_i(0);
} else {
// zeros, ones take the values in the tensor as constant tensor
// shape
input_as_shape->set_i(1);
}
} else {
fillArg(op->add_arg(), apply.attributes()[0]);
}
auto value = op->add_arg();
value->set_name("value");
if (builtin_type.find("ones") != std::string::npos) {
value->set_f(1.0f);
} else {
value->set_f(0.0f);
}
appendOutputs(apply, op, outputs, 1);
}
// emitModule doesn't actually do anything except for allow
// statements like a = Module() to register 'a' as a valid identifier
// so that a.b = ... will work
void emitModule(const Apply& apply, const std::vector<std::string>& outputs) {
expectOutputs(apply, outputs, 1);
}
std::unordered_map<
std::string,
std::function<void(
DefCompiler*,
const Apply&,
const std::vector<std::string>& outputs)>>
builtins{{"zeros", &DefCompiler::emitFillOp},
{"zeros_like", &DefCompiler::emitFillOp},
{"ones", &DefCompiler::emitFillOp},
{"ones_like", &DefCompiler::emitFillOp},
{"Module", &DefCompiler::emitModule}};
};
struct CompilationUnitImpl {
void defineFunction(const Def& def) {
if (functions.count(def.name().name()) > 0) {
throw ErrorReport(def) << def.name().name() << " already defined.";
}
DefCompiler c(
functions.emplace(def.name().name(), FunctionDefinition(def))
.first->second,
functions);
c.run();
}
void define(const std::string& str) {
Parser p(str);
while (p.lexer().cur().kind != TK_EOF) {
defineFunction(Def(p.parseFunction()));
}
}
std::unique_ptr<NetBase> createNet(Workspace* ws, const std::string& str) {
if (functions.count(str) == 0)
throw ErrorReport() << "undefined function: " << str << "\n";
auto& def = functions.at(str);
return caffe2::CreateNet(*def.net_def, ws);
}
void defineExtern(const std::string& name, std::unique_ptr<NetDef> net_def) {
// TODO: unify extern and function namespaces
if (functions.count(name) > 0) {
throw ErrorReport() << "function '" << name << "' already defined.";
}
functions.emplace(name, FunctionDefinition(std::move(net_def)));
}
std::string getProto(const std::string& functionName) {
return functions.at(functionName).net_def->DebugString();
}
private:
friend struct DefCompiler;
SymbolTable functions;
};
CompilationUnit::CompilationUnit() : pImpl(new CompilationUnitImpl()) {}
void CompilationUnit::define(const std::string& str) {
return pImpl->define(str);
}
void CompilationUnit::defineExtern(
const std::string& name,
std::unique_ptr<NetDef> nd) {
pImpl->defineExtern(name, std::move(nd));
}
std::unique_ptr<NetBase> CompilationUnit::createNet(
Workspace* ws,
const std::string& str) {
return pImpl->createNet(ws, str);
}
std::string CompilationUnit::getProto(const std::string& functionName) const {
return pImpl->getProto(functionName);
}
CompilationUnit::~CompilationUnit() {}
} // namespace script
} // namespace caffe2
| 32.214106 | 87 | 0.559622 | [
"object",
"shape",
"vector"
] |
d7591567d5f50fe07706460f1235144ba58f3599 | 2,836 | cpp | C++ | libs/liboclWrapper/oclWrapper.cpp | GabrielHapki/OpenCL | 44e58bc9c43867d24cc6f08eb2e30a9268c5db20 | [
"MIT"
] | null | null | null | libs/liboclWrapper/oclWrapper.cpp | GabrielHapki/OpenCL | 44e58bc9c43867d24cc6f08eb2e30a9268c5db20 | [
"MIT"
] | null | null | null | libs/liboclWrapper/oclWrapper.cpp | GabrielHapki/OpenCL | 44e58bc9c43867d24cc6f08eb2e30a9268c5db20 | [
"MIT"
] | null | null | null | #include "oclWrapper.hpp"
#include <iostream>
#include <fstream>
bool oclWrapper::Init(const ocl::Blocking_t block, const ocl::Profiling_t profiling)
{
std::vector<cl::Platform> all_platforms;
cl::Platform::get(&all_platforms);
if (all_platforms.size()==0) {
std::cout<<" No platforms found. Check OpenCL installation!\n";
return false;
}
cl::Platform default_platform=all_platforms[0];
std::cout << "Using platform: "<<default_platform.getInfo<CL_PLATFORM_NAME>()<<"\n";
std::vector<cl::Device> all_devices;
default_platform.getDevices(CL_DEVICE_TYPE_ALL, &all_devices);
if(all_devices.size()==0){
std::cout<<" No devices found. Check OpenCL installation!\n";
return false;
}
this->m_device=all_devices[0];
std::cout<< "Using device: "<<this->m_device.getInfo<CL_DEVICE_NAME>()<<"\n";
this->m_context = cl::Context({this->m_device});
cl_command_queue_properties properties = 0;
if (block == ocl::ASYNC)
properties |= CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE;
if (profiling == ocl::PROFILING)
properties |= CL_QUEUE_PROFILING_ENABLE;
this->m_queue = cl::CommandQueue(this->m_context, this->m_device, properties);
return true;
}
bool oclWrapper::LoadSourceCode(const std::string& KernelFile)
{
std::string KernelFileSrc = KernelFile + ".cl";
std::ifstream file(KernelFileSrc.data());
std::string prog(std::istreambuf_iterator<char>(file), (std::istreambuf_iterator<char>()));
cl::Program::Sources sources;
sources.push_back({prog.c_str(), prog.length() + 1});
this->m_program = cl::Program(this->m_context, sources);
file.close();
if (this->m_program.build({this->m_device}) != CL_SUCCESS){
std::cout << "Error building: " << this->m_program.getBuildInfo<CL_PROGRAM_BUILD_LOG>(this->m_device) << std::endl;
return false;
}
return true;
}
cl::Context oclWrapper::GetContext()
{
return this->m_context;
}
cl::Program oclWrapper::GetProgram()
{
return this->m_program;
}
cl::CommandQueue oclWrapper::GetQueue()
{
return this->m_queue;
}
void oclWrapper::Flush()
{
auto properties = this->m_queue.getInfo<CL_QUEUE_PROPERTIES>();
if (!(properties & CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE)) // if it is Synchronous
this->m_queue.flush();
}
double oclWrapper::ElapsedTime(const cl::Event &event)
{
auto properties = this->m_queue.getInfo<CL_QUEUE_PROPERTIES>();
if (properties & CL_QUEUE_PROFILING_ENABLE){ // if it is Synchronous
cl_ulong startTime = event.getProfilingInfo<CL_PROFILING_COMMAND_START>();
cl_ulong endTime = event.getProfilingInfo<CL_PROFILING_COMMAND_END>();
double elapsedtime = (endTime - startTime)/1000.f;
return elapsedtime;
}
return -1.f;
} | 32.227273 | 123 | 0.679831 | [
"vector"
] |
d7592d730bf16185ab44e63be13925882f0e5a58 | 7,592 | cpp | C++ | Modules/IGT/IO/mitkNavigationToolReader.cpp | maleike/MITK | 83b0c35625dfaed99147f357dbd798b1dc19815b | [
"BSD-3-Clause"
] | 5 | 2015-05-27T06:57:53.000Z | 2020-03-12T21:08:23.000Z | Modules/IGT/IO/mitkNavigationToolReader.cpp | rkhlebnikov/MITK | 4e084d2d790cac945757ead66b2898ca70e5cd28 | [
"BSD-3-Clause"
] | 4 | 2020-09-17T16:01:55.000Z | 2022-01-18T21:12:10.000Z | Modules/IGT/IO/mitkNavigationToolReader.cpp | rkhlebnikov/MITK | 4e084d2d790cac945757ead66b2898ca70e5cd28 | [
"BSD-3-Clause"
] | 2 | 2016-08-17T12:01:04.000Z | 2020-03-12T22:36:36.000Z | /*===================================================================
The Medical Imaging Interaction Toolkit (MITK)
Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.
This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.
See LICENSE.txt or http://www.mitk.org for details.
===================================================================*/
//Poco headers
#include <Poco/Zip/Decompress.h>
#include <Poco/Path.h>
//mitk headers
#include "mitkNavigationToolReader.h"
#include "mitkTrackingTypes.h"
#include <mitkIOUtil.h>
#include <mitkSceneIO.h>
mitk::NavigationToolReader::NavigationToolReader()
{
m_ToolfilePath = mitk::IOUtil::GetTempPath() + Poco::Path::separator() + "IGT_Toolfiles" + Poco::Path::separator();
}
mitk::NavigationToolReader::~NavigationToolReader()
{
}
mitk::NavigationTool::Pointer mitk::NavigationToolReader::DoRead(std::string filename)
{
//decompress all files into a temporary directory
std::ifstream file( filename.c_str(), std::ios::binary );
if (!file.good())
{
m_ErrorMessage = "Cannot open '" + filename + "' for reading";
return NULL;
}
std::string tempDirectory = m_ToolfilePath + GetFileWithoutPath(filename);
Poco::Zip::Decompress unzipper( file, Poco::Path( tempDirectory ) );
unzipper.decompressAllFiles();
//use SceneSerialization to load the DataStorage
mitk::SceneIO::Pointer mySceneIO = mitk::SceneIO::New();
mitk::DataStorage::Pointer loadedStorage = mySceneIO->LoadScene(tempDirectory + Poco::Path::separator() + GetFileWithoutPath(filename) + ".storage");
if (loadedStorage->GetAll()->size()==0 || loadedStorage.IsNull())
{
m_ErrorMessage = "Invalid file: cannot parse tool data.";
return NULL;
}
//convert the DataStorage back to a NavigationTool-Object
mitk::DataNode::Pointer myNode = loadedStorage->GetAll()->ElementAt(0);
mitk::NavigationTool::Pointer returnValue = ConvertDataNodeToNavigationTool(myNode, tempDirectory);
//delete the data-storage file which is not needed any more. The toolfile must be left in the temporary directory becauses it is linked in the datatreenode of the tool
std::remove((std::string(tempDirectory + Poco::Path::separator() + GetFileWithoutPath(filename) + ".storage")).c_str());
return returnValue;
}
mitk::NavigationTool::Pointer mitk::NavigationToolReader::ConvertDataNodeToNavigationTool(mitk::DataNode::Pointer node, std::string toolPath)
{
mitk::NavigationTool::Pointer returnValue = mitk::NavigationTool::New();
//DateTreeNode with Name and Surface
mitk::DataNode::Pointer newNode = mitk::DataNode::New();
newNode->SetName(node->GetName());
newNode->SetData(node->GetData());
returnValue->SetDataNode(newNode);
//Identifier
std::string identifier;
node->GetStringProperty("identifier",identifier);
returnValue->SetIdentifier(identifier);
//Serial Number
std::string serial;
node->GetStringProperty("serial number",serial);
returnValue->SetSerialNumber(serial);
//Tracking Device
int device_type;
node->GetIntProperty("tracking device type",device_type);
returnValue->SetTrackingDeviceType(static_cast<mitk::TrackingDeviceType>(device_type));
//Tool Type
int type;
node->GetIntProperty("tracking tool type",type);
returnValue->SetType(static_cast<mitk::NavigationTool::NavigationToolType>(type));
//Calibration File Name
std::string calibration_filename;
node->GetStringProperty("toolfileName",calibration_filename);
if (calibration_filename=="none")
{
returnValue->SetCalibrationFile("none");
}
else
{
std::string calibration_filename_with_path = toolPath + Poco::Path::separator() + calibration_filename;
returnValue->SetCalibrationFile(calibration_filename_with_path);
}
//Tool Landmarks
mitk::PointSet::Pointer ToolRegLandmarks = mitk::PointSet::New();
mitk::PointSet::Pointer ToolCalLandmarks = mitk::PointSet::New();
std::string RegLandmarksString;
std::string CalLandmarksString;
node->GetStringProperty("ToolRegistrationLandmarks",RegLandmarksString);
node->GetStringProperty("ToolCalibrationLandmarks",CalLandmarksString);
ToolRegLandmarks = ConvertStringToPointSet(RegLandmarksString);
ToolCalLandmarks = ConvertStringToPointSet(CalLandmarksString);
returnValue->SetToolRegistrationLandmarks(ToolRegLandmarks);
returnValue->SetToolCalibrationLandmarks(ToolCalLandmarks);
//Tool Tip
std::string toolTipPositionString;
std::string toolTipOrientationString;
bool positionSet = node->GetStringProperty("ToolTipPosition",toolTipPositionString);
bool orientationSet = node->GetStringProperty("ToolTipOrientation",toolTipOrientationString);
if(positionSet && orientationSet) //only define tooltip if it is set
{
returnValue->SetToolTipPosition(ConvertStringToPoint(toolTipPositionString));
returnValue->SetToolTipOrientation(ConvertStringToQuaternion(toolTipOrientationString));
}
else if(positionSet != orientationSet)
{
MITK_WARN << "Tooltip definition incomplete: position and orientation have to be set! Skipping tooltip definition.";
}
return returnValue;
}
std::string mitk::NavigationToolReader::GetFileWithoutPath(std::string FileWithPath)
{
Poco::Path myFile(FileWithPath.c_str());
return myFile.getFileName();
}
mitk::PointSet::Pointer mitk::NavigationToolReader::ConvertStringToPointSet(std::string string)
{
mitk::PointSet::Pointer returnValue = mitk::PointSet::New();
std::string pointSeperator = "|";
std::string valueSeperator = ";";
std::vector<std::string> points;
split(string,pointSeperator,points);
for(unsigned int i=0; i<points.size(); i++)
{
std::vector<std::string> values;
split(points.at(i),valueSeperator,values);
if (values.size() == 4)
{
double index = atof(values.at(0).c_str());
mitk::Point3D point;
point[0] = atof(values.at(1).c_str());
point[1] = atof(values.at(2).c_str());
point[2] = atof(values.at(3).c_str());
returnValue->SetPoint(index,point);
}
}
return returnValue;
}
mitk::Point3D mitk::NavigationToolReader::ConvertStringToPoint(std::string string)
{
std::string valueSeperator = ";";
std::vector<std::string> values;
split(string,valueSeperator,values);
mitk::Point3D point;
if (values.size() == 3)
{
point[0] = atof(values.at(0).c_str());
point[1] = atof(values.at(1).c_str());
point[2] = atof(values.at(2).c_str());
}
return point;
}
mitk::Quaternion mitk::NavigationToolReader::ConvertStringToQuaternion(std::string string)
{
std::string valueSeperator = ";";
std::vector<std::string> values;
split(string,valueSeperator,values);
mitk::Quaternion quat = mitk::Quaternion(0,0,0,1);
if (values.size() == 4)
{
quat = mitk::Quaternion(atof(values.at(0).c_str()),
atof(values.at(1).c_str()),
atof(values.at(2).c_str()),
atof(values.at(3).c_str()));
}
return quat;
}
void mitk::NavigationToolReader::split(std::string& text, std::string& separators, std::vector<std::string>& words)
{
int n = text.length();
int start, stop;
start = text.find_first_not_of(separators);
while ((start >= 0) && (start < n))
{
stop = text.find_first_of(separators, start);
if ((stop < 0) || (stop > n)) stop = n;
words.push_back(text.substr(start, stop - start));
start = text.find_first_not_of(separators, stop+1);
}
}
| 34.509091 | 169 | 0.70706 | [
"object",
"vector"
] |
d75ebcac556d8d392665e562b3be4b24f8a6d986 | 1,636 | cpp | C++ | 0123-Word Search/0123-Word Search.cpp | nmdis1999/LintCode-1 | 316fa395c9a6de9bfac1d9c9cf58acb5ffb384a6 | [
"MIT"
] | 77 | 2017-12-30T13:33:37.000Z | 2022-01-16T23:47:08.000Z | 0101-0200/0123-Word Search/0123-Word Search.cpp | jxhangithub/LintCode-1 | a8aecc65c47a944e9debad1971a7bc6b8776e48b | [
"MIT"
] | 1 | 2018-05-14T14:15:40.000Z | 2018-05-14T14:15:40.000Z | 0101-0200/0123-Word Search/0123-Word Search.cpp | jxhangithub/LintCode-1 | a8aecc65c47a944e9debad1971a7bc6b8776e48b | [
"MIT"
] | 39 | 2017-12-07T14:36:25.000Z | 2022-03-10T23:05:37.000Z | class Solution {
public:
/**
* @param board: A list of lists of character
* @param word: A string
* @return: A boolean
*/
bool exist(vector<vector<char> > &board, string word) {
// write your code here
if (word.size() == 0)
{
return false;
}
int m = board.size();
if (m == 0)
{
return false;
}
int n = board[0].size();
vector<vector<bool>> visited(m, vector<bool>(n));
for (int i = 0; i < m; ++i)
{
for (int j = 0; j < n; ++j)
{
if (dfs(board, i, j, visited, word, 0))
{
return true;
}
}
}
return false;
}
private:
bool dfs(vector<vector<char> > &board, int i, int j, vector<vector<bool>>& visited, string& word, int start)
{
if (start == word.size())
{
return true;
}
if (i < 0 || i >= board.size() || j < 0 || j >= board[i].size() || visited[i][j])
{
return false;
}
if (board[i][j] != word[start])
{
return false;
}
visited[i][j] = true;
bool result = dfs(board, i - 1, j, visited, word, start + 1) ||
dfs(board, i + 1, j, visited, word, start + 1) ||
dfs(board, i, j - 1, visited, word, start + 1) ||
dfs(board, i, j + 1, visited, word, start + 1);
visited[i][j] = false;
return result;
}
};
| 25.968254 | 112 | 0.397922 | [
"vector"
] |
d768c8aaeab120127bcfe843c759be859f620190 | 972 | cpp | C++ | c++/p0012.cpp | champson/leetcode | dee1ec06bbca2c8d2f8d1eda0885f99f39067d1c | [
"MIT"
] | null | null | null | c++/p0012.cpp | champson/leetcode | dee1ec06bbca2c8d2f8d1eda0885f99f39067d1c | [
"MIT"
] | null | null | null | c++/p0012.cpp | champson/leetcode | dee1ec06bbca2c8d2f8d1eda0885f99f39067d1c | [
"MIT"
] | null | null | null | /* 12. Integer to Roman
* Given an integer, convert it to a roman numeral.
*
* Input is guaranteed to be within the range from 1 to 3999.
*/
class Solution {
public:
string intToRoman(int num) {
string roman;
if (num < 1 || num > 3999) return "";
vector<pair<int, char>> romanMap = {{1000, 'M'}, {500, 'D'}, {100, 'C'}, {50, 'L'}, {10, 'X'}, {5, 'V'}, {1, 'I'}};
int size = romanMap.size(), i, j;
for (i = 0; i < size; i++) {
while (num >= romanMap[i].first) {
roman.push_back(romanMap[i].second);
num -= romanMap[i].first;
}
if (num == 0) break;
j = (i + 2) - i % 2;
if (num >= (romanMap[i].first - romanMap[j].first)) {
roman.push_back(romanMap[j].second);
roman.push_back(romanMap[i].second);
num -= romanMap[i].first - romanMap[j].first;
}
}
return roman;
}
};
| 32.4 | 121 | 0.481481 | [
"vector"
] |
d769fc2187288e2754ddb27014629db82723f2d1 | 10,731 | cpp | C++ | Medusa/Medusa/Node/Panel/ScrollPanel.cpp | tony2u/Medusa | d4ac8181a693bc796681880e09aac3fdba9aaaaf | [
"MIT"
] | 143 | 2015-11-18T01:06:03.000Z | 2022-03-30T03:08:54.000Z | Medusa/Medusa/Node/Panel/ScrollPanel.cpp | tony2u/Medusa | d4ac8181a693bc796681880e09aac3fdba9aaaaf | [
"MIT"
] | 1 | 2019-10-23T13:00:40.000Z | 2019-10-23T13:00:40.000Z | Medusa/Medusa/Node/Panel/ScrollPanel.cpp | tony2u/Medusa | d4ac8181a693bc796681880e09aac3fdba9aaaaf | [
"MIT"
] | 45 | 2015-11-18T01:17:59.000Z | 2022-03-05T12:29:45.000Z | // Copyright (c) 2015 fjz13. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
#include "MedusaPreCompiled.h"
#include "ScrollPanel.h"
#include "Node/Input/Gesture/SwipeGestureRecognizer.h"
#include "Node/Input/InputDispatcher.h"
#include "Core/Log/Log.h"
#include "Graphics/ResolutionAdapter.h"
#include "Resource/Model/Mesh/General/ShapeGeneralMesh.h"
#include "Resource/Material/MaterialFactory.h"
#include "Resource/Effect/EffectFactory.h"
#include "Resource/ResourceNames.h"
#include "Node/NodeFactory.h"
#include "Node/Action/Basic/FadeBySpeedAction.h"
#include "Geometry/Scroll/SpringScrollMathModel.h"
#include "Node/NodeFactory.h"
MEDUSA_BEGIN;
ScrollPanel::ScrollPanel(StringRef name, ScrollDirection direction )
:IPanel(name),
mScrollBarColor(Color4F::Silver)
{
EnableClipToBound(true);
mSwipeGestureRecognizer = MutableInput().AddSwipeGestureRecognizer(direction);
mSwipeGestureRecognizer->OnSwipeBegin += Bind(&ScrollPanel::OnSwipeBegin,this);
mSwipeGestureRecognizer->OnSwipeMoved += Bind(&ScrollPanel::OnSwipeMoved, this);
mSwipeGestureRecognizer->OnSwipeFailed += Bind(&ScrollPanel::OnSwipeFailed, this);
mSwipeGestureRecognizer->OnSwipeSuccess += Bind(&ScrollPanel::OnSwipeSuccess, this);
mScrollModel = new SpringScrollMathModel(direction);
}
ScrollPanel::ScrollPanel(StringRef name /*= StringRef::Empty*/, const IEventArg& e /*= IEventArg::Empty*/)
:IPanel(name,e),
mScrollBarColor(Color4F::Silver)
{
EnableClipToBound(true);
}
ScrollPanel::~ScrollPanel(void)
{
SAFE_DELETE(mScrollModel);
}
bool ScrollPanel::ArrangeChildren(const Rect2F& limitRect/*=Rect2F::Zero*/, NodeLayoutArrangeFlags arrangeFlags/*=NodeLayoutArrangeFlags::None*/)
{
for (auto child : mNodes)
{
CONTINUE_IF(mManagedNodes.Contains(child));
child->ArrangeRecursively(limitRect, arrangeFlags);
}
OnInitializeTargetBoundingBox();
UpdateScrollStatus();
return true;
}
bool ScrollPanel::IsVertical() const
{
return GetScrollDirection().IsVertical();
}
bool ScrollPanel::IsHorizontal() const
{
return GetScrollDirection().IsHorizontal();
}
ScrollDirection ScrollPanel::GetScrollDirection() const
{
return mSwipeGestureRecognizer->Direction();
}
void ScrollPanel::SetScrollDirection(ScrollDirection direction)
{
RETURN_IF_EQUAL(mSwipeGestureRecognizer->Direction(), direction);
mSwipeGestureRecognizer->SetDirection(direction);
mScrollModel->SetDirection(direction);
UpdateScrollStatus();
}
void ScrollPanel::SetScrollModel(IScrollMathModel* val)
{
SAFE_ASSIGN(mScrollModel, val);
}
void ScrollPanel::OnSwipeBegin(INode* sender, SwipeBeginGestureEventArg& e)
{
mScrollModel->Focus();
UpdateScrollStatus();
}
void ScrollPanel::OnSwipeMoved(INode* sender, SwipeMovedGestureEventArg& e)
{
Point2F movement = mSwipeGestureRecognizer->MovementOnDirection();
mScrollModel->StaticScroll(movement);
OnMoveChildren();
UpdateScrollStatus();
}
void ScrollPanel::OnSwipeFailed(INode* sender, SwipeFailedGestureEventArg& e)
{
mScrollModel->Release();
UpdateScrollStatus();
}
void ScrollPanel::OnSwipeSuccess(INode* sender, SwipeSuccessGestureEventArg& e)
{
Point2F velocity = mSwipeGestureRecognizer->CurrentVelocityOnDirection();
mScrollModel->StartScrolling(velocity);
UpdateScrollStatus();
}
void ScrollPanel::ScrollTo(Point2F offset)
{
mScrollModel->ScrollTo(offset);
OnMoveChildren();
UpdateScrollStatus();
}
void ScrollPanel::ScrollBy(Point2F movement)
{
mScrollModel->ScrollBy(movement);
OnMoveChildren();
UpdateScrollStatus();
}
void ScrollPanel::ScrollToStart()
{
mScrollModel->ScrollToStart();
OnMoveChildren();
UpdateScrollStatus();
}
void ScrollPanel::ScrollToEnd()
{
mScrollModel->ScrollToEnd();
OnMoveChildren();
UpdateScrollStatus();
}
void ScrollPanel::UpdateScrollStatus()
{
OnUpdateScrollBar();
}
void ScrollPanel::OnMoveChildren()
{
Point3F movement = mScrollModel->Movement();
mScrollModel->ApplyMovement();
for (auto child : mNodes)
{
CONTINUE_IF(mManagedNodes.Contains(child));
child->Move(movement);
}
}
void ScrollPanel::OnInitializeTargetBoundingBox()
{
Rect2F targetBoundingBox = Rect2F::Zero;
if (mNodes.Count() > mManagedNodes.Count())
{
//try to optimize this
for (auto child : mNodes)
{
CONTINUE_IF(mManagedNodes.Contains(child));
Rect2F boundingBox = child->GetBoundingBox().To2D();
targetBoundingBox.Union(boundingBox);
}
}
mScrollModel->Initialize(mSize.To2D(), targetBoundingBox);
}
void ScrollPanel::OnUpdateScrollBar()
{
{
bool isShowHorizontal = false;
switch (mHorizontalScrollBarVisibility)
{
case ScrollBarVisibility::Disabled:
if (mHorizontalScrollBar != nullptr)
{
DeleteChild(mHorizontalScrollBar);
mHorizontalScrollBar = nullptr;
}
break;
case ScrollBarVisibility::VisibleIfNeed:
case ScrollBarVisibility::Auto:
isShowHorizontal = mScrollModel->NeedHorizontalScrollBar();
if (!isShowHorizontal&&mHorizontalScrollBar != nullptr&&mHorizontalScrollBar->IsVisible())
{
mHorizontalScrollBar->StopAllActions();
mHorizontalScrollBar->SetVisible(false);
}
break;
case ScrollBarVisibility::AlwaysVisible:
isShowHorizontal = true;
break;
default:
break;
}
if (isShowHorizontal)
{
float offset = mScrollModel->HorizontalScrollBarOffset();
float scrollBarWidth = mScrollModel->HorizontalScrollBarWidth();
if (mHorizontalScrollBar == nullptr)
{
mHorizontalScrollBar = (INode*)NodeFactory::Instance().CreateRect( Rect2F(0, 0, 1, mHorizontalScrollBarHeight), mScrollBarColor);
mHorizontalScrollBar->SetName(MEDUSA_PREFIX(HorizontalScrollBar));
mHorizontalScrollBar->SetPosition(Point3F::Zero);
mHorizontalScrollBar->EnableManaged();
AddChild(mHorizontalScrollBar);
}
mHorizontalScrollBar->SetSize(1, mHorizontalScrollBarHeight);
mHorizontalScrollBar->SetScaleX(scrollBarWidth);
mHorizontalScrollBar->SetPositionX(offset);
mHorizontalScrollBar->SetPositionY(0.f);
if (mVerticalScrollBarVisibility == ScrollBarVisibility::Auto)
{
IScrollMathModel::ScrollState state = mScrollModel->State();
switch (state)
{
case IScrollMathModel::ScrollState::None:
mHorizontalScrollBar->SetOpacity(0.f);
break;
case IScrollMathModel::ScrollState::Begin:
break;
case IScrollMathModel::ScrollState::StaticScroll:
case IScrollMathModel::ScrollState::Scrolling:
case IScrollMathModel::ScrollState::Spring:
if (Math::IsZero(mHorizontalScrollBar->Opacity()))
{
mHorizontalScrollBar->StopAllActions();
mHorizontalScrollBar->RunAction(new FadeBySpeedAction(mScrollBarOpacityFadeSpeed));
}
break;
case IScrollMathModel::ScrollState::End:
mHorizontalScrollBar->StopAllActions();
mHorizontalScrollBar->RunAction(new FadeBySpeedAction(-mScrollBarOpacityFadeSpeed));
break;
default:
break;
}
}
}
}
{
//vertical
bool isShowVertical = false;
switch (mVerticalScrollBarVisibility)
{
case ScrollBarVisibility::Disabled:
if (mVerticalScrollBar != nullptr)
{
DeleteChild(mVerticalScrollBar);
mVerticalScrollBar = nullptr;
}
break;
case ScrollBarVisibility::VisibleIfNeed:
case ScrollBarVisibility::Auto:
isShowVertical = mScrollModel->NeedVerticalScrollBar();
if (!isShowVertical&&mVerticalScrollBar != nullptr&&mVerticalScrollBar->IsVisible())
{
mVerticalScrollBar->StopAllActions();
mVerticalScrollBar->SetVisible(false);
}
break;
case ScrollBarVisibility::AlwaysVisible:
isShowVertical = true;
break;
default:
break;
}
if (isShowVertical)
{
float offset = mScrollModel->VerticalScrollBarOffset();
float scrollBarHeight = mScrollModel->VerticalScrollBarHeight();
if (mVerticalScrollBar == nullptr)
{
mVerticalScrollBar = (INode*)NodeFactory::Instance().CreateRect(Rect2F(0, 0, mVerticalScrollBarWidth, 1), mScrollBarColor);
mVerticalScrollBar->SetName(MEDUSA_PREFIX(VerticalScrollBar));
mVerticalScrollBar->SetPosition(Point3F::Zero);
mVerticalScrollBar->SetPositionX(mSize.Width - mVerticalScrollBarWidth);
mVerticalScrollBar->EnableManaged();
AddChild(mVerticalScrollBar);
}
mVerticalScrollBar->SetSize(mVerticalScrollBarWidth, 1);
mVerticalScrollBar->SetScaleY(scrollBarHeight);
mVerticalScrollBar->SetPositionX(mSize.Width - mVerticalScrollBarWidth);
mVerticalScrollBar->SetPositionY(offset);
if (mVerticalScrollBarVisibility == ScrollBarVisibility::Auto)
{
IScrollMathModel::ScrollState state = mScrollModel->State();
switch (state)
{
case IScrollMathModel::ScrollState::None:
mVerticalScrollBar->SetOpacity(0.f);
break;
case IScrollMathModel::ScrollState::Begin:
break;
case IScrollMathModel::ScrollState::StaticScroll:
case IScrollMathModel::ScrollState::Scrolling:
case IScrollMathModel::ScrollState::Spring:
if (Math::IsZero(mVerticalScrollBar->Opacity()))
{
mVerticalScrollBar->StopAllActions();
mVerticalScrollBar->RunAction(new FadeBySpeedAction(mScrollBarOpacityFadeSpeed));
}
break;
case IScrollMathModel::ScrollState::End:
mVerticalScrollBar->StopAllActions();
mVerticalScrollBar->RunAction(new FadeBySpeedAction(-mScrollBarOpacityFadeSpeed));
break;
default:
break;
}
}
}
}
}
void ScrollPanel::SetHorizontalScrollBarVisibility(ScrollBarVisibility val)
{
RETURN_IF_EQUAL(mHorizontalScrollBarVisibility, val);
mHorizontalScrollBarVisibility = val;
OnUpdateScrollBar();
}
void ScrollPanel::SetVerticalScrollBarVisibility(ScrollBarVisibility val)
{
RETURN_IF_EQUAL(mVerticalScrollBarVisibility, val);
mVerticalScrollBarVisibility = val;
OnUpdateScrollBar();
}
void ScrollPanel::SetHorizontalScrollBarHeight(float val)
{
RETURN_IF_EQUAL(mHorizontalScrollBarHeight, val);
mHorizontalScrollBarHeight = val;
OnUpdateScrollBar();
}
void ScrollPanel::SetVerticalScrollBarWidth(float val)
{
RETURN_IF_EQUAL(mVerticalScrollBarWidth, val);
mVerticalScrollBarWidth = val;
OnUpdateScrollBar();
}
bool ScrollPanel::OnUpdate(float dt, NodeUpdateFlags flag /*= NodeUpdateFlags::None*/)
{
bool isMoved = mScrollModel->UpdateModel(dt);
if (isMoved)
{
OnMoveChildren();
UpdateScrollStatus();
}
return true;
}
void ScrollPanel::OnBeginMove()
{
}
void ScrollPanel::OnEndMove()
{
UpdateScrollStatus();
}
bool ScrollPanel::IsSensitiveToChildLayoutChanged(const ILayoutable& sender, NodeLayoutChangedFlags changedFlag)
{
INode* child = (INode*)&sender;
return !mManagedNodes.Contains(child);
}
MEDUSA_IMPLEMENT_NODE(ScrollPanel);
MEDUSA_END;
| 25.733813 | 145 | 0.75445 | [
"mesh",
"geometry",
"model"
] |
d76c25d8622a0c65a18267b0bf40203664bf9462 | 3,263 | cc | C++ | engine/peer_impl.cc | snyderek/floating_temple | 267ee580620dc7f5a7fff7eb190dc03270267f4c | [
"Apache-2.0"
] | 2 | 2015-03-13T00:16:27.000Z | 2015-03-29T05:10:21.000Z | engine/peer_impl.cc | snyderek/floating_temple | 267ee580620dc7f5a7fff7eb190dc03270267f4c | [
"Apache-2.0"
] | null | null | null | engine/peer_impl.cc | snyderek/floating_temple | 267ee580620dc7f5a7fff7eb190dc03270267f4c | [
"Apache-2.0"
] | null | null | null | // Floating Temple
// Copyright 2015 Derek S. Snyder
//
// 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 "engine/peer_impl.h"
#include <memory>
#include <string>
#include <vector>
#include "base/logging.h"
#include "engine/canonical_peer_map.h"
#include "engine/connection_manager.h"
#include "engine/peer_id.h"
#include "engine/transaction_store.h"
#include "util/state_variable.h"
using std::string;
using std::vector;
namespace floating_temple {
class ObjectReference;
namespace engine {
class CanonicalPeer;
class SharedObject;
PeerImpl::PeerImpl()
: state_(NOT_STARTED) {
state_.AddStateTransition(NOT_STARTED, STARTING);
state_.AddStateTransition(STARTING, RUNNING);
state_.AddStateTransition(RUNNING, STOPPING);
state_.AddStateTransition(STOPPING, STOPPED);
}
PeerImpl::~PeerImpl() {
state_.CheckState(NOT_STARTED | STOPPED);
}
void PeerImpl::Start(Interpreter* interpreter,
const string& interpreter_type,
const string& local_address,
int peer_port,
const vector<string>& known_peer_ids,
int send_receive_thread_count) {
CHECK(interpreter != nullptr);
state_.ChangeState(STARTING);
const string local_peer_id = MakePeerId(local_address, peer_port);
LOG(INFO) << "The local peer id is " << local_peer_id;
const CanonicalPeer* const local_peer = canonical_peer_map_.GetCanonicalPeer(
local_peer_id);
transaction_store_.reset(new TransactionStore(&canonical_peer_map_,
&connection_manager_,
interpreter, local_peer));
connection_manager_.Start(&canonical_peer_map_, interpreter_type, local_peer,
transaction_store_.get(),
send_receive_thread_count);
// Connect to remote peers.
for (const string& peer_id : known_peer_ids) {
const CanonicalPeer* const known_peer =
canonical_peer_map_.GetCanonicalPeer(peer_id);
connection_manager_.ConnectToRemotePeer(known_peer);
}
state_.ChangeState(RUNNING);
}
void PeerImpl::RunProgram(LocalObject* local_object,
const string& method_name,
Value* return_value,
bool linger) {
if (state_.WaitForNotState(NOT_STARTED | STARTING) != RUNNING) {
return;
}
transaction_store_->RunProgram(local_object, method_name, return_value,
linger);
}
void PeerImpl::Stop() {
state_.ChangeState(STOPPING);
connection_manager_.Stop();
transaction_store_.reset(nullptr);
state_.ChangeState(STOPPED);
}
} // namespace engine
} // namespace floating_temple
| 29.93578 | 79 | 0.679743 | [
"vector"
] |
d76d4f6c487c1c358ed4450ba912abe116c77ab6 | 48,567 | cpp | C++ | src/engine/cpp/world_chunk.cpp | jjbandit/game | c28affd868201d3151ca75a20883e7fb26e09302 | [
"WTFPL"
] | 13 | 2017-04-12T16:26:46.000Z | 2022-03-01T22:04:34.000Z | src/engine/cpp/world_chunk.cpp | jjbandit/game | c28affd868201d3151ca75a20883e7fb26e09302 | [
"WTFPL"
] | null | null | null | src/engine/cpp/world_chunk.cpp | jjbandit/game | c28affd868201d3151ca75a20883e7fb26e09302 | [
"WTFPL"
] | null | null | null | inline b32
ChunkIsGarbage(world_chunk* Chunk)
{
Assert( IsSet(Chunk, Chunk_Queued) );
b32 Garbage = False;
if (IsSet(Chunk, Chunk_Garbage))
{
Chunk->Data->Flags = Chunk_Collected;
Garbage = True;
}
return Garbage;
}
bonsai_function world_chunk*
AllocateWorldChunk(memory_arena *Storage, world_position WorldP, chunk_dimension Dim)
{
u32 MaxLodMeshVerts = POINT_BUFFER_SIZE*3;
/* CAssert(sizeof(world_chunk) == CACHE_LINE_SIZE); */
world_chunk *Result = AllocateAlignedProtection(world_chunk, Storage, 1, CACHE_LINE_SIZE, false);
// FIXME(Jesse): The *2048 is an unnecessary debugging crutch .. take it out
Result->LodMesh = AllocateMesh(Storage, MaxLodMeshVerts*2048);
Result->Data = AllocateChunk(Storage, Dim);
Result->WorldP = WorldP;
Result->DimX = SafeTruncateU8(Dim.x);
Result->DimY = SafeTruncateU8(Dim.y);
Result->DimZ = SafeTruncateU8(Dim.z);
/* Result->CurrentTriangles = AllocateCurrentTriangles(2*4096, Storage); */
/* Result->CurrentTriangles->SurfacePoints = AllocateAlignedProtection(boundary_voxels, Storage, 1, 64, False); */
// TODO(Jesse, id: 133, tags: allocation, not_implemented): Allocate in a more sensible way?
/* Result->CurrentTriangles->SurfacePoints->Points = AllocateAlignedProtection(voxel_position, Storage, Volume(WorldChunkDim), 64, False); */
/* SeedTriangulation(Result->CurrentTriangles, Storage); */
return Result;
}
inline u32
GetWorldChunkHash(world_position P, chunk_dimension VisibleRegion)
{
/* TIMED_FUNCTION(); */
u32 I =
(u32)((P.x) +
(P.y*VisibleRegion.x) +
(P.z*VisibleRegion.x*VisibleRegion.y)) * WORLD_HASH_SIZE_MULTIPLIER;
u32 HashIndex = I % WORLD_HASH_SIZE;
return HashIndex;
}
bonsai_function void
InsertChunkIntoWorld(world *World, world_chunk *Chunk, chunk_dimension VisibleRegion)
{
u32 HashIndex = GetWorldChunkHash(Chunk->WorldP, VisibleRegion);
u32 StartingHashIndex = HashIndex;
#if BONSAI_INTERNAL
u32 BucketsSkipped = 0;
#endif
world_chunk **Current = World->ChunkHash + HashIndex;
while (*Current)
{
HashIndex = (HashIndex + 1) % WORLD_HASH_SIZE;
Current = World->ChunkHash + HashIndex;
if (HashIndex == StartingHashIndex)
{
Error("Hashtable full!");
break;
}
#if BONSAI_INTERNAL
++ BucketsSkipped;
#endif
}
#if BONSAI_INTERNAL
if (BucketsSkipped > 10)
{
Warn("%u Collisions encountered while inserting chunk into world", BucketsSkipped);
}
#endif
*Current = Chunk;
return;
}
bonsai_function world_chunk*
GetWorldChunkFor(memory_arena *Storage, world *World, world_position P, chunk_dimension VisibleRegion)
{
/* TIMED_FUNCTION(); */
world_chunk *Result = 0;
if (World->FreeChunkCount == 0)
{
Result = AllocateWorldChunk(Storage, P, World->ChunkDim);
}
else
{
Result = World->FreeChunks[--World->FreeChunkCount];
}
Assert(Result->Data->Flags == Chunk_Uninitialized);
Result->WorldP = P;
InsertChunkIntoWorld(World, Result, VisibleRegion);
return Result;
}
inline u32
GetNextWorldChunkHash(u32 HashIndex)
{
u32 Result = (HashIndex + 1) % WORLD_HASH_SIZE;
return Result;
}
bonsai_function void
DeallocateMesh(world_chunk* Chunk, mesh_freelist* MeshFreelist, memory_arena* Memory)
{
Chunk->Mesh->At = 0;
free_mesh* Container = Unlink_TS(&MeshFreelist->Containers);
if (!Container)
{
Container = Allocate(free_mesh, Memory, 1);
}
Container->Mesh = Chunk->Mesh;
Chunk->Mesh = 0;
Link_TS(&MeshFreelist->FirstFree, Container);
return;
}
bonsai_function void
FreeWorldChunk(world *World, world_chunk *Chunk , mesh_freelist* MeshFreelist, memory_arena* Memory)
{
TIMED_FUNCTION();
if ( Chunk->Data->Flags == Chunk_MeshComplete || Chunk->Data->Flags == Chunk_Collected )
{
Chunk->LodMesh_Complete = False;
Chunk->LodMesh->At = 0;
if (Chunk->Mesh)
{
DeallocateMesh(Chunk, MeshFreelist, Memory);
}
Assert(World->FreeChunkCount < FREELIST_SIZE);
World->FreeChunks[World->FreeChunkCount++] = Chunk;
// FIXME(Jesse): Memoryleak
/* SeedTriangulation( Chunk->CurrentTriangles, Memory); */
/* Chunk->CurrentTriangles->CurrentPointIndex = 0; */
/* Chunk->CurrentTriangles->SurfacePoints->End = 0; */
ZeroChunk(Chunk->Data);
}
else
{
SetFlag(Chunk, Chunk_Garbage);
}
return;
}
bonsai_function world_chunk*
GetWorldChunk( world *World, world_position P, chunk_dimension VisibleRegion)
{
/* TIMED_FUNCTION(); */
u32 HashIndex = GetWorldChunkHash(P, VisibleRegion);
world_chunk *Result = World->ChunkHash[HashIndex];
while (Result)
{
if (Result->WorldP == P)
{
break;
}
HashIndex = (HashIndex + 1) % WORLD_HASH_SIZE;
Result = World->ChunkHash[HashIndex];
}
return Result;
}
bonsai_function void
CollectUnusedChunks(world *World, mesh_freelist* MeshFreelist, memory_arena* Memory, chunk_dimension VisibleRegion)
{
TIMED_FUNCTION();
world_chunk ** WorldHash = World->ChunkHash;
world_position CenterP = World->Center;
chunk_dimension Radius = (VisibleRegion/2);
world_position Min = CenterP - Radius;
world_position Max = CenterP + Radius;
for (u32 ChunkIndex = 0;
ChunkIndex < WORLD_HASH_SIZE;
++ChunkIndex)
{
world_chunk** Chunk = WorldHash + ChunkIndex;
if (*Chunk)
{
world_position ChunkP = (*Chunk)->WorldP;
if ( !(ChunkP >= Min && ChunkP <= Max) )
{
if ( (*Chunk)->Data->Flags == Chunk_MeshComplete || (*Chunk)->Data->Flags == Chunk_Collected )
{
/* ++ChunksCollected; */
u32 ChunkHash = GetWorldChunkHash(ChunkP, VisibleRegion);
world_chunk** Current = WorldHash + ChunkHash;
u32 CurrentHash = GetWorldChunkHash((*Current)->WorldP, VisibleRegion);
world_chunk** LastChunkOfSameHashValue = WorldHash + ChunkHash;
while (*Current && GetWorldChunkHash((*Current)->WorldP, VisibleRegion) == ChunkHash)
{
LastChunkOfSameHashValue = Current;
CurrentHash = GetNextWorldChunkHash(CurrentHash);
Current = WorldHash + CurrentHash;
}
if (Chunk == LastChunkOfSameHashValue)
{
FreeWorldChunk(World, *Chunk, MeshFreelist, Memory);
*Chunk = 0;
}
else
{
FreeWorldChunk(World, *Chunk, MeshFreelist, Memory);
*Chunk = *LastChunkOfSameHashValue;
*LastChunkOfSameHashValue = 0;
--ChunkIndex;
}
}
else
{
SetFlag(*Chunk, Chunk_Garbage);
}
}
}
}
/* Print(ChunksPresentInHashtable); */
/* if(ChunksCollected) */
/* { */
/* Print(ChunksCollected); */
/* } */
return;
}
bonsai_function inline b32
IsFilledInWorld( world *World, world_chunk *chunk, canonical_position VoxelP, chunk_dimension VisibleRegion)
{
/* TIMED_FUNCTION(); */
b32 isFilled = true;
if ( chunk )
{
world_chunk *localChunk = chunk;
if ( chunk->WorldP != VoxelP.WorldP )
{
localChunk = GetWorldChunk(World, VoxelP.WorldP, VisibleRegion);
}
isFilled = localChunk && IsFilledInChunk(localChunk->Data, Voxel_Position(VoxelP.Offset), World->ChunkDim );
}
return isFilled;
}
inline b32
NotFilledInWorld( world *World, world_chunk *chunk, canonical_position VoxelP, chunk_dimension VisibleRegion)
{
/* TIMED_FUNCTION(); */
b32 Result = !(IsFilledInWorld(World, chunk, VoxelP, VisibleRegion));
return Result;
}
bonsai_function void
CopyChunkOffset(world_chunk *Src, voxel_position SrcChunkDim, world_chunk *Dest, voxel_position DestChunkDim, voxel_position Offset)
{
TIMED_FUNCTION();
for ( s32 z = 0; z < DestChunkDim.z; ++ z)
{
for ( s32 y = 0; y < DestChunkDim.y; ++ y)
{
for ( s32 x = 0; x < DestChunkDim.x; ++ x)
{
s32 DestIndex = GetIndex(Voxel_Position(x,y,z), DestChunkDim);
s32 SynIndex = GetIndex(Voxel_Position(x,y,z) + Offset, SrcChunkDim);
#if 1
Dest->Data->Voxels[DestIndex] = Src->Data->Voxels[SynIndex];
#else
voxel vSrc = Src->Data->Voxels[SynIndex];
voxel *vDest = Dest->Data->Voxels[DestIndex];
vDest = vSrc;
#endif
Dest->FilledCount += Dest->Data->Voxels[DestIndex].Flags & Voxel_Filled;
CAssert(Voxel_Filled == 1);
}
}
}
return;
}
bonsai_function void
InitChunkPlane(s32 zIndex, world_chunk *Chunk, chunk_dimension ChunkDim, u8 Color )
{
for ( s32 z = 0; z < ChunkDim.z; ++ z)
{
for ( s32 y = 0; y < ChunkDim.y; ++ y)
{
for ( s32 x = 0; x < ChunkDim.x; ++ x)
{
if (z == zIndex)
{
s32 Index = GetIndex(Voxel_Position(x,y,z), ChunkDim);
Chunk->Data->Voxels[Index].Flags = Voxel_Filled;
Chunk->Data->Voxels[Index].Color = Color;
}
}
}
}
return;
}
bonsai_function u32
InitChunkPerlinPlane(perlin_noise *Noise, world_chunk *WorldChunk, chunk_dimension Dim, u8 ColorIndex, s32 Amplitude, s64 zMin, chunk_dimension WorldChunkDim)
{
TIMED_FUNCTION();
u32 ChunkSum = 0;
Assert(WorldChunk);
chunk_data *ChunkData = WorldChunk->Data;
for ( s32 z = 0; z < Dim.z; ++ z)
{
for ( s32 y = 0; y < Dim.y; ++ y)
{
for ( s32 x = 0; x < Dim.x; ++ x)
{
s32 VoxIndex = GetIndex(Voxel_Position(x,y,z), Dim);
ChunkData->Voxels[VoxIndex].Flags = Voxel_Empty;
Assert( NotSet(&ChunkData->Voxels[VoxIndex], Voxel_Filled) );
double InX = ((double)x + ( (double)WorldChunkDim.x*(double)WorldChunk->WorldP.x))/NOISE_FREQUENCY;
double InY = ((double)y + ( (double)WorldChunkDim.y*(double)WorldChunk->WorldP.y))/NOISE_FREQUENCY;
double InZ = 1.0;
s64 zAbsolute = z - (zMin-Amplitude) + (WorldChunkDim.z*WorldChunk->WorldP.z);
r64 zSlicesAt = (1.0/(r64)Amplitude) * (r64)zAbsolute;
r64 NoiseValue = Noise->noise(InX, InY, InZ);
b32 NoiseChoice = NoiseValue > zSlicesAt ? True : False;
SetFlag(&ChunkData->Voxels[VoxIndex], (voxel_flag)(NoiseChoice * Voxel_Filled));
if (NoiseChoice)
{
ChunkData->Voxels[VoxIndex].Color = ColorIndex;
++ChunkSum;
Assert( IsSet(&ChunkData->Voxels[VoxIndex], Voxel_Filled) );
}
else
{
Assert( NotSet(&ChunkData->Voxels[VoxIndex], Voxel_Filled) );
}
}
}
}
return ChunkSum;
}
bonsai_function void
InitChunkPerlin(perlin_noise *Noise, world_chunk *WorldChunk, chunk_dimension Dim, u8 ColorIndex, chunk_dimension WorldChunkDim)
{
TIMED_FUNCTION();
Assert(WorldChunk);
chunk_data *ChunkData = WorldChunk->Data;
for ( s32 z = 0; z < Dim.z; ++ z)
{
for ( s32 y = 0; y < Dim.y; ++ y)
{
for ( s32 x = 0; x < Dim.x; ++ x)
{
s32 i = GetIndex(Voxel_Position(x,y,z), Dim);
ChunkData->Voxels[i].Flags = Voxel_Empty;
Assert( NotSet(&ChunkData->Voxels[i], Voxel_Filled) );
double InX = ((double)x + ( (double)WorldChunkDim.x*(double)WorldChunk->WorldP.x))/NOISE_FREQUENCY;
double InY = ((double)y + ( (double)WorldChunkDim.y*(double)WorldChunk->WorldP.y))/NOISE_FREQUENCY;
double InZ = ((double)z + ( (double)WorldChunkDim.z*(double)WorldChunk->WorldP.z))/NOISE_FREQUENCY;
r32 noiseValue = (r32)Noise->noise(InX, InY, InZ);
s32 NoiseChoice = Floori(noiseValue + 0.5f);
Assert(NoiseChoice == 0 || NoiseChoice == 1);
SetFlag(&ChunkData->Voxels[i], (voxel_flag)(NoiseChoice * Voxel_Filled));
if (NoiseChoice)
{
ChunkData->Voxels[i].Color = ColorIndex;
Assert( IsSet(&ChunkData->Voxels[i], Voxel_Filled) );
}
else
{
Assert( NotSet(&ChunkData->Voxels[i], Voxel_Filled) );
}
}
}
}
return;
}
bonsai_function void
BuildWorldChunkMesh(world_chunk *ReadChunk, chunk_dimension ReadChunkDim,
world_chunk *WriteChunk, chunk_dimension WriteChunkDim,
untextured_3d_geometry_buffer* DestGeometry)
{
TIMED_FUNCTION();
chunk_data *WriteChunkData = WriteChunk->Data;
chunk_data *ReadChunkData = ReadChunk->Data;
Assert(IsSet(ReadChunk, Chunk_Initialized));
Assert(IsSet(WriteChunk, Chunk_Initialized));
voxel_position rightVoxel;
voxel_position leftVoxel;
voxel_position topVoxel;
voxel_position botVoxel;
voxel_position frontVoxel;
voxel_position backVoxel;
s32 rightVoxelReadIndex;
s32 leftVoxelReadIndex;
s32 topVoxelReadIndex;
s32 botVoxelReadIndex;
s32 frontVoxelReadIndex;
s32 backVoxelReadIndex;
/* random_series ColorEntropy = {33453}; */
for ( s32 z = 0; z < WriteChunkDim.z ; ++z )
{
for ( s32 y = 0; y < WriteChunkDim.y ; ++y )
{
for ( s32 x = 0; x < WriteChunkDim.x ; ++x )
{
voxel_position CurrentP = Voxel_Position(x,y,z);
/* v4 Perturb = 0.08f*V4(RandomBilateral(&ColorEntropy), */
/* RandomBilateral(&ColorEntropy), */
/* RandomBilateral(&ColorEntropy), */
/* 1.0f); */
if ( NotFilledInChunk( WriteChunkData, CurrentP, WriteChunkDim ) )
continue;
v3 Diameter = V3(1.0f);
v3 VertexData[VERTS_PER_FACE];
v4 FaceColors[VERTS_PER_FACE];
voxel *Voxel = &WriteChunkData->Voxels[GetIndex(CurrentP, WriteChunkDim)];
FillColorArray(Voxel->Color, FaceColors, VERTS_PER_FACE);
#if 0
for (u32 ColorIndex = 0;
ColorIndex < VERTS_PER_FACE;
++ColorIndex)
{
FaceColors[ColorIndex] += Perturb*FaceColors[0];
}
#endif
rightVoxel = CurrentP + Voxel_Position(1, 0, 0);
rightVoxelReadIndex = GetIndex(rightVoxel+1, ReadChunkDim);
leftVoxel = CurrentP - Voxel_Position(1, 0, 0);
leftVoxelReadIndex = GetIndex(leftVoxel+1, ReadChunkDim);
topVoxel = CurrentP + Voxel_Position(0, 0, 1);
topVoxelReadIndex = GetIndex(topVoxel+1, ReadChunkDim);
botVoxel = CurrentP - Voxel_Position(0, 0, 1);
botVoxelReadIndex = GetIndex(botVoxel+1, ReadChunkDim);
frontVoxel = CurrentP + Voxel_Position(0, 1, 0);
frontVoxelReadIndex = GetIndex(frontVoxel+1, ReadChunkDim);
backVoxel = CurrentP - Voxel_Position(0, 1, 0);
backVoxelReadIndex = GetIndex(backVoxel+1, ReadChunkDim);
if ( NotFilledInChunk( ReadChunkData, rightVoxelReadIndex) )
{
RightFaceVertexData( V3(CurrentP), Diameter, VertexData);
BufferVertsDirect(DestGeometry, 6, VertexData, RightFaceNormalData, FaceColors);
}
if ( NotFilledInChunk( ReadChunkData, leftVoxelReadIndex) )
{
LeftFaceVertexData( V3(CurrentP), Diameter, VertexData);
BufferVertsDirect(DestGeometry, 6, VertexData, LeftFaceNormalData, FaceColors);
}
if ( NotFilledInChunk( ReadChunkData, botVoxelReadIndex) )
{
BottomFaceVertexData( V3(CurrentP), Diameter, VertexData);
BufferVertsDirect(DestGeometry, 6, VertexData, BottomFaceNormalData, FaceColors);
}
if ( NotFilledInChunk( ReadChunkData, topVoxelReadIndex) )
{
TopFaceVertexData( V3(CurrentP), Diameter, VertexData);
BufferVertsDirect(DestGeometry, 6, VertexData, TopFaceNormalData, FaceColors);
}
if ( NotFilledInChunk( ReadChunkData, frontVoxelReadIndex) )
{
FrontFaceVertexData( V3(CurrentP), Diameter, VertexData);
BufferVertsDirect(DestGeometry, 6, VertexData, FrontFaceNormalData, FaceColors);
}
if ( NotFilledInChunk( ReadChunkData, backVoxelReadIndex) )
{
BackFaceVertexData( V3(CurrentP), Diameter, VertexData);
BufferVertsDirect(DestGeometry, 6, VertexData, BackFaceNormalData, FaceColors);
}
}
}
}
return;
}
bonsai_function void
BuildWorldChunkMesh(world *World, world_chunk *WorldChunk, chunk_dimension WorldChunkDim, untextured_3d_geometry_buffer* DestMesh, chunk_dimension VisibleRegion)
{
TIMED_FUNCTION();
chunk_data *Chunk = WorldChunk->Data;
Assert(IsSet(Chunk, Chunk_Initialized));
Assert(NotSet(Chunk, Chunk_Queued));
canonical_position rightVoxel;
canonical_position leftVoxel;
canonical_position topVoxel;
canonical_position botVoxel;
canonical_position frontVoxel;
canonical_position backVoxel;
random_series ColorEntropy = {33453};
for ( s32 z = 0; z < WorldChunkDim.z ; ++z )
{
for ( s32 y = 0; y < WorldChunkDim.y ; ++y )
{
for ( s32 x = 0; x < WorldChunkDim.x ; ++x )
{
canonical_position CurrentP = Canonical_Position(WorldChunkDim, V3(x,y,z), WorldChunk->WorldP);
v4 Perturb = 0.08f*V4(RandomBilateral(&ColorEntropy),
RandomBilateral(&ColorEntropy),
RandomBilateral(&ColorEntropy),
1.0f);
if ( !IsFilledInWorld( World, WorldChunk, CurrentP, VisibleRegion) )
continue;
voxel *Voxel = &Chunk->Voxels[GetIndex(CurrentP.Offset, WorldChunkDim)];
v3 Diameter = V3(1.0f);
v3 VertexData[VERTS_PER_FACE];
v4 FaceColors[VERTS_PER_FACE];
FillColorArray(Voxel->Color, FaceColors, VERTS_PER_FACE);
for (u32 ColorIndex = 0;
ColorIndex < VERTS_PER_FACE;
++ColorIndex)
{
FaceColors[ColorIndex] += Perturb*FaceColors[0];
}
TIMED_BLOCK("Canonicalize");
rightVoxel = Canonicalize(WorldChunkDim, CurrentP + V3(1, 0, 0));
leftVoxel = Canonicalize(WorldChunkDim, CurrentP - V3(1, 0, 0));
topVoxel = Canonicalize(WorldChunkDim, CurrentP + V3(0, 0, 1));
botVoxel = Canonicalize(WorldChunkDim, CurrentP - V3(0, 0, 1));
frontVoxel = Canonicalize(WorldChunkDim, CurrentP + V3(0, 1, 0));
backVoxel = Canonicalize(WorldChunkDim, CurrentP - V3(0, 1, 0));
END_BLOCK("Canonicalize");
// FIXME(Jesse): This should use a BufferVertsChecked path
if ( !IsFilledInWorld( World, WorldChunk, rightVoxel, VisibleRegion) )
{
RightFaceVertexData( CurrentP.Offset, Diameter, VertexData);
BufferVertsDirect(DestMesh, 6, VertexData, RightFaceNormalData, FaceColors);
}
if ( !IsFilledInWorld( World, WorldChunk, leftVoxel, VisibleRegion ) )
{
LeftFaceVertexData( CurrentP.Offset, Diameter, VertexData);
BufferVertsDirect(DestMesh, 6, VertexData, LeftFaceNormalData, FaceColors);
}
if ( !IsFilledInWorld( World, WorldChunk, botVoxel, VisibleRegion ) )
{
BottomFaceVertexData( CurrentP.Offset, Diameter, VertexData);
BufferVertsDirect(DestMesh, 6, VertexData, BottomFaceNormalData, FaceColors);
}
if ( !IsFilledInWorld( World, WorldChunk, topVoxel, VisibleRegion ) )
{
TopFaceVertexData( CurrentP.Offset, Diameter, VertexData);
BufferVertsDirect(DestMesh, 6, VertexData, TopFaceNormalData, FaceColors);
}
if ( !IsFilledInWorld( World, WorldChunk, frontVoxel, VisibleRegion ) )
{
FrontFaceVertexData( CurrentP.Offset, Diameter, VertexData);
BufferVertsDirect(DestMesh, 6, VertexData, FrontFaceNormalData, FaceColors);
}
if ( !IsFilledInWorld( World, WorldChunk, backVoxel, VisibleRegion ) )
{
BackFaceVertexData( CurrentP.Offset, Diameter, VertexData);
BufferVertsDirect(DestMesh, 6, VertexData, BackFaceNormalData, FaceColors);
}
}
}
}
}
bonsai_function void
InitializeWorldChunkPerlin(perlin_noise *Noise,
chunk_dimension WorldChunkDim,
world_chunk *DestChunk,
untextured_3d_geometry_buffer* DestGeometry,
memory_arena *TempMemory)
{
TIMED_FUNCTION();
Assert( IsSet(DestChunk, Chunk_Queued) );
if (IsSet(DestChunk, Chunk_Garbage))
{
DestChunk->Data->Flags = Chunk_Collected;
return;
}
#if 0
// Don't blow out the Flags for this chunk or risk assertions on other
// threads that rely on that flag being set for every item on the queue
ZeroChunk(DestChunk->Data, Volume(WorldChunkDim));
#else
for ( s32 VoxelIndex = 0;
VoxelIndex < Volume(WorldChunkDim);
++VoxelIndex)
{
voxel *Voxel = &DestChunk->Data->Voxels[VoxelIndex];
Voxel->Flags = Voxel_Empty;
Voxel->Color = 0;
}
#endif
chunk_dimension SynChunkDim = WorldChunkDim + 2;
chunk_dimension SynChunkP = DestChunk->WorldP - 1;
world_chunk *SyntheticChunk = AllocateWorldChunk(TempMemory, SynChunkP, SynChunkDim );
InitChunkPerlin(Noise, SyntheticChunk, SynChunkDim, GRASS_GREEN, WorldChunkDim);
CopyChunkOffset(SyntheticChunk, SynChunkDim, DestChunk, WorldChunkDim, Voxel_Position(1));
SetFlag(DestChunk, Chunk_Initialized);
SetFlag(SyntheticChunk, Chunk_Initialized);
BuildWorldChunkMesh(SyntheticChunk, SynChunkDim, DestChunk, WorldChunkDim, DestGeometry);
DestChunk->Mesh = DestGeometry;
DestChunk->Data->Flags = Chunk_MeshComplete;
return;
}
bonsai_function void
InitializeWorldChunkPlane(world_chunk *DestChunk, chunk_dimension WorldChunkDim, untextured_3d_geometry_buffer* DestGeometry, memory_arena* TempMemory)
{
TIMED_FUNCTION();
Assert( IsSet(DestChunk, Chunk_Queued) );
if (IsSet(DestChunk, Chunk_Garbage))
{
DestChunk->Data->Flags = Chunk_Collected;
return;
}
#if 0
// Don't blow out the Flags for this chunk or risk assertions on other
// threads that rely on that flag being set for every item on the queue
ZeroChunk(DestChunk->Data, Volume(WorldChunkDim));
#else
for ( s32 VoxelIndex = 0;
VoxelIndex < Volume(WorldChunkDim);
++VoxelIndex)
{
voxel *Voxel = &DestChunk->Data->Voxels[VoxelIndex];
Voxel->Flags = Voxel_Empty;
Voxel->Color = 0;
}
#endif
chunk_dimension SynChunkDim = WorldChunkDim + 2;
chunk_dimension SynChunkP = DestChunk->WorldP - 1;
world_chunk *SyntheticChunk = AllocateWorldChunk(TempMemory, SynChunkP, SynChunkDim );
InitChunkPlane(1, SyntheticChunk, SynChunkDim, GREEN);
CopyChunkOffset(SyntheticChunk, SynChunkDim, DestChunk, WorldChunkDim, Voxel_Position(1));
SetFlag(DestChunk, Chunk_Initialized);
SetFlag(SyntheticChunk, Chunk_Initialized);
BuildWorldChunkMesh(SyntheticChunk, SynChunkDim, DestChunk, WorldChunkDim, DestGeometry);
DestChunk->Data->Flags = Chunk_MeshComplete;
return;
}
bonsai_function inline untextured_3d_geometry_buffer*
GetMeshForChunk(mesh_freelist* Freelist, memory_arena* PermMemory)
{
free_mesh* MeshContainer = Unlink_TS(&Freelist->FirstFree);
untextured_3d_geometry_buffer* Result = 0;
if (MeshContainer)
{
Result = MeshContainer->Mesh;
Assert(Result);
MeshContainer->Mesh = 0;
FullBarrier;
Link_TS(&Freelist->Containers, MeshContainer);
}
else
{
Result = AllocateMesh(PermMemory, (u32)Kilobytes(64));
Assert(Result);
}
return Result;
}
bonsai_function void
ClipAndDisplaceToMinDim(untextured_3d_geometry_buffer* Buffer, v3 Min, v3 Dim)
{
v3 Max = Min+Dim;
for (u32 VertIndex = 0;
VertIndex < Buffer->At;
++VertIndex)
{
v3* Vert = Buffer->Verts + VertIndex;
for (u32 AxisIndex = 0;
AxisIndex < 3;
++AxisIndex)
{
if (Vert->E[AxisIndex] > Max.E[AxisIndex])
{
Vert->E[AxisIndex] = Dim.E[AxisIndex];
}
else if (Vert->E[AxisIndex] < Min.E[AxisIndex])
{
Vert->E[AxisIndex] = 0;
}
else
{
Vert->E[AxisIndex] -= Min.E[AxisIndex];
}
}
}
}
bonsai_function void
FindEdgeIntersections(point_buffer* Dest, chunk_data* ChunkData, chunk_dimension ChunkDim)
{
{
voxel_position Start = Voxel_Position(0, 0, 0);
{
voxel_position Iter = Voxel_Position(1, 0, 0);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
{
voxel_position Iter = Voxel_Position(0, 1, 0);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
{
voxel_position Iter = Voxel_Position(0, 0, 1);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
}
{
voxel_position Start = Voxel_Position(0, ChunkDim.y-1, ChunkDim.z-1);
{
voxel_position Iter = Voxel_Position(1, 0, 0);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
{
voxel_position Iter = Voxel_Position(0,-1, 0);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
{
voxel_position Iter = Voxel_Position(0, 0,-1);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
}
{
voxel_position Start = Voxel_Position(ChunkDim.x-1, ChunkDim.y-1, 0);
{
voxel_position Iter = Voxel_Position(-1, 0, 0);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
{
voxel_position Iter = Voxel_Position(0,-1, 0);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
{
voxel_position Iter = Voxel_Position(0, 0, 1);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
}
{
voxel_position Start = Voxel_Position(ChunkDim.x-1, 0, ChunkDim.z-1);
{
voxel_position Iter = Voxel_Position(-1, 0, 0);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
{
voxel_position Iter = Voxel_Position(0, 1, 0);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
{
voxel_position Iter = Voxel_Position(0, 0,-1);
FindBoundaryVoxelsAlongEdge(ChunkData, ChunkDim, Start, Iter, Dest);
}
}
return;
}
#if 1
bonsai_function b32
VertsAreCoplanar(voxel_position* V1, voxel_position* V2, chunk_dimension WorldChunkDim)
{
b32 Result = ( V1->x == V2->x && (V1->x == 0 || V1->x == WorldChunkDim.x) ) ||
( V1->y == V2->y && (V1->y == 0 || V1->y == WorldChunkDim.y) ) ||
( V1->z == V2->z && (V1->z == 0 || V1->z == WorldChunkDim.z) ) ;
return Result;
}
bonsai_function b32
VertsAreNotCoplanar(voxel_position* V1, voxel_position* V2, chunk_dimension WorldChunkDim)
{
b32 Result = !VertsAreCoplanar(V1, V2, WorldChunkDim);
return Result;
}
bonsai_function voxel_position*
GetPrevCoplanarVertex(voxel_position* Query, point_buffer* Points, chunk_dimension WorldChunkDim)
{
voxel_position* Result = 0;
voxel_position* Current = Query + 1;
voxel_position* Last = Points->Points + Points->Count-1;
while (Current != Query)
{
if (Current < Points->Points) { Current = Last; }
if ( VertsAreCoplanar(Current, Query, WorldChunkDim) )
{
Result = Current;
break;
}
--Current;
}
return Result;
}
bonsai_function voxel_position*
GetNextCoplanarVertex(voxel_position* Query, point_buffer* Points, chunk_dimension WorldChunkDim)
{
voxel_position* Result = 0;
voxel_position* Current = Query + 1;
voxel_position* OnePastLast = Points->Points + Points->Count;
while (Current != Query)
{
if (Current == OnePastLast) { Current = Points->Points; }
if ( VertsAreCoplanar(Current, Query, WorldChunkDim) )
{
Result = Current;
break;
}
++Current;
}
return Result;
}
bonsai_function voxel_position*
GetClosestCoplanarPointRelativeTo(voxel_position* Query, voxel_position* Start, voxel_position* OnePastLastVert, v3 RelativePoint, chunk_dimension WorldChunkDim, voxel_position* Skip = 0)
{
voxel_position* Result = 0;
r32 ClosestDistance = f32_MAX;
for ( voxel_position* ClosestCandidate = Start;
ClosestCandidate < OnePastLastVert;
++ClosestCandidate)
{
if (ClosestCandidate == Query) { continue; }
if (ClosestCandidate == Skip) { continue; }
Assert(Result < OnePastLastVert);
r32 DistanceBetween = Distance(Normalize(RelativePoint - V3(*Query)), Normalize(RelativePoint - V3(*ClosestCandidate)));
if (DistanceBetween < ClosestDistance && VertsAreCoplanar(Query, ClosestCandidate, WorldChunkDim) )
{
ClosestDistance = DistanceBetween;
Result = ClosestCandidate;
}
}
return Result;
}
#define MAX_COPLANAR_VERT_COUNT 32
bonsai_function u32
GetAllCoplanarVerts(voxel_position* Query, point_buffer* Points, voxel_position* Results, chunk_dimension WorldChunkDim)
{
u32 Count = 0;
voxel_position* Current = Points->Points;
voxel_position* OnePastLast = Points->Points + Points->Count;
while (Current != OnePastLast)
{
Assert(Count < MAX_COPLANAR_VERT_COUNT);
if (Current == Query) { ++Current; continue; }
if ( VertsAreCoplanar(Current, Query, WorldChunkDim) ) { Results[Count++] = *Current; }
++Current;
}
return Count;
}
#endif
/* bonsai_function voxel_position* */
/* GetClosestAngularDistanceTo(voxel_position* Query, point_buffer* Points, v3 CenterPoint) */
/* { */
/* voxel_position* Result = 0; */
/* voxel_position* Current = Points->Points; */
/* voxel_position* OnePastLast = Points->Points + Points->Count; */
/* return Result; */
/* } */
bonsai_function b32
VertsAreColnear(voxel_position* V1, voxel_position* V2, voxel_position* V3)
{
r32 a = (r32)V1->x;
r32 b = (r32)V1->y;
r32 m = (r32)V2->x;
r32 n = (r32)V2->y;
r32 x = (r32)V3->x;
r32 y = (r32)V3->y;
b32 Result = (n-b)*(x-m) == (y-n)*(m-a);
return Result;
}
bonsai_function b32
TrianglesAreEqual(triangle* T1, triangle* T2)
{
b32 Result = (
( T1->Points[0] == T2->Points[0] || T1->Points[0] == T2->Points[1] || T1->Points[0] == T2->Points[2] ) &&
( T1->Points[1] == T2->Points[0] || T1->Points[1] == T2->Points[1] || T1->Points[1] == T2->Points[2] ) &&
( T1->Points[2] == T2->Points[0] || T1->Points[2] == T2->Points[1] || T1->Points[2] == T2->Points[2] ) );
return Result;
}
bonsai_function b32
TriangleIsUniqueInSet(triangle* Query, triangle** Set, u32 SetCount)
{
b32 Result = True;
for (u32 TestIndex = 0;
TestIndex < SetCount;
++TestIndex)
{
triangle* Test = Set[TestIndex];
if (TrianglesAreEqual(Query, Test))
{
Result = False;
break;
}
}
return Result;
}
untextured_3d_geometry_buffer ReserveBufferSpace(untextured_3d_geometry_buffer* Reservation, u32 ElementsToReserve);
bonsai_function voxel_position*
GetClosestPointRelativeTo(voxel_position* Query, voxel_position* Start, voxel_position* OnePastLastVert, v3 RelativePoint, voxel_position* Skip = 0)
{
voxel_position* Result = 0;
r32 ClosestDistance = f32_MAX;
for ( voxel_position* ClosestCandidate = Start;
ClosestCandidate < OnePastLastVert;
++ClosestCandidate)
{
if (ClosestCandidate == Query) { continue; }
if (ClosestCandidate == Skip) { continue; }
Assert(Result < OnePastLastVert);
r32 DistanceBetween = Distance(Normalize(RelativePoint - V3(*Query)), Normalize(RelativePoint - V3(*ClosestCandidate)));
if (DistanceBetween < ClosestDistance)
{
ClosestDistance = DistanceBetween;
Result = ClosestCandidate;
}
}
return Result;
}
bonsai_function b32
HasUnfilledNeighbors(s32 Index, world_chunk* Chunk, chunk_dimension ChunkDim)
{
TIMED_FUNCTION();
chunk_data *ChunkData = Chunk->Data;
Assert(IsSet(Chunk, Chunk_Initialized) || IsSet(Chunk, Chunk_MeshComplete));
s32 VolumeChunkDim = Volume(ChunkDim);
Assert(Index < VolumeChunkDim);
voxel_position CurrentP = GetPosition(Index, ChunkDim);
voxel_position RightVoxel = CurrentP + Voxel_Position(1, 0, 0);
voxel_position LeftVoxel = CurrentP - Voxel_Position(1, 0, 0);
voxel_position TopVoxel = CurrentP + Voxel_Position(0, 0, 1);
voxel_position BotVoxel = CurrentP - Voxel_Position(0, 0, 1);
voxel_position FrontVoxel = CurrentP + Voxel_Position(0, 1, 0);
voxel_position BackVoxel = CurrentP - Voxel_Position(0, 1, 0);
s32 RightVoxelReadIndex = GetIndexUnsafe(RightVoxel, ChunkDim);
s32 LeftVoxelReadIndex = GetIndexUnsafe(LeftVoxel, ChunkDim);
s32 TopVoxelReadIndex = GetIndexUnsafe(TopVoxel, ChunkDim);
s32 BotVoxelReadIndex = GetIndexUnsafe(BotVoxel, ChunkDim);
s32 FrontVoxelReadIndex = GetIndexUnsafe(FrontVoxel, ChunkDim);
s32 BackVoxelReadIndex = GetIndexUnsafe(BackVoxel, ChunkDim);
b32 Result = False;
if (RightVoxelReadIndex > -1 && RightVoxelReadIndex < VolumeChunkDim)
Result |= NotFilledInChunk( ChunkData, RightVoxelReadIndex);
if (LeftVoxelReadIndex > -1 && LeftVoxelReadIndex < VolumeChunkDim)
Result |= NotFilledInChunk( ChunkData, LeftVoxelReadIndex);
if (BotVoxelReadIndex > -1 && BotVoxelReadIndex < VolumeChunkDim)
Result |= NotFilledInChunk( ChunkData, BotVoxelReadIndex);
if (TopVoxelReadIndex > -1 && TopVoxelReadIndex < VolumeChunkDim)
Result |= NotFilledInChunk( ChunkData, TopVoxelReadIndex);
if (FrontVoxelReadIndex > -1 && FrontVoxelReadIndex < VolumeChunkDim)
Result |= NotFilledInChunk( ChunkData, FrontVoxelReadIndex);
if (BackVoxelReadIndex > -1 && BackVoxelReadIndex < VolumeChunkDim)
Result |= NotFilledInChunk( ChunkData, BackVoxelReadIndex);
return Result;
}
bonsai_function void
GetBoundingVoxelsClippedTo(world_chunk* Chunk, chunk_dimension ChunkDim, boundary_voxels* Dest, aabb Clip)
{
/* TIMED_FUNCTION(); */
v3 MinClip = GetMin(Clip);
v3 MaxClip = GetMax(Clip);
for (s32 z = 0;
z < ChunkDim.z;
++z)
{
for (s32 y = 0;
y < ChunkDim.y;
++y)
{
for (s32 x = 0;
x < ChunkDim.x;
++x)
{
voxel_position P = Voxel_Position(x, y, z);
v3 v3P = V3(P);
if ( v3P.x < MinClip.x || v3P.x > MaxClip.x ||
v3P.y < MinClip.y || v3P.y > MaxClip.y ||
v3P.z < MinClip.z || v3P.z > MaxClip.z )
{
continue;
}
s32 vIndex = GetIndex(P, ChunkDim);
voxel *V = Chunk->Data->Voxels + vIndex;
if (IsSet(V, Voxel_Filled) &&
HasUnfilledNeighbors(vIndex, Chunk, ChunkDim))
{
Assert(Dest->At < Dest->End);
Dest->Points[Dest->At++] = P;
Dest->Min = Min(P, Dest->Min);
Dest->Max = Max(P, Dest->Max);
}
}
}
}
return;
}
struct plane_computation
{
plane Plane;
b32 Complete;
};
// Note(Jesse): Ported from a rust implementation/post at:
// https://www.ilikebigbits.com/2015_03_04_plane_from_points.html
bonsai_function plane_computation
BestFittingPlaneFor(boundary_voxels* BoundingPoints)
{
plane_computation Result = {};
if (BoundingPoints->At >= 3)
{
v3 Sum = V3(0);
for (u32 PointIndex = 0;
PointIndex < BoundingPoints->At;
++PointIndex)
{
Sum += V3(BoundingPoints->Points[PointIndex]);
}
v3 Centroid = Sum * (1.0f / (r32)BoundingPoints->At);
// Calc full 3x3 covariance matrix, excluding symmetries:
r32 XX = 0.0;
r32 XY = 0.0;
r32 XZ = 0.0;
r32 YY = 0.0;
r32 YZ = 0.0;
r32 ZZ = 0.0;
for (u32 PointIndex = 0;
PointIndex < BoundingPoints->At;
++PointIndex)
{
v3 P = V3(BoundingPoints->Points[PointIndex]);
v3 R = P - Centroid;
XX += R.x * R.x;
XY += R.x * R.y;
XZ += R.x * R.z;
YY += R.y * R.y;
YZ += R.y * R.z;
ZZ += R.z * R.z;
}
r32 D_X = YY*ZZ - YZ*YZ;
r32 D_Y = XX*ZZ - XZ*XZ;
r32 D_Z = XX*YY - XY*XY;
r32 D_max = Max( Max(D_X, D_Y), D_Z);
if (D_max <= 0.0f)
{
// Pick path with best conditioning:
v3 Normal = {};
if (D_max == D_X)
{
Normal = V3(D_X, XZ*YZ - XY*ZZ, XY*YZ - XZ*YY);
}
else if (D_max == D_Y)
{
Normal = V3(XZ*YZ - XY*ZZ, D_Y, XY*XZ - YZ*XX);
}
else if (D_max == D_Z)
{
Normal = V3(XY*YZ - XZ*YY, XY*XZ - YZ*XX, D_Z);
}
else
{
InvalidCodePath();
}
Result.Plane = plane(Centroid, Normal);
Result.Complete = True;
}
}
return Result;
}
bonsai_function v3
ComputeNormalSVD(boundary_voxels* BoundingPoints, memory_arena* TempMemory)
{
m_nxn* X = Allocate_3xN_Matrix(BoundingPoints->At, TempMemory);
v3 Centroid = V3(BoundingPoints->Max - BoundingPoints->Min);
for ( u32 PointIndex = 0;
PointIndex < BoundingPoints->At;
++PointIndex)
{
X->Elements[PointIndex] = V3(BoundingPoints->Points[PointIndex]).E[PointIndex%3] - Centroid.E[PointIndex%3];
}
v3 Result = {};
return Result;
}
bonsai_function void
InitializeWorldChunkPerlinPlane(thread_local_state *Thread, world_chunk *DestChunk, chunk_dimension WorldChunkDim, s32 Amplititude, s32 zMin)
{
TIMED_FUNCTION();
#if 0
// Don't blow out the Flags for this chunk or risk assertions on other
// threads that rely on that flag being set for every item on the queue
ZeroChunk(DestChunk->Data, Volume(WorldChunkDim));
#else
for ( s32 VoxelIndex = 0;
VoxelIndex < Volume(WorldChunkDim);
++VoxelIndex)
{
voxel *Voxel = &DestChunk->Data->Voxels[VoxelIndex];
Voxel->Flags = Voxel_Empty;
Voxel->Color = 0;
}
#endif
chunk_dimension SynChunkDim = WorldChunkDim + 2;
chunk_dimension SynChunkP = DestChunk->WorldP - 1;
world_chunk *SyntheticChunk = AllocateWorldChunk(Thread->TempMemory, SynChunkP, SynChunkDim );
u32 SyntheticChunkSum = InitChunkPerlinPlane(Thread->Noise, SyntheticChunk, SynChunkDim, GRASS_GREEN, Amplititude, zMin, WorldChunkDim);
CopyChunkOffset(SyntheticChunk, SynChunkDim, DestChunk, WorldChunkDim, Voxel_Position(1));
SetFlag(DestChunk, Chunk_Initialized);
SetFlag(SyntheticChunk, Chunk_Initialized);
if (SyntheticChunkSum > 0 && SyntheticChunkSum < (u32)Volume(SynChunkDim))
{
Assert(!DestChunk->Mesh);
DestChunk->Mesh = GetMeshForChunk(Thread->MeshFreelist, Thread->PermMemory);
BuildWorldChunkMesh(SyntheticChunk, SynChunkDim, DestChunk, WorldChunkDim, DestChunk->Mesh);
}
if (DestChunk->Mesh && DestChunk->Mesh->At) // Compute 0th LOD
{
u32 SynChunkVolume = (u32)Volume(SynChunkDim);
boundary_voxels* BoundingPoints = AllocateBoundaryVoxels(SynChunkVolume, Thread->TempMemory);
GetBoundingVoxelsClippedTo(SyntheticChunk, SynChunkDim, BoundingPoints, MinMaxAABB( V3(1), V3(SynChunkDim)-V3(2) ) );
chunk_dimension NewSynChunkDim = WorldChunkDim+Voxel_Position(1);
CopyChunkOffset(SyntheticChunk, SynChunkDim, SyntheticChunk, NewSynChunkDim, Voxel_Position(1));
SynChunkDim = NewSynChunkDim;
point_buffer TempBuffer = {};
point_buffer *EdgeBoundaryVoxels = &TempBuffer;
TempBuffer.Min = Voxel_Position(s32_MAX);
TempBuffer.Max = Voxel_Position(s32_MIN);
/* FindEdgeIntersections(EdgeBoundaryVoxels, DestChunk->Data, WorldChunkDim); */
FindEdgeIntersections(EdgeBoundaryVoxels, SyntheticChunk->Data, NewSynChunkDim);
DestChunk->EdgeBoundaryVoxelCount = EdgeBoundaryVoxels->Count;
voxel_position BoundingVoxelMidpoint = EdgeBoundaryVoxels->Min + ((EdgeBoundaryVoxels->Max - EdgeBoundaryVoxels->Min)/2.0f);
// Find closest bounding point to the midpoint of the bounding volume
voxel_position FoundCenterPoint = BoundingVoxelMidpoint;
r32 ShortestLength = f32_MAX;
for ( u32 PointIndex = 0;
PointIndex < BoundingPoints->At;
++PointIndex)
{
voxel_position* TestP = BoundingPoints->Points + PointIndex;
if (DestChunk->DrawBoundingVoxels)
{
DrawVoxel(DestChunk->LodMesh, V3(*TestP), RED, V3(0.25f));
}
r32 TestLength = Length(V3(*TestP) - BoundingVoxelMidpoint);
if (TestLength < ShortestLength)
{
ShortestLength = TestLength;
FoundCenterPoint = *TestP;
}
}
#if 1
v3 Normal = ComputeNormalSVD(BoundingPoints, Thread->TempMemory);
#else
v3 Normal = {};
for ( s32 VoxelIndex = 0;
VoxelIndex < Volume(WorldChunkDim);
++VoxelIndex)
{
voxel *Voxel = &DestChunk->Data->Voxels[VoxelIndex];
if (Voxel->Flags != Voxel_Empty)
{
voxel_position TestP = GetPosition(VoxelIndex, WorldChunkDim);
v3 CenterRelativeTestP = V3(BoundingVoxelMidpoint) - V3(TestP);
Normal += Normalize(CenterRelativeTestP);
}
}
Normal = Normalize(Normal);
#endif
DEBUG_DrawLine( DestChunk->LodMesh, V3(FoundCenterPoint), V3(FoundCenterPoint)+(Normal*10.0f), RED, 0.2f);
#if 1
{
u32 Color = 0;
for ( s32 PointIndex = 0;
PointIndex < EdgeBoundaryVoxels->Count;
++PointIndex )
{
DrawVoxel( DestChunk->LodMesh, V3(EdgeBoundaryVoxels->Points[PointIndex]), Color++, V3(0.6f));
}
}
/* ClipAndDisplaceToMinDim(DestChunk->LodMesh, V3(0), V3(WorldChunkDim) ); */
#endif
if (EdgeBoundaryVoxels->Count)
{
/* DEBUG_DrawAABB(DestChunk->LodMesh, V3(0), V3(WorldChunkDim), PINK); */
DrawVoxel(DestChunk->LodMesh, V3(FoundCenterPoint), PINK, V3(0.35f));
#if 1
const u32 MaxTriangles = 128;
u32 TriangleCount = 0;
triangle* Triangles[MaxTriangles];
if (EdgeBoundaryVoxels->Count)
{
voxel_position* CurrentVert = EdgeBoundaryVoxels->Points;
voxel_position* OnePastLastVert = EdgeBoundaryVoxels->Points + EdgeBoundaryVoxels->Count;
voxel_position FirstVert = *CurrentVert;
s32 RemainingVerts = EdgeBoundaryVoxels->Count;
untextured_3d_geometry_buffer CurrentVoxelBuffer = ReserveBufferSpace(DestChunk->LodMesh, VERTS_PER_VOXEL);
untextured_3d_geometry_buffer ClosestVoxelBuffer = ReserveBufferSpace(DestChunk->LodMesh, VERTS_PER_VOXEL);
untextured_3d_geometry_buffer SecondClosestVoxelBuffer = ReserveBufferSpace(DestChunk->LodMesh, VERTS_PER_VOXEL);
untextured_3d_geometry_buffer FirstNormalBuffer = ReserveBufferSpace(DestChunk->LodMesh, VERTS_PER_LINE);
while (RemainingVerts > DestChunk->PointsToLeaveRemaining)
{
Assert(CurrentVert < OnePastLastVert);
voxel_position* LowestAngleBetween = GetClosestCoplanarPointRelativeTo(CurrentVert, EdgeBoundaryVoxels->Points, OnePastLastVert, V3(FoundCenterPoint), WorldChunkDim);
Assert(CurrentVert < OnePastLastVert);
v3 FirstNormal = {};
if (LowestAngleBetween)
{
SecondClosestVoxelBuffer.At = 0;
DrawVoxel( &SecondClosestVoxelBuffer, V3(*LowestAngleBetween), WHITE, V3(0.0f));
FirstNormal = Normalize(Cross( V3(FoundCenterPoint)-V3(*CurrentVert), V3(FoundCenterPoint)-V3(*LowestAngleBetween) ));
}
FirstNormalBuffer.At = 0;
DEBUG_DrawLine( &FirstNormalBuffer, V3(FoundCenterPoint), V3(FoundCenterPoint)+(FirstNormal*10.0f), BLUE, 0.2f);
if ( LowestAngleBetween && Dot(FirstNormal, Normal) < 0.0f )
{
TriggeredRuntimeBreak();
SecondClosestVoxelBuffer.At = 0;
DrawVoxel( &SecondClosestVoxelBuffer, V3(*LowestAngleBetween)+V3(0.2f), BLUE, V3(0.7f));
voxel_position* SecondLowestAngleBetween = GetClosestCoplanarPointRelativeTo(CurrentVert, EdgeBoundaryVoxels->Points, OnePastLastVert, V3(FoundCenterPoint), WorldChunkDim, LowestAngleBetween);
if (SecondLowestAngleBetween)
{
v3 SecondNormal = Cross( V3(FoundCenterPoint)-V3(*CurrentVert), V3(FoundCenterPoint)-V3(*SecondLowestAngleBetween) );
if ( Dot(SecondNormal, Normal) < 0.0f )
{
Error("Found two negative normals, shit!");
}
else
{
LowestAngleBetween = SecondLowestAngleBetween;
}
}
}
Assert(LowestAngleBetween < OnePastLastVert);
Assert(CurrentVert < OnePastLastVert);
if (LowestAngleBetween)
{
CurrentVoxelBuffer.At = 0;
ClosestVoxelBuffer.At = 0;
DrawVoxel( &ClosestVoxelBuffer, V3(*LowestAngleBetween)+V3(0.1f), GREEN, V3(0.7f));
DrawVoxel( &CurrentVoxelBuffer, V3(*CurrentVert)-V3(0.1f), RED, V3(0.7f));
if (!VertsAreColnear(&FoundCenterPoint, CurrentVert, LowestAngleBetween))
{
triangle* TestTriangle = Triangle(&FoundCenterPoint, CurrentVert, LowestAngleBetween, Thread->TempMemory);
if (!TriangleIsUniqueInSet(TestTriangle, Triangles, TriangleCount) )
{
DEBUG_DrawAABB(DestChunk->LodMesh, V3(0), V3(WorldChunkDim), RED, 0.5f);
}
Assert(TriangleCount < MaxTriangles);
Triangles[TriangleCount++] = TestTriangle;
}
voxel_position *LastVert = OnePastLastVert-1;
*CurrentVert = *LastVert;
if (LowestAngleBetween != LastVert)
{
CurrentVert = LowestAngleBetween;
}
Assert(LowestAngleBetween < OnePastLastVert);
Assert(CurrentVert < OnePastLastVert);
}
else
{
voxel_position *LastVert = OnePastLastVert-1;
if (*LastVert != FirstVert && !VertsAreColnear(&FoundCenterPoint, &FirstVert, LastVert))
{
triangle* TestTriangle = Triangle(&FoundCenterPoint, &FirstVert, LastVert, Thread->TempMemory);
/* Assert( TriangleIsUniqueInSet(TestTriangle, Triangles, TriangleCount) ); */
Assert(TriangleCount < MaxTriangles);
Triangles[TriangleCount++] = TestTriangle;
}
}
Assert(LowestAngleBetween < OnePastLastVert);
Assert(CurrentVert < OnePastLastVert);
OnePastLastVert--;
RemainingVerts--;
}
}
u32 Color = 0;
for (u32 TriIndex = 0;
TriIndex < TriangleCount;
++TriIndex)
{
BufferTriangle(DestChunk->LodMesh, Triangles[TriIndex], V3(0,0,1), Color++);
}
DestChunk->TriCount = TriangleCount;
/* Print(TriangleCount); */
#endif
#if 0
// Draw
if (EdgeBoundaryVoxels->Count)
{
v3 Verts[3] = {};
Verts[0] = FoundCenterPoint;
s32 Color = 42;
s32 VertIndex = 0;
while ( (VertIndex+1) < EdgeBoundaryVoxels->Count )
{
Verts[1] = V3(EdgeBoundaryVoxels->Points[VertIndex]);
Verts[2] = V3(EdgeBoundaryVoxels->Points[VertIndex + 1]);
BufferTriangle(DestChunk->LodMesh, Verts, V3(0,0,1), Color);
++VertIndex;
Color += 10;
}
Verts[1] = V3(EdgeBoundaryVoxels->Points[VertIndex]);
Verts[2] = V3(EdgeBoundaryVoxels->Points[0]);
BufferTriangle(DestChunk->LodMesh, Verts, V3(0,0,1), Color);
}
#endif
}
}
DestChunk->LodMesh_Complete = True;
DestChunk->Data->Flags = Chunk_MeshComplete;
return;
}
bonsai_function chunk_dimension
ChunkDimension(world_chunk* Chunk)
{
chunk_dimension Result = {};
if (Chunk)
{
Result.x = Chunk->DimX;
Result.y = Chunk->DimY;
Result.z = Chunk->DimZ;
}
return Result;
}
bonsai_function void
InitializeWorldChunkEmpty(world_chunk *DestChunk)
{
TIMED_FUNCTION();
Assert( IsSet(DestChunk, Chunk_Queued) );
if (IsSet(DestChunk, Chunk_Garbage))
{
DestChunk->Data->Flags = Chunk_Collected;
return;
}
#if 0
// Don't blow out the Flags for this chunk or risk assertions on other
// threads that rely on that flag being set for every item on the queue
ZeroChunk(DestChunk->Data, Volume(WorldChunkDim));
#else
for ( s32 VoxelIndex = 0;
VoxelIndex < Volume(ChunkDimension(DestChunk));
++VoxelIndex)
{
voxel *Voxel = &DestChunk->Data->Voxels[VoxelIndex];
Voxel->Flags = Voxel_Empty;
Voxel->Color = 0;
}
#endif
DestChunk->Data->Flags = Chunk_MeshComplete;
return;
}
inline void
QueueChunkMeshForCopy(work_queue *Queue, untextured_3d_geometry_buffer* Src, untextured_3d_geometry_buffer* Dest, world_chunk *Chunk, camera* Camera, chunk_dimension WorldChunkDim)
{
untextured_3d_geometry_buffer CopyDest = ReserveBufferSpace(Dest, Src->At);
work_queue_entry Entry = {
.Type = type_work_queue_entry_copy_buffer,
.work_queue_entry_copy_buffer.Src = Src,
.work_queue_entry_copy_buffer.Dest = CopyDest,
.work_queue_entry_copy_buffer.Basis = GetRenderP(WorldChunkDim, Chunk->WorldP, Camera),
};
Assert(CopyDest.At == 0);
Assert(CopyDest.End == Src->At);
PushWorkQueueEntry(Queue, &Entry);
return;
}
| 29.650183 | 204 | 0.655033 | [
"mesh"
] |
d7742cc2aa16b8dcc1e453d8ebcd80363a1bf8be | 12,126 | hpp | C++ | src/lattice.hpp | qftphys/Tight-Binding-Modeling-for-Materials-at-Mesoscale | b57237f87eec1e9beba8d1cfa13b3ebf4589e3be | [
"BSD-4-Clause"
] | 13 | 2017-01-04T17:54:51.000Z | 2022-01-26T12:49:37.000Z | src/lattice.hpp | qftphys/Tight-Binding-Modeling-for-Materials-at-Mesoscale | b57237f87eec1e9beba8d1cfa13b3ebf4589e3be | [
"BSD-4-Clause"
] | null | null | null | src/lattice.hpp | qftphys/Tight-Binding-Modeling-for-Materials-at-Mesoscale | b57237f87eec1e9beba8d1cfa13b3ebf4589e3be | [
"BSD-4-Clause"
] | 10 | 2017-07-23T15:37:33.000Z | 2019-11-29T14:41:52.000Z | /*-----------------------------------------------------------|
| Copyright (C) 2016 Yuan-Yen Tai, Hongchul Choi, |
| Jian-Xin Zhu |
| |
| This file is distributed under the terms of the BSD |
| Berkeley Software Distribution. See the file `LICENSE' in |
| the root directory of the present distribution. |
| |
|-----------------------------------------------------------*/
//
// lattice.hpp
// TBM^3
//
// Created by Yuan-Yen Tai on 7/19/16.
//
// Declare the RTree object.
namespace bg = boost::geometry;
namespace bgi = boost::geometry::index;
typedef bg::model::point<r_var, 3, bg::cs::cartesian> point;
typedef point bondVec;
typedef std::pair<point, unsigned> value;
typedef bg::model::box<point> box;
//----------------------
class Lattice{
unsigned index_size;
public:
Lattice(){ }
Lattice(string _filename):atomIndex(-1), filename(_filename){
open(filename);
}
//Lattice(string _filename, string spin, string space):atomIndex(-1), filename(_filename){
// open(filename);
// parameter.STR("spin") = spin;
// parameter.STR("space") = space;
//}
~Lattice(){
rtree.clear();
atomList.clear();
extendedAtomList.clear();
}
// Read from xxx.lat
BasisVector basisVector;
OrbitalProfile orbitalProfile;
AtomStringParser atomParser;
Parameter parameter;
BondVector bondVector;
void open(string _filename) {
basisVector.clear();
orbitalProfile.clear();
atomParser.clear();
parameter.clear();
extendedAtomList.clear();
rtree.clear();
string line;
string header = "";
string flag = "";
string sub_flag = "";
ifstream infile(_filename);
if ( infile.is_open() ) {
while ( getline(infile, line) ) {
deleteComment(line); // Clean the commented words
istringstream iss(line);
sub_flag = "0";
iss >> header;
if ( header == basisVector()) {flag = header; continue;}
if ( header == orbitalProfile()) {flag = header; continue;}
if ( header == atomParser()) {flag = header; continue;}
if ( flag == basisVector()) { basisVector.append(line); continue; }
if ( flag == orbitalProfile()) { orbitalProfile.append(line); continue; }
if ( flag == atomParser()) { atomParser.append(line); continue; }
}
}
infile.close();
}
size_t latticeSize() { return atomList.size(); }
size_t indexSize() { return index_size; }
Atom getAtom() {
if( !(atomIndex >= 0 and atomIndex < atomList.size()) ){
string ErrorMsg = "Error, index out of range.";
ErrorMessage(ErrorMsg);
}
return atomList[atomIndex];
}
pair<bool,Atom> getAtom(r_mat pos) {
point p = point(pos[0], pos[1], pos[2]);
vector<value> result_s;
rtree.query(bgi::nearest(p, 1), std::back_inserter(result_s));
unsigned exIndex = result_s[0].second;
Atom atom = extendedAtomList[exIndex];
r_mat pos_diff(1,3);
for(unsigned i=0 ; i<pos_diff.size() ; i++)
pos_diff[i] = pos[i] - atom.pos[i];
if( sqrt(cdot(pos_diff, pos_diff)) > 0.01 ) {
return make_pair(false, atom);
}
return make_pair(true, atom);
}
Atom getAtom(unsigned index) {
if( index >= atomList.size() ){
string ErrorMsg = "Error, index out of range.";
ErrorMessage(ErrorMsg);
}
return atomList[index];
}
AtomPair getPair(r_mat bond) {
Atom atomI = getAtom();
r_mat posJ(1,3);
for(unsigned i=0 ; i<posJ.size() ; i++)
posJ[i] = atomI.pos[i] + bond[i];
point p = point(posJ[0], posJ[1], posJ[2]);
vector<value> result_s;
rtree.query(bgi::nearest(p, 1), std::back_inserter(result_s));
unsigned exIndex = result_s[0].second;
Atom atomJ = extendedAtomList[exIndex];
return AtomPair(atomI, atomJ, bond);
}
AtomPair getPair(string bondStr) {
return getPair(vec(bondStr));
}
AtomPair getPair(unsigned index, r_mat bond) {
Atom atomI = getAtom(index);
r_mat posJ(1,3);
for(unsigned i=0 ; i<posJ.size() ; i++)
posJ[i] = atomI.pos[i] + bond[i];
point p = point(posJ[0], posJ[1], posJ[2]);
vector<value> result_s;
rtree.query(bgi::nearest(p, 1), std::back_inserter(result_s));
unsigned exIndex = result_s[0].second;
Atom atomJ = extendedAtomList[exIndex];
return AtomPair(atomI, atomJ, bond);
}
AtomPair getPair(unsigned index, string bondStr) {
return getPair(index, vec(bondStr));
}
pair<Atom, vector<Atom> > getBox(unsigned index) {
Atom atomI = getAtom(index);
r_mat pos = atomI.pos;
vector<value> result_s;
r_var radius = abs(parameter.VAR("bondRadius", 1).real());
box query_box(point(pos[0] - radius, pos[1] - radius, pos[2] - radius),
point(pos[0] + radius, pos[1] + radius, pos[2] + radius));
rtree.query(bgi::intersects(query_box), std::back_inserter(result_s));
vector<Atom> atomJList;
for(unsigned i=0 ; i<result_s.size(); i++){
auto indexJ = result_s[i].second;
Atom atomJ = extendedAtomList[indexJ];
r_mat distanceIJ(1,3);
for(unsigned i=0 ; i<distanceIJ.size() ; i++)
distanceIJ[i] = atomJ.pos[i] - atomI.pos[i];
if( sqrt(cdot(distanceIJ, distanceIJ))<= radius )
atomJList.push_back(atomJ);
}
return make_pair(atomI, atomJList);
}
pair<Atom, vector<Atom> > getRBox(double radius = -1) {
Atom atomI = getAtom();
r_mat pos = atomI.pos;
vector<value> result_s;
if( radius < 0){
radius = abs(parameter.VAR("bondRadius", 1).real());
}
box query_box(point(pos[0] - radius, pos[1] - radius, pos[2] - radius),
point(pos[0] + radius, pos[1] + radius, pos[2] + radius));
rtree.query(bgi::intersects(query_box), std::back_inserter(result_s));
vector<Atom> atomJList;
for(unsigned i=0 ; i<result_s.size(); i++){
auto indexJ = result_s[i].second;
Atom atomJ = extendedAtomList[indexJ];
r_mat distanceIJ(1,3);
for(unsigned i=0 ; i<distanceIJ.size() ; i++)
distanceIJ[i] = atomJ.pos[i] - atomI.pos[i];
if( sqrt(cdot(distanceIJ, distanceIJ))<= radius )
atomJList.push_back(atomJ);
}
return make_pair(atomI, atomJList);
}
vector<Atom> getAtomList() { return atomList; }
r_mat vec(string line) {
// line = "+1+0+1" -> use Cartesian coordinate
// line = "+1+0+1#" -> use BondVector 0
// line = "+1+0+1#0" -> use BondVector 0
// line = "+1+0+1#1" -> use BondVector 1
// line = "+1+0+1#2" -> use BondVector 2
r_mat retVec(1,3);
auto lineParser = split(line, "#");
int CoordinateSelect = -1;
int countSharpSimbol = WordCount("#", line);
if( countSharpSimbol == 1){
if( lineParser.size() == 2)
CoordinateSelect = StrToInt(lineParser[1]);
else if(lineParser.size() == 1){
CoordinateSelect = 0;
}
}
auto vecParser = splitByIntNumber(lineParser[0]);
if( vecParser.size() == 6){
if( CoordinateSelect == -1){ // Cartesian coordinate
retVec[0] = PMStr(vecParser[0])*StrToDouble(vecParser[1]);
retVec[1] = PMStr(vecParser[2])*StrToDouble(vecParser[3]);
retVec[2] = PMStr(vecParser[4])*StrToDouble(vecParser[5]);
}
else{
auto bvec = bondVector.getBond(CoordinateSelect);
double n0 = PMStr(vecParser[0]) * StrToDouble(vecParser[1]);
double n1 = PMStr(vecParser[2]) * StrToDouble(vecParser[3]);
double n2 = PMStr(vecParser[4]) * StrToDouble(vecParser[5]);
for( unsigned i=0 ; i<retVec.size() ; i++){
retVec[i] = n0 * bvec[0][i] +
n1 * bvec[1][i] +
n2 * bvec[2][i] ;
}
}
}
return retVec;
}
H_SPACE HSpace() {return h_space;}
string FileName() {return filename;}
bool iterate() {
atomIndex++;
if( atomIndex == latticeSize()) {
atomIndex = -1;
return false;
}
return true;
}
void shiftXYZ(double X, double Y, double Z) {
r_mat shiftPos(1,3);
shiftPos[0] = X;
shiftPos[1] = Y;
shiftPos[2] = Z;
for( auto & atom: atomList ){
atom.pos = atom.pos + shiftPos;
}
}
void changeAtomName(vector<string> optList) {
if( optList.size() != 2 ){
ErrorMessage("Error, the arguments for '-changeAtom' are not correct.");
return;
}
cout<<"Change inside the box: " << optList[0] <<endl;
cout<<"Property will be changed: " << optList[1] <<endl;
auto parser0 = split(optList[0], ":");
auto isBox = makeBoxFromStr(parser0[0], parser0[1]);
auto parser1 = split(optList[1], "=");
if( parser1.size() != 2 ){
ErrorMessage("Error, the arguments for '-changeAtom' are not correct.");
return;
}
unsigned atomProfile_old = abs( StrToInt( parser1[0] ) );
unsigned atomProfile_new = abs( StrToInt( parser1[1] ) );
if(!(orbitalProfile.isValidAtomIndex(atomProfile_old-1) and
orbitalProfile.isValidAtomIndex(atomProfile_new-1))){
ErrorMessage("Error, one of the selection atom index is not valid.");
return;
}
if( isBox.first ){
auto & vbox = isBox.second;
cout<<" List of changed profile "<<endl;
atomParser.changeProperty(vbox, atomProfile_old, atomProfile_new);
createAtomList("off", "normal");
}
}
void createAtomList(string spin = "on", string space = "normal", bool needExpandedAtomList = true) {
atomList.clear();
Atom::totalIndexSize = 0;
index_size = 0;
auto spinDegree = spin;
auto hSpace = space;
if ( hSpace == "normal") { h_space = NORMAL;}
else if ( hSpace == "nambu") { h_space = NAMBU;}
else if ( hSpace == "exnambu") { h_space = EXNAMBU;}
auto atomInfoList = atomParser.atomInfoList;
auto orbitalList = orbitalProfile.getOrbitalList();
// -----------------------------------------------------------------------
// Generate the index of each atom.
// -----------------------------------------------------------------------
for( unsigned i=0 ; i<atomInfoList.size() ; i++){
int orbitalLabelIndex = atomInfoList[i].first - 1; // The info list starting with 1 (not 0).
r_mat atomPos = atomInfoList[i].second;
if (orbitalLabelIndex >= 0){
auto orbitalLabel = orbitalList[orbitalLabelIndex];
Atom tmpAtom;
tmpAtom.orbitalOriginIndex = orbitalLabelIndex + 1;
tmpAtom.atomIndex = i;
tmpAtom.pos = atomPos;
tmpAtom.createOrbitalContent(orbitalLabel, spinDegree, h_space);
atomList.push_back(tmpAtom);
}
}
index_size = Atom::totalIndexSize;
if( needExpandedAtomList ){
updateExpandedAtomList();
}
}
private:
void updateExpandedAtomList() {
extendedAtomList.clear();
// -----------------------------------------------------------------------
// Create the extendedAtomList from the atomList by a given bondRadius.
// -----------------------------------------------------------------------
auto bondRadius = parameter.VAR("bondRadius", 1);
r_var N = basisVector.minRepeatForRadius(bondRadius.real());
auto AVec = basisVector.getAVec();
if ( AVec.size() == 3){
for( r_var i = -N ; i<=N ; i+=1)
for( r_var j = -N ; j<=N ; j+=1)
for( r_var k = -N ; k<=N ; k+=1){
for(unsigned index=0 ; index<atomList.size() ; index++){
Atom tmpAtom;
tmpAtom = atomList[index];
r_mat A0 = i*AVec[0];
r_mat A1 = j*AVec[1];
r_mat A2 = k*AVec[2];
tmpAtom.pos = tmpAtom.pos+A0+A1+A2;
extendedAtomList.push_back(tmpAtom);
}
}
}
else{
ErrorMessage("Error, should be given a 3D basis vector.");
}
// -----------------------------------------------------------------------
// Create the rtree for atom position search.
// -----------------------------------------------------------------------
rtree.clear();
for( unsigned exIndex=0 ; exIndex<extendedAtomList.size() ; exIndex++){
auto pos = extendedAtomList[exIndex].pos;
point p = point( pos[0], pos[1], pos[2]);
rtree.insert(std::make_pair(p, exIndex));
}
}
bgi::rtree< value, bgi::quadratic<16> > rtree;
int atomIndex;
vector<Atom> atomList;
vector<Atom> extendedAtomList;
string filename;
H_SPACE h_space;
};
| 27.748284 | 107 | 0.588982 | [
"geometry",
"object",
"vector",
"model",
"3d"
] |
d7769310081e4b04c17461bbcffc5333e8e5b95c | 1,231 | cpp | C++ | src/ftxui/dom/spinner_test.cpp | vnepogodin/FTXUI | 67e2d87f313205650e0fa978078e79aecf7a150c | [
"MIT"
] | null | null | null | src/ftxui/dom/spinner_test.cpp | vnepogodin/FTXUI | 67e2d87f313205650e0fa978078e79aecf7a150c | [
"MIT"
] | null | null | null | src/ftxui/dom/spinner_test.cpp | vnepogodin/FTXUI | 67e2d87f313205650e0fa978078e79aecf7a150c | [
"MIT"
] | null | null | null | #include <gtest/gtest-message.h> // for Message
#include <gtest/gtest-test-part.h> // for SuiteApiResolver, TestFactoryImpl, TestPartResult
#include <string> // for allocator
#include "ftxui/dom/elements.hpp" // for spinner
#include "ftxui/dom/node.hpp" // for Render
#include "ftxui/screen/screen.hpp" // for Screen
#include "gtest/gtest_pred_impl.h" // for Test, EXPECT_EQ, TEST
namespace ftxui {
TEST(SpinnerTest, Spinner1) {
auto element = spinner(1, 0);
Screen screen(4, 1);
Render(screen, element);
EXPECT_EQ(screen.ToString(), ". ");
}
TEST(SpinnerTest, Spinner2) {
auto element = spinner(1, 1);
Screen screen(4, 1);
Render(screen, element);
EXPECT_EQ(screen.ToString(), ".. ");
}
TEST(SpinnerTest, Spinner3) {
auto element = spinner(1, 2);
Screen screen(4, 1);
Render(screen, element);
EXPECT_EQ(screen.ToString(), "... ");
}
TEST(SpinnerTest, Spinner4) {
auto element = spinner(1, 3);
Screen screen(4, 1);
Render(screen, element);
EXPECT_EQ(screen.ToString(), ". ");
}
} // namespace ftxui
// Copyright 2022 Arthur Sonzogni. All rights reserved.
// Use of this source code is governed by the MIT license that can be found in
// the LICENSE file.
| 27.355556 | 92 | 0.671812 | [
"render"
] |
d77b4ebcf92a95e1b03643f5546ce220bce23a22 | 10,251 | h++ | C++ | include/nonius/main.h++ | podgorskiy/nonius | 3ce09960893083edf6c32311984d9697094a7eda | [
"CC0-1.0"
] | 1 | 2020-10-11T13:39:09.000Z | 2020-10-11T13:39:09.000Z | include/nonius/main.h++ | podgorskiy/nonius | 3ce09960893083edf6c32311984d9697094a7eda | [
"CC0-1.0"
] | null | null | null | include/nonius/main.h++ | podgorskiy/nonius | 3ce09960893083edf6c32311984d9697094a7eda | [
"CC0-1.0"
] | null | null | null | // Nonius - C++ benchmarking tool
//
// Written in 2014- by the nonius contributors <nonius@rmf.io>
//
// To the extent possible under law, the author(s) have dedicated all copyright and related
// and neighboring rights to this software to the public domain worldwide. This software is
// distributed without any warranty.
//
// You should have received a copy of the CC0 Public Domain Dedication along with this software.
// If not, see <http://creativecommons.org/publicdomain/zero/1.0/>
// Executable building kit
#ifndef NONIUS_MAIN_HPP
#define NONIUS_MAIN_HPP
#include <nonius/nonius.h++>
#include <nonius/detail/argparse.h++>
#include <nonius/detail/string_utils.h++>
#include <vector>
#include <string>
#include <stdexcept>
#include <exception>
#include <iostream>
#include <iomanip>
#include <utility>
namespace nonius {
namespace detail {
template <typename T>
struct parser;
template <>
struct parser<int> {
static int parse(std::string const& s) { return std::stoi(s); }
};
template <>
struct parser<double> {
static double parse(std::string const& s) { return std::stod(s); }
};
template <>
struct parser<std::string> {
static std::string parse(std::string const& s) { return s; }
};
template <>
struct parser<bool> {
static bool parse(std::string const&) { return true; }
};
template <>
struct parser<param_configuration> {
static param_configuration parse(std::string const& param) {
auto v = std::vector<std::string>{};
split(v, param, is_any_of(":"));
try {
if (v.size() > 0) {
auto name = v[0];
auto def = global_param_registry().defaults().at(name);
if (v.size() == 2)
return {{{name, def.parse(v[1])}}, {}};
else if (v.size() == 5) {
auto oper = v[1];
auto init = def.parse(v[2]);
auto step = def.parse(v[3]);
std::stringstream ss(v[4]);
auto count = size_t();
ss >> count;
ss.exceptions(std::ios::failbit);
return {{}, run_configuration{name, oper, init, step, count}};
}
}
}
catch (std::out_of_range const&) {}
return {};
}
};
struct assign_fn {
template <typename T, typename U>
void operator() (T& dest, U&& src) const { dest = std::forward<U>(src); }
};
template <typename T, typename Predicate, typename Assignment=assign_fn>
void parse(T& variable, detail::arguments& args, std::string const& option, Predicate&& is_valid, Assignment&& assign={}) {
auto rng = args.equal_range(option);
for (auto it = rng.first; it != rng.second; ++it) {
if(it != args.end()) {
auto value = parser<T>::parse(it->second);
if(is_valid(value)) {
std::forward<Assignment>(assign) (variable, std::move(value));
} else {
throw argument_error{"Tried to parse invalid value"};
}
}
}
}
template <typename T>
void parse(T& variable, detail::arguments& args, std::string const& option) {
return parse(variable, args, option, [](T const&) { return true; });
}
inline detail::option_set const& command_line_options() {
static detail::option_set the_options {
detail::option("help", "h", "show this help message"),
detail::option("samples", "s", "number of samples to collect (default: 100)", "SAMPLES"),
detail::option("resamples", "rs", "number of resamples for the bootstrap (default: 100000)", "RESAMPLES"),
detail::option("confidence-interval", "ci", "confidence interval for the bootstrap (between 0 and 1, default: 0.95)", "INTERVAL"),
detail::option("param", "p", "set a benchmark parameter", "PARAM"),
detail::option("output", "o", "output file (default: <stdout>)", "FILE"),
detail::option("reporter", "r", "reporter to use (default: standard)", "REPORTER"),
detail::option("title", "t", "set report title", "TITLE"),
detail::option("no-analysis", "A", "perform only measurements; do not perform any analysis"),
detail::option("filter", "f", "only run benchmarks whose name matches the regular expression pattern", "PATTERN"),
detail::option("list", "l", "list benchmarks"),
detail::option("list-params", "lp", "list available parameters"),
detail::option("list-reporters", "lr", "list available reporters"),
detail::option("verbose", "v", "show verbose output (mutually exclusive with -q)"),
detail::option("summary", "q", "show summary output (mutually exclusive with -v)")
};
return the_options;
}
template <typename Iterator>
configuration parse_args(std::string const& name, Iterator first, Iterator last) {
try {
auto args = detail::parse_arguments(command_line_options(), first, last);
configuration cfg;
auto is_positive = [](int x) { return x > 0; };
auto is_ci = [](double x) { return x > 0 && x < 1; };
auto is_reporter = [](std::string const x) { return global_reporter_registry().count(x) > 0; };
auto is_param = [](param_configuration const& x) {
return !x.map.empty() || x.run;
};
auto merge_params = [](param_configuration& x, param_configuration&& y) {
x.map = std::move(x.map).merged(std::move(y.map));
if (y.run) x.run = y.run;
};
parse(cfg.help, args, "help");
parse(cfg.samples, args, "samples", is_positive);
parse(cfg.resamples, args, "resamples", is_positive);
parse(cfg.confidence_interval, args, "confidence-interval", is_ci);
parse(cfg.params, args, "param", is_param, merge_params);
parse(cfg.output_file, args, "output");
parse(cfg.reporter, args, "reporter", is_reporter);
parse(cfg.no_analysis, args, "no-analysis");
parse(cfg.filter_pattern, args, "filter");
parse(cfg.list_benchmarks, args, "list");
parse(cfg.list_params, args, "list-params");
parse(cfg.list_reporters, args, "list-reporters");
parse(cfg.verbose, args, "verbose");
parse(cfg.summary, args, "summary");
parse(cfg.title, args, "title");
if(cfg.verbose && cfg.summary)
throw argument_error{"Verbose and summary output are mutually exclusive"};
return cfg;
} catch(...) {
std::cout << help_text(name, command_line_options());
throw argument_error{"Unexpected catch in argument parsing"};
}
}
} // namespace detail
inline int print_help(std::string const& name) {
std::cout << detail::help_text(name, detail::command_line_options());
return 0;
}
inline int list_benchmarks() {
std::cout << "All available benchmarks:\n";
for(auto&& b : global_benchmark_registry()) {
std::cout << " " << b.name << "\n";
}
std::cout << global_benchmark_registry().size() << " benchmarks\n\n";
return 0;
}
inline int list_params() {
std::cout << "Available parameters (= default):\n"
<< global_param_registry().defaults();
return 0;
}
inline int list_reporters() {
using reporter_entry_ref = decltype(*global_reporter_registry().begin());
auto cmp = [](reporter_entry_ref a, reporter_entry_ref b) { return a.first.size() < b.first.size(); };
auto width = 2 + std::max_element(global_reporter_registry().begin(), global_reporter_registry().end(), cmp)->first.size();
std::cout << "Available reporters:\n";
std::cout << std::left;
for(auto&& r : global_reporter_registry()) {
if(!r.first.empty()) {
std::cout << " " << std::setw(width) << r.first << r.second->description() << "\n";
}
}
std::cout << '\n';
return 0;
}
inline int run_it(configuration cfg) {
try {
nonius::go(cfg);
} catch(...) {
std::cerr << "PANIC: clock is on fire\n";
try {
throw;
} catch(std::exception const& e) {
std::cerr << " " << e.what() << "\n";
} catch(...) {}
return 23;
}
return 0;
}
template <typename Iterator>
int main(std::string const& name, Iterator first, Iterator last) {
configuration cfg;
try {
cfg = detail::parse_args(name, first, last);
} catch(detail::argument_error const&) {
return 17;
}
if(cfg.help) return print_help(name);
else if(cfg.list_benchmarks) return list_benchmarks();
else if(cfg.list_params) return list_params();
else if(cfg.list_reporters) return list_reporters();
else return run_it(cfg);
}
inline int main(int argc, char** argv) {
std::string name(argv[0]);
std::vector<std::string> args(argv+1, argv+argc);
return main(name, args.begin(), args.end());
}
}
#ifdef NONIUS_RUNNER
int main(int argc, char** argv) {
return nonius::main(argc, argv);
}
#endif // NONIUS_RUNNER
#endif // NONIUS_MAIN_HPP
| 42.53527 | 146 | 0.531851 | [
"vector"
] |
d77bdd5b5076721730adffcdde8f58acecc37cf5 | 8,033 | cpp | C++ | MSCL/source/mscl/MicroStrain/MIP/Packets/MipDataPacket.cpp | contagon/MSCL | dc9029e7b7f83dc0eed5035ebb653102b0237060 | [
"BSL-1.0",
"OpenSSL",
"MIT"
] | null | null | null | MSCL/source/mscl/MicroStrain/MIP/Packets/MipDataPacket.cpp | contagon/MSCL | dc9029e7b7f83dc0eed5035ebb653102b0237060 | [
"BSL-1.0",
"OpenSSL",
"MIT"
] | null | null | null | MSCL/source/mscl/MicroStrain/MIP/Packets/MipDataPacket.cpp | contagon/MSCL | dc9029e7b7f83dc0eed5035ebb653102b0237060 | [
"BSL-1.0",
"OpenSSL",
"MIT"
] | null | null | null | /*******************************************************************************
Copyright(c) 2015-2020 Parker Hannifin Corp. All rights reserved.
MIT Licensed. See the included LICENSE.txt for a copy of the full MIT License.
*******************************************************************************/
#include "stdafx.h"
#include "MipDataPacket.h"
#include "mscl/Utils.h"
#include "MipFieldParser.h"
#include "mscl/MicroStrain/DataBuffer.h"
namespace mscl
{
MipDataPacket::MipDataPacket():
m_collectedTime(0),
m_deviceTime(0),
m_hasDeviceTime(false),
m_deviceTimeValid(false),
m_deviceTimeFlags(0)
{
}
MipDataPacket::MipDataPacket(const MipPacket& packet):
m_collectedTime(Timestamp::timeNow()),
m_deviceTime(0),
m_hasDeviceTime(false),
m_deviceTimeValid(false),
m_deviceTimeFlags(0)
{
//construct the data packet from the MipPacket passed in
m_descriptorSet = packet.descriptorSet();
m_payload = Payload(packet.payload());
//parse the data fields in the packet
parseDataFields();
}
void MipDataPacket::parseDataFields()
{
uint8 fieldDescriptor;
uint16 fieldType;
uint32 fieldLen;
//create a DataBuffer to make parsing easier
DataBuffer payloadData(m_payload.data());
while(payloadData.moreToRead())
{
try
{
Bytes fieldBytes;
//read the field length byte
fieldLen = payloadData.read_uint8();
//read the field descriptor byte
fieldDescriptor = payloadData.read_uint8();
//read all the bytes for the current field (up to the field length)
for(uint32 itr = 0; itr < fieldLen - 2; itr++)
{
//add the field bytes to a container
fieldBytes.push_back(payloadData.read_uint8());
}
fieldType = Utils::make_uint16(m_descriptorSet, fieldDescriptor);
//add the field to the m_dataFields vector
MipDataField tempField(fieldType, fieldBytes);
m_dataFields.push_back(tempField);
//parse the data points that are in the existing field that we just created
parsePointsInField(tempField);
}
catch(...)
{
//possible corrupted packet, just break out and skip trying to parse anything else
break;
}
}
}
void MipDataPacket::parsePointsInField(const MipDataField& field)
{
bool isTimestamp = false;
bool isData = true;
MipTypes::ChannelField id = MipTypes::getChannelField_baseDataClass(static_cast<MipTypes::ChannelField>(field.fieldId()));
switch(id)
{
//fields that should only be used as timestamp, and not stored as data
case MipTypes::CH_FIELD_DISP_DISPLACEMENT_TS:
isTimestamp = true;
isData = false;
break;
//fields that will get passed along as data points as well
case MipTypes::CH_FIELD_SENSOR_GPS_CORRELATION_TIMESTAMP:
case MipTypes::CH_FIELD_GNSS_GPS_TIME:
case MipTypes::CH_FIELD_ESTFILTER_GPS_TIMESTAMP:
case MipTypes::CH_FIELD_SENSOR_SHARED_GPS_TIMESTAMP:
isTimestamp = true;
isData = true;
break;
default:
break;
}
// don't re-process if a different timestamp already found
if(isTimestamp && !m_hasDeviceTime)
{
m_hasDeviceTime = true;
parseTimeStamp(field);
}
if(isData)
{
MipFieldParser::parseField(field, m_points);
}
}
bool MipDataPacket::timestampWithinRange(const Timestamp& timestamp) const
{
//timestamp is out of range if it is over an hour in the future
static const uint64 NANOS_IN_1_HOUR = 3600000000000;
//not valid if time is more than 1 hour in the past or future
return ((timestamp - collectedTimestamp()).getNanoseconds() < NANOS_IN_1_HOUR);
}
void MipDataPacket::parseTimeStamp(const MipDataField& field)
{
DataBuffer bytes(field.fieldData());
MipTypes::ChannelField id = MipTypes::getChannelField_baseDataClass(static_cast<MipTypes::ChannelField>(field.fieldId()));
switch (id)
{
case MipTypes::CH_FIELD_DISP_DISPLACEMENT_TS:
{
m_deviceTimeFlags = bytes.read_uint8();
m_deviceTimeValid = (m_deviceTimeFlags == 1);
m_deviceTime.setTime(bytes.read_uint64());
break;
}
case MipTypes::CH_FIELD_SENSOR_GPS_CORRELATION_TIMESTAMP:
{
double gpsTimeOfWeek = bytes.read_double();
uint16 gpsWeekNumber = bytes.read_uint16();
//convert to UTC time
m_deviceTimeFlags = bytes.read_uint16();
m_deviceTime.setTime(Timestamp::gpsTimeToUtcTime(gpsTimeOfWeek, gpsWeekNumber));
//check the GPS time looks like a valid absolute timestamp
//Note: unfortunately, the flags that come with this packet can't be used to identify this,
// so we are just checking for an old or future timestamp, since it starts at 0 when first powered on
m_deviceTimeValid = timestampWithinRange(m_deviceTime);
break;
}
case MipTypes::CH_FIELD_SENSOR_SHARED_GPS_TIMESTAMP:
case MipTypes::CH_FIELD_GNSS_GPS_TIME:
{
double gpsTimeOfWeek = bytes.read_double();
uint16 gpsWeekNumber = bytes.read_uint16();
//convert to UTC time
m_deviceTimeFlags = bytes.read_uint16();
m_deviceTime.setTime(Timestamp::gpsTimeToUtcTime(gpsTimeOfWeek, gpsWeekNumber));
//check the GPS time looks like a valid absolute timestamp
//Note: we might be able to use the flags here, but we're doing this check for the other descriptor sets anyway
m_deviceTimeValid = timestampWithinRange(m_deviceTime);
break;
}
case MipTypes::CH_FIELD_ESTFILTER_GPS_TIMESTAMP:
{
double gpsTimeOfWeek = bytes.read_double();
uint16 gpsWeekNumber = bytes.read_uint16();
//convert to UTC time
m_deviceTimeFlags = bytes.read_uint16();
m_deviceTime.setTime(Timestamp::gpsTimeToUtcTime(gpsTimeOfWeek, gpsWeekNumber));
//check the GPS time looks like a valid absolute timestamp
//Note: unfortunately, the flags that come with this packet can't be used to identify this, as it seems
// they are invalid if the estimation filter isn't initialized, even if the time is initialized
m_deviceTimeValid = timestampWithinRange(m_deviceTime);
break;
}
default:
assert(false); //shouldn't get to this function without being able to parse the timestamp
break;
}
}
const MipDataPoints& MipDataPacket::data() const
{
return m_points;
}
const Timestamp& MipDataPacket::collectedTimestamp() const
{
return m_collectedTime;
}
const Timestamp& MipDataPacket::deviceTimestamp() const
{
return m_deviceTime;
}
bool MipDataPacket::deviceTimeValid() const
{
return m_deviceTimeValid;
}
bool MipDataPacket::hasDeviceTime() const
{
return m_hasDeviceTime;
}
uint16 MipDataPacket::deviceTimeFlags() const
{
return m_deviceTimeFlags;
}
} | 33.894515 | 130 | 0.582597 | [
"vector"
] |
d7807a1d22d9f88aabb36458386e7b34e59c6bca | 401 | cpp | C++ | LeetCode/0674. Longest Continuous Increasing Subsequence/solution.cpp | InnoFang/oh-my-algorithms | f559dba371ce725a926725ad28d5e1c2facd0ab2 | [
"Apache-2.0"
] | 19 | 2018-08-26T03:10:58.000Z | 2022-03-07T18:12:52.000Z | LeetCode/0674. Longest Continuous Increasing Subsequence/solution.cpp | InnoFang/Algorithm-Library | 1896b9d8b1fa4cd73879aaecf97bc32d13ae0169 | [
"Apache-2.0"
] | null | null | null | LeetCode/0674. Longest Continuous Increasing Subsequence/solution.cpp | InnoFang/Algorithm-Library | 1896b9d8b1fa4cd73879aaecf97bc32d13ae0169 | [
"Apache-2.0"
] | 6 | 2020-03-16T23:00:06.000Z | 2022-01-13T07:02:08.000Z | /**
* 36 / 36 test cases passed.
* Status: Accepted
* Runtime: 8 ms
*/
class Solution {
public:
int findLengthOfLCIS(vector<int>& nums) {
int start = 0, ans = 0;
for (int i = 0; i < nums.size(); ++ i) {
if (i > 0 && nums[i] <= nums[i-1]) {
start = i;
}
ans = max(ans, i - start + 1);
}
return ans;
}
};
| 20.05 | 48 | 0.426434 | [
"vector"
] |
d7870df7e3cd78ea2b7cd956f76a2d21e31ace5c | 996 | cpp | C++ | bcge/renderer.cpp | SuperSumo/bcge | 189b9c81190b2abf61e95669d9ae59a559caa4bc | [
"MIT"
] | null | null | null | bcge/renderer.cpp | SuperSumo/bcge | 189b9c81190b2abf61e95669d9ae59a559caa4bc | [
"MIT"
] | null | null | null | bcge/renderer.cpp | SuperSumo/bcge | 189b9c81190b2abf61e95669d9ae59a559caa4bc | [
"MIT"
] | null | null | null | #include <gl/glew.h>
#include <SFML/OpenGL.hpp>
#include "renderer.h"
#include "manager.h"
#include "window.h"
#include "abc/game.h"
using namespace std;
Renderer::Renderer(Manager* manager):
_manager(manager)
{}
void Renderer::initialize()
{
cout << "Renderer::initialize()" << endl;
// Initialize GLEW
glewExperimental = GL_TRUE;
GLenum glew = glewInit();
if (glew != GLEW_OK)
{
cerr << "GLEW Error: " << glewGetErrorString(glew) << endl;
_manager->get_window()->close();
}
// Misc OpenGL settings which will change later.
glClearColor(0.2f, 0.2f, 0.2f, 1.0f);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
glLineWidth(5.0f);
glPointSize(10.0f);
glEnable(GL_DEPTH_TEST); // I need this line for things to work
}
void Renderer::render()
{
// Clear the screen
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Draw the game
_manager->get_game()->draw();
// Swap the buffers
_manager->get_window()->display();
}
| 20.75 | 65 | 0.660643 | [
"render"
] |
d78c0608592830b57d0acde9a253183a180cb55c | 1,226 | cpp | C++ | code archive/TIOJ/2054.cpp | brianbbsu/program | c4505f2b8c0b91010e157db914a63c49638516bc | [
"MIT"
] | 4 | 2018-04-08T08:07:58.000Z | 2021-06-07T14:55:24.000Z | code archive/TIOJ/2054.cpp | brianbbsu/program | c4505f2b8c0b91010e157db914a63c49638516bc | [
"MIT"
] | null | null | null | code archive/TIOJ/2054.cpp | brianbbsu/program | c4505f2b8c0b91010e157db914a63c49638516bc | [
"MIT"
] | 1 | 2018-10-29T12:37:25.000Z | 2018-10-29T12:37:25.000Z | //{
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
typedef int ll;
#define REP(i,n) for(int i=0;i<n;i++)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define SZ(_a) (int)_a.size()
#define ALL(_a) _a.begin(),_a.end()
#define pb push_back
const ll MAXn=3e3+5,MAXlg=__lg(MAXn)+2;
const ll MOD=1000000007;
const ll INF=ll(1e15);
int x[MAXn], y[MAXn], dtx[MAXn], dty[MAXn];
int mx = 0;
vector<int> v;
int n, l, w;
void cal()
{
int it = 0;
REP(i, SZ(v))
{
while(it < SZ(v) && v[it] - v[i] <= l)it++;
mx = max(mx, it - i);
}
}
int main()
{
scanf("%d %d %d", &n, &l, &w);
REP(i,n)scanf("%d %d", x + i, y + i), dtx[i] = i, dty[i] = i;
sort(dtx, dtx + n, [](int a,int b){return x[a] < x[b];});
sort(dty, dty + n, [](int a,int b){return y[a] < y[b];});
int it = 0;
REP(i, n)
{
while(it < n && x[dtx[it]] - x[dtx[i]] <= w)it++;
if(!i || x[dtx[i]] != x[dtx[i-1]])
{
v.clear();
//for(int j = i;j < it;j ++)v.pb(y[dtx[j]]);
//sort(ALL(v));
REP(j,n)if(x[dty[j]] >= x[dtx[i]] && x[dty[j]] <= x[dtx[it-1]])v.pb(y[dty[j]]);
cal();
}
}
printf("%d\n", mx);
}
| 22.703704 | 91 | 0.464927 | [
"vector"
] |
d7a187e7ee21d56046ce84ecae2ed1954613045d | 2,391 | cpp | C++ | game/serversearch.cpp | jmscreation/Capfla | 8a08603595f3abafbdb9c783f0aa223fee79f429 | [
"Apache-2.0"
] | 2 | 2021-02-14T01:39:58.000Z | 2021-02-14T10:17:08.000Z | game/serversearch.cpp | jmscreation/Capfla | 8a08603595f3abafbdb9c783f0aa223fee79f429 | [
"Apache-2.0"
] | null | null | null | game/serversearch.cpp | jmscreation/Capfla | 8a08603595f3abafbdb9c783f0aa223fee79f429 | [
"Apache-2.0"
] | 1 | 2021-04-15T15:54:38.000Z | 2021-04-15T15:54:38.000Z | #include "includes.h"
using namespace Engine;
using namespace std;
ServerSearch::ServerSearch(): close(false), error(false) {
foundServerList.reserve(8);
Handle = new sf::Thread(&ServerSearch::SearchHandle, this);
Handle->launch();
}
ServerSearch::~ServerSearch() {
close = true;
delete Handle;
}
int ServerSearch::serverCount(){
sf::Lock lock(mutex);
return foundServerList.size();
}
vector<ServerSearch::ServerMember> ServerSearch::serverList(){
sf::Lock lock(mutex);
return foundServerList;
}
//Main thread loop handle for finding the server
void ServerSearch::SearchHandle(){
sf::UdpSocket socket;
socket.setBlocking(false);
sf::Packet buf;
sf::IpAddress serverIp;
unsigned short port = BROADCAST_PORT;
sf::Socket::Status status = socket.bind(port);
if(status != sf::Socket::Done){
cout << "Failed to bind announcement port" << endl;
error = true;
socket.unbind();
return;
}
while(!close){
status = socket.receive(buf, serverIp, port);
sf::sleep(sf::milliseconds(100));
{ //Locked Mutex Scope
mutex.lock();
for(unsigned int i=0;i<foundServerList.size();++i){
if(foundServerList[i].expire.getElapsedTime().asSeconds() > 4){
foundServerList.erase(foundServerList.begin() + i);
i--;
}
}
mutex.unlock();
if(close) break;
if(status != sf::Socket::Done) continue;
mutex.lock();
sf::Int32 id, tm = 0;
if(!(buf >> id) || id != GAME_ID) {
cout << "Invalid Game ID" << endl;
buf.clear();
mutex.unlock();
continue;
}
string name;
if(!(buf >> name)) name = "<Unknown Server>";
buf >> tm;
bool found = false;
for(ServerMember& m : foundServerList){
if(m.ip == serverIp){
m.name = name;
m.alive = tm;
m.expire.restart();
found = true;
break;
}
}
if(!found) foundServerList.emplace_back(ServerMember {name, serverIp, tm});
mutex.unlock();
}
}
socket.unbind();
}
| 27.802326 | 87 | 0.519866 | [
"vector"
] |
d7a2c529baee8adae40be85be018a5f3abfddacf | 2,334 | cpp | C++ | src/xr_3da/xrGame/alife_surge_manager.cpp | acidicMercury8/xray-1.0 | 65e85c0e31e82d612c793d980dc4b73fa186c76c | [
"Linux-OpenIB"
] | 10 | 2021-05-04T06:40:27.000Z | 2022-01-20T20:24:28.000Z | src/xr_3da/xrGame/alife_surge_manager.cpp | acidicMercury8/xray-1.0 | 65e85c0e31e82d612c793d980dc4b73fa186c76c | [
"Linux-OpenIB"
] | null | null | null | src/xr_3da/xrGame/alife_surge_manager.cpp | acidicMercury8/xray-1.0 | 65e85c0e31e82d612c793d980dc4b73fa186c76c | [
"Linux-OpenIB"
] | 2 | 2021-11-07T16:57:19.000Z | 2021-12-05T13:17:12.000Z | ////////////////////////////////////////////////////////////////////////////
// Module : alife_surge_manager.cpp
// Created : 25.12.2002
// Modified : 12.05.2004
// Author : Dmitriy Iassenev
// Description : ALife Simulator surge manager
////////////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "alife_surge_manager.h"
#include "alife_object_registry.h"
#include "alife_spawn_registry.h"
#include "alife_time_manager.h"
#include "alife_graph_registry.h"
#include "alife_schedule_registry.h"
#include "alife_simulator_header.h"
#include "ai_space.h"
#include "ef_storage.h"
#include "ef_pattern.h"
#include "graph_engine.h"
#include "xrserver.h"
#include "alife_human_brain.h"
using namespace ALife;
CALifeSurgeManager::~CALifeSurgeManager ()
{
}
void CALifeSurgeManager::spawn_new_spawns ()
{
xr_vector<ALife::_SPAWN_ID>::const_iterator I = m_temp_spawns.begin();
xr_vector<ALife::_SPAWN_ID>::const_iterator E = m_temp_spawns.end();
for ( ; I != E; ++I) {
CSE_ALifeDynamicObject *object, *spawn = smart_cast<CSE_ALifeDynamicObject*>(&spawns().spawns().vertex(*I)->data()->object());
VERIFY3 (spawn,spawns().spawns().vertex(*I)->data()->object().name(),spawns().spawns().vertex(*I)->data()->object().name_replace());
#ifdef DEBUG
CTimer timer;
timer.Start ();
#endif
create (object,spawn,*I);
#ifdef DEBUG
if (psAI_Flags.test(aiALife))
Msg ("LSS : SURGE : SPAWN : [%s],[%s], level %s, time %f ms",*spawn->s_name,spawn->name_replace(),*ai().game_graph().header().level(ai().game_graph().vertex(spawn->m_tGraphID)->level_id()).name(),timer.GetElapsed_sec()*1000.f);
#endif
}
}
void CALifeSurgeManager::fill_spawned_objects ()
{
m_temp_spawned_objects.clear ();
D_OBJECT_P_MAP::const_iterator I = objects().objects().begin();
D_OBJECT_P_MAP::const_iterator E = objects().objects().end();
for ( ; I != E; ++I)
if (spawns().spawns().vertex((*I).second->m_tSpawnID))
m_temp_spawned_objects.push_back ((*I).second->m_tSpawnID);
}
void CALifeSurgeManager::spawn_new_objects ()
{
fill_spawned_objects ();
spawns().fill_new_spawns (m_temp_spawns,time_manager().game_time(),m_temp_spawned_objects);
spawn_new_spawns ();
VERIFY (graph().actor());
}
| 34.323529 | 235 | 0.641388 | [
"object"
] |
d7a5668aa7b530c5641b3c730bbcbc0796ef25b2 | 768 | cpp | C++ | codeforces/I.Wanna.Be.the.Guy.cpp | amarlearning/CodeForces | 6625d3be21cb6a78b88c7521860d1da263e77121 | [
"Unlicense"
] | 3 | 2017-06-17T21:27:04.000Z | 2020-08-07T04:56:56.000Z | codeforces/I.Wanna.Be.the.Guy.cpp | amarlearning/Codeforces | 6625d3be21cb6a78b88c7521860d1da263e77121 | [
"Unlicense"
] | null | null | null | codeforces/I.Wanna.Be.the.Guy.cpp | amarlearning/Codeforces | 6625d3be21cb6a78b88c7521860d1da263e77121 | [
"Unlicense"
] | 2 | 2018-07-26T21:00:42.000Z | 2019-11-30T19:33:57.000Z | #include <string.h>
#include <fstream>
#include <iostream>
#include <string>
#include <complex>
#include <math.h>
#include <set>
#include <vector>
#include <map>
#include <queue>
#include <stdio.h>
#include <stack>
#include <algorithm>
#include <list>
#include <ctime>
#include <memory.h>
#include <ctime>
#include <assert.h>
#define pi 3.14159
#define mod 1000000007
using namespace std;
static int a[500];
int main() {
static int n,p,i,x,cnt;
scanf("%d",&n);
scanf("%d",&p);
for(i=0;i<p;i++) {
scanf("%d",&x);
a[x] = 1;
}
scanf("%d",&p);
for(i=0;i<p;i++) {
scanf("%d",&x);
a[x] = 1;
}
for(i=1;i<=n;i++) {
if(a[i] == 1) {
cnt++;
}
}
if(cnt == n) {
printf("I become the guy.");
}
else {
printf("Oh, my keyboard!");
}
return 0;
}
| 14.222222 | 30 | 0.578125 | [
"vector"
] |
92e6df0f9b885f27e2fb61e0cc9a7ddfc809ebc7 | 3,140 | cpp | C++ | src/addon/register.cpp | jphacks/D_2104 | 54059ef1eec952c775ef6de2c6215912c5eb0a59 | [
"BSD-3-Clause"
] | null | null | null | src/addon/register.cpp | jphacks/D_2104 | 54059ef1eec952c775ef6de2c6215912c5eb0a59 | [
"BSD-3-Clause"
] | null | null | null | src/addon/register.cpp | jphacks/D_2104 | 54059ef1eec952c775ef6de2c6215912c5eb0a59 | [
"BSD-3-Clause"
] | null | null | null | #include <fstream>
#include <exception>
#include <stdexcept>
#include <cstdio>
#include "register.h"
#include "rapidjson/filewritestream.h"
#include "rapidjson/prettywriter.h"
using namespace std;
using namespace std::filesystem;
using namespace rapidjson;
void Register::WriteFeature(string& writePath, Feature& f){
FILE* fp;
#ifdef _MSC_VER
fopen_s(&fp, writePath.c_str(), "wb");
#else
fp = fopen(writePath.c_str(), "wb");
#endif
char writeBuffer[256];
FileWriteStream os(fp, writeBuffer, sizeof(writeBuffer));
PrettyWriter<FileWriteStream> writer(os);
writer.SetIndent(' ', 2);
writer.StartObject();
{
writer.Key("version");
writer.Int(1);
writer.Key("source");
writer.String(f.path.c_str());
writer.Key("base_frequency");
writer.Double(f.baseFrequency);
writer.Key("feature");
writer.StartArray();
{
for(auto& ft : f.feature){
writer.StartObject();
{
writer.Key("f");
writer.Double(ft.first);
writer.Key("p");
writer.Double(ft.second);
}
writer.EndObject();
}
}
writer.EndArray();
}
writer.EndObject();
writer.Flush();
fclose(fp);
}
bool Register::IsTargetFile(string& p, vector<regex>& rules){
if(!is_regular_file(p)){
return false;
}
for(auto& r : rules){
if(regex_match(p, r)){
return false;
}
}
return true;
}
void Register::Execute(){
vector<regex> rules;
size_t pos = 0;
string token;
while ((pos = rule.find(":")) != string::npos) {
token = rule.substr(0, pos);
rules.emplace_back(token);
rule.erase(0, pos + 1);
}
filesystem::path indexPath = saveDir;
indexPath.concat("/index.vsc");
ofstream fout;
regex t(R"(.+\.vsc)");
if(exists(indexPath)){
// TODO: 差分とって必要な分だけ更新.
for (const auto& p : directory_iterator(saveDir)){
auto ps = p.path().string();
if(regex_match(ps, t)){
remove(p);
}
}
fout.open(indexPath.string());
}else{
fout.open(indexPath.string());
}
vector<ExtractFeature> exectractor;
for (const auto& p : recursive_directory_iterator(path)) {
auto pStr = p.path().string();
if(IsTargetFile(pStr, rules)){
exectractor.emplace_back(pStr);
}
}
#pragma omp parallel for schedule(dynamic, 1)
for(auto i = 0; i < exectractor.size(); ++i){
int c = 0;
auto feature = exectractor[i].Extract();
if(feature.isSuccess){
filesystem::path writePath = saveDir;
#pragma omp critical(output)
{
writePath.concat("/" + to_string(Id) + ".vsc");
fout << feature.path << ":" << writePath.string() << endl;
++Id;
}
auto writePathStr = writePath.string();
WriteFeature(writePathStr, feature);
}
}
} | 27.068966 | 74 | 0.540764 | [
"vector"
] |
92e77c57017ef42b966392684d56854a47b1a424 | 6,493 | cpp | C++ | src/LookingGlassOgre/ProcessAnyTime.cpp | Misterblue/LookingGlass-Viewer | c80120e3e5cc8ed699280763c95ca8bb8db8174b | [
"BSD-3-Clause"
] | 3 | 2018-10-14T18:06:33.000Z | 2021-07-23T15:00:10.000Z | src/LookingGlassOgre/ProcessAnyTime.cpp | Misterblue/LookingGlass-Viewer | c80120e3e5cc8ed699280763c95ca8bb8db8174b | [
"BSD-3-Clause"
] | null | null | null | src/LookingGlassOgre/ProcessAnyTime.cpp | Misterblue/LookingGlass-Viewer | c80120e3e5cc8ed699280763c95ca8bb8db8174b | [
"BSD-3-Clause"
] | 2 | 2018-10-14T18:06:37.000Z | 2019-06-10T22:35:37.000Z | /* Copyright (c) Robert Adams
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * The name of the copyright holder may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``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 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.
*/
/*
NOTE TO THE NEXT PERSON: CODE NOT COMPLETE OR HOOKED INTO MAIN CODE
This code is started but not complete. The idea is to create a routine that
tracks meshes and their state (loaded, unloaded, ...) with the goal of allowing
the actual file access part of a mesh load (the call to mesh->prepare()) be
done outside the frame rendering thread.
*/
// #include "stdafx.h"
#include <stdarg.h>
#include "ProcessAnyTime.h"
#include "LookingGlassOgre.h"
#include "RendererOgre.h"
#include "OLMaterialTracker.h"
namespace LG {
ProcessAnyTime* ProcessAnyTime::m_instance = NULL;
// ====================================================================
// PrepareMesh
// Given a meshname, call the prepare routine to get it loaded.
// Once loaded, we can do the refresh between frame
class PrepareMeshPc : public GenericPc {
Ogre::String meshName;
Ogre::String meshGroup;
PrepareMeshPc(Ogre::String meshN, Ogre::String meshG) {
this->meshName = meshN;
this->meshGroup = meshG;
}
~PrepareMeshPc() {
this->meshName.clear();
this->meshGroup.clear();
}
void Process() {
Ogre::ResourceManager::ResourceCreateOrRetrieveResult theMeshResult =
Ogre::MeshManager::getSingleton().createOrRetrieve(this->meshName, this->meshGroup);
Ogre::MeshPtr theMesh = (Ogre::MeshPtr)theMeshResult.first;
if (!theMesh->isPrepared()) {
// read the mesh in from the disk
theMesh->prepare();
// when complete,
// TODO:
}
}
};
// ====================================================================
// Queue of work to do independent of the renderer thread
// Useful for loading meshes and doing other time expensive operations.
// To add a between frame operation, you write a subclass of GenericPc like those
// above, write a routine to create and instance of the class and put it in the
// queue and later, between frames, the Process() routine will be called.
// The constructors and destructors of the *Pc class handles all the allocation
// and deallocation of memory needed to pass the parameters.
ProcessAnyTime::ProcessAnyTime() {
m_workQueueMutex = LGLOCK_ALLOCATE_MUTEX("ProcessAnyTime");
// not enabled yet
// m_processingThread = LGLOCK_ALLOCATE_THREAD(&ProcessThreadRoutine);
// m_backgroundThread = LGLOCK_ALLOCATE_THREAD(&ProcessBackgroundLoading);
m_keepProcessing = true;
m_modified = false;
}
ProcessAnyTime::~ProcessAnyTime() {
m_keepProcessing = false;
LGLOCK_RELEASE_MUTEX(m_workQueueMutex);
}
void ProcessAnyTime::Shutdown() {
// this will cause the threads to exit
m_keepProcessing = false;
}
// static routine to get the thread. Loop around doing work.
void ProcessAnyTime::ProcessThreadRoutine() {
while (LG::ProcessAnyTime::Instance()->m_keepProcessing) {
LGLOCK_LOCK(LG::ProcessAnyTime::Instance()->m_workQueueMutex);
if (!LG::ProcessAnyTime::Instance()->HasWorkItems()) {
LGLOCK_WAIT(LG::ProcessAnyTime::Instance()->m_workQueueMutex);
}
LG::ProcessAnyTime::Instance()->ProcessWorkItems(100);
LGLOCK_UNLOCK(LG::ProcessAnyTime::Instance()->m_workQueueMutex);
}
return;
}
// routine that does the ogre background loading. Kludge that it is here but a test
void ProcessAnyTime::ProcessBackgroundLoading() {
/* Commented out for Ogre 1.7.0 . Replace whole routine with Ogre work queue
Ogre::ResourceBackgroundQueue::getSingleton()._initThread();
while (LG::ProcessAnyTime::Instance()->m_keepProcessing) {
if (!Ogre::ResourceBackgroundQueue::getSingleton()._doNextQueuedBackgroundProcess()) {
// queue is empty, wait a little
LGLOCK_SLEEP(1);
}
}
*/
}
bool ProcessAnyTime::HasWorkItems(){
// TODO:
return false;
}
// Add the work itemt to the work list
void ProcessAnyTime::QueueWork(GenericPc* wi) {
LGLOCK_LOCK(m_workQueueMutex);
// Check to see if uniq is specified and remove any duplicates
if (wi->uniq.length() != 0) {
// There will be duplicate requests for things. If we already have a request, delete the old
std::list<GenericPc*>::iterator li;
for (li = m_work.begin(); li != m_work.end(); li++) {
if ((*li)->uniq.length() != 0) {
if (wi->uniq == (*li)->uniq) {
m_work.erase(li);
LG::IncStat(LG::StatProcessAnyTimeDiscardedDups);
}
}
}
}
m_work.push_back(wi);
m_modified = true;
LGLOCK_UNLOCK(m_workQueueMutex);
LGLOCK_NOTIFY_ONE(m_workQueueMutex);
}
void ProcessAnyTime::ProcessWorkItems(int amountOfWorkToDo) {
// This sort is intended to put the highest priority (ones with lowest numbers) at
// the front of the list for processing first.
// TODO: figure out why uncommenting this line causes exceptions
int loopCost = amountOfWorkToDo;
while (!m_work.empty() && (m_work.size() > 2000 || (loopCost > 0) ) ) {
LGLOCK_LOCK(m_workQueueMutex);
GenericPc* workGeneric = (GenericPc*)m_work.front();
m_work.pop_front();
LGLOCK_UNLOCK(m_workQueueMutex);
LG::SetStat(LG::StatProcessAnyTimeWorkItems, m_work.size());
LG::IncStat(LG::StatProcessAnyTimeTotalProcessed);
workGeneric->Process();
loopCost -= workGeneric->cost;
delete(workGeneric);
}
return;
}
}
| 36.892045 | 94 | 0.723086 | [
"mesh"
] |
92e7a5d566dbbe363b7d86c345627160d17cef55 | 15,259 | cpp | C++ | tests/math_tests/quaternion_operations.cpp | tomreddell/Hamilton | eec6e423f829a559237583803d11fbe06489a9b9 | [
"MIT"
] | 1 | 2020-09-19T14:48:32.000Z | 2020-09-19T14:48:32.000Z | tests/math_tests/quaternion_operations.cpp | tomreddell/Hamilton | eec6e423f829a559237583803d11fbe06489a9b9 | [
"MIT"
] | null | null | null | tests/math_tests/quaternion_operations.cpp | tomreddell/Hamilton | eec6e423f829a559237583803d11fbe06489a9b9 | [
"MIT"
] | 1 | 2021-01-01T02:23:55.000Z | 2021-01-01T02:23:55.000Z | #include "gtest/gtest.h"
#include "test_utils.hpp"
#include "math/core_math.hpp"
#include "math/quaternion.hpp"
TEST(Quaternion, BasicOperations)
{
// For convinience
constexpr auto UNIT_X = Vector3::UNIT_X();
constexpr auto UNIT_Y = Vector3::UNIT_Y();
constexpr auto UNIT_Z = Vector3::UNIT_Z();
{
// Extra checks to guard against accidental overrides
static_assert(Quaternion{} == Quaternion::IDENTITY());
static_assert(Quaternion::IDENTITY().X == 0.0);
static_assert(Quaternion::IDENTITY().Y == 0.0);
static_assert(Quaternion::IDENTITY().Z == 0.0);
static_assert(Quaternion::IDENTITY().S == 1.0);
static_assert(Quaternion::ZERO().X == 0.0);
static_assert(Quaternion::ZERO().Y == 0.0);
static_assert(Quaternion::ZERO().Z == 0.0);
static_assert(Quaternion::ZERO().S == 0.0);
}
// Basic Creation and comparison
{
// Default quaternion (identity)
constexpr auto Q1 = Quaternion {};
// Explicity initialise identity quaternion
constexpr auto Q2 = Quaternion::IDENTITY();
// Initialise from components
constexpr auto Q3 = Quaternion {.X=0.5, .Y=-0.5, .Z=0.5, .S=1.0};
static_assert(Q3.X == 0.5);
static_assert(Q3.Y == -0.5);
static_assert(Q3.Z == 0.5);
static_assert(Q3.S == 1.0);
// Not equal
static_assert(Q3 != Q2);
// copy
constexpr auto Q4 = Q1;
static_assert(Q1 == Q4);
// Move
constexpr auto Q5 = Quaternion {.X = 1.0, .Y=0.0, .Z=0.0, .S=0.0};
static_assert(Q5.X == 1.0);
static_assert(Q5.Y == 0.0);
static_assert(Q5.Z == 0.0);
static_assert(Q5.S == 0.0);
}
// Operations on quaternions
{
constexpr auto Q1 = Quaternion{.X=1.0, .Y = 0.0, .Z = -1.0, .S = 1.0};
static_assert(Q1.NormSquared() == 3.0);
static_assert(Q1.Norm() == Sqrt(3.0));
constexpr auto Q2 = Quaternion{.X=-1.0, .Y=0.0, .Z=1.0, .S=1.0};
static_assert(Q1.Inverse() == Q2.Unit());
}
// More complex construction, rotation
{
// rotation PI / 2 from x -> y axis
constexpr auto Q1 = Quaternion::FromVectorPair(UNIT_X, // frame O
UNIT_Y); // frame M
// x axis in frame O is y axis in frame M by definition
static_assert(IsVector3Near(Q1.Rotate(UNIT_X), UNIT_Y, 1.0E-15));
static_assert(IsVector3Near(Q1.Rotate(-UNIT_X), -UNIT_Y, 1.0E-15));
static_assert(IsVector3Near(Q1.RotateInv(UNIT_Y), UNIT_X, 1.0E-15));
static_assert(IsVector3Near(Q1.RotateInv(-UNIT_Y), -UNIT_X, 1.0E-15));
// y axis in frame O should be -x axis in frame M
static_assert(IsVector3Near(Q1.Rotate(UNIT_Y), -UNIT_X, 1.0E-15));
static_assert(IsVector3Near(Q1.RotateInv(-UNIT_X), UNIT_Y, 1.0E-15));
// +- z axis should remain the same
static_assert(IsVector3Near(Q1.Rotate(UNIT_Z), UNIT_Z, 1.0E-15));
static_assert(IsVector3Near(Q1.Rotate(-UNIT_Z), -UNIT_Z, 1.0E-15));
static_assert(IsVector3Near(Q1.RotateInv(UNIT_Z), UNIT_Z, 1.0E-15));
static_assert(IsVector3Near(Q1.RotateInv(-UNIT_Z), -UNIT_Z, 1.0E-15));
// test a more complicated vector
static_assert(IsVector3Near(Q1.Rotate(Vector3({1, 1, 1})), Vector3({-1.0, 1.0, 1.0}), 1.0E-15));
// Same vector now defined from vector angle initialisation
constexpr auto Q2 = Quaternion::FromVectorAngle(UNIT_Z, -0.5 * PI);
static_assert(IsQuaternionNear(Q1, Q2, 1.0E-15));
// Both fromVectorAngle and fromVectorPair should always constuct a unit quaternion
constexpr auto Q3 = Quaternion::FromVectorPair(Vector3({24, 35, -101}), Vector3({54, -193, 982}));
static_assert(IsNear(Q3.NormSquared(), 1.0, 1.0E-15));
constexpr auto Q4 = Quaternion::FromVectorAngle(Vector3({268, -172, 345}), -2677280.0);
static_assert(IsNear(Q4.NormSquared(), 1.0, 1.0E-15));
}
{
// Another more complicated case
constexpr auto U = Vector3({1.0, 1.0, 1.0});
constexpr auto Q = Quaternion{.X = -0.59037304186825678709,
.Y = 0.737381763784046517785,
.Z = 0.0440496593533170818779,
.S = 0.32524980151386218008};
constexpr auto Q2 = Q.Inverse();
constexpr auto V2 = Vector3({-1.46502882737748851838, -0.919350916194919598468, 0.0921109539875909488771});
constexpr auto V3 = Q.Rotate(U);
static_assert(IsVector3Near(V3, V2, 1.0E-15));
// Should recover original vector from inverse transformation
static_assert(IsVector3Near(Q.RotateInv(V3), U, 1.0E-15));
static_assert(IsVector3Near(Q2.Rotate(V3), U, 1.0E-15));
}
{
// Check the quaternion itself
constexpr auto U = Vector3({-1.0, -1.0, -1.0});
constexpr auto V = Vector3({3.0, -2.0, 1.0});
constexpr auto Q = Quaternion{
.X = -0.3936579516353742,
.Y = -0.26243863442358284,
.Z = 0.65609658605895704,
.S = 0.58795973504816468};
static_assert(IsQuaternionNear(Q, Quaternion::FromVectorPair(V, U), 1.0E-12));
}
{
// Test sucessive rotations
// Rotate z axis counter clockwise, x -> -y, y -> x
constexpr auto Q = Quaternion::FromVectorAngle(UNIT_Z, 0.5 * PI);
static_assert(IsVector3Near(Q.Rotate(UNIT_X), -UNIT_Y, 1.0E-15));
static_assert(IsVector3Near(Q.Rotate(UNIT_Y), UNIT_X, 1.0E-15));
static_assert(IsVector3Near(Q.Rotate(UNIT_Z), UNIT_Z, 1.0E-15));
// Roate y axis counter clockwise, z-> -x, x-> z
constexpr auto Q2 = Quaternion::FromVectorAngle(UNIT_Y, 0.5 * PI);
// Net transform x->-y->-y, y->x->z, z->z->-x
constexpr auto Q3 = Q * Q2;
static_assert(IsVector3Near(Q3.Rotate(UNIT_X), -UNIT_Y, 1.0E-15));
static_assert(IsVector3Near(Q3.Rotate(UNIT_Y), UNIT_Z, 1.0E-15));
static_assert(IsVector3Near(Q3.Rotate(UNIT_Z), -UNIT_X, 1.0E-15));
}
// Euler angles
{
// Identity
{
constexpr auto Q = Quaternion::IDENTITY();
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(EulerAngles.X == 0.0);
static_assert(EulerAngles.Y == 0.0);
static_assert(EulerAngles.Z == 0.0);
}
// X axis
// Rotation PI/2 rad about x
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_X(), PI * 0.5);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(IsNear(EulerAngles.X, PI * 0.5, 1.0E-15));
static_assert(EulerAngles.Y == 0.0);
static_assert(EulerAngles.Z == 0.0);
}
// Rotation -PI/2 rad about x
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_X(), -PI * 0.5);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(IsNear(EulerAngles.X, -PI * 0.5, 1.0E-15));
static_assert(EulerAngles.Y == 0.0);
static_assert(EulerAngles.Z == 0.0);
}
// Rotation 3*PI/2 rad about x
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_X(), 1.5 * PI);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(IsNear(EulerAngles.X, -0.5 * PI, 1.0E-15));
static_assert(EulerAngles.Y == 0.0);
static_assert(EulerAngles.Z == 0.0);
}
// Rotation 2*PI rad about x
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_X(), 2.0 * PI);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(IsNear(EulerAngles.X, 0.0, 1.0E-15));
static_assert(EulerAngles.Y == 0.0);
static_assert(EulerAngles.Z == 0.0);
}
// Y axis
// Rotation PI/2 rad about y
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_Y(), PI * 0.5);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(EulerAngles.X == 0.0);
static_assert(IsNear(EulerAngles.Y, PI * 0.5, 1.0E-15));
static_assert(EulerAngles.Z == 0.0);
}
// Rotation -PI/2 rad about y
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_Y(), -PI * 0.5);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(EulerAngles.X == 0.0);
static_assert(IsNear(EulerAngles.Y, -PI * 0.5, 1.0E-15));
static_assert(EulerAngles.Z == 0.0);
}
// Rotation 3*PI/2 rad about y
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_Y(), 1.5 * PI);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(EulerAngles.X == 0.0);
static_assert(IsNear(EulerAngles.Y, -0.5 * PI, 1.0E-15));
static_assert(IsNear(Fmod(EulerAngles.Z, (2.0 * PI)), 0.0, 1.0E-15)); // fp error puts this one at ~=-2 pi
}
// Rotation 2*PI rad about y
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_Y(), 2.0 * PI);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(EulerAngles.X == 0.0);
static_assert(IsNear(EulerAngles.Y, 0.0, 1.0E-15));
static_assert(EulerAngles.Z == 0.0);
}
// Z axis
// Rotation PI/2 rad about z
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_Z(), PI * 0.5);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(EulerAngles.X == 0.0);
static_assert(EulerAngles.Y == 0.0);
static_assert(IsNear(EulerAngles.Z, 0.5 * PI, 1.0E-15));
}
// Rotation -PI/2 rad about z
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_Z(), -PI * 0.5);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(EulerAngles.X == 0.0);
static_assert(EulerAngles.Y == 0.0);
static_assert(IsNear(EulerAngles.Z, -0.5 * PI, 1.0E-15));
}
// Rotation 3*PI/2 rad about z
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_Z(), 1.5 * PI);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(EulerAngles.X == 0.0);
static_assert(EulerAngles.Y == 0.0);
static_assert(IsNear(EulerAngles.Z, -0.5 * PI, 1.0E-15));
}
// Rotation 2*PI rad about z
{
constexpr auto Q = Quaternion::FromVectorAngle(Vector3::UNIT_Z(), 2.0 * PI);
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(EulerAngles.X == 0.0);
static_assert(EulerAngles.Y == 0.0);
static_assert(IsNear(EulerAngles.Z, 0.0, 1.0E-15));
}
// Some composed rotations
{
constexpr auto Q1 = Quaternion::FromVectorAngle(Vector3::UNIT_Z(), 0.25 * PI);
constexpr auto Q2 = Quaternion::FromVectorAngle(Vector3::UNIT_Y(), PI / 6.0);
constexpr auto Q3 = Quaternion::FromVectorAngle(Vector3::UNIT_X(), PI);
constexpr auto Q = Q1 * Q2 * Q3;
constexpr auto EulerAngles = Q.EulerAngles();
static_assert(IsNear(EulerAngles.X, PI, 1.0E-15));
static_assert(IsNear(EulerAngles.Y, PI / 6.0, 1.0E-15));
static_assert(IsNear(EulerAngles.Z, 0.25 * PI, 1.0E-15));
}
}
// Direct Cosine Matrix (TODO)
{
// A simple orthogonal transform
{
// Rotation : x -> x, y -> z, z -> -y
constexpr auto Q1 = Quaternion::FromVectorAngle(Vector3::UNIT_X(), 0.5 * PI);
constexpr auto Rot = Q1.DirectCosineMatrix();
constexpr auto UnitX = Vector3({.X = Rot.XX, .Y = Rot.YX, .Z = Rot.ZX});
constexpr auto UnitY = Vector3({.X = Rot.XY, .Y = Rot.YY, .Z = Rot.ZY});
constexpr auto UnitZ = Vector3({.X = Rot.XZ, .Y = Rot.YZ, .Z = Rot.ZZ});
constexpr auto ExpectedUnitX = Vector3::UNIT_X(); // Q1.RotateInv(Vector3::UNIT_X());
constexpr auto ExpectedUnitY = Q1.Rotate(Vector3::UNIT_Y());
constexpr auto ExpectedUnitZ = Q1.Rotate(Vector3::UNIT_Z());
static_assert(IsVector3Near(UnitX, ExpectedUnitX, 1.0E-15));
static_assert(IsVector3Near(UnitY, ExpectedUnitY, 1.0E-15));
static_assert(IsVector3Near(UnitZ, ExpectedUnitZ, 1.0E-15));
}
// More complex transform
{
constexpr auto Q1 = Quaternion{.X = 0.507, .Y = 0.507, .Z = 0.507, .S = 0.159}.Unit();
constexpr auto Rot = Q1.DirectCosineMatrix();
constexpr auto UnitX = Vector3({.X = Rot.XX, .Y = Rot.YX, .Z = Rot.ZX});
constexpr auto UnitY = Vector3({.X = Rot.XY, .Y = Rot.YY, .Z = Rot.ZY});
constexpr auto UnitZ = Vector3({.X = Rot.XZ, .Y = Rot.YZ, .Z = Rot.ZZ});
constexpr auto ExpectedUnitX = Q1.Rotate(Vector3::UNIT_X());
constexpr auto ExpectedUnitY = Q1.Rotate(Vector3::UNIT_Y());
constexpr auto ExpectedUnitZ = Q1.Rotate(Vector3::UNIT_Z());
static_assert(IsVector3Near(UnitX, ExpectedUnitX, 1.0E-15));
static_assert(IsVector3Near(UnitY, ExpectedUnitY, 1.0E-15));
static_assert(IsVector3Near(UnitZ, ExpectedUnitZ, 1.0E-15));
}
}
// Derivative
{
{
constexpr auto Q1Dot = Quaternion::IDENTITY().Derivative(Vector3::UNIT_X());
constexpr auto Q2 = Quaternion{.X=0.5, .Y=0.0, .Z=0.0, .S=0.0};
static_assert(Q1Dot == Q2);
}
{
constexpr auto Q1Dot = Quaternion::IDENTITY().Derivative(Vector3::UNIT_Y());
constexpr auto Q2 = Quaternion{.X=0.0, .Y=0.5, .Z=0.0, .S=0.0};
static_assert(Q1Dot == Q2);
}
{
constexpr auto Q1Dot = Quaternion::IDENTITY().Derivative(Vector3::UNIT_Z());
constexpr auto Q2 = Quaternion{.X=0.0, .Y=0.0, .Z=0.5, .S=0.0};
static_assert(Q1Dot == Q2);
}
{
static_assert(Quaternion::IDENTITY().Derivative(Vector3::ZERO()) == Quaternion::ZERO());
}
// TODO: Supply more complex tests
}
} | 41.240541 | 119 | 0.543876 | [
"vector",
"transform"
] |
92e9f3f6d2e5e1a5a2ef6f6e3011c7439664bf58 | 3,873 | hpp | C++ | src/chemistry/chemTabModel.hpp | kolosret/ablate | 755089ab5e39388d9cda8dedac5a45ba1b016dd5 | [
"BSD-3-Clause"
] | null | null | null | src/chemistry/chemTabModel.hpp | kolosret/ablate | 755089ab5e39388d9cda8dedac5a45ba1b016dd5 | [
"BSD-3-Clause"
] | null | null | null | src/chemistry/chemTabModel.hpp | kolosret/ablate | 755089ab5e39388d9cda8dedac5a45ba1b016dd5 | [
"BSD-3-Clause"
] | null | null | null | #ifndef ABLATELIBRARY_CHEMTABMODEL_HPP
#define ABLATELIBRARY_CHEMTABMODEL_HPP
#include <petscmat.h>
#include <filesystem>
#include <istream>
#include "chemistryModel.hpp"
#ifdef WITH_TENSORFLOW
#include <tensorflow/c/c_api.h>
#endif
namespace ablate::chemistry {
#ifdef WITH_TENSORFLOW
class ChemTabModel : public ChemistryModel {
private:
TF_Graph* graph = nullptr;
TF_Status* status = nullptr;
TF_SessionOptions* sessionOpts = nullptr;
TF_Buffer* runOpts = nullptr;
TF_Session* session = nullptr;
std::vector<std::string> speciesNames = std::vector<std::string>(0);
std::vector<std::string> progressVariablesNames = std::vector<std::string>(0);
PetscReal** Wmat = nullptr;
PetscReal** iWmat = nullptr;
/**
* private implementations of support functions
*/
static void ChemTabModelComputeMassFractionsFunction(const PetscReal progressVariables[], const std::size_t progressVariablesSize, PetscReal* massFractions, const std::size_t massFractionsSize,
void* ctx);
static void ChemTabModelComputeSourceFunction(const PetscReal progressVariables[], const std::size_t progressVariablesSize, PetscReal* predictedSourceEnergy, PetscReal* progressVariableSource,
const std::size_t progressVariableSourceSize, void* ctx);
void ExtractMetaData(std::istream& inputStream);
void LoadBasisVectors(std::istream& inputStream, std::size_t columns, PetscReal** W);
public:
explicit ChemTabModel(std::filesystem::path path);
~ChemTabModel() override;
/**
* Returns a vector of all species required for this model. The species order indicates the correct order for other functions
* @return
*/
const std::vector<std::string>& GetSpecies() const override;
/**
* Returns a vector of all progress variables (including zMix) required for this model. The progress variable order indicates the correct order for other functions
* @return
*/
const std::vector<std::string>& GetProgressVariables() const override;
/**
* Computes the progresses variables for a given mass fraction
* @return
*/
void ComputeProgressVariables(const PetscReal massFractions[], const std::size_t massFractionsSize, PetscReal* progressVariables, const std::size_t progressVariablesSize) const override;
/**
* Support functions to get access to c-style pointer functions
* @return
*/
ComputeMassFractionsFunction GetComputeMassFractionsFunction() override { return ChemTabModelComputeMassFractionsFunction; }
ComputeSourceFunction GetComputeSourceFunction() override { return ChemTabModelComputeSourceFunction; }
void* GetContext() override { return this; }
};
#else
class ChemTabModel : public ChemistryModel {
public:
static inline const std::string errorMessage = "Using the ChemTabModel requires Tensorflow to be compile with ABLATE.";
ChemTabModel(std::filesystem::path path) { throw std::runtime_error(errorMessage); }
const std::vector<std::string>& GetSpecies() const override { throw std::runtime_error(errorMessage); }
const std::vector<std::string>& GetProgressVariables() const override { throw std::runtime_error(errorMessage); }
void ComputeProgressVariables(const PetscReal massFractions[], const std::size_t massFractionsSize, PetscReal* progressVariables, const std::size_t progressVariablesSize) const override {
throw std::runtime_error(errorMessage);
}
ComputeMassFractionsFunction GetComputeMassFractionsFunction() override { throw std::runtime_error(errorMessage); }
ComputeSourceFunction GetComputeSourceFunction() override { throw std::runtime_error(errorMessage); }
};
#endif
} // namespace ablate::chemistry
#endif // ABLATELIBRARY_CHEMTABMODEL_HPP
| 44.517241 | 197 | 0.733798 | [
"vector",
"model"
] |
92ece0b7ebe8b99d691bba5c44c16a1129f8899d | 7,355 | cpp | C++ | src/protocol.cpp | Kozisto/pivx540 | 0251902cc1410c4128ff7c3548b49e8ccef98bc1 | [
"MIT"
] | 638 | 2017-01-07T23:55:36.000Z | 2022-03-29T21:02:43.000Z | src/protocol.cpp | Kozisto/pivx540 | 0251902cc1410c4128ff7c3548b49e8ccef98bc1 | [
"MIT"
] | 1,750 | 2017-01-08T12:29:27.000Z | 2022-03-09T18:32:16.000Z | src/protocol.cpp | Kozisto/pivx540 | 0251902cc1410c4128ff7c3548b49e8ccef98bc1 | [
"MIT"
] | 1,461 | 2017-01-08T00:49:42.000Z | 2022-03-20T07:13:39.000Z | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2017-2020 The PIVX developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "protocol.h"
#include "util/system.h"
#include "utilstrencodings.h"
#ifndef WIN32
#include <arpa/inet.h>
#endif
namespace NetMsgType
{
const char* VERSION = "version";
const char* VERACK = "verack";
const char* ADDR = "addr";
const char* ADDRV2="addrv2";
const char* SENDADDRV2="sendaddrv2";
const char* INV = "inv";
const char* GETDATA = "getdata";
const char* MERKLEBLOCK = "merkleblock";
const char* GETBLOCKS = "getblocks";
const char* GETHEADERS = "getheaders";
const char* TX = "tx";
const char* HEADERS = "headers";
const char* BLOCK = "block";
const char* GETADDR = "getaddr";
const char* MEMPOOL = "mempool";
const char* PING = "ping";
const char* PONG = "pong";
const char* ALERT = "alert";
const char* NOTFOUND = "notfound";
const char* FILTERLOAD = "filterload";
const char* FILTERADD = "filteradd";
const char* FILTERCLEAR = "filterclear";
const char* SENDHEADERS = "sendheaders";
const char* SPORK = "spork";
const char* GETSPORKS = "getsporks";
const char* MNBROADCAST = "mnb";
const char* MNBROADCAST2 = "mnb2"; // BIP155 support
const char* MNPING = "mnp";
const char* MNWINNER = "mnw";
const char* GETMNWINNERS = "mnget";
const char* BUDGETPROPOSAL = "mprop";
const char* BUDGETVOTE = "mvote";
const char* BUDGETVOTESYNC = "mnvs";
const char* FINALBUDGET = "fbs";
const char* FINALBUDGETVOTE = "fbvote";
const char* SYNCSTATUSCOUNT = "ssc";
const char* GETMNLIST = "dseg";
}; // namespace NetMsgType
/** All known message types. Keep this in the same order as the list of
* messages above and in protocol.h.
*/
const static std::string allNetMessageTypes[] = {
NetMsgType::VERSION,
NetMsgType::VERACK,
NetMsgType::ADDR,
NetMsgType::ADDRV2,
NetMsgType::SENDADDRV2,
NetMsgType::INV,
NetMsgType::GETDATA,
NetMsgType::MERKLEBLOCK,
NetMsgType::GETBLOCKS,
NetMsgType::GETHEADERS,
NetMsgType::TX,
NetMsgType::HEADERS,
NetMsgType::BLOCK,
NetMsgType::GETADDR,
NetMsgType::MEMPOOL,
NetMsgType::PING,
NetMsgType::PONG,
NetMsgType::ALERT,
NetMsgType::NOTFOUND,
NetMsgType::FILTERLOAD,
NetMsgType::FILTERADD,
NetMsgType::FILTERCLEAR,
NetMsgType::SENDHEADERS,
"filtered block", // Should never occur
"ix", // deprecated
"txlvote", // deprecated
NetMsgType::SPORK, // --- tiertwoNetMessageTypes start here ---
NetMsgType::MNWINNER,
"mnodescanerr",
NetMsgType::BUDGETVOTE,
NetMsgType::BUDGETPROPOSAL,
NetMsgType::FINALBUDGET,
NetMsgType::FINALBUDGETVOTE,
"mnq",
NetMsgType::MNBROADCAST,
NetMsgType::MNPING,
"dstx", // deprecated
NetMsgType::GETMNWINNERS,
NetMsgType::GETMNLIST,
NetMsgType::BUDGETVOTESYNC,
NetMsgType::GETSPORKS,
NetMsgType::SYNCSTATUSCOUNT,
NetMsgType::MNBROADCAST2
};
const static std::vector<std::string> allNetMessageTypesVec(allNetMessageTypes, allNetMessageTypes + ARRAYLEN(allNetMessageTypes));
const static std::vector<std::string> tiertwoNetMessageTypesVec(std::find(allNetMessageTypesVec.begin(), allNetMessageTypesVec.end(), NetMsgType::SPORK), allNetMessageTypesVec.end());
CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn)
{
memcpy(pchMessageStart, pchMessageStartIn, MESSAGE_START_SIZE);
memset(pchCommand, 0, sizeof(pchCommand));
nMessageSize = -1;
memset(pchChecksum, 0, CHECKSUM_SIZE);
}
CMessageHeader::CMessageHeader(const MessageStartChars& pchMessageStartIn, const char* pszCommand, unsigned int nMessageSizeIn)
{
memcpy(pchMessageStart, pchMessageStartIn, MESSAGE_START_SIZE);
// Copy the command name, zero-padding to COMMAND_SIZE bytes
size_t i = 0;
for (; i < COMMAND_SIZE && pszCommand[i] != 0; ++i) pchCommand[i] = pszCommand[i];
assert(pszCommand[i] == 0); // Assert that the command name passed in is not longer than COMMAND_SIZE
for (; i < COMMAND_SIZE; ++i) pchCommand[i] = 0;
nMessageSize = nMessageSizeIn;
memset(pchChecksum, 0, CHECKSUM_SIZE);
}
std::string CMessageHeader::GetCommand() const
{
return std::string(pchCommand, pchCommand + strnlen(pchCommand, COMMAND_SIZE));
}
bool CMessageHeader::IsValid(const MessageStartChars& pchMessageStartIn) const
{
// Check start string
if (memcmp(pchMessageStart, pchMessageStartIn, MESSAGE_START_SIZE) != 0)
return false;
// Check the command string for errors
for (const char* p1 = pchCommand; p1 < pchCommand + COMMAND_SIZE; p1++) {
if (*p1 == 0) {
// Must be all zeros after the first zero
for (; p1 < pchCommand + COMMAND_SIZE; p1++)
if (*p1 != 0)
return false;
} else if (*p1 < ' ' || *p1 > 0x7E)
return false;
}
// Message size
if (nMessageSize > MAX_SIZE) {
LogPrintf("CMessageHeader::IsValid() : (%s, %u bytes) nMessageSize > MAX_SIZE\n", GetCommand(), nMessageSize);
return false;
}
return true;
}
CInv::CInv()
{
type = 0;
hash.SetNull();
}
CInv::CInv(int typeIn, const uint256& hashIn)
{
type = typeIn;
hash = hashIn;
}
bool operator<(const CInv& a, const CInv& b)
{
return (a.type < b.type || (a.type == b.type && a.hash < b.hash));
}
bool CInv::IsMasterNodeType() const{
return type > 2;
}
std::string CInv::GetCommand() const
{
std::string cmd;
switch (type) {
case MSG_TX: return cmd.append(NetMsgType::TX);
case MSG_BLOCK: return cmd.append(NetMsgType::BLOCK);
case MSG_FILTERED_BLOCK: return cmd.append(NetMsgType::MERKLEBLOCK);
case MSG_TXLOCK_REQUEST: return cmd.append("ix"); // Deprecated
case MSG_TXLOCK_VOTE: return cmd.append("txlvote"); // Deprecated
case MSG_SPORK: return cmd.append(NetMsgType::SPORK);
case MSG_MASTERNODE_WINNER: return cmd.append(NetMsgType::MNWINNER);
case MSG_MASTERNODE_SCANNING_ERROR: return cmd.append("mnodescanerr"); // Deprecated
case MSG_BUDGET_VOTE: return cmd.append(NetMsgType::BUDGETVOTE);
case MSG_BUDGET_PROPOSAL: return cmd.append(NetMsgType::BUDGETPROPOSAL);
case MSG_BUDGET_FINALIZED: return cmd.append(NetMsgType::FINALBUDGET);
case MSG_BUDGET_FINALIZED_VOTE: return cmd.append(NetMsgType::FINALBUDGETVOTE);
case MSG_MASTERNODE_QUORUM: return cmd.append("mnq"); // Unused
case MSG_MASTERNODE_ANNOUNCE: return cmd.append(NetMsgType::MNBROADCAST); // or MNBROADCAST2
case MSG_MASTERNODE_PING: return cmd.append(NetMsgType::MNPING);
case MSG_DSTX: return cmd.append("dstx"); // Deprecated
default:
throw std::out_of_range(strprintf("%s: type=%d unknown type", __func__, type));
}
}
std::string CInv::ToString() const
{
return strprintf("%s %s", GetCommand(), hash.ToString());
}
const std::vector<std::string>& getAllNetMessageTypes()
{
return allNetMessageTypesVec;
}
const std::vector<std::string>& getTierTwoNetMessageTypes()
{
return tiertwoNetMessageTypesVec;
}
| 32.982063 | 183 | 0.687152 | [
"vector"
] |
92f3ce1e9f0e3d738d7b5008969b1c4bc5f47f5f | 39,720 | cpp | C++ | main.cpp | asyz8/pop-the-balloon | 1ccb595eaf2d2f663c8b049f22985e57de53e1fb | [
"BSD-3-Clause"
] | null | null | null | main.cpp | asyz8/pop-the-balloon | 1ccb595eaf2d2f663c8b049f22985e57de53e1fb | [
"BSD-3-Clause"
] | null | null | null | main.cpp | asyz8/pop-the-balloon | 1ccb595eaf2d2f663c8b049f22985e57de53e1fb | [
"BSD-3-Clause"
] | null | null | null | ////////////////////////////////////////////////////////////////////////
//
// Harvard University
// CS175 : Computer Graphics
// Professor Steven Gortler
//
////////////////////////////////////////////////////////////////////////
#include <memory>
#include <stdexcept>
#include <string>
#include <vector>
#include <list>
#include <cstdlib>
#include <iostream>
#include <fstream>
#include "unistd.h"
#include "sgutils.h"
#define GLEW_STATIC
#include "GL/glew.h"
#include "GL/glfw3.h"
#include "cvec.h"
#include "geometrymaker.h"
#include "glsupport.h"
#include "matrix4.h"
#include "ppm.h"
#include "rigtform.h"
#include "arcball.h"
#include "asstcommon.h"
#include "scenegraph.h"
#include "drawer.h"
#include "picker.h"
#include "geometry.h"
#include "mesh.h"
using namespace std; // for string, vector, iostream, and other standard C++ stuff
// G L O B A L S ///////////////////////////////////////////////////
// --------- IMPORTANT --------------------------------------------------------
// Before you start working on this assignment, set the following variable
// properly to indicate whether you want to use OpenGL 2.x with GLSL 1.0 or
// OpenGL 3.x+ with GLSL 1.5.
//
// Set g_Gl2Compatible = true to use GLSL 1.0 and g_Gl2Compatible = false to
// use GLSL 1.5. Use GLSL 1.5 unless your system does not support it.
//
// If g_Gl2Compatible=true, shaders with -gl2 suffix will be loaded.
// If g_Gl2Compatible=false, shaders with -gl3 suffix will be loaded.
// To complete the assignment you only need to edit the shader files that get
// loaded
// ----------------------------------------------------------------------------
const bool g_Gl2Compatible = false;
static const float g_frustMinFov = 60.0; // A minimal of 60 degree field of view
static float g_frustFovY = g_frustMinFov; // FOV in y direction (updated by updateFrustFovY)
static const float g_frustNear = -0.1; // near plane
static const float g_frustFar = -100.0; // far plane
static const float g_groundY = -2.0; // y coordinate of the ground
static const float g_ceilY = 20.0; // y coordinate of the ceiling
static const float g_roomWidth = 20.0;
static const float g_roomDepth = 1.5 * g_roomWidth;
static const float g_movementBuffer = 1.0; // skyNode always maintains this distance to the walls of the room
static const float g_lineZ = g_roomDepth/4; // you must start before (z>g_lineZ) this line
static const float g_roomMinDim = min(2*g_roomWidth, min(2*g_roomDepth, g_ceilY-g_groundY)),
g_roomMaxDim = max(2*g_roomWidth, max(2*g_roomDepth, g_ceilY-g_groundY));
static GLFWwindow* g_window;
static int g_windowWidth = 512;
static int g_windowHeight = 512;
static double g_wScale = 1;
static double g_hScale = 1;
static double g_arcballScreenRadius = .25 * min(g_windowWidth, g_windowHeight);
static double g_arcballScale = 1.;
static bool g_mouseClickDown = false; // is the mouse button pressed
static bool g_mouseLClickButton, g_mouseRClickButton, g_mouseMClickButton;
static bool g_spaceDown = false; // space state, for middle mouse emulation
static bool g_pickingMode = false;
static double g_mouseClickX, g_mouseClickY; // coordinates for mouse click event
// --------- Materials
static shared_ptr<Material> g_goldDiffuseMat,
g_blueDiffuseMat,
g_bumpFloorMat,
g_arcballMat,
g_pickingMat,
g_lightMat,
g_transMat;
shared_ptr<Material> g_overridingMaterial;
static vector<shared_ptr<Material>> g_bunnyShellMats; // for bunny shells
// --------- Scene nodes
static shared_ptr<SgTransformNode> g_world, g_groundNode, g_activeEyeNode, g_screenNode,
g_arrowEyeNode, g_arrowEyeNode2;
static shared_ptr<SgRbtNode> g_skyNode, g_arrowNode, g_light1Node, g_light2Node, g_currentPickedRbtNode;
static list<shared_ptr<SgRbtNode>> g_balloonNodes;
static vector<Cvec3> g_balloonVelocity; // in world coordinates
static bool g_skyCameraOrbit = true;
// Is the animation playing?
static bool g_playingAnimation = false;
// Time since last key frame
static int g_animateTime = 0;
static double g_lastFrameClock;
static const double g_framesPerSecond = 60;
// --------- Geometry
typedef SgGeometryShapeNode MyShapeNode;
// Vertex buffer and index buffer associated with the ground and cube geometry
static shared_ptr<Geometry> g_ground, g_cube, g_sphere;
static bool g_print = true; // for testing only
// -------- For the game
// Global variables for used physical simulation
static const Cvec3 g_gravity(0, -0.5, 0); // gavity vector
static double g_timeStep = 0.02;
static double g_numStepsPerFrame = 10;
// Game status and statistics
static int g_scorePerPop = 10;
static int g_currScore = 0;
static float g_arrowWidth = .15;
static float g_arrowWidthMax = g_roomDepth*.03, g_arrowWidthMin = 0.05;
static float g_arrowLength = g_arrowWidth*20;
static Cvec3 g_arrowVelocity(0,0,0);
static bool g_arrowLock = false;
static bool g_arrowSetLaunchVelocity = false;
static float g_arrowLaunchVelocity = 0.0;
static float g_balloonRadius = 2.0;
static bool g_balloonMoving = false;
static float g_balloonVelocityScale = 5.0;
static const float g_balloonSpeedMin = 0.1, g_balloonSpeedMax = min(60.0, g_roomMinDim/g_timeStep);
static const float g_incrementRatio = 1.2;
///////////////// END OF G L O B A L S
/////////////////////////////////////////////////////
// ------- Helper functions
static void initGround() {
int ibLen, vbLen;
getPlaneVbIbLen(vbLen, ibLen);
// Temporary storage for cube Geometry
vector<VertexPNTBX> vtx(vbLen);
vector<unsigned short> idx(ibLen);
makePlane(g_roomMaxDim, vtx.begin(), idx.begin());
g_ground.reset(new SimpleIndexedGeometryPNTBX(&vtx[0], &idx[0], vbLen, ibLen));
}
static void initCubes() {
int ibLen, vbLen;
getCubeVbIbLen(vbLen, ibLen);
// Temporary storage for cube Geometry
vector<VertexPNTBX> vtx(vbLen);
vector<unsigned short> idx(ibLen);
makeCube(1, vtx.begin(), idx.begin());
g_cube.reset(new SimpleIndexedGeometryPNTBX(&vtx[0], &idx[0], vbLen, ibLen));
}
static void initSphere() {
int ibLen, vbLen;
getSphereVbIbLen(20, 10, vbLen, ibLen);
// Temporary storage for sphere Geometry
vector<VertexPNTBX> vtx(vbLen);
vector<unsigned short> idx(ibLen);
makeSphere(1, 20, 10, vtx.begin(), idx.begin());
g_sphere.reset(new SimpleIndexedGeometryPNTBX(&vtx[0], &idx[0], vtx.size(), idx.size()));
}
static Cvec3 coordConvert(Cvec3 p, RigTForm& worldToObject, bool toWorldCoord = true, float translate = 1.) {
return Cvec3((toWorldCoord ? worldToObject : inv(worldToObject))*Cvec4(p,translate));
}
static Cvec3 limitMotion(RigTForm& L, RigTForm worldToObject = RigTForm(),
float buffer = g_movementBuffer,
float zmin = -g_roomDepth, float zmax = g_roomDepth,
float xmin = -g_roomWidth, float xmax = g_roomWidth,
float ymin = g_groundY, float ymax = g_ceilY) {
Cvec3 t = coordConvert(L.getTranslation(), worldToObject);
t[0] = clamp((float)t[0], xmin+buffer, xmax-buffer);
t[1] = clamp((float)t[1], ymin+buffer, ymax-buffer);
t[2] = clamp((float)t[2], zmin+buffer, zmax-buffer);
L.setTranslation(coordConvert(t, worldToObject, false));
return L.getTranslation();
}
static float angleBetween(Cvec3 v1, Cvec3 v2) {
if ((norm(v1) > CS175_EPS) && (norm(v2) > CS175_EPS))
return acos(dot(v1,v2)/norm(v1)/norm(v2));
else
return 0;
}
static void printCvec3(Cvec3 p) {
cout << " " << p[0] << " " << p[1] << " " << p[2] << endl;
}
static Cvec3 getBasis(Quat q, int i) {
return quatToMatrix(q).getBasis(i);
}
static double randomRange(float lo = -1.0, float hi = 1.0) {
return(static_cast <double> (lo + (hi-lo) * rand()/RAND_MAX));
}
static Cvec3 randomCvec3(float scale=1.0) {
float theta = randomRange(0,CS175_PI);
float phi = randomRange(0,CS175_PI*2);
return Cvec3(sin(theta)*cos(phi), sin(theta)*sin(phi), cos(theta))*scale;
}
// takes a projection matrix and send to the the shaders
inline void sendProjectionMatrix(Uniforms& uniforms, const Matrix4& projMatrix) {
uniforms.put("uProjMatrix", projMatrix);
}
// update g_frustFovY from g_frustMinFov, g_windowWidth, and g_windowHeight
static void updateFrustFovY() {
if (g_windowWidth >= g_windowHeight)
g_frustFovY = g_frustMinFov;
else {
const double RAD_PER_DEG = 0.5 * CS175_PI / 180;
g_frustFovY = atan2(sin(g_frustMinFov * RAD_PER_DEG) * g_windowHeight /
g_windowWidth,
cos(g_frustMinFov * RAD_PER_DEG)) /
RAD_PER_DEG;
}
}
static Matrix4 makeProjectionMatrix() {
return Matrix4::makeProjection(
g_frustFovY, g_windowWidth / static_cast<double>(g_windowHeight),
g_frustNear, g_frustFar);
}
static void updateActiveEye() {
cout << "Active eye is ";
if (g_activeEyeNode == g_skyNode) {
g_activeEyeNode = g_arrowEyeNode;
cout << "tip of arrow" << endl;
} else if (g_activeEyeNode == g_arrowEyeNode) {
g_activeEyeNode = g_arrowEyeNode2;
cout << "straddled on arrow" << endl;
} else if (g_activeEyeNode == g_arrowEyeNode2) {
g_activeEyeNode = g_skyNode;
cout << "sky" << endl;
}
}
static RigTForm getEyeRbt() {
return (getPathAccumRbt(g_world, g_activeEyeNode));
}
// -------- Game
static list<shared_ptr<SgRbtNode>>::iterator popBalloon(
list<shared_ptr<SgRbtNode>>::iterator balloon,
vector<Cvec3>::iterator balloonVelocity) {
g_world->removeChild(*balloon);
g_currScore += g_scorePerPop;
cout << "Pop! Current score " << g_currScore << endl;
g_balloonVelocity.erase(balloonVelocity);
return g_balloonNodes.erase(balloon);
}
static bool hitWall(Cvec3 p, double tol = g_arrowWidth) {
return ((p[0] < -g_roomWidth + tol) || (p[0] > g_roomWidth - tol)
|| (p[1] < g_groundY + tol) || (p[1] > g_ceilY - tol)
|| (p[2] < -g_roomDepth + tol) || (p[2] > g_roomDepth - tol) );
}
static void rescaleArrow(bool arrowPicked = false) {
g_arrowNode->clearChild();
g_arrowLength = g_arrowWidth * 20;
g_arrowNode->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_cube, g_blueDiffuseMat, Cvec3(0, 0, 0), Cvec3(0,0,0),
Cvec3(g_arrowWidth, g_arrowWidth, g_arrowLength))));
g_arrowNode->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_sphere, g_blueDiffuseMat, Cvec3(0, 0, -g_arrowLength/2), Cvec3(0,0,0),
Cvec3(g_arrowWidth, g_arrowWidth, g_arrowWidth))));
g_arrowEyeNode.reset(new SgRbtNode(RigTForm(Cvec3(0.0,0.0,-g_arrowWidth-g_arrowLength/2))));
g_arrowEyeNode2.reset(new SgRbtNode(RigTForm(Cvec3(0.0,g_arrowWidth,0))));
g_arrowNode->addChild(g_arrowEyeNode);
g_arrowNode->addChild(g_arrowEyeNode2);
if (arrowPicked) {
g_currentPickedRbtNode = g_arrowNode;
}
}
static void resetScene() {
if (g_arrowEyeNode) {
g_arrowNode->removeChild(g_arrowEyeNode);
g_world->removeChild(g_skyNode);
g_world->removeChild(g_arrowNode);
}
g_skyNode.reset(new SgRbtNode(RigTForm(Cvec3(0.0, (g_ceilY+g_groundY)/2, g_roomDepth-g_movementBuffer))));
g_activeEyeNode = g_skyNode;
bool arrowPicked = (g_currentPickedRbtNode) && (g_currentPickedRbtNode == g_arrowNode);
g_arrowNode.reset(new SgRbtNode(RigTForm(Cvec3(0.0, (g_ceilY+2*g_groundY)/3, (g_lineZ + g_roomDepth)/2),
Quat(cos(0/8),Cvec3(0,1,0)*sin(0/8)))));
rescaleArrow(arrowPicked);
g_world->addChild(g_arrowNode);
g_world->addChild(g_skyNode);
g_arrowVelocity = Cvec3(0,0,0);
g_arrowLock = false;
g_arrowLaunchVelocity = 0.0;
}
static void updateArrow() {
if (norm(g_arrowVelocity) < CS175_EPS)
return;
RigTForm worldToArrow = getPathAccumRbt(g_world, g_arrowNode, 1);
RigTForm L = getPathAccumRbt(g_world, g_arrowNode);
Cvec3 p = coordConvert(L.getTranslation(), worldToArrow); // arrow COM location in world coordinates
p = p + g_arrowVelocity * g_timeStep;
float theta = angleBetween(g_arrowVelocity, g_arrowVelocity + g_gravity * g_timeStep);
Cvec3 k = coordConvert(Cvec3(-g_arrowVelocity[2],0,g_arrowVelocity[0]), L, false, 0);
if (theta > CS175_EPS) {
k.normalize();
} else {
theta = 0;
k = Cvec3(1,0,0);
}
g_arrowVelocity = g_arrowVelocity + g_gravity * g_timeStep;
g_arrowNode->setRbt(RigTForm(coordConvert(p, worldToArrow, false),
inv(worldToArrow.getRotation())*L.getRotation()*Quat(cos(theta/2),k*sin(-theta/2))));
g_world->removeChild(g_groundNode);
g_world->addChild(g_groundNode);
L = getPathAccumRbt(g_world, g_arrowNode);
Cvec3 s = coordConvert(Cvec3(0,0,-g_arrowLength/2), L); // arrow tip location in world coordinates
// Verify that veloc vector = arrow vector in direction
// cout << "veloc vector "; printCvec3(g_arrowVelocity/norm(g_arrowVelocity));
// cout << "arrow vector "; printCvec3(s-p);
auto it2 = g_balloonVelocity.begin();
for(auto it = g_balloonNodes.begin(), end = g_balloonNodes.end(); it != end; it++) {
if (norm2(s - ((*it)->getRbt()).getTranslation()) < (g_balloonRadius+g_arrowWidth)*(g_balloonRadius+g_arrowWidth)) {
it = popBalloon(it, it2);
}
it2++;
}
s += g_arrowVelocity * g_timeStep;
if (hitWall(s)) {
cout << "Arrow hits wall. Your total is "<< g_currScore << endl;
cout << "Resetting arrow in 3s..." << endl;
sleep(3);
resetScene();
}
}
static void generateBalloon(int n = 1, bool randomLoc = true) {
shared_ptr<SgRbtNode> balloon;
Cvec3 loc;
for (int i = 0; i < n; i++) {
loc = randomLoc ? Cvec3(
randomRange(-g_roomWidth+g_balloonRadius, g_roomWidth-g_balloonRadius),
randomRange(g_groundY+g_balloonRadius, g_ceilY-g_balloonRadius),
randomRange(-g_roomDepth+g_balloonRadius, g_lineZ-g_balloonRadius)) : Cvec3(0.0, g_groundY+g_balloonRadius, g_lineZ-g_balloonRadius);
balloon.reset(new SgRbtNode(RigTForm(loc)));
balloon->addChild(shared_ptr<MyShapeNode>(new MyShapeNode(g_sphere, g_goldDiffuseMat,
Cvec3(0, 0, 0), Cvec3(0, 0, 0), Cvec3(g_balloonRadius, g_balloonRadius, g_balloonRadius))));
g_world->removeChild(g_groundNode);
g_world->addChild(balloon);
g_world->addChild(g_groundNode);
g_balloonNodes.push_back(balloon);
g_balloonVelocity.push_back(randomCvec3());
}
}
static void resizeBalloon() {
int i = g_balloonNodes.size();
RigTForm L;
for(auto it = g_balloonNodes.begin(); i > 0; i--, it++) {
RigTForm L = (*it)->getRbt();
(*it)->clearChild();
(*it)->addChild(shared_ptr<MyShapeNode>(new MyShapeNode(g_sphere, g_goldDiffuseMat,
Cvec3(0, 0, 0), Cvec3(0,0,0), Cvec3(g_balloonRadius, g_balloonRadius, g_balloonRadius))));
limitMotion(L, getPathAccumRbt(g_world,*it,1), g_balloonRadius, -g_roomDepth, g_lineZ);
(*it)->setRbt(L);
}
cout << "Balloon resized. New radius: " << g_balloonRadius << endl;
}
static RigTForm updateBalloon(RigTForm L, Cvec3& vel) {
Cvec3 pos = L.getTranslation();
pos += vel * g_timeStep * g_balloonVelocityScale;
if (pos[0]-g_balloonRadius < -g_roomWidth) {
pos[0] = -2*g_roomWidth-(pos[0]-g_balloonRadius)+g_balloonRadius;
vel[0] = -vel[0];
} else if (pos[0]+g_balloonRadius > g_roomWidth) {
pos[0] = 2*g_roomWidth-(pos[0]+g_balloonRadius)-g_balloonRadius;
vel[0] = -vel[0];
}
if (pos[1]-g_balloonRadius < g_groundY) {
pos[1] = 2*g_groundY-(pos[1]-g_balloonRadius)+g_balloonRadius;
vel[1] = -vel[1];
} else if (pos[1]+g_balloonRadius > g_ceilY) {
pos[1] = 2*g_ceilY-(pos[1]+g_balloonRadius)-g_balloonRadius;
vel[1] = -vel[1];
}
if (pos[2]-g_balloonRadius < -g_roomDepth) {
pos[2] = -2*g_roomDepth-(pos[2]-g_balloonRadius)+g_balloonRadius;
vel[2] = -vel[2];
} else if (pos[2]+g_balloonRadius > g_lineZ) {
pos[2] = 2*g_lineZ-(pos[2]+g_balloonRadius)-g_balloonRadius;
vel[2] = -vel[2];
}
L.setTranslation(pos);
return L;
}
static void updateBalloons() {
if (g_balloonMoving) {
vector<Cvec3>::iterator it2 = g_balloonVelocity.begin();
for(auto it = g_balloonNodes.begin(), end = g_balloonNodes.end(); it != end; it++) {
(*it)->setRbt(updateBalloon((*it)->getRbt(), *it2));
it2++;
}
}
}
// ------- Arcball
// returns object center in eye frame
static Cvec3 getArcballCenter() {
RigTForm pickedRbt = (g_currentPickedRbtNode) ? getPathAccumRbt(g_world, g_currentPickedRbtNode) : RigTForm();
Cvec3 center = (inv(getEyeRbt()) * pickedRbt).getTranslation();
return center;
}
static void updateArcballScale() {
double z = getArcballCenter()[2];
g_arcballScale = ((z < -CS175_EPS) ?
getScreenToEyeScale(z, g_frustFovY, g_windowHeight) : .01);
}
static void drawStuff(bool picking = false) {
if (!(g_mouseLClickButton && g_mouseRClickButton) && !g_mouseMClickButton)
updateArcballScale();
Uniforms uniforms;
// build & send proj. matrix to vshader
const Matrix4 projmat = makeProjectionMatrix();
sendProjectionMatrix(uniforms, projmat);
// use the correct eyeRbt from g_whichView
const RigTForm eyeRbt = getEyeRbt();
const RigTForm invEyeRbt = inv(eyeRbt);
const Cvec3 eyeLight1 = Cvec3(
invEyeRbt * Cvec4(getPathAccumRbt(g_world, g_light1Node).getTranslation(), 1));
const Cvec3 eyeLight2 = Cvec3(
invEyeRbt * Cvec4(getPathAccumRbt(g_world, g_light2Node).getTranslation(), 1));
uniforms.put("uLight", eyeLight1);
uniforms.put("uLight2", eyeLight2);
if (!picking) {
Drawer drawer(invEyeRbt, uniforms);
g_world->accept(drawer);
// draw spheres
if (g_currentPickedRbtNode && !g_arrowSetLaunchVelocity) {
Matrix4 MVM = rigTFormToMatrix(invEyeRbt * getPathAccumRbt(g_world, g_currentPickedRbtNode));
MVM = MVM * Matrix4::makeScale(Cvec3(g_arcballScale * g_arcballScreenRadius));
Matrix4 NMVM = normalMatrix(MVM);
sendModelViewNormalMatrix(uniforms, MVM, NMVM);
// safe_glUniform3f(uniforms.h_uColor, 155./255, 28./255, 49./255);
g_arcballMat->draw(*g_sphere, uniforms);
}
} else {
// intialize the picker with our uniforms, as opposed to curSS
Picker picker(invEyeRbt, uniforms);
// set overiding material to our picking material
g_overridingMaterial = g_pickingMat;
g_world->accept(picker);
// unset the overriding material
g_overridingMaterial.reset();
glFlush();
// The OpenGL framebuffer uses pixel units, but it reads mouse coordinates
// using point units. Most of the time these match, but on some hi-res
// screens there can be a scaling factor.
g_currentPickedRbtNode = picker.getRbtNodeAtXY(g_mouseClickX * g_wScale,
g_mouseClickY * g_hScale);
if ((g_currentPickedRbtNode != g_light1Node) && (g_currentPickedRbtNode != g_light2Node) && (g_currentPickedRbtNode != g_arrowNode))
g_currentPickedRbtNode = shared_ptr<SgRbtNode>(); // set to NULL
if ((g_currentPickedRbtNode == g_arrowNode) && g_arrowLock) {
g_currentPickedRbtNode = shared_ptr<SgRbtNode>();
cout << "Cannot manipulate arrow after it is launched" << endl;
}
if (g_currentPickedRbtNode) {
cout << "Part picked" << endl;
} else {
cout << "No part picked" << endl;
}
}
}
static void pick() {
// We need to set the clear color to black, for pick rendering.
// so let's save the clear color
GLdouble clearColor[4];
glGetDoublev(GL_COLOR_CLEAR_VALUE, clearColor);
glClearColor(0, 0, 0, 0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// No more glUseProgram
drawStuff(true); // no more curSS
// Uncomment below to see result of the pick rendering pass
// glfwSwapBuffers();
//Now set back the clear color
glClearColor(clearColor[0], clearColor[1], clearColor[2], clearColor[3]);
checkGlErrors();
}
static Cvec3 findArcballQuat(double x, double y, Cvec3 center) {
Cvec2 arcballScreenCenter = getScreenSpaceCoord(center, makeProjectionMatrix(),
g_frustNear, g_frustFovY, g_windowWidth, g_windowHeight);
Cvec3 v = Cvec3(x - arcballScreenCenter[0], y - arcballScreenCenter[1], 0);
double rxy2 = pow(v[0], 2) + pow(v[1], 2);
if (rxy2 < pow(g_arcballScreenRadius, 2)) {
v[2] = sqrt(pow(g_arcballScreenRadius, 2) - rxy2);
}
return v.normalize();
}
static RigTForm findArcballRbt(double dx, double dy, Cvec3 center) {
if (center[2] > -CS175_EPS) {
return RigTForm();
}
Cvec3 v1 = findArcballQuat(g_mouseClickX, g_mouseClickY, center);
Cvec3 v2 = findArcballQuat(g_mouseClickX + dx, g_mouseClickY + dy, center);
return RigTForm(Quat(0.,v2) * Quat(0.,-v1));
}
// -------- Display
static void updateWHScale() {
int screen_width, screen_height, pixel_width, pixel_height;
glfwGetWindowSize(g_window, &screen_width, &screen_height);
glfwGetFramebufferSize(g_window, &pixel_width, &pixel_height);
g_wScale = pixel_width / screen_width;
g_hScale = pixel_height / screen_height;
}
static void display() {
// No more glUseProgram
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
drawStuff(false); // no more curSS
glfwSwapBuffers(g_window);
checkGlErrors();
}
static void reshape(GLFWwindow * window, const int w, const int h) {
int width, height;
glfwGetFramebufferSize(g_window, &width, &height);
glViewport(0, 0, width, height);
g_arcballScreenRadius = .25 * min(g_windowWidth, g_windowHeight);
g_windowWidth = w;
g_windowHeight = h;
cerr << "Size of window is now " << g_windowWidth << "x" << g_windowHeight << endl;
//set arcball radius here
updateFrustFovY();
}
static RigTForm getM(const double dx, const double dy) {
RigTForm m;
Cvec3 center = getArcballCenter();
if (g_mouseLClickButton && !g_mouseRClickButton && !g_spaceDown) {
// left button down? (rotate)
if (!g_currentPickedRbtNode) {
return RigTForm(Quat::makeXRotation(-dy) * Quat::makeYRotation(dx));
} else {
// Cvec3 v1 = findArcballQuat(g_mouseClickX, g_mouseClickY, c);
// Cvec3 v2 = findArcballQuat(g_mouseClickX + dx, g_mouseClickY + dy, c);
return findArcballRbt(dx, dy, center);
}
} else {
double movementScale = (!g_currentPickedRbtNode) ? 0.01 : g_arcballScale;
if (g_mouseRClickButton && !g_mouseLClickButton) {
// right button down? (translate)
return RigTForm(Cvec3(dx, dy, 0) * movementScale);
} else if (g_mouseMClickButton ||
(g_mouseLClickButton && g_mouseRClickButton) ||
(g_mouseLClickButton && !g_mouseRClickButton && g_spaceDown)) {
// middle or (left and right, or left + space) button down? (zoom in and out)
return RigTForm(Cvec3(0, 0, -dy) * movementScale);
} else {
return RigTForm();
}
}
}
static void motion(GLFWwindow *window, double x, double y) {
const double dx = x - g_mouseClickX;
const double dy = g_windowHeight - y - 1 - g_mouseClickY;
// only manipulate if object is in front of me
// when object = view = cube, cannot rotate but can translate
// in intuitive direction, i.e. reversed
const RigTForm m = getM(dx, dy);
if (g_mouseClickDown) {
if (g_currentPickedRbtNode) { // manipulate object
if (g_arrowSetLaunchVelocity) {
g_arrowLaunchVelocity = min(max(0.0, g_arrowLaunchVelocity+dy*.01), (double)g_balloonSpeedMax);
} else {
RigTForm L = g_currentPickedRbtNode -> getRbt();
RigTForm CL1 = getPathAccumRbt(g_world,g_currentPickedRbtNode, 1);
RigTForm CL = CL1 * L;
const RigTForm A = transFact(CL) * linFact(getEyeRbt());
const RigTForm S_inv = inv(getPathAccumRbt(g_world,g_currentPickedRbtNode,1));
const RigTForm As = S_inv * A;
if (g_mouseLClickButton && !g_mouseRClickButton && !g_spaceDown) { // rotate
const RigTForm my = getM(dx, 0);
const RigTForm mx = getM(0, dy);
const RigTForm B = transFact(CL);
const RigTForm Bs = S_inv * B;
L = doMtoOwrtA(mx, L, As);
L = doMtoOwrtA(my, L, Bs);
} else { // translate
L = doMtoOwrtA(m, L, As);
}
Cvec3 t = (CL1 * L).getTranslation();
limitMotion(L, CL1, (g_currentPickedRbtNode == g_arrowNode) ?
g_arrowLength/2 : g_movementBuffer, g_lineZ);
g_currentPickedRbtNode -> setRbt(L);
}
} else { // manipulate sky
RigTForm L = g_skyNode -> getRbt();
if (g_mouseLClickButton && !g_mouseRClickButton && !g_spaceDown) {
const RigTForm mx = RigTForm(Quat::makeXRotation(dy));
const RigTForm my = RigTForm(Quat::makeYRotation(-dx));
if (g_skyCameraOrbit) {
// orbit around world's origin
L = my * L;
L = doMtoOwrtA(mx, L, linFact(L));
} else {
// ego motion
L = doMtoOwrtA(my, L, transFact(L)) * mx;
}
} else {
L = L * inv(m);
}
limitMotion(L);
g_skyNode -> setRbt(L);
}
}
g_mouseClickX = x;
g_mouseClickY = g_windowHeight - y - 1;
}
static void mouse(GLFWwindow *window, int button, int state, int mods) {
double x, y;
glfwGetCursorPos(window, &x, &y);
g_mouseClickX = x;
// conversion from window-coordinate-system to OpenGL window-coordinate-system
g_mouseClickY = g_windowHeight - y - 1;
g_mouseLClickButton |= (button == GLFW_MOUSE_BUTTON_LEFT && state == GLFW_PRESS);
g_mouseRClickButton |= (button == GLFW_MOUSE_BUTTON_RIGHT && state == GLFW_PRESS);
g_mouseMClickButton |= (button == GLFW_MOUSE_BUTTON_MIDDLE && state == GLFW_PRESS);
g_mouseLClickButton &= !(button == GLFW_MOUSE_BUTTON_LEFT && state == GLFW_RELEASE);
g_mouseRClickButton &= !(button == GLFW_MOUSE_BUTTON_RIGHT && state == GLFW_RELEASE);
g_mouseMClickButton &= !(button == GLFW_MOUSE_BUTTON_MIDDLE && state == GLFW_RELEASE);
g_mouseClickDown = g_mouseLClickButton || g_mouseRClickButton || g_mouseMClickButton;
if (g_pickingMode && g_mouseLClickButton) {
g_pickingMode = false;
pick();
cout << "Picking mode is off" << endl;
}
//glutPostRedisplay();
}
static void keyboard(GLFWwindow* window, int key, int scancode, int action, int mods) {
if (action == GLFW_PRESS || action == GLFW_REPEAT) {
switch (key) {
case GLFW_KEY_ESCAPE:
exit(0);
case GLFW_KEY_H:
cout << " ============== H E L P ==============\n\n"
<< "h\t\thelp menu\n"
<< "s\t\tsave screenshot\n"
<< "v\t\tCycle view\n"
<< "drag left mouse to rotate\n"
<< "drag right mouse to translate\n"
<< "see appendix in report.pdf for more\n"
<< endl;
break;
case GLFW_KEY_S:
glFlush();
writePpmScreenshot(g_windowWidth, g_windowHeight, "out.ppm");
break;
case GLFW_KEY_SPACE:
g_spaceDown = true;
break;
case GLFW_KEY_V:
updateActiveEye();
break;
case GLFW_KEY_M:
g_skyCameraOrbit = not g_skyCameraOrbit;
cout << "Editing sky eye w.r.t. ";
if (g_skyCameraOrbit) {
cout << "world-sky";
} else {
cout << "sky-sky";
}
cout << " frame" << endl;
break;
case GLFW_KEY_P:
if (g_arrowSetLaunchVelocity) {
cout << "Picking mode unavailable when setting arrow power" << endl;
} else {
g_pickingMode = true;
cout << "Picking mode is on" << endl;
}
break;
case GLFW_KEY_G:
generateBalloon();
cout << "New balloon generated. # Balloons = " << g_balloonNodes.size() << endl;
break;
case GLFW_KEY_F:
generateBalloon(20);
cout << "New balloons generated. # Balloons = " << g_balloonNodes.size() << endl;
break;
case GLFW_KEY_R:
if (g_arrowLock) {
cout << "Cannot reset when arrow in motion." << endl;
} else
resetScene();
cout << "Arrow and sky node reset." << endl;
break;
case GLFW_KEY_L:
cout << "Prepare for launch! Drag up to boost launch power, or drag down to reduce it." << endl;
g_arrowLaunchVelocity = 0.0;
g_arrowLock = true;
g_arrowSetLaunchVelocity = true;
g_currentPickedRbtNode = g_arrowNode;
break;
case GLFW_KEY_A:
if (g_arrowLaunchVelocity > CS175_EPS) {
cout << "... and arrow launched! Let's see how this one goes" << endl;
g_arrowVelocity = -rigTFormToMatrix(getPathAccumRbt(g_world,g_arrowNode)).getBasis(2).normalize()*g_arrowLaunchVelocity;
g_arrowSetLaunchVelocity = false;
g_currentPickedRbtNode = shared_ptr<SgRbtNode>();
} else {
cout << "Your arrow has no power. Press [L] and drag to adjust power" << endl;
}
break;
case GLFW_KEY_N:
cout << "Balloon " << (g_balloonMoving ? "paused" : "moving") << endl;
g_balloonMoving = not g_balloonMoving;
break;
case GLFW_KEY_UP:
if (g_balloonRadius * g_incrementRatio < g_roomMinDim/2) {
g_balloonRadius *= g_incrementRatio;
resizeBalloon();
} else
cout << "Max balloon size reached" << endl;
break;
case GLFW_KEY_DOWN:
if (g_balloonRadius > g_incrementRatio * g_arrowWidth) {
g_balloonRadius /= g_incrementRatio;
resizeBalloon();
} else
cout << "Min balloon size reached" << endl;
break;
case GLFW_KEY_RIGHT:
if (g_balloonVelocityScale*g_incrementRatio < g_balloonSpeedMax) {
g_balloonVelocityScale *= g_incrementRatio;
cout << "Balloon velocity: " << g_balloonVelocityScale << endl;
} else
cout << "Max balloon velocity reached" << endl;
break;
case GLFW_KEY_LEFT:
if (g_balloonVelocityScale > g_balloonSpeedMin*g_incrementRatio) {
g_balloonVelocityScale /= g_incrementRatio;
cout << "Balloon velocity: " << g_balloonVelocityScale << endl;
} else
cout << "Min balloon velocity reached" << endl;
break;
case GLFW_KEY_EQUAL: // <
if (g_arrowWidth*g_incrementRatio < g_arrowWidthMax) {
g_arrowWidth *= g_incrementRatio;
cout << "Arrow width: " << g_arrowWidth << endl;
rescaleArrow();
} else
cout << "Max arrow width reached" << endl;
break;
case GLFW_KEY_MINUS: // <
if (g_arrowWidth > g_arrowWidthMin*g_incrementRatio) {
g_arrowWidth /= g_incrementRatio;
cout << "Arrow width: " << g_arrowWidth << endl;
rescaleArrow();
} else
cout << "Min arrow width reached" << endl;
break;
case GLFW_KEY_Q:
if (g_arrowSetLaunchVelocity) {
cout << "Current arrow launch velocity: " << g_arrowLaunchVelocity << endl;
}
break;
}
} else {
switch (key) {
case GLFW_KEY_SPACE:
g_spaceDown = false;
break;
}
}
}
void error_callback(int error, const char* description) {
fprintf(stderr, "Error: %s\n", description);
}
static void initGlfwState() {
glfwInit();
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
glfwWindowHint(GLFW_SRGB_CAPABLE, GL_TRUE);
g_window = glfwCreateWindow(g_windowWidth, g_windowHeight,
"Pop the Balloons!", NULL, NULL);
if (!g_window) {
fprintf(stderr, "Failed to create GLFW window or OpenGL context\n");
exit(1);
}
glfwMakeContextCurrent(g_window);
updateWHScale();
glfwSwapInterval(1);
glfwSetErrorCallback(error_callback);
glfwSetMouseButtonCallback(g_window, mouse);
glfwSetCursorPosCallback(g_window, motion);
glfwSetWindowSizeCallback(g_window, reshape);
glfwSetKeyCallback(g_window, keyboard);
}
static void initGLState() {
glClearColor(205. / 255., 189. / 255., 162. / 255., 0.);
glClearDepth(0.);
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_GREATER);
glReadBuffer(GL_BACK);
if (!g_Gl2Compatible)
glEnable(GL_FRAMEBUFFER_SRGB);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
static void initMaterials() {
// Create some prototype materials
Material diffuse("./shaders/basic-gl3.vshader", "./shaders/diffuse-gl3.fshader");
Material solid("./shaders/basic-gl3.vshader", "./shaders/solid-gl3.fshader");
// copy diffuse prototype and set red color
g_goldDiffuseMat.reset(new Material(diffuse));
g_goldDiffuseMat->getUniforms().put("uColor", Cvec3f(165./255, 124./255, 0./255));
// copy diffuse prototype and set blue color
g_blueDiffuseMat.reset(new Material(diffuse));
g_blueDiffuseMat->getUniforms().put("uColor", Cvec3f(1./255, 1./255, 136./255));
// normal mapping material
g_bumpFloorMat.reset(new Material("./shaders/normal-gl3.vshader", "./shaders/normal-gl3.fshader"));
g_bumpFloorMat->getUniforms().put("uTexColor", shared_ptr<ImageTexture>(new ImageTexture("Fieldstone.ppm", true)));
g_bumpFloorMat->getUniforms().put("uTexNormal", shared_ptr<ImageTexture>(new ImageTexture("FieldstoneNormal.ppm", false)));
// copy solid prototype, and set to wireframed rendering
g_arcballMat.reset(new Material(solid));
g_arcballMat->getUniforms().put("uColor", Cvec3f(0.27f, 0.82f, 0.35f));
g_arcballMat->getRenderStates().polygonMode(GL_FRONT_AND_BACK, GL_LINE);
// copy solid prototype, and set to color white
g_lightMat.reset(new Material(solid));
g_lightMat->getUniforms().put("uColor", Cvec3f(1, 1, 1));
// pick shader
g_pickingMat.reset(new Material("./shaders/basic-gl3.vshader", "./shaders/pick-gl3.fshader"));
// transparent screen shader
g_transMat.reset(new Material("./shaders/basic-gl3.vshader", "./shaders/transparent-gl3.fshader"));
g_transMat->getUniforms().put("uColor", Cvec4f(0.50f, 0.f, 0.f, 0.2f));
// g_transMat->getUniforms().put("uAlpha", 0.0f);
};
static void initGeometry() {
initGround();
initCubes();
initSphere();
}
static void initScene() {
g_world.reset(new SgRootNode());
resetScene();
g_balloonRadius = g_movementBuffer;
g_currScore = 0;
g_groundNode.reset(new SgRbtNode());
g_groundNode->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_ground, g_bumpFloorMat, Cvec3(0, g_groundY, 0))));
g_groundNode->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_ground, g_bumpFloorMat, Cvec3(0, g_ceilY, 0), Cvec3(90, 90, 90))));
g_groundNode->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_ground, g_bumpFloorMat, Cvec3(-g_roomWidth, (g_ceilY+g_groundY)/2, 0), Cvec3(0, 0, -90))));
g_groundNode->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_ground, g_bumpFloorMat, Cvec3(g_roomWidth, (g_ceilY+g_groundY)/2, 0), Cvec3(0, 0, 90))));
g_groundNode->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_ground, g_bumpFloorMat, Cvec3(0, (g_ceilY+g_groundY)/2, -g_roomDepth), Cvec3(90, 0, 0))));
g_groundNode->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_ground, g_bumpFloorMat, Cvec3(0, (g_ceilY+g_groundY)/2, g_roomDepth), Cvec3(-90, 0, 0))));
g_groundNode->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_ground, g_transMat, Cvec3(0, (g_ceilY+g_groundY)/2, g_lineZ), Cvec3(90, 0, 0))));
g_groundNode->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_ground, g_transMat, Cvec3(0, (g_ceilY+g_groundY)/2, g_lineZ), Cvec3(-90, 0, 0))));
g_light1Node.reset(new SgRbtNode(RigTForm(Cvec3(-g_roomWidth+g_movementBuffer, g_ceilY-g_movementBuffer, g_lineZ+g_movementBuffer))));
g_light1Node->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_sphere, g_lightMat, Cvec3(0, 0, 0))));
g_light2Node.reset(new SgRbtNode(RigTForm(Cvec3(g_roomWidth-g_movementBuffer, g_ceilY-g_movementBuffer, g_lineZ+g_movementBuffer))));
g_light2Node->addChild(shared_ptr<MyShapeNode>(
new MyShapeNode(g_sphere, g_lightMat, Cvec3(0, 0, 0))));
g_world->addChild(g_light1Node);
g_world->addChild(g_light2Node);
g_world->addChild(g_groundNode);
}
static void glfwLoop() {
g_lastFrameClock = glfwGetTime();
while (!glfwWindowShouldClose(g_window)) {
double thisTime = glfwGetTime();
if( thisTime - g_lastFrameClock >= 1. / g_framesPerSecond) {
// animationUpdate();
// hairsSimulationUpdate();
updateArrow();
updateBalloons();
display();
g_lastFrameClock = thisTime;
}
glfwPollEvents();
}
}
int main(int argc, char *argv[]) {
try {
initGlfwState();
glewInit(); // load the OpenGL extensions
#ifndef __MAC__
if ((!g_Gl2Compatible) && !GLEW_VERSION_3_0)
throw runtime_error("Error: card/driver does not support OpenGL "
"Shading Language v1.3");
else if (g_Gl2Compatible && !GLEW_VERSION_2_0)
throw runtime_error("Error: card/driver does not support OpenGL "
"Shading Language v1.0");
#endif
cout << (g_Gl2Compatible ? "Will use OpenGL 2.x / GLSL 1.0"
: "Will use OpenGL 3.x / GLSL 1.5")
<< endl;
initGLState();
initMaterials();
initGeometry();
initScene();
glfwLoop();
return 0;
} catch (const runtime_error &e) {
cout << "Exception caught: " << e.what() << endl;
return -1;
}
}
| 38.376812 | 146 | 0.628701 | [
"mesh",
"geometry",
"object",
"vector",
"solid"
] |
92f56b1a8ec5ba1952494556589d81ca64fbe9e8 | 2,214 | cpp | C++ | src/test/interface/io/json/json_data_handler_test.cpp | jtimonen/cmdstan | 8c1e014ed28b4ac3b0f8acc676a4508d07ab8f10 | [
"BSD-3-Clause"
] | 1 | 2021-06-23T15:21:15.000Z | 2021-06-23T15:21:15.000Z | src/test/interface/io/json/json_data_handler_test.cpp | jtimonen/cmdstan | 8c1e014ed28b4ac3b0f8acc676a4508d07ab8f10 | [
"BSD-3-Clause"
] | 2 | 2021-03-17T20:28:05.000Z | 2021-03-20T16:07:31.000Z | src/test/interface/io/json/json_data_handler_test.cpp | jtimonen/cmdstan | 8c1e014ed28b4ac3b0f8acc676a4508d07ab8f10 | [
"BSD-3-Clause"
] | 1 | 2021-04-27T13:58:58.000Z | 2021-04-27T13:58:58.000Z | #include <cmdstan/io/json/json_data.hpp>
#include <cmdstan/io/json/json_data_handler.hpp>
#include <cmdstan/io/json/json_error.hpp>
#include <cmdstan/io/json/json_handler.hpp>
#include <cmdstan/io/json/rapidjson_parser.hpp>
#include <gtest/gtest.h>
void test_rtl_2_ltr(size_t idx_rtl, size_t idx_ltr,
const std::vector<size_t> &dims) {
cmdstan::json::vars_map_r vars_r;
cmdstan::json::vars_map_i vars_i;
cmdstan::json::json_data_handler handler(vars_r, vars_i);
size_t idx = handler.convert_offset_rtl_2_ltr(idx_rtl, dims);
EXPECT_EQ(idx, idx_ltr);
}
void test_exception(size_t idx_rtl, const std::string &exception_text,
const std::vector<size_t> &dims) {
cmdstan::json::vars_map_r vars_r;
cmdstan::json::vars_map_i vars_i;
cmdstan::json::json_data_handler handler(vars_r, vars_i);
try {
handler.convert_offset_rtl_2_ltr(idx_rtl, dims);
} catch (const std::exception &e) {
EXPECT_EQ(e.what(), exception_text);
return;
}
FAIL(); // didn't throw an exception as expected.
}
TEST(ioJson, rtl_2_ltr_1) {
std::vector<size_t> dims(1);
dims[0] = 7;
test_rtl_2_ltr(0, 0, dims);
test_rtl_2_ltr(1, 1, dims);
test_rtl_2_ltr(2, 2, dims);
test_rtl_2_ltr(3, 3, dims);
test_rtl_2_ltr(4, 4, dims);
test_rtl_2_ltr(5, 5, dims);
test_rtl_2_ltr(6, 6, dims);
}
// row major:
// 11 12 13 14 21 22 23 24
// column major:
// 11 21 12 22 13 23 14 24
TEST(ioJson, rtl_2_ltr_2) {
std::vector<size_t> dims(2);
dims[0] = 2;
dims[1] = 4;
test_rtl_2_ltr(0, 0, dims);
test_rtl_2_ltr(1, 2, dims);
test_rtl_2_ltr(2, 4, dims);
test_rtl_2_ltr(3, 6, dims);
test_rtl_2_ltr(4, 1, dims);
test_rtl_2_ltr(5, 3, dims);
test_rtl_2_ltr(6, 5, dims);
test_rtl_2_ltr(7, 7, dims);
}
TEST(ioJson, rtl_2_ltr_err_1) {
std::vector<size_t> dims(1);
dims[0] = 7;
test_exception(7, "variable: , unexpected error", dims);
}
TEST(ioJson, rtl_2_ltr_err_2) {
std::vector<size_t> dims(2);
dims[0] = 2;
dims[1] = 4;
test_exception(8, "variable: , unexpected error", dims);
}
TEST(ioJson, rtl_2_ltr_err_3n) {
std::vector<size_t> dims(2);
dims[0] = 2;
dims[1] = 4;
test_exception(11, "variable: , unexpected error", dims);
}
| 27 | 70 | 0.677958 | [
"vector"
] |
92f76d3df74dfdbe05372f9751d0cb91f0dfe51a | 10,605 | cpp | C++ | core/interface/engine.cpp | Rod-Lin/Ink | 527b258afc35b3d2a723d198c54cfb57bdaac127 | [
"MIT"
] | 1 | 2016-01-01T02:23:55.000Z | 2016-01-01T02:23:55.000Z | core/interface/engine.cpp | Rod-Lin/Ink | 527b258afc35b3d2a723d198c54cfb57bdaac127 | [
"MIT"
] | null | null | null | core/interface/engine.cpp | Rod-Lin/Ink | 527b258afc35b3d2a723d198c54cfb57bdaac127 | [
"MIT"
] | null | null | null | #include "engine.h"
#include "core/hash.h"
#include "core/object.h"
#include "core/expression.h"
#include "core/general.h"
#include "core/syntax/syntax.h"
#include "core/native/native.h"
#include "core/thread/thread.h"
#include "core/gc/collect.h"
namespace ink {
pthread_mutex_t ink_native_exp_list_lock = PTHREAD_MUTEX_INITIALIZER;
Ink_ExpressionList ink_native_exp_list;
void Ink_initNativeExpression()
{
ink_native_exp_list = Ink_ExpressionList();
return;
}
void Ink_cleanNativeExpression()
{
unsigned int i;
pthread_mutex_lock(&ink_native_exp_list_lock);
for (i = 0; i < ink_native_exp_list.size(); i++) {
delete ink_native_exp_list[i];
}
pthread_mutex_unlock(&ink_native_exp_list_lock);
return;
}
void Ink_insertNativeExpression(Ink_ExpressionList::iterator begin,
Ink_ExpressionList::iterator end)
{
pthread_mutex_lock(&ink_native_exp_list_lock);
ink_native_exp_list.insert(ink_native_exp_list.end(), begin, end);
pthread_mutex_unlock(&ink_native_exp_list_lock);
return;
}
void Ink_addNativeExpression(Ink_Expression *expr)
{
pthread_mutex_lock(&ink_native_exp_list_lock);
ink_native_exp_list.push_back(expr);
pthread_mutex_unlock(&ink_native_exp_list_lock);
return;
}
Ink_InterpreteEngine::Ink_InterpreteEngine()
{
// gc_lock.init();
Ink_Object *tmp, *obj_proto;
Ink_ContextObject *global;
igc_collect_threshold = igc_collect_threshold_unit = IGC_COLLECT_THRESHOLD_UNIT;
igc_mark_period = MARK_RES_LAST;
igc_global_ret_val = NULL;
igc_pardon_list = Ink_PardonList();
igc_grey_list = IGC_GreyList();
error_mode = INK_ERRMODE_DEFAULT;
input_file_path = NULL;
current_file_name = NULL;
current_line_number = -1;
trace = NULL;
interrupt_signal = INTER_NONE;
interrupt_value = NULL;
coro_tmp_engine = NULL;
coro_scheduler_stack = Ink_SchedulerStack();
dbg_print_detail = false;
dbg_max_trace = DBG_DEFAULT_MAX_TRACE;
protocol_map = Ink_ProtocolMap();
pthread_mutex_init(&message_lock, NULL);
message_queue = Ink_ActorMessageQueue();
pthread_mutex_init(&watcher_lock, NULL);
watcher_list = Ink_ActorWatcherList();
custom_interrupt_signal = Ink_CustomInterruptSignal();
custom_destructor_queue = Ink_CustomDestructorQueue();
custom_engine_com_map = Ink_CustomEngineComMap();
initThread();
initTypeMapping();
initPrintDebugInfo();
initPrototypeSearch();
initGCCollect();
const_table = Ink_ConstantTable();
gc_engine = new IGC_CollectEngine(this);
setCurrentGC(gc_engine);
global_context = new Ink_ContextChain(new Ink_ContextObject(this));
global = global_context->getGlobal();
// gc_engine->initContext(global_context);
global->setSlot_c("$object", obj_proto = new Ink_Object(this));
setTypePrototype(INK_OBJECT, obj_proto);
global->setProto(obj_proto);
global->setSlot_c("$function", tmp = new Ink_FunctionObject(this));
setTypePrototype(INK_FUNCTION, tmp);
tmp->setProto(obj_proto);
tmp->derivedMethodInit(this);
obj_proto->derivedMethodInit(this);
global->setSlot_c("$exp_list", tmp = new Ink_ExpListObject(this));
setTypePrototype(INK_EXPLIST, tmp);
tmp->setProto(obj_proto);
tmp->derivedMethodInit(this);
global->setSlot_c("$numeric", tmp = new Ink_Numeric(this, Ink_NumericValue()));
setTypePrototype(INK_NUMERIC, tmp);
tmp->setProto(obj_proto);
tmp->derivedMethodInit(this);
global->setSlot_c("$string", tmp = new Ink_String(this, ""));
setTypePrototype(INK_STRING, tmp);
tmp->setProto(obj_proto);
tmp->derivedMethodInit(this);
global->setSlot_c("$array", tmp = new Ink_Array(this));
setTypePrototype(INK_ARRAY, tmp);
tmp->setProto(obj_proto);
tmp->derivedMethodInit(this);
global->setSlot_c("self", global);
global->setSlot_c("top", global);
global->setSlot_c("let", global);
global->setSlot_c("auto", tmp = new Ink_Object(this));
tmp->setSlot_c("missing", new Ink_FunctionObject(this, InkNative_Auto_Missing_i));
// global->setSlot_c("fix", tmp = new Ink_Object(this));
// tmp->setSlot_c("missing", new Ink_FunctionObject(this, InkNative_Fix_Missing_i));
Ink_GlobalMethodInit(this, global_context);
global->setDebugName("__global_context__");
addTrace(global)->setDebug("<root engine>", -1, global);
}
Ink_ContextChain_sub *Ink_InterpreteEngine::addTrace(Ink_ContextObject *context)
{
if (!trace) return (trace = new Ink_ContextChain(context))->head;
return trace->addContext(context);
}
void Ink_InterpreteEngine::removeLastTrace()
{
if (trace)
trace->removeLast();
return;
}
void Ink_InterpreteEngine::removeTrace(Ink_ContextObject *context)
{
trace->removeContext(context);
return;
}
inline void setArgv(Ink_InterpreteEngine *engine, vector<char *> argv)
{
unsigned int i;
Ink_Array *val = new Ink_Array(engine);
for (i = 0; i < argv.size(); i++) {
val->value.push_back(new Ink_HashTable(new Ink_String(engine, string(argv[i])), val));
}
engine->global_context->getGlobal()->setSlot(INK_ARGV_NAME, val);
return;
}
void Ink_InterpreteEngine::startParse(Ink_InputSetting setting)
{
InkParser_lockParseLock();
Ink_InterpreteEngine *backup = InkParser_getParseEngine();
InkParser_setParseEngine(this);
setFilePath(setting.getFilePath());
input_mode = INK_FILE_INPUT;
// CGC_code_mode = setting.getMode();
// cleanTopLevel();
top_level = Ink_ExpressionList();
yyin = setting.getInput();
yyparse();
yylex_destroy();
setting.clean();
InkParser_setParseEngine(backup);
InkParser_unlockParseLock();
setArgv(this, setting.getArgument());
return;
}
void Ink_InterpreteEngine::startParse(FILE *input, bool close_fp)
{
InkParser_lockParseLock();
Ink_InterpreteEngine *backup = InkParser_getParseEngine();
InkParser_setParseEngine(this);
input_mode = INK_FILE_INPUT;
// cleanTopLevel();
top_level = Ink_ExpressionList();
yyin = input;
yyparse();
yylex_destroy();
if (close_fp) fclose(input);
InkParser_setParseEngine(backup);
InkParser_unlockParseLock();
return;
}
void Ink_InterpreteEngine::startParse(string code)
{
InkParser_lockParseLock();
Ink_InterpreteEngine *backup = InkParser_getParseEngine();
InkParser_setParseEngine(this);
const char **input = (const char **)malloc(2 * sizeof(char *));
input[0] = code.c_str();
input[1] = NULL;
input_mode = INK_STRING_INPUT;
// cleanTopLevel();
top_level = Ink_ExpressionList();
Ink_setStringInput(input);
yyparse();
yylex_destroy();
free(input);
InkParser_setParseEngine(backup);
InkParser_unlockParseLock();
return;
}
Ink_Object *Ink_InterpreteEngine::execute(Ink_ContextChain *context, bool if_trap_signal)
{
char *current_dir = NULL, *redirect = NULL;
Ink_InterpreteEngine *engine = this;
if (getFilePath()) {
current_dir = getCurrentDir();
redirect = getBasePath(getFilePath());
if (redirect) {
changeDir(redirect);
free(redirect);
}
}
Ink_Object *ret = NULL_OBJ;
Ink_ContextObject *local = NULL;
unsigned int i;
const char *tmp_sig_name = NULL;
string *tmp_str = NULL;
Ink_ExceptionRaw *tmp_ex = NULL;
if (!context) context = global_context;
local = context->getLocal();
for (i = 0; i < top_level.size(); i++) {
getCurrentGC()->checkGC();
ret = top_level[i]->eval(this, context);
if (getSignal() != INTER_NONE) {
/* interrupt event triggered */
Ink_FunctionObject::triggerInterruptEvent(engine, context, local, local);
if (getSignal() == INTER_NONE) continue;
if (getSignal() < INTER_LAST) {
tmp_sig_name = getNativeSignalName(interrupt_signal);
} else {
if ((tmp_str = getCustomInterruptSignalName(interrupt_signal)) != NULL) {
tmp_sig_name = tmp_str->c_str();
} else {
tmp_sig_name = "<unregistered>";
}
}
if (getSignal() != INTER_EXIT)
InkWarn_Trapping_Untrapped_Signal(engine, tmp_sig_name);
ret = getInterruptValue();
if (getSignal() == INTER_THROW) {
if (!broadcastWatcher("error exit", tmp_ex = Ink_ExceptionRaw::toRaw(ret))) {
delete tmp_ex;
}
}
if (if_trap_signal) {
trapSignal();
}
break;
}
}
if (current_dir) {
changeDir(current_dir);
free(current_dir);
}
return ret;
}
Ink_Object *Ink_InterpreteEngine::execute(Ink_Expression *exp)
{
Ink_Object *ret;
Ink_ContextChain *context = NULL;
if (!context) context = global_context;
getCurrentGC()->checkGC();
ret = exp->eval(this, context);
return ret;
}
void Ink_InterpreteEngine::cleanExpressionList(Ink_ExpressionList exp_list)
{
unsigned int i;
for (i = 0; i < exp_list.size(); i++) {
delete exp_list[i];
}
return;
}
void Ink_InterpreteEngine::cleanContext(Ink_ContextChain *context)
{
delete context;
return;
}
// from engine inline
Ink_InterruptSignal Ink_InterpreteEngine::getCustomInterruptSignal(string id)
{
Ink_CustomInterruptSignal::iterator sig_iter;
for (sig_iter = custom_interrupt_signal.begin();
sig_iter != custom_interrupt_signal.end(); sig_iter++) {
if (id == **sig_iter)
return sig_iter - custom_interrupt_signal.begin() + 1 + INTER_LAST;
}
return 0;
}
bool Ink_InterpreteEngine::deleteCustomInterruptSignal(string id)
{
Ink_CustomInterruptSignal::iterator sig_iter;
for (sig_iter = custom_interrupt_signal.begin();
sig_iter != custom_interrupt_signal.end(); sig_iter++) {
if (id == **sig_iter) {
delete *sig_iter;
custom_interrupt_signal.erase(sig_iter);
return true;
}
}
return false;
}
void Ink_InterpreteEngine::disposeCustomInterruptSignal()
{
Ink_CustomInterruptSignal::iterator sig_iter;
for (sig_iter = custom_interrupt_signal.begin();
sig_iter != custom_interrupt_signal.end(); sig_iter++) {
delete *sig_iter;
}
return;
}
void Ink_InterpreteEngine::breakUnreachableBonding(Ink_HashTable *to_or_from)
{
IGC_BondingMap::iterator bond_iter;
for (bond_iter = igc_bonding_map.begin();
bond_iter != igc_bonding_map.end();) {
if (bond_iter->first == to_or_from) {
igc_bonding_map.erase(bond_iter++);
} else if (bond_iter->second == to_or_from) {
InkWarn_Unreachable_Bonding(this);
bond_iter->first->setBonding(this, NULL, false);
getCurrentGC()->doMark(getInterruptValue());
igc_bonding_map.erase(bond_iter++);
} else {
bond_iter++;
}
}
return;
}
void Ink_InterpreteEngine::callAllDestructor()
{
Ink_CustomDestructorQueue::size_type i;
for (i = 0; i < custom_destructor_queue.size(); i++) {
custom_destructor_queue[i].destruct_func(this, custom_destructor_queue[i].arg);
}
return;
}
Ink_InterpreteEngine::~Ink_InterpreteEngine()
{
callAllDestructor();
disposeAllMessage();
gc_engine->collectGarbage(true);
delete gc_engine;
disposeConstant();
cleanExpressionList(top_level);
cleanContext(global_context);
cleanContext(trace);
disposeTypeMapping();
disposeCustomInterruptSignal();
}
}
| 24.267735 | 89 | 0.745403 | [
"object",
"vector"
] |
92f99df985e2a82101db1e31a81294add6100bc1 | 3,126 | cpp | C++ | tests/cpp/3SumClosest/3SumClosest.cpp | zlc18/LocalJudge | e8b141d2e80087d447a45cce36bac27b4ddb9cd1 | [
"MIT"
] | null | null | null | tests/cpp/3SumClosest/3SumClosest.cpp | zlc18/LocalJudge | e8b141d2e80087d447a45cce36bac27b4ddb9cd1 | [
"MIT"
] | null | null | null | tests/cpp/3SumClosest/3SumClosest.cpp | zlc18/LocalJudge | e8b141d2e80087d447a45cce36bac27b4ddb9cd1 | [
"MIT"
] | null | null | null | // Source : https://oj.leetcode.com/problems/3sum-closest/
// Author : Hao Chen
// Date : 2014-07-03
/**********************************************************************************
*
* Given an array S of n integers, find three integers in S such that the sum is
* closest to a given number, target. Return the sum of the three integers.
* You may assume that each input would have exactly one solution.
*
* For example, given array S = {-1 2 1 -4}, and target = 1.
*
* The sum that is closest to the target is 2. (-1 + 2 + 1 = 2).
*
*
**********************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
#define INT_MAX 2147483647
//solution: http://en.wikipedia.org/wiki/3SUM
//the idea as blow:
// 1) sort the array.
// 2) take the element one by one, calculate the two numbers in reset array.
//
//notes: be careful the duplication number.
//
// for example:
// [-4,-1,-1,1,2] target=1
//
// take -4, can cacluate the "two number problem" of the reset array [-1,-1,1,2] while target=5
// [(-4),-1,-1,1,2] target=5 distance=4
// ^ ^
// because the -1+2 = 1 which < 5, then move the `low` pointer(skip the duplication)
// [(-4),-1,-1,1,2] target=5 distance=2
// ^ ^
// take -1(skip the duplication), can cacluate the "two number problem" of the reset array [1,2] while target=2
// [-4,-1,(-1),1,2] target=2 distance=1
// ^ ^
int threeSumClosest(vector<int> &num, int target) {
//sort the array
sort(num.begin(), num.end());
int n = num.size();
int distance = INT_MAX;
int result;
for (int i=0; i<n-2; i++) {
//skip the duplication
if (i>0 && num[i-1]==num[i]) continue;
int a = num[i];
int low = i+1;
int high = n-1;
//convert the 3sum to 2sum problem
while ( low < high ) {
int b = num[low];
int c = num[high];
int sum = a+b+c;
if (sum - target == 0) {
//got the final soultion
return target;
} else {
//tracking the minmal distance
if (abs(sum-target) < distance ) {
distance = abs(sum - target);
result = sum;
}
if (sum -target> 0) {
//skip the duplication
while(high>0 && num[high]==num[high-1]) high--;
//move the `high` pointer
high--;
} else {
//skip the duplication
while(low<n && num[low]==num[low+1]) low++;
//move the `low` pointer
low++;
}
}
}
}
return result;
}
int main()
{
int a[] = {-1, 2, 1, -4};
vector<int> n(a, a+sizeof(a)/sizeof(int));
int target = 1;
cout << threeSumClosest(n, target) << endl;
return 0;
}
| 29.771429 | 114 | 0.478887 | [
"vector"
] |
92fb04d8401398b5a1267a0ebb3c9618a589595b | 12,619 | cpp | C++ | visa/iga/IGALibrary/Models/Models.cpp | isabella232/intel-graphics-compiler | 1e6e958a2988022e5c67313cbafac855bff2cab0 | [
"MIT"
] | null | null | null | visa/iga/IGALibrary/Models/Models.cpp | isabella232/intel-graphics-compiler | 1e6e958a2988022e5c67313cbafac855bff2cab0 | [
"MIT"
] | 1 | 2021-02-24T08:39:15.000Z | 2021-02-24T08:39:15.000Z | visa/iga/IGALibrary/Models/Models.cpp | isabella232/intel-graphics-compiler | 1e6e958a2988022e5c67313cbafac855bff2cab0 | [
"MIT"
] | null | null | null | #include "Models.hpp"
// this must precede model*.hpp inclusion below
#include "../strings.hpp"
// for bxml/Model operand type mappings
#define TYPE(T) \
ENUM_BITSET_VALUE(T, uint32_t)
#include "bxml/Model7P5.hpp"
#include "bxml/Model8.hpp"
#include "bxml/Model9.hpp"
#include "bxml/Model10.hpp"
#include "bxml/Model11.hpp"
#include "bxml/Model12P1.hpp"
#include "../bits.hpp"
#include "../Backend/Native/MInst.hpp"
#include <sstream>
#include <iostream>
using namespace iga;
// full "constructor"
#define UNWRAP_TUPLE(...) {__VA_ARGS__}
#define IGA_REGISTER_SPEC(\
PLAT_LO,PLAT_HI,\
REGNAME,SYNTAX,DESCRIPTION,\
REGNUM7_4,REGNUM_BASE,\
ACC_GRAN,\
NUM_REGS,NUM_BYTE_PER_REG) \
{REGNAME,SYNTAX,DESCRIPTION,REGNUM7_4,REGNUM_BASE,PLAT_LO,PLAT_HI,ACC_GRAN,NUM_REGS,UNWRAP_TUPLE NUM_BYTE_PER_REG}
// for <= some platform (whatever our lowest platform is
#define IGA_REGISTER_SPEC_LE(PLAT_HI,REGNAME,SYNTAX,DESCRIPTION,REGNUM7_4,REGNUM_BASE,ACC_GRAN,NUM_REGS,NUM_BYTE_PER_REG) \
IGA_REGISTER_SPEC(Platform::GEN6,PLAT_HI,REGNAME,SYNTAX,DESCRIPTION,REGNUM7_4,REGNUM_BASE,ACC_GRAN,NUM_REGS,NUM_BYTE_PER_REG)
// for >= some platform (up to the highest)
#define IGA_REGISTER_SPEC_GE(PLAT_LO,REGNAME,SYNTAX,DESCRIPTION,REGNUM7_4,REGNUM_BASE,ACC_GRAN,NUM_REGS,NUM_BYTE_PER_REG) \
IGA_REGISTER_SPEC(PLAT_LO,Platform::GENNEXT,REGNAME,SYNTAX,DESCRIPTION,REGNUM7_4,REGNUM_BASE,ACC_GRAN,NUM_REGS,NUM_BYTE_PER_REG)
// a specification valid on all platforms
#define IGA_REGISTER_SPEC_UNIFORM(REGNAME,SYNTAX,DESCRIPTION,REGNUM7_4,REGNUM_BASE,ACC_GRAN,NUM_REGS,NUM_BYTE_PER_REG) \
IGA_REGISTER_SPEC(Platform::GEN6,Platform::GENNEXT,REGNAME,SYNTAX,DESCRIPTION,REGNUM7_4,REGNUM_BASE,ACC_GRAN,NUM_REGS,NUM_BYTE_PER_REG)
// ordered by encoding of RegNum[7:4]
// newest platforms first
static const struct RegInfo REGISTER_SPECIFICATIONS[] = {
IGA_REGISTER_SPEC_LE(
Platform::GEN11,
RegName::GRF_R, "r", "General",
0, 0,
1,
128,(0)),
IGA_REGISTER_SPEC_GE(
Platform::GEN12P1,
RegName::GRF_R, "r", "General",
0,0, // regNum7_4, regNumBase
1, // accGran
256,(0)),
IGA_REGISTER_SPEC_UNIFORM(
RegName::ARF_NULL, "null", "Null",
0x0, 0,
0,
0, (32)),
IGA_REGISTER_SPEC_UNIFORM(RegName::ARF_A, "a", "Index",
0x1, 0,
2,
1, (32)),
// acc and mme share same RegNum[7:4], mme gets the high registers
IGA_REGISTER_SPEC_LE(
Platform::GEN11,
RegName::ARF_ACC, "acc", "Accumulator",
0x2, 0,
1,
2, (32,32)),
IGA_REGISTER_SPEC(Platform::GEN12P1, Platform::GEN12P1,
RegName::ARF_ACC, "acc", "Accumulator",
0x2, 0,
1,
8, (32,32,32,32,32,32,32,32)),
IGA_REGISTER_SPEC_LE(
Platform::GEN11,
RegName::ARF_MME, "mme", "Math Macro",
0x2, 2, // offset by 2 "acc2-9"
4,
8, (32,32,32,32,32,32,32,32)),
IGA_REGISTER_SPEC(Platform::GEN12P1, Platform::GEN12P1,
RegName::ARF_MME, "mme", "Math Macro",
0x2, 8, // offset by 8 "acc8-15"
4,
8, (32,32,32,32,32,32,32,32)),
IGA_REGISTER_SPEC_UNIFORM(
RegName::ARF_F, "f", "Flag Register",
0x3, 0,
2,
2, (4,4)),
IGA_REGISTER_SPEC_GE(
Platform::GEN7P5,
RegName::ARF_CE, "ce", "Channel Enable",
0x4, 0,
4,
0, (4)),
IGA_REGISTER_SPEC_GE(
Platform::GEN8,
RegName::ARF_MSG, "msg", "Message Control",
0x5, 0,
4,
8, (4,4,4,4,4,4,4,4)),
IGA_REGISTER_SPEC_GE(
Platform::GEN8,
RegName::ARF_SP, "sp", "Stack Pointer",
0x6, 0,
4,
0, (2*8)), // two subregisters of 8 bytes each
IGA_REGISTER_SPEC(
Platform::GEN7P5, Platform::GEN7P5,
RegName::ARF_SP, "sp", "Stack Pointer",
0x6, 0,
4,
0, (2*4)), // two subregisters of 4 bytes each
IGA_REGISTER_SPEC_UNIFORM(
RegName::ARF_SR, "sr", "State Register",
0x7, 0,
1,
2, (16,16)), // sr{0,1}.{0..3}:d
IGA_REGISTER_SPEC_UNIFORM(
RegName::ARF_CR, "cr", "Control Register",
0x8, 0,
4,
1, (3*4)), // cr0.{0..2}:d
// with SWSB wait n{0,1} replaced by sync.{bar,host}, which
// implicitly reference notification registers;
// not sure if these are needed in CSR though, so leaving for now
IGA_REGISTER_SPEC_UNIFORM(
RegName::ARF_N, "n", "Notification Register",
0x9, 0,
4,
1, (3*4)), // n0.{0..2}:d
IGA_REGISTER_SPEC_UNIFORM(
RegName::ARF_IP, "ip", "Instruction Pointer",
0xA, 0,
4,
0, (4)), // ip
IGA_REGISTER_SPEC_UNIFORM(
RegName::ARF_TDR, "tdr", "Thread Dependency Register",
0xB, 0,
2,
1, (16)), // tdr0.*
IGA_REGISTER_SPEC_GE(
Platform::GEN10,
RegName::ARF_TM, "tm", "Timestamp Register",
0xC, 0,
4,
1, (5*4)), // tm0.{0..4}:d
IGA_REGISTER_SPEC_LE(
Platform::GEN9,
RegName::ARF_TM, "tm", "Timestamp Register",
0xC, 0,
4,
1, (4*4)), // tm0.{0..3}:d
// fc0.0-31 stack-entry 0-31
// fc1.0 global counts
// fc2.0 top of stack pointers
// fc3.0-3 per channel counts
// fc4.0 call mask
IGA_REGISTER_SPEC(Platform::GEN7P5, Platform::GEN11,
RegName::ARF_FC, "fc", "Flow Control",
0xD, 0,
4,
5, (4*32,4*1,4*1,4*4,4*1)),
// EU GOTO/JOIN instruction latency improvement HAS397165 removes two flow control registers
// fc0.0-31 per-channel IP
// fc1.0 channel enables
// fc2 call mask
// fc3 JEU fused mask
IGA_REGISTER_SPEC_GE(Platform::GEN12P1,
RegName::ARF_FC, "fc", "Flow Control",
0xD, 0,
4,
4, (4*32,4*1,4*1,4*1)),
IGA_REGISTER_SPEC(Platform::GEN7, Platform::GEN7P5,
RegName::ARF_DBG, "dbg", "Debug",
0xF, 0,
4,
1, (4)), // dbg0.0:ud
IGA_REGISTER_SPEC_GE(Platform::GEN8,
RegName::ARF_DBG, "dbg", "Debug",
0xF, 0,
4,
1, (2*4)), // dbg0.{0,1}:ud
};
const OpSpec& Model::lookupOpSpec(Op op) const
{
if (op < Op::FIRST_OP || op > Op::LAST_OP) {
// external opspec API can reach this
// IGA_ASSERT_FALSE("op out of bounds");
return opsArray[(int)Op::INVALID]; // return invalid if assertions are off
}
return opsArray[(int)op];
}
const OpSpec& Model::lookupOpSpecByCode(unsigned opcode) const
{
// if (!opsByCodeValid) {
// for (int i = (int)Op::FIRST_OP; i <= (int)Op::LAST_OP; i++) {
// const OpSpec &os = lookupOpSpec((Op)i);
// if (!os.isSubop()) {
// opsByCode[os.code] = &os;
// }
// }
// opsByCodeValid = true;
// }
for (int i = (int)Op::FIRST_OP; i <= (int)Op::LAST_OP; i++) {
if (opsArray[i].op != Op::INVALID &&
opsArray[i].opcode == opcode)
{
return opsArray[i];
}
}
return opsArray[static_cast<int>(Op::INVALID)];
}
template <int N>
static unsigned getBitsFromFragments(const uint64_t *qws, const Fragment ff[N])
{
unsigned bits = 0;
int off = 0;
for (int i = 0; i < N; i++) {
if (ff[i].length == 0) {
break;
}
auto frag = (unsigned)getBits(qws, ff[i].offset, ff[i].length);
bits |= frag << off;
off += ff[i].length;
}
return bits;
}
const OpSpec& Model::lookupOpSpecFromBits(
const void *bits,
OpSpecMissInfo &missInfo) const
{
constexpr static Fragment F_OPCODE("Opcode", 0, 7);
//
const MInst *mi = (const MInst *)bits;
auto opc = mi->getFragment(F_OPCODE);
missInfo.opcode = opc;
const OpSpec *os = &lookupOpSpecByCode((unsigned)opc);
return *os;
}
const RegInfo *Model::lookupRegInfoByRegName(RegName name) const
{
// static tester should check this
for (const RegInfo &ri : REGISTER_SPECIFICATIONS) {
if (ri.regName == name && ri.supportedOn(platform)) {
return &ri;
}
}
return nullptr;
}
uint32_t Model::getNumGRF() const
{
const RegInfo* ri = lookupRegInfoByRegName(RegName::GRF_R);
return ri->getNumReg();
}
uint32_t Model::getNumFlagReg() const
{
const RegInfo* ri = lookupRegInfoByRegName(RegName::ARF_F);
return ri->getNumReg();
}
uint32_t Model::getGRFByteSize() const
{
return 32;
}
const RegInfo *iga::GetRegisterSpecificationTable(int &len)
{
len = sizeof(REGISTER_SPECIFICATIONS)/sizeof(REGISTER_SPECIFICATIONS[0]);
return REGISTER_SPECIFICATIONS;
}
const RegInfo* Model::lookupArfRegInfoByRegNum(uint8_t regNum7_0) const
{
const RegInfo *arfAcc = nullptr;
int regNum = (int)(regNum7_0 & 0xF);
for (const RegInfo &ri : REGISTER_SPECIFICATIONS) {
if (ri.regName == RegName::GRF_R) {
continue; // GRF will be in the table as 0000b
} else if (ri.regNum7_4 == ((uint32_t)regNum7_0 >> 4) && // RegNum[7:4] matches AND
ri.supportedOn(platform)) // platform matches
{
int shiftedRegNum = regNum - ri.regNumBase;
if (ri.regName == RegName::ARF_MME &&
!ri.isRegNumberValid(shiftedRegNum) &&
arfAcc != nullptr)
{
// they picked an invalid register in the acc# space
// (which is shared with mme#)
// since acc# is far more likely, favor that so the error
// message about the register number being out of range
// refers to acc# instead of mme#
return arfAcc;
} else if (ri.regName == RegName::ARF_ACC &&
!ri.isRegNumberValid(shiftedRegNum))
{
// not really acc#, but mme#, continue the loop until we find
// that one, but at least save acc# for the error case above
arfAcc = &ri;
} else {
// - it's acc# (value reg)
// - its mme#
// - it's some other ARF
return &ri;
}
}
}
// if we get here, we didn't find a matching register for this platform
// it is possible we found and rejected acc# because the reg num was out
// of bounds and we were hoping it was an mme# register, so we return
// that reg specification so that the error message will favor
// acc# over mme# (since the latter is far less likely)
return arfAcc;
}
bool RegInfo::encode(int reg, uint8_t ®NumBits) const
{
if (!isRegNumberValid(reg)) {
return false;
}
if (regName == RegName::GRF_R) {
regNumBits = (uint8_t)reg;
} else {
// ARF
// RegNum[7:4] = high bits from the spec
reg += regNumBase;
// this assert would suggest that something is busted in
// the RegInfo table
IGA_ASSERT(reg <= 0xF, "ARF encoding overflowed");
regNumBits = (uint8_t)(regNum7_4 << 4);
regNumBits |= (uint8_t)reg;
}
return true;
}
bool RegInfo::decode(uint8_t regNumBits, int ®) const
{
if (regName == RegName::GRF_R) {
reg = (int)regNumBits;
} else {
reg = (int)(regNumBits & 0xF) - regNumBase; // acc2 -> mme0
}
return isRegNumberValid(reg);
}
const Model *Model::LookupModel(Platform p)
{
switch (p) {
case Platform::GEN7P5:
return &MODEL_GEN7P5;
case Platform::GEN8:
case Platform::GEN8LP:
return &MODEL_GEN8;
case Platform::GEN9:
case Platform::GEN9LP:
case Platform::GEN9P5:
return &MODEL_GEN9;
case Platform::GEN10:
return &MODEL_GEN10;
case Platform::GEN11:
return &MODEL_GEN11;
case Platform::GEN12P1:
return &MODEL_GEN12P1;
default:
return nullptr;
}
}
const PlatformEntry iga::ALL_PLATFORMS[] {
{iga::Platform::GEN7, "7", "ivb"},
{iga::Platform::GEN7P5, "7p5", "hsw"},
{iga::Platform::GEN8, "8", "bdw"},
{iga::Platform::GEN8LP, "8lp", "chv"},
{iga::Platform::GEN9, "9", "skl"},
{iga::Platform::GEN9LP, "9lp", "bxt"},
{iga::Platform::GEN9P5, "9p5", "kbl"},
{iga::Platform::GEN10, "10", "cnl"},
{iga::Platform::GEN11, "11", "icl", "icllp"},
{iga::Platform::GEN12P1, "12p1", "tgl", "tgllp", "dg1"},
};
const size_t iga::ALL_PLATFORMS_LEN = sizeof(ALL_PLATFORMS)/sizeof(ALL_PLATFORMS[0]);
| 30.188995 | 139 | 0.586734 | [
"model"
] |
92fb93b6b5563992f8b0ed3214463681e42dc336 | 2,462 | cpp | C++ | opencv_contrib/src/+cv/private/TextDetectorCNN_.cpp | 1123852253/mexopencv | 17db690133299f561924a45e9092673a4df66c5b | [
"BSD-3-Clause"
] | 571 | 2015-01-04T06:23:19.000Z | 2022-03-31T07:37:19.000Z | opencv_contrib/src/+cv/private/TextDetectorCNN_.cpp | 1123852253/mexopencv | 17db690133299f561924a45e9092673a4df66c5b | [
"BSD-3-Clause"
] | 362 | 2015-01-06T14:20:46.000Z | 2022-01-20T08:10:46.000Z | opencv_contrib/src/+cv/private/TextDetectorCNN_.cpp | 1123852253/mexopencv | 17db690133299f561924a45e9092673a4df66c5b | [
"BSD-3-Clause"
] | 300 | 2015-01-20T03:21:27.000Z | 2022-03-31T07:36:37.000Z | /**
* @file TextDetectorCNN_.cpp
* @brief mex interface for cv::text::TextDetectorCNN
* @ingroup text
* @author Amro
* @date 2018
*/
#include "mexopencv.hpp"
#include "opencv2/text.hpp"
using namespace std;
using namespace cv;
using namespace cv::text;
// Persistent objects
namespace {
/// Last object id to allocate
int last_id = 0;
/// Object container
map<int,Ptr<TextDetectorCNN> > obj_;
}
/**
* Main entry called from Matlab
* @param nlhs number of left-hand-side arguments
* @param plhs pointers to mxArrays in the left-hand-side
* @param nrhs number of right-hand-side arguments
* @param prhs pointers to mxArrays in the right-hand-side
*/
void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
{
// Check the number of arguments
nargchk(nrhs>=2 && nlhs<=2);
// Argument vector
vector<MxArray> rhs(prhs, prhs+nrhs);
int id = rhs[0].toInt();
string method(rhs[1].toString());
// constructor call
if (method == "new") {
nargchk(nrhs>=4 && (nrhs%2)==0 && nlhs<=1);
vector<Size> detectionSizes(1, Size(300, 300));
for (int i=4; i<nrhs; i+=2) {
string key(rhs[i].toString());
if (key == "DetectionSizes")
detectionSizes = rhs[i+1].toVector<Size>();
else
mexErrMsgIdAndTxt("mexopencv:error",
"Unrecognized option %s", key.c_str());
}
string modelArchFilename(rhs[2].toString()),
modelWeightsFilename(rhs[3].toString());
obj_[++last_id] = TextDetectorCNN::create(
modelArchFilename, modelWeightsFilename, detectionSizes);
plhs[0] = MxArray(last_id);
mexLock();
return;
}
// Big operation switch
Ptr<TextDetectorCNN> obj = obj_[id];
if (obj.empty())
mexErrMsgIdAndTxt("mexopencv:error", "Object not found id=%d", id);
if (method == "delete") {
nargchk(nrhs==2 && nlhs==0);
obj_.erase(id);
mexUnlock();
}
else if (method == "detect") {
nargchk(nrhs==3 && nlhs<=2);
Mat inputImage(rhs[2].toMat(CV_8U));
vector<Rect> bbox;
vector<float> confidence;
obj->detect(inputImage, bbox, confidence);
plhs[0] = MxArray(bbox);
if (nlhs > 1)
plhs[1] = MxArray(confidence);
}
else
mexErrMsgIdAndTxt("mexopencv:error",
"Unrecognized operation %s", method.c_str());
}
| 29.662651 | 76 | 0.597076 | [
"object",
"vector"
] |
92ffeaf0b591e026ee95f9281676ee8e16aa811e | 11,183 | cpp | C++ | src/Test/TestDarknet.cpp | uboborov/Synet | 0fb3c4b77193e7fd9c86c15e3c185fec0ee57b4b | [
"MIT"
] | null | null | null | src/Test/TestDarknet.cpp | uboborov/Synet | 0fb3c4b77193e7fd9c86c15e3c185fec0ee57b4b | [
"MIT"
] | null | null | null | src/Test/TestDarknet.cpp | uboborov/Synet | 0fb3c4b77193e7fd9c86c15e3c185fec0ee57b4b | [
"MIT"
] | null | null | null | /*
* Tests for Synet Framework (http://github.com/ermig1979/Synet).
*
* Copyright (c) 2018-2020 Yermalayeu Ihar.
*
* 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 "TestCompare.h"
#include "TestReport.h"
#ifdef SYNET_TEST_FIRST_RUN
#define SYNET_DARKNET_ENABLE
#define SYNET_DARKNET_PATH ../../../3rd/darknet/include
#include "Synet/Converters/Darknet.h"
namespace Test
{
struct DarknetNetwork : public Network
{
DarknetNetwork()
: _net(0)
{
}
virtual ~DarknetNetwork()
{
if(_net)
::free_network(_net);
}
virtual String Name() const
{
return "Darknet";
}
virtual size_t SrcCount() const
{
return 1;
}
virtual Shape SrcShape(size_t index) const
{
return Shape({ size_t(_net->batch), size_t(_net->c), size_t(_net->h), size_t(_net->w) });
}
virtual size_t SrcSize(size_t index) const
{
return size_t(_net->batch) * _net->c * _net->h * _net->w;
}
virtual bool Init(const String & model, const String & weight, const Options & options, const TestParam & param)
{
TEST_PERF_FUNC();
_regionThreshold = options.regionThreshold;
_net = ::parse_network_cfg((char*)PatchCfg(model, options.batchSize).c_str());
::load_weights(_net, (char*)weight.c_str());
return true;
}
virtual const Tensors & Predict(const Tensors & src)
{
{
TEST_PERF_FUNC();
::network_predict(_net, (float*)src[0].CpuData());
}
SetOutput();
return _output;
}
virtual void DebugPrint(const Tensors& src, std::ostream& os, int flag, int first, int last, int precision)
{
if (!flag)
return;
bool output = flag & (1 << Synet::DebugPrintOutput);
bool weight = flag & (1 << Synet::DebugPrintLayerWeight);
bool interim = flag & (1 << Synet::DebugPrintLayerDst);
for (int i = 0; i < _net->n; ++i)
{
const ::layer& l = _net->layers[i];
if (((i == _net->n - 1 || l.type == YOLO || l.type == REGION || l.type == DETECTION) && output) || interim || weight)
{
os << "Layer: " << i << " : " << ToString(l.type) << " ." << std::endl;
if (l.type == CONVOLUTIONAL && weight)
{
Synet::Tensor<float> weight({ (size_t)l.out_c, (size_t)l.c, (size_t)l.size, (size_t)l.size });
memcpy(weight.CpuData(), l.weights, weight.Size() * sizeof(float));
weight.DebugPrint(os, String("weight"), true, first, last, precision);
if (l.batch_normalize)
{
Synet::Tensor<float> mean({ (size_t)l.out_c });
memcpy(mean.CpuData(), l.rolling_mean, mean.Size() * sizeof(float));
mean.DebugPrint(os, String("mean"), true, first, last, precision);
Synet::Tensor<float> variance({ (size_t)l.out_c });
memcpy(variance.CpuData(), l.rolling_variance, variance.Size() * sizeof(float));
variance.DebugPrint(os, String("variance"), true, first, last, precision);
Synet::Tensor<float> scale({ (size_t)l.out_c });
memcpy(scale.CpuData(), l.scales, scale.Size() * sizeof(float));
scale.DebugPrint(os, String("scale"), true, first, last, precision);
}
Synet::Tensor<float> bias({ (size_t)l.out_c });
memcpy(bias.CpuData(), l.biases, bias.Size() * sizeof(float));
bias.DebugPrint(os, String("bias"), true, first, last, precision);
}
if (((i == _net->n - 1 || l.type == YOLO || l.type == REGION || l.type == DETECTION) && output) || interim)
{
Synet::Tensor<float> dst;
OutputToTensor(l, dst);
dst.DebugPrint(os, String("dst[0]"), false, first, last, precision);
}
}
}
}
virtual Regions GetRegions(const Size & size, float threshold, float overlap) const
{
int nboxes = 0;
float hier_thresh = 0.5;
::layer l = _net->layers[_net->n - 1];
::detection *dets = get_network_boxes((::network*)_net, (int)size.x, (int)size.y, threshold, hier_thresh, 0, 1, &nboxes);
if (overlap)
do_nms_sort(dets, nboxes, l.classes, overlap);
Regions regions;
for (size_t i = 0; i < nboxes; ++i)
{
box b = dets[i].bbox;
int const obj_id = max_index(dets[i].prob, l.classes);
float const prob = dets[i].prob[obj_id];
if (prob > threshold)
{
Region region;
region.x = b.x*size.x;
region.y = b.y*size.y;
region.w = b.w*size.x;
region.h = b.h*size.y;
region.id = obj_id;
region.prob = prob;
regions.push_back(region);
}
}
free_detections(dets, nboxes);
return regions;
}
private:
::network * _net;
void SetOutput()
{
_output.clear();
for (size_t i = 0; i < _net->n; ++i)
{
const layer& l = _net->layers[i];
if (l.type == YOLO || l.type == REGION || l.type == DETECTION)
AddToOutput(l);
}
if (_output.empty())
AddToOutput(_net->layers[_net->n - 1]);
}
void AddToOutput(const layer& l)
{
_output.push_back(Tensor());
OutputToTensor(l, _output.back());
}
String ToString(LAYER_TYPE type) const
{
switch (type)
{
case CONVOLUTIONAL: return "Convolution";
case DECONVOLUTIONAL: return "Deconvolution";
case CONNECTED: return "Connected";
case MAXPOOL: return "Maxpool";
case SOFTMAX: return "Softmax";
case DETECTION: return "Detection";
case DROPOUT: return "Dropout";
case CROP: return "Crop";
case ROUTE: return "Route";
case COST: return "Cost";
case NORMALIZATION: return "Normalization";
case AVGPOOL: return "Avgpool";
case LOCAL: return "Local";
case SHORTCUT: return "Shortcut";
case ACTIVE: return "Active";
case RNN: return "Rnn";
case GRU: return "Gru";
case CRNN: return "Crnn";
case BATCHNORM: return "Batchnorm";
case NETWORK: return "Network";
case XNOR: return "Xnor";
case REGION: return "Region";
case YOLO: return "Yolo";
case REORG: return "Reorg";
case UPSAMPLE: return "Upsample";
case BLANK: return "Blank";
default:
return "";
}
}
void OutputToTensor(const layer& l, Tensor& t)
{
if (l.type == ::SOFTMAX)
t.Reshape(Shp(l.batch, l.outputs, 1, 1), Synet::TensorFormatNchw);
else if (l.type == ::YOLO || l.type == ::REGION || l.type == DETECTION)
t.Reshape(Shp(l.batch, l.outputs / l.h / l.w, l.h, l.w), Synet::TensorFormatNchw);
else
t.Reshape(Shp(l.batch, l.out_c, l.out_h, l.out_w), Synet::TensorFormatNchw);
memcpy(t.CpuData(), l.output, t.Size() * sizeof(float));
}
String PatchCfg(const String & src, size_t batchSize)
{
String dst = src + ".patched.txt";
std::ifstream ifs(src.c_str());
std::ofstream ofs(dst.c_str());
String line;
while(std::getline(ifs, line))
{
if (line.substr(0, 6) == "batch=")
ofs << "batch=" << batchSize << std::endl;
else
ofs << line << std::endl;
}
ifs.close();
ofs.close();
return dst;
}
};
}
#else //SYNET_FIRST_RUN
namespace Test
{
struct DarknetNetwork : public Network
{
};
}
#endif//SYNET_FIRST_RUN
Test::PerformanceMeasurerStorage Test::PerformanceMeasurerStorage::s_storage;
int main(int argc, char* argv[])
{
Test::Options options(argc, argv);
if (options.mode == "convert")
{
SYNET_PERF_FUNC();
#ifdef SYNET_TEST_FIRST_RUN
std::cout << "Convert network from Darkent to Synet :" << std::endl;
options.result = Synet::ConvertDarknetToSynet(options.firstModel, options.firstWeight, options.tensorFormat == 1, options.secondModel, options.secondWeight);
std::cout << "Conversion is finished " << (options.result ? "successfully." : "with errors.") << std::endl;
#else
std::cout << "Conversion of Darkent to Synet is not available!" << std::endl;
options.result = false;
#endif
}
else if (options.mode == "compare")
{
Test::Comparer<Test::DarknetNetwork, Test::SynetNetwork> comparer(options);
options.result = comparer.Run();
}
else
std::cout << "Unknown mode : " << options.mode << std::endl;
return options.result ? 0 : 1;
} | 38.829861 | 166 | 0.509613 | [
"shape",
"model"
] |
13049dfe60555ef2b8a6c508849f2f0e4ce796df | 15,053 | cxx | C++ | SimVascular-master/Code/Source/sv4gui/Plugins/org.sv.gui.qt.simulation/sv4gui_CapBCWidget.cxx | mccsssk2/SimVascularPM3_March2020 | 3cce6cc7be66545bea5dc3915a2db50a3892bf04 | [
"BSD-3-Clause"
] | null | null | null | SimVascular-master/Code/Source/sv4gui/Plugins/org.sv.gui.qt.simulation/sv4gui_CapBCWidget.cxx | mccsssk2/SimVascularPM3_March2020 | 3cce6cc7be66545bea5dc3915a2db50a3892bf04 | [
"BSD-3-Clause"
] | null | null | null | SimVascular-master/Code/Source/sv4gui/Plugins/org.sv.gui.qt.simulation/sv4gui_CapBCWidget.cxx | mccsssk2/SimVascularPM3_March2020 | 3cce6cc7be66545bea5dc3915a2db50a3892bf04 | [
"BSD-3-Clause"
] | null | null | null | /* Copyright (c) Stanford University, The Regents of the University of
* California, and others.
*
* All Rights Reserved.
*
* See Copyright-SimVascular.txt for additional details.
*
* 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.
*
* 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 OWNER
* 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.
*/
#include "sv4gui_CapBCWidget.h"
#include "ui_sv4gui_CapBCWidget.h"
#include <berryIPreferencesService.h>
#include <berryIPreferences.h>
#include <berryPlatform.h>
#include <QMessageBox>
#include <QFileDialog>
#include <QTextStream>
#include <sstream>
sv4guiCapBCWidget::sv4guiCapBCWidget(QWidget *parent)
: QWidget(parent)
, ui(new Ui::sv4guiCapBCWidget)
, m_FlowrateContent("")
, m_TimedPressureContent("")
{
ui->setupUi(this);
connect(ui->comboBoxBCType,SIGNAL(currentTextChanged(const QString &)), this, SLOT(SelectionChanged(const QString &)));
connect(ui->toolButtonBrowse,SIGNAL(clicked()), this, SLOT(LoadFlowrateFromFile()));
connect(ui->toolButtonBrowsePressureFile,SIGNAL(clicked()), this, SLOT(LoadTimedPressureFromFile()));
connect(ui->buttonBox,SIGNAL(accepted()), this, SLOT(Confirm()));
connect(ui->buttonBox,SIGNAL(rejected()), this, SLOT(Cancel()));
}
sv4guiCapBCWidget::~sv4guiCapBCWidget()
{
delete ui;
}
void sv4guiCapBCWidget::UpdateGUI(std::string capName, std::map<std::string, std::string> props)
{
ui->labelFaceName->setText(QString::fromStdString(capName));
ui->comboBoxBCType->setCurrentText(QString::fromStdString(props["BC Type"]));
QString shape=QString::fromStdString(props["Analytic Shape"]);
if(shape=="")
ui->comboBoxShape->setCurrentText("parabolic");
else
ui->comboBoxShape->setCurrentText(shape);
QString pointNum=QString::fromStdString(props["Point Number"]);
if(pointNum=="")
ui->lineEditPointNumber->setText("201");
else
ui->lineEditPointNumber->setText(pointNum);
QString modeNum=QString::fromStdString(props["Fourier Modes"]);
if(modeNum=="")
ui->lineEditModeNumber->setText("10");
else
ui->lineEditModeNumber->setText(modeNum);
m_FlowrateContent=props["Flow Rate"];
QString period=QString::fromStdString(props["Period"]);
if(period=="")
{
QStringList list = QString::fromStdString(m_FlowrateContent).split(QRegExp("[(),{}\\s+]"), QString::SkipEmptyParts);
if(list.size()>1)
period=list[list.size()-2];
}
ui->lineEditPeriod->setText(period);
ui->checkBoxFlip->setChecked(props["Flip Normal"]=="True"?true:false);
ui->labelLoadFile->setText(QString::fromStdString(props["Original File"]));
ui->lineEditBCValues->setText(QString::fromStdString(props["Values"]));
QString pressure=QString::fromStdString(props["Pressure"]);
if(pressure=="")
ui->lineEditPressure->setText("0");
else
ui->lineEditPressure->setText(pressure);
ui->labelLoadPressureFile->setText(QString::fromStdString(props["Original File"]));
QString pressureScaling=QString::fromStdString(props["Pressure Scaling"]);
if(pressureScaling=="")
ui->lineEditPressureScaling->setText("1.0");
else
ui->lineEditPressureScaling->setText(pressureScaling);
m_TimedPressureContent=props["Timed Pressure"];
QString pressurePeriod=QString::fromStdString(props["Pressure Period"]);
if(pressurePeriod=="")
{
QStringList list = QString::fromStdString(m_TimedPressureContent).split(QRegExp("[(),{}\\s+]"), QString::SkipEmptyParts);
if(list.size()>1)
pressurePeriod=list[list.size()-2];
}
ui->lineEditPressurePeriod->setText(pressurePeriod);
}
bool sv4guiCapBCWidget::CreateProps()
{
std::map<std::string, std::string> props;
std::string bcType=ui->comboBoxBCType->currentText().toStdString();
if(bcType=="Prescribed Velocities")
{
props["BC Type"]=bcType;
props["Analytic Shape"]=ui->comboBoxShape->currentText().toStdString();
QString pointNum=ui->lineEditPointNumber->text().trimmed();
if(!IsDouble(pointNum))
{
QMessageBox::warning(this,"Point Number Error","Please provide value in a correct format!");
return false;
}
props["Point Number"]=pointNum.toStdString();
QString modeNum=ui->lineEditModeNumber->text().trimmed();
if(!IsDouble(modeNum))
{
QMessageBox::warning(this,"Fourier Modes Error","Please provide value in a correct format!");
return false;
}
props["Fourier Modes"]=modeNum.toStdString();
QString period=ui->lineEditPeriod->text().trimmed();
if(period=="" || !IsDouble(period))
{
QMessageBox::warning(this,"Period Error","Please provide value in a correct format!");
return false;
}
props["Period"]=period.toStdString();
props["Flip Normal"]=ui->checkBoxFlip->isChecked()?"True":"False";
if(m_FlowrateContent=="")
{
QMessageBox::warning(this,"No Flowrate Info","Please provide flow rate data!");
return false;
}
props["Original File"]=ui->labelLoadFile->text().toStdString();
props["Flow Rate"]=m_FlowrateContent;
}
else
{
props["BC Type"]=bcType;
QString pressure=ui->lineEditPressure->text().trimmed();
if(pressure!="")
{
if(!IsDouble(pressure))
{
QMessageBox::warning(this,"Pressure Error","Please provide value in a correct format!");
return false;
}
props["Pressure"]=pressure.toStdString();
}
QString values=ui->lineEditBCValues->text().trimmed();
if(bcType=="Resistance")
{
if(!IsDouble(values))
{
QMessageBox::warning(this,"R Value Error","Please provide value in a correct format!");
return false;
}
props["Values"]=values.toStdString();
}
else if(bcType=="RCR")
{
int count=0;
if(!AreDouble(values,&count) || count!=3)
{
QMessageBox::warning(this,"RCR Values Error","Please provide values in a correct format!");
return false;
}
props["Values"]=values.toStdString();
QStringList list = values.split(QRegExp("[(),{}\\s+]"), QString::SkipEmptyParts);
props["R Values"]=list[0].toStdString()+" "+list[2].toStdString();
props["C Values"]=list[1].toStdString();
}
else if (bcType=="Coronary")
{
int count=0;
if(!AreDouble(values,&count) || count!=5)
{
QMessageBox::warning(this,"Coronary Values Error","Please provide values in a correct format!");
return false;
}
if(m_TimedPressureContent=="")
{
QMessageBox::warning(this,"No Pim Info","Please provide flow rate data!");
return false;
}
QString newPeriodStr=ui->lineEditPressurePeriod->text().trimmed();
if(newPeriodStr=="" || !IsDouble(newPeriodStr))
{
QMessageBox::warning(this,"Pressure Period Error","Please provide value in a correct format!");
return false;
}
QString scalingFactorStr=ui->lineEditPressureScaling->text().trimmed();
if(scalingFactorStr=="" || !IsDouble(scalingFactorStr))
{
QMessageBox::warning(this,"Pressure Scaling Error","Please provide value in a correct format!");
return false;
}
props["Values"]=values.toStdString();
props["Original File"]=ui->labelLoadPressureFile->text().toStdString();
props["Timed Pressure"]=m_TimedPressureContent;
props["Pressure Period"]=newPeriodStr.toStdString();
props["Pressure Scaling"]=scalingFactorStr.toStdString();
QStringList list = values.split(QRegExp("[(),{}\\s+]"), QString::SkipEmptyParts);
props["R Values"]=list[0].toStdString()+" "+list[2].toStdString()+" "+list[4].toStdString();
props["C Values"]=list[1].toStdString()+" "+list[3].toStdString();
}
}
m_Props=props;
return true;
}
std::map<std::string, std::string> sv4guiCapBCWidget::GetProps()
{
return m_Props;
}
void sv4guiCapBCWidget::SelectionChanged(const QString &text)
{
if(text=="Prescribed Velocities")
ui->stackedWidget->setCurrentIndex(0);
else if(text=="Resistance")
{
ui->stackedWidget->setCurrentIndex(1);
ui->labelBCValues->setText("Resistance:");
ui->widgetPressure->hide();
}
else if(text=="RCR")
{
ui->stackedWidget->setCurrentIndex(1);
ui->labelBCValues->setText("R<sub>p</sub>, C, R<sub>d</sub>:");
ui->widgetPressure->hide();
}
else if(text=="Coronary")
{
ui->stackedWidget->setCurrentIndex(1);
ui->labelBCValues->setText("R<sub>a</sub>,C<sub>a</sub>,R<sub>a-micro</sub>,C<sub>im</sub>,R<sub>v</sub>:");
ui->widgetPressure->show();
}
}
void sv4guiCapBCWidget::LoadFlowrateFromFile()
{
berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
berry::IPreferences::Pointer prefs;
if (prefService)
{
prefs = prefService->GetSystemPreferences()->Node("/General");
}
else
{
prefs = berry::IPreferences::Pointer(0);
}
QString lastFileOpenPath="";
if(prefs.IsNotNull())
{
lastFileOpenPath = prefs->Get("LastFileOpenPath", "");
}
if(lastFileOpenPath=="")
lastFileOpenPath=QDir::homePath();
QString flowrateFilePath = QFileDialog::getOpenFileName(this, tr("Load Flow File")
, lastFileOpenPath
, tr("All Files (*)"));
flowrateFilePath=flowrateFilePath.trimmed();
if(flowrateFilePath.isEmpty())
return;
if(prefs.IsNotNull())
{
prefs->Put("LastFileOpenPath", flowrateFilePath);
prefs->Flush();
}
QFile inputFile(flowrateFilePath);
if (inputFile.open(QIODevice::ReadOnly))
{
QTextStream in(&inputFile);
QFileInfo fi(flowrateFilePath);
ui->labelLoadFile->setText(fi.fileName());
m_FlowrateContent=in.readAll().toStdString();
inputFile.close();
}
QString inflowPeriod="";
QFile inputFile2(flowrateFilePath);
if (inputFile2.open(QIODevice::ReadOnly))
{
QTextStream in(&inputFile2);
QString line;
while(1) {
line=in.readLine();
if(line.isNull())
break;
if(line.contains("#"))
continue;
QStringList list = line.split(QRegExp("[(),{}\\s+]"), QString::SkipEmptyParts);
if(list.size()!=2)
continue;
inflowPeriod=list[0];
}
inputFile2.close();
}
ui->lineEditPeriod->setText(inflowPeriod);
}
void sv4guiCapBCWidget::LoadTimedPressureFromFile()
{
berry::IPreferencesService* prefService = berry::Platform::GetPreferencesService();
berry::IPreferences::Pointer prefs;
if (prefService)
{
prefs = prefService->GetSystemPreferences()->Node("/General");
}
else
{
prefs = berry::IPreferences::Pointer(0);
}
QString lastFileOpenPath="";
if(prefs.IsNotNull())
{
lastFileOpenPath = prefs->Get("LastFileOpenPath", "");
}
if(lastFileOpenPath=="")
lastFileOpenPath=QDir::homePath();
QString pressureFilePath = QFileDialog::getOpenFileName(this, tr("Load Pim File")
, lastFileOpenPath
, tr("All Files (*)"));
pressureFilePath=pressureFilePath.trimmed();
if(pressureFilePath.isEmpty())
return;
if(prefs.IsNotNull())
{
prefs->Put("LastFileOpenPath", pressureFilePath);
prefs->Flush();
}
QString pressurePeriod="";
QFile inputFile(pressureFilePath);
if (inputFile.open(QIODevice::ReadOnly))
{
QTextStream in(&inputFile);
QFileInfo fi(pressureFilePath);
ui->labelLoadPressureFile->setText(fi.fileName());
std::stringstream ss;
QString line;
while (1) {
line=in.readLine();
if(line.isNull())
break;
if(line.contains("#"))
continue;
QStringList list = line.split(QRegExp("[(),{}\\s]"), QString::SkipEmptyParts);
if(list.size()!=2)
continue;
ss << list[0].toStdString() << " " << list[1].toStdString() <<"\n";
pressurePeriod=list[0];
}
m_TimedPressureContent=ss.str();
inputFile.close();
}
ui->lineEditPressurePeriod->setText(pressurePeriod);
}
void sv4guiCapBCWidget::Confirm()
{
if(CreateProps())
{
hide();
emit accepted();
}
}
void sv4guiCapBCWidget::Cancel()
{
hide();
}
bool sv4guiCapBCWidget::IsDouble(QString value)
{
bool ok;
value.toDouble(&ok);
return ok;
}
bool sv4guiCapBCWidget::AreDouble(QString values, int* count)
{
QStringList list = values.split(QRegExp("[(),{}\\s]"), QString::SkipEmptyParts);
bool ok;
for(int i=0;i<list.size();i++)
{
list[i].toDouble(&ok);
if(!ok) return false;
}
if(count!=NULL)
(*count)=list.size();
return true;
}
| 31.425887 | 129 | 0.610177 | [
"shape"
] |
1305d0ea81d08369dc1b1e221e6d839a99329dce | 5,367 | cpp | C++ | src/org/apache/poi/util/DefaultTempFileCreationStrategy.cpp | pebble2015/cpoi | 6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6 | [
"Apache-2.0"
] | null | null | null | src/org/apache/poi/util/DefaultTempFileCreationStrategy.cpp | pebble2015/cpoi | 6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6 | [
"Apache-2.0"
] | null | null | null | src/org/apache/poi/util/DefaultTempFileCreationStrategy.cpp | pebble2015/cpoi | 6dcc0c5e13e3e722b4ef9fd0baffbf62bf71ead6 | [
"Apache-2.0"
] | null | null | null | // Generated from /POI/java/org/apache/poi/util/DefaultTempFileCreationStrategy.java
#include <org/apache/poi/util/DefaultTempFileCreationStrategy.hpp>
#include <java/io/File.hpp>
#include <java/io/IOException.hpp>
#include <java/lang/Long.hpp>
#include <java/lang/NullPointerException.hpp>
#include <java/lang/Object.hpp>
#include <java/lang/String.hpp>
#include <java/lang/StringBuilder.hpp>
#include <java/lang/System.hpp>
#include <java/security/SecureRandom.hpp>
#include <org/apache/poi/util/TempFile.hpp>
template<typename T>
static T* npc(T* t)
{
if(!t) throw new ::java::lang::NullPointerException();
return t;
}
poi::util::DefaultTempFileCreationStrategy::DefaultTempFileCreationStrategy(const ::default_init_tag&)
: super(*static_cast< ::default_init_tag* >(0))
{
clinit();
}
poi::util::DefaultTempFileCreationStrategy::DefaultTempFileCreationStrategy()
: DefaultTempFileCreationStrategy(*static_cast< ::default_init_tag* >(0))
{
ctor();
}
poi::util::DefaultTempFileCreationStrategy::DefaultTempFileCreationStrategy(::java::io::File* dir)
: DefaultTempFileCreationStrategy(*static_cast< ::default_init_tag* >(0))
{
ctor(dir);
}
java::lang::String*& poi::util::DefaultTempFileCreationStrategy::JAVA_IO_TMPDIR()
{
clinit();
return JAVA_IO_TMPDIR_;
}
java::lang::String* poi::util::DefaultTempFileCreationStrategy::JAVA_IO_TMPDIR_;
java::lang::String*& poi::util::DefaultTempFileCreationStrategy::POIFILES()
{
clinit();
return POIFILES_;
}
java::lang::String* poi::util::DefaultTempFileCreationStrategy::POIFILES_;
java::lang::String*& poi::util::DefaultTempFileCreationStrategy::KEEP_FILES()
{
clinit();
return KEEP_FILES_;
}
java::lang::String* poi::util::DefaultTempFileCreationStrategy::KEEP_FILES_;
java::security::SecureRandom*& poi::util::DefaultTempFileCreationStrategy::random()
{
clinit();
return random_;
}
java::security::SecureRandom* poi::util::DefaultTempFileCreationStrategy::random_;
void poi::util::DefaultTempFileCreationStrategy::ctor()
{
ctor(nullptr);
}
void poi::util::DefaultTempFileCreationStrategy::ctor(::java::io::File* dir)
{
super::ctor();
this->dir = dir;
}
void poi::util::DefaultTempFileCreationStrategy::createPOIFilesDirectory() /* throws(IOException) */
{
if(dir == nullptr) {
auto tmpDir = ::java::lang::System::getProperty(JAVA_IO_TMPDIR_);
if(tmpDir == nullptr) {
throw new ::java::io::IOException(::java::lang::StringBuilder().append(u"Systems temporary directory not defined - set the -D"_j)->append(JAVA_IO_TMPDIR_)
->append(u" jvm property!"_j)->toString());
}
dir = new ::java::io::File(tmpDir, POIFILES_);
}
createTempDirectory(dir);
}
void poi::util::DefaultTempFileCreationStrategy::createTempDirectory(::java::io::File* directory) /* throws(IOException) */
{
auto const dirExists = (npc(directory)->exists() || npc(directory)->mkdirs());
if(!dirExists) {
throw new ::java::io::IOException(::java::lang::StringBuilder().append(u"Could not create temporary directory '"_j)->append(static_cast< ::java::lang::Object* >(directory))
->append(u"'"_j)->toString());
} else if(!npc(directory)->isDirectory()) {
throw new ::java::io::IOException(::java::lang::StringBuilder().append(u"Could not create temporary directory. '"_j)->append(static_cast< ::java::lang::Object* >(directory))
->append(u"' exists but is not a directory."_j)->toString());
}
}
java::io::File* poi::util::DefaultTempFileCreationStrategy::createTempFile(::java::lang::String* prefix, ::java::lang::String* suffix) /* throws(IOException) */
{
createPOIFilesDirectory();
auto newFile = ::java::io::File::createTempFile(prefix, suffix, dir);
if(::java::lang::System::getProperty(KEEP_FILES_) == nullptr) {
npc(newFile)->deleteOnExit();
}
return newFile;
}
java::io::File* poi::util::DefaultTempFileCreationStrategy::createTempDirectory(::java::lang::String* prefix) /* throws(IOException) */
{
createPOIFilesDirectory();
auto const n = npc(random_)->nextLong();
auto newDirectory = new ::java::io::File(dir, ::java::lang::StringBuilder().append(prefix)->append(::java::lang::Long::toString(n))->toString());
createTempDirectory(newDirectory);
if(::java::lang::System::getProperty(KEEP_FILES_) == nullptr) {
npc(newDirectory)->deleteOnExit();
}
return newDirectory;
}
extern java::lang::Class *class_(const char16_t *c, int n);
java::lang::Class* poi::util::DefaultTempFileCreationStrategy::class_()
{
static ::java::lang::Class* c = ::class_(u"org.apache.poi.util.DefaultTempFileCreationStrategy", 51);
return c;
}
void poi::util::DefaultTempFileCreationStrategy::clinit()
{
struct string_init_ {
string_init_() {
JAVA_IO_TMPDIR_ = TempFile::JAVA_IO_TMPDIR();
POIFILES_ = u"poifiles"_j;
KEEP_FILES_ = u"poi.keep.tmp.files"_j;
}
};
static string_init_ string_init_instance;
super::clinit();
static bool in_cl_init = false;
struct clinit_ {
clinit_() {
in_cl_init = true;
random_ = new ::java::security::SecureRandom();
}
};
if(!in_cl_init) {
static clinit_ clinit_instance;
}
}
java::lang::Class* poi::util::DefaultTempFileCreationStrategy::getClass0()
{
return class_();
}
| 32.527273 | 181 | 0.697037 | [
"object"
] |
13081a2a77862bef84105db387794de925998cd6 | 12,855 | hh | C++ | src/libmess/d3.hh | dsjense/MESS | b54c161327e2e35a40bb3b71555bdc2eef7cd7f9 | [
"Apache-2.0"
] | 9 | 2020-03-03T07:34:35.000Z | 2021-12-08T13:12:16.000Z | src/libmess/d3.hh | dsjense/MESS | b54c161327e2e35a40bb3b71555bdc2eef7cd7f9 | [
"Apache-2.0"
] | 1 | 2022-03-23T10:57:25.000Z | 2022-03-31T12:30:44.000Z | src/libmess/d3.hh | dsjense/MESS | b54c161327e2e35a40bb3b71555bdc2eef7cd7f9 | [
"Apache-2.0"
] | 9 | 2019-12-18T19:59:13.000Z | 2022-01-31T01:49:43.000Z | /*
Chemical Kinetics and Dynamics Library
Copyright (C) 2008-2013, Yuri Georgievski <ygeorgi@anl.gov>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
*/
#ifndef D3_HH
#define D3_HH
#include "linpack.hh"
#include "array.hh"
/******************************************
************ 3-D Space *****************
******************************************/
class Quaternion;
namespace D3 {
class Matrix;
class Vector
{
double _begin [3];
double* _end;
public:
typedef double* iterator;
typedef const double* const_iterator;
typedef double value_type;
Vector ();
Vector (const Vector&);
Vector& operator= (const Vector&);
explicit Vector (double);
explicit Vector (const double*);
template <typename V>
explicit Vector (const V&) ;
double& operator [] (int i) { return _begin[i]; }
double operator [] (int i) const { return _begin[i]; }
operator double* () { return _begin; }
operator const double* () const { return _begin; }
const double* begin () const { return _begin; }
double* begin () { return _begin; }
const double* end () const { return _end; }
double* end () { return _end; }
int size () const { return 3; }
// block operations
template <typename V> Vector& operator= (const V&) ;
template <typename V> Vector& operator+= (const V&) ;
template <typename V> Vector& operator-= (const V&) ;
Vector& operator= (const double*);
Vector& operator+= (const double*);
Vector& operator-= (const double*);
Vector operator+ (const double*) const;
Vector operator+ (const Vector& v) const { return *this + (const double*)v; }
Vector operator- (const double*) const;
Vector operator- (const Vector& v) const { return *this - (const double*)v; }
Vector operator* (double) const;
Vector operator* (const Matrix&) const;
Vector& operator= (double);
Vector& operator*= (double);
Vector& operator/= (double);
Vector& operator*= (const Matrix&); // orthogonal transformation M*v
double vlength () const;
double normalize ();
double orthogonalize (const double*) ;
};
template <typename V>
Vector::Vector (const V& v)
{
const char funame [] = "D3::Vector::Vector: ";
if(v.size() != 3) {
std::cerr << funame << "dimensions mismatch\n";
throw Error::Range();
}
_end = _begin + 3;
typename V::const_iterator vit = v.begin();
for(iterator it = begin(); it != end(); ++it, ++vit)
*it = *vit;
}
template <typename V>
Vector& Vector::operator= (const V& v)
{
const char funame [] = "D3::Vector::operator=: ";
if(v.size() != 3) {
std::cerr << funame << "dimensions mismatch\n";
throw Error::Range();
}
typename V::const_iterator vit = v.begin();
for(iterator it = begin(); it != end(); ++it, ++vit)
*it = *vit;
return *this;
}
template <typename V>
Vector& Vector::operator+= (const V& v)
{
const char funame [] = "D3::Vector::operator+=: ";
if(v.size() != 3) {
std::cerr << funame << "dimensions mismatch\n";
throw Error::Range();
}
typename V::const_iterator vit = v.begin();
for(iterator it = begin(); it != end(); ++it, ++vit)
*it += *vit;
return *this;
}
template <typename V>
Vector& Vector::operator-= (const V& v)
{
const char funame [] = "D3::Vector::operator-=: ";
if(v.size() != 3) {
std::cerr << funame << "dimensions mismatch\n";
throw Error::Range();
}
typename V::const_iterator vit = v.begin();
for(iterator it = begin(); it != end(); ++it, ++vit)
*it -= *vit;
return *this;
}
inline Vector Vector::operator+ (const double* p) const
{
Vector res = *this;
res += p;
return res;
}
inline Vector Vector::operator- (const double* p) const
{
Vector res = *this;
res -= p;
return res;
}
inline Vector Vector::operator* (double d) const
{
Vector res = *this;
res *= d;
return res;
}
inline double Vector::vlength () const
{
return ::vlength(_begin, 3);
}
inline double Vector::normalize ()
{
return ::normalize(_begin, 3);
}
inline double Vector::orthogonalize (const double* n)
{
return ::orthogonalize(_begin, n, 3);
}
Vector operator+ (const double*, const Vector&);
Vector operator- (const double*, const Vector&);
Vector operator* (double, const Vector&);
std::istream& operator>> (std::istream&, Vector&);
std::ostream& operator<< (std::ostream&, const Vector&);
Vector vprod (const double*, const double*); // vector-vector product
void vprod (const double*, const double*, double*); // vector-vector product
void vprod (const Matrix&, const double*, double*); // matrix-vector product
void vprod (const double*, const Matrix&, double*); // vector-matrix product
double volume (const double*, const double*, const double*); // signed volume
void find_orth(const double*, Vector*); // get two vectors orthogonal to the given one
/******************************************* 3-D matrix *****************************************/
// C style matrix
class Matrix
{
double _begin [9];
void _init ();
public:
Matrix () { _init(); }
explicit Matrix (double a) { _init(); diagonal() = a; }
Matrix (Vector, Vector) ; // standard orientation
explicit Matrix (const Quaternion&) ;
double& operator() (int, int) ; // C style indexing
const double& operator() (int, int) const ;
operator Quaternion () const ;
Matrix& operator= (double a) { _init(); diagonal() = a; return *this; }
Slice<double> column (int i) ;
ConstSlice<double> column (int i) const ;
Slice<double> row (int i) ;
ConstSlice<double> row (int i) const ;
Slice<double> diagonal ();
ConstSlice<double> diagonal () const;
Matrix transpose () const;
Matrix operator- () const;
Matrix& operator *= (double);
Matrix& operator /= (double a) { return operator*=(1. / a); }
Matrix operator* (const Matrix&) const; // matrix multiplication
Vector operator* (const double*) const; // matrix vector product M*v
Vector operator* (const Vector& v) const { return *this * (const double*)v; }
void orthogonalize ();
void orthogonality_check (double = -1.) const ;
int inversion () const;
void chirality_check () const ;
};
inline Slice<double> Matrix::diagonal ()
{
return Slice<double>(_begin, 3, 4);
}
inline ConstSlice<double> Matrix::diagonal () const
{
return ConstSlice<double>(_begin, 3, 4);
}
class Plane
{
Vector _normal;
double _dist;
Vector _orth [2];
public:
void set (const Vector& n, double d);
Plane ();
Plane(const Vector& n, double d) { set(n, d); }
const Vector& normal () const { return _normal; }
double dist () const { return _dist; }
const Vector& orth(int i) const { return _orth[i]; }
};
inline std::ostream& operator<< (std::ostream& to, const Plane& p)
{
to << "{normal = " << p.normal() << ", offset = " << p.dist() << "}";
return to;
}
// reference frame
struct Frame
{
Vector origin; // displacement
Matrix orient; // orientation matrix
void set(const Vector& v1, const Vector& v2, const Vector& v3)
{ origin = v1; orient = Matrix(v2 - v1, v3 - v1); }
Frame () : origin(0.), orient(1.) { }
Frame (const Vector& v1, const Vector& v2, const Vector& v3) { set(v1, v2, v3); }
void fv2lv (const double*, double*) const; // frame vector to lab vector
void lv2fv (const double*, double*) const; // lab vector to frame vector
void fp2lp (const double*, double*) const; // frame position to lab position
void lp2fp (const double*, double*) const; // lab position to frame position
};
} // D3 namespace
/*************************************************************************
*************************** QUATERNION **********************************
*************************************************************************/
class Quaternion : private Array<double> {
public:
enum { NOCHECK = 1 };
static double tolerance;
typedef const double* const_iterator;
typedef double* iterator;
typedef double value_type;
Quaternion () : Array<double>(4, 0.) {}
explicit Quaternion (double d) : Array<double>(4, 0.) { *begin() = d; }
explicit Quaternion (const double* p) : Array<double>(4) { Array<double>::operator=(p); }
explicit Quaternion (const D3::Matrix&, int =0) ;
template<class V>
explicit Quaternion (const V&) ;
int size () const { return Array<double>::size(); }
operator double* () { return Array<double>::begin(); }
operator const double* () const { return Array<double>::begin(); }
operator D3::Matrix () const ;
double* begin () { return Array<double>::begin(); }
const double* begin () const { return Array<double>::begin(); }
double* end () { return Array<double>::end(); }
const double* end () const { return Array<double>::end(); }
double& operator[] (int i) { return Array<double>::operator[](i); }
const double& operator[] (int i) const { return Array<double>::operator[](i); }
//vector operations
template<class V> Quaternion& operator= (const V&) ;
template<class V> Quaternion& operator+= (const V& v) { Array<double>::operator+=(v); return *this; }
template<class V> Quaternion& operator-= (const V& v) { Array<double>::operator-=(v); return *this; }
Quaternion& operator= (const double* p) { Array<double>::operator= (p); return *this; }
Quaternion& operator+= (const double* p) { Array<double>::operator+=(p); return *this; }
Quaternion& operator-= (const double* p) { Array<double>::operator-=(p); return *this; }
Quaternion& operator*= (double d) { Array<double>::operator*=(d); return *this; }
Quaternion& operator/= (double d) { Array<double>::operator/=(d); return *this; }
//quaternion operations
Quaternion operator* (const double*) const;
Quaternion operator/ (const double*) const;
Quaternion operator+ (const Quaternion& q) const { Quaternion res(*this); res += q; return res; }
Quaternion operator- (const Quaternion& q) const { Quaternion res(*this); res -= q; return res; }
void normalize ();
static void qprod (const double*, const double*, double*);
};
// quaternion-to-matrix transformation
void quat2mat (const double* q, D3::Matrix& m) ;
// (orthogonal) matrix-to-quaternion transformation
void mat2quat (const D3::Matrix& mat, double* q, int =0) ;
inline D3::Matrix::operator Quaternion () const
{
Quaternion res;
mat2quat(*this, res);
return res;
}
inline D3::Matrix::Matrix (const Quaternion& q)
{
quat2mat(q, *this);
}
inline Quaternion::operator D3::Matrix () const
{
D3::Matrix res;
quat2mat(*this, res);
return res;
}
inline Quaternion::Quaternion (const D3::Matrix& m, int flags)
: Array<double>(4)
{
mat2quat(m, *this, flags);
}
inline Quaternion Quaternion::operator* (const double* q) const
{
Quaternion res;
qprod(*this, q, res);
return res;
}
inline Quaternion Quaternion::operator/ (const double* q) const
{
Quaternion qtemp(q);
for(iterator it = qtemp.begin() + 1; it != qtemp.end(); ++it)
*it = - *it;
Quaternion res;
qprod(*this, qtemp, res);
res /= vdot(qtemp);
return res;
}
template<class V>
Quaternion::Quaternion (const V& v) : Array<double>(v)
{
const char funame [] = "Quaternion::Quaternion: ";
if(v.size() != 4) {
std::cerr << funame << "wrong initializer dimension (" << v.size() << ")/n";
throw Error::Range();
}
}
template<class V>
Quaternion& Quaternion::operator= (const V& v)
{
const char funame [] = "Quaternion::operator=: ";
if(v.size() != 4) {
std::cerr << funame << "dimensions mismatch\n";
throw Error::Range();
}
Array<double>::operator=(v);
return *this;
}
void axis_quaternion (int, double, double*);
void polar2cart (const double*, double*);
#endif
| 28.006536 | 103 | 0.590354 | [
"vector"
] |
130ad73ad100135eb7c817847986c2f64d112da6 | 9,546 | cpp | C++ | OGLFrameworkLib/gfx/glrenderer/MeshRenderable.cpp | dasmysh/OGLFrameworkLib_uulm | 36fd5e65d7fb028a07f9d4f95c543f27a23a7d24 | [
"MIT"
] | null | null | null | OGLFrameworkLib/gfx/glrenderer/MeshRenderable.cpp | dasmysh/OGLFrameworkLib_uulm | 36fd5e65d7fb028a07f9d4f95c543f27a23a7d24 | [
"MIT"
] | null | null | null | OGLFrameworkLib/gfx/glrenderer/MeshRenderable.cpp | dasmysh/OGLFrameworkLib_uulm | 36fd5e65d7fb028a07f9d4f95c543f27a23a7d24 | [
"MIT"
] | 1 | 2019-11-14T06:24:26.000Z | 2019-11-14T06:24:26.000Z | /**
* @file MeshRenderable.cpp
* @author Sebastian Maisch <sebastian.maisch@googlemail.com>
* @date 2015.12.15
*
* @brief Contains the implementation of MeshRenderable.
*/
#include "MeshRenderable.h"
#include "GPUProgram.h"
#include "gfx/mesh/SceneMeshNode.h"
#include "gfx/mesh/SubMesh.h"
#include "gfx/Material.h"
#include "GLTexture2D.h"
#include "GLTexture.h"
#include <glm/gtc/matrix_inverse.hpp>
namespace cgu {
/**
* Constructor.
* @param renderMesh the Mesh to use for rendering.
* @param prog the program used for rendering.
*/
MeshRenderable::MeshRenderable(const Mesh* renderMesh, const GLBuffer* vBuffer, GPUProgram* program) :
MeshRenderable(renderMesh, vBuffer, renderMesh->GetIndexBuffer(), program)
{
}
MeshRenderable::MeshRenderable(const Mesh* renderMesh, const GLBuffer* vBuffer, const GLBuffer* iBuffer, GPUProgram* program) :
mesh_(renderMesh),
vBuffer_(vBuffer),
iBuffer_(iBuffer),
drawProgram_(program)
{
}
/**
* Destructor.
*/
MeshRenderable::~MeshRenderable() = default;
/**
* Copy constructor.
* @param orig the original object
*/
MeshRenderable::MeshRenderable(const MeshRenderable& orig) :
mesh_(orig.mesh_),
iBuffer_(mesh_->GetIndexBuffer()),
vBuffer_(orig.vBuffer_),
drawProgram_(orig.drawProgram_),
drawAttribBinds_(orig.drawAttribBinds_)
{
/*auto bufferSize = 0;
OGL_CALL(glBindBuffer, GL_ARRAY_BUFFER, orig.vBuffer_);
OGL_CALL(glGetBufferParameteriv, GL_ARRAY_BUFFER, GL_BUFFER_SIZE, &bufferSize);
OGL_CALL(glBindBuffer, GL_ARRAY_BUFFER, vBuffer_);
OGL_CALL(glBufferData, GL_ARRAY_BUFFER, bufferSize, 0, GL_STATIC_COPY);
OGL_CALL(glBindBuffer, GL_ARRAY_BUFFER, orig.vBuffer_);
OGL_CALL(glBindBuffer, GL_COPY_WRITE_BUFFER, vBuffer_);
OGL_CALL(glCopyBufferSubData, GL_ARRAY_BUFFER, GL_COPY_WRITE_BUFFER, 0, 0, bufferSize);
OGL_CALL(glBindBuffer, GL_ARRAY_BUFFER, 0);
OGL_CALL(glBindBuffer, GL_COPY_WRITE_BUFFER, 0);*/
}
/**
* Move constructor.
* @param orig the original object
*/
MeshRenderable::MeshRenderable(MeshRenderable&& orig) :
mesh_(orig.mesh_),
vBuffer_(std::move(orig.vBuffer_)),
iBuffer_(std::move(orig.iBuffer_)),
drawProgram_(orig.drawProgram_),
drawAttribBinds_(std::move(orig.drawAttribBinds_))
{
orig.mesh_ = nullptr;
orig.drawProgram_ = nullptr;
}
/**
* Copy assignment operator.
* @param orig the original object
*/
MeshRenderable& MeshRenderable::operator=(const MeshRenderable& orig)
{
if (this != &orig) {
MeshRenderable tmp{ orig };
std::swap(*this, tmp);
}
return *this;
}
/**
* Move assignment operator.
* @param orig the original object
*/
MeshRenderable& MeshRenderable::operator=(MeshRenderable&& orig)
{
if (this != &orig) {
this->~MeshRenderable();
mesh_ = orig.mesh_;
vBuffer_ = std::move(orig.vBuffer_);
iBuffer_ = std::move(orig.iBuffer_);
drawProgram_ = orig.drawProgram_;
drawAttribBinds_ = std::move(orig.drawAttribBinds_);
orig.mesh_ = nullptr;
orig.drawProgram_ = nullptr;
}
return *this;
}
void MeshRenderable::Draw(const glm::mat4& modelMatrix, bool overrideBump) const
{
Draw<true>(modelMatrix, drawProgram_, drawAttribBinds_, overrideBump);
}
void MeshRenderable::DrawPart(const glm::mat4& modelMatrix, unsigned start, unsigned count, GLenum mode) const
{
drawProgram_->UseProgram();
OGL_CALL(glBindBuffer, GL_ARRAY_BUFFER, vBuffer_->GetBuffer());
drawAttribBinds_.GetVertexAttributes()[0]->EnableVertexAttributeArray();
auto localMatrix = mesh_->GetRootNode()->GetLocalTransform() * modelMatrix;
drawProgram_->SetUniform(drawAttribBinds_.GetUniformIds()[0], localMatrix);
drawProgram_->SetUniform(drawAttribBinds_.GetUniformIds()[1], glm::inverseTranspose(glm::mat3(localMatrix)));
OGL_CALL(glDrawElements, mode, count, GL_UNSIGNED_INT, (static_cast<char*>(nullptr)) + (start * sizeof(unsigned int)));
drawAttribBinds_.GetVertexAttributes()[0]->DisableVertexAttributeArray();
OGL_CALL(glBindBuffer, GL_ARRAY_BUFFER, 0);
}
/*void MeshRenderable::BindAsShaderBuffer(GLuint bindingPoint) const
{
OGL_CALL(glBindBufferBase, GL_SHADER_STORAGE_BUFFER, bindingPoint, vBuffer_);
}*/
template <bool useMaterials>
void MeshRenderable::Draw(const glm::mat4& modelMatrix, GPUProgram* program, const ShaderMeshAttributes& attribBinds, bool overrideBump) const
{
program->UseProgram();
OGL_CALL(glBindBuffer, GL_ARRAY_BUFFER, vBuffer_->GetBuffer());
attribBinds.GetVertexAttributes()[0]->EnableVertexAttributeArray();
DrawNode<useMaterials>(mesh_->GetRootTransform() * modelMatrix, mesh_->GetRootNode(), program, attribBinds, overrideBump);
attribBinds.GetVertexAttributes()[0]->DisableVertexAttributeArray();
OGL_CALL(glBindBuffer, GL_ARRAY_BUFFER, 0);
}
template <bool useMaterials>
void MeshRenderable::DrawNode(const glm::mat4& modelMatrix, const SceneMeshNode* node, GPUProgram* program, const ShaderMeshAttributes& attribBinds, bool overrideBump) const
{
auto localMatrix = node->GetLocalTransform() * modelMatrix;
for (unsigned int i = 0; i < node->GetNumMeshes(); ++i) DrawSubMesh<useMaterials>(localMatrix, program, attribBinds, node->GetMesh(i), overrideBump);
for (unsigned int i = 0; i < node->GetNumNodes(); ++i) DrawNode<useMaterials>(localMatrix, node->GetChild(i), program, attribBinds, overrideBump);
}
template<bool useMaterials> void MeshRenderable::DrawSubMesh(const glm::mat4& modelMatrix, GPUProgram* program,
const ShaderMeshAttributes& attribBinds, const SubMesh* subMesh, bool overrideBump) const
{
program->SetUniform(attribBinds.GetUniformIds()[0], modelMatrix);
program->SetUniform(attribBinds.GetUniformIds()[1], glm::inverseTranspose(glm::mat3(modelMatrix)));
UseMaterials<useMaterials>(program, attribBinds, subMesh, overrideBump);
OGL_CALL(glDrawElements, GL_TRIANGLES, subMesh->GetNumberOfIndices(), GL_UNSIGNED_INT,
(static_cast<char*> (nullptr)) + (subMesh->GetIndexOffset() * sizeof(unsigned int)));
}
template<bool useMaterials> void MeshRenderable::UseMaterials(GPUProgram*, const ShaderMeshAttributes&, const SubMesh*, bool) const {}
template<> void MeshRenderable::UseMaterials<true>(GPUProgram* program, const ShaderMeshAttributes& attribBinds,
const SubMesh* subMesh, bool overrideBump) const
{
if (subMesh->GetMaterial()->diffuseTex && attribBinds.GetUniformIds().size() != 0) {
subMesh->GetMaterial()->diffuseTex->GetTexture()->ActivateTexture(GL_TEXTURE0);
program->SetUniform(attribBinds.GetUniformIds()[2], 0);
}
if (subMesh->GetMaterial()->bumpTex && attribBinds.GetUniformIds().size() >= 2) {
subMesh->GetMaterial()->bumpTex->GetTexture()->ActivateTexture(GL_TEXTURE1);
program->SetUniform(attribBinds.GetUniformIds()[3], 1);
if (!overrideBump) program->SetUniform(attribBinds.GetUniformIds()[4], subMesh->GetMaterial()->bumpMultiplier);
}
}
/** Copy constructor. */
MeshRenderableShadowing::MeshRenderableShadowing(const MeshRenderableShadowing& rhs) = default;
/** Copy assignment operator. */
MeshRenderableShadowing& MeshRenderableShadowing::operator=(const MeshRenderableShadowing& rhs) = default;
/** Move constructor. */
MeshRenderableShadowing::MeshRenderableShadowing(MeshRenderableShadowing&& rhs) :
MeshRenderable(std::move(rhs)),
shadowProgram_(rhs.shadowProgram_),
shadowAttribBinds_(std::move(rhs.shadowAttribBinds_))
{
rhs.shadowProgram_ = nullptr;
}
/** Move assignment operator. */
MeshRenderableShadowing& MeshRenderableShadowing::operator=(MeshRenderableShadowing&& rhs)
{
if (this != &rhs) {
this->~MeshRenderableShadowing();
MeshRenderable::operator =(std::move(rhs));
shadowProgram_ = std::move(rhs.shadowProgram_);
shadowAttribBinds_ = std::move(rhs.shadowAttribBinds_);
}
return *this;
}
MeshRenderableShadowing::~MeshRenderableShadowing() = default;
void MeshRenderableShadowing::DrawShadow(const glm::mat4& modelMatrix) const
{
Draw<false>(modelMatrix, shadowProgram_, shadowAttribBinds_);
}
/**
* Constructor.
* @param renderMesh the mesh to render.
* @param program the GPU program for rendering.
* @param shadowProgram the GPU program for shadow map rendering.
*/
MeshRenderableShadowing::MeshRenderableShadowing(const Mesh* renderMesh, const GLBuffer* vBuffer, GPUProgram* program, GPUProgram* shadowProgram) :
MeshRenderable(renderMesh, vBuffer, program),
shadowProgram_(shadowProgram)
{
}
/** Helper constructor for implementing the copy constructor. */
MeshRenderableShadowing::MeshRenderableShadowing(const MeshRenderable& rhs, GPUProgram* shadowProgram) :
MeshRenderable(rhs),
shadowProgram_(shadowProgram)
{
}
}
| 40.621277 | 177 | 0.680075 | [
"mesh",
"render",
"object"
] |
130f6ac3f95e373654e482eb507b6d6d38c64de3 | 5,806 | cpp | C++ | advent/2021/23/23.1.cpp | evilmucedin/project-euler | 08ed51a5ff0d05f60271d99d35b3e601bcddf85d | [
"MIT"
] | 3 | 2020-03-23T04:31:14.000Z | 2021-01-17T09:03:09.000Z | advent/2021/23/23.1.cpp | evilmucedin/project-euler | 08ed51a5ff0d05f60271d99d35b3e601bcddf85d | [
"MIT"
] | null | null | null | advent/2021/23/23.1.cpp | evilmucedin/project-euler | 08ed51a5ff0d05f60271d99d35b3e601bcddf85d | [
"MIT"
] | 3 | 2018-03-28T20:53:27.000Z | 2020-04-27T07:03:02.000Z | #include "advent/lib/aoc.h"
#include "lib/init.h"
#include "lib/string.h"
#include "gflags/gflags.h"
#include "glog/logging.h"
DEFINE_int32(test, 1, "test number");
struct Item {
vector<vector<int>> rooms;
vector<int> hallway = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
void print() const {
REP(i, 4) {
if (rooms[i].size() == 2) {
cerr << char(rooms[i][0]) << ", " << char(rooms[i][1]) << endl;
} else if (rooms[i].size() == 1) {
cerr << char(rooms[i][0]) << endl;
} else {
cerr << endl;
}
}
REP(j, 11) {
cerr << (hallway[j] ? char(hallway[j]) : '.') << " ";
}
cerr << endl;
}
bool operator<(const Item& rhs) const {
if (rooms != rhs.rooms) {
return rooms < rhs.rooms;
}
return hallway < rhs.hallway;
}
};
Item read() {
const auto input = readInputLines();
Item res;
res.rooms.resize(4);
REP (i, 4) {
res.rooms[i].resize(2);
REP (j, 2) {
res.rooms[i][j] = input[3 - j][3 + 2*i];
}
}
return res;
}
bool isFinal(const Item& f) {
for (auto h: f.hallway) {
if (h) {
return false;
}
}
REP (i, 4) {
if (f.rooms[i].size() != 2) {
return false;
}
REP (j, 2) {
if (f.rooms[i][j] != 'A' + i) {
return false;
}
}
}
return true;
}
int costA(int a) {
switch (a) {
case 'A':
return 1;
case 'B':
return 10;
case 'C':
return 100;
case 'D':
return 1000;
default:
throw Exception("costA");
}
}
bool can1(const Item& f, int room, int hallway) {
if (hallway == 2 || hallway == 4 || hallway == 6 || hallway == 8) {
return false;
}
hallway += 1;
int x = room*2 + 3;
if (x < hallway) {
for (int i = x; i <= hallway; ++i) {
if (f.hallway[i - 1]) {
return false;
}
}
} else {
for (int i = hallway; i <= x; ++i) {
if (f.hallway[i - 1]) {
return false;
}
}
}
return true;
}
bool can2(const Item& f, int room, int hallway) {
if (hallway == 2 || hallway == 4 || hallway == 6 || hallway == 8) {
return false;
}
hallway += 1;
int x = room*2 + 3;
if (x == hallway) {
return true;
}
if (x < hallway) {
for (int i = x; i < hallway; ++i) {
if (f.hallway[i - 1]) {
return false;
}
}
} else {
for (int i = hallway + 1; i <= x; ++i) {
if (f.hallway[i - 1]) {
return false;
}
}
}
return true;
}
int cost1(int roomSize, int room, int hallway) {
hallway += 1;
int x = room*2 + 3;
int res = abs(x - hallway);
if (roomSize == 2) {
++res;
} else if (roomSize == 1) {
res += 2;
} else if (roomSize == 0) {
res += 3;
}
return res;
}
int cost2(int roomSize, int room, int hallway) {
hallway += 1;
int x = room*2 + 3;
int res = abs(x - hallway);
if (roomSize == 2) {
} else if (roomSize == 1) {
res += 1;
} else if (roomSize == 0) {
res += 2;
}
return res;
}
bool goodRoom(const Item& f, int room) {
for (int i = 0; i < f.rooms[room].size(); ++i) {
if (f.rooms[room][i] != room + 'A') {
return false;
}
}
return true;
}
int best = 1000000000;
priority_queue<pair<int, Item>> q;
map<Item, int> bestD;
void dfs(const Item& f0) {
q.emplace(0, f0);
while (!q.empty()) {
auto tp = q.top();
q.pop();
const auto f = tp.second;
const int d = -tp.first;
LOG_EVERY_MS(INFO, 1000) << d << " " << best;
if (isFinal(f)) {
if (d < best) {
best = d;
}
continue;
}
const auto toItem = bestD.find(f);
if (toItem != bestD.end() && toItem->second <= d) {
continue;
}
bestD.emplace(f, d);
/*
cerr << d << " " << best << endl;
f.print();
cerr << endl;
*/
REP(i, 4) {
if (!f.rooms[i].empty()) {
REP(j, 11) {
if (can1(f, i, j)) {
auto nf = f;
const auto a = nf.rooms[i].back();
auto nd = d + cost1(nf.rooms[i].size(), i, j) * costA(a);
nf.rooms[i].pop_back();
nf.hallway[j] = a;
q.emplace(-nd, nf);
}
}
}
}
REP(j, 11) {
if (f.hallway[j]) {
auto a = f.hallway[j];
const int i = f.hallway[j] - 'A';
if (goodRoom(f, i)) {
if (can2(f, i, j)) {
auto nf = f;
auto nd = d + cost2(nf.rooms[i].size(), i, j) * costA(a);
nf.rooms[i].push_back(a);
nf.hallway[j] = 0;
q.emplace(-nd, nf);
}
}
}
}
}
}
void first() {
const auto input = read();
input.print();
dfs(input);
cout << best << endl;
}
void second() {
const auto input = readInputLines();
cout << endl;
}
int main(int argc, char* argv[]) {
standardInit(argc, argv);
if (FLAGS_test == 1) {
first();
} else if (FLAGS_test == 2) {
second();
}
return 0;
}
| 22.160305 | 81 | 0.396142 | [
"vector"
] |
13133c80b1185d224250bb2efe9b7bf08ef20661 | 2,823 | hpp | C++ | ThirdParty-mod/java2cpp/java/util/NoSuchElementException.hpp | kakashidinho/HQEngine | 8125b290afa7c62db6cc6eac14e964d8138c7fd0 | [
"MIT"
] | 1 | 2019-04-03T01:53:28.000Z | 2019-04-03T01:53:28.000Z | ThirdParty-mod/java2cpp/java/util/NoSuchElementException.hpp | kakashidinho/HQEngine | 8125b290afa7c62db6cc6eac14e964d8138c7fd0 | [
"MIT"
] | null | null | null | ThirdParty-mod/java2cpp/java/util/NoSuchElementException.hpp | kakashidinho/HQEngine | 8125b290afa7c62db6cc6eac14e964d8138c7fd0 | [
"MIT"
] | null | null | null | /*================================================================================
code generated by: java2cpp
author: Zoran Angelov, mailto://baldzar@gmail.com
class: java.util.NoSuchElementException
================================================================================*/
#ifndef J2CPP_INCLUDE_IMPLEMENTATION
#ifndef J2CPP_JAVA_UTIL_NOSUCHELEMENTEXCEPTION_HPP_DECL
#define J2CPP_JAVA_UTIL_NOSUCHELEMENTEXCEPTION_HPP_DECL
namespace j2cpp { namespace java { namespace lang { class RuntimeException; } } }
namespace j2cpp { namespace java { namespace lang { class String; } } }
#include <java/lang/RuntimeException.hpp>
#include <java/lang/String.hpp>
namespace j2cpp {
namespace java { namespace util {
class NoSuchElementException;
class NoSuchElementException
: public object<NoSuchElementException>
{
public:
J2CPP_DECLARE_CLASS
J2CPP_DECLARE_METHOD(0)
J2CPP_DECLARE_METHOD(1)
explicit NoSuchElementException(jobject jobj)
: object<NoSuchElementException>(jobj)
{
}
operator local_ref<java::lang::RuntimeException>() const;
NoSuchElementException();
NoSuchElementException(local_ref< java::lang::String > const&);
}; //class NoSuchElementException
} //namespace util
} //namespace java
} //namespace j2cpp
#endif //J2CPP_JAVA_UTIL_NOSUCHELEMENTEXCEPTION_HPP_DECL
#else //J2CPP_INCLUDE_IMPLEMENTATION
#ifndef J2CPP_JAVA_UTIL_NOSUCHELEMENTEXCEPTION_HPP_IMPL
#define J2CPP_JAVA_UTIL_NOSUCHELEMENTEXCEPTION_HPP_IMPL
namespace j2cpp {
java::util::NoSuchElementException::operator local_ref<java::lang::RuntimeException>() const
{
return local_ref<java::lang::RuntimeException>(get_jobject());
}
java::util::NoSuchElementException::NoSuchElementException()
: object<java::util::NoSuchElementException>(
call_new_object<
java::util::NoSuchElementException::J2CPP_CLASS_NAME,
java::util::NoSuchElementException::J2CPP_METHOD_NAME(0),
java::util::NoSuchElementException::J2CPP_METHOD_SIGNATURE(0)
>()
)
{
}
java::util::NoSuchElementException::NoSuchElementException(local_ref< java::lang::String > const &a0)
: object<java::util::NoSuchElementException>(
call_new_object<
java::util::NoSuchElementException::J2CPP_CLASS_NAME,
java::util::NoSuchElementException::J2CPP_METHOD_NAME(1),
java::util::NoSuchElementException::J2CPP_METHOD_SIGNATURE(1)
>(a0)
)
{
}
J2CPP_DEFINE_CLASS(java::util::NoSuchElementException,"java/util/NoSuchElementException")
J2CPP_DEFINE_METHOD(java::util::NoSuchElementException,0,"<init>","()V")
J2CPP_DEFINE_METHOD(java::util::NoSuchElementException,1,"<init>","(Ljava/lang/String;)V")
} //namespace j2cpp
#endif //J2CPP_JAVA_UTIL_NOSUCHELEMENTEXCEPTION_HPP_IMPL
#endif //J2CPP_INCLUDE_IMPLEMENTATION
| 26.632075 | 102 | 0.716968 | [
"object"
] |
131aae1de8b598b90f70b1d7707ff332c0b276a3 | 7,242 | cc | C++ | logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.cc | wyshen2020/webrtc | b93e2240f1653b82e24553e092bbab84337774af | [
"BSD-3-Clause"
] | 2 | 2022-03-10T01:47:56.000Z | 2022-03-31T12:51:46.000Z | logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.cc | wyshen2020/webrtc | b93e2240f1653b82e24553e092bbab84337774af | [
"BSD-3-Clause"
] | null | null | null | logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.cc | wyshen2020/webrtc | b93e2240f1653b82e24553e092bbab84337774af | [
"BSD-3-Clause"
] | null | null | null | /*
* Copyright (c) 2021 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_v3.h"
#include <string>
#include <vector>
#include "absl/types/optional.h"
#include "logging/rtc_event_log/encoder/rtc_event_log_encoder_common.h"
#include "logging/rtc_event_log/encoder/var_int.h"
#include "logging/rtc_event_log/events/rtc_event_alr_state.h"
#include "logging/rtc_event_log/events/rtc_event_audio_network_adaptation.h"
#include "logging/rtc_event_log/events/rtc_event_audio_playout.h"
#include "logging/rtc_event_log/events/rtc_event_audio_receive_stream_config.h"
#include "logging/rtc_event_log/events/rtc_event_audio_send_stream_config.h"
#include "logging/rtc_event_log/events/rtc_event_begin_log.h"
#include "logging/rtc_event_log/events/rtc_event_bwe_update_delay_based.h"
#include "logging/rtc_event_log/events/rtc_event_bwe_update_loss_based.h"
#include "logging/rtc_event_log/events/rtc_event_dtls_transport_state.h"
#include "logging/rtc_event_log/events/rtc_event_dtls_writable_state.h"
#include "logging/rtc_event_log/events/rtc_event_end_log.h"
#include "logging/rtc_event_log/events/rtc_event_frame_decoded.h"
#include "logging/rtc_event_log/events/rtc_event_generic_ack_received.h"
#include "logging/rtc_event_log/events/rtc_event_generic_packet_received.h"
#include "logging/rtc_event_log/events/rtc_event_generic_packet_sent.h"
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair.h"
#include "logging/rtc_event_log/events/rtc_event_ice_candidate_pair_config.h"
#include "logging/rtc_event_log/events/rtc_event_probe_cluster_created.h"
#include "logging/rtc_event_log/events/rtc_event_probe_result_failure.h"
#include "logging/rtc_event_log/events/rtc_event_probe_result_success.h"
#include "logging/rtc_event_log/events/rtc_event_remote_estimate.h"
#include "logging/rtc_event_log/events/rtc_event_route_change.h"
#include "logging/rtc_event_log/events/rtc_event_rtcp_packet_incoming.h"
#include "logging/rtc_event_log/events/rtc_event_rtcp_packet_outgoing.h"
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_incoming.h"
#include "logging/rtc_event_log/events/rtc_event_rtp_packet_outgoing.h"
#include "logging/rtc_event_log/events/rtc_event_video_receive_stream_config.h"
#include "logging/rtc_event_log/events/rtc_event_video_send_stream_config.h"
#include "rtc_base/checks.h"
#include "rtc_base/logging.h"
namespace webrtc {
std::string RtcEventLogEncoderV3::EncodeLogStart(int64_t timestamp_us,
int64_t utc_time_us) {
std::unique_ptr<RtcEventBeginLog> begin_log =
std::make_unique<RtcEventBeginLog>(Timestamp::Micros(timestamp_us),
Timestamp::Micros(utc_time_us));
std::vector<const RtcEvent*> batch;
batch.push_back(begin_log.get());
std::string encoded_event = RtcEventBeginLog::Encode(batch);
return encoded_event;
}
std::string RtcEventLogEncoderV3::EncodeLogEnd(int64_t timestamp_us) {
std::unique_ptr<RtcEventEndLog> end_log =
std::make_unique<RtcEventEndLog>(Timestamp::Micros(timestamp_us));
std::vector<const RtcEvent*> batch;
batch.push_back(end_log.get());
std::string encoded_event = RtcEventEndLog::Encode(batch);
return encoded_event;
}
RtcEventLogEncoderV3::RtcEventLogEncoderV3() {
encoders_[RtcEvent::Type::AlrStateEvent] = RtcEventAlrState::Encode;
encoders_[RtcEvent::Type::AudioNetworkAdaptation] =
RtcEventAudioNetworkAdaptation::Encode;
encoders_[RtcEvent::Type::AudioPlayout] = RtcEventAudioPlayout::Encode;
encoders_[RtcEvent::Type::AudioReceiveStreamConfig] =
RtcEventAudioReceiveStreamConfig::Encode;
encoders_[RtcEvent::Type::AudioSendStreamConfig] =
RtcEventAudioSendStreamConfig::Encode;
encoders_[RtcEvent::Type::BweUpdateDelayBased] =
RtcEventBweUpdateDelayBased::Encode;
encoders_[RtcEvent::Type::BweUpdateLossBased] =
RtcEventBweUpdateLossBased::Encode;
encoders_[RtcEvent::Type::DtlsTransportState] =
RtcEventDtlsTransportState::Encode;
encoders_[RtcEvent::Type::DtlsWritableState] =
RtcEventDtlsWritableState::Encode;
encoders_[RtcEvent::Type::FrameDecoded] = RtcEventFrameDecoded::Encode;
encoders_[RtcEvent::Type::GenericAckReceived] =
RtcEventGenericAckReceived::Encode;
encoders_[RtcEvent::Type::GenericPacketReceived] =
RtcEventGenericPacketReceived::Encode;
encoders_[RtcEvent::Type::GenericPacketSent] =
RtcEventGenericPacketSent::Encode;
encoders_[RtcEvent::Type::IceCandidatePairConfig] =
RtcEventIceCandidatePairConfig::Encode;
encoders_[RtcEvent::Type::IceCandidatePairEvent] =
RtcEventIceCandidatePair::Encode;
encoders_[RtcEvent::Type::ProbeClusterCreated] =
RtcEventProbeClusterCreated::Encode;
encoders_[RtcEvent::Type::ProbeResultFailure] =
RtcEventProbeResultFailure::Encode;
encoders_[RtcEvent::Type::ProbeResultSuccess] =
RtcEventProbeResultSuccess::Encode;
encoders_[RtcEvent::Type::RemoteEstimateEvent] =
RtcEventRemoteEstimate::Encode;
encoders_[RtcEvent::Type::RouteChangeEvent] = RtcEventRouteChange::Encode;
encoders_[RtcEvent::Type::RtcpPacketIncoming] =
RtcEventRtcpPacketIncoming::Encode;
encoders_[RtcEvent::Type::RtcpPacketOutgoing] =
RtcEventRtcpPacketOutgoing::Encode;
encoders_[RtcEvent::Type::RtpPacketIncoming] =
RtcEventRtpPacketIncoming::Encode;
encoders_[RtcEvent::Type::RtpPacketOutgoing] =
RtcEventRtpPacketOutgoing::Encode;
encoders_[RtcEvent::Type::VideoReceiveStreamConfig] =
RtcEventVideoReceiveStreamConfig::Encode;
encoders_[RtcEvent::Type::VideoSendStreamConfig] =
RtcEventVideoSendStreamConfig::Encode;
}
std::string RtcEventLogEncoderV3::EncodeBatch(
std::deque<std::unique_ptr<RtcEvent>>::const_iterator begin,
std::deque<std::unique_ptr<RtcEvent>>::const_iterator end) {
struct EventGroupKey {
// Events are grouped by event type. For compression efficiency,
// events can optionally have a secondary key, in most cases the
// SSRC.
RtcEvent::Type type;
uint32_t secondary_group_key;
bool operator<(EventGroupKey other) const {
return type < other.type ||
(type == other.type &&
secondary_group_key < other.secondary_group_key);
}
};
std::map<EventGroupKey, std::vector<const RtcEvent*>> event_groups;
for (auto it = begin; it != end; ++it) {
event_groups[{(*it)->GetType(), (*it)->GetGroupKey()}].push_back(it->get());
}
std::string encoded_output;
for (auto& kv : event_groups) {
auto it = encoders_.find(kv.first.type);
RTC_DCHECK(it != encoders_.end());
if (it != encoders_.end()) {
auto& encoder = it->second;
// TODO(terelius): Use some "string builder" or preallocate?
encoded_output += encoder(kv.second);
}
}
return encoded_output;
}
} // namespace webrtc
| 43.890909 | 80 | 0.7723 | [
"vector"
] |
131bf09c239bf8eb14b4379024ed554032491d55 | 6,582 | cpp | C++ | practica_6/practica_6_alt/practica6_texturizado.cpp | ValdrST/lab_computacion_grafica | 5971e7a57acafd9df93463da533e756608cde066 | [
"MIT"
] | null | null | null | practica_6/practica_6_alt/practica6_texturizado.cpp | ValdrST/lab_computacion_grafica | 5971e7a57acafd9df93463da533e756608cde066 | [
"MIT"
] | null | null | null | practica_6/practica_6_alt/practica6_texturizado.cpp | ValdrST/lab_computacion_grafica | 5971e7a57acafd9df93463da533e756608cde066 | [
"MIT"
] | null | null | null | /*
Semestre 2020-2
Pr�ctica 6 Texturizado
Usando librer�a stb_image.h
*/
//para cargar imagen
#define STB_IMAGE_IMPLEMENTATION
#include <stdio.h>
#include <string.h>
#include<cmath>
#include<vector>
#include <glew.h>
#include <glfw3.h>
//glm
#include<glm.hpp>
#include<gtc/matrix_transform.hpp>
#include<gtc/type_ptr.hpp>
#include <gtc/random.hpp>
//clases para dar orden y limpieza al c�digo
#include"Mesh.h"
#include"Shader.h"
#include "Sphere.h"
#include"Window.h"
#include "Camera.h"
#include"Texture.h"
//Dimensiones de la ventana
const float toRadians = 3.14159265f/180.0; //grados a radianes
GLfloat deltaTime = 0.0f;
GLfloat lastTime = 0.0f;
float codo = 0.0f;
Texture T_ladrillos;
Texture T_asfalto;
Texture T_dado;
Camera camera;
Window mainWindow;
std::vector<Mesh*> meshList;
std::vector<Shader>shaderList;
//Vertex Shader
static const char* vShader = "shaders/shader_t.vert";
static const char* fShader = "shaders/shader_t.frag";
Sphere sp = Sphere(1, 20, 20);
void CreateObject()
{
unsigned int indices[] = {
0,3,1,
1,3,2,
2,3,0,
0,1,2
};
GLfloat vertices[] = {
-0.5f, -0.5f,0.5f, 0.0f, 0.0f,
0.0f,-0.5f,0.5f, 1.0f, 0.0f,
0.5f,-0.5f, 0.0f, 1.0f, 1.0f,
0.0f,0.5f,0.0f, 0.0f, 1.0f
};
Mesh *obj1 = new Mesh();
obj1->CreateMesh(vertices, indices, 12, 12);
meshList.push_back(obj1);
}
//ejercicio 1 para hacer en clase, el cubo
void CrearCubo(){
unsigned int cubo_indices[] = {
// front
0, 1, 2,
2, 3, 0,
// right
1, 4, 5,
1, 5, 2,
//left
6, 0, 3,
6, 3, 7,
//bottom
0, 1, 8,
1, 8, 9,
// up
2, 3, 10,
2, 10, 11,
//back
12, 13, 14,
12, 14, 15,
};
GLfloat cubo_vertices[] = {
// front
//x y z u v
-0.5f, -0.5f, 0.5f, 0.33f, 0.50f, // 0
0.5f, -0.5f, 0.5f, 0.66f, 0.50f, // 1
0.5f, 0.5f, 0.5f, 0.66f, 0.75f, // 2
-0.5f, 0.5f, 0.5f, 0.33f, 0.75f, // 3
//right
0.5f, -0.5f, -0.5f, 0.99f, 0.50f, // 4
0.5f, 0.5f, -0.5f, 0.99f, 0.75f, // 5
//left
-0.5f, -0.5f, -0.5f, 0.0f, 0.50f, // 6
-0.5f, 0.5f, -0.5f, 0.0f, 0.75f, // 7
//bottom
-0.5f, -0.5f, -0.5f, 0.33f, 0.25f, // 8
0.5f, -0.5f, -0.5f, 0.66f, 0.25f, // 9
// up
-0.5f, 0.5f, -0.5f, 0.33f, 1.0f, // 10
0.5f, 0.5f, -0.5f, 0.66f, 1.0f, // 11
// back
-0.5f, -0.5f, -0.5f, 0.33f, 0.0f, // 12
0.5f, -0.5f, -0.5f, 0.66f, 0.0f, // 13
0.5f, 0.5f, -0.5f, 0.66f, 0.25f, // 14
-0.5f, 0.5f, -0.5f, 0.33f, 0.25f, // 15
};
int tamano_vertices = sizeof(cubo_vertices)/sizeof(cubo_vertices[0]);
Mesh *cubo = new Mesh();
cubo->CreateMesh(cubo_vertices, cubo_indices,tamano_vertices, 36);
meshList.push_back(cubo);
}
void CrearDado10(){
unsigned int dado_indices[] = {
// Arriba
0, 1, 2,
2, 3, 0,
0, 3, 4,
4, 5, 0,
0, 5, 6,
6, 7, 0,
0, 7, 8,
8, 9, 0,
0, 9, 10,
10, 11, 0,
// Abajo
23, 12, 13,
13, 14, 23,
23, 14, 15,
14, 15, 23,
23, 15, 16,
16, 17, 23,
23, 17, 18,
18, 19, 23,
23, 19, 20,
20, 21, 23,
23, 21, 22
};
GLfloat dado_vertices[] = {
// front
//x y z u v
0.0f, 0.0f, 0.5f, 0.637f, 0.7402f, // superior
0.5f, 0.0f, 0.05f, 0.9942f, 0.8781f, // 1
0.4f, 0.29f, -0.05f, 0.8886f, 0.981f, // 2
0.15f, 0.48f, 0.05f, 0.6776f, 0.9782f, // 3
-0.15f, 0.48f, -0.05f, 0.4639f, 1.0f, // 4
-0.4f, 0.29f, 0.05f, 0.3259f, 0.9133f, // 5
-0.5f, 0.0f, -0.05f, 0.1771f, 0.8186f, // 6
-0.4f, -0.29f, 0.05f, 0.2176f, 0.6969f, // 7
-0.15f, -0.48f, -0.05f,0.2501f, 0.5751f, // 8
0.15f, -0.48f, 0.05f, 0.4449f, 0.5345f, // 9
0.4f, -0.29f, -0.05f, 0.6343f, 0.4669f, // 10
0.5f, 0.0f, 0.05f, 0.8183f, 0.5264f, // 11
0.4f, -0.29f, -0.05f, 0.6343f, 0.4669f, // 12 10
0.15f, -0.48f, 0.05f, 0.4449f, 0.5345f, // 13 9
-0.15f, -0.48f, -0.05f, 0.2609f, 0.4669f, // 14 8
-0.4f, -0.29f, 0.05f, 0.0661f, 0.4155f, // 15 7
-0.5f, 0.0f, -0.05f, 0.0391f, 0.291f, // 16 6
-0.4f, 0.29f, 0.05f, 0.0012f, 0.1666f, // 17 5
-0.15f, 0.48f, -0.05f, 0.1365f, 0.0854f, // 18 4
0.15f, 0.48f, 0.05f, 0.2745f, 0.0042f, // 19 3
0.4f, 0.29f, -0.05f, 0.4882f, 0.015f, // 20 2
0.5f, 0.0f, 0.05f, 0.7019f, 0.0259f, // 21 1
0.4f, -0.29f, -0.05f, 0.8102f, 0.1233f, // 22 12
0.0f, 0.0f, -0.5f,0.4449f, 0.2504f // Inferior
};
int tamano_vertices = sizeof(dado_vertices)/sizeof(dado_vertices[0]);
int tamano_indices = sizeof(dado_indices)/sizeof(dado_indices[0]);
Mesh *cubo = new Mesh();
cubo->CreateMesh(dado_vertices, dado_indices,tamano_vertices, tamano_indices);
meshList.push_back(cubo);
}
void CreateShaders(){
Shader *shader1 = new Shader();
shader1->CreateFromFiles(vShader, fShader);
shaderList.push_back(*shader1);
}
int main(){
mainWindow = Window(1920, 1080);
mainWindow.Initialise();
CreateObject();
CrearCubo();
CrearDado10();
CreateShaders();
camera = Camera(glm::vec3(1.0f, 0.0f, 0.0f), glm::vec3(0.0f, 1.0f, 0.0f), -90.0f, 0.0f, 3.0f, 0.3f);
//para crear la textura
T_dado = Texture("Textures/dado_10.tga");
T_dado.LoadTexture();
GLuint uniformProjection = 0;
GLuint uniformModel = 0;
GLuint uniformView = 0;
glm::mat4 projection = glm::perspective(45.0f, (GLfloat)mainWindow.getBufferWidth() / mainWindow.getBufferHeight(), 0.1f, 100.0f);
//Loop mientras no se cierra la ventana
while (!mainWindow.getShouldClose()){
GLfloat now = glfwGetTime(); // SDL_GetPerformanceCounter();
deltaTime = now - lastTime; // (now - lastTime)*1000/SDL_GetPerformanceFrequency();
lastTime = now;
//Recibir eventos del usuario
glfwPollEvents();
camera.keyControl(mainWindow.getsKeys(), deltaTime);
camera.mouseControl(mainWindow.getXChange(), mainWindow.getYChange());
//Limpiar la ventana
glClearColor(0.0f,0.0f,0.0f,1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); //Se agrega limpiar el buffer de profundidad
shaderList[0].useShader();
uniformModel = shaderList[0].getModelLocation();
uniformProjection = shaderList[0].getProjectLocation();
uniformView = shaderList[0].getViewLocation();
//ejercicio 1:
glm::mat4 model(1.0);
glUniformMatrix4fv(uniformModel, 1, GL_FALSE, glm::value_ptr(model));
glUniformMatrix4fv(uniformProjection, 1, GL_FALSE, glm::value_ptr(projection));
glUniformMatrix4fv(uniformView, 1, GL_FALSE, glm::value_ptr(camera.calculateViewMatrix()));
model = glm::mat4(1.0);
glUniformMatrix4fv(uniformModel, 1, GL_FALSE, glm::value_ptr(model));
T_dado.UseTexture();
meshList[2]->RenderMesh();
glUseProgram(0);
mainWindow.swapBuffers();
}
return 0;
} | 27.539749 | 132 | 0.604527 | [
"mesh",
"vector",
"model"
] |
131f7364e20ee5874149c381238fe2d9903831e0 | 20,193 | cc | C++ | omaha/tools/goopdump/data_dumper_goopdate.cc | whitemike889/omaha | c8a6457a07e1f697a9b9bea7f0777018a207b8d7 | [
"Apache-2.0"
] | 4 | 2021-09-17T00:05:50.000Z | 2021-12-16T18:08:47.000Z | omaha/tools/goopdump/data_dumper_goopdate.cc | richard9810/chrome-mobile-ie- | 6aa9d7bfed998a0cd1854f04945b77206fea251d | [
"Apache-2.0"
] | 2 | 2021-09-21T15:48:48.000Z | 2021-09-24T19:58:14.000Z | omaha/tools/goopdump/data_dumper_goopdate.cc | richard9810/chrome-mobile-ie- | 6aa9d7bfed998a0cd1854f04945b77206fea251d | [
"Apache-2.0"
] | 3 | 2021-09-17T00:06:52.000Z | 2021-12-27T16:48:24.000Z | // Copyright 2008-2009 Google Inc.
//
// 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 "omaha/tools/goopdump/data_dumper_goopdate.h"
#include <atltime.h>
#include <mstask.h>
#include <psapi.h>
#include <regstr.h>
#include <tlhelp32.h>
#include <list>
#include <memory>
#include "omaha/common/constants.h"
#include "omaha/common/error.h"
#include "omaha/common/file.h"
#include "omaha/common/file_reader.h"
#include "omaha/common/reg_key.h"
#include "omaha/common/scoped_ptr_cotask.h"
#include "omaha/common/service_utils.h"
#include "omaha/common/time.h"
#include "omaha/goopdate/config_manager.h"
#include "omaha/goopdate/const_goopdate.h"
#include "omaha/goopdate/event_logger.h"
#include "omaha/goopdate/goopdate_utils.h"
#include "omaha/tools/goopdump/dump_log.h"
#include "omaha/tools/goopdump/goopdump_cmd_line_parser.h"
#include "omaha/tools/goopdump/process_commandline.h"
namespace {
CString FormatRunTimeString(SYSTEMTIME* system_time) {
SYSTEMTIME local_time = {0};
::SystemTimeToTzSpecificLocalTime(NULL, system_time, &local_time);
CString str;
str.Format(_T("%02d/%02d/%04d %02d:%02d:%02d"),
local_time.wMonth,
local_time.wDay,
local_time.wYear,
local_time.wHour,
local_time.wMinute,
local_time.wSecond);
return str;
}
} // namespace
namespace omaha {
DataDumperGoopdate::DataDumperGoopdate() {
}
DataDumperGoopdate::~DataDumperGoopdate() {
}
HRESULT DataDumperGoopdate::Process(const DumpLog& dump_log,
const GoopdumpCmdLineArgs& args) {
UNREFERENCED_PARAMETER(args);
DumpHeader header(dump_log, _T("Goopdate Data"));
dump_log.WriteLine(_T(""));
dump_log.WriteLine(_T("-- GENERAL / GLOBAL DATA --"));
DumpHostsFile(dump_log);
DumpGoogleUpdateIniFile(dump_log);
DumpUpdateDevKeys(dump_log);
DumpLogFile(dump_log);
DumpEventLog(dump_log);
DumpGoogleUpdateProcessInfo(dump_log);
if (args.is_machine) {
dump_log.WriteLine(_T(""));
dump_log.WriteLine(_T("-- PER-MACHINE DATA --"));
DumpDirContents(dump_log, true);
DumpServiceInfo(dump_log);
}
if (args.is_user) {
dump_log.WriteLine(_T(""));
dump_log.WriteLine(_T("-- PER-USER DATA --"));
DumpDirContents(dump_log, false);
DumpRunKeys(dump_log);
}
DumpScheduledTaskInfo(dump_log, args.is_machine);
return S_OK;
}
void DataDumperGoopdate::DumpDirContents(const DumpLog& dump_log,
bool is_machine) {
DumpHeader header(dump_log, _T("Directory Contents"));
CString registered_version;
if (FAILED(GetRegisteredVersion(is_machine, ®istered_version))) {
dump_log.WriteLine(_T("Failed to get registered version."));
return;
}
CString dll_dir;
if (FAILED(GetDllDir(is_machine, &dll_dir))) {
dump_log.WriteLine(_T("Failed to get dlldir."));
return;
}
dump_log.WriteLine(_T("Version:\t%s"), registered_version);
dump_log.WriteLine(_T("Dll Dir:\t%s"), dll_dir);
// Enumerate all files in the DllPath and log them.
std::vector<CString> matching_paths;
HRESULT hr = File::GetWildcards(dll_dir, _T("*.*"), &matching_paths);
if (SUCCEEDED(hr)) {
dump_log.WriteLine(_T(""));
dump_log.WriteLine(_T("Files in DllDir:"));
for (size_t i = 0; i < matching_paths.size(); ++i) {
dump_log.WriteLine(matching_paths[i]);
}
dump_log.WriteLine(_T(""));
} else {
dump_log.WriteLine(_T("Failure getting files in DllDir (0x%x)."), hr);
}
}
HRESULT DataDumperGoopdate::GetRegisteredVersion(bool is_machine,
CString* version) {
HKEY key = NULL;
LONG res = ::RegOpenKeyEx(is_machine ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER,
GOOPDATE_REG_RELATIVE_CLIENTS GOOPDATE_APP_ID,
0,
KEY_READ,
&key);
if (ERROR_SUCCESS != res) {
return HRESULT_FROM_WIN32(res);
}
DWORD type = 0;
DWORD version_length = 50;
res = ::SHQueryValueEx(key,
omaha::kRegValueProductVersion,
NULL,
&type,
CStrBuf(*version, version_length),
&version_length);
if (ERROR_SUCCESS != res) {
return HRESULT_FROM_WIN32(res);
}
if (REG_SZ != type) {
return E_UNEXPECTED;
}
return S_OK;
}
HRESULT DataDumperGoopdate::GetDllDir(bool is_machine, CString* dll_path) {
TCHAR path[MAX_PATH] = {0};
CString base_path = goopdate_utils::BuildGoogleUpdateExeDir(is_machine);
// Try the side-by-side DLL first.
_tcscpy_s(path, arraysize(path), base_path);
if (!::PathAppend(path, omaha::kGoopdateDllName)) {
return HRESULTFromLastError();
}
if (File::Exists(path)) {
*dll_path = base_path;
return S_OK;
}
// Try the version subdirectory.
_tcscpy_s(path, arraysize(path), base_path);
CString version;
HRESULT hr = GetRegisteredVersion(is_machine, &version);
if (FAILED(hr)) {
return hr;
}
if (!::PathAppend(path, version)) {
return HRESULTFromLastError();
}
base_path = path;
if (!::PathAppend(path, omaha::kGoopdateDllName)) {
return HRESULTFromLastError();
}
if (!File::Exists(path)) {
return GOOGLEUPDATE_E_DLL_NOT_FOUND;
}
*dll_path = base_path;
return S_OK;
}
void DataDumperGoopdate::DumpGoogleUpdateIniFile(const DumpLog& dump_log) {
DumpHeader header(dump_log, MAIN_EXE_BASE_NAME _T(".ini File Contents"));
DumpFileContents(dump_log, _T("c:\\googleupdate.ini"), 0);
}
void DataDumperGoopdate::DumpHostsFile(const DumpLog& dump_log) {
DumpHeader header(dump_log, _T("Hosts File Contents"));
TCHAR system_path[MAX_PATH] = {0};
HRESULT hr = ::SHGetFolderPath(NULL,
CSIDL_SYSTEM,
NULL,
SHGFP_TYPE_CURRENT,
system_path);
if (FAILED(hr)) {
dump_log.WriteLine(_T("Can't get System folder: 0x%x"), hr);
return;
}
CPath full_path = system_path;
full_path.Append(_T("drivers\\etc\\hosts"));
DumpFileContents(dump_log, full_path, 0);
}
void DataDumperGoopdate::DumpUpdateDevKeys(const DumpLog& dump_log) {
DumpHeader header(dump_log, _T("UpdateDev Keys"));
DumpRegistryKeyData(dump_log, _T("HKLM\\Software\\") PATH_COMPANY_NAME _T("\\UpdateDev"));
}
void DataDumperGoopdate::DumpLogFile(const DumpLog& dump_log) {
DumpHeader header(dump_log, _T("Debug Log File Contents"));
Logging logger;
CString log_file_path(logger.GetLogFilePath());
DumpFileContents(dump_log, log_file_path, 500);
}
CString EventLogTypeToString(WORD event_log_type) {
CString str = _T("Unknown");
switch (event_log_type) {
case EVENTLOG_ERROR_TYPE:
str = _T("ERROR");
break;
case EVENTLOG_WARNING_TYPE:
str = _T("WARNING");
break;
case EVENTLOG_INFORMATION_TYPE:
str = _T("INFORMATION");
break;
case EVENTLOG_AUDIT_SUCCESS:
str = _T("AUDIT_SUCCESS");
break;
case EVENTLOG_AUDIT_FAILURE:
str = _T("AUDIT_FAILURE");
break;
default:
str = _T("Unknown");
break;
}
return str;
}
void DataDumperGoopdate::DumpEventLog(const DumpLog& dump_log) {
DumpHeader header(dump_log, _T("Google Update Event Log Entries"));
HANDLE handle_event_log = ::OpenEventLog(NULL, _T("Application"));
if (handle_event_log == NULL) {
return;
}
const int kInitialBufferSize = 8192;
int buffer_size = kInitialBufferSize;
std::unique_ptr<TCHAR[]> buffer(new TCHAR[buffer_size]);
while (1) {
EVENTLOGRECORD* record = reinterpret_cast<EVENTLOGRECORD*>(buffer.get());
DWORD num_bytes_read = 0;
DWORD bytes_needed = 0;
if (!::ReadEventLog(handle_event_log,
EVENTLOG_FORWARDS_READ | EVENTLOG_SEQUENTIAL_READ,
0,
record,
buffer_size,
&num_bytes_read,
&bytes_needed)) {
const int err = ::GetLastError();
if (ERROR_INSUFFICIENT_BUFFER == err) {
buffer_size = bytes_needed;
buffer.reset(new TCHAR[buffer_size]);
continue;
} else {
if (ERROR_HANDLE_EOF != err) {
dump_log.WriteLine(_T("ReadEventLog failed: %d"), err);
}
break;
}
}
while (num_bytes_read > 0) {
const TCHAR* source_name = reinterpret_cast<const TCHAR*>(
reinterpret_cast<BYTE*>(record) + sizeof(*record));
if (_tcscmp(source_name, EventLogger::kSourceName) == 0) {
CString event_log_type = EventLogTypeToString(record->EventType);
const TCHAR* message_data_buffer = reinterpret_cast<const TCHAR*>(
reinterpret_cast<BYTE*>(record) + record->StringOffset);
CString message_data(message_data_buffer);
FILETIME filetime = {0};
TimeTToFileTime(record->TimeWritten, &filetime);
SYSTEMTIME systemtime = {0};
::FileTimeToSystemTime(&filetime, &systemtime);
CString message_line;
message_line.Format(_T("[%s] (%d)|(%s) %s"),
FormatRunTimeString(&systemtime),
record->EventID,
event_log_type,
message_data);
dump_log.WriteLine(message_line);
}
num_bytes_read -= record->Length;
record = reinterpret_cast<EVENTLOGRECORD*>(
reinterpret_cast<BYTE*>(record) + record->Length);
}
record = reinterpret_cast<EVENTLOGRECORD*>(&buffer);
}
::CloseEventLog(handle_event_log);
}
void DataDumperGoopdate::DumpGoogleUpdateProcessInfo(const DumpLog& dump_log) {
DumpHeader header(dump_log, MAIN_EXE_BASE_NAME _T(".exe Process Info"));
EnableDebugPrivilege();
scoped_handle handle_snap;
reset(handle_snap,
::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD, 0));
if (!valid(handle_snap)) {
return;
}
PROCESSENTRY32 process_entry32 = {0};
process_entry32.dwSize = sizeof(PROCESSENTRY32);
if (!::Process32First(get(handle_snap), &process_entry32)) {
return;
}
bool first = true;
do {
CString exe_file_name = process_entry32.szExeFile;
exe_file_name.MakeLower();
CString main_exe_file_name(MAIN_EXE_BASE_NAME _T(".exe"));
main_exe_file_name.MakeLower();
if (exe_file_name.Find(main_exe_file_name) >= 0) {
if (first) {
first = false;
} else {
dump_log.WriteLine(_T("-------------------"));
}
dump_log.WriteLine(_T("Process ID: %d"), process_entry32.th32ProcessID);
scoped_handle process_handle;
reset(process_handle, ::OpenProcess(PROCESS_ALL_ACCESS,
FALSE,
process_entry32.th32ProcessID));
if (get(process_handle)) {
CString command_line;
if (SUCCEEDED(GetProcessCommandLine(process_entry32.th32ProcessID,
&command_line))) {
dump_log.WriteLine(_T("Command Line: %s"), command_line);
} else {
dump_log.WriteLine(_T("Command Line: Failed to retrieve"));
}
PROCESS_MEMORY_COUNTERS memory_counters = {0};
memory_counters.cb = sizeof(memory_counters);
if (GetProcessMemoryInfo(get(process_handle),
&memory_counters,
sizeof(memory_counters))) {
dump_log.WriteLine(_T("Page Fault Count: %d"),
memory_counters.PageFaultCount);
dump_log.WriteLine(_T("Peak Working Set Size: %d"),
memory_counters.PeakWorkingSetSize);
dump_log.WriteLine(_T("Working Set Size: %d"),
memory_counters.WorkingSetSize);
dump_log.WriteLine(_T("Page File Usage: %d"),
memory_counters.PagefileUsage);
dump_log.WriteLine(_T("Peak Page File Usage: %d"),
memory_counters.PeakPagefileUsage);
} else {
dump_log.WriteLine(_T("Unable to get process memory info"));
}
THREADENTRY32 thread_entry = {0};
thread_entry.dwSize = sizeof(thread_entry);
int thread_count = 0;
if (Thread32First(get(handle_snap), &thread_entry)) {
do {
if (thread_entry.th32OwnerProcessID ==
process_entry32.th32ProcessID) {
++thread_count;
}
} while (::Thread32Next(get(handle_snap), &thread_entry));
}
dump_log.WriteLine(_T("Thread Count: %d"), thread_count);
FILETIME creation_time = {0};
FILETIME exit_time = {0};
FILETIME kernel_time = {0};
FILETIME user_time = {0};
if (::GetProcessTimes(get(process_handle),
&creation_time,
&exit_time,
&kernel_time,
&user_time)) {
SYSTEMTIME creation_system_time = {0};
FileTimeToSystemTime(&creation_time, &creation_system_time);
CString creation_str = FormatRunTimeString(&creation_system_time);
dump_log.WriteLine(_T("Process Start Time: %s"), creation_str);
CTime time_creation(creation_time);
CTime time_now = CTime::GetCurrentTime();
CTimeSpan time_span = time_now - time_creation;
CString time_span_format =
time_span.Format(_T("%D days, %H hours, %M minutes, %S seconds"));
dump_log.WriteLine(_T("Process Uptime: %s"), time_span_format);
} else {
dump_log.WriteLine(_T("Unable to get Process Times"));
}
}
}
} while (::Process32Next(get(handle_snap), &process_entry32));
}
void DataDumperGoopdate::DumpServiceInfo(const DumpLog& dump_log) {
DumpHeader header(dump_log, _T("Google Update Service Info"));
CString current_service_name = ConfigManager::GetCurrentServiceName();
bool is_service_installed =
ServiceInstall::IsServiceInstalled(current_service_name);
dump_log.WriteLine(_T("Service Name: %s"), current_service_name);
dump_log.WriteLine(_T("Is Installed: %s"),
is_service_installed ? _T("YES") : _T("NO"));
}
void DataDumperGoopdate::DumpScheduledTaskInfo(const DumpLog& dump_log,
bool is_machine) {
DumpHeader header(dump_log, _T("Scheduled Task Info"));
CComPtr<ITaskScheduler> scheduler;
HRESULT hr = scheduler.CoCreateInstance(CLSID_CTaskScheduler,
NULL,
CLSCTX_INPROC_SERVER);
if (FAILED(hr)) {
dump_log.WriteLine(_T("ITaskScheduler.CoCreateInstance failed: 0x%x"),
hr);
return;
}
CComPtr<ITask> task;
hr = scheduler->Activate(ConfigManager::GetCurrentTaskNameCore(is_machine),
__uuidof(ITask),
reinterpret_cast<IUnknown**>(&task));
if (FAILED(hr)) {
dump_log.WriteLine(_T("ITaskScheduler.Activate failed: 0x%x"), hr);
return;
}
scoped_ptr_cotask<TCHAR> app_name;
hr = task->GetApplicationName(address(app_name));
dump_log.WriteLine(_T("ApplicationName: %s"),
SUCCEEDED(hr) ? app_name.get() : _T("Not Found"));
scoped_ptr_cotask<TCHAR> creator;
hr = task->GetCreator(address(creator));
dump_log.WriteLine(_T("Creator: %s"),
SUCCEEDED(hr) ? creator.get() : _T("Not Found"));
scoped_ptr_cotask<TCHAR> parameters;
hr = task->GetParameters(address(parameters));
dump_log.WriteLine(_T("Parameters: %s"),
SUCCEEDED(hr) ? parameters.get() : _T("Not Found"));
scoped_ptr_cotask<TCHAR> comment;
hr = task->GetComment(address(comment));
dump_log.WriteLine(_T("Comment: %s"),
SUCCEEDED(hr) ? comment.get() : _T("Not Found"));
scoped_ptr_cotask<TCHAR> working_dir;
hr = task->GetWorkingDirectory(address(working_dir));
dump_log.WriteLine(_T("Working Directory: %s"),
SUCCEEDED(hr) ? working_dir.get() : _T("Not Found"));
scoped_ptr_cotask<TCHAR> account_info;
hr = task->GetAccountInformation(address(account_info));
dump_log.WriteLine(_T("Account Info: %s"),
SUCCEEDED(hr) ? account_info.get() : _T("Not Found"));
dump_log.WriteLine(_T("Triggers:"));
WORD trigger_count = 0;
hr = task->GetTriggerCount(&trigger_count);
if (SUCCEEDED(hr)) {
for (WORD i = 0; i < trigger_count; ++i) {
CComPtr<ITaskTrigger> trigger;
if (SUCCEEDED(task->GetTrigger(i, &trigger))) {
scoped_ptr_cotask<TCHAR> trigger_string;
if (SUCCEEDED(trigger->GetTriggerString(address(trigger_string)))) {
dump_log.WriteLine(_T(" %s"), trigger_string.get());
}
}
}
}
SYSTEMTIME next_run_time = {0};
hr = task->GetNextRunTime(&next_run_time);
if (SUCCEEDED(hr)) {
dump_log.WriteLine(_T("Next Run Time: %s"),
FormatRunTimeString(&next_run_time));
} else {
dump_log.WriteLine(_T("Next Run Time: Not Found"));
}
SYSTEMTIME recent_run_time = {0};
hr = task->GetMostRecentRunTime(&recent_run_time);
if (SUCCEEDED(hr)) {
dump_log.WriteLine(_T("Most Recent Run Time: %s"),
FormatRunTimeString(&recent_run_time));
} else {
dump_log.WriteLine(_T("Most Recent Run Time: Not Found"));
}
DWORD max_run_time = 0;
hr = task->GetMaxRunTime(&max_run_time);
if (SUCCEEDED(hr)) {
dump_log.WriteLine(_T("Max Run Time: %d ms"), max_run_time);
} else {
dump_log.WriteLine(_T("Max Run Time: [Not Available]"));
}
}
void DataDumperGoopdate::DumpRunKeys(const DumpLog& dump_log) {
DumpHeader header(dump_log, _T("Google Update Run Keys"));
CString key_path = AppendRegKeyPath(USER_KEY_NAME, REGSTR_PATH_RUN);
DumpRegValueStr(dump_log, key_path, kRunValueName);
}
void DataDumperGoopdate::DumpFileContents(const DumpLog& dump_log,
const CString& file_path,
int num_tail_lines) {
if (num_tail_lines > 0) {
dump_log.WriteLine(_T("Tailing last %d lines of file"), num_tail_lines);
}
dump_log.WriteLine(_T("-------------------------------------"));
if (File::Exists(file_path)) {
FileReader reader;
HRESULT hr = reader.Init(file_path, 2048);
if (FAILED(hr)) {
dump_log.WriteLine(_T("Unable to open %s: 0x%x."), file_path, hr);
return;
}
CString current_line;
std::list<CString> tail_lines;
while (SUCCEEDED(reader.ReadLineString(¤t_line))) {
if (num_tail_lines == 0) {
// We're not doing a tail, so just print the entire file.
dump_log.WriteLine(current_line);
} else {
// Collect the lines in a queue until we're done.
tail_lines.push_back(current_line);
if (tail_lines.size() > static_cast<size_t>(num_tail_lines)) {
tail_lines.pop_front();
}
}
}
// Print out the tail lines collected from the file, if they exist.
if (num_tail_lines > 0) {
for (std::list<CString>::const_iterator it = tail_lines.begin();
it != tail_lines.end();
++it) {
dump_log.WriteLine(*it);
}
}
} else {
dump_log.WriteLine(_T("File does not exist."));
}
}
} // namespace omaha
| 33.0491 | 92 | 0.622642 | [
"vector"
] |
132052257f111dcb36e9934564a2fffddf72ac46 | 2,681 | cpp | C++ | combination_sum.cpp | shifabanu/LeetCode | 785c3afb32c981a8bffbde0129ad1b1b5bd26928 | [
"MIT"
] | null | null | null | combination_sum.cpp | shifabanu/LeetCode | 785c3afb32c981a8bffbde0129ad1b1b5bd26928 | [
"MIT"
] | null | null | null | combination_sum.cpp | shifabanu/LeetCode | 785c3afb32c981a8bffbde0129ad1b1b5bd26928 | [
"MIT"
] | null | null | null | /******************************************************************************
Combination Sum
Medium
Given an array of distinct integers candidates and a target integer target,
return a list of all unique combinations of candidates where the chosen numbers
sum to target. You may return the combinations in any order.
The same number may be chosen from candidates an unlimited number of times.
Two combinations are unique if the frequency of at least one of the chosen
numbers is different.
It is guaranteed that the number of unique combinations that sum up to target
is less than 150 combinations for the given input.
Input: candidates = [2,3,6,7], target = 7
Output: [[2,2,3],[7]]
Explanation:
2 and 3 are candidates, and 2 + 2 + 3 = 7. Note that 2 can be used multiple times.
7 is a candidate, and 7 = 7.
These are the only two combinations.
Input: candidates = [2,3,5], target = 8
Output: [[2,2,2,2],[2,3,3],[3,5]]
Input: candidates = [2], target = 1
Output: []
Input: candidates = [1], target = 1
Output: [[1]]
Input: candidates = [1], target = 2
Output: [[1,1]]
*******************************************************************************/
/*#############################################################################
LOGIC BEHIND THE SOLUTION
Recursion and Backtracking
Step 1: Create a function that takes the vector/array and sum that
returns vector<vector<int>> result
Step 2: Sort the vector/array using .sort(.begin(), .end())
Step 3: Remove any duplicates using .erase(unique(), .end())
Step 4: Create a temporary array to save one combination and later can be
appended/pushed back to the result.
Step 5: Create and call another void findSum function inside to pass arr, sum,
res, r, 0.
0 here is the value of i for first iteration.
Step 6: Function is called
Step 6.1: if sum == 0 then we will push_back the contents in r (it will be
an array) to the result vector. Then we will return to the caller function.
Step 6.2: We will create a while loop that will check if the i < arr.size()
&& sum - arr[i] >=0. The sum value should be non-negative only otherwise
it is ignored
Step 6.3: Push_back the arr[i] in r and call the findSum fucntion again (Recursion).
But now pass parameters like (arr, sum-arr[i], res, r, i)
Whenever, the function returns to this caller function we will do:
i++
pop_back the last value from r. (Backtracking)
website: https://www.geeksforgeeks.org/combinational-sum/
##############################################################################*/
| 36.22973 | 88 | 0.60276 | [
"vector"
] |
1324d5b386fb72093b6a9ea20b647ae9c032a704 | 2,415 | cpp | C++ | cpp/example_code/s3/delete_bucket_policy.cpp | iconara/aws-doc-sdk-examples | 52706b31b4fce8fb89468e56743edf5369e69628 | [
"Apache-2.0"
] | 1 | 2022-02-02T03:49:17.000Z | 2022-02-02T03:49:17.000Z | cpp/example_code/s3/delete_bucket_policy.cpp | iconara/aws-doc-sdk-examples | 52706b31b4fce8fb89468e56743edf5369e69628 | [
"Apache-2.0"
] | 1 | 2021-04-09T21:17:09.000Z | 2021-04-09T21:17:09.000Z | cpp/example_code/s3/delete_bucket_policy.cpp | iconara/aws-doc-sdk-examples | 52706b31b4fce8fb89468e56743edf5369e69628 | [
"Apache-2.0"
] | 27 | 2020-04-16T22:52:53.000Z | 2021-09-30T22:55:58.000Z | //snippet-sourcedescription:[delete_bucket_policy.cpp demonstrates how to delete a policy from an Amazon Simple Storage Service (Amazon S3) bucket.]
//snippet-keyword:[AWS SDK for C++]
//snippet-keyword:[Code Sample]
//snippet-service:[Amazon S3]
//snippet-sourcetype:[full-example]
//snippet-sourcedate:[12/15/2021]
//snippet-sourceauthor:[scmacdon - aws]
/*
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
// snippet-start:[s3.cpp.delete_bucket_policy.inc]
#include <iostream>
#include <aws/core/Aws.h>
#include <aws/s3/S3Client.h>
#include <aws/s3/model/DeleteBucketPolicyRequest.h>
// snippet-end:[s3.cpp.delete_bucket_policy.inc]
/*
*
* Prerequisites: The bucket containing the bucket policy to be deleted.
*
* Inputs:
* - bucketName: The name of the bucket containing the bucket policy to delete.
* - region: The AWS Region of the bucket.
*
* To run this C++ code example, ensure that you have setup your development environment, including your credentials.
* For information, see this documentation topic:
* https://docs.aws.amazon.com/sdk-for-cpp/v1/developer-guide/getting-started.html
*
*/
// snippet-start:[s3.cpp.delete_bucket_policy.code]
using namespace Aws;
int main()
{
//TODO: Change bucket_name to the name of a bucket in your account.
const Aws::String bucketName = "<Enter bucket name>";
//TODO: Set to the AWS Region in which the bucket was created.
const Aws::String region = "us-east-1";
Aws::SDKOptions options;
Aws::InitAPI(options);
{
Aws::Client::ClientConfiguration clientConfig;
if (!region.empty())
clientConfig.region = region;
S3::S3Client client(clientConfig);
Aws::S3::Model::DeleteBucketPolicyRequest request;
request.SetBucket(bucketName);
Aws::S3::Model::DeleteBucketPolicyOutcome outcome = client.DeleteBucketPolicy(request);
if (!outcome.IsSuccess())
{
auto err = outcome.GetError();
std::cout << "Error: DeleteBucketPolicy: " <<
err.GetExceptionName() << ": " << err.GetMessage() << std::endl;
return false;
}
else
{
std::cout << "Policy was deleted from the bucket." << std::endl;
}
}
ShutdownAPI(options);
}
// snippet-end:[s3.cpp.delete_bucket_policy.code]
| 31.776316 | 148 | 0.670807 | [
"model"
] |
132b0ae679915fc1b20e6732380fd298403105a9 | 29,154 | cpp | C++ | src/circuits/FourToTwoGarbledBoleanCircuitNoAssumptions.cpp | manel1874/libscapi | 8cf705162af170c04c8e2299213f52888193cabe | [
"MIT"
] | null | null | null | src/circuits/FourToTwoGarbledBoleanCircuitNoAssumptions.cpp | manel1874/libscapi | 8cf705162af170c04c8e2299213f52888193cabe | [
"MIT"
] | 2 | 2021-03-31T20:04:20.000Z | 2021-12-13T20:47:34.000Z | src/circuits/FourToTwoGarbledBoleanCircuitNoAssumptions.cpp | manel1874/libscapi | 8cf705162af170c04c8e2299213f52888193cabe | [
"MIT"
] | null | null | null | /**
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
* Copyright (c) 2016 LIBSCAPI (http://crypto.biu.ac.il/SCAPI)
* This file is part of the SCAPI project.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* 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.
*
* We request that any publication and/or code referring to and/or based on SCAPI contain an appropriate citation to SCAPI, including a reference to
* http://crypto.biu.ac.il/SCAPI.
*
* Libscapi uses several open source libraries. Please see these projects for any further licensing issues.
* For more information , See https://github.com/cryptobiu/libscapi/blob/master/LICENSE.MD
*
* %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
*
*/
#ifdef __x86_64__
#include <string.h>
#include <iostream>
#include "../../include/circuits/Compat.h"
#include "../../include/circuits/intrinsic.h"
#include "../../include/circuits/GarbledGate.h"
#include "../../include/circuits/FourToTwoGarbledBoleanCircuitNoAssumptions.h"
using namespace std;
FourToTwoGarbledBoleanCircuitNoAssumptions::FourToTwoGarbledBoleanCircuitNoAssumptions(void)
{
}
FourToTwoGarbledBoleanCircuitNoAssumptions::~FourToTwoGarbledBoleanCircuitNoAssumptions(void)
{
if (garbledWires != nullptr){
garbledWires--;
garbledWires--;
_aligned_free(garbledWires);
}
if (encryptedChunkKeys != nullptr)
_aligned_free(encryptedChunkKeys);
if (indexArray != nullptr)
_aligned_free(indexArray);
}
FourToTwoGarbledBoleanCircuitNoAssumptions::FourToTwoGarbledBoleanCircuitNoAssumptions(const char* fileName)
{
//create the needed memory for this circuit
createCircuitMemory(fileName);
}
void FourToTwoGarbledBoleanCircuitNoAssumptions::createCircuitMemory(const char* fileName, bool isNonXorOutputsRequired) {
//call the base class to create circuit function
createCircuit(fileName, false);
//create this memory and initialize it in construction time to gain performance
//allocate the garbled table as follows: 2 blocks + one unsigned char for each AND gate and 1 block for xor gate (we add one just to be on the safe side)
garbledTables = (block *)_aligned_malloc(sizeof(block) * (((numberOfGates - numOfXorGates - numOfNotGates) * 33) / 16 + 1 + numOfXorGates), 16);
if (garbledTables == nullptr) {
cout << "garbled tables could not be allocated";
exit(0);
}
memset(garbledTables, 0, (sizeof(block) * (((numberOfGates - numOfXorGates - numOfNotGates) * 33) / 16 + 1 + numOfXorGates)));
garbledWires = (block *)_aligned_malloc(sizeof(block) * ((lastWireIndex + 1) * 2 + 2), 16);
if (garbledWires == nullptr) {
cout << "garbledWires could not be allocated";
exit(0);
}
memset(garbledWires, 0, sizeof(block) * ((lastWireIndex + 1) * 2 + 2));
garbledWires++;
garbledWires++;
//prepare randomness for the input keys and one byte for each AND gate for the signal bit (could use this for 8 gates, but it is fater and clearer like
//this)
encryptedChunkKeys = (block *)_aligned_malloc(sizeof(block) *(2 * numberOfInputs + (numberOfGates - numOfXorGates - numOfNotGates) / SIZE_OF_BLOCK + 1), 16);
if (encryptedChunkKeys == nullptr) {
cout << "encryptedChunkKeys could not be allocated";
exit(0);
}
memset(encryptedChunkKeys, 0, sizeof(block) * (2 * numberOfInputs + (numberOfGates - numOfXorGates - numOfNotGates) / SIZE_OF_BLOCK + 1));
indexArray = (block *)_aligned_malloc(sizeof(block) * (2 * numberOfInputs + (numberOfGates - numOfXorGates - numOfNotGates) / SIZE_OF_BLOCK + 1), 16);
if (indexArray == nullptr) {
cout << "indexArray could not be allocated";
exit(0);
}
//we put the indices ahead of time to encrypt the whole chunk in one call.
for (int i = 0; i < 2 * numberOfInputs + (numberOfGates - numOfXorGates - numOfNotGates) / SIZE_OF_BLOCK + 1; i++){
indexArray[i] = _mm_set_epi32(0, 0, 0, i);
}
}
void FourToTwoGarbledBoleanCircuitNoAssumptions::garble(block *emptyBothInputKeys, block *emptyBothOutputKeys, vector<byte> & emptyTranslationTable, block seed){
this->seed = seed;
//init the aes encryptions of the seed and the fixed key. Fill the input wires
initAesEncryptionsAndInputKeys(emptyBothInputKeys);
int nonXorIndex = 0;
int xorIndex = 0;
ROUND_KEYS* KEYS = (ROUND_KEYS *)_aligned_malloc(4 * 256, 16);
for (int i = 0; i < numberOfGates; i++){
if (garbledGates[i].truthTable == XOR_GATE && garbledGates[i].input1 == -1){//This is a NOT gate
//switch the garbled wires
garbledWires[garbledGates[i].output * 2] = garbledWires[garbledGates[i].input0 * 2 + 1];
garbledWires[garbledGates[i].output * 2 + 1] = garbledWires[garbledGates[i].input0 * 2];
}
else{
//get the keys from the input wires of the gate
block keys[4];
keys[0] = garbledWires[garbledGates[i].input0 * 2];
keys[1] = garbledWires[garbledGates[i].input0 * 2 + 1];;
keys[2] = garbledWires[garbledGates[i].input1 * 2];
keys[3] = garbledWires[garbledGates[i].input1 * 2 + 1];
//An array of signal bits the 0-wire. This prevents from calling the function getSignalBitOf more than
//once for each 0-wire in the for loop below
int wire0signalBitsArray[2];
wire0signalBitsArray[0] = getSignalBitOf(keys[0]);
wire0signalBitsArray[1] = 1 - wire0signalBitsArray[0];
//An array of signal bits the 0-wire. This prevents from calling the function getSignalBitOf more than
//once for each 0-wire in the for loop below
int wire1signalBitsArray[2];
wire1signalBitsArray[0] = getSignalBitOf(keys[2]);
wire1signalBitsArray[1] = 1 - wire1signalBitsArray[0];
if (garbledGates[i].truthTable == XOR_GATE){
block plaintext[4];
//prepare the plaintext
plaintext[0] = _mm_set_epi32(wire0signalBitsArray[0], 0, 0, i);
plaintext[1] = _mm_set_epi32(wire0signalBitsArray[1], 0, 0, i);
plaintext[2] = _mm_set_epi32(wire1signalBitsArray[0], 0, 0, i);
plaintext[3] = _mm_set_epi32(wire1signalBitsArray[1], 0, 0, i);
block ciphertext[4];
//encrypt 4ks_senc
intrin_sequential_ks4_enc4((const unsigned char*)plaintext, (unsigned char*)ciphertext, 1, (unsigned char*)KEYS, (unsigned char*)keys, nullptr);
block deltaOutput = _mm_xor_si128(ciphertext[0], ciphertext[1]);
//this code is according to the pseudo code of the paper
if (wire1signalBitsArray[0] == 0){
garbledWires[garbledGates[i].output * 2] = _mm_xor_si128(ciphertext[0], ciphertext[2]);
}
else{
garbledWires[garbledGates[i].output * 2] = _mm_xor_si128(ciphertext[1], ciphertext[3]);
}
//set the first row of the garbled table
garbledTables[2 * nonXorIndex + xorIndex] = _mm_xor_si128(_mm_xor_si128(ciphertext[2], ciphertext[3]), deltaOutput);
//make the signal bit be 1.
*((unsigned char *)(&deltaOutput)) |= 1;
//we now need to do some signal bits fixing
int theRightSignalBit = wire0signalBitsArray[0] ^ wire1signalBitsArray[0];
int outputCurrentSignalBit = getSignalBitOf(garbledWires[garbledGates[i].output * 2]);
//only if the signal bits are not matching fix the output key signal bit
if (theRightSignalBit != outputCurrentSignalBit){
//flip the signal bit
*((unsigned char *)(&garbledWires[garbledGates[i].output * 2])) = *((unsigned char *)(&garbledWires[garbledGates[i].output * 2])) ^ 1;
}
//since we have fixed the deltaOutput we can now safely do the xor and get the right signal bit
garbledWires[garbledGates[i].output * 2 + 1] = _mm_xor_si128(garbledWires[garbledGates[i].output * 2], deltaOutput);
xorIndex++;
continue;
}
else{//This is an AND gate
block T1, T2;
//We crete the signal bits of input0 and input 1 by 2*signalBit(wire0) + signalBit(wire1)
int signalBits[4];
signalBits[0] = 2 * wire0signalBitsArray[0] + wire1signalBitsArray[0];
signalBits[1] = 2 * wire0signalBitsArray[0] + wire1signalBitsArray[1];
signalBits[2] = 2 * wire0signalBitsArray[1] + wire1signalBitsArray[0];
signalBits[3] = 2 * wire0signalBitsArray[1] + wire1signalBitsArray[1];
block plainText[8];
block cipherText[8];
//set the plaintexts to be the signal bit and the tweak
for (int j = 0; j < 4; j++){
plainText[j] = _mm_set_epi32(signalBits[j], 0, 0, i);
}
plainText[4] = plainText[0];
plainText[5] = plainText[2];
plainText[6] = plainText[1];
plainText[7] = plainText[3];
//encrypt the plaintext by 4 key schedules and 8 encryptions
intrin_sequential_ks4_enc8((const unsigned char*)plainText, (unsigned char*)cipherText, 4, (unsigned char*)KEYS, (unsigned char*)keys, nullptr);
block cipherText2[4];
cipherText2[0] = cipherText[4 + 0];
cipherText2[1] = cipherText[4 + 2];
cipherText2[2] = cipherText[4 + 1];
cipherText2[3] = cipherText[4 + 3];
block entryXor[4];
unsigned char lastBit[4];
//get the last bit of the ciphers
for (int j = 0; j < 4; j++){
entryXor[j] = _mm_xor_si128(cipherText[signalBits[j]], cipherText2[signalBits[j]]);
lastBit[j] = getSignalBitOf(entryXor[j]);
}
for (int j = 0; j < 4; j++){
//set the last bit to zero
if (getSignalBitOf(entryXor[j]) != 0)
*((unsigned char *)(&entryXor[j])) = *((unsigned char *)(&entryXor[j])) ^ 1;
}
//compute T1
if (wire0signalBitsArray[0] == 0){//the cases of 0001 and 0010
T1 = _mm_xor_si128(entryXor[0], entryXor[1]);
}
else{//the cases of 0100 and 1000
T1 = _mm_xor_si128(entryXor[2], entryXor[3]);
}
//compute T2
if (wire1signalBitsArray[0] == 0){//the cases of 0001 and 0100
T2 = _mm_xor_si128(entryXor[0], entryXor[2]);
}
else{
T2 = _mm_xor_si128(entryXor[1], entryXor[3]);
}
//get the random bit generated by the seed
unsigned char output0SignalBit = ((unsigned char *)encryptedChunkKeys)[SIZE_OF_BLOCK * 2 * numberOfInputs + nonXorIndex] % 2;
unsigned char output1SignalBit = 1 - output0SignalBit;
//create the mask table for the evaluator to retrieve the right signal bit
unsigned char mask = 0;
mask |= (lastBit[signalBits[3]] ^ output1SignalBit) << signalBits[3];
mask |= (lastBit[signalBits[2]] ^ output0SignalBit) << signalBits[2];
mask |= (lastBit[signalBits[1]] ^ output0SignalBit) << signalBits[1];
mask |= (lastBit[signalBits[0]] ^ output0SignalBit) << signalBits[0];
//put the masks in the end of the garbled table
((unsigned char*)garbledTables)[((numberOfGates - numOfXorGates- numOfNotGates) * 2 + numOfXorGates) * 16 + nonXorIndex] = mask;
//now create the garbled table wich is T1 and T2
garbledTables[2 * nonXorIndex + xorIndex] = T1;
garbledTables[2 * nonXorIndex + xorIndex + 1] = T2;
//generate the garbled wires according to the case of the signal bits
if (signalBits[0] != 3){
*((unsigned char *)(&entryXor[0])) = *((unsigned char *)(&entryXor[0])) ^ output0SignalBit;
garbledWires[2 * garbledGates[i].output] = entryXor[0];
garbledWires[2 * garbledGates[i].output + 1] = _mm_xor_si128(_mm_xor_si128(entryXor[1], entryXor[2]), entryXor[3]);
*((unsigned char *)(&garbledWires[2 * garbledGates[i].output + 1])) = *((unsigned char *)(&garbledWires[2 * garbledGates[i].output + 1])) ^ output1SignalBit;
}
else{
*((unsigned char *)(&entryXor[0])) = *((unsigned char *)(&entryXor[0])) ^ output1SignalBit;
garbledWires[2 * garbledGates[i].output + 1] = entryXor[0];
garbledWires[2 * garbledGates[i].output] = _mm_xor_si128(_mm_xor_si128(entryXor[1], entryXor[2]), entryXor[3]);
*((unsigned char *)(&garbledWires[2 * garbledGates[i].output])) = *((unsigned char *)(&garbledWires[2 * garbledGates[i].output])) ^ output0SignalBit;
}
nonXorIndex++;
}
}
}
translationTable.clear();
//copy the output keys to get back to the caller of the function as well as filling the translation table.
//The input keys were already filled in the initialization of the function.
for (int i = 0; i < numberOfOutputs; i++) {
emptyBothOutputKeys[2 * i] = garbledWires[outputIndices[i] * 2];
emptyBothOutputKeys[2 * i + 1] = garbledWires[outputIndices[i] * 2 + 1];
translationTable.push_back(getSignalBitOf(emptyBothOutputKeys[2 * i]));
emptyTranslationTable.push_back(getSignalBitOf(emptyBothOutputKeys[2 * i]));
}
_aligned_free(KEYS);
}
int FourToTwoGarbledBoleanCircuitNoAssumptions::getGarbledTableSize()
{
if (isNonXorOutputsRequired == true) {
return (sizeof(block) * (((numberOfGates - numOfXorGates - numOfNotGates) * 33) / 16 + 1 + numOfXorGates) + 2 * numberOfOutputs);
}
else {
return (sizeof(block) * (((numberOfGates - numOfXorGates - numOfNotGates) * 33) / 16 + 1 + numOfXorGates));
}
}
void FourToTwoGarbledBoleanCircuitNoAssumptions::initAesEncryptionsAndInputKeys(block* emptyBothInputKeys){
//create the aes with the seed as the key. This will be used for encrypting the input keys
AES_set_encrypt_key((const unsigned char *)&seed, 128, &aesSeedKey);
//generate randomness for the input keys as well as the signal bits for the AND gates
AES_ecb_encrypt_chunk_in_out(indexArray,
encryptedChunkKeys,
(2 * numberOfInputs + (numberOfGates - numOfXorGates - numOfNotGates) / SIZE_OF_BLOCK + 1),
&aesSeedKey);
/*AES_ECB_encrypt((const unsigned char *)indexArray,
(unsigned char *)encryptedChunkKeys,
SIZE_OF_BLOCK * (2 * numberOfInputs + (numberOfGates - numOfXorGates - numOfNotGates) / SIZE_OF_BLOCK + 1),
(const unsigned char *)aesSeedKey->rd_key,
aesSeedKey->rounds);
*/
//put the values of zero and a random encryption of -1 in the begining of the garbled wires for future use of the NOT gates
block index = _mm_set_epi32(0, 0, 0, -1);
garbledWires[-1] = ZERO_BLOCK;
AES_encryptC(&index, &garbledWires[-2], &aesSeedKey);
//set the input keys
for (int i = 0; i<numberOfInputs; i++){
emptyBothInputKeys[2 * i] = encryptedChunkKeys[2 * i];
emptyBothInputKeys[2 * i] = encryptedChunkKeys[2 * i + 1];
setSignalBit(&(emptyBothInputKeys[2 * i]), &(emptyBothInputKeys[2 * i + 1]));
//copy the input keys to the garbledWires array
garbledWires[inputIndices[i] * 2] = emptyBothInputKeys[2 * i];
garbledWires[inputIndices[i] * 2 + 1] = emptyBothInputKeys[2 * i + 1];
}
}
void FourToTwoGarbledBoleanCircuitNoAssumptions::compute(block * singleWiresInputKeys, block * Output)
{
ROUND_KEYS* KEY = (ROUND_KEYS *)_aligned_malloc(4 * 256, 16);
int nonXorIndex = 0;
int xorIndex = 0;
for (int i = 0; i<numberOfInputs; i++){
//get the input keys into the computed wires array
computedWires[inputIndices[i]] = singleWiresInputKeys[i];
}
//start computing the circuit by going over the gates in topological order
for (int i = 0; i<numberOfGates; i++){
if (garbledGates[i].truthTable == XOR_GATE && garbledGates[i].input1 == -1){//This is a NOT gate
//the signal bits are fliped in the garble (by switching the garbled wires) and thus this is actually NOT gate.
computedWires[garbledGates[i].output] = computedWires[garbledGates[i].input0];
}
else{
block keys[2];
//get the keys from the already calculated wires
keys[0] = computedWires[garbledGates[i].input0];
keys[1] = computedWires[garbledGates[i].input1];
//Get the signal bits of the computed inputs
int wire0SignalBit = getSignalBitOf(keys[0]);
int wire1SignalBit = getSignalBitOf(keys[1]);
//create the ciphertext
block ciphertext[2];
block plaintext[2];
if (garbledGates[i].truthTable == XOR_GATE){//handle xor gates
//prepare the plaintext
plaintext[0] = _mm_set_epi32(wire0SignalBit, 0, 0, i);
plaintext[1] = _mm_set_epi32(wire1SignalBit, 0, 0, i);
intrin_sequential_ks2_enc2((const unsigned char*)plaintext, (unsigned char*)ciphertext, 2, (unsigned char*)KEY, (unsigned char*)keys, nullptr);
//check the psudocode of the paper for more information
if (wire1SignalBit == 1){
computedWires[garbledGates[i].output] = _mm_xor_si128(_mm_xor_si128(ciphertext[0], ciphertext[1]), garbledTables[2 * nonXorIndex + xorIndex]);
}
else{
computedWires[garbledGates[i].output] = _mm_xor_si128(ciphertext[0], ciphertext[1]);
}
//we now need to do some signal bits fixing
int theRightSignalBit = wire0SignalBit ^ wire1SignalBit;
int outputCurrentSignalBit = getSignalBitOf(computedWires[garbledGates[i].output]);
if (theRightSignalBit != outputCurrentSignalBit){
//flip the signal bit
*((unsigned char *)(&computedWires[garbledGates[i].output])) = *((unsigned char *)(&computedWires[garbledGates[i].output])) ^ 1;
}
xorIndex++;
}
else{
plaintext[0] = _mm_set_epi32(2 * wire0SignalBit + wire1SignalBit, 0, 0, i);
plaintext[1] = plaintext[0];
intrin_sequential_ks2_enc2((const unsigned char*)plaintext, (unsigned char*)ciphertext, 2, (unsigned char*)KEY, (unsigned char*)keys, nullptr);
block entryXor = _mm_xor_si128(ciphertext[0], ciphertext[1]);
unsigned char lastBit = getSignalBitOf(entryXor);
//now correct the signal bit , first get the mask
unsigned char mask = ((unsigned char*)garbledTables)[((numberOfGates - numOfXorGates-numOfNotGates) * 2 + numOfXorGates) * 16 + nonXorIndex];
//get the bit of the mask
int index = 2 * wire0SignalBit + wire1SignalBit;
unsigned char theRightBit = ((mask >> index) & 1) ^ lastBit;
switch (index) {
case 0:
computedWires[garbledGates[i].output] = entryXor;
break;
case 1:
computedWires[garbledGates[i].output] = _mm_xor_si128(entryXor, garbledTables[2 * nonXorIndex + xorIndex]);
break;
case 2:
computedWires[garbledGates[i].output] = _mm_xor_si128(entryXor, garbledTables[2 * nonXorIndex + xorIndex + 1]);
break;
case 3:
computedWires[garbledGates[i].output] = _mm_xor_si128(_mm_xor_si128(entryXor, garbledTables[2 * nonXorIndex + xorIndex]), garbledTables[2 * nonXorIndex + xorIndex + 1]);
break;
default:
;//do nothing
}
unsigned char outputCurrentSignalBit = getSignalBitOf(computedWires[garbledGates[i].output]);
//if the current signal bit is not the signal generated using the mask than flip the signal bit
if (theRightBit != outputCurrentSignalBit){
//flip the signal bit
*((unsigned char *)(&computedWires[garbledGates[i].output])) = *((unsigned char *)(&computedWires[garbledGates[i].output])) ^ 1;
}
//increment the nonXor gates number only for the AND gates.
nonXorIndex++;
}
}
}
//copy the output wire keys which are the result the user is interested in.
for (int i = 0; i < numberOfOutputs; i++) {
Output[i] = computedWires[outputIndices[i]];
}
_aligned_free(KEY);
}
bool FourToTwoGarbledBoleanCircuitNoAssumptions::internalVerify(block *bothInputKeys, block *emptyBothWireOutputKeys){
int nonXorIndex = 0;
int xorIndex = 0;
ROUND_KEYS* KEYS = (ROUND_KEYS *)_aligned_malloc(4 * 256, 16);
for (int i = 0; i < numberOfGates; i++){
if (garbledGates[i].truthTable == XOR_GATE && garbledGates[i].input1 == -1){//This is a NOT gate
//switch the garbled wires
garbledWires[garbledGates[i].output * 2] = garbledWires[garbledGates[i].input0 * 2 + 1];
garbledWires[garbledGates[i].output * 2 + 1] = garbledWires[garbledGates[i].input0 * 2];
}
else{
//get the keys from the input wires of the gate
block keys[4];
keys[0] = garbledWires[garbledGates[i].input0 * 2];
keys[1] = garbledWires[garbledGates[i].input0 * 2 + 1];;
keys[2] = garbledWires[garbledGates[i].input1 * 2];
keys[3] = garbledWires[garbledGates[i].input1 * 2 + 1];
//An array of signal bits the 0-wire. This prevents from calling the function getSignalBitOf more than
//once for each 0-wire in the for loop below
int wire0signalBitsArray[2];
wire0signalBitsArray[0] = getSignalBitOf(keys[0]);
wire0signalBitsArray[1] = 1 - wire0signalBitsArray[0];
//An array of signal bits the 0-wire. This prevents from calling the function getSignalBitOf more than
//once for each 0-wire in the for loop below
int wire1signalBitsArray[2];
wire1signalBitsArray[0] = getSignalBitOf(keys[2]);
wire1signalBitsArray[1] = 1 - wire1signalBitsArray[0];
if (garbledGates[i].truthTable == XOR_GATE){
block plaintext[4];
//prepare the plaintext
plaintext[0] = _mm_set_epi32(wire0signalBitsArray[0], 0, 0, i);
plaintext[1] = _mm_set_epi32(wire0signalBitsArray[1], 0, 0, i);
plaintext[2] = _mm_set_epi32(wire1signalBitsArray[0], 0, 0, i);
plaintext[3] = _mm_set_epi32(wire1signalBitsArray[1], 0, 0, i);
block ciphertext[4];
//encrypt 4ks_senc
intrin_sequential_ks4_enc4((const unsigned char*)plaintext, (unsigned char*)ciphertext, 1, (unsigned char*)KEYS, (unsigned char*)keys, nullptr);
block deltaOutput = _mm_xor_si128(ciphertext[0], ciphertext[1]);
//if deltaOutput has 1 signal bit, than fine
//else flip ciphertext[1] signal bit.
if (wire1signalBitsArray[0] == 0){
garbledWires[garbledGates[i].output * 2] = _mm_xor_si128(ciphertext[0], ciphertext[2]);
}
else{
garbledWires[garbledGates[i].output * 2] = _mm_xor_si128(ciphertext[1], ciphertext[3]);
}
if (!equalBlocks(garbledTables[2 * nonXorIndex + xorIndex], _mm_xor_si128(_mm_xor_si128(ciphertext[2], ciphertext[3]), deltaOutput)))
return false;
//make the signal bit be 1.
*((unsigned char *)(&deltaOutput)) |= 1;
//we now need to do some signal bits fixing
int theRightSignalBit = wire0signalBitsArray[0] ^ wire1signalBitsArray[0];
int outputCurrentSignalBit = getSignalBitOf(garbledWires[garbledGates[i].output * 2]);
//only if the signal bits are not matching fix the output key signal bit
if (theRightSignalBit != outputCurrentSignalBit){
//flip the signal bit
*((unsigned char *)(&garbledWires[garbledGates[i].output * 2])) = *((unsigned char *)(&garbledWires[garbledGates[i].output * 2])) ^ 1;
}
//since we have fixed the deltaOutput we can now safely do the xor and get the right signal bit
garbledWires[garbledGates[i].output * 2 + 1] = _mm_xor_si128(garbledWires[garbledGates[i].output * 2], deltaOutput);
xorIndex++;
continue;
}
//Since the seed is not supplied, the check is on the garbled wires and not the garbled tables.
//The signal bit is
else{//This is an AND gate.
//We crete the signal bits of input0 and input 1 by 2*signalBit(wire0) + signalBit(wire1)
//In this case we avoid calling getSignalBitOf twice as much.
int signalBits[4];
signalBits[0] = 2 * wire0signalBitsArray[0] + wire1signalBitsArray[0];
signalBits[1] = 2 * wire0signalBitsArray[0] + wire1signalBitsArray[1];
signalBits[2] = 2 * wire0signalBitsArray[1] + wire1signalBitsArray[0];
signalBits[3] = 2 * wire0signalBitsArray[1] + wire1signalBitsArray[1];
//generate the keys array as well as the encryptedKeys array
block plainText[8];
block cipherText[8];
//Encrypt the 4 keys in one chunk to gain pipelining and puts the answer in encryptedKeys block array
//AES_ecb_encrypt_blks_4_in_out(keys, encryptedKeys, aesFixedKey);
for (int j = 0; j < 4; j++){
plainText[j] = _mm_set_epi32(signalBits[j], 0, 0, i);
}
plainText[4] = plainText[0];
plainText[5] = plainText[2];
plainText[6] = plainText[1];
plainText[7] = plainText[3];
//create the plaintext which is the ks4_ec8
intrin_sequential_ks4_enc8((const unsigned char*)plainText, (unsigned char*)cipherText, 4, (unsigned char*)KEYS, (unsigned char*)keys, nullptr);
block cipherText2[4];
cipherText2[0] = cipherText[4 + 0];
cipherText2[1] = cipherText[4 + 2];
cipherText2[2] = cipherText[4 + 1];
cipherText2[3] = cipherText[4 + 3];
block entryXor[4];
unsigned char lastBit[4];
block k0;//the 0-value that is kept to compare with future 0-values and check that they are infact equal
bool isK0Set = false;
//get the last bit of the ciphers
for (int j = 0; j < 4; j++){
entryXor[j] = _mm_xor_si128(cipherText[j], cipherText2[j]);
lastBit[j] = getSignalBitOf(entryXor[j]);
}
//get the mask for this gate
unsigned char mask = ((unsigned char*)garbledTables)[((numberOfGates - numOfXorGates - numOfNotGates) * 2 + numOfXorGates) * 16 + nonXorIndex];
for (int j = 0; j < 4; j++){
//get the bit of the mask
int index = signalBits[j];
unsigned char theRightBit = ((mask >> index) & 1) ^ lastBit[j];
if (j != 3){//the 0 value's of the AND gate
switch (index) {
case 0:
garbledWires[garbledGates[i].output*2] = entryXor[j];
break;
case 1:
garbledWires[garbledGates[i].output * 2] = _mm_xor_si128(entryXor[j], garbledTables[2 * nonXorIndex + xorIndex]);
break;
case 2:
garbledWires[garbledGates[i].output * 2] = _mm_xor_si128(entryXor[j], garbledTables[2 * nonXorIndex + xorIndex + 1]);
break;
case 3:
garbledWires[garbledGates[i].output * 2] = _mm_xor_si128(_mm_xor_si128(entryXor[j], garbledTables[2 * nonXorIndex + xorIndex]), garbledTables[2 * nonXorIndex + xorIndex + 1]);
break;
default:
;//do nothing
}
unsigned char outputCurrentSignalBit = getSignalBitOf(garbledWires[garbledGates[i].output*2]);
//int theRightBit = getSignalBitOf(entryXor) ^ signalBit;
if (theRightBit != outputCurrentSignalBit){
//flip the signal bit
*((unsigned char *)(&garbledWires[garbledGates[i].output*2])) = *((unsigned char *)(&garbledWires[garbledGates[i].output*2])) ^ 1;
}
if (isK0Set == false){
k0 = garbledWires[garbledGates[i].output * 2];
isK0Set = true;
}
else{
if (!(equalBlocks(k0, garbledWires[garbledGates[i].output*2])))
return false;
}
}
else{//this is the 1-value, since in AND gate it is the only 1-value, just set the garbled wire of the output
switch (index) {
case 0:
garbledWires[garbledGates[i].output *2 + 1] = entryXor[j];
break;
case 1:
garbledWires[garbledGates[i].output * 2 + 1] = _mm_xor_si128(entryXor[j], garbledTables[2 * nonXorIndex + xorIndex]);
break;
case 2:
garbledWires[garbledGates[i].output * 2 + 1] = _mm_xor_si128(entryXor[j], garbledTables[2 * nonXorIndex + xorIndex + 1]);
break;
case 3:
garbledWires[garbledGates[i].output * 2 + 1] = _mm_xor_si128(_mm_xor_si128(entryXor[j], garbledTables[2 * nonXorIndex + xorIndex]), garbledTables[2 * nonXorIndex + xorIndex + 1]);
break;
default:
;//do nothing
}
unsigned char outputCurrentSignalBit = getSignalBitOf(garbledWires[garbledGates[i].output * 2 + 1]);
//int theRightBit = getSignalBitOf(entryXor) ^ signalBit;
if (theRightBit != outputCurrentSignalBit){
//flip the signal bit
*((unsigned char *)(&garbledWires[garbledGates[i].output * 2 + 1])) = *((unsigned char *)(&garbledWires[garbledGates[i].output * 2 + 1])) ^ 1;
}
}
}
nonXorIndex++;
}
}
}
//copy the output keys to return to the caller of the function
for (int i = 0; i < numberOfOutputs; i++) {
emptyBothWireOutputKeys[2 * i] = garbledWires[outputIndices[i] * 2];
emptyBothWireOutputKeys[2 * i + 1] = garbledWires[outputIndices[i] * 2 + 1];
}
return true;
}
#endif | 36.625628 | 187 | 0.668553 | [
"vector"
] |
132bea2f32257d4e9c598836c81aceb992ab7b5e | 1,950 | cpp | C++ | src/csapex_core/src/command/disable_node.cpp | ICRA-2018/csapex | 8ee83b9166d0281a4923184cce67b4a55f273ea2 | [
"BSD-3-Clause"
] | 21 | 2016-09-02T15:33:25.000Z | 2021-06-10T06:34:39.000Z | src/csapex_core/src/command/disable_node.cpp | ICRA-2018/csapex | 8ee83b9166d0281a4923184cce67b4a55f273ea2 | [
"BSD-3-Clause"
] | null | null | null | src/csapex_core/src/command/disable_node.cpp | ICRA-2018/csapex | 8ee83b9166d0281a4923184cce67b4a55f273ea2 | [
"BSD-3-Clause"
] | 10 | 2016-10-12T00:55:17.000Z | 2020-04-24T19:59:02.000Z | /// HEADER
#include <csapex/command/disable_node.h>
/// COMPONENT
#include <csapex/command/delete_connection.h>
#include <csapex/model/node_constructor.h>
#include <csapex/model/node.h>
#include <csapex/model/node_handle.h>
#include <csapex/model/node_state.h>
#include <csapex/factory/node_factory_impl.h>
#include <csapex/model/graph/graph_impl.h>
#include <csapex/msg/input.h>
#include <csapex/msg/output.h>
#include <csapex/model/node_state.h>
#include <csapex/command/command_serializer.h>
#include <csapex/serialization/io/std_io.h>
#include <csapex/serialization/io/csapex_io.h>
/// SYSTEM
using namespace csapex;
using namespace csapex::command;
CSAPEX_REGISTER_COMMAND_SERIALIZER(DisableNode)
DisableNode::DisableNode(const AUUID& parent_uuid, const UUID& uuid, bool disable) : CommandImplementation(parent_uuid), uuid(uuid), disable_(disable)
{
}
std::string DisableNode::getDescription() const
{
if (disable_) {
return std::string("disable node ") + uuid.getFullName();
} else {
return std::string("enable node ") + uuid.getFullName();
}
}
bool DisableNode::doExecute()
{
NodeHandle* node_handle = getGraph()->findNodeHandle(uuid);
// node_handle->setProcessingEnabled(!disable_);
node_handle->getNodeState()->setEnabled(!disable_);
return true;
}
bool DisableNode::doUndo()
{
NodeHandle* node_handle = getGraph()->findNodeHandle(uuid);
// node_handle->setProcessingEnabled(disable_);
node_handle->getNodeState()->setEnabled(disable_);
return true;
}
bool DisableNode::doRedo()
{
return doExecute();
}
void DisableNode::serialize(SerializationBuffer& data, SemanticVersion& version) const
{
Command::serialize(data, version);
data << uuid;
data << disable_;
}
void DisableNode::deserialize(const SerializationBuffer& data, const SemanticVersion& version)
{
Command::deserialize(data, version);
data >> uuid;
data >> disable_;
}
| 24.683544 | 150 | 0.728718 | [
"model"
] |
132dea4bbc732872faf0b3b392556fe34f7ca732 | 660 | cpp | C++ | src/splitpdbqt.cpp | HongjianLi/istarutils | 2b113b4be8d33e6e31c334c4917d65125696f9cb | [
"MIT"
] | null | null | null | src/splitpdbqt.cpp | HongjianLi/istarutils | 2b113b4be8d33e6e31c334c4917d65125696f9cb | [
"MIT"
] | null | null | null | src/splitpdbqt.cpp | HongjianLi/istarutils | 2b113b4be8d33e6e31c334c4917d65125696f9cb | [
"MIT"
] | null | null | null | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
using namespace std;
void write(const vector<string>& lines, const string filename)
{
ofstream ofs(filename);
for (const auto& line : lines)
{
ofs << line << endl;
}
}
int main(int argc, char* argv[])
{
vector<string> lines;
bool content = false;
size_t id = 0;
for (string line; getline(cin, line);)
{
if (line[0] == 'R')
{
content = true;
}
if (content)
{
lines.push_back(line);
}
if (line[0] == 'T')
{
content = false;
write(lines, to_string(++id) + ".pdbqt");
lines.clear();
}
}
cout << "Splitted into " << id << " files" << endl;
}
| 16.5 | 62 | 0.595455 | [
"vector"
] |
133072f078fbeb38df1c1b3ec48fe36b1a799490 | 3,550 | cpp | C++ | QtOrm/AutoUpdater.cpp | rensfo/QtOrm | 46a16ee507cff4b1367b674420365137bf20aa9f | [
"MIT"
] | null | null | null | QtOrm/AutoUpdater.cpp | rensfo/QtOrm | 46a16ee507cff4b1367b674420365137bf20aa9f | [
"MIT"
] | 1 | 2016-11-04T14:26:58.000Z | 2016-11-04T14:27:57.000Z | QtOrm/AutoUpdater.cpp | rensfo/QtOrm | 46a16ee507cff4b1367b674420365137bf20aa9f | [
"MIT"
] | null | null | null | #include "AutoUpdater.h"
#include <QDebug>
#include <QMetaObject>
#include "Mappings/ConfigurationMap.h"
#include "Query.h"
namespace QtOrm {
using namespace Config;
AutoUpdater::AutoUpdater(QObject *parent) : QObject(parent) {
onObjectPropertyChangedMethod = findOnObjectPropertyChangedMethod();
}
QString AutoUpdater::getPropertyName(QSharedPointer<QObject> sender, int senderSignalIndex) {
QMetaMethod senderSignal = sender->metaObject()->method(senderSignalIndex);
QMetaProperty senderProperty;
const QMetaObject *senderMeta = sender->metaObject();
for (int i = 0; i < senderMeta->propertyCount(); i++) {
if (senderMeta->property(i).hasNotifySignal()) {
if (senderMeta->property(i).notifySignal() == senderSignal) {
senderProperty = senderMeta->property(i);
break;
}
}
}
return QString(senderProperty.name());
}
void AutoUpdater::connectToAllProperties(QSharedPointer<QObject> object) {
QSharedPointer<ClassMapBase> classBase = configuration->getMappedClass(object->metaObject()->className());
QStringList properties;
for (QSharedPointer<OneToOne> oneToOne : classBase->getOneToOneRelations()) {
properties.append(oneToOne->getProperty());
}
if(SubClassMap::isClassTableInheritance(classBase)){
auto allProperties = classBase->toSubclass()->getAllProperties();
properties.append(allProperties.keys());
} else {
properties.append(classBase->getProperties().keys());
}
for (QString propertyName : properties) {
int propertyIndex = object->metaObject()->indexOfProperty(propertyName.toStdString().data());
QMetaProperty property = object->metaObject()->property(propertyIndex);
if (property.hasNotifySignal()) {
connect(object.data(), property.notifySignal(), this, onObjectPropertyChangedMethod, Qt::UniqueConnection);
} else {
if (classBase->getIdProperty()->getName() != propertyName)
qWarning() << QString("Property %1 from class %2 has not Notify signal!")
.arg(propertyName)
.arg(object->metaObject()->className());
}
}
}
void AutoUpdater::onObjectPropertyChanged() {
QObject *sender = this->sender();
QSharedPointer<QObject> sharedSender = registry->value(sender);
if (sharedSender) {
QString senderPropertyName = getPropertyName(sharedSender, senderSignalIndex());
using Sql::Query;
Query query;
query.setDatabase(database);
query.setRegistry(registry);
query.setConfiguration(configuration);
connect(&query, &Query::executedSql, this, &AutoUpdater::executedSql);
query.saveOneField(sharedSender, senderPropertyName);
}
}
QMetaMethod AutoUpdater::findOnObjectPropertyChangedMethod() {
QMetaMethod result;
for (int m = 0; m < this->metaObject()->methodCount(); m++) {
QMetaMethod method = this->metaObject()->method(m);
if (QString(method.name()) == "onObjectPropertyChanged" && method.parameterCount() == 0) {
result = method;
}
}
return result;
}
QSharedPointer<Config::ConfigurationMap> AutoUpdater::getConfiguration() const
{
return configuration;
}
void AutoUpdater::setConfiguration(QSharedPointer<ConfigurationMap> value)
{
configuration = value;
}
QSqlDatabase AutoUpdater::getDatabase() const {
return database;
}
void AutoUpdater::setDatabase(const QSqlDatabase &value) {
database = value;
}
QSharedPointer<Registry> AutoUpdater::getRegistry() const {
return registry;
}
void AutoUpdater::setRegistry(QSharedPointer<Registry> value) {
registry = value;
}
}
| 30.603448 | 113 | 0.716901 | [
"object"
] |
133092885d7b9884fbeb048d17a722db8f7d0aee | 8,051 | cpp | C++ | src/uploaders/default/gdrivesettingsdialog.cpp | mightybruno/KShare | c1124354be9c8bb5c1931e37e19391f0b6c4389f | [
"MIT"
] | 16 | 2020-01-22T04:52:46.000Z | 2022-02-22T09:53:39.000Z | src/uploaders/default/gdrivesettingsdialog.cpp | mightybruno/KShare | c1124354be9c8bb5c1931e37e19391f0b6c4389f | [
"MIT"
] | 15 | 2020-02-16T01:12:42.000Z | 2021-05-03T21:51:26.000Z | src/uploaders/default/gdrivesettingsdialog.cpp | mightybruno/KShare | c1124354be9c8bb5c1931e37e19391f0b6c4389f | [
"MIT"
] | 3 | 2020-04-03T22:20:14.000Z | 2020-09-23T07:58:09.000Z | #include "gdrivesettingsdialog.hpp"
#include "ui_gdrivesettingsdialog.h"
#include <QDesktopServices>
#include <QDialogButtonBox>
#include <QLabel>
#include <QLineEdit>
#include <QNetworkReply>
#include <QPushButton>
#include <QUrl>
#include <io/ioutils.hpp>
#include <settings.hpp>
GDriveSettingsDialog::GDriveSettingsDialog(QWidget *parent) : QDialog(parent), ui(new Ui::GDriveSettingsDialog) {
ui->setupUi(this);
connect(this, &GDriveSettingsDialog::accepted, this, &GDriveSettingsDialog::deleteLater);
ui->clientId->setText(settings::settings().value("google/cid").toString());
ui->clientSecret->setText(settings::settings().value("google/csecret").toString());
ui->folderId->setText(settings::settings().value("google/folder").toString().toUtf8());
ui->isPublic->setChecked(settings::settings().value("google/public").toBool());
}
GDriveSettingsDialog::~GDriveSettingsDialog() {
delete ui;
}
void GDriveSettingsDialog::on_addApp_clicked() {
QDesktopServices::openUrl(
QUrl(QString("https://accounts.google.com/o/oauth2/auth?client_id=%1&redirect_uri=urn:ietf:wg:oauth:2.0:oob&response_type=code&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive").arg(ui->clientId->text())));
}
void GDriveSettingsDialog::on_isPublic_clicked(bool checked) {
settings::settings().setValue("google/public", checked);
}
void GDriveSettingsDialog::on_folderId_textChanged(QString arg1) {
settings::settings().setValue("google/folder", arg1);
}
bool GDriveSettingsDialog::checkAuthorization () {
if (ui->folderId->text().isEmpty()) return false;
settings::settings().setValue("google/folder", ui->folderId->text());
if (settings::settings().contains("google/expire") //
&& settings::settings().contains("google/refresh") //
&& settings::settings().contains("google/access")) {
QDateTime expireTime = settings::settings().value("google/expire").toDateTime();
if (QDateTime::currentDateTimeUtc() > expireTime) {
// Token expired
ui->status->setText(tr("Token expired"));
} else {
ui->buttonBox->setEnabled(false);
ui->testButton->setEnabled(false);
ioutils::getData(QUrl(QString("https://www.googleapis.com/drive/v3/files?q='%1'+in+parents&fields=files(md5Checksum,+originalFilename)").arg(ui->folderId->text())),
QList<QPair<QString, QString>>({ QPair<QString, QString>("Authorization", settings::settings().value("google/access").toString().prepend("Bearer ")) }),
[&](QByteArray a, QNetworkReply *r) {
QVariant statusCode = r->attribute(QNetworkRequest::HttpStatusCodeAttribute);
if (!statusCode.isValid()) return;
ui->testButton->setEnabled(true);
int status = statusCode.toInt();
if (status != 200 && status != 400)
{
QString reason = r->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString();
qDebug() << reason;
ui->buttonBox->setEnabled(true);
ui->status->setText(reason);
return;
}
QJsonDocument response = QJsonDocument::fromJson(a);
if (!response.isObject()) {
ui->buttonBox->setEnabled(true);
ui->status->setText("Invalid JSON");
return;
}
QJsonObject res = response.object();
if (res.contains("error")) {
ui->buttonBox->setEnabled(true);
ui->status->setText(res.value("error_description").toString().toUtf8());
ui->status->setStyleSheet("* { color: red; }");
return;
}
ui->buttonBox->setEnabled(true);
ui->testButton->hide();
ui->status->setText(tr("It works!"));
ui->status->setStyleSheet("* { color: green; }");
});
}
} else {
// No Token set
ui->status->setText(tr("Login with Google needed"));
}
}
void GDriveSettingsDialog::on_testButton_clicked() {
GDriveSettingsDialog::checkAuthorization();
}
void GDriveSettingsDialog::on_authorize_clicked() {
if (ui->pin->text().isEmpty() || ui->folderId->text().isEmpty()) return;
ui->buttonBox->setEnabled(false);
QJsonObject object;
object.insert("client_id", ui->clientId->text());
object.insert("client_secret", ui->clientSecret->text());
object.insert("grant_type", "authorization_code");
object.insert("code", ui->pin->text());
object.insert("redirect_uri", "urn:ietf:wg:oauth:2.0:oob");
settings::settings().setValue("google/cid", ui->clientId->text());
settings::settings().setValue("google/csecret", ui->clientSecret->text());
settings::settings().setValue("google/folder", ui->folderId->text());
settings::settings().setValue("google/public", ui->isPublic->isChecked());
ioutils::postJson(QUrl("https://accounts.google.com/o/oauth2/token"),
QList<QPair<QString, QString>>({ QPair<QString, QString>("Content-Type", "applicaton/json") }),
QJsonDocument::fromVariant(object.toVariantMap()).toJson(),
[&](QJsonDocument response, QByteArray, QNetworkReply *r) {
QVariant statusCode = r->attribute(QNetworkRequest::HttpStatusCodeAttribute);
if (!statusCode.isValid()) return;
int status = statusCode.toInt();
if (status != 200 && status != 400)
{
QString reason = r->attribute( QNetworkRequest::HttpReasonPhraseAttribute ).toString();
qDebug() << reason;
ui->buttonBox->setEnabled(true);
return;
}
if (!response.isObject()) {
ui->buttonBox->setEnabled(true);
return;
}
QJsonObject res = response.object();
if (res.contains("error")) {
ui->buttonBox->setEnabled(true);
ui->status->setText(res.value("error_description").toString().toUtf8());
ui->status->setStyleSheet("* { color: red; }");
return;
}
if (res.value("success").toBool()) {
ui->buttonBox->setEnabled(true);
return;
}
settings::settings().setValue("google/expire",
QDateTime::currentDateTimeUtc().addSecs(res["expires_in"].toInt()));
settings::settings().setValue("google/refresh", res["refresh_token"].toString().toUtf8());
settings::settings().setValue("google/access", res["access_token"].toString().toUtf8());
ui->status->setText(tr("It works!"));
ui->status->setStyleSheet("* { color: green; }");
ui->authorize->setEnabled(false);
ui->addApp->setEnabled(false);
ui->clientSecret->setEnabled(false);
ui->clientId->setEnabled(false);
ui->buttonBox->setEnabled(true);
ui->testButton->hide();
});
}
| 45.230337 | 215 | 0.532108 | [
"object"
] |
13315ca087f0dc507e4f05ebbaabcaacbbbbb3a2 | 654,183 | cpp | C++ | src/main_1200.cpp | Fernthedev/BeatSaber-Quest-Codegen | 716e4ff3f8608f7ed5b83e2af3be805f69e26d9e | [
"Unlicense"
] | null | null | null | src/main_1200.cpp | Fernthedev/BeatSaber-Quest-Codegen | 716e4ff3f8608f7ed5b83e2af3be805f69e26d9e | [
"Unlicense"
] | null | null | null | src/main_1200.cpp | Fernthedev/BeatSaber-Quest-Codegen | 716e4ff3f8608f7ed5b83e2af3be805f69e26d9e | [
"Unlicense"
] | null | null | null | // Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Security.PbeUtilities
#include "Org/BouncyCastle/Security/PbeUtilities.hpp"
// Including type: System.Collections.IDictionary
#include "System/Collections/IDictionary.hpp"
// Including type: Org.BouncyCastle.Crypto.PbeParametersGenerator
#include "Org/BouncyCastle/Crypto/PbeParametersGenerator.hpp"
// Including type: Org.BouncyCastle.Crypto.IDigest
#include "Org/BouncyCastle/Crypto/IDigest.hpp"
// Including type: Org.BouncyCastle.Crypto.ICipherParameters
#include "Org/BouncyCastle/Crypto/ICipherParameters.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.AlgorithmIdentifier
#include "Org/BouncyCastle/Asn1/X509/AlgorithmIdentifier.hpp"
// Including type: Org.BouncyCastle.Asn1.Asn1Encodable
#include "Org/BouncyCastle/Asn1/Asn1Encodable.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static private readonly System.Collections.IDictionary algorithms
System::Collections::IDictionary* Org::BouncyCastle::Security::PbeUtilities::_get_algorithms() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::_get_algorithms");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::IDictionary*>("Org.BouncyCastle.Security", "PbeUtilities", "algorithms"));
}
// Autogenerated static field setter
// Set static field: static private readonly System.Collections.IDictionary algorithms
void Org::BouncyCastle::Security::PbeUtilities::_set_algorithms(System::Collections::IDictionary* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::_set_algorithms");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Security", "PbeUtilities", "algorithms", value));
}
// Autogenerated static field getter
// Get static field: static private readonly System.Collections.IDictionary algorithmType
System::Collections::IDictionary* Org::BouncyCastle::Security::PbeUtilities::_get_algorithmType() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::_get_algorithmType");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::IDictionary*>("Org.BouncyCastle.Security", "PbeUtilities", "algorithmType"));
}
// Autogenerated static field setter
// Set static field: static private readonly System.Collections.IDictionary algorithmType
void Org::BouncyCastle::Security::PbeUtilities::_set_algorithmType(System::Collections::IDictionary* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::_set_algorithmType");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Security", "PbeUtilities", "algorithmType", value));
}
// Autogenerated static field getter
// Get static field: static private readonly System.Collections.IDictionary oids
System::Collections::IDictionary* Org::BouncyCastle::Security::PbeUtilities::_get_oids() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::_get_oids");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::IDictionary*>("Org.BouncyCastle.Security", "PbeUtilities", "oids"));
}
// Autogenerated static field setter
// Set static field: static private readonly System.Collections.IDictionary oids
void Org::BouncyCastle::Security::PbeUtilities::_set_oids(System::Collections::IDictionary* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::_set_oids");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Security", "PbeUtilities", "oids", value));
}
// Autogenerated method: Org.BouncyCastle.Security.PbeUtilities..cctor
void Org::BouncyCastle::Security::PbeUtilities::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PbeUtilities", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Security.PbeUtilities.MakePbeGenerator
Org::BouncyCastle::Crypto::PbeParametersGenerator* Org::BouncyCastle::Security::PbeUtilities::MakePbeGenerator(::Il2CppString* type, Org::BouncyCastle::Crypto::IDigest* digest, ::Array<uint8_t>* key, ::Array<uint8_t>* salt, int iterationCount) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::MakePbeGenerator");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PbeUtilities", "MakePbeGenerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(type), ::il2cpp_utils::ExtractType(digest), ::il2cpp_utils::ExtractType(key), ::il2cpp_utils::ExtractType(salt), ::il2cpp_utils::ExtractType(iterationCount)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Crypto::PbeParametersGenerator*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, type, digest, key, salt, iterationCount);
}
// Autogenerated method: Org.BouncyCastle.Security.PbeUtilities.IsPkcs12
bool Org::BouncyCastle::Security::PbeUtilities::IsPkcs12(::Il2CppString* algorithm) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::IsPkcs12");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PbeUtilities", "IsPkcs12", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(algorithm)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, algorithm);
}
// Autogenerated method: Org.BouncyCastle.Security.PbeUtilities.IsPkcs5Scheme2
bool Org::BouncyCastle::Security::PbeUtilities::IsPkcs5Scheme2(::Il2CppString* algorithm) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::IsPkcs5Scheme2");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PbeUtilities", "IsPkcs5Scheme2", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(algorithm)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, algorithm);
}
// Autogenerated method: Org.BouncyCastle.Security.PbeUtilities.GenerateCipherParameters
Org::BouncyCastle::Crypto::ICipherParameters* Org::BouncyCastle::Security::PbeUtilities::GenerateCipherParameters(Org::BouncyCastle::Asn1::X509::AlgorithmIdentifier* algID, ::Array<::Il2CppChar>* password, bool wrongPkcs12Zero) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::GenerateCipherParameters");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PbeUtilities", "GenerateCipherParameters", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(algID), ::il2cpp_utils::ExtractType(password), ::il2cpp_utils::ExtractType(wrongPkcs12Zero)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Crypto::ICipherParameters*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, algID, password, wrongPkcs12Zero);
}
// Autogenerated method: Org.BouncyCastle.Security.PbeUtilities.GenerateCipherParameters
Org::BouncyCastle::Crypto::ICipherParameters* Org::BouncyCastle::Security::PbeUtilities::GenerateCipherParameters(::Il2CppString* algorithm, ::Array<::Il2CppChar>* password, bool wrongPkcs12Zero, Org::BouncyCastle::Asn1::Asn1Encodable* pbeParameters) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::GenerateCipherParameters");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PbeUtilities", "GenerateCipherParameters", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(algorithm), ::il2cpp_utils::ExtractType(password), ::il2cpp_utils::ExtractType(wrongPkcs12Zero), ::il2cpp_utils::ExtractType(pbeParameters)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Crypto::ICipherParameters*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, algorithm, password, wrongPkcs12Zero, pbeParameters);
}
// Autogenerated method: Org.BouncyCastle.Security.PbeUtilities.CreateEngine
::Il2CppObject* Org::BouncyCastle::Security::PbeUtilities::CreateEngine(Org::BouncyCastle::Asn1::X509::AlgorithmIdentifier* algID) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::CreateEngine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PbeUtilities", "CreateEngine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(algID)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, algID);
}
// Autogenerated method: Org.BouncyCastle.Security.PbeUtilities.CreateEngine
::Il2CppObject* Org::BouncyCastle::Security::PbeUtilities::CreateEngine(::Il2CppString* algorithm) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::CreateEngine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PbeUtilities", "CreateEngine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(algorithm)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, algorithm);
}
// Autogenerated method: Org.BouncyCastle.Security.PbeUtilities.FixDesParity
Org::BouncyCastle::Crypto::ICipherParameters* Org::BouncyCastle::Security::PbeUtilities::FixDesParity(::Il2CppString* mechanism, Org::BouncyCastle::Crypto::ICipherParameters* parameters) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PbeUtilities::FixDesParity");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PbeUtilities", "FixDesParity", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(mechanism), ::il2cpp_utils::ExtractType(parameters)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Crypto::ICipherParameters*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, mechanism, parameters);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Security.PrivateKeyFactory
#include "Org/BouncyCastle/Security/PrivateKeyFactory.hpp"
// Including type: Org.BouncyCastle.Crypto.AsymmetricKeyParameter
#include "Org/BouncyCastle/Crypto/AsymmetricKeyParameter.hpp"
// Including type: Org.BouncyCastle.Asn1.Pkcs.PrivateKeyInfo
#include "Org/BouncyCastle/Asn1/Pkcs/PrivateKeyInfo.hpp"
// Including type: Org.BouncyCastle.Asn1.Pkcs.EncryptedPrivateKeyInfo
#include "Org/BouncyCastle/Asn1/Pkcs/EncryptedPrivateKeyInfo.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.Security.PrivateKeyFactory.CreateKey
Org::BouncyCastle::Crypto::AsymmetricKeyParameter* Org::BouncyCastle::Security::PrivateKeyFactory::CreateKey(Org::BouncyCastle::Asn1::Pkcs::PrivateKeyInfo* keyInfo) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PrivateKeyFactory::CreateKey");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PrivateKeyFactory", "CreateKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(keyInfo)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Crypto::AsymmetricKeyParameter*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, keyInfo);
}
// Autogenerated method: Org.BouncyCastle.Security.PrivateKeyFactory.GetRawKey
::Array<uint8_t>* Org::BouncyCastle::Security::PrivateKeyFactory::GetRawKey(Org::BouncyCastle::Asn1::Pkcs::PrivateKeyInfo* keyInfo, int expectedSize) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PrivateKeyFactory::GetRawKey");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PrivateKeyFactory", "GetRawKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(keyInfo), ::il2cpp_utils::ExtractType(expectedSize)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, keyInfo, expectedSize);
}
// Autogenerated method: Org.BouncyCastle.Security.PrivateKeyFactory.DecryptKey
Org::BouncyCastle::Crypto::AsymmetricKeyParameter* Org::BouncyCastle::Security::PrivateKeyFactory::DecryptKey(::Array<::Il2CppChar>* passPhrase, Org::BouncyCastle::Asn1::Pkcs::EncryptedPrivateKeyInfo* encInfo) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PrivateKeyFactory::DecryptKey");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PrivateKeyFactory", "DecryptKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(passPhrase), ::il2cpp_utils::ExtractType(encInfo)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Crypto::AsymmetricKeyParameter*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, passPhrase, encInfo);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Security.PublicKeyFactory
#include "Org/BouncyCastle/Security/PublicKeyFactory.hpp"
// Including type: Org.BouncyCastle.Crypto.AsymmetricKeyParameter
#include "Org/BouncyCastle/Crypto/AsymmetricKeyParameter.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.SubjectPublicKeyInfo
#include "Org/BouncyCastle/Asn1/X509/SubjectPublicKeyInfo.hpp"
// Including type: Org.BouncyCastle.Asn1.Asn1Sequence
#include "Org/BouncyCastle/Asn1/Asn1Sequence.hpp"
// Including type: Org.BouncyCastle.Crypto.Parameters.DHPublicKeyParameters
#include "Org/BouncyCastle/Crypto/Parameters/DHPublicKeyParameters.hpp"
// Including type: Org.BouncyCastle.Asn1.DerObjectIdentifier
#include "Org/BouncyCastle/Asn1/DerObjectIdentifier.hpp"
// Including type: Org.BouncyCastle.Math.BigInteger
#include "Org/BouncyCastle/Math/BigInteger.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.Security.PublicKeyFactory.CreateKey
Org::BouncyCastle::Crypto::AsymmetricKeyParameter* Org::BouncyCastle::Security::PublicKeyFactory::CreateKey(::Array<uint8_t>* keyInfoData) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PublicKeyFactory::CreateKey");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PublicKeyFactory", "CreateKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(keyInfoData)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Crypto::AsymmetricKeyParameter*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, keyInfoData);
}
// Autogenerated method: Org.BouncyCastle.Security.PublicKeyFactory.CreateKey
Org::BouncyCastle::Crypto::AsymmetricKeyParameter* Org::BouncyCastle::Security::PublicKeyFactory::CreateKey(Org::BouncyCastle::Asn1::X509::SubjectPublicKeyInfo* keyInfo) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PublicKeyFactory::CreateKey");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PublicKeyFactory", "CreateKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(keyInfo)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Crypto::AsymmetricKeyParameter*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, keyInfo);
}
// Autogenerated method: Org.BouncyCastle.Security.PublicKeyFactory.GetRawKey
::Array<uint8_t>* Org::BouncyCastle::Security::PublicKeyFactory::GetRawKey(Org::BouncyCastle::Asn1::X509::SubjectPublicKeyInfo* keyInfo, int expectedSize) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PublicKeyFactory::GetRawKey");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PublicKeyFactory", "GetRawKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(keyInfo), ::il2cpp_utils::ExtractType(expectedSize)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, keyInfo, expectedSize);
}
// Autogenerated method: Org.BouncyCastle.Security.PublicKeyFactory.IsPkcsDHParam
bool Org::BouncyCastle::Security::PublicKeyFactory::IsPkcsDHParam(Org::BouncyCastle::Asn1::Asn1Sequence* seq) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PublicKeyFactory::IsPkcsDHParam");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PublicKeyFactory", "IsPkcsDHParam", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(seq)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, seq);
}
// Autogenerated method: Org.BouncyCastle.Security.PublicKeyFactory.ReadPkcsDHParam
Org::BouncyCastle::Crypto::Parameters::DHPublicKeyParameters* Org::BouncyCastle::Security::PublicKeyFactory::ReadPkcsDHParam(Org::BouncyCastle::Asn1::DerObjectIdentifier* algOid, Org::BouncyCastle::Math::BigInteger* y, Org::BouncyCastle::Asn1::Asn1Sequence* seq) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::PublicKeyFactory::ReadPkcsDHParam");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "PublicKeyFactory", "ReadPkcsDHParam", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(algOid), ::il2cpp_utils::ExtractType(y), ::il2cpp_utils::ExtractType(seq)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Crypto::Parameters::DHPublicKeyParameters*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, algOid, y, seq);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Security.SecurityUtilityException
#include "Org/BouncyCastle/Security/SecurityUtilityException.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Security.SignatureException
#include "Org/BouncyCastle/Security/SignatureException.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Security.SignerUtilities
#include "Org/BouncyCastle/Security/SignerUtilities.hpp"
// Including type: System.Collections.IDictionary
#include "System/Collections/IDictionary.hpp"
// Including type: Org.BouncyCastle.Crypto.ISigner
#include "Org/BouncyCastle/Crypto/ISigner.hpp"
// Including type: Org.BouncyCastle.Asn1.DerObjectIdentifier
#include "Org/BouncyCastle/Asn1/DerObjectIdentifier.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static readonly System.Collections.IDictionary algorithms
System::Collections::IDictionary* Org::BouncyCastle::Security::SignerUtilities::_get_algorithms() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::SignerUtilities::_get_algorithms");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::IDictionary*>("Org.BouncyCastle.Security", "SignerUtilities", "algorithms"));
}
// Autogenerated static field setter
// Set static field: static readonly System.Collections.IDictionary algorithms
void Org::BouncyCastle::Security::SignerUtilities::_set_algorithms(System::Collections::IDictionary* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::SignerUtilities::_set_algorithms");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Security", "SignerUtilities", "algorithms", value));
}
// Autogenerated static field getter
// Get static field: static readonly System.Collections.IDictionary oids
System::Collections::IDictionary* Org::BouncyCastle::Security::SignerUtilities::_get_oids() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::SignerUtilities::_get_oids");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::IDictionary*>("Org.BouncyCastle.Security", "SignerUtilities", "oids"));
}
// Autogenerated static field setter
// Set static field: static readonly System.Collections.IDictionary oids
void Org::BouncyCastle::Security::SignerUtilities::_set_oids(System::Collections::IDictionary* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::SignerUtilities::_set_oids");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Security", "SignerUtilities", "oids", value));
}
// Autogenerated method: Org.BouncyCastle.Security.SignerUtilities..cctor
void Org::BouncyCastle::Security::SignerUtilities::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::SignerUtilities::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "SignerUtilities", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Security.SignerUtilities.GetSigner
Org::BouncyCastle::Crypto::ISigner* Org::BouncyCastle::Security::SignerUtilities::GetSigner(::Il2CppString* algorithm) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::SignerUtilities::GetSigner");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "SignerUtilities", "GetSigner", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(algorithm)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Crypto::ISigner*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, algorithm);
}
// Autogenerated method: Org.BouncyCastle.Security.SignerUtilities.GetEncodingName
::Il2CppString* Org::BouncyCastle::Security::SignerUtilities::GetEncodingName(Org::BouncyCastle::Asn1::DerObjectIdentifier* oid) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Security::SignerUtilities::GetEncodingName");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Security", "SignerUtilities", "GetEncodingName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(oid)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, oid);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Collections.CollectionUtilities
#include "Org/BouncyCastle/Utilities/Collections/CollectionUtilities.hpp"
// Including type: System.Collections.IDictionary
#include "System/Collections/IDictionary.hpp"
// Including type: System.Collections.IEnumerator
#include "System/Collections/IEnumerator.hpp"
// Including type: System.Collections.IEnumerable
#include "System/Collections/IEnumerable.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.CollectionUtilities.ReadOnly
System::Collections::IDictionary* Org::BouncyCastle::Utilities::Collections::CollectionUtilities::ReadOnly(System::Collections::IDictionary* d) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::CollectionUtilities::ReadOnly");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Collections", "CollectionUtilities", "ReadOnly", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(d)})));
return ::il2cpp_utils::RunMethodThrow<System::Collections::IDictionary*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, d);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.CollectionUtilities.RequireNext
::Il2CppObject* Org::BouncyCastle::Utilities::Collections::CollectionUtilities::RequireNext(System::Collections::IEnumerator* e) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::CollectionUtilities::RequireNext");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Collections", "CollectionUtilities", "RequireNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(e)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, e);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.CollectionUtilities.ToString
::Il2CppString* Org::BouncyCastle::Utilities::Collections::CollectionUtilities::ToString(System::Collections::IEnumerable* c) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::CollectionUtilities::ToString");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Collections", "CollectionUtilities", "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, c);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: Org.BouncyCastle.Utilities.Collections.EmptyEnumerable
#include "Org/BouncyCastle/Utilities/Collections/EmptyEnumerable.hpp"
// Including type: System.Collections.IEnumerator
#include "System/Collections/IEnumerator.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public readonly System.Collections.IEnumerable Instance
System::Collections::IEnumerable* Org::BouncyCastle::Utilities::Collections::EmptyEnumerable::_get_Instance() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EmptyEnumerable::_get_Instance");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::IEnumerable*>("Org.BouncyCastle.Utilities.Collections", "EmptyEnumerable", "Instance"));
}
// Autogenerated static field setter
// Set static field: static public readonly System.Collections.IEnumerable Instance
void Org::BouncyCastle::Utilities::Collections::EmptyEnumerable::_set_Instance(System::Collections::IEnumerable* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EmptyEnumerable::_set_Instance");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Utilities.Collections", "EmptyEnumerable", "Instance", value));
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.EmptyEnumerable..cctor
void Org::BouncyCastle::Utilities::Collections::EmptyEnumerable::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EmptyEnumerable::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Collections", "EmptyEnumerable", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.EmptyEnumerable.GetEnumerator
System::Collections::IEnumerator* Org::BouncyCastle::Utilities::Collections::EmptyEnumerable::GetEnumerator() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EmptyEnumerable::GetEnumerator");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::Collections::IEnumerator*, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Collections.EmptyEnumerator
#include "Org/BouncyCastle/Utilities/Collections/EmptyEnumerator.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public readonly System.Collections.IEnumerator Instance
System::Collections::IEnumerator* Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::_get_Instance() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::_get_Instance");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Collections::IEnumerator*>("Org.BouncyCastle.Utilities.Collections", "EmptyEnumerator", "Instance"));
}
// Autogenerated static field setter
// Set static field: static public readonly System.Collections.IEnumerator Instance
void Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::_set_Instance(System::Collections::IEnumerator* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::_set_Instance");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Utilities.Collections", "EmptyEnumerator", "Instance", value));
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.EmptyEnumerator.get_Current
::Il2CppObject* Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::get_Current() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::get_Current");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Current", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.EmptyEnumerator..cctor
void Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Collections", "EmptyEnumerator", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.EmptyEnumerator.MoveNext
bool Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::MoveNext() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::MoveNext");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveNext", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.EmptyEnumerator.Reset
void Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::Reset() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EmptyEnumerator::Reset");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: Org.BouncyCastle.Utilities.Collections.EnumerableProxy
#include "Org/BouncyCastle/Utilities/Collections/EnumerableProxy.hpp"
// Including type: System.Collections.IEnumerator
#include "System/Collections/IEnumerator.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.IEnumerable inner
System::Collections::IEnumerable*& Org::BouncyCastle::Utilities::Collections::EnumerableProxy::dyn_inner() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EnumerableProxy::dyn_inner");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "inner"))->offset;
return *reinterpret_cast<System::Collections::IEnumerable**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.EnumerableProxy.GetEnumerator
System::Collections::IEnumerator* Org::BouncyCastle::Utilities::Collections::EnumerableProxy::GetEnumerator() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::EnumerableProxy::GetEnumerator");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::Collections::IEnumerator*, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Collections.ISet
#include "Org/BouncyCastle/Utilities/Collections/ISet.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.ISet.Add
void Org::BouncyCastle::Utilities::Collections::ISet::Add(::Il2CppObject* o) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::ISet::Add");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Add", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(o)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, o);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Collections.HashSet
#include "Org/BouncyCastle/Utilities/Collections/HashSet.hpp"
// Including type: System.Collections.IDictionary
#include "System/Collections/IDictionary.hpp"
// Including type: System.Array
#include "System/Array.hpp"
// Including type: System.Collections.IEnumerator
#include "System/Collections/IEnumerator.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.IDictionary impl
System::Collections::IDictionary*& Org::BouncyCastle::Utilities::Collections::HashSet::dyn_impl() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::HashSet::dyn_impl");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "impl"))->offset;
return *reinterpret_cast<System::Collections::IDictionary**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.HashSet.get_Count
int Org::BouncyCastle::Utilities::Collections::HashSet::get_Count() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::HashSet::get_Count");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Count", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.HashSet.Add
void Org::BouncyCastle::Utilities::Collections::HashSet::Add(::Il2CppObject* o) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::HashSet::Add");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Add", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(o)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, o);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.HashSet.CopyTo
void Org::BouncyCastle::Utilities::Collections::HashSet::CopyTo(System::Array* array, int index) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::HashSet::CopyTo");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CopyTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(array), ::il2cpp_utils::ExtractType(index)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, array, index);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.HashSet.GetEnumerator
System::Collections::IEnumerator* Org::BouncyCastle::Utilities::Collections::HashSet::GetEnumerator() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::HashSet::GetEnumerator");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::Collections::IEnumerator*, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionary
#include "Org/BouncyCastle/Utilities/Collections/UnmodifiableDictionary.hpp"
// Including type: System.Array
#include "System/Array.hpp"
// Including type: System.Collections.IEnumerator
#include "System/Collections/IEnumerator.hpp"
// Including type: System.Collections.IDictionaryEnumerator
#include "System/Collections/IDictionaryEnumerator.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionary.get_Count
int Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::get_Count() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::get_Count");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Count", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionary.get_Keys
System::Collections::ICollection* Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::get_Keys() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::get_Keys");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Keys", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::Collections::ICollection*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionary.get_Item
::Il2CppObject* Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::get_Item(::Il2CppObject* k) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::get_Item");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(k)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(___instance_arg, ___internal__method, k);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionary.set_Item
void Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::set_Item(::Il2CppObject* k, ::Il2CppObject* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::set_Item");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_Item", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(k), ::il2cpp_utils::ExtractType(value)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, k, value);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionary.Add
void Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::Add(::Il2CppObject* k, ::Il2CppObject* v) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::Add");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Add", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(k), ::il2cpp_utils::ExtractType(v)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, k, v);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionary.Contains
bool Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::Contains(::Il2CppObject* k) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::Contains");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Contains", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(k)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, k);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionary.CopyTo
void Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::CopyTo(System::Array* array, int index) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::CopyTo");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CopyTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(array), ::il2cpp_utils::ExtractType(index)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, array, index);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionary.System.Collections.IEnumerable.GetEnumerator
System::Collections::IEnumerator* Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::System_Collections_IEnumerable_GetEnumerator() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::System.Collections.IEnumerable.GetEnumerator");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "System.Collections.IEnumerable.GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::Collections::IEnumerator*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionary.GetEnumerator
System::Collections::IDictionaryEnumerator* Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::GetEnumerator() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::GetEnumerator");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::Collections::IDictionaryEnumerator*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionary.GetValue
::Il2CppObject* Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::GetValue(::Il2CppObject* k) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionary::GetValue");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetValue", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(k)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(___instance_arg, ___internal__method, k);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionaryProxy
#include "Org/BouncyCastle/Utilities/Collections/UnmodifiableDictionaryProxy.hpp"
// Including type: System.Array
#include "System/Array.hpp"
// Including type: System.Collections.IDictionaryEnumerator
#include "System/Collections/IDictionaryEnumerator.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly System.Collections.IDictionary d
System::Collections::IDictionary*& Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::dyn_d() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::dyn_d");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "d"))->offset;
return *reinterpret_cast<System::Collections::IDictionary**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionaryProxy.get_Count
int Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::get_Count() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::get_Count");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Count", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionaryProxy.get_Keys
System::Collections::ICollection* Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::get_Keys() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::get_Keys");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Keys", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::Collections::ICollection*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionaryProxy.Contains
bool Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::Contains(::Il2CppObject* k) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::Contains");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Contains", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(k)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, k);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionaryProxy.CopyTo
void Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::CopyTo(System::Array* array, int index) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::CopyTo");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CopyTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(array), ::il2cpp_utils::ExtractType(index)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, array, index);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionaryProxy.GetEnumerator
System::Collections::IDictionaryEnumerator* Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::GetEnumerator() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::GetEnumerator");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEnumerator", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::Collections::IDictionaryEnumerator*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Collections.UnmodifiableDictionaryProxy.GetValue
::Il2CppObject* Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::GetValue(::Il2CppObject* k) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Collections::UnmodifiableDictionaryProxy::GetValue");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetValue", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(k)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppObject*, false>(___instance_arg, ___internal__method, k);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Date.DateTimeObject
#include "Org/BouncyCastle/Utilities/Date/DateTimeObject.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly System.DateTime dt
System::DateTime& Org::BouncyCastle::Utilities::Date::DateTimeObject::dyn_dt() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Date::DateTimeObject::dyn_dt");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "dt"))->offset;
return *reinterpret_cast<System::DateTime*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Date.DateTimeObject.ToString
::Il2CppString* Org::BouncyCastle::Utilities::Date::DateTimeObject::ToString() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Date::DateTimeObject::ToString");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: Org.BouncyCastle.Utilities.Date.DateTimeUtilities
#include "Org/BouncyCastle/Utilities/Date/DateTimeUtilities.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public readonly System.DateTime UnixEpoch
System::DateTime Org::BouncyCastle::Utilities::Date::DateTimeUtilities::_get_UnixEpoch() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Date::DateTimeUtilities::_get_UnixEpoch");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::DateTime>("Org.BouncyCastle.Utilities.Date", "DateTimeUtilities", "UnixEpoch"));
}
// Autogenerated static field setter
// Set static field: static public readonly System.DateTime UnixEpoch
void Org::BouncyCastle::Utilities::Date::DateTimeUtilities::_set_UnixEpoch(System::DateTime value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Date::DateTimeUtilities::_set_UnixEpoch");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Utilities.Date", "DateTimeUtilities", "UnixEpoch", value));
}
// Autogenerated method: Org.BouncyCastle.Utilities.Date.DateTimeUtilities..cctor
void Org::BouncyCastle::Utilities::Date::DateTimeUtilities::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Date::DateTimeUtilities::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Date", "DateTimeUtilities", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Date.DateTimeUtilities.DateTimeToUnixMs
int64_t Org::BouncyCastle::Utilities::Date::DateTimeUtilities::DateTimeToUnixMs(System::DateTime dateTime) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Date::DateTimeUtilities::DateTimeToUnixMs");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Date", "DateTimeUtilities", "DateTimeToUnixMs", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(dateTime)})));
return ::il2cpp_utils::RunMethodThrow<int64_t, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, dateTime);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Date.DateTimeUtilities.CurrentUnixMs
int64_t Org::BouncyCastle::Utilities::Date::DateTimeUtilities::CurrentUnixMs() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Date::DateTimeUtilities::CurrentUnixMs");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Date", "DateTimeUtilities", "CurrentUnixMs", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodThrow<int64_t, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Encoders.Base64
#include "Org/BouncyCastle/Utilities/Encoders/Base64.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.Base64.Decode
::Array<uint8_t>* Org::BouncyCastle::Utilities::Encoders::Base64::Decode(::Il2CppString* data) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::Base64::Decode");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Encoders", "Base64", "Decode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Encoders.Hex
#include "Org/BouncyCastle/Utilities/Encoders/Hex.hpp"
// Including type: Org.BouncyCastle.Utilities.Encoders.HexEncoder
#include "Org/BouncyCastle/Utilities/Encoders/HexEncoder.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static private readonly Org.BouncyCastle.Utilities.Encoders.HexEncoder encoder
Org::BouncyCastle::Utilities::Encoders::HexEncoder* Org::BouncyCastle::Utilities::Encoders::Hex::_get_encoder() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::Hex::_get_encoder");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<Org::BouncyCastle::Utilities::Encoders::HexEncoder*>("Org.BouncyCastle.Utilities.Encoders", "Hex", "encoder"));
}
// Autogenerated static field setter
// Set static field: static private readonly Org.BouncyCastle.Utilities.Encoders.HexEncoder encoder
void Org::BouncyCastle::Utilities::Encoders::Hex::_set_encoder(Org::BouncyCastle::Utilities::Encoders::HexEncoder* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::Hex::_set_encoder");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Utilities.Encoders", "Hex", "encoder", value));
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.Hex..cctor
void Org::BouncyCastle::Utilities::Encoders::Hex::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::Hex::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Encoders", "Hex", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.Hex.ToHexString
::Il2CppString* Org::BouncyCastle::Utilities::Encoders::Hex::ToHexString(::Array<uint8_t>* data) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::Hex::ToHexString");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Encoders", "Hex", "ToHexString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.Hex.ToHexString
::Il2CppString* Org::BouncyCastle::Utilities::Encoders::Hex::ToHexString(::Array<uint8_t>* data, int off, int length) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::Hex::ToHexString");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Encoders", "Hex", "ToHexString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(off), ::il2cpp_utils::ExtractType(length)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data, off, length);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.Hex.Encode
::Array<uint8_t>* Org::BouncyCastle::Utilities::Encoders::Hex::Encode(::Array<uint8_t>* data, int off, int length) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::Hex::Encode");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Encoders", "Hex", "Encode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(off), ::il2cpp_utils::ExtractType(length)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data, off, length);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.Hex.Decode
::Array<uint8_t>* Org::BouncyCastle::Utilities::Encoders::Hex::Decode(::Il2CppString* data) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::Hex::Decode");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Encoders", "Hex", "Decode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.Hex.DecodeStrict
::Array<uint8_t>* Org::BouncyCastle::Utilities::Encoders::Hex::DecodeStrict(::Il2CppString* str) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::Hex::DecodeStrict");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Encoders", "Hex", "DecodeStrict", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(str)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, str);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Encoders.HexEncoder
#include "Org/BouncyCastle/Utilities/Encoders/HexEncoder.hpp"
// Including type: System.IO.Stream
#include "System/IO/Stream.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: protected readonly System.Byte[] encodingTable
::Array<uint8_t>*& Org::BouncyCastle::Utilities::Encoders::HexEncoder::dyn_encodingTable() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::HexEncoder::dyn_encodingTable");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "encodingTable"))->offset;
return *reinterpret_cast<::Array<uint8_t>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: protected readonly System.Byte[] decodingTable
::Array<uint8_t>*& Org::BouncyCastle::Utilities::Encoders::HexEncoder::dyn_decodingTable() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::HexEncoder::dyn_decodingTable");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "decodingTable"))->offset;
return *reinterpret_cast<::Array<uint8_t>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.HexEncoder.InitialiseDecodingTable
void Org::BouncyCastle::Utilities::Encoders::HexEncoder::InitialiseDecodingTable() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::HexEncoder::InitialiseDecodingTable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InitialiseDecodingTable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.HexEncoder.Encode
int Org::BouncyCastle::Utilities::Encoders::HexEncoder::Encode(::Array<uint8_t>* inBuf, int inOff, int inLen, ::Array<uint8_t>* outBuf, int outOff) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::HexEncoder::Encode");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Encode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inBuf), ::il2cpp_utils::ExtractType(inOff), ::il2cpp_utils::ExtractType(inLen), ::il2cpp_utils::ExtractType(outBuf), ::il2cpp_utils::ExtractType(outOff)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method, inBuf, inOff, inLen, outBuf, outOff);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.HexEncoder.Encode
int Org::BouncyCastle::Utilities::Encoders::HexEncoder::Encode(::Array<uint8_t>* buf, int off, int len, System::IO::Stream* outStream) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::HexEncoder::Encode");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Encode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(buf), ::il2cpp_utils::ExtractType(off), ::il2cpp_utils::ExtractType(len), ::il2cpp_utils::ExtractType(outStream)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method, buf, off, len, outStream);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.HexEncoder.Ignore
bool Org::BouncyCastle::Utilities::Encoders::HexEncoder::Ignore(::Il2CppChar c) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::HexEncoder::Ignore");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.Encoders", "HexEncoder", "Ignore", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, c);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.HexEncoder.DecodeString
int Org::BouncyCastle::Utilities::Encoders::HexEncoder::DecodeString(::Il2CppString* data, System::IO::Stream* outStream) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::HexEncoder::DecodeString");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DecodeString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(outStream)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method, data, outStream);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Encoders.HexEncoder.DecodeStrict
::Array<uint8_t>* Org::BouncyCastle::Utilities::Encoders::HexEncoder::DecodeStrict(::Il2CppString* str, int off, int len) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Encoders::HexEncoder::DecodeStrict");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "DecodeStrict", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(str), ::il2cpp_utils::ExtractType(off), ::il2cpp_utils::ExtractType(len)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(___instance_arg, ___internal__method, str, off, len);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.IO.Pem.PemHeader
#include "Org/BouncyCastle/Utilities/IO/Pem/PemHeader.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.String name
::Il2CppString*& Org::BouncyCastle::Utilities::IO::Pem::PemHeader::dyn_name() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemHeader::dyn_name");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "name"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String val
::Il2CppString*& Org::BouncyCastle::Utilities::IO::Pem::PemHeader::dyn_val() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemHeader::dyn_val");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "val"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Pem.PemHeader.get_Name
::Il2CppString* Org::BouncyCastle::Utilities::IO::Pem::PemHeader::get_Name() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemHeader::get_Name");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Name", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Pem.PemHeader.get_Value
::Il2CppString* Org::BouncyCastle::Utilities::IO::Pem::PemHeader::get_Value() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemHeader::get_Value");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Value", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Pem.PemHeader.GetHashCode
int Org::BouncyCastle::Utilities::IO::Pem::PemHeader::GetHashCode(::Il2CppString* s) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemHeader::GetHashCode");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(s)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method, s);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Pem.PemHeader.GetHashCode
int Org::BouncyCastle::Utilities::IO::Pem::PemHeader::GetHashCode() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemHeader::GetHashCode");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Pem.PemHeader.Equals
bool Org::BouncyCastle::Utilities::IO::Pem::PemHeader::Equals(::Il2CppObject* obj) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemHeader::Equals");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, obj);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.IO.Pem.PemObject
#include "Org/BouncyCastle/Utilities/IO/Pem/PemObject.hpp"
// Including type: System.Collections.IList
#include "System/Collections/IList.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.String type
::Il2CppString*& Org::BouncyCastle::Utilities::IO::Pem::PemObject::dyn_type() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemObject::dyn_type");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "type"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Collections.IList headers
System::Collections::IList*& Org::BouncyCastle::Utilities::IO::Pem::PemObject::dyn_headers() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemObject::dyn_headers");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "headers"))->offset;
return *reinterpret_cast<System::Collections::IList**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Byte[] content
::Array<uint8_t>*& Org::BouncyCastle::Utilities::IO::Pem::PemObject::dyn_content() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemObject::dyn_content");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "content"))->offset;
return *reinterpret_cast<::Array<uint8_t>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Pem.PemObject.get_Type
::Il2CppString* Org::BouncyCastle::Utilities::IO::Pem::PemObject::get_Type() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemObject::get_Type");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Type", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Pem.PemObject.get_Headers
System::Collections::IList* Org::BouncyCastle::Utilities::IO::Pem::PemObject::get_Headers() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemObject::get_Headers");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Headers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::Collections::IList*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Pem.PemObject.get_Content
::Array<uint8_t>* Org::BouncyCastle::Utilities::IO::Pem::PemObject::get_Content() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Pem::PemObject::get_Content");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Content", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.IO.PushbackStream
#include "Org/BouncyCastle/Utilities/IO/PushbackStream.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.Int32 buf
int& Org::BouncyCastle::Utilities::IO::PushbackStream::dyn_buf() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::PushbackStream::dyn_buf");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "buf"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.PushbackStream.Unread
void Org::BouncyCastle::Utilities::IO::PushbackStream::Unread(int b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::PushbackStream::Unread");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Unread", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(b)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.PushbackStream.ReadByte
int Org::BouncyCastle::Utilities::IO::PushbackStream::ReadByte() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::PushbackStream::ReadByte");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadByte", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.PushbackStream.Read
int Org::BouncyCastle::Utilities::IO::PushbackStream::Read(::Array<uint8_t>* buffer, int offset, int count) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::PushbackStream::Read");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Read", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(buffer), ::il2cpp_utils::ExtractType(offset), ::il2cpp_utils::ExtractType(count)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method, buffer, offset, count);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.IO.Streams
#include "Org/BouncyCastle/Utilities/IO/Streams.hpp"
// Including type: System.IO.Stream
#include "System/IO/Stream.hpp"
// Including type: System.IO.MemoryStream
#include "System/IO/MemoryStream.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Streams.ReadAll
::Array<uint8_t>* Org::BouncyCastle::Utilities::IO::Streams::ReadAll(System::IO::Stream* inStr) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Streams::ReadAll");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.IO", "Streams", "ReadAll", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inStr)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, inStr);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Streams.ReadFully
int Org::BouncyCastle::Utilities::IO::Streams::ReadFully(System::IO::Stream* inStr, ::Array<uint8_t>* buf) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Streams::ReadFully");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.IO", "Streams", "ReadFully", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inStr), ::il2cpp_utils::ExtractType(buf)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, inStr, buf);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Streams.ReadFully
int Org::BouncyCastle::Utilities::IO::Streams::ReadFully(System::IO::Stream* inStr, ::Array<uint8_t>* buf, int off, int len) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Streams::ReadFully");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.IO", "Streams", "ReadFully", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inStr), ::il2cpp_utils::ExtractType(buf), ::il2cpp_utils::ExtractType(off), ::il2cpp_utils::ExtractType(len)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, inStr, buf, off, len);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Streams.PipeAll
void Org::BouncyCastle::Utilities::IO::Streams::PipeAll(System::IO::Stream* inStr, System::IO::Stream* outStr) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Streams::PipeAll");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.IO", "Streams", "PipeAll", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inStr), ::il2cpp_utils::ExtractType(outStr)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, inStr, outStr);
}
// Autogenerated method: Org.BouncyCastle.Utilities.IO.Streams.WriteBufTo
int Org::BouncyCastle::Utilities::IO::Streams::WriteBufTo(System::IO::MemoryStream* buf, ::Array<uint8_t>* output, int offset) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::IO::Streams::WriteBufTo");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities.IO", "Streams", "WriteBufTo", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(buf), ::il2cpp_utils::ExtractType(output), ::il2cpp_utils::ExtractType(offset)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, buf, output, offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Arrays
#include "Org/BouncyCastle/Utilities/Arrays.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public readonly System.Byte[] EmptyBytes
::Array<uint8_t>* Org::BouncyCastle::Utilities::Arrays::_get_EmptyBytes() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::_get_EmptyBytes");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<uint8_t>*>("Org.BouncyCastle.Utilities", "Arrays", "EmptyBytes"));
}
// Autogenerated static field setter
// Set static field: static public readonly System.Byte[] EmptyBytes
void Org::BouncyCastle::Utilities::Arrays::_set_EmptyBytes(::Array<uint8_t>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::_set_EmptyBytes");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Utilities", "Arrays", "EmptyBytes", value));
}
// Autogenerated static field getter
// Get static field: static public readonly System.Int32[] EmptyInts
::Array<int>* Org::BouncyCastle::Utilities::Arrays::_get_EmptyInts() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::_get_EmptyInts");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<int>*>("Org.BouncyCastle.Utilities", "Arrays", "EmptyInts"));
}
// Autogenerated static field setter
// Set static field: static public readonly System.Int32[] EmptyInts
void Org::BouncyCastle::Utilities::Arrays::_set_EmptyInts(::Array<int>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::_set_EmptyInts");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Utilities", "Arrays", "EmptyInts", value));
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays..cctor
void Org::BouncyCastle::Utilities::Arrays::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.AreEqual
bool Org::BouncyCastle::Utilities::Arrays::AreEqual(::Array<uint8_t>* a, ::Array<uint8_t>* b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::AreEqual");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "AreEqual", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, a, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.ConstantTimeAreEqual
bool Org::BouncyCastle::Utilities::Arrays::ConstantTimeAreEqual(::Array<uint8_t>* a, ::Array<uint8_t>* b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::ConstantTimeAreEqual");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "ConstantTimeAreEqual", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, a, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.ConstantTimeAreEqual
bool Org::BouncyCastle::Utilities::Arrays::ConstantTimeAreEqual(int len, ::Array<uint8_t>* a, int aOff, ::Array<uint8_t>* b, int bOff) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::ConstantTimeAreEqual");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "ConstantTimeAreEqual", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(len), ::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(aOff), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(bOff)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, len, a, aOff, b, bOff);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.AreEqual
bool Org::BouncyCastle::Utilities::Arrays::AreEqual(::Array<int>* a, ::Array<int>* b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::AreEqual");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "AreEqual", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, a, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.AreEqual
bool Org::BouncyCastle::Utilities::Arrays::AreEqual(::Array<uint>* a, ::Array<uint>* b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::AreEqual");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "AreEqual", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, a, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.HaveSameContents
bool Org::BouncyCastle::Utilities::Arrays::HaveSameContents(::Array<uint8_t>* a, ::Array<uint8_t>* b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::HaveSameContents");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "HaveSameContents", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, a, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.HaveSameContents
bool Org::BouncyCastle::Utilities::Arrays::HaveSameContents(::Array<int>* a, ::Array<int>* b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::HaveSameContents");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "HaveSameContents", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, a, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.HaveSameContents
bool Org::BouncyCastle::Utilities::Arrays::HaveSameContents(::Array<uint>* a, ::Array<uint>* b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::HaveSameContents");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "HaveSameContents", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, a, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.GetHashCode
int Org::BouncyCastle::Utilities::Arrays::GetHashCode(::Array<uint8_t>* data) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::GetHashCode");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.GetHashCode
int Org::BouncyCastle::Utilities::Arrays::GetHashCode(::Array<int>* data) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::GetHashCode");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.GetHashCode
int Org::BouncyCastle::Utilities::Arrays::GetHashCode(::Array<uint>* data, int off, int len) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::GetHashCode");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(off), ::il2cpp_utils::ExtractType(len)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data, off, len);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.GetHashCode
int Org::BouncyCastle::Utilities::Arrays::GetHashCode(::Array<uint64_t>* data, int off, int len) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::GetHashCode");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(off), ::il2cpp_utils::ExtractType(len)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data, off, len);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.Clone
::Array<uint8_t>* Org::BouncyCastle::Utilities::Arrays::Clone(::Array<uint8_t>* data) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::Clone");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "Clone", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.Clone
::Array<int>* Org::BouncyCastle::Utilities::Arrays::Clone(::Array<int>* data) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::Clone");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "Clone", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data)})));
return ::il2cpp_utils::RunMethodThrow<::Array<int>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.Clone
::Array<uint>* Org::BouncyCastle::Utilities::Arrays::Clone(::Array<uint>* data) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::Clone");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "Clone", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.Clone
::Array<int64_t>* Org::BouncyCastle::Utilities::Arrays::Clone(::Array<int64_t>* data) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::Clone");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "Clone", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data)})));
return ::il2cpp_utils::RunMethodThrow<::Array<int64_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.Clone
::Array<uint64_t>* Org::BouncyCastle::Utilities::Arrays::Clone(::Array<uint64_t>* data) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::Clone");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "Clone", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint64_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.Contains
bool Org::BouncyCastle::Utilities::Arrays::Contains(::Array<uint8_t>* a, uint8_t n) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::Contains");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "Contains", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(n)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, a, n);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.Fill
void Org::BouncyCastle::Utilities::Arrays::Fill(::Array<uint8_t>* buf, uint8_t b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::Fill");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "Fill", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(buf), ::il2cpp_utils::ExtractType(b)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, buf, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.Fill
void Org::BouncyCastle::Utilities::Arrays::Fill(::Array<uint8_t>* buf, int from, int to, uint8_t b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::Fill");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "Fill", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(buf), ::il2cpp_utils::ExtractType(from), ::il2cpp_utils::ExtractType(to), ::il2cpp_utils::ExtractType(b)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, buf, from, to, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.CopyOfRange
::Array<uint8_t>* Org::BouncyCastle::Utilities::Arrays::CopyOfRange(::Array<uint8_t>* data, int from, int to) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::CopyOfRange");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "CopyOfRange", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(data), ::il2cpp_utils::ExtractType(from), ::il2cpp_utils::ExtractType(to)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, data, from, to);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.GetLength
int Org::BouncyCastle::Utilities::Arrays::GetLength(int from, int to) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::GetLength");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "GetLength", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(from), ::il2cpp_utils::ExtractType(to)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, from, to);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.Prepend
::Array<uint8_t>* Org::BouncyCastle::Utilities::Arrays::Prepend(::Array<uint8_t>* a, uint8_t b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::Prepend");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "Prepend", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, a, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.Reverse
::Array<uint8_t>* Org::BouncyCastle::Utilities::Arrays::Reverse(::Array<uint8_t>* a) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::Reverse");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "Reverse", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, a);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Arrays.IsNullOrContainsNull
bool Org::BouncyCastle::Utilities::Arrays::IsNullOrContainsNull(::Array<::Il2CppObject*>* array) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Arrays::IsNullOrContainsNull");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Arrays", "IsNullOrContainsNull", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(array)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, array);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.BigIntegers
#include "Org/BouncyCastle/Utilities/BigIntegers.hpp"
// Including type: Org.BouncyCastle.Math.BigInteger
#include "Org/BouncyCastle/Math/BigInteger.hpp"
// Including type: Org.BouncyCastle.Security.SecureRandom
#include "Org/BouncyCastle/Security/SecureRandom.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.Utilities.BigIntegers.AsUnsignedByteArray
::Array<uint8_t>* Org::BouncyCastle::Utilities::BigIntegers::AsUnsignedByteArray(Org::BouncyCastle::Math::BigInteger* n) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::BigIntegers::AsUnsignedByteArray");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "BigIntegers", "AsUnsignedByteArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(n)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, n);
}
// Autogenerated method: Org.BouncyCastle.Utilities.BigIntegers.AsUnsignedByteArray
::Array<uint8_t>* Org::BouncyCastle::Utilities::BigIntegers::AsUnsignedByteArray(int length, Org::BouncyCastle::Math::BigInteger* n) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::BigIntegers::AsUnsignedByteArray");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "BigIntegers", "AsUnsignedByteArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(length), ::il2cpp_utils::ExtractType(n)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, length, n);
}
// Autogenerated method: Org.BouncyCastle.Utilities.BigIntegers.CreateRandomBigInteger
Org::BouncyCastle::Math::BigInteger* Org::BouncyCastle::Utilities::BigIntegers::CreateRandomBigInteger(int bitLength, Org::BouncyCastle::Security::SecureRandom* secureRandom) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::BigIntegers::CreateRandomBigInteger");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "BigIntegers", "CreateRandomBigInteger", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(bitLength), ::il2cpp_utils::ExtractType(secureRandom)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Math::BigInteger*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, bitLength, secureRandom);
}
// Autogenerated method: Org.BouncyCastle.Utilities.BigIntegers.CreateRandomInRange
Org::BouncyCastle::Math::BigInteger* Org::BouncyCastle::Utilities::BigIntegers::CreateRandomInRange(Org::BouncyCastle::Math::BigInteger* min, Org::BouncyCastle::Math::BigInteger* max, Org::BouncyCastle::Security::SecureRandom* random) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::BigIntegers::CreateRandomInRange");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "BigIntegers", "CreateRandomInRange", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(min), ::il2cpp_utils::ExtractType(max), ::il2cpp_utils::ExtractType(random)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Math::BigInteger*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, min, max, random);
}
// Autogenerated method: Org.BouncyCastle.Utilities.BigIntegers.GetUnsignedByteLength
int Org::BouncyCastle::Utilities::BigIntegers::GetUnsignedByteLength(Org::BouncyCastle::Math::BigInteger* n) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::BigIntegers::GetUnsignedByteLength");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "BigIntegers", "GetUnsignedByteLength", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(n)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, n);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Enums
#include "Org/BouncyCastle/Utilities/Enums.hpp"
// Including type: System.Enum
#include "System/Enum.hpp"
// Including type: System.Type
#include "System/Type.hpp"
// Including type: System.Array
#include "System/Array.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.Utilities.Enums.GetEnumValue
System::Enum* Org::BouncyCastle::Utilities::Enums::GetEnumValue(System::Type* enumType, ::Il2CppString* s) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Enums::GetEnumValue");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Enums", "GetEnumValue", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(enumType), ::il2cpp_utils::ExtractType(s)})));
return ::il2cpp_utils::RunMethodThrow<System::Enum*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, enumType, s);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Enums.GetEnumValues
System::Array* Org::BouncyCastle::Utilities::Enums::GetEnumValues(System::Type* enumType) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Enums::GetEnumValues");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Enums", "GetEnumValues", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(enumType)})));
return ::il2cpp_utils::RunMethodThrow<System::Array*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, enumType);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Enums.GetArbitraryValue
System::Enum* Org::BouncyCastle::Utilities::Enums::GetArbitraryValue(System::Type* enumType) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Enums::GetArbitraryValue");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Enums", "GetArbitraryValue", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(enumType)})));
return ::il2cpp_utils::RunMethodThrow<System::Enum*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, enumType);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Enums.IsEnumType
bool Org::BouncyCastle::Utilities::Enums::IsEnumType(System::Type* t) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Enums::IsEnumType");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Enums", "IsEnumType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: Org.BouncyCastle.Utilities.Integers
#include "Org/BouncyCastle/Utilities/Integers.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.Utilities.Integers.NumberOfLeadingZeros
int Org::BouncyCastle::Utilities::Integers::NumberOfLeadingZeros(int i) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Integers::NumberOfLeadingZeros");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Integers", "NumberOfLeadingZeros", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(i)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, i);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Integers.NumberOfTrailingZeros
int Org::BouncyCastle::Utilities::Integers::NumberOfTrailingZeros(int i) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Integers::NumberOfTrailingZeros");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Integers", "NumberOfTrailingZeros", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(i)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, i);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Integers.RotateLeft
int Org::BouncyCastle::Utilities::Integers::RotateLeft(int i, int distance) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Integers::RotateLeft");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Integers", "RotateLeft", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(i), ::il2cpp_utils::ExtractType(distance)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, i, distance);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Integers.RotateLeft
uint Org::BouncyCastle::Utilities::Integers::RotateLeft(uint i, int distance) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Integers::RotateLeft");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Integers", "RotateLeft", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(i), ::il2cpp_utils::ExtractType(distance)})));
return ::il2cpp_utils::RunMethodThrow<uint, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, i, distance);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.MemoableResetException
#include "Org/BouncyCastle/Utilities/MemoableResetException.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Platform
#include "Org/BouncyCastle/Utilities/Platform.hpp"
// Including type: System.Globalization.CompareInfo
#include "System/Globalization/CompareInfo.hpp"
// Including type: System.Exception
#include "System/Exception.hpp"
// Including type: System.Collections.IList
#include "System/Collections/IList.hpp"
// Including type: System.Collections.ICollection
#include "System/Collections/ICollection.hpp"
// Including type: System.Collections.IDictionary
#include "System/Collections/IDictionary.hpp"
// Including type: System.IO.Stream
#include "System/IO/Stream.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static private readonly System.Globalization.CompareInfo InvariantCompareInfo
System::Globalization::CompareInfo* Org::BouncyCastle::Utilities::Platform::_get_InvariantCompareInfo() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::_get_InvariantCompareInfo");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<System::Globalization::CompareInfo*>("Org.BouncyCastle.Utilities", "Platform", "InvariantCompareInfo"));
}
// Autogenerated static field setter
// Set static field: static private readonly System.Globalization.CompareInfo InvariantCompareInfo
void Org::BouncyCastle::Utilities::Platform::_set_InvariantCompareInfo(System::Globalization::CompareInfo* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::_set_InvariantCompareInfo");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Utilities", "Platform", "InvariantCompareInfo", value));
}
// Autogenerated static field getter
// Get static field: static readonly System.String NewLine
::Il2CppString* Org::BouncyCastle::Utilities::Platform::_get_NewLine() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::_get_NewLine");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Il2CppString*>("Org.BouncyCastle.Utilities", "Platform", "NewLine"));
}
// Autogenerated static field setter
// Set static field: static readonly System.String NewLine
void Org::BouncyCastle::Utilities::Platform::_set_NewLine(::Il2CppString* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::_set_NewLine");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Utilities", "Platform", "NewLine", value));
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform..cctor
void Org::BouncyCastle::Utilities::Platform::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.GetNewLine
::Il2CppString* Org::BouncyCastle::Utilities::Platform::GetNewLine() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::GetNewLine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "GetNewLine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.EqualsIgnoreCase
bool Org::BouncyCastle::Utilities::Platform::EqualsIgnoreCase(::Il2CppString* a, ::Il2CppString* b) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::EqualsIgnoreCase");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "EqualsIgnoreCase", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(a), ::il2cpp_utils::ExtractType(b)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, a, b);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.GetEnvironmentVariable
::Il2CppString* Org::BouncyCastle::Utilities::Platform::GetEnvironmentVariable(::Il2CppString* variable) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::GetEnvironmentVariable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "GetEnvironmentVariable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(variable)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, variable);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.CreateNotImplementedException
System::Exception* Org::BouncyCastle::Utilities::Platform::CreateNotImplementedException(::Il2CppString* message) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::CreateNotImplementedException");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "CreateNotImplementedException", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(message)})));
return ::il2cpp_utils::RunMethodThrow<System::Exception*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, message);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.CreateArrayList
System::Collections::IList* Org::BouncyCastle::Utilities::Platform::CreateArrayList() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::CreateArrayList");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "CreateArrayList", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodThrow<System::Collections::IList*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.CreateArrayList
System::Collections::IList* Org::BouncyCastle::Utilities::Platform::CreateArrayList(int capacity) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::CreateArrayList");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "CreateArrayList", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(capacity)})));
return ::il2cpp_utils::RunMethodThrow<System::Collections::IList*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, capacity);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.CreateArrayList
System::Collections::IList* Org::BouncyCastle::Utilities::Platform::CreateArrayList(System::Collections::ICollection* collection) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::CreateArrayList");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "CreateArrayList", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(collection)})));
return ::il2cpp_utils::RunMethodThrow<System::Collections::IList*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, collection);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.CreateHashtable
System::Collections::IDictionary* Org::BouncyCastle::Utilities::Platform::CreateHashtable() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::CreateHashtable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "CreateHashtable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodThrow<System::Collections::IDictionary*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.CreateHashtable
System::Collections::IDictionary* Org::BouncyCastle::Utilities::Platform::CreateHashtable(int capacity) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::CreateHashtable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "CreateHashtable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(capacity)})));
return ::il2cpp_utils::RunMethodThrow<System::Collections::IDictionary*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, capacity);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.ToUpperInvariant
::Il2CppString* Org::BouncyCastle::Utilities::Platform::ToUpperInvariant(::Il2CppString* s) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::ToUpperInvariant");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "ToUpperInvariant", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(s)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, s);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.Dispose
void Org::BouncyCastle::Utilities::Platform::Dispose(System::IO::Stream* s) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::Dispose");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "Dispose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(s)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, s);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.IndexOf
int Org::BouncyCastle::Utilities::Platform::IndexOf(::Il2CppString* source, ::Il2CppString* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::IndexOf");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "IndexOf", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(source), ::il2cpp_utils::ExtractType(value)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, source, value);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.StartsWith
bool Org::BouncyCastle::Utilities::Platform::StartsWith(::Il2CppString* source, ::Il2CppString* prefix) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::StartsWith");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "StartsWith", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(source), ::il2cpp_utils::ExtractType(prefix)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, source, prefix);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.EndsWith
bool Org::BouncyCastle::Utilities::Platform::EndsWith(::Il2CppString* source, ::Il2CppString* suffix) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::EndsWith");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "EndsWith", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(source), ::il2cpp_utils::ExtractType(suffix)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, source, suffix);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Platform.GetTypeName
::Il2CppString* Org::BouncyCastle::Utilities::Platform::GetTypeName(::Il2CppObject* obj) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Platform::GetTypeName");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Platform", "GetTypeName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, obj);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.Utilities.Strings
#include "Org/BouncyCastle/Utilities/Strings.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.Utilities.Strings.IsOneOf
bool Org::BouncyCastle::Utilities::Strings::IsOneOf(::Il2CppString* s, ::Array<::Il2CppString*>* candidates) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Strings::IsOneOf");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Strings", "IsOneOf", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(s), ::il2cpp_utils::ExtractType(candidates)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, s, candidates);
}
// Creating initializer_list -> params proxy for: System.Boolean IsOneOf(System.String s, params System.String[] candidates)
bool Org::BouncyCastle::Utilities::Strings::IsOneOf(::Il2CppString* s, std::initializer_list<::Il2CppString*> candidates) {
return Org::BouncyCastle::Utilities::Strings::IsOneOf(s, ::Array<::Il2CppString*>::New(candidates));
}
// Autogenerated method: Org.BouncyCastle.Utilities.Strings.FromByteArray
::Il2CppString* Org::BouncyCastle::Utilities::Strings::FromByteArray(::Array<uint8_t>* bs) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Strings::FromByteArray");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Strings", "FromByteArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(bs)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, bs);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Strings.ToByteArray
::Array<uint8_t>* Org::BouncyCastle::Utilities::Strings::ToByteArray(::Array<::Il2CppChar>* cs) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Strings::ToByteArray");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Strings", "ToByteArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(cs)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, cs);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Strings.ToByteArray
::Array<uint8_t>* Org::BouncyCastle::Utilities::Strings::ToByteArray(::Il2CppString* s) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Strings::ToByteArray");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Strings", "ToByteArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(s)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, s);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Strings.FromAsciiByteArray
::Il2CppString* Org::BouncyCastle::Utilities::Strings::FromAsciiByteArray(::Array<uint8_t>* bytes) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Strings::FromAsciiByteArray");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Strings", "FromAsciiByteArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(bytes)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, bytes);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Strings.ToAsciiByteArray
::Array<uint8_t>* Org::BouncyCastle::Utilities::Strings::ToAsciiByteArray(::Il2CppString* s) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Strings::ToAsciiByteArray");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Strings", "ToAsciiByteArray", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(s)})));
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, s);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: Org.BouncyCastle.Utilities.Times
#include "Org/BouncyCastle/Utilities/Times.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static private System.Int64 NanosecondsPerTick
int64_t Org::BouncyCastle::Utilities::Times::_get_NanosecondsPerTick() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Times::_get_NanosecondsPerTick");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<int64_t>("Org.BouncyCastle.Utilities", "Times", "NanosecondsPerTick"));
}
// Autogenerated static field setter
// Set static field: static private System.Int64 NanosecondsPerTick
void Org::BouncyCastle::Utilities::Times::_set_NanosecondsPerTick(int64_t value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Times::_set_NanosecondsPerTick");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.Utilities", "Times", "NanosecondsPerTick", value));
}
// Autogenerated method: Org.BouncyCastle.Utilities.Times..cctor
void Org::BouncyCastle::Utilities::Times::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Times::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Times", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.Utilities.Times.NanoTime
int64_t Org::BouncyCastle::Utilities::Times::NanoTime() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::Utilities::Times::NanoTime");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.Utilities", "Times", "NanoTime", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodThrow<int64_t, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: Org.BouncyCastle.X509.Extension.X509ExtensionUtilities
#include "Org/BouncyCastle/X509/Extension/X509ExtensionUtilities.hpp"
// Including type: Org.BouncyCastle.Asn1.Asn1Object
#include "Org/BouncyCastle/Asn1/Asn1Object.hpp"
// Including type: Org.BouncyCastle.Asn1.Asn1OctetString
#include "Org/BouncyCastle/Asn1/Asn1OctetString.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: Org.BouncyCastle.X509.Extension.X509ExtensionUtilities.FromExtensionValue
Org::BouncyCastle::Asn1::Asn1Object* Org::BouncyCastle::X509::Extension::X509ExtensionUtilities::FromExtensionValue(Org::BouncyCastle::Asn1::Asn1OctetString* extensionValue) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::Extension::X509ExtensionUtilities::FromExtensionValue");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.X509.Extension", "X509ExtensionUtilities", "FromExtensionValue", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(extensionValue)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::Asn1Object*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, extensionValue);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.X509.PemParser
#include "Org/BouncyCastle/X509/PemParser.hpp"
// Including type: System.IO.Stream
#include "System/IO/Stream.hpp"
// Including type: Org.BouncyCastle.Asn1.Asn1Sequence
#include "Org/BouncyCastle/Asn1/Asn1Sequence.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly System.String _header1
::Il2CppString*& Org::BouncyCastle::X509::PemParser::dyn__header1() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::PemParser::dyn__header1");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_header1"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.String _header2
::Il2CppString*& Org::BouncyCastle::X509::PemParser::dyn__header2() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::PemParser::dyn__header2");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_header2"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.String _footer1
::Il2CppString*& Org::BouncyCastle::X509::PemParser::dyn__footer1() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::PemParser::dyn__footer1");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_footer1"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.String _footer2
::Il2CppString*& Org::BouncyCastle::X509::PemParser::dyn__footer2() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::PemParser::dyn__footer2");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_footer2"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.X509.PemParser.ReadLine
::Il2CppString* Org::BouncyCastle::X509::PemParser::ReadLine(System::IO::Stream* inStream) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::PemParser::ReadLine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadLine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inStream)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method, inStream);
}
// Autogenerated method: Org.BouncyCastle.X509.PemParser.ReadPemObject
Org::BouncyCastle::Asn1::Asn1Sequence* Org::BouncyCastle::X509::PemParser::ReadPemObject(System::IO::Stream* inStream) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::PemParser::ReadPemObject");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadPemObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inStream)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::Asn1Sequence*, false>(___instance_arg, ___internal__method, inStream);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.X509.X509Certificate
#include "Org/BouncyCastle/X509/X509Certificate.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.X509CertificateStructure
#include "Org/BouncyCastle/Asn1/X509/X509CertificateStructure.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.BasicConstraints
#include "Org/BouncyCastle/Asn1/X509/BasicConstraints.hpp"
// Including type: Org.BouncyCastle.Crypto.AsymmetricKeyParameter
#include "Org/BouncyCastle/Crypto/AsymmetricKeyParameter.hpp"
// Including type: Org.BouncyCastle.Math.BigInteger
#include "Org/BouncyCastle/Math/BigInteger.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.X509Name
#include "Org/BouncyCastle/Asn1/X509/X509Name.hpp"
// Including type: System.DateTime
#include "System/DateTime.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.X509Extensions
#include "Org/BouncyCastle/Asn1/X509/X509Extensions.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly Org.BouncyCastle.Asn1.X509.X509CertificateStructure c
Org::BouncyCastle::Asn1::X509::X509CertificateStructure*& Org::BouncyCastle::X509::X509Certificate::dyn_c() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::dyn_c");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "c"))->offset;
return *reinterpret_cast<Org::BouncyCastle::Asn1::X509::X509CertificateStructure**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.String sigAlgName
::Il2CppString*& Org::BouncyCastle::X509::X509Certificate::dyn_sigAlgName() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::dyn_sigAlgName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "sigAlgName"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Byte[] sigAlgParams
::Array<uint8_t>*& Org::BouncyCastle::X509::X509Certificate::dyn_sigAlgParams() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::dyn_sigAlgParams");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "sigAlgParams"))->offset;
return *reinterpret_cast<::Array<uint8_t>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly Org.BouncyCastle.Asn1.X509.BasicConstraints basicConstraints
Org::BouncyCastle::Asn1::X509::BasicConstraints*& Org::BouncyCastle::X509::X509Certificate::dyn_basicConstraints() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::dyn_basicConstraints");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "basicConstraints"))->offset;
return *reinterpret_cast<Org::BouncyCastle::Asn1::X509::BasicConstraints**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Boolean[] keyUsage
::Array<bool>*& Org::BouncyCastle::X509::X509Certificate::dyn_keyUsage() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::dyn_keyUsage");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "keyUsage"))->offset;
return *reinterpret_cast<::Array<bool>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Object cacheLock
::Il2CppObject*& Org::BouncyCastle::X509::X509Certificate::dyn_cacheLock() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::dyn_cacheLock");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "cacheLock"))->offset;
return *reinterpret_cast<::Il2CppObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Org.BouncyCastle.Crypto.AsymmetricKeyParameter publicKeyValue
Org::BouncyCastle::Crypto::AsymmetricKeyParameter*& Org::BouncyCastle::X509::X509Certificate::dyn_publicKeyValue() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::dyn_publicKeyValue");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "publicKeyValue"))->offset;
return *reinterpret_cast<Org::BouncyCastle::Crypto::AsymmetricKeyParameter**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean hashValueSet
bool& Org::BouncyCastle::X509::X509Certificate::dyn_hashValueSet() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::dyn_hashValueSet");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "hashValueSet"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 hashValue
int& Org::BouncyCastle::X509::X509Certificate::dyn_hashValue() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::dyn_hashValue");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "hashValue"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.get_Version
int Org::BouncyCastle::X509::X509Certificate::get_Version() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::get_Version");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Version", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.get_SerialNumber
Org::BouncyCastle::Math::BigInteger* Org::BouncyCastle::X509::X509Certificate::get_SerialNumber() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::get_SerialNumber");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_SerialNumber", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Math::BigInteger*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.get_IssuerDN
Org::BouncyCastle::Asn1::X509::X509Name* Org::BouncyCastle::X509::X509Certificate::get_IssuerDN() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::get_IssuerDN");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IssuerDN", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::X509::X509Name*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.get_SubjectDN
Org::BouncyCastle::Asn1::X509::X509Name* Org::BouncyCastle::X509::X509Certificate::get_SubjectDN() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::get_SubjectDN");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_SubjectDN", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::X509::X509Name*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.get_NotBefore
System::DateTime Org::BouncyCastle::X509::X509Certificate::get_NotBefore() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::get_NotBefore");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_NotBefore", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::DateTime, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.get_NotAfter
System::DateTime Org::BouncyCastle::X509::X509Certificate::get_NotAfter() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::get_NotAfter");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_NotAfter", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::DateTime, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.get_SigAlgName
::Il2CppString* Org::BouncyCastle::X509::X509Certificate::get_SigAlgName() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::get_SigAlgName");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_SigAlgName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.GetSignature
::Array<uint8_t>* Org::BouncyCastle::X509::X509Certificate::GetSignature() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::GetSignature");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetSignature", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.GetPublicKey
Org::BouncyCastle::Crypto::AsymmetricKeyParameter* Org::BouncyCastle::X509::X509Certificate::GetPublicKey() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::GetPublicKey");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetPublicKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Crypto::AsymmetricKeyParameter*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.GetEncoded
::Array<uint8_t>* Org::BouncyCastle::X509::X509Certificate::GetEncoded() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::GetEncoded");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetEncoded", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.GetX509Extensions
Org::BouncyCastle::Asn1::X509::X509Extensions* Org::BouncyCastle::X509::X509Certificate::GetX509Extensions() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::GetX509Extensions");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetX509Extensions", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::X509::X509Extensions*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.Equals
bool Org::BouncyCastle::X509::X509Certificate::Equals(::Il2CppObject* other) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::Equals");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, other);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.GetHashCode
int Org::BouncyCastle::X509::X509Certificate::GetHashCode() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::GetHashCode");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Certificate.ToString
::Il2CppString* Org::BouncyCastle::X509::X509Certificate::ToString() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Certificate::ToString");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.X509.X509CertificateParser
#include "Org/BouncyCastle/X509/X509CertificateParser.hpp"
// Including type: Org.BouncyCastle.Asn1.Asn1Set
#include "Org/BouncyCastle/Asn1/Asn1Set.hpp"
// Including type: System.IO.Stream
#include "System/IO/Stream.hpp"
// Including type: Org.BouncyCastle.X509.PemParser
#include "Org/BouncyCastle/X509/PemParser.hpp"
// Including type: Org.BouncyCastle.X509.X509Certificate
#include "Org/BouncyCastle/X509/X509Certificate.hpp"
// Including type: Org.BouncyCastle.Asn1.Asn1InputStream
#include "Org/BouncyCastle/Asn1/Asn1InputStream.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.X509CertificateStructure
#include "Org/BouncyCastle/Asn1/X509/X509CertificateStructure.hpp"
// Including type: System.Collections.ICollection
#include "System/Collections/ICollection.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static private readonly Org.BouncyCastle.X509.PemParser PemCertParser
Org::BouncyCastle::X509::PemParser* Org::BouncyCastle::X509::X509CertificateParser::_get_PemCertParser() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::_get_PemCertParser");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<Org::BouncyCastle::X509::PemParser*>("Org.BouncyCastle.X509", "X509CertificateParser", "PemCertParser"));
}
// Autogenerated static field setter
// Set static field: static private readonly Org.BouncyCastle.X509.PemParser PemCertParser
void Org::BouncyCastle::X509::X509CertificateParser::_set_PemCertParser(Org::BouncyCastle::X509::PemParser* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::_set_PemCertParser");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.X509", "X509CertificateParser", "PemCertParser", value));
}
// Autogenerated instance field getter
// Get instance field: private Org.BouncyCastle.Asn1.Asn1Set sData
Org::BouncyCastle::Asn1::Asn1Set*& Org::BouncyCastle::X509::X509CertificateParser::dyn_sData() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::dyn_sData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "sData"))->offset;
return *reinterpret_cast<Org::BouncyCastle::Asn1::Asn1Set**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 sDataObjectCount
int& Org::BouncyCastle::X509::X509CertificateParser::dyn_sDataObjectCount() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::dyn_sDataObjectCount");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "sDataObjectCount"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.IO.Stream currentStream
System::IO::Stream*& Org::BouncyCastle::X509::X509CertificateParser::dyn_currentStream() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::dyn_currentStream");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "currentStream"))->offset;
return *reinterpret_cast<System::IO::Stream**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CertificateParser..cctor
void Org::BouncyCastle::X509::X509CertificateParser::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.X509", "X509CertificateParser", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CertificateParser.ReadDerCertificate
Org::BouncyCastle::X509::X509Certificate* Org::BouncyCastle::X509::X509CertificateParser::ReadDerCertificate(Org::BouncyCastle::Asn1::Asn1InputStream* dIn) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::ReadDerCertificate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadDerCertificate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(dIn)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Certificate*, false>(___instance_arg, ___internal__method, dIn);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CertificateParser.GetCertificate
Org::BouncyCastle::X509::X509Certificate* Org::BouncyCastle::X509::X509CertificateParser::GetCertificate() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::GetCertificate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetCertificate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Certificate*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CertificateParser.ReadPemCertificate
Org::BouncyCastle::X509::X509Certificate* Org::BouncyCastle::X509::X509CertificateParser::ReadPemCertificate(System::IO::Stream* inStream) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::ReadPemCertificate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadPemCertificate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inStream)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Certificate*, false>(___instance_arg, ___internal__method, inStream);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CertificateParser.CreateX509Certificate
Org::BouncyCastle::X509::X509Certificate* Org::BouncyCastle::X509::X509CertificateParser::CreateX509Certificate(Org::BouncyCastle::Asn1::X509::X509CertificateStructure* c) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::CreateX509Certificate");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateX509Certificate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(c)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Certificate*, false>(___instance_arg, ___internal__method, c);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CertificateParser.ReadCertificate
Org::BouncyCastle::X509::X509Certificate* Org::BouncyCastle::X509::X509CertificateParser::ReadCertificate(::Array<uint8_t>* input) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::ReadCertificate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadCertificate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(input)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Certificate*, false>(___instance_arg, ___internal__method, input);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CertificateParser.ReadCertificates
System::Collections::ICollection* Org::BouncyCastle::X509::X509CertificateParser::ReadCertificates(::Array<uint8_t>* input) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::ReadCertificates");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadCertificates", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(input)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::Collections::ICollection*, false>(___instance_arg, ___internal__method, input);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CertificateParser.ReadCertificate
Org::BouncyCastle::X509::X509Certificate* Org::BouncyCastle::X509::X509CertificateParser::ReadCertificate(System::IO::Stream* inStream) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::ReadCertificate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadCertificate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inStream)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Certificate*, false>(___instance_arg, ___internal__method, inStream);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CertificateParser.ReadCertificates
System::Collections::ICollection* Org::BouncyCastle::X509::X509CertificateParser::ReadCertificates(System::IO::Stream* inStream) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CertificateParser::ReadCertificates");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadCertificates", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inStream)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::Collections::ICollection*, false>(___instance_arg, ___internal__method, inStream);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.X509.X509Crl
#include "Org/BouncyCastle/X509/X509Crl.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.CertificateList
#include "Org/BouncyCastle/Asn1/X509/CertificateList.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.X509Name
#include "Org/BouncyCastle/Asn1/X509/X509Name.hpp"
// Including type: System.DateTime
#include "System/DateTime.hpp"
// Including type: Org.BouncyCastle.Utilities.Date.DateTimeObject
#include "Org/BouncyCastle/Utilities/Date/DateTimeObject.hpp"
// Including type: Org.BouncyCastle.Utilities.Collections.ISet
#include "Org/BouncyCastle/Utilities/Collections/ISet.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.X509Extensions
#include "Org/BouncyCastle/Asn1/X509/X509Extensions.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly Org.BouncyCastle.Asn1.X509.CertificateList c
Org::BouncyCastle::Asn1::X509::CertificateList*& Org::BouncyCastle::X509::X509Crl::dyn_c() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::dyn_c");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "c"))->offset;
return *reinterpret_cast<Org::BouncyCastle::Asn1::X509::CertificateList**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.String sigAlgName
::Il2CppString*& Org::BouncyCastle::X509::X509Crl::dyn_sigAlgName() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::dyn_sigAlgName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "sigAlgName"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Byte[] sigAlgParams
::Array<uint8_t>*& Org::BouncyCastle::X509::X509Crl::dyn_sigAlgParams() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::dyn_sigAlgParams");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "sigAlgParams"))->offset;
return *reinterpret_cast<::Array<uint8_t>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Boolean isIndirect
bool& Org::BouncyCastle::X509::X509Crl::dyn_isIndirect() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::dyn_isIndirect");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "isIndirect"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean hashValueSet
bool& Org::BouncyCastle::X509::X509Crl::dyn_hashValueSet() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::dyn_hashValueSet");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "hashValueSet"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 hashValue
int& Org::BouncyCastle::X509::X509Crl::dyn_hashValue() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::dyn_hashValue");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "hashValue"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.get_Version
int Org::BouncyCastle::X509::X509Crl::get_Version() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::get_Version");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_Version", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.get_IssuerDN
Org::BouncyCastle::Asn1::X509::X509Name* Org::BouncyCastle::X509::X509Crl::get_IssuerDN() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::get_IssuerDN");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IssuerDN", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::X509::X509Name*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.get_ThisUpdate
System::DateTime Org::BouncyCastle::X509::X509Crl::get_ThisUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::get_ThisUpdate");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ThisUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::DateTime, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.get_NextUpdate
Org::BouncyCastle::Utilities::Date::DateTimeObject* Org::BouncyCastle::X509::X509Crl::get_NextUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::get_NextUpdate");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_NextUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Utilities::Date::DateTimeObject*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.get_SigAlgName
::Il2CppString* Org::BouncyCastle::X509::X509Crl::get_SigAlgName() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::get_SigAlgName");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_SigAlgName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.get_IsIndirectCrl
bool Org::BouncyCastle::X509::X509Crl::get_IsIndirectCrl() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::get_IsIndirectCrl");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_IsIndirectCrl", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.LoadCrlEntries
Org::BouncyCastle::Utilities::Collections::ISet* Org::BouncyCastle::X509::X509Crl::LoadCrlEntries() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::LoadCrlEntries");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LoadCrlEntries", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Utilities::Collections::ISet*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.GetRevokedCertificates
Org::BouncyCastle::Utilities::Collections::ISet* Org::BouncyCastle::X509::X509Crl::GetRevokedCertificates() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::GetRevokedCertificates");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetRevokedCertificates", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Utilities::Collections::ISet*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.GetSignature
::Array<uint8_t>* Org::BouncyCastle::X509::X509Crl::GetSignature() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::GetSignature");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetSignature", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Array<uint8_t>*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.GetX509Extensions
Org::BouncyCastle::Asn1::X509::X509Extensions* Org::BouncyCastle::X509::X509Crl::GetX509Extensions() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::GetX509Extensions");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetX509Extensions", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::X509::X509Extensions*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.Equals
bool Org::BouncyCastle::X509::X509Crl::Equals(::Il2CppObject* other) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::Equals");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, other);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.GetHashCode
int Org::BouncyCastle::X509::X509Crl::GetHashCode() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::GetHashCode");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509Crl.ToString
::Il2CppString* Org::BouncyCastle::X509::X509Crl::ToString() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509Crl::ToString");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.X509.X509CrlEntry
#include "Org/BouncyCastle/X509/X509CrlEntry.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.CrlEntry
#include "Org/BouncyCastle/Asn1/X509/CrlEntry.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.X509Name
#include "Org/BouncyCastle/Asn1/X509/X509Name.hpp"
// Including type: Org.BouncyCastle.Math.BigInteger
#include "Org/BouncyCastle/Math/BigInteger.hpp"
// Including type: System.DateTime
#include "System/DateTime.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.X509Extensions
#include "Org/BouncyCastle/Asn1/X509/X509Extensions.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private Org.BouncyCastle.Asn1.X509.CrlEntry c
Org::BouncyCastle::Asn1::X509::CrlEntry*& Org::BouncyCastle::X509::X509CrlEntry::dyn_c() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::dyn_c");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "c"))->offset;
return *reinterpret_cast<Org::BouncyCastle::Asn1::X509::CrlEntry**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean isIndirect
bool& Org::BouncyCastle::X509::X509CrlEntry::dyn_isIndirect() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::dyn_isIndirect");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "isIndirect"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Org.BouncyCastle.Asn1.X509.X509Name previousCertificateIssuer
Org::BouncyCastle::Asn1::X509::X509Name*& Org::BouncyCastle::X509::X509CrlEntry::dyn_previousCertificateIssuer() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::dyn_previousCertificateIssuer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "previousCertificateIssuer"))->offset;
return *reinterpret_cast<Org::BouncyCastle::Asn1::X509::X509Name**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Org.BouncyCastle.Asn1.X509.X509Name certificateIssuer
Org::BouncyCastle::Asn1::X509::X509Name*& Org::BouncyCastle::X509::X509CrlEntry::dyn_certificateIssuer() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::dyn_certificateIssuer");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "certificateIssuer"))->offset;
return *reinterpret_cast<Org::BouncyCastle::Asn1::X509::X509Name**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean hashValueSet
bool& Org::BouncyCastle::X509::X509CrlEntry::dyn_hashValueSet() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::dyn_hashValueSet");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "hashValueSet"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 hashValue
int& Org::BouncyCastle::X509::X509CrlEntry::dyn_hashValue() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::dyn_hashValue");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "hashValue"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlEntry.get_SerialNumber
Org::BouncyCastle::Math::BigInteger* Org::BouncyCastle::X509::X509CrlEntry::get_SerialNumber() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::get_SerialNumber");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_SerialNumber", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Math::BigInteger*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlEntry.get_RevocationDate
System::DateTime Org::BouncyCastle::X509::X509CrlEntry::get_RevocationDate() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::get_RevocationDate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_RevocationDate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::DateTime, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlEntry.loadCertificateIssuer
Org::BouncyCastle::Asn1::X509::X509Name* Org::BouncyCastle::X509::X509CrlEntry::loadCertificateIssuer() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::loadCertificateIssuer");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "loadCertificateIssuer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::X509::X509Name*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlEntry.GetCertificateIssuer
Org::BouncyCastle::Asn1::X509::X509Name* Org::BouncyCastle::X509::X509CrlEntry::GetCertificateIssuer() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::GetCertificateIssuer");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetCertificateIssuer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::X509::X509Name*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlEntry.GetX509Extensions
Org::BouncyCastle::Asn1::X509::X509Extensions* Org::BouncyCastle::X509::X509CrlEntry::GetX509Extensions() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::GetX509Extensions");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetX509Extensions", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::X509::X509Extensions*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlEntry.Equals
bool Org::BouncyCastle::X509::X509CrlEntry::Equals(::Il2CppObject* other) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::Equals");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(other)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, other);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlEntry.GetHashCode
int Org::BouncyCastle::X509::X509CrlEntry::GetHashCode() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::GetHashCode");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlEntry.ToString
::Il2CppString* Org::BouncyCastle::X509::X509CrlEntry::ToString() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlEntry::ToString");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.X509.X509CrlParser
#include "Org/BouncyCastle/X509/X509CrlParser.hpp"
// Including type: Org.BouncyCastle.Asn1.Asn1Set
#include "Org/BouncyCastle/Asn1/Asn1Set.hpp"
// Including type: System.IO.Stream
#include "System/IO/Stream.hpp"
// Including type: Org.BouncyCastle.X509.PemParser
#include "Org/BouncyCastle/X509/PemParser.hpp"
// Including type: Org.BouncyCastle.X509.X509Crl
#include "Org/BouncyCastle/X509/X509Crl.hpp"
// Including type: Org.BouncyCastle.Asn1.Asn1InputStream
#include "Org/BouncyCastle/Asn1/Asn1InputStream.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.CertificateList
#include "Org/BouncyCastle/Asn1/X509/CertificateList.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static private readonly Org.BouncyCastle.X509.PemParser PemCrlParser
Org::BouncyCastle::X509::PemParser* Org::BouncyCastle::X509::X509CrlParser::_get_PemCrlParser() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::_get_PemCrlParser");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<Org::BouncyCastle::X509::PemParser*>("Org.BouncyCastle.X509", "X509CrlParser", "PemCrlParser"));
}
// Autogenerated static field setter
// Set static field: static private readonly Org.BouncyCastle.X509.PemParser PemCrlParser
void Org::BouncyCastle::X509::X509CrlParser::_set_PemCrlParser(Org::BouncyCastle::X509::PemParser* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::_set_PemCrlParser");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.X509", "X509CrlParser", "PemCrlParser", value));
}
// Autogenerated instance field getter
// Get instance field: private readonly System.Boolean lazyAsn1
bool& Org::BouncyCastle::X509::X509CrlParser::dyn_lazyAsn1() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::dyn_lazyAsn1");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "lazyAsn1"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private Org.BouncyCastle.Asn1.Asn1Set sCrlData
Org::BouncyCastle::Asn1::Asn1Set*& Org::BouncyCastle::X509::X509CrlParser::dyn_sCrlData() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::dyn_sCrlData");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "sCrlData"))->offset;
return *reinterpret_cast<Org::BouncyCastle::Asn1::Asn1Set**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 sCrlDataObjectCount
int& Org::BouncyCastle::X509::X509CrlParser::dyn_sCrlDataObjectCount() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::dyn_sCrlDataObjectCount");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "sCrlDataObjectCount"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.IO.Stream currentCrlStream
System::IO::Stream*& Org::BouncyCastle::X509::X509CrlParser::dyn_currentCrlStream() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::dyn_currentCrlStream");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "currentCrlStream"))->offset;
return *reinterpret_cast<System::IO::Stream**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlParser..cctor
void Org::BouncyCastle::X509::X509CrlParser::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.X509", "X509CrlParser", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlParser.ReadPemCrl
Org::BouncyCastle::X509::X509Crl* Org::BouncyCastle::X509::X509CrlParser::ReadPemCrl(System::IO::Stream* inStream) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::ReadPemCrl");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadPemCrl", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inStream)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Crl*, false>(___instance_arg, ___internal__method, inStream);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlParser.ReadDerCrl
Org::BouncyCastle::X509::X509Crl* Org::BouncyCastle::X509::X509CrlParser::ReadDerCrl(Org::BouncyCastle::Asn1::Asn1InputStream* dIn) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::ReadDerCrl");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadDerCrl", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(dIn)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Crl*, false>(___instance_arg, ___internal__method, dIn);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlParser.GetCrl
Org::BouncyCastle::X509::X509Crl* Org::BouncyCastle::X509::X509CrlParser::GetCrl() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::GetCrl");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetCrl", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Crl*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlParser.CreateX509Crl
Org::BouncyCastle::X509::X509Crl* Org::BouncyCastle::X509::X509CrlParser::CreateX509Crl(Org::BouncyCastle::Asn1::X509::CertificateList* c) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::CreateX509Crl");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CreateX509Crl", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(c)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Crl*, false>(___instance_arg, ___internal__method, c);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlParser.ReadCrl
Org::BouncyCastle::X509::X509Crl* Org::BouncyCastle::X509::X509CrlParser::ReadCrl(::Array<uint8_t>* input) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::ReadCrl");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadCrl", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(input)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Crl*, false>(___instance_arg, ___internal__method, input);
}
// Autogenerated method: Org.BouncyCastle.X509.X509CrlParser.ReadCrl
Org::BouncyCastle::X509::X509Crl* Org::BouncyCastle::X509::X509CrlParser::ReadCrl(System::IO::Stream* inStream) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509CrlParser::ReadCrl");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReadCrl", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(inStream)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::X509::X509Crl*, false>(___instance_arg, ___internal__method, inStream);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.X509.X509SignatureUtilities
#include "Org/BouncyCastle/X509/X509SignatureUtilities.hpp"
// Including type: Org.BouncyCastle.Asn1.Asn1Null
#include "Org/BouncyCastle/Asn1/Asn1Null.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.AlgorithmIdentifier
#include "Org/BouncyCastle/Asn1/X509/AlgorithmIdentifier.hpp"
// Including type: Org.BouncyCastle.Asn1.DerObjectIdentifier
#include "Org/BouncyCastle/Asn1/DerObjectIdentifier.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static private readonly Org.BouncyCastle.Asn1.Asn1Null derNull
Org::BouncyCastle::Asn1::Asn1Null* Org::BouncyCastle::X509::X509SignatureUtilities::_get_derNull() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509SignatureUtilities::_get_derNull");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<Org::BouncyCastle::Asn1::Asn1Null*>("Org.BouncyCastle.X509", "X509SignatureUtilities", "derNull"));
}
// Autogenerated static field setter
// Set static field: static private readonly Org.BouncyCastle.Asn1.Asn1Null derNull
void Org::BouncyCastle::X509::X509SignatureUtilities::_set_derNull(Org::BouncyCastle::Asn1::Asn1Null* value) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509SignatureUtilities::_set_derNull");
THROW_UNLESS(il2cpp_utils::SetFieldValue("Org.BouncyCastle.X509", "X509SignatureUtilities", "derNull", value));
}
// Autogenerated method: Org.BouncyCastle.X509.X509SignatureUtilities..cctor
void Org::BouncyCastle::X509::X509SignatureUtilities::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509SignatureUtilities::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.X509", "X509SignatureUtilities", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509SignatureUtilities.GetSignatureName
::Il2CppString* Org::BouncyCastle::X509::X509SignatureUtilities::GetSignatureName(Org::BouncyCastle::Asn1::X509::AlgorithmIdentifier* sigAlgId) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509SignatureUtilities::GetSignatureName");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.X509", "X509SignatureUtilities", "GetSignatureName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(sigAlgId)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, sigAlgId);
}
// Autogenerated method: Org.BouncyCastle.X509.X509SignatureUtilities.GetDigestAlgName
::Il2CppString* Org::BouncyCastle::X509::X509SignatureUtilities::GetDigestAlgName(Org::BouncyCastle::Asn1::DerObjectIdentifier* digestAlgOID) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509SignatureUtilities::GetDigestAlgName");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.X509", "X509SignatureUtilities", "GetDigestAlgName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(digestAlgOID)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, digestAlgOID);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: Org.BouncyCastle.X509.X509V2AttributeCertificate
#include "Org/BouncyCastle/X509/X509V2AttributeCertificate.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.AttributeCertificate
#include "Org/BouncyCastle/Asn1/X509/AttributeCertificate.hpp"
// Including type: System.IO.Stream
#include "System/IO/Stream.hpp"
// Including type: Org.BouncyCastle.Asn1.X509.X509Extensions
#include "Org/BouncyCastle/Asn1/X509/X509Extensions.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private readonly Org.BouncyCastle.Asn1.X509.AttributeCertificate cert
Org::BouncyCastle::Asn1::X509::AttributeCertificate*& Org::BouncyCastle::X509::X509V2AttributeCertificate::dyn_cert() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509V2AttributeCertificate::dyn_cert");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "cert"))->offset;
return *reinterpret_cast<Org::BouncyCastle::Asn1::X509::AttributeCertificate**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.DateTime notBefore
System::DateTime& Org::BouncyCastle::X509::X509V2AttributeCertificate::dyn_notBefore() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509V2AttributeCertificate::dyn_notBefore");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "notBefore"))->offset;
return *reinterpret_cast<System::DateTime*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private readonly System.DateTime notAfter
System::DateTime& Org::BouncyCastle::X509::X509V2AttributeCertificate::dyn_notAfter() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509V2AttributeCertificate::dyn_notAfter");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "notAfter"))->offset;
return *reinterpret_cast<System::DateTime*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: Org.BouncyCastle.X509.X509V2AttributeCertificate.GetObject
Org::BouncyCastle::Asn1::X509::AttributeCertificate* Org::BouncyCastle::X509::X509V2AttributeCertificate::GetObject(System::IO::Stream* input) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509V2AttributeCertificate::GetObject");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("Org.BouncyCastle.X509", "X509V2AttributeCertificate", "GetObject", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(input)})));
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::X509::AttributeCertificate*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, input);
}
// Autogenerated method: Org.BouncyCastle.X509.X509V2AttributeCertificate.GetX509Extensions
Org::BouncyCastle::Asn1::X509::X509Extensions* Org::BouncyCastle::X509::X509V2AttributeCertificate::GetX509Extensions() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509V2AttributeCertificate::GetX509Extensions");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetX509Extensions", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<Org::BouncyCastle::Asn1::X509::X509Extensions*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: Org.BouncyCastle.X509.X509V2AttributeCertificate.Equals
bool Org::BouncyCastle::X509::X509V2AttributeCertificate::Equals(::Il2CppObject* obj) {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509V2AttributeCertificate::Equals");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Equals", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(obj)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, obj);
}
// Autogenerated method: Org.BouncyCastle.X509.X509V2AttributeCertificate.GetHashCode
int Org::BouncyCastle::X509::X509V2AttributeCertificate::GetHashCode() {
static auto ___internal__logger = ::Logger::get().WithContext("Org::BouncyCastle::X509::X509V2AttributeCertificate::GetHashCode");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetHashCode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<int, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: ColorSO
#include "GlobalNamespace/ColorSO.hpp"
// Including type: UnityEngine.Color
#include "UnityEngine/Color.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: ColorSO.get_color
UnityEngine::Color GlobalNamespace::ColorSO::get_color() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorSO::get_color");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_color", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: ColorScheme
#include "GlobalNamespace/ColorScheme.hpp"
// Including type: ColorSchemeSO
#include "GlobalNamespace/ColorSchemeSO.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private System.String _colorSchemeId
::Il2CppString*& GlobalNamespace::ColorScheme::dyn__colorSchemeId() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__colorSchemeId");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colorSchemeId"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _colorSchemeNameLocalizationKey
::Il2CppString*& GlobalNamespace::ColorScheme::dyn__colorSchemeNameLocalizationKey() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__colorSchemeNameLocalizationKey");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colorSchemeNameLocalizationKey"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _useNonLocalizedName
bool& GlobalNamespace::ColorScheme::dyn__useNonLocalizedName() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__useNonLocalizedName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_useNonLocalizedName"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String _nonLocalizedName
::Il2CppString*& GlobalNamespace::ColorScheme::dyn__nonLocalizedName() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__nonLocalizedName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_nonLocalizedName"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _isEditable
bool& GlobalNamespace::ColorScheme::dyn__isEditable() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__isEditable");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_isEditable"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _saberAColor
UnityEngine::Color& GlobalNamespace::ColorScheme::dyn__saberAColor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__saberAColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberAColor"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _saberBColor
UnityEngine::Color& GlobalNamespace::ColorScheme::dyn__saberBColor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__saberBColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_saberBColor"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _obstaclesColor
UnityEngine::Color& GlobalNamespace::ColorScheme::dyn__obstaclesColor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__obstaclesColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_obstaclesColor"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _environmentColor0
UnityEngine::Color& GlobalNamespace::ColorScheme::dyn__environmentColor0() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__environmentColor0");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_environmentColor0"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _environmentColor1
UnityEngine::Color& GlobalNamespace::ColorScheme::dyn__environmentColor1() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__environmentColor1");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_environmentColor1"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean _supportsEnvironmentColorBoost
bool& GlobalNamespace::ColorScheme::dyn__supportsEnvironmentColorBoost() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__supportsEnvironmentColorBoost");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_supportsEnvironmentColorBoost"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _environmentColor0Boost
UnityEngine::Color& GlobalNamespace::ColorScheme::dyn__environmentColor0Boost() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__environmentColor0Boost");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_environmentColor0Boost"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _environmentColor1Boost
UnityEngine::Color& GlobalNamespace::ColorScheme::dyn__environmentColor1Boost() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::dyn__environmentColor1Boost");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_environmentColor1Boost"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: ColorScheme.get_colorSchemeId
::Il2CppString* GlobalNamespace::ColorScheme::get_colorSchemeId() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_colorSchemeId");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_colorSchemeId", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_colorSchemeNameLocalizationKey
::Il2CppString* GlobalNamespace::ColorScheme::get_colorSchemeNameLocalizationKey() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_colorSchemeNameLocalizationKey");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_colorSchemeNameLocalizationKey", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_nonLocalizedName
::Il2CppString* GlobalNamespace::ColorScheme::get_nonLocalizedName() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_nonLocalizedName");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_nonLocalizedName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_useNonLocalizedName
bool GlobalNamespace::ColorScheme::get_useNonLocalizedName() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_useNonLocalizedName");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_useNonLocalizedName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_isEditable
bool GlobalNamespace::ColorScheme::get_isEditable() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_isEditable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isEditable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_saberAColor
UnityEngine::Color GlobalNamespace::ColorScheme::get_saberAColor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_saberAColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_saberAColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_saberBColor
UnityEngine::Color GlobalNamespace::ColorScheme::get_saberBColor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_saberBColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_saberBColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_environmentColor0
UnityEngine::Color GlobalNamespace::ColorScheme::get_environmentColor0() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_environmentColor0");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_environmentColor0", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_environmentColor1
UnityEngine::Color GlobalNamespace::ColorScheme::get_environmentColor1() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_environmentColor1");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_environmentColor1", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_supportsEnvironmentColorBoost
bool GlobalNamespace::ColorScheme::get_supportsEnvironmentColorBoost() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_supportsEnvironmentColorBoost");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_supportsEnvironmentColorBoost", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_environmentColor0Boost
UnityEngine::Color GlobalNamespace::ColorScheme::get_environmentColor0Boost() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_environmentColor0Boost");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_environmentColor0Boost", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_environmentColor1Boost
UnityEngine::Color GlobalNamespace::ColorScheme::get_environmentColor1Boost() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_environmentColor1Boost");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_environmentColor1Boost", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: ColorScheme.get_obstaclesColor
UnityEngine::Color GlobalNamespace::ColorScheme::get_obstaclesColor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorScheme::get_obstaclesColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_obstaclesColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: ColorSchemeSO
#include "GlobalNamespace/ColorSchemeSO.hpp"
// Including type: ColorScheme
#include "GlobalNamespace/ColorScheme.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private ColorScheme _colorScheme
GlobalNamespace::ColorScheme*& GlobalNamespace::ColorSchemeSO::dyn__colorScheme() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorSchemeSO::dyn__colorScheme");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colorScheme"))->offset;
return *reinterpret_cast<GlobalNamespace::ColorScheme**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: ColorSchemeSO.get_colorScheme
GlobalNamespace::ColorScheme* GlobalNamespace::ColorSchemeSO::get_colorScheme() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorSchemeSO::get_colorScheme");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_colorScheme", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<GlobalNamespace::ColorScheme*, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: ColorSchemesListSO
#include "GlobalNamespace/ColorSchemesListSO.hpp"
// Including type: ColorSchemeSO
#include "GlobalNamespace/ColorSchemeSO.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private ColorSchemeSO[] _colorSchemes
::Array<GlobalNamespace::ColorSchemeSO*>*& GlobalNamespace::ColorSchemesListSO::dyn__colorSchemes() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorSchemesListSO::dyn__colorSchemes");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_colorSchemes"))->offset;
return *reinterpret_cast<::Array<GlobalNamespace::ColorSchemeSO*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: ColorSchemesListSO.get_colorSchemes
::Array<GlobalNamespace::ColorSchemeSO*>* GlobalNamespace::ColorSchemesListSO::get_colorSchemes() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::ColorSchemesListSO::get_colorSchemes");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_colorSchemes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Array<GlobalNamespace::ColorSchemeSO*>*, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultipliedAndAddedColorSO
#include "GlobalNamespace/MultipliedAndAddedColorSO.hpp"
// Including type: SimpleColorSO
#include "GlobalNamespace/SimpleColorSO.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private SimpleColorSO _baseColor
GlobalNamespace::SimpleColorSO*& GlobalNamespace::MultipliedAndAddedColorSO::dyn__baseColor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::MultipliedAndAddedColorSO::dyn__baseColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_baseColor"))->offset;
return *reinterpret_cast<GlobalNamespace::SimpleColorSO**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _multiplierColor
UnityEngine::Color& GlobalNamespace::MultipliedAndAddedColorSO::dyn__multiplierColor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::MultipliedAndAddedColorSO::dyn__multiplierColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplierColor"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _addColor
UnityEngine::Color& GlobalNamespace::MultipliedAndAddedColorSO::dyn__addColor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::MultipliedAndAddedColorSO::dyn__addColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_addColor"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultipliedAndAddedColorSO.get_color
UnityEngine::Color GlobalNamespace::MultipliedAndAddedColorSO::get_color() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::MultipliedAndAddedColorSO::get_color");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_color", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: MultipliedColorSO
#include "GlobalNamespace/MultipliedColorSO.hpp"
// Including type: SimpleColorSO
#include "GlobalNamespace/SimpleColorSO.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private SimpleColorSO _baseColor
GlobalNamespace::SimpleColorSO*& GlobalNamespace::MultipliedColorSO::dyn__baseColor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::MultipliedColorSO::dyn__baseColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_baseColor"))->offset;
return *reinterpret_cast<GlobalNamespace::SimpleColorSO**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Color _multiplierColor
UnityEngine::Color& GlobalNamespace::MultipliedColorSO::dyn__multiplierColor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::MultipliedColorSO::dyn__multiplierColor");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_multiplierColor"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: MultipliedColorSO.get_color
UnityEngine::Color GlobalNamespace::MultipliedColorSO::get_color() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::MultipliedColorSO::get_color");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_color", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: SimpleColorSO
#include "GlobalNamespace/SimpleColorSO.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: protected UnityEngine.Color _color
UnityEngine::Color& GlobalNamespace::SimpleColorSO::dyn__color() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::SimpleColorSO::dyn__color");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_color"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: SimpleColorSO.SetColor
void GlobalNamespace::SimpleColorSO::SetColor(UnityEngine::Color c) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::SimpleColorSO::SetColor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetColor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(c)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, c);
}
// Autogenerated method: SimpleColorSO.get_color
UnityEngine::Color GlobalNamespace::SimpleColorSO::get_color() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::SimpleColorSO::get_color");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_color", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Color, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: LayerMasks
#include "GlobalNamespace/LayerMasks.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// [DoesNotRequireDomainReloadInitAttribute] Offset: 0xE187F8
// Autogenerated static field getter
// Get static field: static public readonly UnityEngine.LayerMask saberLayerMask
UnityEngine::LayerMask GlobalNamespace::LayerMasks::_get_saberLayerMask() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_get_saberLayerMask");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<UnityEngine::LayerMask>("", "LayerMasks", "saberLayerMask"));
}
// Autogenerated static field setter
// Set static field: static public readonly UnityEngine.LayerMask saberLayerMask
void GlobalNamespace::LayerMasks::_set_saberLayerMask(UnityEngine::LayerMask value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_set_saberLayerMask");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "LayerMasks", "saberLayerMask", value));
}
// [DoesNotRequireDomainReloadInitAttribute] Offset: 0xE18808
// Autogenerated static field getter
// Get static field: static public readonly UnityEngine.LayerMask noteLayerMask
UnityEngine::LayerMask GlobalNamespace::LayerMasks::_get_noteLayerMask() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_get_noteLayerMask");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<UnityEngine::LayerMask>("", "LayerMasks", "noteLayerMask"));
}
// Autogenerated static field setter
// Set static field: static public readonly UnityEngine.LayerMask noteLayerMask
void GlobalNamespace::LayerMasks::_set_noteLayerMask(UnityEngine::LayerMask value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_set_noteLayerMask");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "LayerMasks", "noteLayerMask", value));
}
// [DoesNotRequireDomainReloadInitAttribute] Offset: 0xE18818
// Autogenerated static field getter
// Get static field: static public readonly UnityEngine.LayerMask noteDebrisLayerMask
UnityEngine::LayerMask GlobalNamespace::LayerMasks::_get_noteDebrisLayerMask() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_get_noteDebrisLayerMask");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<UnityEngine::LayerMask>("", "LayerMasks", "noteDebrisLayerMask"));
}
// Autogenerated static field setter
// Set static field: static public readonly UnityEngine.LayerMask noteDebrisLayerMask
void GlobalNamespace::LayerMasks::_set_noteDebrisLayerMask(UnityEngine::LayerMask value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_set_noteDebrisLayerMask");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "LayerMasks", "noteDebrisLayerMask", value));
}
// [DoesNotRequireDomainReloadInitAttribute] Offset: 0xE18828
// Autogenerated static field getter
// Get static field: static public readonly UnityEngine.LayerMask cutEffectParticlesLayerMask
UnityEngine::LayerMask GlobalNamespace::LayerMasks::_get_cutEffectParticlesLayerMask() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_get_cutEffectParticlesLayerMask");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<UnityEngine::LayerMask>("", "LayerMasks", "cutEffectParticlesLayerMask"));
}
// Autogenerated static field setter
// Set static field: static public readonly UnityEngine.LayerMask cutEffectParticlesLayerMask
void GlobalNamespace::LayerMasks::_set_cutEffectParticlesLayerMask(UnityEngine::LayerMask value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_set_cutEffectParticlesLayerMask");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "LayerMasks", "cutEffectParticlesLayerMask", value));
}
// [DoesNotRequireDomainReloadInitAttribute] Offset: 0xE18838
// Autogenerated static field getter
// Get static field: static public readonly System.Int32 noteDebrisLayer
int GlobalNamespace::LayerMasks::_get_noteDebrisLayer() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_get_noteDebrisLayer");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("", "LayerMasks", "noteDebrisLayer"));
}
// Autogenerated static field setter
// Set static field: static public readonly System.Int32 noteDebrisLayer
void GlobalNamespace::LayerMasks::_set_noteDebrisLayer(int value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_set_noteDebrisLayer");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "LayerMasks", "noteDebrisLayer", value));
}
// [DoesNotRequireDomainReloadInitAttribute] Offset: 0xE18848
// Autogenerated static field getter
// Get static field: static public readonly System.Int32 cutEffectParticlesLayer
int GlobalNamespace::LayerMasks::_get_cutEffectParticlesLayer() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_get_cutEffectParticlesLayer");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<int>("", "LayerMasks", "cutEffectParticlesLayer"));
}
// Autogenerated static field setter
// Set static field: static public readonly System.Int32 cutEffectParticlesLayer
void GlobalNamespace::LayerMasks::_set_cutEffectParticlesLayer(int value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::_set_cutEffectParticlesLayer");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "LayerMasks", "cutEffectParticlesLayer", value));
}
// Autogenerated method: LayerMasks..cctor
void GlobalNamespace::LayerMasks::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "LayerMasks", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: LayerMasks.GetLayerMask
UnityEngine::LayerMask GlobalNamespace::LayerMasks::GetLayerMask(::Il2CppString* layerName) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::GetLayerMask");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "LayerMasks", "GetLayerMask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layerName)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::LayerMask, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, layerName);
}
// Autogenerated method: LayerMasks.GetLayerMask
UnityEngine::LayerMask GlobalNamespace::LayerMasks::GetLayerMask(int layerNum) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::GetLayerMask");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "LayerMasks", "GetLayerMask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layerNum)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::LayerMask, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, layerNum);
}
// Autogenerated method: LayerMasks.GetLayer
int GlobalNamespace::LayerMasks::GetLayer(::Il2CppString* layerName) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::LayerMasks::GetLayer");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "LayerMasks", "GetLayer", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layerName)})));
return ::il2cpp_utils::RunMethodThrow<int, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, layerName);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: DynamicBone
#include "GlobalNamespace/DynamicBone.hpp"
// Including type: UnityEngine.AnimationCurve
#include "UnityEngine/AnimationCurve.hpp"
// Including type: DynamicBone/Particle
#include "GlobalNamespace/DynamicBone_Particle.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: System.Collections.Generic.List`1
#include "System/Collections/Generic/List_1.hpp"
// Including type: DynamicBoneColliderBase
#include "GlobalNamespace/DynamicBoneColliderBase.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform m_Root
UnityEngine::Transform*& GlobalNamespace::DynamicBone::dyn_m_Root() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Root");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Root"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_UpdateRate
float& GlobalNamespace::DynamicBone::dyn_m_UpdateRate() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_UpdateRate");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_UpdateRate"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public DynamicBone/UpdateMode m_UpdateMode
GlobalNamespace::DynamicBone::UpdateMode& GlobalNamespace::DynamicBone::dyn_m_UpdateMode() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_UpdateMode");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_UpdateMode"))->offset;
return *reinterpret_cast<GlobalNamespace::DynamicBone::UpdateMode*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_Damping
float& GlobalNamespace::DynamicBone::dyn_m_Damping() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Damping");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Damping"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve m_DampingDistrib
UnityEngine::AnimationCurve*& GlobalNamespace::DynamicBone::dyn_m_DampingDistrib() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_DampingDistrib");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_DampingDistrib"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_Elasticity
float& GlobalNamespace::DynamicBone::dyn_m_Elasticity() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Elasticity");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Elasticity"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve m_ElasticityDistrib
UnityEngine::AnimationCurve*& GlobalNamespace::DynamicBone::dyn_m_ElasticityDistrib() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_ElasticityDistrib");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ElasticityDistrib"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_Stiffness
float& GlobalNamespace::DynamicBone::dyn_m_Stiffness() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Stiffness");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Stiffness"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve m_StiffnessDistrib
UnityEngine::AnimationCurve*& GlobalNamespace::DynamicBone::dyn_m_StiffnessDistrib() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_StiffnessDistrib");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_StiffnessDistrib"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_Inert
float& GlobalNamespace::DynamicBone::dyn_m_Inert() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Inert");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Inert"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve m_InertDistrib
UnityEngine::AnimationCurve*& GlobalNamespace::DynamicBone::dyn_m_InertDistrib() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_InertDistrib");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_InertDistrib"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_Radius
float& GlobalNamespace::DynamicBone::dyn_m_Radius() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Radius");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Radius"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve m_RadiusDistrib
UnityEngine::AnimationCurve*& GlobalNamespace::DynamicBone::dyn_m_RadiusDistrib() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_RadiusDistrib");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_RadiusDistrib"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_EndLength
float& GlobalNamespace::DynamicBone::dyn_m_EndLength() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_EndLength");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_EndLength"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 m_EndOffset
UnityEngine::Vector3& GlobalNamespace::DynamicBone::dyn_m_EndOffset() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_EndOffset");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_EndOffset"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 m_Gravity
UnityEngine::Vector3& GlobalNamespace::DynamicBone::dyn_m_Gravity() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Gravity");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Gravity"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 m_Force
UnityEngine::Vector3& GlobalNamespace::DynamicBone::dyn_m_Force() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Force");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Force"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Collections.Generic.List`1<DynamicBoneColliderBase> m_Colliders
System::Collections::Generic::List_1<GlobalNamespace::DynamicBoneColliderBase*>*& GlobalNamespace::DynamicBone::dyn_m_Colliders() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Colliders");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Colliders"))->offset;
return *reinterpret_cast<System::Collections::Generic::List_1<GlobalNamespace::DynamicBoneColliderBase*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Collections.Generic.List`1<UnityEngine.Transform> m_Exclusions
System::Collections::Generic::List_1<UnityEngine::Transform*>*& GlobalNamespace::DynamicBone::dyn_m_Exclusions() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Exclusions");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Exclusions"))->offset;
return *reinterpret_cast<System::Collections::Generic::List_1<UnityEngine::Transform*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public DynamicBone/FreezeAxis m_FreezeAxis
GlobalNamespace::DynamicBone::FreezeAxis& GlobalNamespace::DynamicBone::dyn_m_FreezeAxis() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_FreezeAxis");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_FreezeAxis"))->offset;
return *reinterpret_cast<GlobalNamespace::DynamicBone::FreezeAxis*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Boolean m_DistantDisable
bool& GlobalNamespace::DynamicBone::dyn_m_DistantDisable() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_DistantDisable");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_DistantDisable"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform m_ReferenceObject
UnityEngine::Transform*& GlobalNamespace::DynamicBone::dyn_m_ReferenceObject() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_ReferenceObject");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ReferenceObject"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_DistanceToObject
float& GlobalNamespace::DynamicBone::dyn_m_DistanceToObject() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_DistanceToObject");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_DistanceToObject"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 m_LocalGravity
UnityEngine::Vector3& GlobalNamespace::DynamicBone::dyn_m_LocalGravity() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_LocalGravity");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_LocalGravity"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 m_ObjectMove
UnityEngine::Vector3& GlobalNamespace::DynamicBone::dyn_m_ObjectMove() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_ObjectMove");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ObjectMove"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 m_ObjectPrevPosition
UnityEngine::Vector3& GlobalNamespace::DynamicBone::dyn_m_ObjectPrevPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_ObjectPrevPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ObjectPrevPosition"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single m_BoneTotalLength
float& GlobalNamespace::DynamicBone::dyn_m_BoneTotalLength() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_BoneTotalLength");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_BoneTotalLength"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single m_ObjectScale
float& GlobalNamespace::DynamicBone::dyn_m_ObjectScale() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_ObjectScale");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ObjectScale"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single m_Time
float& GlobalNamespace::DynamicBone::dyn_m_Time() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Time");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Time"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single m_Weight
float& GlobalNamespace::DynamicBone::dyn_m_Weight() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Weight");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Weight"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean m_DistantDisabled
bool& GlobalNamespace::DynamicBone::dyn_m_DistantDisabled() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_DistantDisabled");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_DistantDisabled"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Collections.Generic.List`1<DynamicBone/Particle> m_Particles
System::Collections::Generic::List_1<GlobalNamespace::DynamicBone::Particle*>*& GlobalNamespace::DynamicBone::dyn_m_Particles() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::dyn_m_Particles");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Particles"))->offset;
return *reinterpret_cast<System::Collections::Generic::List_1<GlobalNamespace::DynamicBone::Particle*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: DynamicBone.Start
void GlobalNamespace::DynamicBone::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.FixedUpdate
void GlobalNamespace::DynamicBone::FixedUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::FixedUpdate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "FixedUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.Update
void GlobalNamespace::DynamicBone::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.LateUpdate
void GlobalNamespace::DynamicBone::LateUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::LateUpdate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LateUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.PreUpdate
void GlobalNamespace::DynamicBone::PreUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::PreUpdate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "PreUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.CheckDistance
void GlobalNamespace::DynamicBone::CheckDistance() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::CheckDistance");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CheckDistance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.OnEnable
void GlobalNamespace::DynamicBone::OnEnable() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::OnEnable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnEnable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.OnDisable
void GlobalNamespace::DynamicBone::OnDisable() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::OnDisable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDisable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.OnValidate
void GlobalNamespace::DynamicBone::OnValidate() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::OnValidate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnValidate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.OnDrawGizmosSelected
void GlobalNamespace::DynamicBone::OnDrawGizmosSelected() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::OnDrawGizmosSelected");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDrawGizmosSelected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.SetWeight
void GlobalNamespace::DynamicBone::SetWeight(float w) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::SetWeight");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetWeight", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(w)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, w);
}
// Autogenerated method: DynamicBone.GetWeight
float GlobalNamespace::DynamicBone::GetWeight() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::GetWeight");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetWeight", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<float, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.UpdateDynamicBones
void GlobalNamespace::DynamicBone::UpdateDynamicBones(float t) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::UpdateDynamicBones");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateDynamicBones", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, t);
}
// Autogenerated method: DynamicBone.SetupParticles
void GlobalNamespace::DynamicBone::SetupParticles() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::SetupParticles");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetupParticles", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.AppendParticles
void GlobalNamespace::DynamicBone::AppendParticles(UnityEngine::Transform* b, int parentIndex, float boneLength) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::AppendParticles");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AppendParticles", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(parentIndex), ::il2cpp_utils::ExtractType(boneLength)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, b, parentIndex, boneLength);
}
// Autogenerated method: DynamicBone.UpdateParameters
void GlobalNamespace::DynamicBone::UpdateParameters() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::UpdateParameters");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateParameters", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.InitTransforms
void GlobalNamespace::DynamicBone::InitTransforms() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::InitTransforms");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InitTransforms", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.ResetParticlesPosition
void GlobalNamespace::DynamicBone::ResetParticlesPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::ResetParticlesPosition");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ResetParticlesPosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.UpdateParticles1
void GlobalNamespace::DynamicBone::UpdateParticles1() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::UpdateParticles1");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateParticles1", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.UpdateParticles2
void GlobalNamespace::DynamicBone::UpdateParticles2() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::UpdateParticles2");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateParticles2", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.SkipUpdateParticles
void GlobalNamespace::DynamicBone::SkipUpdateParticles() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::SkipUpdateParticles");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SkipUpdateParticles", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBone.MirrorVector
UnityEngine::Vector3 GlobalNamespace::DynamicBone::MirrorVector(UnityEngine::Vector3 v, UnityEngine::Vector3 axis) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::MirrorVector");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "DynamicBone", "MirrorVector", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(v), ::il2cpp_utils::ExtractType(axis)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, v, axis);
}
// Autogenerated method: DynamicBone.ApplyParticlesToTransforms
void GlobalNamespace::DynamicBone::ApplyParticlesToTransforms() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::ApplyParticlesToTransforms");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ApplyParticlesToTransforms", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: DynamicBone/UpdateMode
#include "GlobalNamespace/DynamicBone.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public DynamicBone/UpdateMode Normal
GlobalNamespace::DynamicBone::UpdateMode GlobalNamespace::DynamicBone::UpdateMode::_get_Normal() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::UpdateMode::_get_Normal");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBone::UpdateMode>("", "DynamicBone/UpdateMode", "Normal"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBone/UpdateMode Normal
void GlobalNamespace::DynamicBone::UpdateMode::_set_Normal(GlobalNamespace::DynamicBone::UpdateMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::UpdateMode::_set_Normal");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBone/UpdateMode", "Normal", value));
}
// Autogenerated static field getter
// Get static field: static public DynamicBone/UpdateMode AnimatePhysics
GlobalNamespace::DynamicBone::UpdateMode GlobalNamespace::DynamicBone::UpdateMode::_get_AnimatePhysics() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::UpdateMode::_get_AnimatePhysics");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBone::UpdateMode>("", "DynamicBone/UpdateMode", "AnimatePhysics"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBone/UpdateMode AnimatePhysics
void GlobalNamespace::DynamicBone::UpdateMode::_set_AnimatePhysics(GlobalNamespace::DynamicBone::UpdateMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::UpdateMode::_set_AnimatePhysics");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBone/UpdateMode", "AnimatePhysics", value));
}
// Autogenerated static field getter
// Get static field: static public DynamicBone/UpdateMode UnscaledTime
GlobalNamespace::DynamicBone::UpdateMode GlobalNamespace::DynamicBone::UpdateMode::_get_UnscaledTime() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::UpdateMode::_get_UnscaledTime");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBone::UpdateMode>("", "DynamicBone/UpdateMode", "UnscaledTime"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBone/UpdateMode UnscaledTime
void GlobalNamespace::DynamicBone::UpdateMode::_set_UnscaledTime(GlobalNamespace::DynamicBone::UpdateMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::UpdateMode::_set_UnscaledTime");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBone/UpdateMode", "UnscaledTime", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& GlobalNamespace::DynamicBone::UpdateMode::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::UpdateMode::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: DynamicBone/FreezeAxis
#include "GlobalNamespace/DynamicBone.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public DynamicBone/FreezeAxis None
GlobalNamespace::DynamicBone::FreezeAxis GlobalNamespace::DynamicBone::FreezeAxis::_get_None() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::FreezeAxis::_get_None");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBone::FreezeAxis>("", "DynamicBone/FreezeAxis", "None"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBone/FreezeAxis None
void GlobalNamespace::DynamicBone::FreezeAxis::_set_None(GlobalNamespace::DynamicBone::FreezeAxis value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::FreezeAxis::_set_None");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBone/FreezeAxis", "None", value));
}
// Autogenerated static field getter
// Get static field: static public DynamicBone/FreezeAxis X
GlobalNamespace::DynamicBone::FreezeAxis GlobalNamespace::DynamicBone::FreezeAxis::_get_X() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::FreezeAxis::_get_X");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBone::FreezeAxis>("", "DynamicBone/FreezeAxis", "X"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBone/FreezeAxis X
void GlobalNamespace::DynamicBone::FreezeAxis::_set_X(GlobalNamespace::DynamicBone::FreezeAxis value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::FreezeAxis::_set_X");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBone/FreezeAxis", "X", value));
}
// Autogenerated static field getter
// Get static field: static public DynamicBone/FreezeAxis Y
GlobalNamespace::DynamicBone::FreezeAxis GlobalNamespace::DynamicBone::FreezeAxis::_get_Y() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::FreezeAxis::_get_Y");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBone::FreezeAxis>("", "DynamicBone/FreezeAxis", "Y"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBone/FreezeAxis Y
void GlobalNamespace::DynamicBone::FreezeAxis::_set_Y(GlobalNamespace::DynamicBone::FreezeAxis value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::FreezeAxis::_set_Y");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBone/FreezeAxis", "Y", value));
}
// Autogenerated static field getter
// Get static field: static public DynamicBone/FreezeAxis Z
GlobalNamespace::DynamicBone::FreezeAxis GlobalNamespace::DynamicBone::FreezeAxis::_get_Z() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::FreezeAxis::_get_Z");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBone::FreezeAxis>("", "DynamicBone/FreezeAxis", "Z"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBone/FreezeAxis Z
void GlobalNamespace::DynamicBone::FreezeAxis::_set_Z(GlobalNamespace::DynamicBone::FreezeAxis value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::FreezeAxis::_set_Z");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBone/FreezeAxis", "Z", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& GlobalNamespace::DynamicBone::FreezeAxis::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::FreezeAxis::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: DynamicBone/Particle
#include "GlobalNamespace/DynamicBone_Particle.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform m_Transform
UnityEngine::Transform*& GlobalNamespace::DynamicBone::Particle::dyn_m_Transform() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_Transform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Transform"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 m_ParentIndex
int& GlobalNamespace::DynamicBone::Particle::dyn_m_ParentIndex() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_ParentIndex");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_ParentIndex"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_Damping
float& GlobalNamespace::DynamicBone::Particle::dyn_m_Damping() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_Damping");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Damping"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_Elasticity
float& GlobalNamespace::DynamicBone::Particle::dyn_m_Elasticity() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_Elasticity");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Elasticity"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_Stiffness
float& GlobalNamespace::DynamicBone::Particle::dyn_m_Stiffness() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_Stiffness");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Stiffness"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_Inert
float& GlobalNamespace::DynamicBone::Particle::dyn_m_Inert() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_Inert");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Inert"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_Radius
float& GlobalNamespace::DynamicBone::Particle::dyn_m_Radius() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_Radius");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Radius"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_BoneLength
float& GlobalNamespace::DynamicBone::Particle::dyn_m_BoneLength() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_BoneLength");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_BoneLength"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 m_Position
UnityEngine::Vector3& GlobalNamespace::DynamicBone::Particle::dyn_m_Position() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_Position");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Position"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 m_PrevPosition
UnityEngine::Vector3& GlobalNamespace::DynamicBone::Particle::dyn_m_PrevPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_PrevPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_PrevPosition"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 m_EndOffset
UnityEngine::Vector3& GlobalNamespace::DynamicBone::Particle::dyn_m_EndOffset() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_EndOffset");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_EndOffset"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 m_InitLocalPosition
UnityEngine::Vector3& GlobalNamespace::DynamicBone::Particle::dyn_m_InitLocalPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_InitLocalPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_InitLocalPosition"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Quaternion m_InitLocalRotation
UnityEngine::Quaternion& GlobalNamespace::DynamicBone::Particle::dyn_m_InitLocalRotation() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBone::Particle::dyn_m_InitLocalRotation");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_InitLocalRotation"))->offset;
return *reinterpret_cast<UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: DynamicBoneCollider
#include "GlobalNamespace/DynamicBoneCollider.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.Single m_Radius
float& GlobalNamespace::DynamicBoneCollider::dyn_m_Radius() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneCollider::dyn_m_Radius");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Radius"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single m_Height
float& GlobalNamespace::DynamicBoneCollider::dyn_m_Height() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneCollider::dyn_m_Height");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Height"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: DynamicBoneCollider.OnValidate
void GlobalNamespace::DynamicBoneCollider::OnValidate() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneCollider::OnValidate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnValidate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBoneCollider.OutsideSphere
void GlobalNamespace::DynamicBoneCollider::OutsideSphere(ByRef<UnityEngine::Vector3> particlePosition, float particleRadius, UnityEngine::Vector3 sphereCenter, float sphereRadius) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneCollider::OutsideSphere");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "DynamicBoneCollider", "OutsideSphere", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(particlePosition), ::il2cpp_utils::ExtractType(particleRadius), ::il2cpp_utils::ExtractType(sphereCenter), ::il2cpp_utils::ExtractType(sphereRadius)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, byref(particlePosition), particleRadius, sphereCenter, sphereRadius);
}
// Autogenerated method: DynamicBoneCollider.InsideSphere
void GlobalNamespace::DynamicBoneCollider::InsideSphere(ByRef<UnityEngine::Vector3> particlePosition, float particleRadius, UnityEngine::Vector3 sphereCenter, float sphereRadius) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneCollider::InsideSphere");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "DynamicBoneCollider", "InsideSphere", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(particlePosition), ::il2cpp_utils::ExtractType(particleRadius), ::il2cpp_utils::ExtractType(sphereCenter), ::il2cpp_utils::ExtractType(sphereRadius)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, byref(particlePosition), particleRadius, sphereCenter, sphereRadius);
}
// Autogenerated method: DynamicBoneCollider.OutsideCapsule
void GlobalNamespace::DynamicBoneCollider::OutsideCapsule(ByRef<UnityEngine::Vector3> particlePosition, float particleRadius, UnityEngine::Vector3 capsuleP0, UnityEngine::Vector3 capsuleP1, float capsuleRadius) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneCollider::OutsideCapsule");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "DynamicBoneCollider", "OutsideCapsule", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(particlePosition), ::il2cpp_utils::ExtractType(particleRadius), ::il2cpp_utils::ExtractType(capsuleP0), ::il2cpp_utils::ExtractType(capsuleP1), ::il2cpp_utils::ExtractType(capsuleRadius)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, byref(particlePosition), particleRadius, capsuleP0, capsuleP1, capsuleRadius);
}
// Autogenerated method: DynamicBoneCollider.InsideCapsule
void GlobalNamespace::DynamicBoneCollider::InsideCapsule(ByRef<UnityEngine::Vector3> particlePosition, float particleRadius, UnityEngine::Vector3 capsuleP0, UnityEngine::Vector3 capsuleP1, float capsuleRadius) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneCollider::InsideCapsule");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("", "DynamicBoneCollider", "InsideCapsule", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(particlePosition), ::il2cpp_utils::ExtractType(particleRadius), ::il2cpp_utils::ExtractType(capsuleP0), ::il2cpp_utils::ExtractType(capsuleP1), ::il2cpp_utils::ExtractType(capsuleRadius)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, byref(particlePosition), particleRadius, capsuleP0, capsuleP1, capsuleRadius);
}
// Autogenerated method: DynamicBoneCollider.OnDrawGizmosSelected
void GlobalNamespace::DynamicBoneCollider::OnDrawGizmosSelected() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneCollider::OnDrawGizmosSelected");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDrawGizmosSelected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBoneCollider.Collide
void GlobalNamespace::DynamicBoneCollider::Collide(ByRef<UnityEngine::Vector3> particlePosition, float particleRadius) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneCollider::Collide");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Collide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(particlePosition), ::il2cpp_utils::ExtractType(particleRadius)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, byref(particlePosition), particleRadius);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: DynamicBoneColliderBase
#include "GlobalNamespace/DynamicBoneColliderBase.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public DynamicBoneColliderBase/Direction m_Direction
GlobalNamespace::DynamicBoneColliderBase::Direction& GlobalNamespace::DynamicBoneColliderBase::dyn_m_Direction() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::dyn_m_Direction");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Direction"))->offset;
return *reinterpret_cast<GlobalNamespace::DynamicBoneColliderBase::Direction*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 m_Center
UnityEngine::Vector3& GlobalNamespace::DynamicBoneColliderBase::dyn_m_Center() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::dyn_m_Center");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Center"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public DynamicBoneColliderBase/Bound m_Bound
GlobalNamespace::DynamicBoneColliderBase::Bound& GlobalNamespace::DynamicBoneColliderBase::dyn_m_Bound() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::dyn_m_Bound");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "m_Bound"))->offset;
return *reinterpret_cast<GlobalNamespace::DynamicBoneColliderBase::Bound*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: DynamicBoneColliderBase.Collide
void GlobalNamespace::DynamicBoneColliderBase::Collide(ByRef<UnityEngine::Vector3> particlePosition, float particleRadius) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Collide");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Collide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(particlePosition), ::il2cpp_utils::ExtractType(particleRadius)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, byref(particlePosition), particleRadius);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: DynamicBoneColliderBase/Direction
#include "GlobalNamespace/DynamicBoneColliderBase.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public DynamicBoneColliderBase/Direction X
GlobalNamespace::DynamicBoneColliderBase::Direction GlobalNamespace::DynamicBoneColliderBase::Direction::_get_X() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Direction::_get_X");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBoneColliderBase::Direction>("", "DynamicBoneColliderBase/Direction", "X"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBoneColliderBase/Direction X
void GlobalNamespace::DynamicBoneColliderBase::Direction::_set_X(GlobalNamespace::DynamicBoneColliderBase::Direction value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Direction::_set_X");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBoneColliderBase/Direction", "X", value));
}
// Autogenerated static field getter
// Get static field: static public DynamicBoneColliderBase/Direction Y
GlobalNamespace::DynamicBoneColliderBase::Direction GlobalNamespace::DynamicBoneColliderBase::Direction::_get_Y() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Direction::_get_Y");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBoneColliderBase::Direction>("", "DynamicBoneColliderBase/Direction", "Y"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBoneColliderBase/Direction Y
void GlobalNamespace::DynamicBoneColliderBase::Direction::_set_Y(GlobalNamespace::DynamicBoneColliderBase::Direction value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Direction::_set_Y");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBoneColliderBase/Direction", "Y", value));
}
// Autogenerated static field getter
// Get static field: static public DynamicBoneColliderBase/Direction Z
GlobalNamespace::DynamicBoneColliderBase::Direction GlobalNamespace::DynamicBoneColliderBase::Direction::_get_Z() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Direction::_get_Z");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBoneColliderBase::Direction>("", "DynamicBoneColliderBase/Direction", "Z"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBoneColliderBase/Direction Z
void GlobalNamespace::DynamicBoneColliderBase::Direction::_set_Z(GlobalNamespace::DynamicBoneColliderBase::Direction value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Direction::_set_Z");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBoneColliderBase/Direction", "Z", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& GlobalNamespace::DynamicBoneColliderBase::Direction::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Direction::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: DynamicBoneColliderBase/Bound
#include "GlobalNamespace/DynamicBoneColliderBase.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public DynamicBoneColliderBase/Bound Outside
GlobalNamespace::DynamicBoneColliderBase::Bound GlobalNamespace::DynamicBoneColliderBase::Bound::_get_Outside() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Bound::_get_Outside");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBoneColliderBase::Bound>("", "DynamicBoneColliderBase/Bound", "Outside"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBoneColliderBase/Bound Outside
void GlobalNamespace::DynamicBoneColliderBase::Bound::_set_Outside(GlobalNamespace::DynamicBoneColliderBase::Bound value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Bound::_set_Outside");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBoneColliderBase/Bound", "Outside", value));
}
// Autogenerated static field getter
// Get static field: static public DynamicBoneColliderBase/Bound Inside
GlobalNamespace::DynamicBoneColliderBase::Bound GlobalNamespace::DynamicBoneColliderBase::Bound::_get_Inside() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Bound::_get_Inside");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<GlobalNamespace::DynamicBoneColliderBase::Bound>("", "DynamicBoneColliderBase/Bound", "Inside"));
}
// Autogenerated static field setter
// Set static field: static public DynamicBoneColliderBase/Bound Inside
void GlobalNamespace::DynamicBoneColliderBase::Bound::_set_Inside(GlobalNamespace::DynamicBoneColliderBase::Bound value) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Bound::_set_Inside");
THROW_UNLESS(il2cpp_utils::SetFieldValue("", "DynamicBoneColliderBase/Bound", "Inside", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& GlobalNamespace::DynamicBoneColliderBase::Bound::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBoneColliderBase::Bound::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: DynamicBonePlaneCollider
#include "GlobalNamespace/DynamicBonePlaneCollider.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: DynamicBonePlaneCollider.OnValidate
void GlobalNamespace::DynamicBonePlaneCollider::OnValidate() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBonePlaneCollider::OnValidate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnValidate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBonePlaneCollider.OnDrawGizmosSelected
void GlobalNamespace::DynamicBonePlaneCollider::OnDrawGizmosSelected() {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBonePlaneCollider::OnDrawGizmosSelected");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDrawGizmosSelected", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: DynamicBonePlaneCollider.Collide
void GlobalNamespace::DynamicBonePlaneCollider::Collide(ByRef<UnityEngine::Vector3> particlePosition, float particleRadius) {
static auto ___internal__logger = ::Logger::get().WithContext("GlobalNamespace::DynamicBonePlaneCollider::Collide");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Collide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(particlePosition), ::il2cpp_utils::ExtractType(particleRadius)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, byref(particlePosition), particleRadius);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.Baker
#include "RootMotion/Baker.hpp"
// Including type: UnityEngine.AnimationClip
#include "UnityEngine/AnimationClip.hpp"
// Including type: UnityEngine.Animator
#include "UnityEngine/Animator.hpp"
// Including type: UnityEngine.Playables.PlayableDirector
#include "UnityEngine/Playables/PlayableDirector.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.Int32 frameRate
int& RootMotion::Baker::dyn_frameRate() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_frameRate");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "frameRate"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single keyReductionError
float& RootMotion::Baker::dyn_keyReductionError() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_keyReductionError");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "keyReductionError"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.Baker/RootMotion.Mode mode
RootMotion::Baker::Mode& RootMotion::Baker::dyn_mode() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_mode");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "mode"))->offset;
return *reinterpret_cast<RootMotion::Baker::Mode*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationClip[] animationClips
::Array<UnityEngine::AnimationClip*>*& RootMotion::Baker::dyn_animationClips() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_animationClips");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "animationClips"))->offset;
return *reinterpret_cast<::Array<UnityEngine::AnimationClip*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.String[] animationStates
::Array<::Il2CppString*>*& RootMotion::Baker::dyn_animationStates() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_animationStates");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "animationStates"))->offset;
return *reinterpret_cast<::Array<::Il2CppString*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Boolean loop
bool& RootMotion::Baker::dyn_loop() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_loop");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "loop"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.String saveToFolder
::Il2CppString*& RootMotion::Baker::dyn_saveToFolder() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_saveToFolder");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "saveToFolder"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.String appendName
::Il2CppString*& RootMotion::Baker::dyn_appendName() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_appendName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "appendName"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.String saveName
::Il2CppString*& RootMotion::Baker::dyn_saveName() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_saveName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "saveName"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean <isBaking>k__BackingField
bool& RootMotion::Baker::dyn_$isBaking$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_$isBaking$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<isBaking>k__BackingField"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single <bakingProgress>k__BackingField
float& RootMotion::Baker::dyn_$bakingProgress$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_$bakingProgress$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<bakingProgress>k__BackingField"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Animator animator
UnityEngine::Animator*& RootMotion::Baker::dyn_animator() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_animator");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "animator"))->offset;
return *reinterpret_cast<UnityEngine::Animator**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Playables.PlayableDirector director
UnityEngine::Playables::PlayableDirector*& RootMotion::Baker::dyn_director() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_director");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "director"))->offset;
return *reinterpret_cast<UnityEngine::Playables::PlayableDirector**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single <clipLength>k__BackingField
float& RootMotion::Baker::dyn_$clipLength$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::dyn_$clipLength$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<clipLength>k__BackingField"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.Baker.get_isBaking
bool RootMotion::Baker::get_isBaking() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::get_isBaking");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isBaking", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Baker.set_isBaking
void RootMotion::Baker::set_isBaking(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::set_isBaking");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_isBaking", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, value);
}
// Autogenerated method: RootMotion.Baker.get_bakingProgress
float RootMotion::Baker::get_bakingProgress() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::get_bakingProgress");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_bakingProgress", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<float, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Baker.set_bakingProgress
void RootMotion::Baker::set_bakingProgress(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::set_bakingProgress");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_bakingProgress", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, value);
}
// Autogenerated method: RootMotion.Baker.get_clipLength
float RootMotion::Baker::get_clipLength() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::get_clipLength");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_clipLength", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<float, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Baker.set_clipLength
void RootMotion::Baker::set_clipLength(float value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::set_clipLength");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_clipLength", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, value);
}
// Autogenerated method: RootMotion.Baker.OpenUserManual
void RootMotion::Baker::OpenUserManual() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::OpenUserManual");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OpenUserManual", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Baker.OpenScriptReference
void RootMotion::Baker::OpenScriptReference() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::OpenScriptReference");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OpenScriptReference", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Baker.SupportGroup
void RootMotion::Baker::SupportGroup() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::SupportGroup");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SupportGroup", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Baker.ASThread
void RootMotion::Baker::ASThread() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::ASThread");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ASThread", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Baker.GetCharacterRoot
UnityEngine::Transform* RootMotion::Baker::GetCharacterRoot() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::GetCharacterRoot");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetCharacterRoot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Transform*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Baker.OnStartBaking
void RootMotion::Baker::OnStartBaking() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::OnStartBaking");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnStartBaking", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Baker.OnSetLoopFrame
void RootMotion::Baker::OnSetLoopFrame(float time) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::OnSetLoopFrame");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnSetLoopFrame", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time);
}
// Autogenerated method: RootMotion.Baker.OnSetCurves
void RootMotion::Baker::OnSetCurves(ByRef<UnityEngine::AnimationClip*> clip) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::OnSetCurves");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnSetCurves", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(clip)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, byref(clip));
}
// Autogenerated method: RootMotion.Baker.OnSetKeyframes
void RootMotion::Baker::OnSetKeyframes(float time, bool lastFrame) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::OnSetKeyframes");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnSetKeyframes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time), ::il2cpp_utils::ExtractType(lastFrame)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time, lastFrame);
}
// Autogenerated method: RootMotion.Baker.BakeClip
void RootMotion::Baker::BakeClip() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::BakeClip");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BakeClip", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Baker.StartBaking
void RootMotion::Baker::StartBaking() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::StartBaking");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "StartBaking", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Baker.StopBaking
void RootMotion::Baker::StopBaking() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::StopBaking");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "StopBaking", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.Baker/RootMotion.Mode
#include "RootMotion/Baker.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public RootMotion.Baker/RootMotion.Mode AnimationClips
RootMotion::Baker::Mode RootMotion::Baker::Mode::_get_AnimationClips() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::Mode::_get_AnimationClips");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::Baker::Mode>("RootMotion", "Baker/Mode", "AnimationClips"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.Baker/RootMotion.Mode AnimationClips
void RootMotion::Baker::Mode::_set_AnimationClips(RootMotion::Baker::Mode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::Mode::_set_AnimationClips");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "Baker/Mode", "AnimationClips", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.Baker/RootMotion.Mode AnimationStates
RootMotion::Baker::Mode RootMotion::Baker::Mode::_get_AnimationStates() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::Mode::_get_AnimationStates");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::Baker::Mode>("RootMotion", "Baker/Mode", "AnimationStates"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.Baker/RootMotion.Mode AnimationStates
void RootMotion::Baker::Mode::_set_AnimationStates(RootMotion::Baker::Mode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::Mode::_set_AnimationStates");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "Baker/Mode", "AnimationStates", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.Baker/RootMotion.Mode PlayableDirector
RootMotion::Baker::Mode RootMotion::Baker::Mode::_get_PlayableDirector() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::Mode::_get_PlayableDirector");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::Baker::Mode>("RootMotion", "Baker/Mode", "PlayableDirector"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.Baker/RootMotion.Mode PlayableDirector
void RootMotion::Baker::Mode::_set_PlayableDirector(RootMotion::Baker::Mode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::Mode::_set_PlayableDirector");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "Baker/Mode", "PlayableDirector", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.Baker/RootMotion.Mode Realtime
RootMotion::Baker::Mode RootMotion::Baker::Mode::_get_Realtime() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::Mode::_get_Realtime");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::Baker::Mode>("RootMotion", "Baker/Mode", "Realtime"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.Baker/RootMotion.Mode Realtime
void RootMotion::Baker::Mode::_set_Realtime(RootMotion::Baker::Mode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::Mode::_set_Realtime");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "Baker/Mode", "Realtime", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& RootMotion::Baker::Mode::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Baker::Mode::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.GenericBaker
#include "RootMotion/GenericBaker.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: RootMotion.BakerTransform
#include "RootMotion/BakerTransform.hpp"
// Including type: UnityEngine.AnimationClip
#include "UnityEngine/AnimationClip.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.Boolean markAsLegacy
bool& RootMotion::GenericBaker::dyn_markAsLegacy() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::dyn_markAsLegacy");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "markAsLegacy"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform root
UnityEngine::Transform*& RootMotion::GenericBaker::dyn_root() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::dyn_root");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "root"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform rootNode
UnityEngine::Transform*& RootMotion::GenericBaker::dyn_rootNode() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::dyn_rootNode");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rootNode"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform[] ignoreList
::Array<UnityEngine::Transform*>*& RootMotion::GenericBaker::dyn_ignoreList() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::dyn_ignoreList");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "ignoreList"))->offset;
return *reinterpret_cast<::Array<UnityEngine::Transform*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform[] bakePositionList
::Array<UnityEngine::Transform*>*& RootMotion::GenericBaker::dyn_bakePositionList() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::dyn_bakePositionList");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "bakePositionList"))->offset;
return *reinterpret_cast<::Array<UnityEngine::Transform*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private RootMotion.BakerTransform[] children
::Array<RootMotion::BakerTransform*>*& RootMotion::GenericBaker::dyn_children() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::dyn_children");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "children"))->offset;
return *reinterpret_cast<::Array<RootMotion::BakerTransform*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private RootMotion.BakerTransform rootChild
RootMotion::BakerTransform*& RootMotion::GenericBaker::dyn_rootChild() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::dyn_rootChild");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rootChild"))->offset;
return *reinterpret_cast<RootMotion::BakerTransform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 rootChildIndex
int& RootMotion::GenericBaker::dyn_rootChildIndex() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::dyn_rootChildIndex");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rootChildIndex"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.GenericBaker.Awake
void RootMotion::GenericBaker::Awake() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::Awake");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.GenericBaker.IsIgnored
bool RootMotion::GenericBaker::IsIgnored(UnityEngine::Transform* t) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::IsIgnored");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsIgnored", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, t);
}
// Autogenerated method: RootMotion.GenericBaker.BakePosition
bool RootMotion::GenericBaker::BakePosition(UnityEngine::Transform* t) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::BakePosition");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BakePosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, t);
}
// Autogenerated method: RootMotion.GenericBaker.GetCharacterRoot
UnityEngine::Transform* RootMotion::GenericBaker::GetCharacterRoot() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::GetCharacterRoot");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetCharacterRoot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Transform*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.GenericBaker.OnStartBaking
void RootMotion::GenericBaker::OnStartBaking() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::OnStartBaking");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnStartBaking", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.GenericBaker.OnSetLoopFrame
void RootMotion::GenericBaker::OnSetLoopFrame(float time) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::OnSetLoopFrame");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnSetLoopFrame", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time);
}
// Autogenerated method: RootMotion.GenericBaker.OnSetCurves
void RootMotion::GenericBaker::OnSetCurves(ByRef<UnityEngine::AnimationClip*> clip) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::OnSetCurves");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnSetCurves", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(clip)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, byref(clip));
}
// Autogenerated method: RootMotion.GenericBaker.OnSetKeyframes
void RootMotion::GenericBaker::OnSetKeyframes(float time, bool lastFrame) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::GenericBaker::OnSetKeyframes");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnSetKeyframes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time), ::il2cpp_utils::ExtractType(lastFrame)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time, lastFrame);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.TQ
#include "RootMotion/TQ.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 t
UnityEngine::Vector3& RootMotion::TQ::dyn_t() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::TQ::dyn_t");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "t"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Quaternion q
UnityEngine::Quaternion& RootMotion::TQ::dyn_q() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::TQ::dyn_q");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "q"))->offset;
return *reinterpret_cast<UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.AvatarUtility
#include "RootMotion/AvatarUtility.hpp"
// Including type: UnityEngine.Quaternion
#include "UnityEngine/Quaternion.hpp"
// Including type: UnityEngine.Avatar
#include "UnityEngine/Avatar.hpp"
// Including type: UnityEngine.AvatarIKGoal
#include "UnityEngine/AvatarIKGoal.hpp"
// Including type: RootMotion.TQ
#include "RootMotion/TQ.hpp"
// Including type: UnityEngine.HumanBodyBones
#include "UnityEngine/HumanBodyBones.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: RootMotion.AvatarUtility.GetPostRotation
UnityEngine::Quaternion RootMotion::AvatarUtility::GetPostRotation(UnityEngine::Avatar* avatar, UnityEngine::AvatarIKGoal avatarIKGoal) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::AvatarUtility::GetPostRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "AvatarUtility", "GetPostRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(avatar), ::il2cpp_utils::ExtractType(avatarIKGoal)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, avatar, avatarIKGoal);
}
// Autogenerated method: RootMotion.AvatarUtility.GetIKGoalTQ
RootMotion::TQ* RootMotion::AvatarUtility::GetIKGoalTQ(UnityEngine::Avatar* avatar, float humanScale, UnityEngine::AvatarIKGoal avatarIKGoal, RootMotion::TQ* bodyPositionRotation, RootMotion::TQ* boneTQ) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::AvatarUtility::GetIKGoalTQ");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "AvatarUtility", "GetIKGoalTQ", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(avatar), ::il2cpp_utils::ExtractType(humanScale), ::il2cpp_utils::ExtractType(avatarIKGoal), ::il2cpp_utils::ExtractType(bodyPositionRotation), ::il2cpp_utils::ExtractType(boneTQ)})));
return ::il2cpp_utils::RunMethodThrow<RootMotion::TQ*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, avatar, humanScale, avatarIKGoal, bodyPositionRotation, boneTQ);
}
// Autogenerated method: RootMotion.AvatarUtility.HumanIDFromAvatarIKGoal
UnityEngine::HumanBodyBones RootMotion::AvatarUtility::HumanIDFromAvatarIKGoal(UnityEngine::AvatarIKGoal avatarIKGoal) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::AvatarUtility::HumanIDFromAvatarIKGoal");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "AvatarUtility", "HumanIDFromAvatarIKGoal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(avatarIKGoal)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::HumanBodyBones, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, avatarIKGoal);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.BakerUtilities
#include "RootMotion/BakerUtilities.hpp"
// Including type: UnityEngine.AnimationCurve
#include "UnityEngine/AnimationCurve.hpp"
// Including type: UnityEngine.Quaternion
#include "UnityEngine/Quaternion.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: RootMotion.BakerUtilities.ReduceKeyframes
void RootMotion::BakerUtilities::ReduceKeyframes(UnityEngine::AnimationCurve* curve, float maxError) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerUtilities::ReduceKeyframes");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BakerUtilities", "ReduceKeyframes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(curve), ::il2cpp_utils::ExtractType(maxError)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, curve, maxError);
}
// Autogenerated method: RootMotion.BakerUtilities.GetReducedKeyframes
::Array<UnityEngine::Keyframe>* RootMotion::BakerUtilities::GetReducedKeyframes(UnityEngine::AnimationCurve* curve, float maxError) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerUtilities::GetReducedKeyframes");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BakerUtilities", "GetReducedKeyframes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(curve), ::il2cpp_utils::ExtractType(maxError)})));
return ::il2cpp_utils::RunMethodThrow<::Array<UnityEngine::Keyframe>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, curve, maxError);
}
// Autogenerated method: RootMotion.BakerUtilities.SetLoopFrame
void RootMotion::BakerUtilities::SetLoopFrame(float time, UnityEngine::AnimationCurve* curve) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerUtilities::SetLoopFrame");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BakerUtilities", "SetLoopFrame", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time), ::il2cpp_utils::ExtractType(curve)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, time, curve);
}
// Autogenerated method: RootMotion.BakerUtilities.SetTangentMode
void RootMotion::BakerUtilities::SetTangentMode(UnityEngine::AnimationCurve* curve) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerUtilities::SetTangentMode");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BakerUtilities", "SetTangentMode", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(curve)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, curve);
}
// Autogenerated method: RootMotion.BakerUtilities.EnsureQuaternionContinuity
UnityEngine::Quaternion RootMotion::BakerUtilities::EnsureQuaternionContinuity(UnityEngine::Quaternion lastQ, UnityEngine::Quaternion q) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerUtilities::EnsureQuaternionContinuity");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BakerUtilities", "EnsureQuaternionContinuity", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(lastQ), ::il2cpp_utils::ExtractType(q)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, lastQ, q);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.BakerHumanoidQT
#include "RootMotion/BakerHumanoidQT.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: UnityEngine.AnimationCurve
#include "UnityEngine/AnimationCurve.hpp"
// Including type: UnityEngine.Avatar
#include "UnityEngine/Avatar.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
// Including type: UnityEngine.AnimationClip
#include "UnityEngine/AnimationClip.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform transform
UnityEngine::Transform*& RootMotion::BakerHumanoidQT::dyn_transform() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_transform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "transform"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String Qx
::Il2CppString*& RootMotion::BakerHumanoidQT::dyn_Qx() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_Qx");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "Qx"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String Qy
::Il2CppString*& RootMotion::BakerHumanoidQT::dyn_Qy() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_Qy");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "Qy"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String Qz
::Il2CppString*& RootMotion::BakerHumanoidQT::dyn_Qz() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_Qz");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "Qz"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String Qw
::Il2CppString*& RootMotion::BakerHumanoidQT::dyn_Qw() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_Qw");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "Qw"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String Tx
::Il2CppString*& RootMotion::BakerHumanoidQT::dyn_Tx() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_Tx");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "Tx"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String Ty
::Il2CppString*& RootMotion::BakerHumanoidQT::dyn_Ty() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_Ty");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "Ty"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String Tz
::Il2CppString*& RootMotion::BakerHumanoidQT::dyn_Tz() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_Tz");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "Tz"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve rotX
UnityEngine::AnimationCurve*& RootMotion::BakerHumanoidQT::dyn_rotX() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_rotX");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rotX"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve rotY
UnityEngine::AnimationCurve*& RootMotion::BakerHumanoidQT::dyn_rotY() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_rotY");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rotY"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve rotZ
UnityEngine::AnimationCurve*& RootMotion::BakerHumanoidQT::dyn_rotZ() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_rotZ");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rotZ"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve rotW
UnityEngine::AnimationCurve*& RootMotion::BakerHumanoidQT::dyn_rotW() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_rotW");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rotW"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve posX
UnityEngine::AnimationCurve*& RootMotion::BakerHumanoidQT::dyn_posX() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_posX");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "posX"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve posY
UnityEngine::AnimationCurve*& RootMotion::BakerHumanoidQT::dyn_posY() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_posY");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "posY"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve posZ
UnityEngine::AnimationCurve*& RootMotion::BakerHumanoidQT::dyn_posZ() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_posZ");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "posZ"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.AvatarIKGoal goal
UnityEngine::AvatarIKGoal& RootMotion::BakerHumanoidQT::dyn_goal() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_goal");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "goal"))->offset;
return *reinterpret_cast<UnityEngine::AvatarIKGoal*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion lastQ
UnityEngine::Quaternion& RootMotion::BakerHumanoidQT::dyn_lastQ() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_lastQ");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "lastQ"))->offset;
return *reinterpret_cast<UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean lastQSet
bool& RootMotion::BakerHumanoidQT::dyn_lastQSet() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::dyn_lastQSet");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "lastQSet"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.BakerHumanoidQT.Reset
void RootMotion::BakerHumanoidQT::Reset() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::Reset");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.BakerHumanoidQT.SetIKKeyframes
void RootMotion::BakerHumanoidQT::SetIKKeyframes(float time, UnityEngine::Avatar* avatar, float humanScale, UnityEngine::Vector3 bodyPosition, UnityEngine::Quaternion bodyRotation) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::SetIKKeyframes");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetIKKeyframes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time), ::il2cpp_utils::ExtractType(avatar), ::il2cpp_utils::ExtractType(humanScale), ::il2cpp_utils::ExtractType(bodyPosition), ::il2cpp_utils::ExtractType(bodyRotation)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time, avatar, humanScale, bodyPosition, bodyRotation);
}
// Autogenerated method: RootMotion.BakerHumanoidQT.SetKeyframes
void RootMotion::BakerHumanoidQT::SetKeyframes(float time, UnityEngine::Vector3 pos, UnityEngine::Quaternion rot) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::SetKeyframes");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetKeyframes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time), ::il2cpp_utils::ExtractType(pos), ::il2cpp_utils::ExtractType(rot)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time, pos, rot);
}
// Autogenerated method: RootMotion.BakerHumanoidQT.MoveLastKeyframes
void RootMotion::BakerHumanoidQT::MoveLastKeyframes(float time) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::MoveLastKeyframes");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveLastKeyframes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time);
}
// Autogenerated method: RootMotion.BakerHumanoidQT.SetLoopFrame
void RootMotion::BakerHumanoidQT::SetLoopFrame(float time) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::SetLoopFrame");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetLoopFrame", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time);
}
// Autogenerated method: RootMotion.BakerHumanoidQT.MoveLastKeyframe
void RootMotion::BakerHumanoidQT::MoveLastKeyframe(float time, UnityEngine::AnimationCurve* curve) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::MoveLastKeyframe");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MoveLastKeyframe", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time), ::il2cpp_utils::ExtractType(curve)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time, curve);
}
// Autogenerated method: RootMotion.BakerHumanoidQT.MultiplyLength
void RootMotion::BakerHumanoidQT::MultiplyLength(UnityEngine::AnimationCurve* curve, float mlp) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::MultiplyLength");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MultiplyLength", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(curve), ::il2cpp_utils::ExtractType(mlp)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, curve, mlp);
}
// Autogenerated method: RootMotion.BakerHumanoidQT.SetCurves
void RootMotion::BakerHumanoidQT::SetCurves(ByRef<UnityEngine::AnimationClip*> clip, float maxError, float lengthMlp) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerHumanoidQT::SetCurves");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetCurves", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(clip), ::il2cpp_utils::ExtractType(maxError), ::il2cpp_utils::ExtractType(lengthMlp)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, byref(clip), maxError, lengthMlp);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.BakerMuscle
#include "RootMotion/BakerMuscle.hpp"
// Including type: UnityEngine.AnimationCurve
#include "UnityEngine/AnimationCurve.hpp"
// Including type: UnityEngine.AnimationClip
#include "UnityEngine/AnimationClip.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve curve
UnityEngine::AnimationCurve*& RootMotion::BakerMuscle::dyn_curve() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerMuscle::dyn_curve");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "curve"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 muscleIndex
int& RootMotion::BakerMuscle::dyn_muscleIndex() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerMuscle::dyn_muscleIndex");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "muscleIndex"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String propertyName
::Il2CppString*& RootMotion::BakerMuscle::dyn_propertyName() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerMuscle::dyn_propertyName");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "propertyName"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.BakerMuscle.MuscleNameToPropertyName
::Il2CppString* RootMotion::BakerMuscle::MuscleNameToPropertyName(::Il2CppString* n) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerMuscle::MuscleNameToPropertyName");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MuscleNameToPropertyName", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(n)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(___instance_arg, ___internal__method, n);
}
// Autogenerated method: RootMotion.BakerMuscle.MultiplyLength
void RootMotion::BakerMuscle::MultiplyLength(UnityEngine::AnimationCurve* curve, float mlp) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerMuscle::MultiplyLength");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "MultiplyLength", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(curve), ::il2cpp_utils::ExtractType(mlp)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, curve, mlp);
}
// Autogenerated method: RootMotion.BakerMuscle.SetCurves
void RootMotion::BakerMuscle::SetCurves(ByRef<UnityEngine::AnimationClip*> clip, float maxError, float lengthMlp) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerMuscle::SetCurves");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetCurves", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(clip), ::il2cpp_utils::ExtractType(maxError), ::il2cpp_utils::ExtractType(lengthMlp)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, byref(clip), maxError, lengthMlp);
}
// Autogenerated method: RootMotion.BakerMuscle.Reset
void RootMotion::BakerMuscle::Reset() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerMuscle::Reset");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.BakerMuscle.SetKeyframe
void RootMotion::BakerMuscle::SetKeyframe(float time, ::Array<float>* muscles) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerMuscle::SetKeyframe");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetKeyframe", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time), ::il2cpp_utils::ExtractType(muscles)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time, muscles);
}
// Autogenerated method: RootMotion.BakerMuscle.SetLoopFrame
void RootMotion::BakerMuscle::SetLoopFrame(float time) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerMuscle::SetLoopFrame");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetLoopFrame", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.BakerTransform
#include "RootMotion/BakerTransform.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: UnityEngine.AnimationCurve
#include "UnityEngine/AnimationCurve.hpp"
// Including type: UnityEngine.AnimationClip
#include "UnityEngine/AnimationClip.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform transform
UnityEngine::Transform*& RootMotion::BakerTransform::dyn_transform() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_transform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "transform"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve posX
UnityEngine::AnimationCurve*& RootMotion::BakerTransform::dyn_posX() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_posX");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "posX"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve posY
UnityEngine::AnimationCurve*& RootMotion::BakerTransform::dyn_posY() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_posY");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "posY"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve posZ
UnityEngine::AnimationCurve*& RootMotion::BakerTransform::dyn_posZ() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_posZ");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "posZ"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve rotX
UnityEngine::AnimationCurve*& RootMotion::BakerTransform::dyn_rotX() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_rotX");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rotX"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve rotY
UnityEngine::AnimationCurve*& RootMotion::BakerTransform::dyn_rotY() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_rotY");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rotY"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve rotZ
UnityEngine::AnimationCurve*& RootMotion::BakerTransform::dyn_rotZ() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_rotZ");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rotZ"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.AnimationCurve rotW
UnityEngine::AnimationCurve*& RootMotion::BakerTransform::dyn_rotW() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_rotW");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rotW"))->offset;
return *reinterpret_cast<UnityEngine::AnimationCurve**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.String relativePath
::Il2CppString*& RootMotion::BakerTransform::dyn_relativePath() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_relativePath");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "relativePath"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean recordPosition
bool& RootMotion::BakerTransform::dyn_recordPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_recordPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "recordPosition"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 relativePosition
UnityEngine::Vector3& RootMotion::BakerTransform::dyn_relativePosition() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_relativePosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "relativePosition"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean isRootNode
bool& RootMotion::BakerTransform::dyn_isRootNode() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_isRootNode");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "isRootNode"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion relativeRotation
UnityEngine::Quaternion& RootMotion::BakerTransform::dyn_relativeRotation() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::dyn_relativeRotation");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "relativeRotation"))->offset;
return *reinterpret_cast<UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.BakerTransform.SetRelativeSpace
void RootMotion::BakerTransform::SetRelativeSpace(UnityEngine::Vector3 position, UnityEngine::Quaternion rotation) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::SetRelativeSpace");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetRelativeSpace", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(position), ::il2cpp_utils::ExtractType(rotation)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, position, rotation);
}
// Autogenerated method: RootMotion.BakerTransform.SetCurves
void RootMotion::BakerTransform::SetCurves(ByRef<UnityEngine::AnimationClip*> clip) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::SetCurves");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetCurves", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(clip)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, byref(clip));
}
// Autogenerated method: RootMotion.BakerTransform.AddRootMotionCurves
void RootMotion::BakerTransform::AddRootMotionCurves(ByRef<UnityEngine::AnimationClip*> clip) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::AddRootMotionCurves");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddRootMotionCurves", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(clip)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, byref(clip));
}
// Autogenerated method: RootMotion.BakerTransform.Reset
void RootMotion::BakerTransform::Reset() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::Reset");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Reset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.BakerTransform.ReduceKeyframes
void RootMotion::BakerTransform::ReduceKeyframes(float maxError) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::ReduceKeyframes");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ReduceKeyframes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(maxError)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, maxError);
}
// Autogenerated method: RootMotion.BakerTransform.SetKeyframes
void RootMotion::BakerTransform::SetKeyframes(float time) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::SetKeyframes");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetKeyframes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time);
}
// Autogenerated method: RootMotion.BakerTransform.AddLoopFrame
void RootMotion::BakerTransform::AddLoopFrame(float time) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BakerTransform::AddLoopFrame");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AddLoopFrame", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.HumanoidBaker
#include "RootMotion/HumanoidBaker.hpp"
// Including type: RootMotion.BakerMuscle
#include "RootMotion/BakerMuscle.hpp"
// Including type: RootMotion.BakerHumanoidQT
#include "RootMotion/BakerHumanoidQT.hpp"
// Including type: UnityEngine.HumanPoseHandler
#include "UnityEngine/HumanPoseHandler.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: UnityEngine.AnimationClip
#include "UnityEngine/AnimationClip.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.Boolean bakeHandIK
bool& RootMotion::HumanoidBaker::dyn_bakeHandIK() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_bakeHandIK");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "bakeHandIK"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single IKKeyReductionError
float& RootMotion::HumanoidBaker::dyn_IKKeyReductionError() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_IKKeyReductionError");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "IKKeyReductionError"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 muscleFrameRateDiv
int& RootMotion::HumanoidBaker::dyn_muscleFrameRateDiv() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_muscleFrameRateDiv");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "muscleFrameRateDiv"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private RootMotion.BakerMuscle[] bakerMuscles
::Array<RootMotion::BakerMuscle*>*& RootMotion::HumanoidBaker::dyn_bakerMuscles() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_bakerMuscles");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "bakerMuscles"))->offset;
return *reinterpret_cast<::Array<RootMotion::BakerMuscle*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private RootMotion.BakerHumanoidQT rootQT
RootMotion::BakerHumanoidQT*& RootMotion::HumanoidBaker::dyn_rootQT() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_rootQT");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rootQT"))->offset;
return *reinterpret_cast<RootMotion::BakerHumanoidQT**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private RootMotion.BakerHumanoidQT leftFootQT
RootMotion::BakerHumanoidQT*& RootMotion::HumanoidBaker::dyn_leftFootQT() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_leftFootQT");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftFootQT"))->offset;
return *reinterpret_cast<RootMotion::BakerHumanoidQT**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private RootMotion.BakerHumanoidQT rightFootQT
RootMotion::BakerHumanoidQT*& RootMotion::HumanoidBaker::dyn_rightFootQT() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_rightFootQT");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightFootQT"))->offset;
return *reinterpret_cast<RootMotion::BakerHumanoidQT**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private RootMotion.BakerHumanoidQT leftHandQT
RootMotion::BakerHumanoidQT*& RootMotion::HumanoidBaker::dyn_leftHandQT() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_leftHandQT");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftHandQT"))->offset;
return *reinterpret_cast<RootMotion::BakerHumanoidQT**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private RootMotion.BakerHumanoidQT rightHandQT
RootMotion::BakerHumanoidQT*& RootMotion::HumanoidBaker::dyn_rightHandQT() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_rightHandQT");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightHandQT"))->offset;
return *reinterpret_cast<RootMotion::BakerHumanoidQT**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single[] muscles
::Array<float>*& RootMotion::HumanoidBaker::dyn_muscles() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_muscles");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "muscles"))->offset;
return *reinterpret_cast<::Array<float>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.HumanPose pose
UnityEngine::HumanPose& RootMotion::HumanoidBaker::dyn_pose() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_pose");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "pose"))->offset;
return *reinterpret_cast<UnityEngine::HumanPose*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.HumanPoseHandler handler
UnityEngine::HumanPoseHandler*& RootMotion::HumanoidBaker::dyn_handler() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_handler");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "handler"))->offset;
return *reinterpret_cast<UnityEngine::HumanPoseHandler**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 bodyPosition
UnityEngine::Vector3& RootMotion::HumanoidBaker::dyn_bodyPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_bodyPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "bodyPosition"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion bodyRotation
UnityEngine::Quaternion& RootMotion::HumanoidBaker::dyn_bodyRotation() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_bodyRotation");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "bodyRotation"))->offset;
return *reinterpret_cast<UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 mN
int& RootMotion::HumanoidBaker::dyn_mN() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_mN");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "mN"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Quaternion lastBodyRotation
UnityEngine::Quaternion& RootMotion::HumanoidBaker::dyn_lastBodyRotation() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::dyn_lastBodyRotation");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "lastBodyRotation"))->offset;
return *reinterpret_cast<UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.HumanoidBaker.Awake
void RootMotion::HumanoidBaker::Awake() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::Awake");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Awake", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.HumanoidBaker.UpdateHumanPose
void RootMotion::HumanoidBaker::UpdateHumanPose() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::UpdateHumanPose");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateHumanPose", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.HumanoidBaker.GetCharacterRoot
UnityEngine::Transform* RootMotion::HumanoidBaker::GetCharacterRoot() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::GetCharacterRoot");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetCharacterRoot", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Transform*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.HumanoidBaker.OnStartBaking
void RootMotion::HumanoidBaker::OnStartBaking() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::OnStartBaking");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnStartBaking", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.HumanoidBaker.OnSetLoopFrame
void RootMotion::HumanoidBaker::OnSetLoopFrame(float time) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::OnSetLoopFrame");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnSetLoopFrame", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time);
}
// Autogenerated method: RootMotion.HumanoidBaker.OnSetCurves
void RootMotion::HumanoidBaker::OnSetCurves(ByRef<UnityEngine::AnimationClip*> clip) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::OnSetCurves");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnSetCurves", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(clip)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, byref(clip));
}
// Autogenerated method: RootMotion.HumanoidBaker.OnSetKeyframes
void RootMotion::HumanoidBaker::OnSetKeyframes(float time, bool lastFrame) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::HumanoidBaker::OnSetKeyframes");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnSetKeyframes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(time), ::il2cpp_utils::ExtractType(lastFrame)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, time, lastFrame);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.Axis
#include "RootMotion/Axis.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public RootMotion.Axis X
RootMotion::Axis RootMotion::Axis::_get_X() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Axis::_get_X");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::Axis>("RootMotion", "Axis", "X"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.Axis X
void RootMotion::Axis::_set_X(RootMotion::Axis value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Axis::_set_X");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "Axis", "X", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.Axis Y
RootMotion::Axis RootMotion::Axis::_get_Y() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Axis::_get_Y");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::Axis>("RootMotion", "Axis", "Y"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.Axis Y
void RootMotion::Axis::_set_Y(RootMotion::Axis value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Axis::_set_Y");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "Axis", "Y", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.Axis Z
RootMotion::Axis RootMotion::Axis::_get_Z() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Axis::_get_Z");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::Axis>("RootMotion", "Axis", "Z"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.Axis Z
void RootMotion::Axis::_set_Z(RootMotion::Axis value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Axis::_set_Z");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "Axis", "Z", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& RootMotion::Axis::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Axis::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.AxisTools
#include "RootMotion/AxisTools.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
// Including type: RootMotion.Axis
#include "RootMotion/Axis.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: UnityEngine.Quaternion
#include "UnityEngine/Quaternion.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: RootMotion.AxisTools.ToVector3
UnityEngine::Vector3 RootMotion::AxisTools::ToVector3(RootMotion::Axis axis) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::AxisTools::ToVector3");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "AxisTools", "ToVector3", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(axis)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, axis);
}
// Autogenerated method: RootMotion.AxisTools.ToAxis
RootMotion::Axis RootMotion::AxisTools::ToAxis(UnityEngine::Vector3 v) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::AxisTools::ToAxis");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "AxisTools", "ToAxis", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(v)})));
return ::il2cpp_utils::RunMethodThrow<RootMotion::Axis, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, v);
}
// Autogenerated method: RootMotion.AxisTools.GetAxisToPoint
RootMotion::Axis RootMotion::AxisTools::GetAxisToPoint(UnityEngine::Transform* t, UnityEngine::Vector3 worldPosition) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::AxisTools::GetAxisToPoint");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "AxisTools", "GetAxisToPoint", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(worldPosition)})));
return ::il2cpp_utils::RunMethodThrow<RootMotion::Axis, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, worldPosition);
}
// Autogenerated method: RootMotion.AxisTools.GetAxisToDirection
RootMotion::Axis RootMotion::AxisTools::GetAxisToDirection(UnityEngine::Transform* t, UnityEngine::Vector3 direction) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::AxisTools::GetAxisToDirection");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "AxisTools", "GetAxisToDirection", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(direction)})));
return ::il2cpp_utils::RunMethodThrow<RootMotion::Axis, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, direction);
}
// Autogenerated method: RootMotion.AxisTools.GetAxisVectorToPoint
UnityEngine::Vector3 RootMotion::AxisTools::GetAxisVectorToPoint(UnityEngine::Transform* t, UnityEngine::Vector3 worldPosition) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::AxisTools::GetAxisVectorToPoint");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "AxisTools", "GetAxisVectorToPoint", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(worldPosition)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, worldPosition);
}
// Autogenerated method: RootMotion.AxisTools.GetAxisVectorToDirection
UnityEngine::Vector3 RootMotion::AxisTools::GetAxisVectorToDirection(UnityEngine::Transform* t, UnityEngine::Vector3 direction) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::AxisTools::GetAxisVectorToDirection");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "AxisTools", "GetAxisVectorToDirection", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(direction)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, direction);
}
// Autogenerated method: RootMotion.AxisTools.GetAxisVectorToDirection
UnityEngine::Vector3 RootMotion::AxisTools::GetAxisVectorToDirection(UnityEngine::Quaternion r, UnityEngine::Vector3 direction) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::AxisTools::GetAxisVectorToDirection");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "AxisTools", "GetAxisVectorToDirection", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(r), ::il2cpp_utils::ExtractType(direction)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, r, direction);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.BipedLimbOrientations
#include "RootMotion/BipedLimbOrientations.hpp"
// Including type: RootMotion.BipedLimbOrientations/RootMotion.LimbOrientation
#include "RootMotion/BipedLimbOrientations_LimbOrientation.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public RootMotion.BipedLimbOrientations/RootMotion.LimbOrientation leftArm
RootMotion::BipedLimbOrientations::LimbOrientation*& RootMotion::BipedLimbOrientations::dyn_leftArm() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedLimbOrientations::dyn_leftArm");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftArm"))->offset;
return *reinterpret_cast<RootMotion::BipedLimbOrientations::LimbOrientation**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.BipedLimbOrientations/RootMotion.LimbOrientation rightArm
RootMotion::BipedLimbOrientations::LimbOrientation*& RootMotion::BipedLimbOrientations::dyn_rightArm() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedLimbOrientations::dyn_rightArm");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightArm"))->offset;
return *reinterpret_cast<RootMotion::BipedLimbOrientations::LimbOrientation**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.BipedLimbOrientations/RootMotion.LimbOrientation leftLeg
RootMotion::BipedLimbOrientations::LimbOrientation*& RootMotion::BipedLimbOrientations::dyn_leftLeg() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedLimbOrientations::dyn_leftLeg");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftLeg"))->offset;
return *reinterpret_cast<RootMotion::BipedLimbOrientations::LimbOrientation**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.BipedLimbOrientations/RootMotion.LimbOrientation rightLeg
RootMotion::BipedLimbOrientations::LimbOrientation*& RootMotion::BipedLimbOrientations::dyn_rightLeg() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedLimbOrientations::dyn_rightLeg");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightLeg"))->offset;
return *reinterpret_cast<RootMotion::BipedLimbOrientations::LimbOrientation**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.BipedLimbOrientations.get_UMA
RootMotion::BipedLimbOrientations* RootMotion::BipedLimbOrientations::get_UMA() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedLimbOrientations::get_UMA");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedLimbOrientations", "get_UMA", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodThrow<RootMotion::BipedLimbOrientations*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: RootMotion.BipedLimbOrientations.get_MaxBiped
RootMotion::BipedLimbOrientations* RootMotion::BipedLimbOrientations::get_MaxBiped() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedLimbOrientations::get_MaxBiped");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedLimbOrientations", "get_MaxBiped", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodThrow<RootMotion::BipedLimbOrientations*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.BipedLimbOrientations/RootMotion.LimbOrientation
#include "RootMotion/BipedLimbOrientations_LimbOrientation.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 upperBoneForwardAxis
UnityEngine::Vector3& RootMotion::BipedLimbOrientations::LimbOrientation::dyn_upperBoneForwardAxis() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedLimbOrientations::LimbOrientation::dyn_upperBoneForwardAxis");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "upperBoneForwardAxis"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 lowerBoneForwardAxis
UnityEngine::Vector3& RootMotion::BipedLimbOrientations::LimbOrientation::dyn_lowerBoneForwardAxis() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedLimbOrientations::LimbOrientation::dyn_lowerBoneForwardAxis");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "lowerBoneForwardAxis"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 lastBoneLeftAxis
UnityEngine::Vector3& RootMotion::BipedLimbOrientations::LimbOrientation::dyn_lastBoneLeftAxis() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedLimbOrientations::LimbOrientation::dyn_lastBoneLeftAxis");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "lastBoneLeftAxis"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.BipedNaming
#include "RootMotion/BipedNaming.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public System.String[] typeLeft
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeLeft() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeLeft");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeLeft"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeLeft
void RootMotion::BipedNaming::_set_typeLeft(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeLeft");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeLeft", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeRight
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeRight() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeRight");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeRight"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeRight
void RootMotion::BipedNaming::_set_typeRight(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeRight");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeRight", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeSpine
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeSpine() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeSpine");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeSpine"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeSpine
void RootMotion::BipedNaming::_set_typeSpine(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeSpine");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeSpine", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeHead
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeHead() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeHead");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeHead"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeHead
void RootMotion::BipedNaming::_set_typeHead(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeHead");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeHead", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeArm
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeArm() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeArm");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeArm"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeArm
void RootMotion::BipedNaming::_set_typeArm(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeArm");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeArm", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeLeg
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeLeg() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeLeg");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeLeg"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeLeg
void RootMotion::BipedNaming::_set_typeLeg(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeLeg");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeLeg", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeTail
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeTail() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeTail");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeTail"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeTail
void RootMotion::BipedNaming::_set_typeTail(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeTail");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeTail", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeEye
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeEye() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeEye");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeEye"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeEye
void RootMotion::BipedNaming::_set_typeEye(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeEye");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeEye", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeExclude
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeExclude() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeExclude");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeExclude"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeExclude
void RootMotion::BipedNaming::_set_typeExclude(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeExclude");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeExclude", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeExcludeSpine
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeExcludeSpine() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeExcludeSpine");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeExcludeSpine"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeExcludeSpine
void RootMotion::BipedNaming::_set_typeExcludeSpine(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeExcludeSpine");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeExcludeSpine", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeExcludeHead
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeExcludeHead() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeExcludeHead");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeExcludeHead"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeExcludeHead
void RootMotion::BipedNaming::_set_typeExcludeHead(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeExcludeHead");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeExcludeHead", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeExcludeArm
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeExcludeArm() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeExcludeArm");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeExcludeArm"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeExcludeArm
void RootMotion::BipedNaming::_set_typeExcludeArm(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeExcludeArm");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeExcludeArm", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeExcludeLeg
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeExcludeLeg() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeExcludeLeg");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeExcludeLeg"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeExcludeLeg
void RootMotion::BipedNaming::_set_typeExcludeLeg(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeExcludeLeg");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeExcludeLeg", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeExcludeTail
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeExcludeTail() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeExcludeTail");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeExcludeTail"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeExcludeTail
void RootMotion::BipedNaming::_set_typeExcludeTail(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeExcludeTail");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeExcludeTail", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] typeExcludeEye
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_typeExcludeEye() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_typeExcludeEye");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "typeExcludeEye"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] typeExcludeEye
void RootMotion::BipedNaming::_set_typeExcludeEye(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_typeExcludeEye");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "typeExcludeEye", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] pelvis
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_pelvis() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_pelvis");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "pelvis"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] pelvis
void RootMotion::BipedNaming::_set_pelvis(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_pelvis");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "pelvis", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] hand
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_hand() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_hand");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "hand"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] hand
void RootMotion::BipedNaming::_set_hand(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_hand");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "hand", value));
}
// Autogenerated static field getter
// Get static field: static public System.String[] foot
::Array<::Il2CppString*>* RootMotion::BipedNaming::_get_foot() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_get_foot");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<::Array<::Il2CppString*>*>("RootMotion", "BipedNaming", "foot"));
}
// Autogenerated static field setter
// Set static field: static public System.String[] foot
void RootMotion::BipedNaming::_set_foot(::Array<::Il2CppString*>* value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::_set_foot");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming", "foot", value));
}
// Autogenerated method: RootMotion.BipedNaming..cctor
void RootMotion::BipedNaming::_cctor() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::.cctor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", ".cctor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated method: RootMotion.BipedNaming.GetBonesOfType
::Array<UnityEngine::Transform*>* RootMotion::BipedNaming::GetBonesOfType(RootMotion::BipedNaming::BoneType boneType, ::Array<UnityEngine::Transform*>* bones) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::GetBonesOfType");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "GetBonesOfType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneType), ::il2cpp_utils::ExtractType(bones)})));
return ::il2cpp_utils::RunMethodThrow<::Array<UnityEngine::Transform*>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneType, bones);
}
// Autogenerated method: RootMotion.BipedNaming.GetBonesOfSide
::Array<UnityEngine::Transform*>* RootMotion::BipedNaming::GetBonesOfSide(RootMotion::BipedNaming::BoneSide boneSide, ::Array<UnityEngine::Transform*>* bones) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::GetBonesOfSide");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "GetBonesOfSide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneSide), ::il2cpp_utils::ExtractType(bones)})));
return ::il2cpp_utils::RunMethodThrow<::Array<UnityEngine::Transform*>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneSide, bones);
}
// Autogenerated method: RootMotion.BipedNaming.GetBonesOfTypeAndSide
::Array<UnityEngine::Transform*>* RootMotion::BipedNaming::GetBonesOfTypeAndSide(RootMotion::BipedNaming::BoneType boneType, RootMotion::BipedNaming::BoneSide boneSide, ::Array<UnityEngine::Transform*>* bones) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::GetBonesOfTypeAndSide");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "GetBonesOfTypeAndSide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneType), ::il2cpp_utils::ExtractType(boneSide), ::il2cpp_utils::ExtractType(bones)})));
return ::il2cpp_utils::RunMethodThrow<::Array<UnityEngine::Transform*>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneType, boneSide, bones);
}
// Autogenerated method: RootMotion.BipedNaming.GetFirstBoneOfTypeAndSide
UnityEngine::Transform* RootMotion::BipedNaming::GetFirstBoneOfTypeAndSide(RootMotion::BipedNaming::BoneType boneType, RootMotion::BipedNaming::BoneSide boneSide, ::Array<UnityEngine::Transform*>* bones) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::GetFirstBoneOfTypeAndSide");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "GetFirstBoneOfTypeAndSide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneType), ::il2cpp_utils::ExtractType(boneSide), ::il2cpp_utils::ExtractType(bones)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Transform*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneType, boneSide, bones);
}
// Autogenerated method: RootMotion.BipedNaming.GetNamingMatch
UnityEngine::Transform* RootMotion::BipedNaming::GetNamingMatch(::Array<UnityEngine::Transform*>* transforms, ::Array<::Array<::Il2CppString*>*>* namings) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::GetNamingMatch");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "GetNamingMatch", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(transforms), ::il2cpp_utils::ExtractType(namings)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Transform*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, transforms, namings);
}
// Creating initializer_list -> params proxy for: UnityEngine.Transform GetNamingMatch(UnityEngine.Transform[] transforms, params System.String[][] namings)
UnityEngine::Transform* RootMotion::BipedNaming::GetNamingMatch(::Array<UnityEngine::Transform*>* transforms, std::initializer_list<::Array<::Il2CppString*>*> namings) {
return RootMotion::BipedNaming::GetNamingMatch(transforms, ::Array<::Array<::Il2CppString*>*>::New(namings));
}
// Autogenerated method: RootMotion.BipedNaming.GetBoneType
RootMotion::BipedNaming::BoneType RootMotion::BipedNaming::GetBoneType(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::GetBoneType");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "GetBoneType", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<RootMotion::BipedNaming::BoneType, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.GetBoneSide
RootMotion::BipedNaming::BoneSide RootMotion::BipedNaming::GetBoneSide(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::GetBoneSide");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "GetBoneSide", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<RootMotion::BipedNaming::BoneSide, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.GetBone
UnityEngine::Transform* RootMotion::BipedNaming::GetBone(::Array<UnityEngine::Transform*>* transforms, RootMotion::BipedNaming::BoneType boneType, RootMotion::BipedNaming::BoneSide boneSide, ::Array<::Array<::Il2CppString*>*>* namings) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::GetBone");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "GetBone", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(transforms), ::il2cpp_utils::ExtractType(boneType), ::il2cpp_utils::ExtractType(boneSide), ::il2cpp_utils::ExtractType(namings)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Transform*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, transforms, boneType, boneSide, namings);
}
// Creating initializer_list -> params proxy for: UnityEngine.Transform GetBone(UnityEngine.Transform[] transforms, RootMotion.BipedNaming/RootMotion.BoneType boneType, RootMotion.BipedNaming/RootMotion.BoneSide boneSide, params System.String[][] namings)
UnityEngine::Transform* RootMotion::BipedNaming::GetBone(::Array<UnityEngine::Transform*>* transforms, RootMotion::BipedNaming::BoneType boneType, RootMotion::BipedNaming::BoneSide boneSide, std::initializer_list<::Array<::Il2CppString*>*> namings) {
return RootMotion::BipedNaming::GetBone(transforms, boneType, boneSide, ::Array<::Array<::Il2CppString*>*>::New(namings));
}
// Autogenerated method: RootMotion.BipedNaming.isLeft
bool RootMotion::BipedNaming::isLeft(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::isLeft");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "isLeft", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.isRight
bool RootMotion::BipedNaming::isRight(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::isRight");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "isRight", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.isSpine
bool RootMotion::BipedNaming::isSpine(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::isSpine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "isSpine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.isHead
bool RootMotion::BipedNaming::isHead(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::isHead");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "isHead", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.isArm
bool RootMotion::BipedNaming::isArm(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::isArm");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "isArm", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.isLeg
bool RootMotion::BipedNaming::isLeg(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::isLeg");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "isLeg", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.isTail
bool RootMotion::BipedNaming::isTail(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::isTail");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "isTail", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.isEye
bool RootMotion::BipedNaming::isEye(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::isEye");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "isEye", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.isTypeExclude
bool RootMotion::BipedNaming::isTypeExclude(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::isTypeExclude");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "isTypeExclude", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.matchesNaming
bool RootMotion::BipedNaming::matchesNaming(::Il2CppString* boneName, ::Array<::Il2CppString*>* namingConvention) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::matchesNaming");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "matchesNaming", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName), ::il2cpp_utils::ExtractType(namingConvention)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName, namingConvention);
}
// Autogenerated method: RootMotion.BipedNaming.excludesNaming
bool RootMotion::BipedNaming::excludesNaming(::Il2CppString* boneName, ::Array<::Il2CppString*>* namingConvention) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::excludesNaming");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "excludesNaming", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName), ::il2cpp_utils::ExtractType(namingConvention)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName, namingConvention);
}
// Autogenerated method: RootMotion.BipedNaming.matchesLastLetter
bool RootMotion::BipedNaming::matchesLastLetter(::Il2CppString* boneName, ::Array<::Il2CppString*>* namingConvention) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::matchesLastLetter");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "matchesLastLetter", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName), ::il2cpp_utils::ExtractType(namingConvention)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName, namingConvention);
}
// Autogenerated method: RootMotion.BipedNaming.LastLetterIs
bool RootMotion::BipedNaming::LastLetterIs(::Il2CppString* boneName, ::Il2CppString* letter) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::LastLetterIs");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "LastLetterIs", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName), ::il2cpp_utils::ExtractType(letter)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName, letter);
}
// Autogenerated method: RootMotion.BipedNaming.firstLetter
::Il2CppString* RootMotion::BipedNaming::firstLetter(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::firstLetter");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "firstLetter", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated method: RootMotion.BipedNaming.lastLetter
::Il2CppString* RootMotion::BipedNaming::lastLetter(::Il2CppString* boneName) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::lastLetter");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedNaming", "lastLetter", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneName)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneName);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.BipedNaming/RootMotion.BoneType
#include "RootMotion/BipedNaming.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public RootMotion.BipedNaming/RootMotion.BoneType Unassigned
RootMotion::BipedNaming::BoneType RootMotion::BipedNaming::BoneType::_get_Unassigned() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_get_Unassigned");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::BipedNaming::BoneType>("RootMotion", "BipedNaming/BoneType", "Unassigned"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.BipedNaming/RootMotion.BoneType Unassigned
void RootMotion::BipedNaming::BoneType::_set_Unassigned(RootMotion::BipedNaming::BoneType value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_set_Unassigned");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming/BoneType", "Unassigned", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.BipedNaming/RootMotion.BoneType Spine
RootMotion::BipedNaming::BoneType RootMotion::BipedNaming::BoneType::_get_Spine() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_get_Spine");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::BipedNaming::BoneType>("RootMotion", "BipedNaming/BoneType", "Spine"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.BipedNaming/RootMotion.BoneType Spine
void RootMotion::BipedNaming::BoneType::_set_Spine(RootMotion::BipedNaming::BoneType value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_set_Spine");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming/BoneType", "Spine", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.BipedNaming/RootMotion.BoneType Head
RootMotion::BipedNaming::BoneType RootMotion::BipedNaming::BoneType::_get_Head() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_get_Head");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::BipedNaming::BoneType>("RootMotion", "BipedNaming/BoneType", "Head"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.BipedNaming/RootMotion.BoneType Head
void RootMotion::BipedNaming::BoneType::_set_Head(RootMotion::BipedNaming::BoneType value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_set_Head");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming/BoneType", "Head", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.BipedNaming/RootMotion.BoneType Arm
RootMotion::BipedNaming::BoneType RootMotion::BipedNaming::BoneType::_get_Arm() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_get_Arm");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::BipedNaming::BoneType>("RootMotion", "BipedNaming/BoneType", "Arm"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.BipedNaming/RootMotion.BoneType Arm
void RootMotion::BipedNaming::BoneType::_set_Arm(RootMotion::BipedNaming::BoneType value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_set_Arm");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming/BoneType", "Arm", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.BipedNaming/RootMotion.BoneType Leg
RootMotion::BipedNaming::BoneType RootMotion::BipedNaming::BoneType::_get_Leg() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_get_Leg");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::BipedNaming::BoneType>("RootMotion", "BipedNaming/BoneType", "Leg"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.BipedNaming/RootMotion.BoneType Leg
void RootMotion::BipedNaming::BoneType::_set_Leg(RootMotion::BipedNaming::BoneType value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_set_Leg");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming/BoneType", "Leg", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.BipedNaming/RootMotion.BoneType Tail
RootMotion::BipedNaming::BoneType RootMotion::BipedNaming::BoneType::_get_Tail() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_get_Tail");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::BipedNaming::BoneType>("RootMotion", "BipedNaming/BoneType", "Tail"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.BipedNaming/RootMotion.BoneType Tail
void RootMotion::BipedNaming::BoneType::_set_Tail(RootMotion::BipedNaming::BoneType value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_set_Tail");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming/BoneType", "Tail", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.BipedNaming/RootMotion.BoneType Eye
RootMotion::BipedNaming::BoneType RootMotion::BipedNaming::BoneType::_get_Eye() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_get_Eye");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::BipedNaming::BoneType>("RootMotion", "BipedNaming/BoneType", "Eye"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.BipedNaming/RootMotion.BoneType Eye
void RootMotion::BipedNaming::BoneType::_set_Eye(RootMotion::BipedNaming::BoneType value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::_set_Eye");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming/BoneType", "Eye", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& RootMotion::BipedNaming::BoneType::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneType::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.BipedNaming/RootMotion.BoneSide
#include "RootMotion/BipedNaming.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public RootMotion.BipedNaming/RootMotion.BoneSide Center
RootMotion::BipedNaming::BoneSide RootMotion::BipedNaming::BoneSide::_get_Center() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneSide::_get_Center");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::BipedNaming::BoneSide>("RootMotion", "BipedNaming/BoneSide", "Center"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.BipedNaming/RootMotion.BoneSide Center
void RootMotion::BipedNaming::BoneSide::_set_Center(RootMotion::BipedNaming::BoneSide value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneSide::_set_Center");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming/BoneSide", "Center", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.BipedNaming/RootMotion.BoneSide Left
RootMotion::BipedNaming::BoneSide RootMotion::BipedNaming::BoneSide::_get_Left() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneSide::_get_Left");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::BipedNaming::BoneSide>("RootMotion", "BipedNaming/BoneSide", "Left"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.BipedNaming/RootMotion.BoneSide Left
void RootMotion::BipedNaming::BoneSide::_set_Left(RootMotion::BipedNaming::BoneSide value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneSide::_set_Left");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming/BoneSide", "Left", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.BipedNaming/RootMotion.BoneSide Right
RootMotion::BipedNaming::BoneSide RootMotion::BipedNaming::BoneSide::_get_Right() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneSide::_get_Right");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::BipedNaming::BoneSide>("RootMotion", "BipedNaming/BoneSide", "Right"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.BipedNaming/RootMotion.BoneSide Right
void RootMotion::BipedNaming::BoneSide::_set_Right(RootMotion::BipedNaming::BoneSide value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneSide::_set_Right");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "BipedNaming/BoneSide", "Right", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& RootMotion::BipedNaming::BoneSide::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedNaming::BoneSide::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.BipedReferences
#include "RootMotion/BipedReferences.hpp"
// Including type: RootMotion.BipedReferences/RootMotion.AutoDetectParams
#include "RootMotion/BipedReferences_AutoDetectParams.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: UnityEngine.Animator
#include "UnityEngine/Animator.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
// Including type: UnityEngine.Quaternion
#include "UnityEngine/Quaternion.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform root
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_root() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_root");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "root"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform pelvis
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_pelvis() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_pelvis");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "pelvis"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform leftThigh
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_leftThigh() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_leftThigh");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftThigh"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform leftCalf
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_leftCalf() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_leftCalf");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftCalf"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform leftFoot
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_leftFoot() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_leftFoot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftFoot"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform rightThigh
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_rightThigh() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_rightThigh");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightThigh"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform rightCalf
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_rightCalf() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_rightCalf");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightCalf"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform rightFoot
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_rightFoot() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_rightFoot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightFoot"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform leftUpperArm
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_leftUpperArm() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_leftUpperArm");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftUpperArm"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform leftForearm
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_leftForearm() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_leftForearm");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftForearm"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform leftHand
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_leftHand() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_leftHand");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftHand"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform rightUpperArm
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_rightUpperArm() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_rightUpperArm");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightUpperArm"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform rightForearm
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_rightForearm() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_rightForearm");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightForearm"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform rightHand
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_rightHand() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_rightHand");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightHand"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform head
UnityEngine::Transform*& RootMotion::BipedReferences::dyn_head() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_head");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "head"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform[] spine
::Array<UnityEngine::Transform*>*& RootMotion::BipedReferences::dyn_spine() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_spine");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "spine"))->offset;
return *reinterpret_cast<::Array<UnityEngine::Transform*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform[] eyes
::Array<UnityEngine::Transform*>*& RootMotion::BipedReferences::dyn_eyes() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::dyn_eyes");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "eyes"))->offset;
return *reinterpret_cast<::Array<UnityEngine::Transform*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.BipedReferences.get_isFilled
bool RootMotion::BipedReferences::get_isFilled() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::get_isFilled");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isFilled", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.BipedReferences.get_isEmpty
bool RootMotion::BipedReferences::get_isEmpty() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::get_isEmpty");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isEmpty", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.BipedReferences.IsEmpty
bool RootMotion::BipedReferences::IsEmpty(bool includeRoot) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::IsEmpty");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "IsEmpty", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(includeRoot)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, includeRoot);
}
// Autogenerated method: RootMotion.BipedReferences.Contains
bool RootMotion::BipedReferences::Contains(UnityEngine::Transform* t, bool ignoreRoot) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::Contains");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Contains", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(ignoreRoot)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, t, ignoreRoot);
}
// Autogenerated method: RootMotion.BipedReferences.AutoDetectReferences
bool RootMotion::BipedReferences::AutoDetectReferences(ByRef<RootMotion::BipedReferences*> references, UnityEngine::Transform* root, RootMotion::BipedReferences::AutoDetectParams autoDetectParams) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::AutoDetectReferences");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "AutoDetectReferences", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(root), ::il2cpp_utils::ExtractType(autoDetectParams)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, byref(references), root, autoDetectParams);
}
// Autogenerated method: RootMotion.BipedReferences.DetectReferencesByNaming
void RootMotion::BipedReferences::DetectReferencesByNaming(ByRef<RootMotion::BipedReferences*> references, UnityEngine::Transform* root, RootMotion::BipedReferences::AutoDetectParams autoDetectParams) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::DetectReferencesByNaming");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "DetectReferencesByNaming", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(root), ::il2cpp_utils::ExtractType(autoDetectParams)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, byref(references), root, autoDetectParams);
}
// Autogenerated method: RootMotion.BipedReferences.AssignHumanoidReferences
void RootMotion::BipedReferences::AssignHumanoidReferences(ByRef<RootMotion::BipedReferences*> references, UnityEngine::Animator* animator, RootMotion::BipedReferences::AutoDetectParams autoDetectParams) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::AssignHumanoidReferences");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "AssignHumanoidReferences", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(animator), ::il2cpp_utils::ExtractType(autoDetectParams)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, byref(references), animator, autoDetectParams);
}
// Autogenerated method: RootMotion.BipedReferences.SetupError
bool RootMotion::BipedReferences::SetupError(RootMotion::BipedReferences* references, ByRef<::Il2CppString*> errorMessage) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::SetupError");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "SetupError", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(errorMessage)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, references, byref(errorMessage));
}
// Autogenerated method: RootMotion.BipedReferences.SetupWarning
bool RootMotion::BipedReferences::SetupWarning(RootMotion::BipedReferences* references, ByRef<::Il2CppString*> warningMessage) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::SetupWarning");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "SetupWarning", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(warningMessage)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, references, byref(warningMessage));
}
// Autogenerated method: RootMotion.BipedReferences.IsNeckBone
bool RootMotion::BipedReferences::IsNeckBone(UnityEngine::Transform* bone, UnityEngine::Transform* leftUpperArm) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::IsNeckBone");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "IsNeckBone", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(bone), ::il2cpp_utils::ExtractType(leftUpperArm)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, bone, leftUpperArm);
}
// Autogenerated method: RootMotion.BipedReferences.AddBoneToEyes
bool RootMotion::BipedReferences::AddBoneToEyes(UnityEngine::Transform* bone, ByRef<RootMotion::BipedReferences*> references, RootMotion::BipedReferences::AutoDetectParams autoDetectParams) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::AddBoneToEyes");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "AddBoneToEyes", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(bone), ::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(autoDetectParams)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, bone, byref(references), autoDetectParams);
}
// Autogenerated method: RootMotion.BipedReferences.AddBoneToSpine
bool RootMotion::BipedReferences::AddBoneToSpine(UnityEngine::Transform* bone, ByRef<RootMotion::BipedReferences*> references, RootMotion::BipedReferences::AutoDetectParams autoDetectParams) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::AddBoneToSpine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "AddBoneToSpine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(bone), ::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(autoDetectParams)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, bone, byref(references), autoDetectParams);
}
// Autogenerated method: RootMotion.BipedReferences.DetectLimb
void RootMotion::BipedReferences::DetectLimb(RootMotion::BipedNaming::BoneType boneType, RootMotion::BipedNaming::BoneSide boneSide, ByRef<UnityEngine::Transform*> firstBone, ByRef<UnityEngine::Transform*> secondBone, ByRef<UnityEngine::Transform*> lastBone, ::Array<UnityEngine::Transform*>* transforms) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::DetectLimb");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "DetectLimb", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(boneType), ::il2cpp_utils::ExtractType(boneSide), ::il2cpp_utils::ExtractType(firstBone), ::il2cpp_utils::ExtractType(secondBone), ::il2cpp_utils::ExtractType(lastBone), ::il2cpp_utils::ExtractType(transforms)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, boneType, boneSide, byref(firstBone), byref(secondBone), byref(lastBone), transforms);
}
// Autogenerated method: RootMotion.BipedReferences.AddBoneToHierarchy
void RootMotion::BipedReferences::AddBoneToHierarchy(ByRef<::Array<UnityEngine::Transform*>*> bones, UnityEngine::Transform* transform) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::AddBoneToHierarchy");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "AddBoneToHierarchy", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(bones), ::il2cpp_utils::ExtractType(transform)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, byref(bones), transform);
}
// Autogenerated method: RootMotion.BipedReferences.LimbError
bool RootMotion::BipedReferences::LimbError(UnityEngine::Transform* bone1, UnityEngine::Transform* bone2, UnityEngine::Transform* bone3, ByRef<::Il2CppString*> errorMessage) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::LimbError");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "LimbError", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(bone1), ::il2cpp_utils::ExtractType(bone2), ::il2cpp_utils::ExtractType(bone3), ::il2cpp_utils::ExtractType(errorMessage)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, bone1, bone2, bone3, byref(errorMessage));
}
// Autogenerated method: RootMotion.BipedReferences.LimbWarning
bool RootMotion::BipedReferences::LimbWarning(UnityEngine::Transform* bone1, UnityEngine::Transform* bone2, UnityEngine::Transform* bone3, ByRef<::Il2CppString*> warningMessage) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::LimbWarning");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "LimbWarning", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(bone1), ::il2cpp_utils::ExtractType(bone2), ::il2cpp_utils::ExtractType(bone3), ::il2cpp_utils::ExtractType(warningMessage)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, bone1, bone2, bone3, byref(warningMessage));
}
// Autogenerated method: RootMotion.BipedReferences.SpineError
bool RootMotion::BipedReferences::SpineError(RootMotion::BipedReferences* references, ByRef<::Il2CppString*> errorMessage) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::SpineError");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "SpineError", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(errorMessage)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, references, byref(errorMessage));
}
// Autogenerated method: RootMotion.BipedReferences.SpineWarning
bool RootMotion::BipedReferences::SpineWarning(RootMotion::BipedReferences* references, ByRef<::Il2CppString*> warningMessage) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::SpineWarning");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "SpineWarning", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(warningMessage)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, references, byref(warningMessage));
}
// Autogenerated method: RootMotion.BipedReferences.EyesError
bool RootMotion::BipedReferences::EyesError(RootMotion::BipedReferences* references, ByRef<::Il2CppString*> errorMessage) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::EyesError");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "EyesError", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(errorMessage)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, references, byref(errorMessage));
}
// Autogenerated method: RootMotion.BipedReferences.EyesWarning
bool RootMotion::BipedReferences::EyesWarning(RootMotion::BipedReferences* references, ByRef<::Il2CppString*> warningMessage) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::EyesWarning");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "EyesWarning", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(warningMessage)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, references, byref(warningMessage));
}
// Autogenerated method: RootMotion.BipedReferences.RootHeightWarning
bool RootMotion::BipedReferences::RootHeightWarning(RootMotion::BipedReferences* references, ByRef<::Il2CppString*> warningMessage) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::RootHeightWarning");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "RootHeightWarning", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(warningMessage)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, references, byref(warningMessage));
}
// Autogenerated method: RootMotion.BipedReferences.FacingAxisWarning
bool RootMotion::BipedReferences::FacingAxisWarning(RootMotion::BipedReferences* references, ByRef<::Il2CppString*> warningMessage) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::FacingAxisWarning");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "FacingAxisWarning", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references), ::il2cpp_utils::ExtractType(warningMessage)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, references, byref(warningMessage));
}
// Autogenerated method: RootMotion.BipedReferences.GetVerticalOffset
float RootMotion::BipedReferences::GetVerticalOffset(UnityEngine::Vector3 p1, UnityEngine::Vector3 p2, UnityEngine::Quaternion rotation) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::GetVerticalOffset");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences", "GetVerticalOffset", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(p1), ::il2cpp_utils::ExtractType(p2), ::il2cpp_utils::ExtractType(rotation)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, p1, p2, rotation);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.BipedReferences/RootMotion.AutoDetectParams
#include "RootMotion/BipedReferences_AutoDetectParams.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.Boolean legsParentInSpine
bool& RootMotion::BipedReferences::AutoDetectParams::dyn_legsParentInSpine() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::AutoDetectParams::dyn_legsParentInSpine");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "legsParentInSpine"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Boolean includeEyes
bool& RootMotion::BipedReferences::AutoDetectParams::dyn_includeEyes() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::AutoDetectParams::dyn_includeEyes");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "includeEyes"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.BipedReferences/RootMotion.AutoDetectParams.get_Default
RootMotion::BipedReferences::AutoDetectParams RootMotion::BipedReferences::AutoDetectParams::get_Default() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::BipedReferences::AutoDetectParams::get_Default");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "BipedReferences/AutoDetectParams", "get_Default", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
return ::il2cpp_utils::RunMethodThrow<RootMotion::BipedReferences::AutoDetectParams, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.Comments
#include "RootMotion/Comments.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.String text
::Il2CppString*& RootMotion::Comments::dyn_text() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Comments::dyn_text");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "text"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.DemoGUIMessage
#include "RootMotion/DemoGUIMessage.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.String text
::Il2CppString*& RootMotion::DemoGUIMessage::dyn_text() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::DemoGUIMessage::dyn_text");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "text"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Color color
UnityEngine::Color& RootMotion::DemoGUIMessage::dyn_color() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::DemoGUIMessage::dyn_color");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "color"))->offset;
return *reinterpret_cast<UnityEngine::Color*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.DemoGUIMessage.OnGUI
void RootMotion::DemoGUIMessage::OnGUI() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::DemoGUIMessage::OnGUI");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnGUI", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.Hierarchy
#include "RootMotion/Hierarchy.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: UnityEngine.Object
#include "UnityEngine/Object.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: RootMotion.Hierarchy.HierarchyIsValid
bool RootMotion::Hierarchy::HierarchyIsValid(::Array<UnityEngine::Transform*>* bones) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Hierarchy::HierarchyIsValid");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Hierarchy", "HierarchyIsValid", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(bones)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, bones);
}
// Autogenerated method: RootMotion.Hierarchy.ContainsDuplicate
UnityEngine::Object* RootMotion::Hierarchy::ContainsDuplicate(::Array<UnityEngine::Object*>* objects) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Hierarchy::ContainsDuplicate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Hierarchy", "ContainsDuplicate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(objects)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Object*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, objects);
}
// Autogenerated method: RootMotion.Hierarchy.IsAncestor
bool RootMotion::Hierarchy::IsAncestor(UnityEngine::Transform* transform, UnityEngine::Transform* ancestor) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Hierarchy::IsAncestor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Hierarchy", "IsAncestor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(transform), ::il2cpp_utils::ExtractType(ancestor)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, transform, ancestor);
}
// Autogenerated method: RootMotion.Hierarchy.ContainsChild
bool RootMotion::Hierarchy::ContainsChild(UnityEngine::Transform* transform, UnityEngine::Transform* child) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Hierarchy::ContainsChild");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Hierarchy", "ContainsChild", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(transform), ::il2cpp_utils::ExtractType(child)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, transform, child);
}
// Autogenerated method: RootMotion.Hierarchy.AddAncestors
void RootMotion::Hierarchy::AddAncestors(UnityEngine::Transform* transform, UnityEngine::Transform* blocker, ByRef<::Array<UnityEngine::Transform*>*> array) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Hierarchy::AddAncestors");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Hierarchy", "AddAncestors", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(transform), ::il2cpp_utils::ExtractType(blocker), ::il2cpp_utils::ExtractType(array)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, transform, blocker, byref(array));
}
// Autogenerated method: RootMotion.Hierarchy.GetAncestor
UnityEngine::Transform* RootMotion::Hierarchy::GetAncestor(UnityEngine::Transform* transform, int minChildCount) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Hierarchy::GetAncestor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Hierarchy", "GetAncestor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(transform), ::il2cpp_utils::ExtractType(minChildCount)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Transform*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, transform, minChildCount);
}
// Autogenerated method: RootMotion.Hierarchy.GetFirstCommonAncestor
UnityEngine::Transform* RootMotion::Hierarchy::GetFirstCommonAncestor(UnityEngine::Transform* t1, UnityEngine::Transform* t2) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Hierarchy::GetFirstCommonAncestor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Hierarchy", "GetFirstCommonAncestor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t1), ::il2cpp_utils::ExtractType(t2)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Transform*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t1, t2);
}
// Autogenerated method: RootMotion.Hierarchy.GetFirstCommonAncestor
UnityEngine::Transform* RootMotion::Hierarchy::GetFirstCommonAncestor(::Array<UnityEngine::Transform*>* transforms) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Hierarchy::GetFirstCommonAncestor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Hierarchy", "GetFirstCommonAncestor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(transforms)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Transform*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, transforms);
}
// Autogenerated method: RootMotion.Hierarchy.GetFirstCommonAncestorRecursive
UnityEngine::Transform* RootMotion::Hierarchy::GetFirstCommonAncestorRecursive(UnityEngine::Transform* transform, ::Array<UnityEngine::Transform*>* transforms) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Hierarchy::GetFirstCommonAncestorRecursive");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Hierarchy", "GetFirstCommonAncestorRecursive", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(transform), ::il2cpp_utils::ExtractType(transforms)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Transform*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, transform, transforms);
}
// Autogenerated method: RootMotion.Hierarchy.IsCommonAncestor
bool RootMotion::Hierarchy::IsCommonAncestor(UnityEngine::Transform* transform, ::Array<UnityEngine::Transform*>* transforms) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Hierarchy::IsCommonAncestor");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Hierarchy", "IsCommonAncestor", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(transform), ::il2cpp_utils::ExtractType(transforms)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, transform, transforms);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.InspectorComment
#include "RootMotion/InspectorComment.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.String name
::Il2CppString*& RootMotion::InspectorComment::dyn_name() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InspectorComment::dyn_name");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "name"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.String color
::Il2CppString*& RootMotion::InspectorComment::dyn_color() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InspectorComment::dyn_color");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "color"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.InterpolationMode
#include "RootMotion/InterpolationMode.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode None
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_None() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_None");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "None"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode None
void RootMotion::InterpolationMode::_set_None(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_None");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "None", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InOutCubic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InOutCubic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InOutCubic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InOutCubic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InOutCubic
void RootMotion::InterpolationMode::_set_InOutCubic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InOutCubic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InOutCubic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InOutQuintic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InOutQuintic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InOutQuintic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InOutQuintic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InOutQuintic
void RootMotion::InterpolationMode::_set_InOutQuintic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InOutQuintic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InOutQuintic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InOutSine
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InOutSine() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InOutSine");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InOutSine"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InOutSine
void RootMotion::InterpolationMode::_set_InOutSine(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InOutSine");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InOutSine", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InQuintic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InQuintic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InQuintic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InQuintic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InQuintic
void RootMotion::InterpolationMode::_set_InQuintic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InQuintic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InQuintic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InQuartic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InQuartic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InQuartic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InQuartic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InQuartic
void RootMotion::InterpolationMode::_set_InQuartic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InQuartic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InQuartic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InCubic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InCubic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InCubic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InCubic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InCubic
void RootMotion::InterpolationMode::_set_InCubic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InCubic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InCubic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InQuadratic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InQuadratic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InQuadratic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InQuadratic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InQuadratic
void RootMotion::InterpolationMode::_set_InQuadratic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InQuadratic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InQuadratic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InElastic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InElastic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InElastic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InElastic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InElastic
void RootMotion::InterpolationMode::_set_InElastic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InElastic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InElastic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InElasticSmall
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InElasticSmall() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InElasticSmall");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InElasticSmall"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InElasticSmall
void RootMotion::InterpolationMode::_set_InElasticSmall(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InElasticSmall");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InElasticSmall", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InElasticBig
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InElasticBig() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InElasticBig");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InElasticBig"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InElasticBig
void RootMotion::InterpolationMode::_set_InElasticBig(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InElasticBig");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InElasticBig", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InSine
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InSine() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InSine");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InSine"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InSine
void RootMotion::InterpolationMode::_set_InSine(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InSine");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InSine", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode InBack
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_InBack() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_InBack");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "InBack"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode InBack
void RootMotion::InterpolationMode::_set_InBack(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_InBack");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "InBack", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutQuintic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutQuintic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutQuintic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutQuintic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutQuintic
void RootMotion::InterpolationMode::_set_OutQuintic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutQuintic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutQuintic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutQuartic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutQuartic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutQuartic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutQuartic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutQuartic
void RootMotion::InterpolationMode::_set_OutQuartic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutQuartic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutQuartic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutCubic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutCubic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutCubic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutCubic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutCubic
void RootMotion::InterpolationMode::_set_OutCubic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutCubic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutCubic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutInCubic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutInCubic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutInCubic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutInCubic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutInCubic
void RootMotion::InterpolationMode::_set_OutInCubic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutInCubic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutInCubic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutInQuartic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutInQuartic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutInQuartic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutInQuartic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutInQuartic
void RootMotion::InterpolationMode::_set_OutInQuartic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutInQuartic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutInQuartic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutElastic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutElastic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutElastic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutElastic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutElastic
void RootMotion::InterpolationMode::_set_OutElastic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutElastic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutElastic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutElasticSmall
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutElasticSmall() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutElasticSmall");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutElasticSmall"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutElasticSmall
void RootMotion::InterpolationMode::_set_OutElasticSmall(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutElasticSmall");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutElasticSmall", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutElasticBig
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutElasticBig() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutElasticBig");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutElasticBig"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutElasticBig
void RootMotion::InterpolationMode::_set_OutElasticBig(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutElasticBig");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutElasticBig", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutSine
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutSine() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutSine");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutSine"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutSine
void RootMotion::InterpolationMode::_set_OutSine(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutSine");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutSine", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutBack
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutBack() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutBack");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutBack"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutBack
void RootMotion::InterpolationMode::_set_OutBack(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutBack");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutBack", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutBackCubic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutBackCubic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutBackCubic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutBackCubic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutBackCubic
void RootMotion::InterpolationMode::_set_OutBackCubic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutBackCubic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutBackCubic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode OutBackQuartic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_OutBackQuartic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_OutBackQuartic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "OutBackQuartic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode OutBackQuartic
void RootMotion::InterpolationMode::_set_OutBackQuartic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_OutBackQuartic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "OutBackQuartic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode BackInCubic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_BackInCubic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_BackInCubic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "BackInCubic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode BackInCubic
void RootMotion::InterpolationMode::_set_BackInCubic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_BackInCubic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "BackInCubic", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.InterpolationMode BackInQuartic
RootMotion::InterpolationMode RootMotion::InterpolationMode::_get_BackInQuartic() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_get_BackInQuartic");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::InterpolationMode>("RootMotion", "InterpolationMode", "BackInQuartic"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.InterpolationMode BackInQuartic
void RootMotion::InterpolationMode::_set_BackInQuartic(RootMotion::InterpolationMode value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::_set_BackInQuartic");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "InterpolationMode", "BackInQuartic", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& RootMotion::InterpolationMode::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::InterpolationMode::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.Interp
#include "RootMotion/Interp.hpp"
// Including type: RootMotion.InterpolationMode
#include "RootMotion/InterpolationMode.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: RootMotion.Interp.Float
float RootMotion::Interp::Float(float t, RootMotion::InterpolationMode mode) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::Float");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "Float", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(mode)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, mode);
}
// Autogenerated method: RootMotion.Interp.V3
UnityEngine::Vector3 RootMotion::Interp::V3(UnityEngine::Vector3 v1, UnityEngine::Vector3 v2, float t, RootMotion::InterpolationMode mode) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::V3");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "V3", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(v1), ::il2cpp_utils::ExtractType(v2), ::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(mode)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, v1, v2, t, mode);
}
// Autogenerated method: RootMotion.Interp.LerpValue
float RootMotion::Interp::LerpValue(float value, float target, float increaseSpeed, float decreaseSpeed) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::LerpValue");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "LerpValue", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value), ::il2cpp_utils::ExtractType(target), ::il2cpp_utils::ExtractType(increaseSpeed), ::il2cpp_utils::ExtractType(decreaseSpeed)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, value, target, increaseSpeed, decreaseSpeed);
}
// Autogenerated method: RootMotion.Interp.None
float RootMotion::Interp::None(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::None");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "None", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InOutCubic
float RootMotion::Interp::InOutCubic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InOutCubic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InOutCubic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InOutQuintic
float RootMotion::Interp::InOutQuintic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InOutQuintic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InOutQuintic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InQuintic
float RootMotion::Interp::InQuintic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InQuintic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InQuintic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InQuartic
float RootMotion::Interp::InQuartic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InQuartic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InQuartic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InCubic
float RootMotion::Interp::InCubic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InCubic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InCubic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InQuadratic
float RootMotion::Interp::InQuadratic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InQuadratic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InQuadratic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutQuintic
float RootMotion::Interp::OutQuintic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutQuintic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutQuintic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutQuartic
float RootMotion::Interp::OutQuartic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutQuartic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutQuartic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutCubic
float RootMotion::Interp::OutCubic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutCubic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutCubic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutInCubic
float RootMotion::Interp::OutInCubic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutInCubic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutInCubic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutInQuartic
float RootMotion::Interp::OutInQuartic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutInQuartic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutInQuartic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.BackInCubic
float RootMotion::Interp::BackInCubic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::BackInCubic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "BackInCubic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.BackInQuartic
float RootMotion::Interp::BackInQuartic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::BackInQuartic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "BackInQuartic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutBackCubic
float RootMotion::Interp::OutBackCubic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutBackCubic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutBackCubic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutBackQuartic
float RootMotion::Interp::OutBackQuartic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutBackQuartic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutBackQuartic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutElasticSmall
float RootMotion::Interp::OutElasticSmall(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutElasticSmall");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutElasticSmall", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutElasticBig
float RootMotion::Interp::OutElasticBig(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutElasticBig");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutElasticBig", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InElasticSmall
float RootMotion::Interp::InElasticSmall(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InElasticSmall");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InElasticSmall", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InElasticBig
float RootMotion::Interp::InElasticBig(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InElasticBig");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InElasticBig", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InSine
float RootMotion::Interp::InSine(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InSine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InSine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutSine
float RootMotion::Interp::OutSine(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutSine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutSine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InOutSine
float RootMotion::Interp::InOutSine(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InOutSine");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InOutSine", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InElastic
float RootMotion::Interp::InElastic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InElastic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InElastic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutElastic
float RootMotion::Interp::OutElastic(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutElastic");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutElastic", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.InBack
float RootMotion::Interp::InBack(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::InBack");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "InBack", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated method: RootMotion.Interp.OutBack
float RootMotion::Interp::OutBack(float t, float b, float c) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Interp::OutBack");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Interp", "OutBack", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(b), ::il2cpp_utils::ExtractType(c)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, b, c);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.LargeHeader
#include "RootMotion/LargeHeader.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.String name
::Il2CppString*& RootMotion::LargeHeader::dyn_name() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LargeHeader::dyn_name");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "name"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.String color
::Il2CppString*& RootMotion::LargeHeader::dyn_color() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LargeHeader::dyn_color");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "color"))->offset;
return *reinterpret_cast<::Il2CppString**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.LayerMaskExtensions
#include "RootMotion/LayerMaskExtensions.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: RootMotion.LayerMaskExtensions.Contains
bool RootMotion::LayerMaskExtensions::Contains(UnityEngine::LayerMask mask, int layer) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::Contains");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "Contains", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(mask), ::il2cpp_utils::ExtractType(layer)})));
return ::il2cpp_utils::RunMethodThrow<bool, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, mask, layer);
}
// Autogenerated method: RootMotion.LayerMaskExtensions.Create
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::Create(::Array<::Il2CppString*>* layerNames) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::Create");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "Create", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layerNames)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::LayerMask, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, layerNames);
}
// Creating initializer_list -> params proxy for: UnityEngine.LayerMask Create(params System.String[] layerNames)
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::Create(std::initializer_list<::Il2CppString*> layerNames) {
return RootMotion::LayerMaskExtensions::Create(::Array<::Il2CppString*>::New(layerNames));
}
// Autogenerated method: RootMotion.LayerMaskExtensions.Create
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::Create(::Array<int>* layerNumbers) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::Create");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "Create", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layerNumbers)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::LayerMask, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, layerNumbers);
}
// Creating initializer_list -> params proxy for: UnityEngine.LayerMask Create(params System.Int32[] layerNumbers)
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::Create(std::initializer_list<int> layerNumbers) {
return RootMotion::LayerMaskExtensions::Create(::Array<int>::New(layerNumbers));
}
// Autogenerated method: RootMotion.LayerMaskExtensions.NamesToMask
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::NamesToMask(::Array<::Il2CppString*>* layerNames) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::NamesToMask");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "NamesToMask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layerNames)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::LayerMask, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, layerNames);
}
// Creating initializer_list -> params proxy for: UnityEngine.LayerMask NamesToMask(params System.String[] layerNames)
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::NamesToMask(std::initializer_list<::Il2CppString*> layerNames) {
return RootMotion::LayerMaskExtensions::NamesToMask(::Array<::Il2CppString*>::New(layerNames));
}
// Autogenerated method: RootMotion.LayerMaskExtensions.LayerNumbersToMask
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::LayerNumbersToMask(::Array<int>* layerNumbers) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::LayerNumbersToMask");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "LayerNumbersToMask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(layerNumbers)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::LayerMask, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, layerNumbers);
}
// Creating initializer_list -> params proxy for: UnityEngine.LayerMask LayerNumbersToMask(params System.Int32[] layerNumbers)
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::LayerNumbersToMask(std::initializer_list<int> layerNumbers) {
return RootMotion::LayerMaskExtensions::LayerNumbersToMask(::Array<int>::New(layerNumbers));
}
// Autogenerated method: RootMotion.LayerMaskExtensions.Inverse
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::Inverse(UnityEngine::LayerMask original) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::Inverse");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "Inverse", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(original)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::LayerMask, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, original);
}
// Autogenerated method: RootMotion.LayerMaskExtensions.AddToMask
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::AddToMask(UnityEngine::LayerMask original, ::Array<::Il2CppString*>* layerNames) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::AddToMask");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "AddToMask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(original), ::il2cpp_utils::ExtractType(layerNames)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::LayerMask, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, original, layerNames);
}
// Creating initializer_list -> params proxy for: UnityEngine.LayerMask AddToMask(UnityEngine.LayerMask original, params System.String[] layerNames)
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::AddToMask(UnityEngine::LayerMask original, std::initializer_list<::Il2CppString*> layerNames) {
return RootMotion::LayerMaskExtensions::AddToMask(original, ::Array<::Il2CppString*>::New(layerNames));
}
// Autogenerated method: RootMotion.LayerMaskExtensions.RemoveFromMask
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::RemoveFromMask(UnityEngine::LayerMask original, ::Array<::Il2CppString*>* layerNames) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::RemoveFromMask");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "RemoveFromMask", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(original), ::il2cpp_utils::ExtractType(layerNames)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::LayerMask, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, original, layerNames);
}
// Creating initializer_list -> params proxy for: UnityEngine.LayerMask RemoveFromMask(UnityEngine.LayerMask original, params System.String[] layerNames)
UnityEngine::LayerMask RootMotion::LayerMaskExtensions::RemoveFromMask(UnityEngine::LayerMask original, std::initializer_list<::Il2CppString*> layerNames) {
return RootMotion::LayerMaskExtensions::RemoveFromMask(original, ::Array<::Il2CppString*>::New(layerNames));
}
// Autogenerated method: RootMotion.LayerMaskExtensions.MaskToNames
::Array<::Il2CppString*>* RootMotion::LayerMaskExtensions::MaskToNames(UnityEngine::LayerMask original) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::MaskToNames");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "MaskToNames", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(original)})));
return ::il2cpp_utils::RunMethodThrow<::Array<::Il2CppString*>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, original);
}
// Autogenerated method: RootMotion.LayerMaskExtensions.MaskToNumbers
::Array<int>* RootMotion::LayerMaskExtensions::MaskToNumbers(UnityEngine::LayerMask original) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::MaskToNumbers");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "MaskToNumbers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(original)})));
return ::il2cpp_utils::RunMethodThrow<::Array<int>*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, original);
}
// Autogenerated method: RootMotion.LayerMaskExtensions.MaskToString
::Il2CppString* RootMotion::LayerMaskExtensions::MaskToString(UnityEngine::LayerMask original) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::MaskToString");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "MaskToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(original)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, original);
}
// Autogenerated method: RootMotion.LayerMaskExtensions.MaskToString
::Il2CppString* RootMotion::LayerMaskExtensions::MaskToString(UnityEngine::LayerMask original, ::Il2CppString* delimiter) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::LayerMaskExtensions::MaskToString");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "LayerMaskExtensions", "MaskToString", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(original), ::il2cpp_utils::ExtractType(delimiter)})));
return ::il2cpp_utils::RunMethodThrow<::Il2CppString*, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, original, delimiter);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.QuaTools
#include "RootMotion/QuaTools.hpp"
// Including type: UnityEngine.Quaternion
#include "UnityEngine/Quaternion.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: RootMotion.QuaTools.Lerp
UnityEngine::Quaternion RootMotion::QuaTools::Lerp(UnityEngine::Quaternion fromRotation, UnityEngine::Quaternion toRotation, float weight) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::Lerp");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "Lerp", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(fromRotation), ::il2cpp_utils::ExtractType(toRotation), ::il2cpp_utils::ExtractType(weight)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, fromRotation, toRotation, weight);
}
// Autogenerated method: RootMotion.QuaTools.Slerp
UnityEngine::Quaternion RootMotion::QuaTools::Slerp(UnityEngine::Quaternion fromRotation, UnityEngine::Quaternion toRotation, float weight) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::Slerp");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "Slerp", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(fromRotation), ::il2cpp_utils::ExtractType(toRotation), ::il2cpp_utils::ExtractType(weight)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, fromRotation, toRotation, weight);
}
// Autogenerated method: RootMotion.QuaTools.LinearBlend
UnityEngine::Quaternion RootMotion::QuaTools::LinearBlend(UnityEngine::Quaternion q, float weight) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::LinearBlend");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "LinearBlend", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(q), ::il2cpp_utils::ExtractType(weight)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, q, weight);
}
// Autogenerated method: RootMotion.QuaTools.SphericalBlend
UnityEngine::Quaternion RootMotion::QuaTools::SphericalBlend(UnityEngine::Quaternion q, float weight) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::SphericalBlend");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "SphericalBlend", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(q), ::il2cpp_utils::ExtractType(weight)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, q, weight);
}
// Autogenerated method: RootMotion.QuaTools.FromToAroundAxis
UnityEngine::Quaternion RootMotion::QuaTools::FromToAroundAxis(UnityEngine::Vector3 fromDirection, UnityEngine::Vector3 toDirection, UnityEngine::Vector3 axis) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::FromToAroundAxis");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "FromToAroundAxis", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(fromDirection), ::il2cpp_utils::ExtractType(toDirection), ::il2cpp_utils::ExtractType(axis)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, fromDirection, toDirection, axis);
}
// Autogenerated method: RootMotion.QuaTools.RotationToLocalSpace
UnityEngine::Quaternion RootMotion::QuaTools::RotationToLocalSpace(UnityEngine::Quaternion space, UnityEngine::Quaternion rotation) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::RotationToLocalSpace");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "RotationToLocalSpace", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(space), ::il2cpp_utils::ExtractType(rotation)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, space, rotation);
}
// Autogenerated method: RootMotion.QuaTools.FromToRotation
UnityEngine::Quaternion RootMotion::QuaTools::FromToRotation(UnityEngine::Quaternion from, UnityEngine::Quaternion to) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::FromToRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "FromToRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(from), ::il2cpp_utils::ExtractType(to)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, from, to);
}
// Autogenerated method: RootMotion.QuaTools.GetAxis
UnityEngine::Vector3 RootMotion::QuaTools::GetAxis(UnityEngine::Vector3 v) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::GetAxis");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "GetAxis", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(v)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, v);
}
// Autogenerated method: RootMotion.QuaTools.ClampRotation
UnityEngine::Quaternion RootMotion::QuaTools::ClampRotation(UnityEngine::Quaternion rotation, float clampWeight, int clampSmoothing) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::ClampRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "ClampRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(rotation), ::il2cpp_utils::ExtractType(clampWeight), ::il2cpp_utils::ExtractType(clampSmoothing)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, rotation, clampWeight, clampSmoothing);
}
// Autogenerated method: RootMotion.QuaTools.ClampAngle
float RootMotion::QuaTools::ClampAngle(float angle, float clampWeight, int clampSmoothing) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::ClampAngle");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "ClampAngle", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(angle), ::il2cpp_utils::ExtractType(clampWeight), ::il2cpp_utils::ExtractType(clampSmoothing)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, angle, clampWeight, clampSmoothing);
}
// Autogenerated method: RootMotion.QuaTools.MatchRotation
UnityEngine::Quaternion RootMotion::QuaTools::MatchRotation(UnityEngine::Quaternion targetRotation, UnityEngine::Vector3 targetforwardAxis, UnityEngine::Vector3 targetUpAxis, UnityEngine::Vector3 forwardAxis, UnityEngine::Vector3 upAxis) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::MatchRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "MatchRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(targetRotation), ::il2cpp_utils::ExtractType(targetforwardAxis), ::il2cpp_utils::ExtractType(targetUpAxis), ::il2cpp_utils::ExtractType(forwardAxis), ::il2cpp_utils::ExtractType(upAxis)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, targetRotation, targetforwardAxis, targetUpAxis, forwardAxis, upAxis);
}
// Autogenerated method: RootMotion.QuaTools.ToBiPolar
UnityEngine::Vector3 RootMotion::QuaTools::ToBiPolar(UnityEngine::Vector3 euler) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::ToBiPolar");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "ToBiPolar", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(euler)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, euler);
}
// Autogenerated method: RootMotion.QuaTools.ToBiPolar
float RootMotion::QuaTools::ToBiPolar(float angle) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::QuaTools::ToBiPolar");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "QuaTools", "ToBiPolar", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(angle)})));
return ::il2cpp_utils::RunMethodThrow<float, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, angle);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.SolverManager
#include "RootMotion/SolverManager.hpp"
// Including type: UnityEngine.Animator
#include "UnityEngine/Animator.hpp"
// Including type: UnityEngine.Animation
#include "UnityEngine/Animation.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.Boolean fixTransforms
bool& RootMotion::SolverManager::dyn_fixTransforms() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::dyn_fixTransforms");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "fixTransforms"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Animator animator
UnityEngine::Animator*& RootMotion::SolverManager::dyn_animator() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::dyn_animator");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "animator"))->offset;
return *reinterpret_cast<UnityEngine::Animator**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Animation legacy
UnityEngine::Animation*& RootMotion::SolverManager::dyn_legacy() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::dyn_legacy");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "legacy"))->offset;
return *reinterpret_cast<UnityEngine::Animation**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean updateFrame
bool& RootMotion::SolverManager::dyn_updateFrame() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::dyn_updateFrame");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "updateFrame"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean componentInitiated
bool& RootMotion::SolverManager::dyn_componentInitiated() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::dyn_componentInitiated");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "componentInitiated"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean skipSolverUpdate
bool& RootMotion::SolverManager::dyn_skipSolverUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::dyn_skipSolverUpdate");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "skipSolverUpdate"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.SolverManager.get_animatePhysics
bool RootMotion::SolverManager::get_animatePhysics() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::get_animatePhysics");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_animatePhysics", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.get_isAnimated
bool RootMotion::SolverManager::get_isAnimated() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::get_isAnimated");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isAnimated", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.Disable
void RootMotion::SolverManager::Disable() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::Disable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Disable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.InitiateSolver
void RootMotion::SolverManager::InitiateSolver() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::InitiateSolver");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InitiateSolver", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.UpdateSolver
void RootMotion::SolverManager::UpdateSolver() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::UpdateSolver");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateSolver", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.FixTransforms
void RootMotion::SolverManager::FixTransforms() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::FixTransforms");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "FixTransforms", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.OnDisable
void RootMotion::SolverManager::OnDisable() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::OnDisable");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnDisable", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.Start
void RootMotion::SolverManager::Start() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::Start");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Start", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.Initiate
void RootMotion::SolverManager::Initiate() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::Initiate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Initiate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.Update
void RootMotion::SolverManager::Update() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.FindAnimatorRecursive
void RootMotion::SolverManager::FindAnimatorRecursive(UnityEngine::Transform* t, bool findInChildren) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::FindAnimatorRecursive");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "FindAnimatorRecursive", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(findInChildren)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, t, findInChildren);
}
// Autogenerated method: RootMotion.SolverManager.FixedUpdate
void RootMotion::SolverManager::FixedUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::FixedUpdate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "FixedUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.LateUpdate
void RootMotion::SolverManager::LateUpdate() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::LateUpdate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LateUpdate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.SolverManager.UpdateSolverExternal
void RootMotion::SolverManager::UpdateSolverExternal() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::SolverManager::UpdateSolverExternal");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateSolverExternal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.TriggerEventBroadcaster
#include "RootMotion/TriggerEventBroadcaster.hpp"
// Including type: UnityEngine.GameObject
#include "UnityEngine/GameObject.hpp"
// Including type: UnityEngine.Collider
#include "UnityEngine/Collider.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.GameObject target
UnityEngine::GameObject*& RootMotion::TriggerEventBroadcaster::dyn_target() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::TriggerEventBroadcaster::dyn_target");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "target"))->offset;
return *reinterpret_cast<UnityEngine::GameObject**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.TriggerEventBroadcaster.OnTriggerEnter
void RootMotion::TriggerEventBroadcaster::OnTriggerEnter(UnityEngine::Collider* collider) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::TriggerEventBroadcaster::OnTriggerEnter");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnTriggerEnter", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(collider)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, collider);
}
// Autogenerated method: RootMotion.TriggerEventBroadcaster.OnTriggerStay
void RootMotion::TriggerEventBroadcaster::OnTriggerStay(UnityEngine::Collider* collider) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::TriggerEventBroadcaster::OnTriggerStay");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnTriggerStay", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(collider)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, collider);
}
// Autogenerated method: RootMotion.TriggerEventBroadcaster.OnTriggerExit
void RootMotion::TriggerEventBroadcaster::OnTriggerExit(UnityEngine::Collider* collider) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::TriggerEventBroadcaster::OnTriggerExit");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OnTriggerExit", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(collider)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, collider);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.V3Tools
#include "RootMotion/V3Tools.hpp"
// Including type: UnityEngine.Vector3
#include "UnityEngine/Vector3.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: RootMotion.V3Tools.Lerp
UnityEngine::Vector3 RootMotion::V3Tools::Lerp(UnityEngine::Vector3 fromVector, UnityEngine::Vector3 toVector, float weight) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::V3Tools::Lerp");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "V3Tools", "Lerp", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(fromVector), ::il2cpp_utils::ExtractType(toVector), ::il2cpp_utils::ExtractType(weight)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, fromVector, toVector, weight);
}
// Autogenerated method: RootMotion.V3Tools.Slerp
UnityEngine::Vector3 RootMotion::V3Tools::Slerp(UnityEngine::Vector3 fromVector, UnityEngine::Vector3 toVector, float weight) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::V3Tools::Slerp");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "V3Tools", "Slerp", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(fromVector), ::il2cpp_utils::ExtractType(toVector), ::il2cpp_utils::ExtractType(weight)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, fromVector, toVector, weight);
}
// Autogenerated method: RootMotion.V3Tools.ExtractVertical
UnityEngine::Vector3 RootMotion::V3Tools::ExtractVertical(UnityEngine::Vector3 v, UnityEngine::Vector3 verticalAxis, float weight) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::V3Tools::ExtractVertical");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "V3Tools", "ExtractVertical", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(v), ::il2cpp_utils::ExtractType(verticalAxis), ::il2cpp_utils::ExtractType(weight)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, v, verticalAxis, weight);
}
// Autogenerated method: RootMotion.V3Tools.ExtractHorizontal
UnityEngine::Vector3 RootMotion::V3Tools::ExtractHorizontal(UnityEngine::Vector3 v, UnityEngine::Vector3 normal, float weight) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::V3Tools::ExtractHorizontal");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "V3Tools", "ExtractHorizontal", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(v), ::il2cpp_utils::ExtractType(normal), ::il2cpp_utils::ExtractType(weight)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, v, normal, weight);
}
// Autogenerated method: RootMotion.V3Tools.ClampDirection
UnityEngine::Vector3 RootMotion::V3Tools::ClampDirection(UnityEngine::Vector3 direction, UnityEngine::Vector3 normalDirection, float clampWeight, int clampSmoothing) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::V3Tools::ClampDirection");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "V3Tools", "ClampDirection", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(direction), ::il2cpp_utils::ExtractType(normalDirection), ::il2cpp_utils::ExtractType(clampWeight), ::il2cpp_utils::ExtractType(clampSmoothing)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, direction, normalDirection, clampWeight, clampSmoothing);
}
// Autogenerated method: RootMotion.V3Tools.ClampDirection
UnityEngine::Vector3 RootMotion::V3Tools::ClampDirection(UnityEngine::Vector3 direction, UnityEngine::Vector3 normalDirection, float clampWeight, int clampSmoothing, ByRef<bool> changed) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::V3Tools::ClampDirection");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "V3Tools", "ClampDirection", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(direction), ::il2cpp_utils::ExtractType(normalDirection), ::il2cpp_utils::ExtractType(clampWeight), ::il2cpp_utils::ExtractType(clampSmoothing), ::il2cpp_utils::ExtractIndependentType<bool&>()})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, direction, normalDirection, clampWeight, clampSmoothing, byref(changed));
}
// Autogenerated method: RootMotion.V3Tools.ClampDirection
UnityEngine::Vector3 RootMotion::V3Tools::ClampDirection(UnityEngine::Vector3 direction, UnityEngine::Vector3 normalDirection, float clampWeight, int clampSmoothing, ByRef<float> clampValue) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::V3Tools::ClampDirection");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "V3Tools", "ClampDirection", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(direction), ::il2cpp_utils::ExtractType(normalDirection), ::il2cpp_utils::ExtractType(clampWeight), ::il2cpp_utils::ExtractType(clampSmoothing), ::il2cpp_utils::ExtractIndependentType<float&>()})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, direction, normalDirection, clampWeight, clampSmoothing, byref(clampValue));
}
// Autogenerated method: RootMotion.V3Tools.LineToPlane
UnityEngine::Vector3 RootMotion::V3Tools::LineToPlane(UnityEngine::Vector3 origin, UnityEngine::Vector3 direction, UnityEngine::Vector3 planeNormal, UnityEngine::Vector3 planePoint) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::V3Tools::LineToPlane");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "V3Tools", "LineToPlane", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(origin), ::il2cpp_utils::ExtractType(direction), ::il2cpp_utils::ExtractType(planeNormal), ::il2cpp_utils::ExtractType(planePoint)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, origin, direction, planeNormal, planePoint);
}
// Autogenerated method: RootMotion.V3Tools.PointToPlane
UnityEngine::Vector3 RootMotion::V3Tools::PointToPlane(UnityEngine::Vector3 point, UnityEngine::Vector3 planePosition, UnityEngine::Vector3 planeNormal) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::V3Tools::PointToPlane");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "V3Tools", "PointToPlane", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(point), ::il2cpp_utils::ExtractType(planePosition), ::il2cpp_utils::ExtractType(planeNormal)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, point, planePosition, planeNormal);
}
// Autogenerated method: RootMotion.V3Tools.TransformPointUnscaled
UnityEngine::Vector3 RootMotion::V3Tools::TransformPointUnscaled(UnityEngine::Transform* t, UnityEngine::Vector3 point) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::V3Tools::TransformPointUnscaled");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "V3Tools", "TransformPointUnscaled", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(point)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, point);
}
// Autogenerated method: RootMotion.V3Tools.InverseTransformPointUnscaled
UnityEngine::Vector3 RootMotion::V3Tools::InverseTransformPointUnscaled(UnityEngine::Transform* t, UnityEngine::Vector3 point) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::V3Tools::InverseTransformPointUnscaled");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "V3Tools", "InverseTransformPointUnscaled", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(t), ::il2cpp_utils::ExtractType(point)})));
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, t, point);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.Warning
#include "RootMotion/Warning.hpp"
// Including type: RootMotion.Warning/RootMotion.Logger
#include "RootMotion/Warning_Logger.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public System.Boolean logged
bool RootMotion::Warning::_get_logged() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Warning::_get_logged");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<bool>("RootMotion", "Warning", "logged"));
}
// Autogenerated static field setter
// Set static field: static public System.Boolean logged
void RootMotion::Warning::_set_logged(bool value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Warning::_set_logged");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion", "Warning", "logged", value));
}
// Autogenerated method: RootMotion.Warning.Log
void RootMotion::Warning::Log(::Il2CppString* message, RootMotion::Warning::Logger* logger, bool logInEditMode) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Warning::Log");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Warning", "Log", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(message), ::il2cpp_utils::ExtractType(logger), ::il2cpp_utils::ExtractType(logInEditMode)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, message, logger, logInEditMode);
}
// Autogenerated method: RootMotion.Warning.Log
void RootMotion::Warning::Log(::Il2CppString* message, UnityEngine::Transform* context, bool logInEditMode) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Warning::Log");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod("RootMotion", "Warning", "Log", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(message), ::il2cpp_utils::ExtractType(context), ::il2cpp_utils::ExtractType(logInEditMode)})));
::il2cpp_utils::RunMethodThrow<void, false>(static_cast<Il2CppClass*>(nullptr), ___internal__method, message, context, logInEditMode);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.Warning/RootMotion.Logger
#include "RootMotion/Warning_Logger.hpp"
// Including type: System.IAsyncResult
#include "System/IAsyncResult.hpp"
// Including type: System.AsyncCallback
#include "System/AsyncCallback.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated method: RootMotion.Warning/RootMotion.Logger.Invoke
void RootMotion::Warning::Logger::Invoke(::Il2CppString* message) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Warning::Logger::Invoke");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Invoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(message)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, message);
}
// Autogenerated method: RootMotion.Warning/RootMotion.Logger.BeginInvoke
System::IAsyncResult* RootMotion::Warning::Logger::BeginInvoke(::Il2CppString* message, System::AsyncCallback* callback, ::Il2CppObject* object) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Warning::Logger::BeginInvoke");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "BeginInvoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(message), ::il2cpp_utils::ExtractType(callback), ::il2cpp_utils::ExtractType(object)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<System::IAsyncResult*, false>(___instance_arg, ___internal__method, message, callback, object);
}
// Autogenerated method: RootMotion.Warning/RootMotion.Logger.EndInvoke
void RootMotion::Warning::Logger::EndInvoke(System::IAsyncResult* result) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Warning::Logger::EndInvoke");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "EndInvoke", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(result)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, result);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.Demos.Navigator
#include "RootMotion/Demos/Navigator.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
// Including type: UnityEngine.AI.NavMeshPath
#include "UnityEngine/AI/NavMeshPath.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public System.Boolean activeTargetSeeking
bool& RootMotion::Demos::Navigator::dyn_activeTargetSeeking() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_activeTargetSeeking");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "activeTargetSeeking"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single cornerRadius
float& RootMotion::Demos::Navigator::dyn_cornerRadius() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_cornerRadius");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "cornerRadius"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single recalculateOnPathDistance
float& RootMotion::Demos::Navigator::dyn_recalculateOnPathDistance() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_recalculateOnPathDistance");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "recalculateOnPathDistance"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single maxSampleDistance
float& RootMotion::Demos::Navigator::dyn_maxSampleDistance() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_maxSampleDistance");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "maxSampleDistance"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single nextPathInterval
float& RootMotion::Demos::Navigator::dyn_nextPathInterval() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_nextPathInterval");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "nextPathInterval"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 <normalizedDeltaPosition>k__BackingField
UnityEngine::Vector3& RootMotion::Demos::Navigator::dyn_$normalizedDeltaPosition$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_$normalizedDeltaPosition$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<normalizedDeltaPosition>k__BackingField"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private RootMotion.Demos.Navigator/RootMotion.Demos.State <state>k__BackingField
RootMotion::Demos::Navigator::State& RootMotion::Demos::Navigator::dyn_$state$k__BackingField() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_$state$k__BackingField");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "<state>k__BackingField"))->offset;
return *reinterpret_cast<RootMotion::Demos::Navigator::State*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Transform transform
UnityEngine::Transform*& RootMotion::Demos::Navigator::dyn_transform() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_transform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "transform"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Int32 cornerIndex
int& RootMotion::Demos::Navigator::dyn_cornerIndex() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_cornerIndex");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "cornerIndex"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3[] corners
::Array<UnityEngine::Vector3>*& RootMotion::Demos::Navigator::dyn_corners() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_corners");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "corners"))->offset;
return *reinterpret_cast<::Array<UnityEngine::Vector3>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.AI.NavMeshPath path
UnityEngine::AI::NavMeshPath*& RootMotion::Demos::Navigator::dyn_path() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_path");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "path"))->offset;
return *reinterpret_cast<UnityEngine::AI::NavMeshPath**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 lastTargetPosition
UnityEngine::Vector3& RootMotion::Demos::Navigator::dyn_lastTargetPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_lastTargetPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "lastTargetPosition"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean initiated
bool& RootMotion::Demos::Navigator::dyn_initiated() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_initiated");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "initiated"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Single nextPathTime
float& RootMotion::Demos::Navigator::dyn_nextPathTime() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::dyn_nextPathTime");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "nextPathTime"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.Demos.Navigator.get_normalizedDeltaPosition
UnityEngine::Vector3 RootMotion::Demos::Navigator::get_normalizedDeltaPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::get_normalizedDeltaPosition");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_normalizedDeltaPosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Demos.Navigator.set_normalizedDeltaPosition
void RootMotion::Demos::Navigator::set_normalizedDeltaPosition(UnityEngine::Vector3 value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::set_normalizedDeltaPosition");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_normalizedDeltaPosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, value);
}
// Autogenerated method: RootMotion.Demos.Navigator.get_state
RootMotion::Demos::Navigator::State RootMotion::Demos::Navigator::get_state() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::get_state");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_state", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<RootMotion::Demos::Navigator::State, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Demos.Navigator.set_state
void RootMotion::Demos::Navigator::set_state(RootMotion::Demos::Navigator::State value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::set_state");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "set_state", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(value)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, value);
}
// Autogenerated method: RootMotion.Demos.Navigator.Initiate
void RootMotion::Demos::Navigator::Initiate(UnityEngine::Transform* transform) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::Initiate");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Initiate", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(transform)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, transform);
}
// Autogenerated method: RootMotion.Demos.Navigator.Update
void RootMotion::Demos::Navigator::Update(UnityEngine::Vector3 targetPosition) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::Update");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Update", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(targetPosition)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, targetPosition);
}
// Autogenerated method: RootMotion.Demos.Navigator.CalculatePath
void RootMotion::Demos::Navigator::CalculatePath(UnityEngine::Vector3 targetPosition) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::CalculatePath");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "CalculatePath", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(targetPosition)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, targetPosition);
}
// Autogenerated method: RootMotion.Demos.Navigator.Find
bool RootMotion::Demos::Navigator::Find(UnityEngine::Vector3 targetPosition) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::Find");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Find", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(targetPosition)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method, targetPosition);
}
// Autogenerated method: RootMotion.Demos.Navigator.Stop
void RootMotion::Demos::Navigator::Stop() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::Stop");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Stop", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.Demos.Navigator.HorDistance
float RootMotion::Demos::Navigator::HorDistance(UnityEngine::Vector3 p1, UnityEngine::Vector3 p2) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::HorDistance");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "HorDistance", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(p1), ::il2cpp_utils::ExtractType(p2)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<float, false>(___instance_arg, ___internal__method, p1, p2);
}
// Autogenerated method: RootMotion.Demos.Navigator.Visualize
void RootMotion::Demos::Navigator::Visualize() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::Visualize");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "Visualize", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.Demos.Navigator/RootMotion.Demos.State
#include "RootMotion/Demos/Navigator.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated static field getter
// Get static field: static public RootMotion.Demos.Navigator/RootMotion.Demos.State Idle
RootMotion::Demos::Navigator::State RootMotion::Demos::Navigator::State::_get_Idle() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::State::_get_Idle");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::Demos::Navigator::State>("RootMotion.Demos", "Navigator/State", "Idle"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.Demos.Navigator/RootMotion.Demos.State Idle
void RootMotion::Demos::Navigator::State::_set_Idle(RootMotion::Demos::Navigator::State value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::State::_set_Idle");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion.Demos", "Navigator/State", "Idle", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.Demos.Navigator/RootMotion.Demos.State Seeking
RootMotion::Demos::Navigator::State RootMotion::Demos::Navigator::State::_get_Seeking() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::State::_get_Seeking");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::Demos::Navigator::State>("RootMotion.Demos", "Navigator/State", "Seeking"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.Demos.Navigator/RootMotion.Demos.State Seeking
void RootMotion::Demos::Navigator::State::_set_Seeking(RootMotion::Demos::Navigator::State value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::State::_set_Seeking");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion.Demos", "Navigator/State", "Seeking", value));
}
// Autogenerated static field getter
// Get static field: static public RootMotion.Demos.Navigator/RootMotion.Demos.State OnPath
RootMotion::Demos::Navigator::State RootMotion::Demos::Navigator::State::_get_OnPath() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::State::_get_OnPath");
return THROW_UNLESS(il2cpp_utils::GetFieldValue<RootMotion::Demos::Navigator::State>("RootMotion.Demos", "Navigator/State", "OnPath"));
}
// Autogenerated static field setter
// Set static field: static public RootMotion.Demos.Navigator/RootMotion.Demos.State OnPath
void RootMotion::Demos::Navigator::State::_set_OnPath(RootMotion::Demos::Navigator::State value) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::State::_set_OnPath");
THROW_UNLESS(il2cpp_utils::SetFieldValue("RootMotion.Demos", "Navigator/State", "OnPath", value));
}
// Autogenerated instance field getter
// Get instance field: public System.Int32 value__
int& RootMotion::Demos::Navigator::State::dyn_value__() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::Demos::Navigator::State::dyn_value__");
auto ___internal__instance = *this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "value__"))->offset;
return *reinterpret_cast<int*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.FinalIK.BipedIK
#include "RootMotion/FinalIK/BipedIK.hpp"
// Including type: RootMotion.BipedReferences
#include "RootMotion/BipedReferences.hpp"
// Including type: RootMotion.FinalIK.BipedIKSolvers
#include "RootMotion/FinalIK/BipedIKSolvers.hpp"
// Including type: UnityEngine.AvatarIKGoal
#include "UnityEngine/AvatarIKGoal.hpp"
// Including type: RootMotion.FinalIK.IKSolverLimb
#include "RootMotion/FinalIK/IKSolverLimb.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public RootMotion.BipedReferences references
RootMotion::BipedReferences*& RootMotion::FinalIK::BipedIK::dyn_references() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::dyn_references");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "references"))->offset;
return *reinterpret_cast<RootMotion::BipedReferences**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.FinalIK.BipedIKSolvers solvers
RootMotion::FinalIK::BipedIKSolvers*& RootMotion::FinalIK::BipedIK::dyn_solvers() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::dyn_solvers");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "solvers"))->offset;
return *reinterpret_cast<RootMotion::FinalIK::BipedIKSolvers**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.OpenUserManual
void RootMotion::FinalIK::BipedIK::OpenUserManual() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::OpenUserManual");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OpenUserManual", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.OpenScriptReference
void RootMotion::FinalIK::BipedIK::OpenScriptReference() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::OpenScriptReference");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "OpenScriptReference", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.SupportGroup
void RootMotion::FinalIK::BipedIK::SupportGroup() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::SupportGroup");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SupportGroup", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.ASThread
void RootMotion::FinalIK::BipedIK::ASThread() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::ASThread");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "ASThread", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.GetIKPositionWeight
float RootMotion::FinalIK::BipedIK::GetIKPositionWeight(UnityEngine::AvatarIKGoal goal) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::GetIKPositionWeight");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetIKPositionWeight", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(goal)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<float, false>(___instance_arg, ___internal__method, goal);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.GetIKRotationWeight
float RootMotion::FinalIK::BipedIK::GetIKRotationWeight(UnityEngine::AvatarIKGoal goal) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::GetIKRotationWeight");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetIKRotationWeight", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(goal)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<float, false>(___instance_arg, ___internal__method, goal);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.SetIKPositionWeight
void RootMotion::FinalIK::BipedIK::SetIKPositionWeight(UnityEngine::AvatarIKGoal goal, float weight) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::SetIKPositionWeight");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetIKPositionWeight", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(goal), ::il2cpp_utils::ExtractType(weight)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, goal, weight);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.SetIKRotationWeight
void RootMotion::FinalIK::BipedIK::SetIKRotationWeight(UnityEngine::AvatarIKGoal goal, float weight) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::SetIKRotationWeight");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetIKRotationWeight", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(goal), ::il2cpp_utils::ExtractType(weight)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, goal, weight);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.SetIKPosition
void RootMotion::FinalIK::BipedIK::SetIKPosition(UnityEngine::AvatarIKGoal goal, UnityEngine::Vector3 IKPosition) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::SetIKPosition");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetIKPosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(goal), ::il2cpp_utils::ExtractType(IKPosition)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, goal, IKPosition);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.SetIKRotation
void RootMotion::FinalIK::BipedIK::SetIKRotation(UnityEngine::AvatarIKGoal goal, UnityEngine::Quaternion IKRotation) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::SetIKRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetIKRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(goal), ::il2cpp_utils::ExtractType(IKRotation)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, goal, IKRotation);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.GetIKPosition
UnityEngine::Vector3 RootMotion::FinalIK::BipedIK::GetIKPosition(UnityEngine::AvatarIKGoal goal) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::GetIKPosition");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetIKPosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(goal)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Vector3, false>(___instance_arg, ___internal__method, goal);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.GetIKRotation
UnityEngine::Quaternion RootMotion::FinalIK::BipedIK::GetIKRotation(UnityEngine::AvatarIKGoal goal) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::GetIKRotation");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetIKRotation", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(goal)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<UnityEngine::Quaternion, false>(___instance_arg, ___internal__method, goal);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.SetLookAtWeight
void RootMotion::FinalIK::BipedIK::SetLookAtWeight(float weight, float bodyWeight, float headWeight, float eyesWeight, float clampWeight, float clampWeightHead, float clampWeightEyes) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::SetLookAtWeight");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetLookAtWeight", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(weight), ::il2cpp_utils::ExtractType(bodyWeight), ::il2cpp_utils::ExtractType(headWeight), ::il2cpp_utils::ExtractType(eyesWeight), ::il2cpp_utils::ExtractType(clampWeight), ::il2cpp_utils::ExtractType(clampWeightHead), ::il2cpp_utils::ExtractType(clampWeightEyes)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, weight, bodyWeight, headWeight, eyesWeight, clampWeight, clampWeightHead, clampWeightEyes);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.SetLookAtPosition
void RootMotion::FinalIK::BipedIK::SetLookAtPosition(UnityEngine::Vector3 lookAtPosition) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::SetLookAtPosition");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetLookAtPosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(lookAtPosition)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, lookAtPosition);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.SetSpinePosition
void RootMotion::FinalIK::BipedIK::SetSpinePosition(UnityEngine::Vector3 spinePosition) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::SetSpinePosition");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetSpinePosition", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(spinePosition)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, spinePosition);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.SetSpineWeight
void RootMotion::FinalIK::BipedIK::SetSpineWeight(float weight) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::SetSpineWeight");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetSpineWeight", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(weight)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, weight);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.GetGoalIK
RootMotion::FinalIK::IKSolverLimb* RootMotion::FinalIK::BipedIK::GetGoalIK(UnityEngine::AvatarIKGoal goal) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::GetGoalIK");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "GetGoalIK", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(goal)})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<RootMotion::FinalIK::IKSolverLimb*, false>(___instance_arg, ___internal__method, goal);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.InitiateBipedIK
void RootMotion::FinalIK::BipedIK::InitiateBipedIK() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::InitiateBipedIK");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InitiateBipedIK", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.UpdateBipedIK
void RootMotion::FinalIK::BipedIK::UpdateBipedIK() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::UpdateBipedIK");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateBipedIK", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.SetToDefaults
void RootMotion::FinalIK::BipedIK::SetToDefaults() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::SetToDefaults");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "SetToDefaults", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.LogWarning
void RootMotion::FinalIK::BipedIK::LogWarning(::Il2CppString* message) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::LogWarning");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "LogWarning", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(message)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, message);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.FixTransforms
void RootMotion::FinalIK::BipedIK::FixTransforms() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::FixTransforms");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "FixTransforms", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.InitiateSolver
void RootMotion::FinalIK::BipedIK::InitiateSolver() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::InitiateSolver");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "InitiateSolver", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.BipedIK.UpdateSolver
void RootMotion::FinalIK::BipedIK::UpdateSolver() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIK::UpdateSolver");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateSolver", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
#include "extern/beatsaber-hook/shared/utils/typedefs.h"
// Including type: RootMotion.FinalIK.BipedIKSolvers
#include "RootMotion/FinalIK/BipedIKSolvers.hpp"
// Including type: RootMotion.FinalIK.IKSolverLimb
#include "RootMotion/FinalIK/IKSolverLimb.hpp"
// Including type: RootMotion.FinalIK.IKSolverFABRIK
#include "RootMotion/FinalIK/IKSolverFABRIK.hpp"
// Including type: RootMotion.FinalIK.IKSolverLookAt
#include "RootMotion/FinalIK/IKSolverLookAt.hpp"
// Including type: RootMotion.FinalIK.IKSolverAim
#include "RootMotion/FinalIK/IKSolverAim.hpp"
// Including type: RootMotion.FinalIK.Constraints
#include "RootMotion/FinalIK/Constraints.hpp"
// Including type: RootMotion.FinalIK.IKSolver
#include "RootMotion/FinalIK/IKSolver.hpp"
// Including type: RootMotion.BipedReferences
#include "RootMotion/BipedReferences.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public RootMotion.FinalIK.IKSolverLimb leftFoot
RootMotion::FinalIK::IKSolverLimb*& RootMotion::FinalIK::BipedIKSolvers::dyn_leftFoot() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::dyn_leftFoot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftFoot"))->offset;
return *reinterpret_cast<RootMotion::FinalIK::IKSolverLimb**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.FinalIK.IKSolverLimb rightFoot
RootMotion::FinalIK::IKSolverLimb*& RootMotion::FinalIK::BipedIKSolvers::dyn_rightFoot() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::dyn_rightFoot");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightFoot"))->offset;
return *reinterpret_cast<RootMotion::FinalIK::IKSolverLimb**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.FinalIK.IKSolverLimb leftHand
RootMotion::FinalIK::IKSolverLimb*& RootMotion::FinalIK::BipedIKSolvers::dyn_leftHand() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::dyn_leftHand");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "leftHand"))->offset;
return *reinterpret_cast<RootMotion::FinalIK::IKSolverLimb**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.FinalIK.IKSolverLimb rightHand
RootMotion::FinalIK::IKSolverLimb*& RootMotion::FinalIK::BipedIKSolvers::dyn_rightHand() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::dyn_rightHand");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rightHand"))->offset;
return *reinterpret_cast<RootMotion::FinalIK::IKSolverLimb**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.FinalIK.IKSolverFABRIK spine
RootMotion::FinalIK::IKSolverFABRIK*& RootMotion::FinalIK::BipedIKSolvers::dyn_spine() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::dyn_spine");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "spine"))->offset;
return *reinterpret_cast<RootMotion::FinalIK::IKSolverFABRIK**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.FinalIK.IKSolverLookAt lookAt
RootMotion::FinalIK::IKSolverLookAt*& RootMotion::FinalIK::BipedIKSolvers::dyn_lookAt() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::dyn_lookAt");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "lookAt"))->offset;
return *reinterpret_cast<RootMotion::FinalIK::IKSolverLookAt**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.FinalIK.IKSolverAim aim
RootMotion::FinalIK::IKSolverAim*& RootMotion::FinalIK::BipedIKSolvers::dyn_aim() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::dyn_aim");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "aim"))->offset;
return *reinterpret_cast<RootMotion::FinalIK::IKSolverAim**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public RootMotion.FinalIK.Constraints pelvis
RootMotion::FinalIK::Constraints*& RootMotion::FinalIK::BipedIKSolvers::dyn_pelvis() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::dyn_pelvis");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "pelvis"))->offset;
return *reinterpret_cast<RootMotion::FinalIK::Constraints**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private RootMotion.FinalIK.IKSolverLimb[] _limbs
::Array<RootMotion::FinalIK::IKSolverLimb*>*& RootMotion::FinalIK::BipedIKSolvers::dyn__limbs() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::dyn__limbs");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_limbs"))->offset;
return *reinterpret_cast<::Array<RootMotion::FinalIK::IKSolverLimb*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private RootMotion.FinalIK.IKSolver[] _ikSolvers
::Array<RootMotion::FinalIK::IKSolver*>*& RootMotion::FinalIK::BipedIKSolvers::dyn__ikSolvers() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::dyn__ikSolvers");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "_ikSolvers"))->offset;
return *reinterpret_cast<::Array<RootMotion::FinalIK::IKSolver*>**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.FinalIK.BipedIKSolvers.get_limbs
::Array<RootMotion::FinalIK::IKSolverLimb*>* RootMotion::FinalIK::BipedIKSolvers::get_limbs() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::get_limbs");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_limbs", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Array<RootMotion::FinalIK::IKSolverLimb*>*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.BipedIKSolvers.get_ikSolvers
::Array<RootMotion::FinalIK::IKSolver*>* RootMotion::FinalIK::BipedIKSolvers::get_ikSolvers() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::get_ikSolvers");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_ikSolvers", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<::Array<RootMotion::FinalIK::IKSolver*>*, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.BipedIKSolvers.AssignReferences
void RootMotion::FinalIK::BipedIKSolvers::AssignReferences(RootMotion::BipedReferences* references) {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::BipedIKSolvers::AssignReferences");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "AssignReferences", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{::il2cpp_utils::ExtractType(references)})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method, references);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.FinalIK.Constraint
#include "RootMotion/FinalIK/Constraint.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Transform transform
UnityEngine::Transform*& RootMotion::FinalIK::Constraint::dyn_transform() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::Constraint::dyn_transform");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "transform"))->offset;
return *reinterpret_cast<UnityEngine::Transform**>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: public System.Single weight
float& RootMotion::FinalIK::Constraint::dyn_weight() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::Constraint::dyn_weight");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "weight"))->offset;
return *reinterpret_cast<float*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.FinalIK.Constraint.get_isValid
bool RootMotion::FinalIK::Constraint::get_isValid() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::Constraint::get_isValid");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_isValid", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.Constraint.UpdateConstraint
void RootMotion::FinalIK::Constraint::UpdateConstraint() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::Constraint::UpdateConstraint");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateConstraint", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.FinalIK.ConstraintPosition
#include "RootMotion/FinalIK/ConstraintPosition.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 position
UnityEngine::Vector3& RootMotion::FinalIK::ConstraintPosition::dyn_position() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::ConstraintPosition::dyn_position");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "position"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.FinalIK.ConstraintPosition.UpdateConstraint
void RootMotion::FinalIK::ConstraintPosition::UpdateConstraint() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::ConstraintPosition::UpdateConstraint");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateConstraint", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.FinalIK.ConstraintPositionOffset
#include "RootMotion/FinalIK/ConstraintPositionOffset.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Vector3 offset
UnityEngine::Vector3& RootMotion::FinalIK::ConstraintPositionOffset::dyn_offset() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::ConstraintPositionOffset::dyn_offset");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "offset"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 defaultLocalPosition
UnityEngine::Vector3& RootMotion::FinalIK::ConstraintPositionOffset::dyn_defaultLocalPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::ConstraintPositionOffset::dyn_defaultLocalPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "defaultLocalPosition"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private UnityEngine.Vector3 lastLocalPosition
UnityEngine::Vector3& RootMotion::FinalIK::ConstraintPositionOffset::dyn_lastLocalPosition() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::ConstraintPositionOffset::dyn_lastLocalPosition");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "lastLocalPosition"))->offset;
return *reinterpret_cast<UnityEngine::Vector3*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated instance field getter
// Get instance field: private System.Boolean initiated
bool& RootMotion::FinalIK::ConstraintPositionOffset::dyn_initiated() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::ConstraintPositionOffset::dyn_initiated");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "initiated"))->offset;
return *reinterpret_cast<bool*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.FinalIK.ConstraintPositionOffset.get_positionChanged
bool RootMotion::FinalIK::ConstraintPositionOffset::get_positionChanged() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::ConstraintPositionOffset::get_positionChanged");
static auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "get_positionChanged", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
return ::il2cpp_utils::RunMethodThrow<bool, false>(___instance_arg, ___internal__method);
}
// Autogenerated method: RootMotion.FinalIK.ConstraintPositionOffset.UpdateConstraint
void RootMotion::FinalIK::ConstraintPositionOffset::UpdateConstraint() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::ConstraintPositionOffset::UpdateConstraint");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateConstraint", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
// Autogenerated from CppSourceCreator
// Created by Sc2ad
// =========================================================================
// Begin includes
// Including type: RootMotion.FinalIK.ConstraintRotation
#include "RootMotion/FinalIK/ConstraintRotation.hpp"
// Including type: UnityEngine.Transform
#include "UnityEngine/Transform.hpp"
#include "extern/beatsaber-hook/shared/utils/il2cpp-utils.hpp"
#include "extern/beatsaber-hook/shared/utils/utils.h"
// Completed includes
// Autogenerated instance field getter
// Get instance field: public UnityEngine.Quaternion rotation
UnityEngine::Quaternion& RootMotion::FinalIK::ConstraintRotation::dyn_rotation() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::ConstraintRotation::dyn_rotation");
auto ___internal__instance = this;
static auto ___internal__field__offset = THROW_UNLESS(il2cpp_utils::FindField(___internal__instance, "rotation"))->offset;
return *reinterpret_cast<UnityEngine::Quaternion*>(reinterpret_cast<char*>(this) + ___internal__field__offset);
}
// Autogenerated method: RootMotion.FinalIK.ConstraintRotation.UpdateConstraint
void RootMotion::FinalIK::ConstraintRotation::UpdateConstraint() {
static auto ___internal__logger = ::Logger::get().WithContext("RootMotion::FinalIK::ConstraintRotation::UpdateConstraint");
auto* ___internal__method = THROW_UNLESS((::il2cpp_utils::FindMethod(this, "UpdateConstraint", std::vector<Il2CppClass*>{}, ::std::vector<const Il2CppType*>{})));
auto ___instance_arg = this;
::il2cpp_utils::RunMethodThrow<void, false>(___instance_arg, ___internal__method);
}
| 79.905093 | 463 | 0.77089 | [
"object",
"vector",
"transform"
] |
13319fa50719b53d2bdcb480eb1db3ddfa1f7ddf | 4,245 | cpp | C++ | src/Matlab/mex_compile/regularisers_GPU/PatchSelect_GPU.cpp | vais-ral/CCPi-FISTA_Reconstruction | 3c9ae36ac8e492d1c47142c808a8b643a16961c6 | [
"Apache-2.0"
] | 34 | 2018-07-30T21:42:45.000Z | 2021-11-18T06:01:19.000Z | src/Matlab/mex_compile/regularisers_GPU/PatchSelect_GPU.cpp | vais-ral/CCPi-FISTA_Reconstruction | 3c9ae36ac8e492d1c47142c808a8b643a16961c6 | [
"Apache-2.0"
] | 77 | 2018-05-02T14:59:49.000Z | 2021-11-19T11:55:17.000Z | src/Matlab/mex_compile/regularisers_GPU/PatchSelect_GPU.cpp | vais-ral/CCPi-FISTA_Reconstruction | 3c9ae36ac8e492d1c47142c808a8b643a16961c6 | [
"Apache-2.0"
] | 19 | 2018-11-13T20:30:16.000Z | 2021-11-02T18:12:09.000Z | /*
* This work is part of the Core Imaging Library developed by
* Visual Analytics and Imaging System Group of the Science Technology
* Facilities Council, STFC and Diamond Light Source Ltd.
*
* Copyright 2017 Daniil Kazantsev
* Copyright 2017 Srikanth Nagella, Edoardo Pasca
* Copyright 2018 Diamond Light Source 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.
*/
#include "matrix.h"
#include "mex.h"
#include "PatchSelect_GPU_core.h"
/* CUDA implementation of non-local weight pre-calculation for non-local priors
* Weights and associated indices are stored into pre-allocated arrays and passed
* to the regulariser
*
*
* Input Parameters:
* 1. 2D/3D grayscale image/volume
* 2. Searching window (half-size of the main bigger searching window, e.g. 11)
* 3. Similarity window (half-size of the patch window, e.g. 2)
* 4. The number of neighbours to take (the most prominent after sorting neighbours will be taken)
* 5. noise-related parameter to calculate non-local weights
*
* Output [2D]:
* 1. AR_i - indeces of i neighbours
* 2. AR_j - indeces of j neighbours
* 3. Weights_ij - associated weights
*
* Output [3D]:
* 1. AR_i - indeces of i neighbours
* 2. AR_j - indeces of j neighbours
* 3. AR_k - indeces of j neighbours
* 4. Weights_ijk - associated weights
*/
/**************************************************/
void mexFunction(
int nlhs, mxArray *plhs[],
int nrhs, const mxArray *prhs[])
{
int number_of_dims, SearchWindow, SimilarWin, NumNeighb;
mwSize dimX, dimY, dimZ;
const mwSize *dim_array;
unsigned short *H_i=NULL, *H_j=NULL, *H_k=NULL;
float *A, *Weights = NULL, h;
mwSize dim_array2[3]; /* for 2D data */
mwSize dim_array3[4]; /* for 3D data */
dim_array = mxGetDimensions(prhs[0]);
number_of_dims = mxGetNumberOfDimensions(prhs[0]);
/*Handling Matlab input data*/
A = (float *) mxGetData(prhs[0]); /* a 2D or 3D image/volume */
SearchWindow = (int) mxGetScalar(prhs[1]); /* Large Searching window */
SimilarWin = (int) mxGetScalar(prhs[2]); /* Similarity window (patch-search)*/
NumNeighb = (int) mxGetScalar(prhs[3]); /* the total number of neighbours to take */
h = (float) mxGetScalar(prhs[4]); /* NLM parameter */
dimX = dim_array[0]; dimY = dim_array[1]; dimZ = dim_array[2];
dim_array2[0] = dimX; dim_array2[1] = dimY; dim_array2[2] = NumNeighb; /* 2D case */
dim_array3[0] = dimX; dim_array3[1] = dimY; dim_array3[2] = dimZ; dim_array3[3] = NumNeighb; /* 3D case */
/****************2D INPUT ***************/
if (number_of_dims == 2) {
dimZ = 0;
H_i = (unsigned short*)mxGetPr(plhs[0] = mxCreateNumericArray(3, dim_array2, mxUINT16_CLASS, mxREAL));
H_j = (unsigned short*)mxGetPr(plhs[1] = mxCreateNumericArray(3, dim_array2, mxUINT16_CLASS, mxREAL));
Weights = (float*)mxGetPr(plhs[2] = mxCreateNumericArray(3, dim_array2, mxSINGLE_CLASS, mxREAL));
}
/****************3D INPUT ***************/
if (number_of_dims == 3) {
/*
H_i = (unsigned short*)mxGetPr(plhs[0] = mxCreateNumericArray(4, dim_array3, mxUINT16_CLASS, mxREAL));
H_j = (unsigned short*)mxGetPr(plhs[1] = mxCreateNumericArray(4, dim_array3, mxUINT16_CLASS, mxREAL));
H_k = (unsigned short*)mxGetPr(plhs[2] = mxCreateNumericArray(4, dim_array3, mxUINT16_CLASS, mxREAL));
Weights = (float*)mxGetPr(plhs[3] = mxCreateNumericArray(4, dim_array3, mxSINGLE_CLASS, mxREAL));
*/
mexErrMsgTxt("3D version is not yet supported");
}
PatchSelect_GPU_main(A, H_i, H_j, Weights, (long)(dimX), (long)(dimY), SearchWindow, SimilarWin, NumNeighb, h);
}
| 44.684211 | 124 | 0.659835 | [
"3d"
] |
1334ef0d84fb7b7823dfbd964ea809a7f49502bd | 6,357 | cc | C++ | RecoPPS/Local/src/RPixDetClusterizer.cc | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 6 | 2017-09-08T14:12:56.000Z | 2022-03-09T23:57:01.000Z | RecoPPS/Local/src/RPixDetClusterizer.cc | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 545 | 2017-09-19T17:10:19.000Z | 2022-03-07T16:55:27.000Z | RecoPPS/Local/src/RPixDetClusterizer.cc | SWuchterl/cmssw | 769b4a7ef81796579af7d626da6039dfa0347b8e | [
"Apache-2.0"
] | 14 | 2017-10-04T09:47:21.000Z | 2019-10-23T18:04:45.000Z | #include <iostream>
#include "FWCore/Utilities/interface/Exception.h"
#include "RecoPPS/Local/interface/RPixDetClusterizer.h"
namespace {
constexpr int maxCol = CTPPSPixelCluster::MAXCOL;
constexpr int maxRow = CTPPSPixelCluster::MAXROW;
constexpr double highRangeCal = 1800.;
constexpr double lowRangeCal = 260.;
} // namespace
RPixDetClusterizer::RPixDetClusterizer(edm::ParameterSet const &conf) : params_(conf), SeedVector_(0) {
verbosity_ = conf.getUntrackedParameter<int>("RPixVerbosity");
SeedADCThreshold_ = conf.getParameter<int>("SeedADCThreshold");
ADCThreshold_ = conf.getParameter<int>("ADCThreshold");
ElectronADCGain_ = conf.getParameter<double>("ElectronADCGain");
VcaltoElectronGain_ = conf.getParameter<int>("VCaltoElectronGain");
VcaltoElectronOffset_ = conf.getParameter<int>("VCaltoElectronOffset");
doSingleCalibration_ = conf.getParameter<bool>("doSingleCalibration");
}
RPixDetClusterizer::~RPixDetClusterizer() {}
void RPixDetClusterizer::buildClusters(unsigned int detId,
const std::vector<CTPPSPixelDigi> &digi,
std::vector<CTPPSPixelCluster> &clusters,
const CTPPSPixelGainCalibrations *pcalibrations,
const CTPPSPixelAnalysisMask *maskera) {
std::map<uint32_t, CTPPSPixelROCAnalysisMask> const &mask = maskera->analysisMask;
std::map<uint32_t, CTPPSPixelROCAnalysisMask>::const_iterator mask_it = mask.find(detId);
std::set<std::pair<unsigned char, unsigned char> > maskedPixels;
if (mask_it != mask.end())
maskedPixels = mask_it->second.maskedPixels;
if (verbosity_)
edm::LogInfo("RPixDetClusterizer") << detId << " received digi.size()=" << digi.size();
// creating a set of CTPPSPixelDigi's and fill it
rpix_digi_set_.clear();
rpix_digi_set_.insert(digi.begin(), digi.end());
SeedVector_.clear();
// calibrate digis here
calib_rpix_digi_map_.clear();
for (auto const &RPdit : rpix_digi_set_) {
uint8_t row = RPdit.row();
uint8_t column = RPdit.column();
if (row > maxRow || column > maxCol)
throw cms::Exception("CTPPSDigiOutofRange") << " row = " << row << " column = " << column;
std::pair<unsigned char, unsigned char> pixel = std::make_pair(row, column);
unsigned short adc = RPdit.adc();
unsigned short electrons = 0;
// check if pixel is noisy or dead (i.e. in the mask)
const bool is_in = maskedPixels.find(pixel) != maskedPixels.end();
if (!is_in) {
//calibrate digi and store the new ones
electrons = calibrate(detId, adc, row, column, pcalibrations);
if (electrons < SeedADCThreshold_ * ElectronADCGain_)
electrons = SeedADCThreshold_ * ElectronADCGain_;
RPixCalibDigi calibDigi(row, column, adc, electrons);
unsigned int index = column * maxRow + row;
calib_rpix_digi_map_.insert(std::pair<unsigned int, RPixCalibDigi>(index, calibDigi));
SeedVector_.push_back(calibDigi);
}
}
if (verbosity_)
edm::LogInfo("RPixDetClusterizer") << " RPix set size = " << calib_rpix_digi_map_.size();
for (auto SeedIt : SeedVector_) {
make_cluster(SeedIt, clusters);
}
}
void RPixDetClusterizer::make_cluster(RPixCalibDigi const &aSeed, std::vector<CTPPSPixelCluster> &clusters) {
/// check if seed already used
unsigned int seedIndex = aSeed.column() * maxRow + aSeed.row();
if (calib_rpix_digi_map_.find(seedIndex) == calib_rpix_digi_map_.end()) {
return;
}
// creating a temporary cluster
RPixTempCluster atempCluster;
// filling the cluster with the seed
atempCluster.addPixel(aSeed.row(), aSeed.column(), aSeed.electrons());
calib_rpix_digi_map_.erase(seedIndex);
while (!atempCluster.empty()) {
//This is the standard algorithm to find and add a pixel
auto curInd = atempCluster.top();
atempCluster.pop();
for (auto c = std::max(0, int(atempCluster.col[curInd]) - 1);
c < std::min(int(atempCluster.col[curInd]) + 2, maxCol);
++c) {
for (auto r = std::max(0, int(atempCluster.row[curInd]) - 1);
r < std::min(int(atempCluster.row[curInd]) + 2, maxRow);
++r) {
unsigned int currIndex = c * maxRow + r;
if (calib_rpix_digi_map_.find(currIndex) != calib_rpix_digi_map_.end()) {
if (!atempCluster.addPixel(r, c, calib_rpix_digi_map_[currIndex].electrons())) {
CTPPSPixelCluster acluster(atempCluster.isize, atempCluster.adc, atempCluster.row, atempCluster.col);
clusters.push_back(acluster);
return;
}
calib_rpix_digi_map_.erase(currIndex);
}
}
}
} // while accretion
CTPPSPixelCluster cluster(atempCluster.isize, atempCluster.adc, atempCluster.row, atempCluster.col);
clusters.push_back(cluster);
}
int RPixDetClusterizer::calibrate(
unsigned int detId, int adc, int row, int col, const CTPPSPixelGainCalibrations *pcalibrations) {
float gain = 0;
float pedestal = 0;
int electrons = 0;
if (!doSingleCalibration_) {
const CTPPSPixelGainCalibration &DetCalibs = pcalibrations->getGainCalibration(detId);
if (DetCalibs.getDetId() != 0) {
gain = DetCalibs.getGain(col, row) * highRangeCal / lowRangeCal;
pedestal = DetCalibs.getPed(col, row);
float vcal = (adc - pedestal) * gain;
electrons = int(vcal * VcaltoElectronGain_ + VcaltoElectronOffset_);
} else {
gain = ElectronADCGain_;
pedestal = 0;
electrons = int(adc * gain - pedestal);
}
if (verbosity_)
edm::LogInfo("RPixCalibration") << "calibrate: adc = " << adc << " electrons = " << electrons
<< " gain = " << gain << " pedestal = " << pedestal;
} else {
gain = ElectronADCGain_;
pedestal = 0;
electrons = int(adc * gain - pedestal);
if (verbosity_)
edm::LogInfo("RPixCalibration") << "calibrate: adc = " << adc << " electrons = " << electrons
<< " ElectronADCGain = " << gain << " pedestal = " << pedestal;
}
if (electrons < 0) {
edm::LogInfo("RPixCalibration") << "RPixDetClusterizer::calibrate: *** electrons < 0 *** --> " << electrons
<< " --> electrons = 0";
electrons = 0;
}
return electrons;
}
| 39.73125 | 113 | 0.654397 | [
"vector"
] |
133508b59549fd08933db29c4292f30c5ab556fa | 724 | cpp | C++ | Week 6/id_400/LeetCode_36_400.cpp | larryRishi/algorithm004-05 | e60d0b1176acd32a9184b215e36d4122ba0b6263 | [
"Apache-2.0"
] | 1 | 2019-10-12T06:48:45.000Z | 2019-10-12T06:48:45.000Z | Week 6/id_400/LeetCode_36_400.cpp | larryRishi/algorithm004-05 | e60d0b1176acd32a9184b215e36d4122ba0b6263 | [
"Apache-2.0"
] | 1 | 2019-12-01T10:02:03.000Z | 2019-12-01T10:02:03.000Z | Week 6/id_400/LeetCode_36_400.cpp | larryRishi/algorithm004-05 | e60d0b1176acd32a9184b215e36d4122ba0b6263 | [
"Apache-2.0"
] | null | null | null | class Solution {
public:
bool isValidSudoku(vector<vector<char>>& board) {
vector<unordered_set<int>> row(9), col(9), block(9);
for (int i = 0; i < board.size(); i++) {
for (int j = 0; j < board[0].size(); j++) {
int cur = board[i][j];
int index = (i / 3) * 3 + j / 3;
if (cur == '.') {
continue;
}
if (row[i].count(cur) || col[j].count(cur) || block[index].count(cur)) {
return false;
}
row[i].insert(cur);
col[j].insert(cur);
block[index].insert(cur);
}
}
return true;
}
};
| 31.478261 | 88 | 0.388122 | [
"vector"
] |
1337499f9642d9e5f1a30700c2e4db2226bc4278 | 1,351 | hpp | C++ | src/KeyCombo.hpp | abitrolly/Hawck | a1b6ca18fbc020265419217cbbbf51cfe3f50a0e | [
"BSD-2-Clause"
] | 320 | 2018-08-28T14:49:53.000Z | 2022-03-31T05:26:11.000Z | src/KeyCombo.hpp | abitrolly/Hawck | a1b6ca18fbc020265419217cbbbf51cfe3f50a0e | [
"BSD-2-Clause"
] | 69 | 2018-08-28T15:11:29.000Z | 2022-03-14T20:58:28.000Z | src/KeyCombo.hpp | abitrolly/Hawck | a1b6ca18fbc020265419217cbbbf51cfe3f50a0e | [
"BSD-2-Clause"
] | 22 | 2019-08-12T19:31:27.000Z | 2021-12-04T10:39:50.000Z | #pragma once
#include <vector>
#include <limits.h>
#include <assert.h>
#include "KBDAction.hpp"
#include "KeyValue.hpp"
#include <iostream>
struct KeyCombo {
std::vector<int> key_seq;
int activator;
int num_seq;
inline KeyCombo(const std::vector<int>& seq) noexcept {
assert(seq.size() < INT_MAX);
key_seq = seq;
activator = key_seq[key_seq.size() - 1];
key_seq.pop_back();
}
inline bool check(const KBDAction &action) noexcept {
if (action.ev.value == KEY_VAL_REPEAT)
return false;
if (num_seq == ((int) key_seq.size()) && action.ev.code == activator &&
action.ev.value == KEY_VAL_DOWN)
{
num_seq = 0;
return true;
}
for (auto k : key_seq) {
if (k == action.ev.code) {
num_seq += (action.ev.value == KEY_VAL_DOWN) ? 1 : -1;
break;
}
}
if (num_seq < 0)
num_seq = 0;
return false;
}
};
struct KeyComboToggle : public KeyCombo {
bool active = false;
inline KeyComboToggle(const std::vector<int>& seq) noexcept
: KeyCombo(seq) {}
inline bool check(const KBDAction& action) noexcept {
if (KeyCombo::check(action))
active = !active;
return active;
}
};
| 23.293103 | 79 | 0.545522 | [
"vector"
] |
13391c58b104367974add69762ed0c5e3b1134e0 | 94,142 | cpp | C++ | pxr/usdImaging/usdImaging/pointInstancerAdapter.cpp | yurivict/USD | 3b097e3ba8fabf1777a1256e241ea15df83f3065 | [
"Apache-2.0"
] | 1 | 2021-09-25T12:49:37.000Z | 2021-09-25T12:49:37.000Z | pxr/usdImaging/usdImaging/pointInstancerAdapter.cpp | yurivict/USD | 3b097e3ba8fabf1777a1256e241ea15df83f3065 | [
"Apache-2.0"
] | null | null | null | pxr/usdImaging/usdImaging/pointInstancerAdapter.cpp | yurivict/USD | 3b097e3ba8fabf1777a1256e241ea15df83f3065 | [
"Apache-2.0"
] | 1 | 2018-10-03T19:08:33.000Z | 2018-10-03T19:08:33.000Z | //
// Copyright 2016 Pixar
//
// Licensed under the Apache License, Version 2.0 (the "Apache License")
// with the following modification; you may not use this file except in
// compliance with the Apache License and the following modification to it:
// Section 6. Trademarks. is deleted and replaced with:
//
// 6. Trademarks. This License does not grant permission to use the trade
// names, trademarks, service marks, or product names of the Licensor
// and its affiliates, except as required to comply with Section 4(c) of
// the License and to reproduce the content of the NOTICE file.
//
// You may obtain a copy of the Apache License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the Apache License with the above modification is
// distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the Apache License for the specific
// language governing permissions and limitations under the Apache License.
//
#include "pxr/usdImaging/usdImaging/pointInstancerAdapter.h"
#include "pxr/usdImaging/usdImaging/debugCodes.h"
#include "pxr/usdImaging/usdImaging/delegate.h"
#include "pxr/usdImaging/usdImaging/debugCodes.h"
#include "pxr/usdImaging/usdImaging/indexProxy.h"
#include "pxr/usdImaging/usdImaging/instancerContext.h"
#include "pxr/usdImaging/usdImaging/tokens.h"
#include "pxr/usdImaging/usdImaging/version.h"
#include "pxr/imaging/hd/perfLog.h"
#include "pxr/imaging/hd/renderIndex.h"
#include "pxr/usd/sdf/schema.h"
#include "pxr/usd/usd/primRange.h"
#include "pxr/usd/usdGeom/imageable.h"
#include "pxr/usd/usdGeom/pointInstancer.h"
#include "pxr/usd/usdGeom/primvarsAPI.h"
#include "pxr/usd/usdGeom/tokens.h"
#include "pxr/usd/usdGeom/xformable.h"
#include "pxr/base/tf/staticTokens.h"
#include "pxr/base/tf/stringUtils.h"
#include "pxr/base/tf/type.h"
#include "pxr/base/gf/quath.h"
#include <limits>
#include <atomic>
PXR_NAMESPACE_OPEN_SCOPE
// XXX: These should come from Hd or UsdImaging
TF_DEFINE_PRIVATE_TOKENS(
_tokens,
(instance)
(instancer)
(rotate)
(scale)
(translate)
);
TF_REGISTRY_FUNCTION(TfType)
{
typedef UsdImagingPointInstancerAdapter Adapter;
TfType t = TfType::Define<Adapter, TfType::Bases<Adapter::BaseAdapter> >();
t.SetFactory< UsdImagingPrimAdapterFactory<Adapter> >();
}
UsdImagingPointInstancerAdapter::~UsdImagingPointInstancerAdapter()
{
}
bool
UsdImagingPointInstancerAdapter::ShouldCullChildren() const
{
return true;
}
bool
UsdImagingPointInstancerAdapter::IsInstancerAdapter() const
{
return true;
}
SdfPath
UsdImagingPointInstancerAdapter::Populate(UsdPrim const& prim,
UsdImagingIndexProxy* index,
UsdImagingInstancerContext const* instancerContext)
{
return _Populate(prim, index, instancerContext);
}
SdfPath
UsdImagingPointInstancerAdapter::_Populate(UsdPrim const& prim,
UsdImagingIndexProxy* index,
UsdImagingInstancerContext const* instancerContext)
{
SdfPath const& parentInstancerCachePath =
instancerContext ? instancerContext->instancerCachePath : SdfPath();
SdfPath instancerCachePath = prim.GetPath();
UsdGeomPointInstancer inst(prim);
if (!inst) {
TF_WARN("Invalid instancer prim <%s>, instancer scheme was not valid\n",
instancerCachePath.GetText());
return SdfPath();
}
// for the case we happen to process the same instancer more than once,
// use variant selection path to make a unique index path (e.g. NI-PI)
if (_instancerData.find(instancerCachePath) != _instancerData.end()) {
static std::atomic_int ctr(0);
std::string name = TfStringify(++ctr);
instancerCachePath = instancerCachePath.AppendVariantSelection(
"instance",name);
}
// ---------------------------------------------------------------------- //
// Init instancer and fetch authored data needed to drive population
// ---------------------------------------------------------------------- //
// Get the prototype target paths. These paths target subgraphs that are to
// be instanced. As a result, a single path here may result in many rprims
// for a single declared "prototype".
SdfPathVector usdProtoPaths;
UsdRelationship protosRel = inst.GetPrototypesRel();
if (!protosRel.GetForwardedTargets(&usdProtoPaths)) {
TF_WARN("Point instancer %s does not have a valid 'prototypes' "
"relationship. Not adding it to the render index."
, instancerCachePath.GetText());
return SdfPath();
}
// protoIndices is a required property; it is allowed to be empty if
// time-varying data is provided via protoIndices.timeSamples. we only
// check for its definition since USD doesn't have a cheap mechanism to
// check if an attribute has data
UsdAttribute protoIndicesAttr = inst.GetProtoIndicesAttr();
if (!protoIndicesAttr.HasValue()) {
TF_WARN("Point instancer %s does not have a 'protoIndices'"
"attribute. Not adding it to the render index.",
instancerCachePath.GetText());
return SdfPath();
}
// positions is a required property; it is allowed to be empty if
// time-varying data is provided via positions.timeSamples. we only
// check for its definition since USD doesn't have a cheap mechanism to
// check if an attribute has data
UsdAttribute positionsAttr = inst.GetPositionsAttr();
if (!positionsAttr.HasValue()) {
TF_WARN("Point instancer %s does not have a 'positions' attribute. "
"Not adding it to the render index.",
instancerCachePath.GetText());
return SdfPath();
}
// Erase any data that we may have accumulated for a previous instancer at
// the same path (given that we should get a PrimResync notice before
// population, perhaps this is unnecessary?).
if (!TF_VERIFY(_instancerData.find(instancerCachePath)
== _instancerData.end(), "<%s>\n",
instancerCachePath.GetText())) {
_UnloadInstancer(instancerCachePath, index);
}
// Init instancer data for this point instancer.
_InstancerData& instrData = _instancerData[instancerCachePath];
// myself. we want to grab PI adapter even if the PI itself is NI
// so that the children are bound to the PI adapter.
UsdImagingPrimAdapterSharedPtr instancerAdapter
= _GetPrimAdapter(prim, /*ignoreInstancing=*/true);
// PERFORMANCE: We may allocate more pools than are actually used, so if
// we're squeezing memory in the future, we could be a little more efficient
// here.
instrData.prototypePaths.resize(usdProtoPaths.size());
instrData.prototypePathIndices.clear();
instrData.visible = true;
instrData.variableVisibility = true;
instrData.parentInstancerCachePath = parentInstancerCachePath;
instrData.visibleTime = std::numeric_limits<double>::infinity();
TF_DEBUG(USDIMAGING_INSTANCER)
.Msg("[Add PI] %s, parentInstancerCachePath <%s>\n",
instancerCachePath.GetText(), parentInstancerCachePath.GetText());
// Need to use GetAbsoluteRootOrPrimPath() on instancerCachePath to drop
// {instance=X} from the path, so usd can find the prim.
index->InsertInstancer(
instancerCachePath,
_GetPrim(instancerCachePath.GetAbsoluteRootOrPrimPath()),
instancerContext ? instancerContext->instancerAdapter
: UsdImagingPrimAdapterSharedPtr());
// ---------------------------------------------------------------------- //
// Main Prototype allocation loop.
// ---------------------------------------------------------------------- //
// Iterate over all prototypes to allocate the Rprims in the Hydra
// RenderIndex.
size_t prototypeCount = instrData.prototypePaths.size();
// For each prototype, allocate the Rprims.
for (size_t protoIndex = 0; protoIndex < prototypeCount; ++protoIndex) {
// -------------------------------------------------------------- //
// Initialize this prototype.
// -------------------------------------------------------------- //
const SdfPath & prototypePath = usdProtoPaths[protoIndex];
instrData.prototypePaths[protoIndex] = prototypePath;
instrData.prototypePathIndices[prototypePath] = protoIndex;
UsdPrim protoRootPrim = _GetPrim(instrData.prototypePaths[protoIndex]);
if (!protoRootPrim) {
TF_WARN("Targeted prototype was not found <%s>\n",
instrData.prototypePaths[protoIndex].GetText());
continue;
}
// -------------------------------------------------------------- //
// Traverse the subtree and allocate the Rprims
// -------------------------------------------------------------- //
UsdImagingInstancerContext ctx = { instancerCachePath,
/*childName=*/TfToken(),
SdfPath(),
TfToken(),
TfToken(),
instancerAdapter};
_PopulatePrototype(protoIndex, instrData, protoRootPrim, index, &ctx);
}
return instancerCachePath;
}
void
UsdImagingPointInstancerAdapter::_PopulatePrototype(
int protoIndex,
_InstancerData& instrData,
UsdPrim const& protoRootPrim,
UsdImagingIndexProxy* index,
UsdImagingInstancerContext const *instancerContext)
{
int protoID = 0;
size_t primCount = 0;
size_t instantiatedPrimCount = 0;
std::vector<UsdPrimRange> treeStack;
treeStack.push_back(
UsdPrimRange(protoRootPrim, _GetDisplayPredicateForPrototypes()));
while (!treeStack.empty()) {
if (!treeStack.back()) {
treeStack.pop_back();
if (!treeStack.empty() && treeStack.back()) {
// whenever we push a new tree iterator, we leave the
// last one un-incremented intentionally so we have the
// residual path. That also means that whenever we pop,
// must increment the last iterator.
treeStack.back().increment_begin();
}
if (treeStack.empty() || !treeStack.back()) {
continue;
}
}
UsdPrimRange &range = treeStack.back();
UsdPrimRange::iterator iter = range.begin();
// If we encounter native instances, continue traversing inside them.
// XXX: Should we delegate to instanceAdapter here?
if (iter->IsInstance()) {
UsdPrim prototype = iter->GetPrototype();
UsdPrimRange prototypeRange(
prototype, _GetDisplayPredicateForPrototypes());
treeStack.push_back(prototypeRange);
// Make sure to register a dependency on this instancer with the
// parent PI.
index->AddDependency(instancerContext->instancerCachePath, *iter);
continue;
}
// construct instance chain
// note: paths is stored in the backward of treeStack
// (prototype, prototype, ... , instance path)
// to get the UsdPrim, use paths.front()
//
// for example:
//
// ProtoCube <----+
// +-- cube | (native instance)
// ProtoA | <--+
// +-- ProtoCube--+ | (native instance)
// PointInstancer |
// +-- ProtoA ----------+
//
// paths =
// /__Prototype_1/cube
// /__Prototype_2/ProtoCube
// /PointInstancer/ProtoA
SdfPathVector instancerChain;
for (int i = treeStack.size()-1; i >= 0; i--) {
instancerChain.push_back(treeStack[i].front().GetPath());
}
// make sure instancerChain is not empty
TF_VERIFY(instancerChain.size() > 0);
// _GetPrimAdapter requires the instance proxy prim path, so:
UsdPrim instanceProxyPrim = _GetPrim(_GetPrimPathFromInstancerChain(
instancerChain));
if (!instanceProxyPrim) {
range.set_begin(++iter);
continue;
}
// Skip population of non-imageable prims.
if (UsdImagingPrimAdapter::ShouldCullSubtree(instanceProxyPrim)) {
TF_DEBUG(USDIMAGING_INSTANCER).Msg("[Instance PI] Discovery of new "
"prims at or below <%s> pruned by prim type (%s)\n",
iter->GetPath().GetText(), iter->GetTypeName().GetText());
iter.PruneChildren();
range.set_begin(++iter);
continue;
}
UsdImagingPrimAdapterSharedPtr adapter =
_GetPrimAdapter(instanceProxyPrim, /* ignoreInstancing = */ true);
// Usd prohibits directly instancing gprims so if the current prim is
// an instance and has an adapter, warn and skip the prim. Prim types
// (such as cards) that can be directly instanced can opt out of this
// via CanPopulateUsdInstance().
if (instanceProxyPrim.IsInstance() && adapter &&
!adapter->CanPopulateUsdInstance()) {
TF_WARN("The gprim at path <%s> was directly instanced. "
"In order to instance this prim, put the prim under an "
"Xform, and instance the Xform parent.",
iter->GetPath().GetText());
range.set_begin(++iter);
continue;
}
if (adapter) {
primCount++;
//
// prototype allocation.
//
SdfPath protoPath;
if (adapter->IsInstancerAdapter()) {
// if the prim is handled by some kind of multiplexing adapter
// (e.g. another nested PointInstancer)
// we'll relocate its children to itself, then no longer need to
// traverse for this instancer.
//
// note that this condition should be tested after IsInstance()
// above, since UsdImagingInstanceAdapter also returns true for
// IsInstancerAdapter but it could be instancing something else.
UsdImagingInstancerContext ctx = {
instancerContext->instancerCachePath,
instancerContext->childName,
instancerContext->instancerMaterialUsdPath,
instancerContext->instanceDrawMode,
instancerContext->instanceInheritablePurpose,
UsdImagingPrimAdapterSharedPtr() };
protoPath = adapter->Populate(*iter, index, &ctx);
} else {
TfToken protoName(
TfStringPrintf(
"proto%d_%s_id%d", protoIndex,
iter->GetPath().GetName().c_str(), protoID++));
UsdPrim populatePrim = *iter;
if (iter->IsPrototype() &&
TF_VERIFY(instancerChain.size() > 1)) {
populatePrim = _GetPrim(instancerChain.at(1));
}
SdfPath const& materialId = GetMaterialUsdPath(instanceProxyPrim);
TfToken const& drawMode = GetModelDrawMode(instanceProxyPrim);
TfToken const& inheritablePurpose =
GetInheritablePurpose(instanceProxyPrim);
UsdImagingInstancerContext ctx = {
instancerContext->instancerCachePath,
/*childName=*/protoName,
materialId,
drawMode,
inheritablePurpose,
instancerContext->instancerAdapter };
protoPath = adapter->Populate(populatePrim, index, &ctx);
}
if (adapter->ShouldCullChildren()) {
iter.PruneChildren();
}
if (protoPath.IsEmpty()) {
// Dont track this prototype if it wasn't actually
// added.
range.set_begin(++iter);
continue;
}
TF_DEBUG(USDIMAGING_INSTANCER).Msg(
"[Add Instance PI] <%s> %s\n",
instancerContext->instancerCachePath.GetText(),
protoPath.GetText());
//
// Update instancer data.
//
_ProtoPrim& proto = instrData.protoPrimMap[protoPath];
proto.adapter = adapter;
proto.protoRootPath = instrData.prototypePaths[protoIndex];
proto.paths = instancerChain;
// Book keeping, for debugging.
instantiatedPrimCount++;
}
range.set_begin(++iter);
}
TF_DEBUG(USDIMAGING_POINT_INSTANCER_PROTO_CREATED).Msg(
"Prototype[%d]: <%s>, primCount: %lu, instantiatedPrimCount: %lu\n",
protoIndex,
protoRootPrim.GetPath().GetText(),
primCount,
instantiatedPrimCount);
}
void
UsdImagingPointInstancerAdapter::TrackVariability(UsdPrim const& prim,
SdfPath const& cachePath,
HdDirtyBits* timeVaryingBits,
UsdImagingInstancerContext const*
instancerContext) const
{
// XXX: This is no good: if an attribute has exactly one time sample, the
// default value will get cached and never updated. However, if we use an
// arbitrary time here, attributes which have valid default values and 1
// time sample will get cached with the wrong result. The solution is to
// stop guessing about what time to read, which will be done in a future
// change, which requires a much larger structure change to UsdImaging.
//
// Here we choose to favor correctness of the time sample, since we must
// ensure the correct image is produced for final render.
UsdTimeCode time(1.0);
if (IsChildPath(cachePath)) {
_ProtoPrim& proto =
const_cast<_ProtoPrim&>(_GetProtoPrim(prim.GetPath(), cachePath));
if (!TF_VERIFY(proto.adapter, "%s", cachePath.GetText())) {
return;
}
if (!TF_VERIFY(proto.paths.size() > 0, "%s", cachePath.GetText())) {
return;
}
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
proto.adapter->TrackVariability(protoPrim, cachePath,
&proto.variabilityBits);
*timeVaryingBits |= proto.variabilityBits;
if (!(proto.variabilityBits & HdChangeTracker::DirtyVisibility)) {
// Pre-cache visibility, because we now know that it is static for
// the populated prototype over all time. protoPrim may be across
// an instance boundary from protoRootPrim, so compute visibility
// for each prototype subtree, and then for the final path relative
// to the proto root.
UsdPrim protoRootPrim = _GetPrim(proto.protoRootPath);
for (size_t i = 0; i < proto.paths.size()-1; ++i) {
_ComputeProtoVisibility(
_GetPrim(proto.paths[i+1]).GetPrototype(),
_GetPrim(proto.paths[i+0]),
time, &proto.visible);
}
_ComputeProtoVisibility(protoRootPrim, _GetPrim(proto.paths.back()),
time, &proto.visible);
}
// XXX: We handle PI visibility by pushing it onto the prototype;
// we should fix this.
_IsVarying(prim,
UsdGeomTokens->visibility,
HdChangeTracker::DirtyVisibility,
UsdImagingTokens->usdVaryingVisibility,
timeVaryingBits,
true);
return;
} else if (_InstancerData const* instrData =
TfMapLookupPtr(_instancerData, cachePath)) {
// Mark instance indices as time varying if any of the following is
// time varying : protoIndices, invisibleIds
_IsVarying(prim,
UsdGeomTokens->invisibleIds,
HdChangeTracker::DirtyInstanceIndex,
_tokens->instancer,
timeVaryingBits,
false) || _IsVarying(prim,
UsdGeomTokens->protoIndices,
HdChangeTracker::DirtyInstanceIndex,
_tokens->instancer,
timeVaryingBits,
false);
// this is for instancer transform.
_IsTransformVarying(prim,
HdChangeTracker::DirtyTransform,
UsdImagingTokens->usdVaryingXform,
timeVaryingBits);
// instancer visibility
HdDirtyBits visBits;
if (!_IsVarying(prim,
UsdGeomTokens->visibility,
HdChangeTracker::DirtyVisibility,
UsdImagingTokens->usdVaryingVisibility,
&visBits,
true))
{
// When the instancer visibility doesn't vary over time, pre-cache
// visibility to avoid fetching it on frame change.
// XXX: The usage of _GetTimeWithOffset here is super-sketch, but
// it avoids blowing up the inherited visibility cache...
// We should let this be initialized by the first UpdateForTime...
instrData->visible = _GetInstancerVisible(cachePath,
_GetTimeWithOffset(0.0));
instrData->variableVisibility = false;
} else {
instrData->variableVisibility = true;
}
// Check per-instance transform primvars
_IsVarying(prim,
UsdGeomTokens->positions,
HdChangeTracker::DirtyPrimvar,
_tokens->instancer,
timeVaryingBits,
false) ||
_IsVarying(prim,
UsdGeomTokens->orientations,
HdChangeTracker::DirtyPrimvar,
_tokens->instancer,
timeVaryingBits,
false) ||
_IsVarying(prim,
UsdGeomTokens->scales,
HdChangeTracker::DirtyPrimvar,
_tokens->instancer,
timeVaryingBits,
false);
if (!(*timeVaryingBits & HdChangeTracker::DirtyPrimvar)) {
UsdGeomPrimvarsAPI primvars(prim);
for (auto const &pv: primvars.GetPrimvarsWithValues()) {
TfToken const& interp = pv.GetInterpolation();
if (interp != UsdGeomTokens->constant &&
interp != UsdGeomTokens->uniform &&
pv.ValueMightBeTimeVarying()) {
*timeVaryingBits |= HdChangeTracker::DirtyPrimvar;
HD_PERF_COUNTER_INCR(_tokens->instancer);
break;
}
}
}
}
}
void
UsdImagingPointInstancerAdapter::UpdateForTime(UsdPrim const& prim,
SdfPath const& cachePath,
UsdTimeCode time,
HdDirtyBits requestedBits,
UsdImagingInstancerContext const*
instancerContext) const
{
UsdImagingPrimvarDescCache* primvarDescCache = _GetPrimvarDescCache();
if (IsChildPath(cachePath)) {
// Allow the prototype's adapter to update, if there's anything left
// to do.
if (requestedBits != HdChangeTracker::Clean) {
// cachePath : /path/instancerPath.proto_*
// instancerPath : /path/instancerPath
SdfPath instancerPath = cachePath.GetParentPath();
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
if (!TF_VERIFY(proto.adapter, "%s", cachePath.GetText())) {
return;
}
if (!TF_VERIFY(proto.paths.size() > 0, "%s", cachePath.GetText())) {
return;
}
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
proto.adapter->UpdateForTime(
protoPrim, cachePath, time, requestedBits);
}
} else if (_instancerData.find(cachePath) != _instancerData.end()) {
// For the instancer itself, we only send translate, rotate and scale
// back as primvars, which all fall into the DirtyPrimvar bucket
// currently.
if (requestedBits & HdChangeTracker::DirtyPrimvar) {
UsdGeomPointInstancer instancer(prim);
HdPrimvarDescriptorVector& vPrimvars =
primvarDescCache->GetPrimvars(cachePath);
// PERFORMANCE: It would be nice to track variability of individual
// primvars separately, since uniform values will needlessly be
// sent to the GPU on every frame.
VtVec3fArray positions;
if (instancer.GetPositionsAttr().Get(&positions, time)) {
_MergePrimvar(
&vPrimvars,
_tokens->translate,
HdInterpolationInstance,
HdPrimvarRoleTokens->vector);
}
VtQuathArray orientations;
if (instancer.GetOrientationsAttr().Get(&orientations, time)) {
_MergePrimvar(
&vPrimvars,
_tokens->rotate,
HdInterpolationInstance);
}
VtVec3fArray scales;
if (instancer.GetScalesAttr().Get(&scales, time)) {
_MergePrimvar(
&vPrimvars,
_tokens->scale,
HdInterpolationInstance);
}
// Convert non-constant primvars on UsdGeomPointInstancer
// into instance-rate primvars. Note: this only gets local primvars.
// Inherited primvars don't vary per-instance, so we let the
// prototypes pick them up.
UsdGeomPrimvarsAPI primvars(instancer);
for (auto const &pv: primvars.GetPrimvarsWithValues()) {
TfToken const& interp = pv.GetInterpolation();
if (interp != UsdGeomTokens->constant &&
interp != UsdGeomTokens->uniform) {
HdInterpolation interp = HdInterpolationInstance;
_ComputeAndMergePrimvar(prim, pv, time, &vPrimvars, &interp);
}
}
}
}
}
HdDirtyBits
UsdImagingPointInstancerAdapter::ProcessPropertyChange(UsdPrim const& prim,
SdfPath const& cachePath,
TfToken const& propertyName)
{
if (IsChildPath(cachePath)) {
_ProtoPrim const& proto = _GetProtoPrim(prim.GetPath(), cachePath);
if (!proto.adapter || (proto.paths.size() <= 0)) {
// It's possible we'll get multiple USD edits for the same
// prototype, one of which will cause a resync. On resync,
// we immediately remove the instancer data, but primInfo
// deletion is deferred until the end of the edit batch.
// That means, if GetProtoPrim fails we've already
// queued the prototype for resync and we can safely
// return clean (no-work).
return HdChangeTracker::Clean;
}
UsdPrim protoUsdPrim = _GetProtoUsdPrim(proto);
if (!protoUsdPrim) {
// It's possible that we will get a property change that was
// actually directed at a parent primitive for an inherited
// primvar. We need to verify that the prototype UsdPrim still
// exists, as it may have been deactivated or otherwise removed,
// in which case we can return clean (no-work).
return HdChangeTracker::Clean;
}
// XXX: Specifically disallow visibility and transform updates: in
// these cases, it's hard to tell which prims we should dirty but
// probably we need to dirty both prototype & instancer. This is a
// project for later. In the meantime, returning AllDirty causes
// a re-sync.
HdDirtyBits dirtyBits = proto.adapter->ProcessPropertyChange(
protoUsdPrim, cachePath, propertyName);
if (dirtyBits & (HdChangeTracker::DirtyTransform |
HdChangeTracker::DirtyVisibility)) {
return HdChangeTracker::AllDirty;
}
return dirtyBits;
}
if (propertyName == UsdGeomTokens->positions ||
propertyName == UsdGeomTokens->orientations ||
propertyName == UsdGeomTokens->scales) {
TfToken primvarName = propertyName;
if (propertyName == UsdGeomTokens->positions) {
primvarName = _tokens->translate;
} else if (propertyName == UsdGeomTokens->orientations) {
primvarName = _tokens->rotate;
} else if (propertyName == UsdGeomTokens->scales) {
primvarName = _tokens->scale;
}
return _ProcessNonPrefixedPrimvarPropertyChange(
prim, cachePath, propertyName, primvarName,
HdInterpolationInstance);
}
if (propertyName == UsdGeomTokens->protoIndices ||
propertyName == UsdGeomTokens->invisibleIds) {
return HdChangeTracker::DirtyInstanceIndex;
}
// Is the property a primvar?
if (UsdGeomPrimvarsAPI::CanContainPropertyName(propertyName)) {
// Ignore local constant/uniform primvars.
UsdGeomPrimvar pv = UsdGeomPrimvarsAPI(prim).GetPrimvar(propertyName);
if (pv && (pv.GetInterpolation() == UsdGeomTokens->constant ||
pv.GetInterpolation() == UsdGeomTokens->uniform)) {
return HdChangeTracker::Clean;
}
return UsdImagingPrimAdapter::_ProcessPrefixedPrimvarPropertyChange(
prim, cachePath, propertyName,
/*valueChangeDirtyBit*/HdChangeTracker::DirtyPrimvar,
/*inherited=*/false);
}
// XXX: Treat transform & visibility changes as re-sync, until we untangle
// instancer vs proto data.
if (propertyName == UsdGeomTokens->visibility ||
UsdGeomXformable::IsTransformationAffectedByAttrNamed(propertyName)) {
return HdChangeTracker::AllDirty;
}
return HdChangeTracker::Clean;
}
void
UsdImagingPointInstancerAdapter::_ProcessPrimRemoval(SdfPath const& cachePath,
UsdImagingIndexProxy* index,
SdfPathVector* instancersToReload)
{
SdfPath affectedInstancer;
// cachePath is from the _dependencyInfo map in the delegate, and points to
// either a hydra instancer or a hydra prototype (the latter in the case of
// adapter forwarding). For hydra prototypes, their name is mangled by the
// immediate instancer parent: if /World/PI/PI2 has cache path
// /World/PI/PI2{0}, then /World/PI/PI2/cube will have cache path
// /World/PI/PI2{0}.proto0_cube_id0 (see _PopulatePrototype). This, then,
// gives us an easy route to the affected instancer.
if (IsChildPath(cachePath)) {
affectedInstancer = cachePath.GetParentPath();
} else {
affectedInstancer = cachePath;
}
// If the affected instancer is populated, delete it by finding the
// top-level instancer and calling _UnloadInstancer on that.
// XXX: It would be nice if we could just remove *this* prim and rely on
// the resync code to propertly resync it with the right parent instancer.
_InstancerDataMap::iterator instIt = _instancerData.find(affectedInstancer);
if (instIt == _instancerData.end()) {
// Invalid cache path.
return;
}
while (instIt != _instancerData.end()) {
affectedInstancer = instIt->first;
SdfPath parentInstancerCachePath =
instIt->second.parentInstancerCachePath;
if (parentInstancerCachePath.IsEmpty()) {
break;
}
instIt = _instancerData.find(parentInstancerCachePath);
}
// Should we reload affected instancer?
if (instancersToReload) {
UsdPrim p = _GetPrim(affectedInstancer.GetPrimPath());
if (p && p.IsActive()) {
instancersToReload->push_back(affectedInstancer);
}
}
_UnloadInstancer(affectedInstancer, index);
}
void
UsdImagingPointInstancerAdapter::ProcessPrimResync(SdfPath const& cachePath,
UsdImagingIndexProxy* index)
{
// _ProcesPrimRemoval does the heavy lifting, returning a set of instancers
// to repopulate. Note that the child/prototype prims need not be in the
// "toReload" list, as they will be discovered in the process of reloading
// the root instancer prim.
SdfPathVector toReload;
_ProcessPrimRemoval(cachePath, index, &toReload);
for (SdfPath const& instancerRootPath : toReload) {
index->Repopulate(instancerRootPath);
}
}
/*virtual*/
void
UsdImagingPointInstancerAdapter::ProcessPrimRemoval(SdfPath const& cachePath,
UsdImagingIndexProxy* index)
{
// Process removals, but do not repopulate.
_ProcessPrimRemoval(cachePath, index, /*instancersToRepopulate*/nullptr);
}
void
UsdImagingPointInstancerAdapter::MarkDirty(UsdPrim const& prim,
SdfPath const& cachePath,
HdDirtyBits dirty,
UsdImagingIndexProxy* index)
{
if (IsChildPath(cachePath)) {
// cachePath : /path/instancerPath.proto_*
// instancerPath : /path/instancerPath
SdfPath instancerPath = cachePath.GetParentPath();
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
proto.adapter->MarkDirty(prim, cachePath, dirty, index);
} else {
index->MarkInstancerDirty(cachePath, dirty);
}
}
void
UsdImagingPointInstancerAdapter::MarkRefineLevelDirty(
UsdPrim const& prim,
SdfPath const& cachePath,
UsdImagingIndexProxy* index)
{
if (IsChildPath(cachePath)) {
// cachePath : /path/instancerPath.proto_*
// instancerPath : /path/instancerPath
SdfPath instancerPath = cachePath.GetParentPath();
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
proto.adapter->MarkRefineLevelDirty(prim, cachePath, index);
}
}
void
UsdImagingPointInstancerAdapter::MarkReprDirty(UsdPrim const& prim,
SdfPath const& cachePath,
UsdImagingIndexProxy* index)
{
if (IsChildPath(cachePath)) {
// cachePath : /path/instancerPath.proto_*
// instancerPath : /path/instancerPath
SdfPath instancerPath = cachePath.GetParentPath();
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
proto.adapter->MarkReprDirty(prim, cachePath, index);
}
}
void
UsdImagingPointInstancerAdapter::MarkCullStyleDirty(UsdPrim const& prim,
SdfPath const& cachePath,
UsdImagingIndexProxy* index)
{
if (IsChildPath(cachePath)) {
// cachePath : /path/instancerPath.proto_*
// instancerPath : /path/instancerPath
SdfPath instancerPath = cachePath.GetParentPath();
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
proto.adapter->MarkCullStyleDirty(prim, cachePath, index);
}
}
void
UsdImagingPointInstancerAdapter::MarkRenderTagDirty(UsdPrim const& prim,
SdfPath const& cachePath,
UsdImagingIndexProxy* index)
{
if (IsChildPath(cachePath)) {
// cachePath : /path/instancerPath.proto_*
// instancerPath : /path/instancerPath
SdfPath instancerPath = cachePath.GetParentPath();
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
proto.adapter->MarkRenderTagDirty(prim, cachePath, index);
}
}
void
UsdImagingPointInstancerAdapter::MarkTransformDirty(UsdPrim const& prim,
SdfPath const& cachePath,
UsdImagingIndexProxy* index)
{
if (IsChildPath(cachePath)) {
// cachePath : /path/instancerPath.proto_*
// instancerPath : /path/instancerPath
SdfPath instancerPath = cachePath.GetParentPath();
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
proto.adapter->MarkTransformDirty(prim, cachePath, index);
} else {
static const HdDirtyBits transformDirty =
HdChangeTracker::DirtyTransform;
index->MarkInstancerDirty(cachePath, transformDirty);
}
}
void
UsdImagingPointInstancerAdapter::MarkVisibilityDirty(
UsdPrim const& prim,
SdfPath const& cachePath,
UsdImagingIndexProxy* index)
{
if (IsChildPath(cachePath)) {
// cachePath : /path/instancerPath.proto_*
// instancerPath : /path/instancerPath
SdfPath instancerPath = cachePath.GetParentPath();
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
proto.adapter->MarkVisibilityDirty(prim, cachePath, index);
} else {
static const HdDirtyBits visibilityDirty =
HdChangeTracker::DirtyVisibility;
index->MarkInstancerDirty(cachePath, visibilityDirty);
}
}
void
UsdImagingPointInstancerAdapter::_UnloadInstancer(SdfPath const& instancerPath,
UsdImagingIndexProxy* index)
{
_InstancerDataMap::iterator instIt = _instancerData.find(instancerPath);
// Note: If any of the prototype children is a point instancer, their
// ProcessPrimRemoval will try to forward the removal call to the
// top-level instancer that has an entry in _instancerData. This means,
// to avoid infinite loops, that we need to remove the _instancerData
// entry for this instancer before removing prototypes.
const _ProtoPrimMap protoPrimMap = instIt->second.protoPrimMap;
_instancerData.erase(instIt);
// First, we need to make sure all proto rprims are removed.
for (auto const& pair : protoPrimMap) {
// pair: <cache path, _ProtoPrim>
pair.second.adapter->ProcessPrimRemoval(pair.first, index);
}
// Blow away the instancer and the associated local data.
index->RemoveInstancer(instancerPath);
}
// -------------------------------------------------------------------------- //
// Private IO Helpers
// -------------------------------------------------------------------------- //
UsdImagingPointInstancerAdapter::_ProtoPrim const&
UsdImagingPointInstancerAdapter::_GetProtoPrim(SdfPath const& instrPath,
SdfPath const& cachePath) const
{
static _ProtoPrim const EMPTY;
SdfPath const& instancerPath =
(cachePath.GetParentPath().IsPrimVariantSelectionPath())
? cachePath.GetParentPath()
: instrPath;
_InstancerDataMap::const_iterator it = _instancerData.find(instancerPath);
if (it == _instancerData.end()) {
return EMPTY;
}
_ProtoPrimMap::const_iterator protoPrimIt
= it->second.protoPrimMap.find(cachePath);
if (protoPrimIt == it->second.protoPrimMap.end()) {
return EMPTY;
}
return protoPrimIt->second;
}
bool
UsdImagingPointInstancerAdapter::_GetProtoPrimForChild(
UsdPrim const& usdPrim,
SdfPath const& cachePath,
_ProtoPrim const** proto,
UsdImagingInstancerContext* ctx) const
{
if (IsChildPath(cachePath)) {
*proto = &_GetProtoPrim(usdPrim.GetPath(), cachePath);
if (!TF_VERIFY(*proto)) {
return false;
}
UsdPrim protoPrim = _GetProtoUsdPrim(**proto);
// The instancer path since IsChildPath is true
const SdfPath instancerPath = cachePath.GetParentPath();
ctx->instancerCachePath = instancerPath;
ctx->childName = cachePath.GetNameToken();
ctx->instancerMaterialUsdPath = SdfPath();
ctx->instanceDrawMode = TfToken();
ctx->instanceInheritablePurpose = TfToken();
ctx->instancerAdapter = const_cast<UsdImagingPointInstancerAdapter *>
(this)->shared_from_this();
return true;
} else {
return false;
}
}
const UsdPrim
UsdImagingPointInstancerAdapter::_GetProtoUsdPrim(
_ProtoPrim const& proto) const
{
// proto.paths.front() is the most local path for the rprim.
// If it's not native-instanced, proto.paths will be size 1.
// If it is native-instanced, proto.paths may look like
// /__Prototype_1/prim
// /Instance
// where /__Prototype_1/prim is the pointer to the actual prim in question.
UsdPrim prim = _GetPrim(proto.paths.front());
// One exception: if the prototype is an instance, proto.paths looks like
// /__Prototype_1
// /Instance
// ... in which case, we want to return /Instance since prototypes drop all
// attributes.
if (prim && prim.IsPrototype() && TF_VERIFY(proto.paths.size() > 1)) {
prim = _GetPrim(proto.paths.at(1));
}
return prim;
}
bool
UsdImagingPointInstancerAdapter::_GetInstancerVisible(
SdfPath const &instancerPath, UsdTimeCode time) const
{
bool visible = UsdImagingPrimAdapter::GetVisible(
_GetPrim(instancerPath.GetPrimPath()),
instancerPath,
time);
if (visible) {
_InstancerDataMap::const_iterator it
= _instancerData.find(instancerPath);
if (it != _instancerData.end()) {
// note that parent instancer may not be a namespace parent
// (e.g. prototype -> instance)
SdfPath const &parentInstancerCachePath =
it->second.parentInstancerCachePath;
if (!parentInstancerCachePath.IsEmpty()) {
return _GetInstancerVisible(parentInstancerCachePath, time);
}
}
}
return visible;
}
void
UsdImagingPointInstancerAdapter::_UpdateInstancerVisibility(
SdfPath const& instancerPath,
_InstancerData const& instrData,
UsdTimeCode time) const
{
TF_DEBUG(USDIMAGING_INSTANCER).Msg(
"[PointInstancer::_UpdateInstancerVisibility] %s\n",
instancerPath.GetText());
if (instrData.variableVisibility) {
// If visibility is variable, each prototype will be updating the
// instancer visibility here, so make sure we lock before retrieving
// or computing it.
std::lock_guard<std::mutex> lock(instrData.mutex);
// Grab the instancer visibility, if it varies over time.
bool upToDate = instrData.visibleTime == time;
if (!upToDate) {
instrData.visible = _GetInstancerVisible(instancerPath, time);
instrData.visibleTime = time;
}
}
}
GfMatrix4d
UsdImagingPointInstancerAdapter::_CorrectTransform(
UsdPrim const& instancer,
UsdPrim const& protoRoot,
SdfPath const& cachePath,
SdfPathVector const& protoPathChain,
GfMatrix4d const& inTransform,
UsdTimeCode time) const
{
// Subtract out the parent transform from prototypes (in prototype time).
//
// Need to track instancer transform variability (this should be
// fine, as long as the prototypes live under the instancer).
// - delegate-root-transform
// root transform applied to entire prims in a delegate.
// - proto-root-transform
// transform of the each prototype root usd-prim
// - proto-gprim-transform
// transform of the each prototype Rprim
// Our Hydra convention applies the delegate-root-transform to instancer,
// not to a prototype (required for nested instancing).
// Compute inverse to extract root transform from prototypes too.
GfMatrix4d inverseRootTransform = GetRootTransform().GetInverse();
// First, GprimAdapter has already populated transform of the protoPrim into
// value cache, including the delegate-root-transform, because GprimAdapter
// doesn't know if it's a prototype of point instancer or not.
//
// (see UsdImagingGprimAdapter::UpdateForTime. GetTransform() doesn't
// specify ignoreRootTransform parameter)
//
// We want to store the relative transform for each prototype rprim.
// Subtract the delegate-root-transform.
GfMatrix4d protoGprimToWorld = inTransform;
protoGprimToWorld = protoGprimToWorld * inverseRootTransform;
// If this is nested instancer (has parent),
for (size_t i = 1; i < protoPathChain.size(); ++i) {
// ignore root transform of nested instancer chain
//
// PI ---(protoRoot)--- NI:XFM
// ^
// This matrix, we're applying
protoGprimToWorld *= BaseAdapter::GetTransform(
_GetPrim(protoPathChain[i]),
protoPathChain[i],
time,
/*ignoreRootTransform=*/true);
}
// Then, we also need to subtract transform above the proto root to avoid
// double transform of instancer and prototypes.
// Compute the transform of the proto root,
// excluding delegate-root-transform.
//
// PI(or whatever):XFM---(protoRoot)--- NI (or whatever)
// ^
// This matrix, we're subtracting
UsdPrim parent = protoRoot.GetParent();
if (parent) {
GfMatrix4d parentToWorld = GetTransform(
parent, parent.GetPath(), time, /*ignoreRootTransform=*/true);
// protoRootToWorld includes its own transform AND root transform,
// GetInverse() extracts both transforms.
protoGprimToWorld = protoGprimToWorld * parentToWorld.GetInverse();
}
return protoGprimToWorld;
}
void
UsdImagingPointInstancerAdapter::_ComputeProtoVisibility(
UsdPrim const& protoRoot,
UsdPrim const& protoGprim,
UsdTimeCode time,
bool* vis) const
{
if (!TF_VERIFY(vis)) { return; }
if (!protoGprim.GetPath().HasPrefix(protoRoot.GetPath())) {
TF_CODING_ERROR("Prototype <%s> is not prefixed under "
"proto root <%s>\n",
protoGprim.GetPath().GetText(),
protoRoot.GetPath().GetText());
return;
}
// if it's in invised list, set vis to false
if (_IsInInvisedPaths(protoGprim.GetPath())) {
*vis = false;
return;
}
// Recurse until we get to the protoRoot. With this recursion, we'll
// process the protoRoot first, then a child, down to the protoGprim.
//
// Skip all prototypes, since they can't have an opinion.
if (!protoGprim.IsPrototype() &&
protoRoot != protoGprim && protoGprim.GetParent()) {
_ComputeProtoVisibility(protoRoot, protoGprim.GetParent(), time, vis);
}
// If an ancestor set vis to false, we need not check any other prims.
if (!*vis)
return;
// Check visibility of this prim.
TfToken visToken;
if (UsdGeomImageable(protoGprim).GetVisibilityAttr().Get(&visToken, time)
&& visToken == UsdGeomTokens->invisible) {
*vis = false;
return;
}
}
/* virtual */
SdfPath
UsdImagingPointInstancerAdapter::GetScenePrimPath(
SdfPath const& cachePath,
int instanceIndex,
HdInstancerContext *instancerContext) const
{
HD_TRACE_FUNCTION();
TF_DEBUG(USDIMAGING_SELECTION).Msg(
"GetScenePrimPath: proto = %s\n", cachePath.GetText());
SdfPath instancerPath;
SdfPath protoPath = cachePath;
// If the prototype is an rprim, the instancer path is just the parent path.
if (IsChildPath(cachePath)) {
instancerPath = cachePath.GetParentPath();
} else {
// If the prototype is a PI, then cache path will be in the prim map
// of one of the instancers. If it's a UsdGeomPointInstancer, we can
// look it up directly, and get the parent path that way. Otherwise,
// we need to loop all instancers.
_InstancerDataMap::const_iterator it =
_instancerData.find(cachePath);
if (it != _instancerData.end()) {
instancerPath = it->second.parentInstancerCachePath;
} else {
for (auto const& pair : _instancerData) {
if (pair.second.protoPrimMap.count(cachePath) > 0) {
instancerPath = pair.first;
break;
}
}
}
}
// If we couldn't determine instancerPath, bail.
if (instancerPath == SdfPath()) {
return SdfPath();
}
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
if (!proto.adapter) {
// If proto.adapter is null, _GetProtoPrim failed.
return SdfPath();
}
SdfPath primPath = _GetPrimPathFromInstancerChain(proto.paths);
// If the prim path is in prototype, we need the help of the parent
// instancer to figure out what the right instance is. We assume:
// 1.) primPath and instancerPath are inside the same prototype.
// 2.) recursing gives us the fully-qualified version of instancerPath.
//
// If:
// - primPath is /__Prototype_1/Instancer/protos/A
// - instancerPath is /__Prototype_1/Instancer
// - parentPath is /World/Foo/Instance
//
// Let fqInstancerPath = parentAdapter->GetScenePrimPath(instancerPath);
// - fqInstancerPath = /World/Bar/Instance/Instancer
// Then instancePath = /World/Bar/Instance
// instancePath = fqInstancerPath - instancerPath, or traversing up
// until we hit the first instance.
//
// Finally:
// - fqPrimPath = instancePath + primPath
// = /World/Bar/Instance/Instancer/protos/A
//
// We also recurse here to fill in instancerContext.
// Look up the parent instancer of this instancer.
_InstancerDataMap::const_iterator it = _instancerData.find(instancerPath);
if (it == _instancerData.end()) {
return SdfPath();
}
SdfPath parentPath = it->second.parentInstancerCachePath;
// Compute the local & parent instance index.
VtValue indicesValue = GetInstanceIndices(_GetPrim(instancerPath),
instancerPath, cachePath, _GetTimeWithOffset(0.0));
if (!indicesValue.IsHolding<VtIntArray>()) {
return SdfPath();
}
VtIntArray const & indices = indicesValue.UncheckedGet<VtIntArray>();
// instanceIndex = parentIndex * indices.size() + i.
int parentIndex = instanceIndex / indices.size();
// indices[i] gives the offset into the index buffers (i.e. protoIndices).
int localIndex = indices[instanceIndex % indices.size()];
// Find out the fully-qualified parent path. If there is none, the
// one we have is fully qualified.
SdfPath fqInstancerPath = instancerPath;
UsdPrim parentInstancerUsdPrim =
_GetPrim(parentPath.GetAbsoluteRootOrPrimPath());
if (parentInstancerUsdPrim) {
UsdImagingPrimAdapterSharedPtr parentAdapter =
_GetPrimAdapter(parentInstancerUsdPrim);
if (!TF_VERIFY(parentAdapter, "%s",
parentPath.GetAbsoluteRootOrPrimPath().GetText())) {
return SdfPath();
}
fqInstancerPath =
parentAdapter->GetScenePrimPath(instancerPath, parentIndex,
instancerContext);
}
// Append to the instancer context.
if (instancerContext != nullptr) {
instancerContext->push_back(
std::make_pair(fqInstancerPath, localIndex));
}
// Check if primPath is in prototype, and if so check if the instancer
// is in the same prototype...
UsdPrim prim = _GetPrim(primPath);
if (!prim || !prim.IsInPrototype()) {
return primPath;
}
UsdPrim instancer = _GetPrim(instancerPath.GetAbsoluteRootOrPrimPath());
if (!instancer || !instancer.IsInPrototype() ||
prim.GetPrototype() != instancer.GetPrototype()) {
TF_CODING_ERROR("primPath <%s> and instancerPath <%s> are not in "
"the same prototype", primPath.GetText(),
instancerPath.GetText());
return SdfPath();
}
// Stitch the paths together.
UsdPrim fqInstancer = _GetPrim(fqInstancerPath);
if (!fqInstancer || !fqInstancer.IsInstanceProxy()) {
return SdfPath();
}
while (fqInstancer && !fqInstancer.IsInstance()) {
fqInstancer = fqInstancer.GetParent();
}
SdfPath instancePath = fqInstancer.GetPath();
SdfPathVector paths = { primPath, instancePath };
return _GetPrimPathFromInstancerChain(paths);
}
/* virtual */
SdfPathVector
UsdImagingPointInstancerAdapter::GetScenePrimPaths(
SdfPath const& cachePath,
std::vector<int> const& instanceIndices,
std::vector<HdInstancerContext> *instancerCtxs) const
{
SdfPathVector result;
HdInstancerContext instanceCtx;
result.reserve(instanceIndices.size());
if (instancerCtxs)
instancerCtxs->reserve(instanceIndices.size());
for (size_t i = 0; i < instanceIndices.size(); i++) {
result.push_back(
GetScenePrimPath(cachePath, instanceIndices[i], &instanceCtx));
if (instancerCtxs)
instancerCtxs->push_back(std::move(instanceCtx));
}
return result;
}
static
size_t
_GatherAuthoredTransformTimeSamples(
UsdPrim const& prim,
GfInterval interval,
std::vector<double>* timeSamples)
{
UsdPrim p = prim;
while (p) {
// XXX We could do some caching here
if (UsdGeomXformable xf = UsdGeomXformable(p)) {
std::vector<double> localTimeSamples;
xf.GetTimeSamplesInInterval(interval, &localTimeSamples);
// Join timesamples
timeSamples->insert(
timeSamples->end(),
localTimeSamples.begin(),
localTimeSamples.end());
}
p = p.GetParent();
}
// Sort here
std::sort(timeSamples->begin(), timeSamples->end());
timeSamples->erase(
std::unique(timeSamples->begin(),
timeSamples->end()),
timeSamples->end());
return timeSamples->size();
}
/*virtual*/
GfMatrix4d
UsdImagingPointInstancerAdapter::GetInstancerTransform(
UsdPrim const& instancerPrim,
SdfPath const& instancerPath,
UsdTimeCode time) const
{
TRACE_FUNCTION();
_InstancerDataMap::const_iterator inst = _instancerData.find(instancerPath);
if (!TF_VERIFY(inst != _instancerData.end(),
"Unknown instancer %s", instancerPath.GetText())) {
return GfMatrix4d(1);
}
SdfPath parentInstancerCachePath = inst->second.parentInstancerCachePath;
if (!parentInstancerCachePath.IsEmpty()) {
// If nested, double transformation should be avoided.
SdfPath parentInstancerUsdPath =
parentInstancerCachePath.GetAbsoluteRootOrPrimPath();
UsdPrim parentInstancerUsdPrim = _GetPrim(parentInstancerUsdPath);
UsdImagingPrimAdapterSharedPtr adapter =
_GetPrimAdapter(parentInstancerUsdPrim);
// ParentInstancer doesn't necessarily be UsdGeomPointInstancer.
// lookup and delegate adapter to compute the instancer
// transform.
return adapter->GetRelativeInstancerTransform(
parentInstancerCachePath,
instancerPath,
time);
} else {
// If not nested, simply output the transform of the instancer.
return GetRelativeInstancerTransform(parentInstancerCachePath,
instancerPath,
time);
}
}
/*virtual*/
SdfPath
UsdImagingPointInstancerAdapter::GetInstancerId(
UsdPrim const& usdPrim,
SdfPath const& cachePath) const
{
if (IsChildPath(cachePath)) {
// If this is called on behalf of an rprim, the rprim's name will be
// /path/to/instancer.name_of_proto, so just take the parent path.
return cachePath.GetParentPath();
} else if (_InstancerData const* instrData =
TfMapLookupPtr(_instancerData, cachePath)) {
// Otherwise, look up the parent in the instancer data.
return instrData->parentInstancerCachePath;
} else {
TF_CODING_ERROR("Unexpected path <%s>", cachePath.GetText());
return SdfPath::EmptyPath();
}
}
/*virtual*/
SdfPathVector
UsdImagingPointInstancerAdapter::GetInstancerPrototypes(
UsdPrim const& usdPrim,
SdfPath const& cachePath) const
{
HD_TRACE_FUNCTION();
if (IsChildPath(cachePath)) {
_ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(), cachePath);
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
return proto.adapter->GetInstancerPrototypes(protoPrim, cachePath);
} else {
SdfPathVector prototypes;
if (const _InstancerData* instancerData =
TfMapLookupPtr(_instancerData, cachePath)) {
for (_ProtoPrimMap::const_iterator i =
instancerData->protoPrimMap.cbegin();
i != instancerData->protoPrimMap.cend(); ++i) {
prototypes.push_back(i->first);
}
}
return prototypes;
}
}
/*virtual*/
size_t
UsdImagingPointInstancerAdapter::SampleInstancerTransform(
UsdPrim const& instancerPrim,
SdfPath const& instancerPath,
UsdTimeCode time,
size_t maxNumSamples,
float *sampleTimes,
GfMatrix4d *sampleValues)
{
HD_TRACE_FUNCTION();
if (maxNumSamples == 0) {
return 0;
}
// This code must match how UpdateForTime() computes instancerTransform.
_InstancerDataMap::iterator inst = _instancerData.find(instancerPath);
if (!TF_VERIFY(inst != _instancerData.end(),
"Unknown instancer %s", instancerPath.GetText())) {
return 0;
}
SdfPath parentInstancerCachePath = inst->second.parentInstancerCachePath;
GfInterval interval = _GetCurrentTimeSamplingInterval();
// Add time samples at the boudary conditions
size_t numSamples = 0;
std::vector<double> timeSamples;
timeSamples.push_back(interval.GetMin());
timeSamples.push_back(interval.GetMax());
if (!parentInstancerCachePath.IsEmpty()) {
// if nested, double transformation should be avoided.
SdfPath parentInstancerUsdPath =
parentInstancerCachePath.GetAbsoluteRootOrPrimPath();
UsdPrim parentInstancerUsdPrim = _GetPrim(parentInstancerUsdPath);
UsdImagingPrimAdapterSharedPtr adapter =
_GetPrimAdapter(parentInstancerUsdPrim);
numSamples = _GatherAuthoredTransformTimeSamples(
parentInstancerUsdPrim,
interval,
&timeSamples);
size_t numSamplesToEvaluate = std::min(maxNumSamples, numSamples);
for (size_t i=0; i < numSamplesToEvaluate; ++i) {
sampleTimes[i] = timeSamples[i] - time.GetValue();
sampleValues[i] = adapter->GetRelativeInstancerTransform(
parentInstancerCachePath,
instancerPath,
timeSamples[i]);
}
} else {
numSamples = _GatherAuthoredTransformTimeSamples(
_GetPrim(instancerPath),
interval,
&timeSamples);
size_t numSamplesToEvaluate = std::min(maxNumSamples, numSamples);
for (size_t i=0; i < numSamplesToEvaluate; ++i) {
sampleTimes[i] = timeSamples[i] - time.GetValue();
sampleValues[i] = GetRelativeInstancerTransform(
parentInstancerCachePath,
instancerPath,
timeSamples[i]);
}
}
return numSamples;
}
GfMatrix4d
UsdImagingPointInstancerAdapter::GetTransform(UsdPrim const& prim,
SdfPath const& cachePath,
UsdTimeCode time,
bool ignoreRootTransform) const
{
GfMatrix4d output(1.0);
if (!IsChildPath(cachePath)) {
return BaseAdapter::GetTransform(prim,
cachePath,
time,
ignoreRootTransform);
}
// cachePath : /path/instancerPath.proto_*
// instancerPath : /path/instancerPath
SdfPath instancerPath = cachePath.GetParentPath();
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
if (!TF_VERIFY(proto.adapter, "%s", cachePath.GetText())) {
return output;
}
if (!TF_VERIFY(proto.paths.size() > 0, "%s", cachePath.GetText())) {
return output;
}
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
output = proto.adapter->GetTransform(
protoPrim,
cachePath,
time,
ignoreRootTransform);
// If the prototype we're processing is a prototype, _GetProtoUsdPrim
// will return us the instance for attribute lookup; but the
// instance transform for that instance is already accounted for in
// _CorrectTransform. Prototypes don't have any transform aside from
// the root transform, so override the result of UpdateForTime.
if (protoPrim.IsInstance()) {
output = GetRootTransform();
}
// Correct the transform for various shenanigans: NI transforms,
// delegate root transform, proto root transform.
return _CorrectTransform(prim, _GetPrim(proto.protoRootPath), cachePath,
proto.paths, output, time);
}
size_t
UsdImagingPointInstancerAdapter::SampleTransform(
UsdPrim const& usdPrim,
SdfPath const& cachePath,
UsdTimeCode time,
size_t maxNumSamples,
float *sampleTimes,
GfMatrix4d *sampleValues)
{
if (maxNumSamples == 0) {
return 0;
}
// Pull a single sample from the value-cached transform.
// This makes the (hopefully safe) assumption that we do not need
// motion blur on the underlying prototypes.
sampleTimes[0] = 0.0;
sampleValues[0] = GetTransform(usdPrim, cachePath, time);
return 1;
}
size_t
UsdImagingPointInstancerAdapter::SamplePrimvar(
UsdPrim const& usdPrim,
SdfPath const& cachePath,
TfToken const& key,
UsdTimeCode time,
size_t maxNumSamples,
float *sampleTimes,
VtValue *sampleValues,
VtIntArray *sampleIndices)
{
HD_TRACE_FUNCTION();
if (maxNumSamples == 0) {
return 0;
}
if (IsChildPath(cachePath)) {
// Delegate to prototype adapter and USD prim.
_ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(),
cachePath);
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
return proto.adapter->SamplePrimvar(
protoPrim, cachePath, key, time,
maxNumSamples, sampleTimes, sampleValues, sampleIndices);
} else {
// Map Hydra-PI transform keys to their USD equivalents.
TfToken usdKey = key;
if (key == _tokens->translate) {
usdKey = UsdGeomTokens->positions;
} else if (key == _tokens->scale) {
usdKey = UsdGeomTokens->scales;
} else if (key == _tokens->rotate) {
usdKey = UsdGeomTokens->orientations;
}
return UsdImagingPrimAdapter::SamplePrimvar(
usdPrim, cachePath, usdKey, time,
maxNumSamples, sampleTimes, sampleValues, sampleIndices);
}
}
/*virtual*/
bool
UsdImagingPointInstancerAdapter::GetVisible(UsdPrim const& prim,
SdfPath const& cachePath,
UsdTimeCode time) const
{
// Apply the instancer visibility at the current time to the
// instance. Notice that the instance will also pickup the instancer
// visibility at the time offset.
if (IsChildPath(cachePath)) {
bool vis = false;
// cachePath : /path/instancerPath.proto_*
// instancerPath : /path/instancerPath
SdfPath instancerPath = cachePath.GetParentPath();
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
if (!TF_VERIFY(proto.adapter, "%s", cachePath.GetText())) {
return vis;
}
if (!TF_VERIFY(proto.paths.size() > 0, "%s", cachePath.GetText())) {
return vis;
}
bool protoHasFixedVis = !(proto.variabilityBits
& HdChangeTracker::DirtyVisibility);
_InstancerDataMap::const_iterator it =
_instancerData.find(instancerPath);
if (TF_VERIFY(it != _instancerData.end())) {
_InstancerData const& instrData = it->second;
_UpdateInstancerVisibility(instancerPath, instrData, time);
vis = instrData.visible;
}
if (protoHasFixedVis) {
// The instancer is visible and the proto prim has fixed
// visibility (it does not vary over time), we can use the
// pre-cached visibility.
vis = vis && proto.visible;
} else if (vis) {
// The instancer is visible and the prototype has varying
// visibility, we must compute visibility from the proto
// prim to the model instance root.
for (size_t i = 0; i < proto.paths.size()-1; ++i) {
_ComputeProtoVisibility(
_GetPrim(proto.paths[i+1]).GetPrototype(),
_GetPrim(proto.paths[i+0]),
time, &vis);
}
_ComputeProtoVisibility(
_GetPrim(proto.protoRootPath),
_GetPrim(proto.paths.back()),
time, &vis);
}
return vis;
}
return BaseAdapter::GetVisible(prim, cachePath, time);
}
/*virtual*/
TfToken
UsdImagingPointInstancerAdapter::GetPurpose(
UsdPrim const& usdPrim,
SdfPath const& cachePath,
TfToken const& instanceInheritablePurpose) const
{
if (IsChildPath(cachePath)) {
// Delegate to prototype adapter and USD prim
_ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(), cachePath);
UsdPrim protoUsdPrim = _GetProtoUsdPrim(proto);
UsdPrim instanceProxyPrim = _GetPrim(_GetPrimPathFromInstancerChain(
proto.paths));
TfToken const& inheritablePurpose =
GetInheritablePurpose(instanceProxyPrim);
return proto.adapter->GetPurpose(protoUsdPrim, cachePath,
inheritablePurpose);
}
return BaseAdapter::GetPurpose(usdPrim, cachePath, TfToken());
}
/*virtual*/
PxOsdSubdivTags
UsdImagingPointInstancerAdapter::GetSubdivTags(UsdPrim const& usdPrim,
SdfPath const& cachePath,
UsdTimeCode time) const
{
if (IsChildPath(cachePath)) {
// Delegate to prototype adapter and USD prim.
_ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(), cachePath);
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
return proto.adapter->GetSubdivTags(protoPrim, cachePath, time);
}
return BaseAdapter::GetSubdivTags(usdPrim, cachePath, time);
}
/*virtual*/
VtValue
UsdImagingPointInstancerAdapter::GetTopology(UsdPrim const& usdPrim,
SdfPath const& cachePath,
UsdTimeCode time) const
{
if (IsChildPath(cachePath)) {
// Delegate to prototype adapter and USD prim.
_ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(), cachePath);
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
return proto.adapter->GetTopology(protoPrim, cachePath, time);
}
return BaseAdapter::GetTopology(usdPrim, cachePath, time);
}
/*virtual*/
HdCullStyle
UsdImagingPointInstancerAdapter::GetCullStyle(UsdPrim const& usdPrim,
SdfPath const& cachePath,
UsdTimeCode time) const
{
if (IsChildPath(cachePath)) {
// Delegate to prototype adapter and USD prim.
_ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(), cachePath);
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
return proto.adapter->GetCullStyle(protoPrim, cachePath, time);
}
return BaseAdapter::GetCullStyle(usdPrim, cachePath, time);
}
/*virtual*/
GfRange3d
UsdImagingPointInstancerAdapter::GetExtent(UsdPrim const& usdPrim,
SdfPath const& cachePath,
UsdTimeCode time) const
{
if (IsChildPath(cachePath)) {
// Delegate to prototype adapter and USD prim.
_ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(), cachePath);
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
return proto.adapter->GetExtent(protoPrim, cachePath, time);
}
return BaseAdapter::GetExtent(usdPrim, cachePath, time);
}
/*virtual*/
bool
UsdImagingPointInstancerAdapter::GetDoubleSided(UsdPrim const& usdPrim,
SdfPath const& cachePath,
UsdTimeCode time) const
{
if (IsChildPath(cachePath)) {
// Delegate to prototype adapter and USD prim.
_ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(), cachePath);
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
return proto.adapter->GetDoubleSided(protoPrim, cachePath, time);
}
return BaseAdapter::GetDoubleSided(usdPrim, cachePath, time);
}
/*virtual*/
SdfPath
UsdImagingPointInstancerAdapter::GetMaterialId(UsdPrim const& usdPrim,
SdfPath const& cachePath,
UsdTimeCode time) const
{
if (IsChildPath(cachePath)) {
// Delegate to prototype adapter and USD prim.
_ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(), cachePath);
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
SdfPath materialId =
proto.adapter->GetMaterialId(protoPrim, cachePath, time);
if (!materialId.IsEmpty()) {
return materialId;
}
// If the child prim doesn't have a material ID, see if there's
// an instancer material path...
UsdPrim instanceProxyPrim = _GetPrim(_GetPrimPathFromInstancerChain(
proto.paths));
return GetMaterialUsdPath(instanceProxyPrim);
}
return BaseAdapter::GetMaterialId(usdPrim, cachePath, time);
}
/*virtual*/
VtValue
UsdImagingPointInstancerAdapter::Get(UsdPrim const& usdPrim,
SdfPath const& cachePath,
TfToken const& key,
UsdTimeCode time,
VtIntArray *outIndices) const
{
TRACE_FUNCTION();
if (IsChildPath(cachePath)) {
// Delegate to prototype adapter and USD prim.
_ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(), cachePath);
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
return proto.adapter->Get(protoPrim, cachePath, key, time, outIndices);
} else if (_InstancerData const* instrData =
TfMapLookupPtr(_instancerData, cachePath)) {
TF_UNUSED(instrData);
if (key == _tokens->translate) {
UsdGeomPointInstancer instancer(usdPrim);
VtVec3fArray positions;
if (instancer.GetPositionsAttr().Get(&positions, time)) {
return VtValue(positions);
}
} else if (key == _tokens->rotate) {
UsdGeomPointInstancer instancer(usdPrim);
VtQuathArray orientations;
if (instancer.GetOrientationsAttr().Get(&orientations, time)) {
return VtValue(orientations);
}
} else if (key == _tokens->scale) {
UsdGeomPointInstancer instancer(usdPrim);
VtVec3fArray scales;
if (instancer.GetScalesAttr().Get(&scales, time)) {
return VtValue(scales);
}
} else {
UsdGeomPrimvarsAPI primvars(usdPrim);
if (UsdGeomPrimvar pv = primvars.GetPrimvar(key)) {
VtValue value;
if (outIndices) {
if (pv && pv.Get(&value, time)) {
pv.GetIndices(outIndices, time);
return value;
}
} else if (pv && pv.ComputeFlattened(&value, time)) {
return value;
}
}
}
}
return BaseAdapter::Get(usdPrim, cachePath, key, time, outIndices);
}
/*virtual*/
HdExtComputationInputDescriptorVector
UsdImagingPointInstancerAdapter::GetExtComputationInputs(
UsdPrim const& usdPrim,
SdfPath const& cachePath,
const UsdImagingInstancerContext* /*unused*/) const
{
UsdImagingInstancerContext ctx;
_ProtoPrim const *proto;
if (_GetProtoPrimForChild(usdPrim, cachePath, &proto, &ctx)) {
return proto->adapter->GetExtComputationInputs(
_GetProtoUsdPrim(*proto), cachePath, &ctx);
}
return BaseAdapter::GetExtComputationInputs(usdPrim, cachePath, nullptr);
}
/*virtual*/
HdExtComputationOutputDescriptorVector
UsdImagingPointInstancerAdapter::GetExtComputationOutputs(
UsdPrim const& usdPrim,
SdfPath const& cachePath,
const UsdImagingInstancerContext* /*unused*/) const
{
UsdImagingInstancerContext ctx;
_ProtoPrim const *proto;
if (_GetProtoPrimForChild(usdPrim, cachePath, &proto, &ctx)) {
return proto->adapter->GetExtComputationOutputs(
_GetProtoUsdPrim(*proto), cachePath, &ctx);
}
return BaseAdapter::GetExtComputationOutputs(usdPrim, cachePath, nullptr);
}
/*virtual*/
HdExtComputationPrimvarDescriptorVector
UsdImagingPointInstancerAdapter::GetExtComputationPrimvars(
UsdPrim const& usdPrim,
SdfPath const& cachePath,
HdInterpolation interpolation,
const UsdImagingInstancerContext* /*unused*/) const
{
UsdImagingInstancerContext ctx;
_ProtoPrim const *proto;
if (_GetProtoPrimForChild(usdPrim, cachePath, &proto, &ctx)) {
return proto->adapter->GetExtComputationPrimvars(
_GetProtoUsdPrim(*proto), cachePath, interpolation, &ctx);
}
return BaseAdapter::GetExtComputationPrimvars(usdPrim, cachePath,
interpolation, nullptr);
}
/*virtual*/
VtValue
UsdImagingPointInstancerAdapter::GetExtComputationInput(
UsdPrim const& usdPrim,
SdfPath const& cachePath,
TfToken const& name,
UsdTimeCode time,
const UsdImagingInstancerContext* /*unused*/) const
{
UsdImagingInstancerContext ctx;
_ProtoPrim const *proto;
if (_GetProtoPrimForChild(usdPrim, cachePath, &proto, &ctx)) {
return proto->adapter->GetExtComputationInput(
_GetProtoUsdPrim(*proto), cachePath, name, time, &ctx);
}
return BaseAdapter::GetExtComputationInput(usdPrim, cachePath, name, time,
nullptr);
}
/*virtual*/
VtValue
UsdImagingPointInstancerAdapter::GetInstanceIndices(
UsdPrim const& instancerPrim,
SdfPath const& instancerCachePath,
SdfPath const& prototypeCachePath,
UsdTimeCode time) const
{
if (IsChildPath(instancerCachePath)) {
UsdImagingInstancerContext ctx;
_ProtoPrim const *proto;
if (_GetProtoPrimForChild(
instancerPrim, instancerCachePath, &proto, &ctx)) {
return proto->adapter->GetInstanceIndices(
_GetProtoUsdPrim(*proto), instancerCachePath,
prototypeCachePath, time);
}
}
if (_InstancerData const* instrData =
TfMapLookupPtr(_instancerData, instancerCachePath)) {
// need to find the prototypeRootPath for this prototypeCachePath
const auto protoPrimIt =
instrData->protoPrimMap.find(prototypeCachePath);
if (protoPrimIt != instrData->protoPrimMap.end()) {
const SdfPath & prototypeRootPath =
protoPrimIt->second.protoRootPath;
// find index of prototypeRootPath within expected array-of-arrays
const auto pathIndexIt =
instrData->prototypePathIndices.find(prototypeRootPath);
if (pathIndexIt != instrData->prototypePathIndices.end()) {
size_t pathIndex = (*pathIndexIt).second;
UsdPrim instancerPrim = _GetPrim(
instancerCachePath.GetPrimPath());
VtArray<VtIntArray> indices = GetPerPrototypeIndices(
instancerPrim, time);
if (pathIndex >= indices.size()) {
TF_WARN("ProtoIndex %lu out of bounds "
"(prototypes size = %lu) for (%s, %s)",
pathIndex,
indices.size(),
instancerCachePath.GetText(),
prototypeCachePath.GetText());
return VtValue();
}
return VtValue(indices[pathIndex]);
}
}
TF_WARN("No matching ProtoRootPath found for (%s, %s)",
instancerCachePath.GetText(), prototypeCachePath.GetText());
}
return VtValue();
}
/*virtual*/
std::string
UsdImagingPointInstancerAdapter::GetExtComputationKernel(
UsdPrim const& usdPrim,
SdfPath const& cachePath,
const UsdImagingInstancerContext* /*unused*/) const
{
UsdImagingInstancerContext ctx;
_ProtoPrim const *proto;
if (_GetProtoPrimForChild(usdPrim, cachePath, &proto, &ctx)) {
return proto->adapter->GetExtComputationKernel(
_GetProtoUsdPrim(*proto), cachePath, &ctx);
}
return BaseAdapter::GetExtComputationKernel(usdPrim, cachePath, nullptr);
}
/*virtual*/
bool
UsdImagingPointInstancerAdapter::PopulateSelection(
HdSelection::HighlightMode const& highlightMode,
SdfPath const &cachePath,
UsdPrim const &usdPrim,
int const hydraInstanceIndex,
VtIntArray const &parentInstanceIndices,
HdSelectionSharedPtr const &result) const
{
HD_TRACE_FUNCTION();
if (IsChildPath(cachePath)) {
SdfPath instancerPath = cachePath.GetParentPath();
_ProtoPrim const& proto = _GetProtoPrim(instancerPath, cachePath);
if (!proto.adapter) {
return false;
}
TF_DEBUG(USDIMAGING_SELECTION).Msg(
"PopulateSelection: proto = %s pi = %s\n",
cachePath.GetText(), instancerPath.GetText());
// Make sure one of the prototype paths is a suffix of "usdPrim".
// "paths" has the location of the populated proto; for native
// instancing, it will have N-1 paths to instances and
// 1 path to the prototype.
// If there's no native instancing, paths will have size 1.
// If "usdPrim" is a parent of any of these paths, that counts
// as a selection of this prototype. e.g.
// - /World/Instancer/protos (-> /__Prototype_1)
// - /__Prototype_1/trees/tree_1 (a gprim)
bool foundPrefix = false;
SdfPath usdPath = usdPrim.GetPath();
for (auto const& path : proto.paths) {
if (path.HasPrefix(usdPath)) {
foundPrefix = true;
break;
}
}
if (!foundPrefix) {
return false;
}
// Compose instance indices, if we don't have an explicit index.
// UsdImaging only adds instance indices in the case of usd instances,
// so if we don't have an explicit index we want to add all PI
// instances of the given prototype.
VtIntArray instanceIndices;
if (hydraInstanceIndex == -1 && parentInstanceIndices.size() != 0) {
_InstancerData const* instrData =
TfMapLookupPtr(_instancerData, instancerPath);
if (instrData == nullptr) {
return false;
}
// XXX: Using _GetTimeWithOffset here is a bit of a hack?
VtValue indicesValue = GetInstanceIndices(_GetPrim(instancerPath),
instancerPath, cachePath, _GetTimeWithOffset(0.0));
if (!indicesValue.IsHolding<VtIntArray>()) {
return false;
}
VtIntArray const & indices =
indicesValue.UncheckedGet<VtIntArray>();
for (const int pi : parentInstanceIndices) {
for (size_t i = 0; i < indices.size(); ++i) {
instanceIndices.push_back(pi * indices.size() + i);
}
}
}
// We want the path comparison in PopulateSelection to always succeed
// (since we've verified the path above), so take the prim at
// cachePath.GetPrimPath, since that's guaranteed to exist and be a
// prefix...
UsdPrim prefixPrim = _GetPrim(cachePath.GetAbsoluteRootOrPrimPath());
return proto.adapter->PopulateSelection(
highlightMode, cachePath, prefixPrim,
hydraInstanceIndex, instanceIndices, result);
} else {
_InstancerData const* instrData =
TfMapLookupPtr(_instancerData, cachePath);
if (instrData == nullptr) {
return false;
}
TF_DEBUG(USDIMAGING_SELECTION).Msg(
"PopulateSelection: pi = %s\n", cachePath.GetText());
// For non-gprim selections, selectionPath might be pointing to a
// point instancer, or it might be pointing to a usd native instance
// (which is a dependency of the PI, used for calculating prototype
// transform). If there's native instancing involved, we need to
// break the selection path down to a path context, and zipper compare
// it against the proto paths of each proto prim. This is a very
// similar implementation to the one in instanceAdapter.cpp...
std::deque<SdfPath> selectionPathVec;
UsdPrim p = usdPrim;
while (p.IsInstanceProxy()) {
selectionPathVec.push_front(p.GetPrimInPrototype().GetPath());
do {
p = p.GetParent();
} while (!p.IsInstance());
}
selectionPathVec.push_front(p.GetPath());
// If "cachePath" and "usdPrim" are equal, and hydraInstanceIndex
// has a value, we're responding to "AddSelected(/World/PI, N)";
// we can treat it as an instance index for this PI, rather than
// treating it as an absolute instance index for an rprim.
// (/World/PI, -1) still corresponds to select-all-instances.
if (usdPrim.GetPath() == cachePath.GetAbsoluteRootOrPrimPath() &&
hydraInstanceIndex != -1) {
// "N" here refers to the instance index in the protoIndices array,
// which may be different than the actual hydra index, so we need
// to find the correct prototype/instance pair.
bool added = false;
for (auto const& pair : instrData->protoPrimMap) {
VtValue indicesValue = GetInstanceIndices(_GetPrim(cachePath),
cachePath, pair.first, _GetTimeWithOffset(0.0));
if (!indicesValue.IsHolding<VtIntArray>()) {
continue;
}
VtIntArray const & indices =
indicesValue.UncheckedGet<VtIntArray>();
int foundIndex = -1;
for (size_t i = 0; i < indices.size(); ++i) {
if (indices[i] == hydraInstanceIndex) {
foundIndex = int(i);
break;
}
}
if (foundIndex == -1) {
continue;
}
VtIntArray instanceIndices;
if (parentInstanceIndices.size() > 0) {
for (const int pi : parentInstanceIndices) {
instanceIndices.push_back(pi * indices.size() +
foundIndex);
}
} else {
instanceIndices.push_back(foundIndex);
}
UsdPrim selectionPrim =
_GetPrim(pair.first.GetAbsoluteRootOrPrimPath());
added |= pair.second.adapter->PopulateSelection(
highlightMode, pair.first, selectionPrim,
-1, instanceIndices, result);
}
return added;
}
bool added = false;
for (auto const& pair : instrData->protoPrimMap) {
// Zipper compare the instance paths and the selection paths.
size_t instanceCount, selectionCount;
for (instanceCount = 0, selectionCount = 0;
instanceCount < pair.second.paths.size() &&
selectionCount < selectionPathVec.size();
++instanceCount) {
// pair.second.paths is innermost-first, and selectionPathVec
// outermost-first, so we need to flip the paths index.
size_t instanceIdx =
pair.second.paths.size() - instanceCount - 1;
if (pair.second.paths[instanceIdx].HasPrefix(
selectionPathVec[selectionCount])) {
++selectionCount;
} else if (selectionPathVec[selectionCount].HasPrefix(
pair.second.paths[instanceIdx])) {
// If the selection path is a suffix of the prototype path,
// leave the rest of the selection path to be used as
// a selection prim for the child adapter.
++instanceCount;
break;
} else if (selectionCount != 0) {
// The paths don't match; setting "selectionCount = 0"
// is telling the below code "no match", which is an
// ok proxy for "partial match, partial mismatch".
selectionCount = 0;
break;
}
}
UsdPrim selectionPrim;
if (selectionCount == selectionPathVec.size()) {
// If we've accounted for the whole selection path, fully
// populate this prototype.
selectionPrim =
_GetPrim(pair.first.GetAbsoluteRootOrPrimPath());
}
else if (selectionCount != 0 &&
instanceCount == pair.second.paths.size()) {
// If the selection path goes past the end of the instance path,
// compose the remainder of the selection path into a
// (possibly instance proxy) usd prim and use that as the
// selection prim.
SdfPathVector residualPathVec(
selectionPathVec.rbegin(),
selectionPathVec.rend() - selectionCount);
SdfPath residualPath =
_GetPrimPathFromInstancerChain(residualPathVec);
selectionPrim = _GetPrim(residualPath);
} else {
continue;
}
// Compose instance indices.
VtIntArray instanceIndices;
VtValue indicesValue =
GetInstanceIndices(_GetPrim(cachePath), cachePath,
pair.first, _GetTimeWithOffset(0.0));
if (!indicesValue.IsHolding<VtIntArray>()) {
continue;
}
VtIntArray const & indices =
indicesValue.UncheckedGet<VtIntArray>();
if (parentInstanceIndices.size() > 0) {
for (const int pi : parentInstanceIndices) {
for (size_t i = 0; i < indices.size(); ++i) {
instanceIndices.push_back(pi * indices.size() + i);
}
}
} else {
for (size_t i = 0; i < indices.size(); ++i) {
instanceIndices.push_back(i);
}
}
added |= pair.second.adapter->PopulateSelection(
highlightMode, pair.first, selectionPrim,
hydraInstanceIndex, instanceIndices, result);
}
return added;
}
return false;
}
/*virtual*/
HdVolumeFieldDescriptorVector
UsdImagingPointInstancerAdapter::GetVolumeFieldDescriptors(
UsdPrim const& usdPrim,
SdfPath const &id,
UsdTimeCode time) const
{
if (IsChildPath(id)) {
// Delegate to prototype adapter and USD prim.
_ProtoPrim const& proto = _GetProtoPrim(usdPrim.GetPath(), id);
UsdPrim protoPrim = _GetProtoUsdPrim(proto);
return proto.adapter->GetVolumeFieldDescriptors(
protoPrim, id, time);
} else {
return UsdImagingPrimAdapter::GetVolumeFieldDescriptors(
usdPrim, id, time);
}
}
/*virtual*/
void
UsdImagingPointInstancerAdapter::_RemovePrim(SdfPath const& cachePath,
UsdImagingIndexProxy* index)
{
TF_CODING_ERROR("Should use overidden ProcessPrimResync/ProcessPrimRemoval");
}
/*virtual*/
GfMatrix4d
UsdImagingPointInstancerAdapter::GetRelativeInstancerTransform(
SdfPath const &parentInstancerCachePath,
SdfPath const &cachePath,
UsdTimeCode time) const
{
GfMatrix4d transformRoot(1); // target to world.
// XXX: isProtoRoot detection shouldn't be needed since UsdGeomPointInstaner
// doesn't have a convention of ignoring protoRoot transform unlike the ones
// in PxUsdGeomGL.
// 2 test cases in testUsdImagingGLPointInstancer
// pi_pi_usda, time=1 and 2
// are wrongly configured, and we need to be updated together when fixing.
//
bool isProtoRoot = false;
UsdPrim prim = _GetPrim(cachePath.GetPrimPath());
bool inPrototype = prim.IsInPrototype();
if (!parentInstancerCachePath.IsEmpty()) {
// this instancer has a parent instancer. see if this instancer
// is a protoRoot or not.
_ProtoPrim const& proto
= _GetProtoPrim(parentInstancerCachePath, cachePath);
if (proto.protoRootPath == cachePath) {
// this instancer is a proto root.
isProtoRoot = true;
} else {
// this means instancer(cachePath) is a member of a
// prototype of the parent instacer, but not a proto root.
//
// we need to extract relative transform to root.
//
if (inPrototype) {
// if the instancer is in prototype, set the target
// root transform to world, since the parent
// instancer (if the parent is also in prototype,
// native instancer which instances that parent)
// has delegate's root transform.
transformRoot = GetRootTransform();
} else {
// set the target root to proto root.
transformRoot
= BaseAdapter::GetTransform(
_GetPrim(proto.protoRootPath),
proto.protoRootPath,
time);
}
}
}
if (isProtoRoot) {
// instancer is a protoroot of parent instancer.
// ignore instancer transform.
return GfMatrix4d(1);
} else {
// set protoRoot-to-instancer relative transform
// note that GetTransform() includes GetRootTransform().
// GetTransform(prim) : InstancerXfm * RootTransform
//
// 1. If the instancer doesn't have a parent,
// transformRoot is identity.
//
// val = InstancerXfm * RootTransform * 1^-1
// = InstancerXfm * RootTransform
//
// 2. If the instancer has a parent and in prototype,
// transformRoot is RootTransform.
//
// val = InstancerXfm * RootTransform * (RootTransform)^-1
// = InstancerXfm
//
// 3. If the instaner has a parent but not in prototype,
// transformRoot is (ProtoRoot * RootTransform).
//
// val = InstancerXfm * RootTransform * (ProtoRoot * RootTransform)^-1
// = InstancerXfm * (ProtoRoot)^-1
//
// in case 2 and 3, RootTransform will be applied on the parent
// instancer.
//
return BaseAdapter::GetTransform(prim, prim.GetPath(), time) *
transformRoot.GetInverse();
}
}
PXR_NAMESPACE_CLOSE_SCOPE
| 38.409629 | 82 | 0.601921 | [
"render",
"vector",
"model",
"transform"
] |
13472012e3aaba9e2631c26d92a6019a7b586815 | 24,567 | cpp | C++ | external_libs/CppUTest/tests/CppUTestExt/MockComparatorCopierTest.cpp | Dasudian/dsd-datahub-sdk-embedded-C | c3e6cdc3db6ef2efdeaab2a32ed78b80f3cbe430 | [
"Apache-2.0"
] | 5 | 2019-03-27T17:12:42.000Z | 2020-09-25T17:20:36.000Z | external_libs/CppUTest/tests/CppUTestExt/MockComparatorCopierTest.cpp | Dasudian/dsd-datahub-sdk-embedded-C | c3e6cdc3db6ef2efdeaab2a32ed78b80f3cbe430 | [
"Apache-2.0"
] | null | null | null | external_libs/CppUTest/tests/CppUTestExt/MockComparatorCopierTest.cpp | Dasudian/dsd-datahub-sdk-embedded-C | c3e6cdc3db6ef2efdeaab2a32ed78b80f3cbe430 | [
"Apache-2.0"
] | 1 | 2022-03-24T13:47:17.000Z | 2022-03-24T13:47:17.000Z | /*
* Copyright (c) 2007, Michael Feathers, James Grenning and Bas Vodde
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * 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.
* * Neither the name of the <organization> nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE EARLIER MENTIONED AUTHORS ``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 <copyright holder> 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.
*/
#include "CppUTest/TestHarness.h"
#include "MockFailureReporterForTest.h"
TEST_GROUP(MockComparatorCopierTest)
{
void teardown()
{
mock().checkExpectations();
}
};
class MyTypeForTesting
{
public:
MyTypeForTesting(long val)
{
value = new long(val);
}
virtual ~MyTypeForTesting()
{
delete value;
}
long *value;
};
class MyTypeForTestingComparator : public MockNamedValueComparator
{
public:
virtual bool isEqual(const void* object1, const void* object2)
{
const MyTypeForTesting* obj1 = (const MyTypeForTesting*) object1;
const MyTypeForTesting* obj2 = (const MyTypeForTesting*) object2;
return *(obj1->value) == *(obj2->value);
}
virtual SimpleString valueToString(const void* object)
{
const MyTypeForTesting* obj = (const MyTypeForTesting*) object;
return StringFrom(*(obj->value));
}
};
class MyTypeForTestingCopier : public MockNamedValueCopier
{
public:
virtual void copy(void* dst_, const void* src_)
{
MyTypeForTesting* dst = (MyTypeForTesting*) dst_;
const MyTypeForTesting* src = (const MyTypeForTesting*) src_;
*(dst->value) = *(src->value);
}
};
TEST(MockComparatorCopierTest, customObjectParameterFailsWhenNotHavingAComparisonRepository)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting object(1);
mock().expectOneCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock().actualCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
MockNoWayToCompareCustomTypeFailure expectedFailure(mockFailureTest(), "MyTypeForTesting");
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
TEST(MockComparatorCopierTest, customObjectParameterFailsWhenNotHavingACopierRepository)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting object(1);
mock().expectOneCall("function").withOutputParameterOfTypeReturning("MyTypeForTesting", "parameterName", &object);
mock().actualCall("function").withOutputParameterOfType("MyTypeForTesting", "parameterName", &object);
MockNoWayToCopyCustomTypeFailure expectedFailure(mockFailureTest(), "MyTypeForTesting");
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
TEST(MockComparatorCopierTest, customObjectParameterSucceeds)
{
MyTypeForTesting object(1);
MyTypeForTestingComparator comparator;
mock().installComparator("MyTypeForTesting", comparator);
mock().expectOneCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock().actualCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock().checkExpectations();
mock().removeAllComparatorsAndCopiers();
}
static bool myTypeIsEqual(const void* object1, const void* object2)
{
return ((const MyTypeForTesting*)object1)->value == ((const MyTypeForTesting*)object2)->value;
}
static SimpleString myTypeValueToString(const void* object)
{
return StringFrom(((const MyTypeForTesting*)object)->value);
}
TEST(MockComparatorCopierTest, customObjectWithFunctionComparator)
{
MyTypeForTesting object(1);
MockFunctionComparator comparator(myTypeIsEqual, myTypeValueToString);
mock().installComparator("MyTypeForTesting", comparator);
mock().expectOneCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock().actualCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock().checkExpectations();
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, customObjectWithFunctionComparatorThatFailsCoversValueToString)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting object(5);
MockFunctionComparator comparator(myTypeIsEqual, myTypeValueToString);
mock().installComparator("MyTypeForTesting", comparator);
MockExpectedCallsListForTest expectations;
expectations.addFunction("function")->withParameterOfType("MyTypeForTesting", "parameterName", &object);
MockExpectedCallsDidntHappenFailure failure(UtestShell::getCurrent(), expectations);
mock().expectOneCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock().checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE_LOCATION(failure, __FILE__, __LINE__);
}
TEST(MockComparatorCopierTest, customTypeOutputParameterSucceeds)
{
MyTypeForTesting expectedObject(55);
MyTypeForTesting actualObject(99);
MyTypeForTestingCopier copier;
mock().installCopier("MyTypeForTesting", copier);
mock().expectOneCall("function").withOutputParameterOfTypeReturning("MyTypeForTesting", "parameterName", &expectedObject);
mock().actualCall("function").withOutputParameterOfType("MyTypeForTesting", "parameterName", &actualObject);
mock().checkExpectations();
CHECK_EQUAL(55, *(expectedObject.value));
CHECK_EQUAL(55, *(actualObject.value));
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, noActualCallForCustomTypeOutputParameter)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting expectedObject(1);
MyTypeForTestingCopier copier;
mock().installCopier("MyTypeForTesting", copier);
MockExpectedCallsListForTest expectations;
expectations.addFunction("foo")->withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
MockExpectedCallsDidntHappenFailure expectedFailure(mockFailureTest(), expectations);
mock().expectOneCall("foo").withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
mock().checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, unexpectedCustomTypeOutputParameter)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting actualObject(8834);
MyTypeForTestingCopier copier;
mock().installCopier("MyTypeForTesting", copier);
MockExpectedCallsListForTest expectations;
expectations.addFunction("foo");
MockNamedValue parameter("parameterName");
parameter.setConstObjectPointer("MyTypeForTesting", &actualObject);
MockUnexpectedOutputParameterFailure expectedFailure(mockFailureTest(), "foo", parameter, expectations);
mock().expectOneCall("foo");
mock().actualCall("foo").withOutputParameterOfType("MyTypeForTesting", "parameterName", &actualObject);
mock().checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, customTypeOutputParameterMissing)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting expectedObject(123464);
MyTypeForTestingCopier copier;
mock().installCopier("MyTypeForTesting", copier);
MockExpectedCallsListForTest expectations;
expectations.addFunction("foo")->withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
MockExpectedParameterDidntHappenFailure expectedFailure(mockFailureTest(), "foo", expectations);
mock().expectOneCall("foo").withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
mock().actualCall("foo");
mock().checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, customTypeOutputParameterOfWrongType)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting expectedObject(123464);
MyTypeForTesting actualObject(75646);
MyTypeForTestingCopier copier;
mock().installCopier("MyTypeForTesting", copier);
MockExpectedCallsListForTest expectations;
expectations.addFunction("foo")->withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
MockNamedValue parameter("output");
parameter.setConstObjectPointer("OtherTypeForTesting", &actualObject);
MockUnexpectedOutputParameterFailure expectedFailure(mockFailureTest(), "foo", parameter, expectations);
mock().expectOneCall("foo").withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
mock().actualCall("foo").withOutputParameterOfType("OtherTypeForTesting", "output", &actualObject);
mock().checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, noCopierForCustomTypeOutputParameter)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting expectedObject(123464);
MyTypeForTesting actualObject(8834);
MockExpectedCallsListForTest expectations;
expectations.addFunction("foo")->withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
MockNoWayToCopyCustomTypeFailure expectedFailure(mockFailureTest(), "MyTypeForTesting");
mock().expectOneCall("foo").withOutputParameterOfTypeReturning("MyTypeForTesting", "output", &expectedObject);
mock().actualCall("foo").withOutputParameterOfType("MyTypeForTesting", "output", &actualObject);
mock().checkExpectations();
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
TEST(MockComparatorCopierTest, twoCustomTypeOutputParameters)
{
MyTypeForTesting expectedObject1(545);
MyTypeForTesting actualObject1(979);
MyTypeForTesting expectedObject2(123);
MyTypeForTesting actualObject2(4567);
MyTypeForTestingCopier copier;
mock().installCopier("MyTypeForTesting", copier);
mock().expectOneCall("function").withOutputParameterOfTypeReturning("MyTypeForTesting", "parameterName", &expectedObject1).withParameter("id", 1);
mock().expectOneCall("function").withOutputParameterOfTypeReturning("MyTypeForTesting", "parameterName", &expectedObject2).withParameter("id", 2);
mock().actualCall("function").withOutputParameterOfType("MyTypeForTesting", "parameterName", &actualObject1).withParameter("id", 1);
mock().actualCall("function").withOutputParameterOfType("MyTypeForTesting", "parameterName", &actualObject2).withParameter("id", 2);
mock().checkExpectations();
CHECK_EQUAL(545, *(expectedObject1.value));
CHECK_EQUAL(545, *(actualObject1.value));
CHECK_EQUAL(123, *(expectedObject2.value));
CHECK_EQUAL(123, *(actualObject2.value));
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, twoInterleavedCustomTypeOutputParameters)
{
MyTypeForTesting expectedObject1(9545);
MyTypeForTesting actualObject1(79);
MyTypeForTesting expectedObject2(132);
MyTypeForTesting actualObject2(743);
MyTypeForTestingCopier copier;
mock().installCopier("MyTypeForTesting", copier);
mock().expectOneCall("function").withOutputParameterOfTypeReturning("MyTypeForTesting", "parameterName", &expectedObject1).withParameter("id", 1);
mock().expectOneCall("function").withOutputParameterOfTypeReturning("MyTypeForTesting", "parameterName", &expectedObject2).withParameter("id", 2);
mock().actualCall("function").withOutputParameterOfType("MyTypeForTesting", "parameterName", &actualObject2).withParameter("id", 2);
mock().actualCall("function").withOutputParameterOfType("MyTypeForTesting", "parameterName", &actualObject1).withParameter("id", 1);
mock().checkExpectations();
CHECK_EQUAL(9545, *(expectedObject1.value));
CHECK_EQUAL(9545, *(actualObject1.value));
CHECK_EQUAL(132, *(expectedObject2.value));
CHECK_EQUAL(132, *(actualObject2.value));
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, twoDifferentCustomTypeOutputParametersInSameFunctionCallSucceeds)
{
MyTypeForTesting expectedObject1(11);
MyTypeForTesting actualObject1(22);
MyTypeForTesting expectedObject2(33);
MyTypeForTesting actualObject2(44);
MyTypeForTestingCopier copier;
mock().installCopier("MyTypeForTesting", copier);
mock().expectOneCall("foo")
.withOutputParameterOfTypeReturning("MyTypeForTesting", "bar", &expectedObject1)
.withOutputParameterOfTypeReturning("MyTypeForTesting", "foobar", &expectedObject2);
mock().actualCall("foo")
.withOutputParameterOfType("MyTypeForTesting", "bar", &actualObject1)
.withOutputParameterOfType("MyTypeForTesting", "foobar", &actualObject2);
mock().checkExpectations();
CHECK_EQUAL(11, *(expectedObject1.value));
CHECK_EQUAL(11, *(actualObject1.value));
CHECK_EQUAL(33, *(expectedObject2.value));
CHECK_EQUAL(33, *(actualObject2.value));
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, customTypeOutputAndInputParametersOfSameNameInDifferentFunctionCallsOfSameFunctionSucceeds)
{
MyTypeForTesting expectedObject1(911);
MyTypeForTesting actualObject1(6576878);
MyTypeForTesting expectedObject2(123);
MyTypeForTesting actualObject2(123);
MyTypeForTestingCopier copier;
MyTypeForTestingComparator comparator;
mock().installCopier("MyTypeForTesting", copier);
mock().installComparator("MyTypeForTesting", comparator);
mock().expectOneCall("foo").withOutputParameterOfTypeReturning("MyTypeForTesting", "bar", &expectedObject1);
mock().expectOneCall("foo").withParameterOfType("MyTypeForTesting", "bar", &expectedObject2);
mock().actualCall("foo").withOutputParameterOfType("MyTypeForTesting", "bar", &actualObject1);
mock().actualCall("foo").withParameterOfType("MyTypeForTesting", "bar", &actualObject2);
mock().checkExpectations();
CHECK_EQUAL(911, *(expectedObject1.value));
CHECK_EQUAL(911, *(actualObject1.value));
CHECK_EQUAL(123, *(expectedObject2.value));
CHECK_EQUAL(123, *(actualObject2.value));
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, twoCustomTypeOutputParametersOfSameNameInDifferentFunctionsSucceeds)
{
MyTypeForTesting expectedObject1(657);
MyTypeForTesting actualObject1(984465);
MyTypeForTesting expectedObject2(987);
MyTypeForTesting actualObject2(987);
MyTypeForTestingCopier copier;
MyTypeForTestingComparator comparator;
mock().installCopier("MyTypeForTesting", copier);
mock().installComparator("MyTypeForTesting", comparator);
mock().expectOneCall("foo1").withOutputParameterOfTypeReturning("MyTypeForTesting", "bar", &expectedObject1);
mock().expectOneCall("foo2").withParameterOfType("MyTypeForTesting", "bar", &expectedObject2);
mock().actualCall("foo1").withOutputParameterOfType("MyTypeForTesting", "bar", &actualObject1);
mock().actualCall("foo2").withParameterOfType("MyTypeForTesting", "bar", &actualObject2);
mock().checkExpectations();
CHECK_EQUAL(657, *(expectedObject1.value));
CHECK_EQUAL(657, *(actualObject1.value));
CHECK_EQUAL(987, *(expectedObject2.value));
CHECK_EQUAL(987, *(actualObject2.value));
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, customTypeOutputAndInputParameterOfSameTypeInSameFunctionCall)
{
MyTypeForTesting expectedObject1(45);
MyTypeForTesting actualObject1(45);
MyTypeForTesting expectedObject2(987765443);
MyTypeForTesting actualObject2(0);
MyTypeForTestingCopier copier;
MyTypeForTestingComparator comparator;
mock().installCopier("MyTypeForTesting", copier);
mock().installComparator("MyTypeForTesting", comparator);
mock().expectOneCall("foo")
.withParameterOfType("MyTypeForTesting", "bar", &expectedObject1)
.withOutputParameterOfTypeReturning("MyTypeForTesting", "bar", &expectedObject2);
mock().actualCall("foo")
.withParameterOfType("MyTypeForTesting", "bar", &actualObject1)
.withOutputParameterOfType("MyTypeForTesting", "bar", &actualObject2);
mock().checkExpectations();
CHECK_EQUAL(45, *(expectedObject1.value));
CHECK_EQUAL(45, *(actualObject1.value));
CHECK_EQUAL(987765443, *(expectedObject2.value));
CHECK_EQUAL(987765443, *(actualObject2.value));
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, customTypeOutputParameterTraced)
{
MyTypeForTesting actualObject(676789);
MyTypeForTestingCopier copier;
mock().installCopier("MyTypeForTesting", copier);
mock().tracing(true);
mock().actualCall("someFunc").withOutputParameterOfType("MyTypeForTesting", "someParameter", &actualObject);
mock().checkExpectations();
STRCMP_CONTAINS("Function name:someFunc MyTypeForTesting someParameter:", mock().getTraceOutput());
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, customTypeOutputParameterWithIgnoredParameters)
{
MyTypeForTesting expectedObject(444537909);
MyTypeForTesting actualObject(98765);
MyTypeForTestingCopier copier;
mock().installCopier("MyTypeForTesting", copier);
mock().expectOneCall("foo").withOutputParameterOfTypeReturning("MyTypeForTesting", "bar", &expectedObject).ignoreOtherParameters();
mock().actualCall("foo").withOutputParameterOfType("MyTypeForTesting", "bar", &actualObject).withParameter("other", 1);
mock().checkExpectations();
CHECK_EQUAL(444537909, *(expectedObject.value));
CHECK_EQUAL(444537909, *(actualObject.value));
mock().removeAllComparatorsAndCopiers();
}
static void myTypeCopy(void* dst_, const void* src_)
{
MyTypeForTesting* dst = (MyTypeForTesting*) dst_;
const MyTypeForTesting* src = (const MyTypeForTesting*) src_;
*(dst->value) = *(src->value);
}
TEST(MockComparatorCopierTest, customObjectWithFunctionCopier)
{
MyTypeForTesting expectedObject(9874452);
MyTypeForTesting actualObject(2034);
MockFunctionCopier copier(myTypeCopy);
mock().installCopier("MyTypeForTesting", copier);
mock().expectOneCall("function").withOutputParameterOfTypeReturning("MyTypeForTesting", "parameterName", &expectedObject);
mock().actualCall("function").withOutputParameterOfType("MyTypeForTesting", "parameterName", &actualObject);
mock().checkExpectations();
CHECK_EQUAL(9874452, *(expectedObject.value));
CHECK_EQUAL(9874452, *(actualObject.value));
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, removingComparatorsWorksHierachically)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting object(1);
MyTypeForTestingComparator comparator;
mock("scope").installComparator("MyTypeForTesting", comparator);
mock().removeAllComparatorsAndCopiers();
mock("scope").expectOneCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock("scope").actualCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
MockNoWayToCompareCustomTypeFailure expectedFailure(mockFailureTest(), "MyTypeForTesting");
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
TEST(MockComparatorCopierTest, removingCopiersWorksHierachically)
{
MockFailureReporterInstaller failureReporterInstaller;
MyTypeForTesting object(1);
MyTypeForTestingCopier copier;
mock("scope").installCopier("MyTypeForTesting", copier);
mock().removeAllComparatorsAndCopiers();
mock("scope").expectOneCall("foo").withOutputParameterOfTypeReturning("MyTypeForTesting", "bar", &object);
mock("scope").actualCall("foo").withOutputParameterOfType("MyTypeForTesting", "bar", &object);
MockNoWayToCopyCustomTypeFailure expectedFailure(mockFailureTest(), "MyTypeForTesting");
CHECK_EXPECTED_MOCK_FAILURE(expectedFailure);
}
TEST(MockComparatorCopierTest, installComparatorWorksHierarchicalOnBothExistingAndDynamicallyCreatedMockSupports)
{
MyTypeForTesting object(1);
MyTypeForTestingComparator comparator;
mock("existing");
mock().installComparator("MyTypeForTesting", comparator);
mock("existing").expectOneCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock("existing").actualCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock("dynamic").expectOneCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock("dynamic").actualCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock().checkExpectations();
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, installComparatorsWorksHierarchical)
{
MyTypeForTesting object(1);
MyTypeForTestingComparator comparator;
MockNamedValueComparatorsAndCopiersRepository repos;
repos.installComparator("MyTypeForTesting", comparator);
mock("existing");
mock().installComparatorsAndCopiers(repos);
mock("existing").expectOneCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock("existing").actualCall("function").withParameterOfType("MyTypeForTesting", "parameterName", &object);
mock().checkExpectations();
mock().removeAllComparatorsAndCopiers();
}
TEST(MockComparatorCopierTest, installCopiersWorksHierarchically)
{
MyTypeForTesting object(1);
MyTypeForTestingCopier copier;
mock("existing");
mock().installCopier("MyTypeForTesting", copier);
mock("existing").expectOneCall("function").withOutputParameterOfTypeReturning("MyTypeForTesting", "parameterName", &object);
mock("existing").actualCall("function").withOutputParameterOfType("MyTypeForTesting", "parameterName", &object);
mock().checkExpectations();
mock().removeAllComparatorsAndCopiers();
}
class StubComparator : public MockNamedValueComparator
{
public:
virtual bool isEqual(const void*, const void*)
{
return true;
}
virtual SimpleString valueToString(const void*)
{
return "";
}
};
struct SomeClass
{
int someDummy_;
};
static void functionWithConstParam(const SomeClass param)
{
mock().actualCall("functionWithConstParam").withParameterOfType("SomeClass", "param", ¶m);
}
TEST(MockComparatorCopierTest, shouldSupportConstParameters)
{
StubComparator comparator;
mock().installComparator("SomeClass", comparator);
SomeClass param;
mock().expectOneCall("functionWithConstParam").withParameterOfType("SomeClass", "param", ¶m);
functionWithConstParam(param);
mock().checkExpectations();
}
| 40.945 | 151 | 0.747018 | [
"object"
] |
134c2750a7bbf0016fbb59080bb94834d49fef33 | 7,935 | cpp | C++ | Source/TriangleInfoManager.cpp | sultim-t/RayTracedGL1 | f226f97f97554854cad807578efa282a5620bcb4 | [
"MIT"
] | 17 | 2021-09-05T01:34:40.000Z | 2022-03-12T03:25:38.000Z | Source/TriangleInfoManager.cpp | sultim-t/RayTracedGL1 | f226f97f97554854cad807578efa282a5620bcb4 | [
"MIT"
] | null | null | null | Source/TriangleInfoManager.cpp | sultim-t/RayTracedGL1 | f226f97f97554854cad807578efa282a5620bcb4 | [
"MIT"
] | 3 | 2021-11-14T01:02:25.000Z | 2022-02-14T08:56:22.000Z | // Copyright (c) 2021 Sultim Tsyrendashiev
//
// 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 "TriangleInfoManager.h"
#include "Generated/ShaderCommonC.h"
constexpr VkDeviceSize TRIANGLE_INFO_SIZE = sizeof(uint32_t);
RTGL1::TriangleInfoManager::TriangleInfoManager(
VkDevice _device,
std::shared_ptr<MemoryAllocator> &_allocator,
std::shared_ptr<SectorVisibility> _sectorVisibility)
:
device(_device),
sectorVisibility(std::move(_sectorVisibility)),
staticGeometryRange(0),
dynamicGeometryRange(0),
copyStaticRange(false)
{
triangleSectorIndicesBuffer = std::make_unique<AutoBuffer>(device, _allocator, "Triangle info staging buffer", "Triangle info buffer");
triangleSectorIndicesBuffer->Create(MAX_INDEXED_PRIMITIVE_COUNT * TRIANGLE_INFO_SIZE, VK_BUFFER_USAGE_STORAGE_BUFFER_BIT);
static_assert(sizeof(decltype(tempValues)::value_type) == TRIANGLE_INFO_SIZE, "");
}
RTGL1::TriangleInfoManager::~TriangleInfoManager()
{}
uint32_t RTGL1::TriangleInfoManager::UploadAndGetArrayIndex(uint32_t frameIndex, const uint32_t *pTriangleSectorIDs, uint32_t count, RgGeometryType geomType)
{
if (pTriangleSectorIDs == nullptr || count == 0)
{
return GEOM_INST_NO_TRIANGLE_INFO;
}
if (geomType == RG_GEOMETRY_TYPE_STATIC_MOVABLE)
{
assert(0 && "Static movable triangle info (vertex/index arrays) should be uploaded only once. "
"However, if movable geometry moved, sector IDs are invalid. So we need to enforce new pTriangleSectorIDs "
"on movable geometry transform change. It's not implemented.\n"
"Another solution is to assume that dynamic/movable objects are smaller than sector, so whole "
"geometry has only one sector ID, and for movable ShGeometryInstance can be updated along with its new transform");
return GEOM_INST_NO_TRIANGLE_INFO;
}
auto &indices = TransformIdsToIndices(pTriangleSectorIDs, count);
uint32_t startIndexInArray;
if (geomType == RG_GEOMETRY_TYPE_DYNAMIC)
{
// trying to add first dynamic, lock static
if (dynamicGeometryRange.GetCount() == 0)
{
staticGeometryRange.Lock();
}
// to add dynamic, static must be already locked
assert(staticGeometryRange.IsLocked());
startIndexInArray = dynamicGeometryRange.GetFirstIndexAfterRange();
uint32_t *pDst = (uint32_t *)triangleSectorIndicesBuffer->GetMapped(frameIndex);
memcpy(&pDst[startIndexInArray], indices.data(), indices.size() * TRIANGLE_INFO_SIZE);
dynamicGeometryRange.Add(indices.size());
}
else
{
startIndexInArray = staticGeometryRange.GetFirstIndexAfterRange();
// need to copy static geom data to both staging buffers, to be able to upload it in any frameIndex
for (uint32_t f = 0; f < MAX_FRAMES_IN_FLIGHT; f++)
{
uint32_t *pDst = (uint32_t *)triangleSectorIndicesBuffer->GetMapped(f);
memcpy(&pDst[startIndexInArray], indices.data(), indices.size() * TRIANGLE_INFO_SIZE);
}
staticGeometryRange.Add(indices.size());
// update dynamic, as it should start right after static
dynamicGeometryRange.StartIndexingAfter(staticGeometryRange);
}
indices.clear();
return startIndexInArray;
}
void RTGL1::TriangleInfoManager::PrepareForFrame(uint32_t frameIndex)
{
// start dynamic again, but don't touch static geom indices
dynamicGeometryRange.Reset(0);
dynamicGeometryRange.StartIndexingAfter(staticGeometryRange);
}
void RTGL1::TriangleInfoManager::Reset()
{
staticGeometryRange.Reset(0);
dynamicGeometryRange.Reset(0);
copyStaticRange = true;
}
std::vector<RTGL1::SectorArrayIndex::index_t> &RTGL1::TriangleInfoManager::TransformIdsToIndices(const uint32_t *pTriangleSectorIDs, uint32_t count)
{
assert(tempValues.empty());
tempValues.reserve(count);
for (uint32_t i = 0; i < count; i++)
{
SectorID id = SectorID{ pTriangleSectorIDs[i] };
tempValues.push_back(sectorVisibility->SectorIDToArrayIndex(id).GetArrayIndex());
}
return tempValues;
}
bool RTGL1::TriangleInfoManager::CopyFromStaging(VkCommandBuffer cmd, uint32_t frameIndex, bool insertBarrier)
{
VkBufferCopy copyInfos[2] = {};
uint32_t cc = 0;
if (staticGeometryRange.GetCount() > 0 && copyStaticRange)
{
copyInfos[cc].srcOffset = copyInfos[cc].dstOffset = staticGeometryRange.GetStartIndex() * TRIANGLE_INFO_SIZE;
copyInfos[cc].size = staticGeometryRange.GetCount() * TRIANGLE_INFO_SIZE;
cc++;
}
if (dynamicGeometryRange.GetCount() > 0)
{
copyInfos[cc].srcOffset = copyInfos[cc].dstOffset = dynamicGeometryRange.GetStartIndex() * TRIANGLE_INFO_SIZE;
copyInfos[cc].size = dynamicGeometryRange.GetCount() * TRIANGLE_INFO_SIZE;
cc++;
}
triangleSectorIndicesBuffer->CopyFromStaging(cmd, frameIndex, copyInfos, cc);
if (insertBarrier)
{
VkBufferMemoryBarrier barriers[2] = {};
uint32_t bc = 0;
if (staticGeometryRange.GetCount() > 0 && copyStaticRange)
{
auto &b = barriers[bc];
b.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
b.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
b.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
b.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
b.buffer = triangleSectorIndicesBuffer->GetDeviceLocal();
b.offset = staticGeometryRange.GetStartIndex() * TRIANGLE_INFO_SIZE;
b.size = staticGeometryRange.GetCount() * TRIANGLE_INFO_SIZE;
bc++;
}
if (dynamicGeometryRange.GetCount() > 0)
{
auto &b = barriers[bc];
b.sType = VK_STRUCTURE_TYPE_BUFFER_MEMORY_BARRIER;
b.srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
b.dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED;
b.srcAccessMask = VK_ACCESS_TRANSFER_WRITE_BIT;
b.dstAccessMask = VK_ACCESS_SHADER_READ_BIT;
b.buffer = triangleSectorIndicesBuffer->GetDeviceLocal();
b.offset = dynamicGeometryRange.GetStartIndex() * TRIANGLE_INFO_SIZE;
b.size = dynamicGeometryRange.GetCount() * TRIANGLE_INFO_SIZE;
bc++;
}
vkCmdPipelineBarrier(
cmd,
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT | VK_PIPELINE_STAGE_RAY_TRACING_SHADER_BIT_KHR,
0,
0, nullptr,
bc, barriers,
0, nullptr);
}
copyStaticRange = false;
return true;
}
VkBuffer RTGL1::TriangleInfoManager::GetBuffer() const
{
return triangleSectorIndicesBuffer->GetDeviceLocal();
}
| 36.906977 | 157 | 0.698551 | [
"geometry",
"vector",
"transform"
] |
1354d4178bfd8045d0ae1a4ee23a088a029f9d22 | 4,454 | cpp | C++ | third_parties/wcsp/src/LinearProgramSolverGurobi.cpp | nandofioretto/py_dcop | fb2dbc97b69360f5d1fb67d84749e44afcdf48c3 | [
"Apache-2.0"
] | 4 | 2018-08-06T08:55:36.000Z | 2018-09-28T12:54:21.000Z | third_parties/wcsp/src/LinearProgramSolverGurobi.cpp | nandofioretto/py_dcop | fb2dbc97b69360f5d1fb67d84749e44afcdf48c3 | [
"Apache-2.0"
] | null | null | null | third_parties/wcsp/src/LinearProgramSolverGurobi.cpp | nandofioretto/py_dcop | fb2dbc97b69360f5d1fb67d84749e44afcdf48c3 | [
"Apache-2.0"
] | null | null | null | /*
Copyright (c) 2016-2017 Hong Xu
This file is part of WCSPLift.
WCSPLift 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.
WCSPLift 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 WCSPLift. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_GUROBI
#include "LinearProgramSolverGurobi.h"
#include <iostream>
LinearProgramSolverGurobi::LinearProgramSolverGurobi()
{
try
{
gurobiEnv.reset(new GRBEnv());
gurobiEnv->set(GRB_IntParam_Threads, 1); // single thread
gurobiModel.reset(new GRBModel(*gurobiEnv));
} catch (GRBException e)
{
std::cerr << "Gurobi Error code: " << e.getErrorCode() << std::endl;
throw e;
}
}
LinearProgramSolverGurobi::~LinearProgramSolverGurobi() = default;
LinearProgramSolver::variable_id_t LinearProgramSolverGurobi::addVariable(
double coefficient, VarType type, double lb, double ub)
{
char gurobi_type;
switch (type)
{
case VarType::BINARY:
gurobi_type = GRB_BINARY;
break;
case VarType::CONTINUOUS:
gurobi_type = GRB_CONTINUOUS;
break;
}
// Store the variable object in an array
gurobiVariables.push_back(
gurobiModel->addVar(lb, ub, coefficient, gurobi_type));
objectiveCoefficients.push_back(coefficient);
return gurobiVariables.size() - 1;
}
LinearProgramSolver::constraint_id_t LinearProgramSolverGurobi::addConstraint(
const std::vector<variable_id_t>& variables,
const std::vector<double>& coefficients, double rhs,
ConstraintType type)
{
if (variables.empty())
return -1;
// Get the corresponding Gurobi constraint type from our definition of constraint type.
char gurobi_type;
switch (type)
{
case ConstraintType::LESS_EQUAL:
gurobi_type = GRB_LESS_EQUAL;
break;
case ConstraintType::GREATER_EQUAL:
gurobi_type = GRB_GREATER_EQUAL;
break;
case ConstraintType::EQUAL:
gurobi_type = GRB_EQUAL;
break;
}
// Construct the left hand side expression.
GRBLinExpr lhs_expr;
for (size_t i = 0; i < variables.size(); ++ i)
lhs_expr.addTerms(&coefficients[i], &gurobiVariables.at(variables[i]), 1);
gurobiConstraints.push_back(gurobiModel->addConstr(lhs_expr, gurobi_type, rhs));
return gurobiConstraints.size() - 1;
}
void LinearProgramSolverGurobi::setObjectiveType(ObjectiveType type)
{
char gurobi_type;
switch (type)
{
case ObjectiveType::MIN:
gurobi_type = GRB_MINIMIZE;
break;
case ObjectiveType::MAX:
gurobi_type = GRB_MAXIMIZE;
break;
}
gurobiModel->update();
// Construct the objective expression.
GRBLinExpr expr;
expr.addTerms(&objectiveCoefficients[0],
&gurobiVariables[0], gurobiVariables.size());
gurobiModel->setObjective(expr, gurobi_type);
}
double LinearProgramSolverGurobi::solve(std::vector<double>& assignments)
{
assignments.clear();
gurobiModel->update();
try
{
gurobiModel->optimize();
if (gurobiModel->get(GRB_IntAttr_Status) == GRB_TIME_LIMIT)
throw LinearProgramSolver::TimeOutException("");
// Assign the values of the variables.
assignments.reserve(gurobiVariables.size());
for (auto& v : gurobiVariables)
assignments.push_back(v.get(GRB_DoubleAttr_X));
} catch (GRBException e)
{
return 0.0;
}
return gurobiModel->get(GRB_DoubleAttr_ObjVal);
}
void LinearProgramSolverGurobi::reset()
{
objectiveCoefficients.clear();
gurobiVariables.clear();
gurobiConstraints.clear();
std::unique_ptr<GRBEnv> env = std::move(gurobiEnv);
gurobiEnv.reset(new GRBEnv());
gurobiEnv->set(GRB_IntParam_Threads, 1); // single thread
gurobiModel.reset(new GRBModel(*gurobiEnv));
}
void LinearProgramSolverGurobi::setTimeLimit(double t)
{
gurobiModel->getEnv().set(GRB_DoubleParam_TimeLimit, t);
}
#endif // HAVE_GUROBI
| 27.158537 | 91 | 0.687023 | [
"object",
"vector"
] |
135c3876b246027b96268f590dd0ef0c9da8e9ca | 1,281 | hpp | C++ | isotactics/iso-lib/include/HelperMaps.hpp | flange/esp | 78925925daf876e4936ca7af046b4f884e8a4233 | [
"MIT"
] | 5 | 2017-08-22T12:24:07.000Z | 2019-05-21T07:51:38.000Z | isotactics/iso-lib/include/HelperMaps.hpp | flange/esp | 78925925daf876e4936ca7af046b4f884e8a4233 | [
"MIT"
] | null | null | null | isotactics/iso-lib/include/HelperMaps.hpp | flange/esp | 78925925daf876e4936ca7af046b4f884e8a4233 | [
"MIT"
] | 3 | 2017-08-24T10:44:26.000Z | 2017-09-13T01:18:26.000Z | #ifndef __HELPERMAPS_HPP__
#define __HELPERMAPS_HPP__
#include <set>
#include <unordered_map>
#include <vector>
#include "AlignmentUtils.hpp"
#include "GraphUtils.hpp"
#include "Utils.hpp"
using labelGroupingMap = std::unordered_map<label, alignmentGrouping>;
using labelAlmSubMap = std::unordered_map<label, alignmentSub>;
using edgeLabelSet = std::set<alignmentGrouping>;
using labelPermissivenessMap = std::unordered_map<label, int>;
namespace Helper {
labelGroupingMap LabelGroupingMap(const Graph_t &g, const alignmentHalf &alh);
labelAlmSubMap LabelAlmSubMap(const Graph_t &g, const alignment &alm);
edgeLabelSet lgmFlatten(const labelGroupingMap &lgm);
std::vector<label> elsFlatten(const edgeLabelSet &els);
void labelsToGroupings(Graph_t &g, labelGroupingMap &lgm);
labelPermissivenessMap emptyLpm(const alignment &alm);
labelPermissivenessMap LabelPermissivenessMap(const alignment &alm);
int maxPermissiveness(const alignment &alm);
int maxComplexity(const alignment &alm);
int alignmentNorm(const alignment &alm);
void printLgm(const labelGroupingMap &lgm);
void printLsm(const labelAlmSubMap &lsm);
void printEls(const edgeLabelSet &els);
void printLpm(const labelPermissivenessMap &lpm);
}
#endif // __HELPERMAPS_HPP__
| 25.62 | 80 | 0.786105 | [
"vector"
] |
135c5de691fed83be056b5c56dab57e2bd119c79 | 813 | cpp | C++ | C++/zigzag-iterator.cpp | xtt129/LeetCode | 1afa893d38e2fce68e4677b34169c0f0262b6fac | [
"MIT"
] | 2 | 2020-04-08T17:57:43.000Z | 2021-11-07T09:11:51.000Z | C++/zigzag-iterator.cpp | xtt129/LeetCode | 1afa893d38e2fce68e4677b34169c0f0262b6fac | [
"MIT"
] | null | null | null | C++/zigzag-iterator.cpp | xtt129/LeetCode | 1afa893d38e2fce68e4677b34169c0f0262b6fac | [
"MIT"
] | 8 | 2018-03-13T18:20:26.000Z | 2022-03-09T19:48:11.000Z | // Time: O(n)
// Space: O(k)
class ZigzagIterator {
public:
ZigzagIterator(vector<int>& v1, vector<int>& v2) {
if (!v1.empty()) {
q.emplace(make_pair(v1.size(), v1.cbegin()));
}
if (!v2.empty()) {
q.emplace(make_pair(v2.size(), v2.cbegin()));
}
}
int next() {
const auto len = q.front().first;
const auto it = q.front().second;
q.pop();
if (len > 1) {
q.emplace(make_pair(len - 1, it + 1));
}
return *it;
}
bool hasNext() {
return !q.empty();
}
private:
queue<pair<int, vector<int>::const_iterator>> q;
};
/**
* Your ZigzagIterator object will be instantiated and called as such:
* ZigzagIterator i(v1, v2);
* while (i.hasNext()) cout << i.next();
*/
| 21.394737 | 70 | 0.507995 | [
"object",
"vector"
] |
135d4b3df1ffe7de41b59584ec1d470549b84b21 | 973 | hpp | C++ | include/caffe/layers/loss/styleloss_layer.hpp | JEF1056/MetaLearning-Neural-Style | 94ac33cb6a62c4de8ff2aeac3572afd61f1bda5d | [
"MIT"
] | 126 | 2017-09-14T01:53:15.000Z | 2021-03-24T08:57:41.000Z | include/caffe/layers/loss/styleloss_layer.hpp | hli1221/styletransfer | 5101f2c024638d3e111644c64398b3290fdeaec6 | [
"BSD-2-Clause"
] | 17 | 2017-09-14T09:11:50.000Z | 2019-11-27T08:56:52.000Z | include/caffe/layers/loss/styleloss_layer.hpp | hli1221/styletransfer | 5101f2c024638d3e111644c64398b3290fdeaec6 | [
"BSD-2-Clause"
] | 34 | 2017-09-14T09:14:21.000Z | 2020-12-16T09:49:40.000Z |
#ifndef CAFFE_StyleLoss_LAYER_HPP_
#define CAFFE_StyleLoss_LAYER_HPP_
#include <vector>
#include "caffe/blob.hpp"
#include "caffe/layer.hpp"
#include "caffe/proto/caffe.pb.h"
namespace caffe {
class StyleLossLayer : public Layer {
public:
explicit StyleLossLayer(const LayerParameter& param): Layer(param) {}
virtual inline const char* type() const { return "StyleLoss"; }
virtual void LayerSetUp(const vector<Blob*>& bottom, const vector<Blob*>& top);
virtual void Reshape(const vector<Blob*>& bottom, const vector<Blob*>& top);
virtual void Forward_gpu(const vector<Blob*>& bottom, const vector<Blob*>& top);
virtual void Backward_gpu(const vector<Blob*>& top, const vector<Blob*>& bottom);
virtual void SecForward_gpu(const vector<Blob*>& bottom, const vector<Blob*>& top);
protected:
Blob * buffer_0_;
Blob * buffer_1_;
Blob * buffer_delta_;
Blob * buffer_square_;
};
} // namespace caffe
#endif // CAFFE_StyleLossLAYER_HPP_
| 23.731707 | 85 | 0.73073 | [
"vector"
] |
13631d28850336363d557b7e4ecb266b578fb612 | 1,664 | cpp | C++ | problems/545.boundary-of-binary-tree.cpp | bigfishi/leetcode | 3e512f2822a742349384a0bdd7954696f5867683 | [
"MIT"
] | null | null | null | problems/545.boundary-of-binary-tree.cpp | bigfishi/leetcode | 3e512f2822a742349384a0bdd7954696f5867683 | [
"MIT"
] | null | null | null | problems/545.boundary-of-binary-tree.cpp | bigfishi/leetcode | 3e512f2822a742349384a0bdd7954696f5867683 | [
"MIT"
] | null | null | null | // 中等 根据左边界,叶子结点,右边界做,难度不大。错了一次,误解了题意,题目说不能有重复节点,可以有重复值,我理解成不能有重复数了。
class Solution {
void leftBoundry(TreeNode* root, vector<TreeNode*>& list) {
if (root) list.push_back(root);
else return;
if (!root->left) return;
TreeNode* cur = root->left;
while (cur)
{
list.push_back(cur);
if (cur->left) cur = cur->left;
else if (cur->right) cur = cur->right;
else cur = NULL;
}
}
void rightBoundry(TreeNode* root, vector<TreeNode*>& list) {
if (root) list.push_back(root);
else return;
if (!root->right) return;
TreeNode* cur = root->right;
while (cur)
{
list.push_back(cur);
if (cur->right) cur = cur->right;
else if (cur->left) cur = cur->left;
else cur = NULL;
}
}
void leafNode(TreeNode* root, vector<TreeNode*>& list) {
if (!root) return;
if (!root->left && !root->right) {
list.push_back(root);
return;
}
leafNode(root->left, list);
leafNode(root->right, list);
}
public:
vector<int> boundaryOfBinaryTree(TreeNode* root) {
vector<int> res;
if (!root) return res;
vector<TreeNode*> lb, ln, rb;
leftBoundry(root, lb);
leafNode(root, ln);
rightBoundry(root, rb);
reverse(rb.begin(), rb.end());
map<TreeNode*, int> record;
for (int i = 0; i < lb.size(); i++) {
if (record.find(lb[i]) == record.end()) {
record[lb[i]]++;
res.push_back(lb[i]->val);
}
}
for (int i = 0; i < ln.size(); i++) {
if (record.find(ln[i]) == record.end()) {
record[ln[i]]++;
res.push_back(ln[i]->val);
}
}
for (int i = 0; i < rb.size(); i++) {
if (record.find(rb[i]) == record.end()) {
record[rb[i]]++;
res.push_back(rb[i]->val);
}
}
return res;
}
}; | 24.470588 | 68 | 0.591346 | [
"vector"
] |
13653df608ae179fc7ec9273bc4e3315874943f2 | 5,053 | cpp | C++ | src/engine/engine.cpp | gregtour/tedge-cpp | 45f47ec7017d2124463430f1e584d9fb0dc8bdd8 | [
"Apache-2.0"
] | 1 | 2016-10-31T15:02:32.000Z | 2016-10-31T15:02:32.000Z | src/engine/engine.cpp | gregtour/tedge-cpp | 45f47ec7017d2124463430f1e584d9fb0dc8bdd8 | [
"Apache-2.0"
] | null | null | null | src/engine/engine.cpp | gregtour/tedge-cpp | 45f47ec7017d2124463430f1e584d9fb0dc8bdd8 | [
"Apache-2.0"
] | 1 | 2021-02-22T22:03:49.000Z | 2021-02-22T22:03:49.000Z | /*
* TeDGE:
* Team Duck Game Engine
*
* Copyright 2010 Team Duck
*/
/* Library Includes */
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#ifdef WIN32
#include <windows.h>
#endif
#include "SDL.h"
#include "SDL_opengl.h"
#include <GL/gl.h>
#include <GL/glu.h>
#include "SDL_mixer.h"
/* Accessory Classes */
#include "common/list.h"
#include "common/timer.h"
#include "common/resource.h"
#include "common/log.h"
//#include "common/profile.h"
/* Game Includes */
#include "entity/entity.h"
#include "entity/camera.h"
#include "engine.h"
#include "update.h"
#include "graphics/graphics.h"
#include "input/input.h"
//#include "sound/sound.h"
#include "physics/physics.h"
#ifdef _NETWORKING
#include "network/network.h"
#endif
/* Global Variables */
bool gRunning;
bool gActive;
bool gPaused;
CLinkedList<CEntity> gEntities;
CPhysics* gWorld = NULL;
CLog gLog;
CResourceManager gResourceManager;
CLinkedList<CCollision> gCollisions;
float gFPS;
int gState;
/* Code */
int Startup()
{
std::cout << "Startup..." << std::endl;
gState = DEFAULT_STATE;
gRunning = true;
gActive = true;
gPaused = false;
#ifdef _DEBUG
if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER | SDL_INIT_NOPARACHUTE /*| SDL_INIT_JOYSTICK */) != 0 )
return 0;
#else
if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO | SDL_INIT_TIMER /*| SDL_INIT_JOYSTICK */) != 0)
return 0;
#endif
// SDL_JoystickOpen(0);
// SDL_JoystickEventState(SDL_ENABLE);
gLog.ResetTimeStamp();
// ProfileInit();
if (
// SoundStartup() &&
GraphicsStartup() &&
#ifdef _NETWORKING
NetworkStartup() &&
#endif
SetupInput() &&
GamePrecache()
)
return 1;
return 0;
}
void Shutdown()
{
std::cout << "Shutdown..." << std::endl << std::endl << std::endl;
GameUnload();
// SoundShutdown();
GraphicsShutdown();
#ifdef _NETWORKING
NetworkShutdown();
#endif
SDL_Quit();
gResourceManager.UnloadAll();
}
void EndGame()
{
gRunning = false;
}
void ChangeGameState( int newState )
{
gState = newState;
}
void SdlEvents()
{
SDL_Event event;
while ( SDL_PollEvent( &event ) )
{
switch( event.type )
{
/* Window Focus */
case SDL_ACTIVEEVENT:
if ( event.active.gain == 0 )
gActive = true;
else
gActive = true;
break;
/* Any of the Input Event Types */
case SDL_MOUSEMOTION:
case SDL_MOUSEBUTTONDOWN:
case SDL_MOUSEBUTTONUP:
// case SDL_JOYAXISMOTION:
// case SDL_JOYBUTTONDOWN:
// case SDL_JOYBUTTONUP:
case SDL_KEYDOWN:
case SDL_KEYUP:
InputEvent( &event );
break;
case SDL_QUIT:
EndGame();
break;
}
}
}
void Game()
{
gLog.LogItem( new CLogMessage("Starting Up") );
if ( Startup() == 0 )
{
gLog.LogItem( new CLogMessage("Error Starting Up") );
gLog.LogItem( new CLogMessage("Shutting Down") );
Shutdown();
return;
}
gLog.LogItem( new CLogMessage("Starting Game") );
GameStart();
CGameTimer timer;
timer.Clear();
int ticks = SDL_GetTicks();
int lastTicks;
int oldState = gState;
int fpsTick = 0;
gFPS = 10.0f;
float total_time = 0.0f;
int total_frames = 0;
std::cout << "Main loop..." << std::endl;
gLog.LogItem( new CLogMessage("Entering Main Loop") );
while ( gRunning )
{
// std::cout << "Frame." << std::endl;
if ( oldState != gState )
GameStateChange( oldState, gState );
oldState = gState;
// std::cout << "Input." << std::endl;
gInputState->Update();
SdlEvents();
// std::cout << "Ticks." << std::endl;
lastTicks = ticks;
ticks = SDL_GetTicks();
if (gPaused)
CTimer::gPausedTicks += (ticks - lastTicks);
timer.Step();
total_time += (ticks - lastTicks) * 0.001f;
total_frames++;
fpsTick = (fpsTick+1) % (2);
if ( fpsTick == 0 ) {
gFPS = 1 / timer.DT();
if (total_time > 1.0f) {
printf("%.2f FPS\n", total_frames/total_time);
total_time = 0.0f;
total_frames = 0;
}
}
if ( gActive )
{
if ( !gPaused )
{
// std::cout << "Update." << std::endl;
GameUpdate( timer.DT() / 1.5f );
// std::cout << "Update Physics." << std::endl;
gWorld->Update( timer.DT() / 1.5f );
// std::cout << "Collision." << std::endl;
HandleCollisions();
} else {
GameUpdate(0.0f);
}
// std::cout << "Render." << std::endl;
GameRender();
}
}
gLog.LogItem( new CLogMessage("Shutting Down") );
gLog.LogItem( new CLogMessage("<3 HAL") );
Shutdown();
}
CEntity* FindFirst(std::string type)
{
CListEntry<CEntity>* ent = gEntities.GetFirst();
while (ent)
{
if (ent->data->ClassName().compare(type) == 0)
{
return ent->data;
}
ent = ent->GetNext();
}
return NULL;
}
| 19.140152 | 122 | 0.584801 | [
"render"
] |
1368c494e6fc7e178d898320cbcb678cc7337cc2 | 9,646 | cpp | C++ | to/lang/OpenCV-2.2.0/modules/highgui/src/grfmt_imageio.cpp | eirTony/INDI1 | 42642d8c632da53f60f2610b056547137793021b | [
"MIT"
] | 1 | 2019-02-28T07:40:01.000Z | 2019-02-28T07:40:01.000Z | 3rdparty/OpenCV-2.3.0/modules/highgui/src/grfmt_imageio.cpp | fughz/frayer | ec0a671bc6df3c5f0fe3a94d07b6748a14a8ba91 | [
"BSD-3-Clause"
] | 14 | 2016-11-24T10:46:39.000Z | 2016-12-10T07:24:15.000Z | to/lang/OpenCV-2.2.0/modules/highgui/src/grfmt_imageio.cpp | eirTony/INDI1 | 42642d8c632da53f60f2610b056547137793021b | [
"MIT"
] | 1 | 2021-07-14T13:23:14.000Z | 2021-07-14T13:23:14.000Z | /*
* grfmt_imageio.cpp
*
*
* Created by Morgan Conbere on 5/17/07.
*
*/
#include "precomp.hpp"
#ifdef HAVE_IMAGEIO
#include "grfmt_imageio.hpp"
namespace cv
{
/////////////////////// ImageIODecoder ///////////////////
ImageIODecoder::ImageIODecoder()
{
imageRef = NULL;
}
ImageIODecoder::~ImageIODecoder()
{
close();
}
void ImageIODecoder::close()
{
CGImageRelease( imageRef );
imageRef = NULL;
}
size_t ImageIODecoder::signatureLength() const
{
return 12;
}
bool ImageIODecoder::checkSignature( const string& signature ) const
{
// TODO: implement real signature check
return true;
}
ImageDecoder ImageIODecoder::newDecoder() const
{
return new ImageIODecoder;
}
bool ImageIODecoder::readHeader()
{
CFURLRef imageURLRef;
CGImageSourceRef sourceRef;
// diciu, if ReadHeader is called twice in a row make sure to release the previously allocated imageRef
if (imageRef != NULL)
CGImageRelease(imageRef);
imageRef = NULL;
imageURLRef = CFURLCreateFromFileSystemRepresentation( NULL,
(const UInt8*)m_filename.c_str(), m_filename.size(), false );
sourceRef = CGImageSourceCreateWithURL( imageURLRef, NULL );
CFRelease( imageURLRef );
if ( !sourceRef )
return false;
imageRef = CGImageSourceCreateImageAtIndex( sourceRef, 0, NULL );
CFRelease( sourceRef );
if( !imageRef )
return false;
m_width = CGImageGetWidth( imageRef );
m_height = CGImageGetHeight( imageRef );
CGColorSpaceRef colorSpace = CGImageGetColorSpace( imageRef );
if( !colorSpace )
return false;
m_type = CGColorSpaceGetNumberOfComponents( colorSpace ) > 1 ? CV_8UC3 : CV_8UC1;
return true;
}
bool ImageIODecoder::readData( Mat& img )
{
uchar* data = img.data;
int step = img.step;
bool color = img.channels() > 1;
int bpp; // Bytes per pixel
int bit_depth = 8;
// Get Height, Width, and color information
if( !readHeader() )
return false;
CGContextRef context = NULL; // The bitmap context
CGColorSpaceRef colorSpace = NULL;
uchar* bitmap = NULL;
CGImageAlphaInfo alphaInfo;
// CoreGraphics will take care of converting to grayscale and back as long as the
// appropriate colorspace is set
if( color == CV_LOAD_IMAGE_GRAYSCALE )
{
colorSpace = CGColorSpaceCreateDeviceGray();
bpp = 1;
alphaInfo = kCGImageAlphaNone;
}
else if( color == CV_LOAD_IMAGE_COLOR )
{
colorSpace = CGColorSpaceCreateWithName( kCGColorSpaceGenericRGBLinear );
bpp = 4; /* CG only has 8 and 32 bit color spaces, so we waste a byte */
alphaInfo = kCGImageAlphaNoneSkipLast;
}
if( !colorSpace )
return false;
bitmap = (uchar*)malloc( bpp * m_height * m_width );
if( !bitmap )
{
CGColorSpaceRelease( colorSpace );
return false;
}
context = CGBitmapContextCreate( (void *)bitmap,
m_width, /* width */
m_height, /* height */
bit_depth, /* bit depth */
bpp * m_width, /* bytes per row */
colorSpace, /* color space */
alphaInfo);
CGColorSpaceRelease( colorSpace );
if( !context )
{
free( bitmap );
return false;
}
// Copy the image data into the bitmap region
CGRect rect = {{0,0},{m_width,m_height}};
CGContextDrawImage( context, rect, imageRef );
uchar* bitdata = (uchar*)CGBitmapContextGetData( context );
if( !bitdata )
{
free( bitmap);
CGContextRelease( context );
return false;
}
// Move the bitmap (in RGB) into data (in BGR)
int bitmapIndex = 0;
if( color == CV_LOAD_IMAGE_COLOR )
{
uchar * base = data;
for (int y = 0; y < m_height; y++)
{
uchar * line = base + y * step;
for (int x = 0; x < m_width; x++)
{
// Blue channel
line[0] = bitdata[bitmapIndex + 2];
// Green channel
line[1] = bitdata[bitmapIndex + 1];
// Red channel
line[2] = bitdata[bitmapIndex + 0];
line += 3;
bitmapIndex += bpp;
}
}
}
else if( color == CV_LOAD_IMAGE_GRAYSCALE )
{
for (int y = 0; y < m_height; y++)
memcpy (data + y * step, bitmap + y * m_width, m_width);
}
free( bitmap );
CGContextRelease( context );
return true;
}
/////////////////////// ImageIOEncoder ///////////////////
ImageIOEncoder::ImageIOEncoder()
{
m_description = "Apple ImageIO (*.bmp;*.dib;*.exr;*.jpeg;*.jpg;*.jpe;*.jp2;*.pdf;*.png;*.tiff;*.tif)";
}
ImageIOEncoder::~ImageIOEncoder()
{
}
ImageEncoder ImageIOEncoder::newEncoder() const
{
return new ImageIOEncoder;
}
static
CFStringRef FilenameToUTI( const char* filename )
{
const char* ext = filename;
char* ext_buf;
int i;
CFStringRef imageUTI = NULL;
for(;;)
{
const char* temp = strchr( ext + 1, '.' );
if( !temp ) break;
ext = temp;
}
if(!ext)
return NULL;
ext_buf = (char*)malloc(strlen(ext)+1);
for(i = 0; ext[i] != '\0'; i++)
ext_buf[i] = (char)tolower(ext[i]);
ext_buf[i] = '\0';
ext = ext_buf;
if( !strcmp(ext, ".bmp") || !strcmp(ext, ".dib") )
imageUTI = CFSTR( "com.microsoft.bmp" );
else if( !strcmp(ext, ".exr") )
imageUTI = CFSTR( "com.ilm.openexr-image" );
else if( !strcmp(ext, ".jpeg") || !strcmp(ext, ".jpg") || !strcmp(ext, ".jpe") )
imageUTI = CFSTR( "public.jpeg" );
else if( !strcmp(ext, ".jp2") )
imageUTI = CFSTR( "public.jpeg-2000" );
else if( !strcmp(ext, ".pdf") )
imageUTI = CFSTR( "com.adobe.pdf" );
else if( !strcmp(ext, ".png") )
imageUTI = CFSTR( "public.png" );
else if( !strcmp(ext, ".tiff") || !strcmp(ext, ".tif") )
imageUTI = CFSTR( "public.tiff" );
free(ext_buf);
return imageUTI;
}
bool ImageIOEncoder::write( const Mat& img, const vector<int>& params )
{
int width = img.cols, height = img.rows;
int _channels = img.channels();
const uchar* data = img.data;
int step = img.step;
// Determine the appropriate UTI based on the filename extension
CFStringRef imageUTI = FilenameToUTI( m_filename.c_str() );
// Determine the Bytes Per Pixel
int bpp = (_channels == 1) ? 1 : 4;
// Write the data into a bitmap context
CGContextRef context;
CGColorSpaceRef colorSpace;
uchar* bitmapData = NULL;
if( bpp == 1 )
colorSpace = CGColorSpaceCreateWithName( kCGColorSpaceGenericGray );
else if( bpp == 4 )
colorSpace = CGColorSpaceCreateWithName( kCGColorSpaceGenericRGBLinear );
if( !colorSpace )
return false;
bitmapData = (uchar*)malloc( bpp * height * width );
if( !bitmapData )
{
CGColorSpaceRelease( colorSpace );
return false;
}
context = CGBitmapContextCreate( bitmapData,
width,
height,
8,
bpp * width,
colorSpace,
(bpp == 1) ? kCGImageAlphaNone :
kCGImageAlphaNoneSkipLast );
CGColorSpaceRelease( colorSpace );
if( !context )
{
free( bitmapData );
return false;
}
// Copy pixel information from data into bitmapData
if (bpp == 4)
{
int bitmapIndex = 0;
const uchar * base = data;
for (int y = 0; y < height; y++)
{
const uchar * line = base + y * step;
for (int x = 0; x < width; x++)
{
// Blue channel
bitmapData[bitmapIndex + 2] = line[0];
// Green channel
bitmapData[bitmapIndex + 1] = line[1];
// Red channel
bitmapData[bitmapIndex + 0] = line[2];
line += 3;
bitmapIndex += bpp;
}
}
}
else if (bpp == 1)
{
for (int y = 0; y < height; y++)
memcpy (bitmapData + y * width, data + y * step, width);
}
// Turn the bitmap context into an imageRef
CGImageRef imageRef = CGBitmapContextCreateImage( context );
CGContextRelease( context );
if( !imageRef )
{
free( bitmapData );
return false;
}
// Write the imageRef to a file based on the UTI
CFURLRef imageURLRef = CFURLCreateFromFileSystemRepresentation( NULL,
(const UInt8*)m_filename.c_str(), m_filename.size(), false );
if( !imageURLRef )
{
CGImageRelease( imageRef );
free( bitmapData );
return false;
}
CGImageDestinationRef destRef = CGImageDestinationCreateWithURL( imageURLRef,
imageUTI,
1,
NULL);
CFRelease( imageURLRef );
if( !destRef )
{
CGImageRelease( imageRef );
free( bitmapData );
fprintf(stderr, "!destRef\n");
return false;
}
CGImageDestinationAddImage(destRef, imageRef, NULL);
if( !CGImageDestinationFinalize(destRef) )
{
fprintf(stderr, "Finalize failed\n");
return false;
}
CFRelease( destRef );
CGImageRelease( imageRef );
free( bitmapData );
return true;
}
}
#endif /* HAVE_IMAGEIO */
| 25.185379 | 107 | 0.556189 | [
"vector"
] |
137046fbc6fef48cbd505e38b64edabf76928c87 | 3,859 | hpp | C++ | include/debugger.hpp | tonyYSaliba/Software-Fault-Injector | 6e18bf2f6aad1588dc45acfcdf72a26e952a8f82 | [
"MIT"
] | null | null | null | include/debugger.hpp | tonyYSaliba/Software-Fault-Injector | 6e18bf2f6aad1588dc45acfcdf72a26e952a8f82 | [
"MIT"
] | null | null | null | include/debugger.hpp | tonyYSaliba/Software-Fault-Injector | 6e18bf2f6aad1588dc45acfcdf72a26e952a8f82 | [
"MIT"
] | 1 | 2021-05-23T14:24:54.000Z | 2021-05-23T14:24:54.000Z | #ifndef SOFI_DEBUGGER_HPP
#define SOFI_DEBUGGER_HPP
#include <utility>
#include <string>
#include <linux/types.h>
#include <unordered_map>
#include "breakpoint.hpp"
#include "dwarf/dwarf++.hh"
#include "elf/elf++.hh"
#define INFINITY 10
namespace sofi {
enum class symbol_type {
notype, // No type (e.g., absolute symbol)
object, // Data object
func, // Function entry point
section, // Symbol is associated with a section
file, // Source file associated with the
}; // object file
std::string to_string (symbol_type st) {
switch (st) {
case symbol_type::notype: return "notype";
case symbol_type::object: return "object";
case symbol_type::func: return "func";
case symbol_type::section: return "section";
case symbol_type::file: return "file";
}
}
struct symbol {
symbol_type type;
std::string name;
std::uintptr_t addr;
};
class debugger {
public:
debugger(){};
debugger (std::string prog_name, pid_t pid)
: m_prog_name{std::move(prog_name)}, m_pid{pid} {
halt_mode = 0;
auto fd = open(m_prog_name.c_str(), O_RDONLY);
m_elf = elf::elf{elf::create_mmap_loader(fd)};
m_dwarf = dwarf::dwarf{dwarf::elf::create_loader(m_elf)};
}
void run();
void set_breakpoint_at_address(std::intptr_t addr);
void set_breakpoint_at_function(const std::string& name);
void set_breakpoint_at_source_line(const std::string& file, unsigned line);
void dump_registers();
void print_backtrace();
void read_variables(uint64_t* variables, int&size);
void print_source(const std::string& file_name, unsigned line, unsigned n_lines_context=2);
auto lookup_symbol(const std::string& name) -> std::vector<symbol>;
void single_step_instruction();
void single_step_instruction_with_breakpoint_check();
void get_address_at_source_line(const std::string& file, unsigned line, intptr_t& addr);
void single_step();
void get_function_start_and_end_addresses(const std::string& name, std::intptr_t& start_addr, std::intptr_t& end_addr);
void get_alligned_address(std::intptr_t& addr);
void continue_execution_single_step();
void mutate_register(std::intptr_t addr);
void mutate_opcode(std::intptr_t addr);
dwarf::die get_function_from_name(const std::string& name);
void mutate_data(std::intptr_t addr);
void handle_command(const std::string& line);
void continue_execution();
auto get_pc() -> uint64_t;
auto get_offset_pc() -> uint64_t;
void set_pc(uint64_t pc);
void step_over_breakpoint();
siginfo_t wait_for_signal();
auto get_signal_info() -> siginfo_t;
void handle_sigtrap(siginfo_t info);
void initialise_load_address();
uint64_t offset_load_address(uint64_t addr);
uint64_t offset_dwarf_address(uint64_t addr);
auto get_function_from_pc(uint64_t pc) -> dwarf::die;
auto get_line_entry_from_pc(uint64_t pc) -> dwarf::line_table::iterator;
auto read_memory(uint64_t address) -> uint64_t ;
void write_memory(uint64_t address, uint64_t value);
std::string m_prog_name;
pid_t m_pid;
uint64_t m_load_address = 0;
std::unordered_map<std::intptr_t,breakpoint> m_breakpoints;
dwarf::dwarf m_dwarf;
elf::elf m_elf;
siginfo_t result;
int duration = 0;
int halt_mode;
int ttl = INFINITY;
std::string originalOut="";
std::string originalErr="";
int sdc = 0;
};
}
#endif
| 33.850877 | 127 | 0.62866 | [
"object",
"vector"
] |
137173f04d6829013ea67f3071f4e468b773435e | 10,351 | hpp | C++ | include/coin/CbcClique.hpp | fourkind/orwrap | fe33d01976ce27afefcbb34cf1111b372a417e55 | [
"Apache-2.0"
] | 5 | 2020-01-28T08:38:35.000Z | 2021-06-19T04:11:23.000Z | include/coin/CbcClique.hpp | fourkind/orwrap | fe33d01976ce27afefcbb34cf1111b372a417e55 | [
"Apache-2.0"
] | null | null | null | include/coin/CbcClique.hpp | fourkind/orwrap | fe33d01976ce27afefcbb34cf1111b372a417e55 | [
"Apache-2.0"
] | 3 | 2019-11-26T14:43:13.000Z | 2021-10-06T08:03:46.000Z | // $Id$
// Copyright (C) 2002, International Business Machines
// Corporation and others. All Rights Reserved.
// This code is licensed under the terms of the Eclipse Public License (EPL).
// Edwin 11/9/2009-- carved out of CbcBranchActual
#ifndef CbcClique_H
#define CbcClique_H
/** \brief Branching object for cliques
A clique is defined to be a set of binary variables where fixing any one
variable to its `strong' value fixes all other variables. An example is the
most common SOS1 construction: a set of binary variables x_j s.t. SUM{j}
x_j = 1. Setting any one variable to 1 forces all other variables to 0.
(See comments for CbcSOS below.)
Other configurations are possible, however: Consider x1-x2+x3 <= 0.
Setting x1 (x3) to 1 forces x2 to 1 and x3 (x1) to 0. Setting x2 to 0
forces x1 and x3 to 0.
The proper point of view to take when interpreting CbcClique is
`generalisation of SOS1 on binary variables.' To get into the proper frame
of mind, here's an example.
Consider the following sequence, where x_j = (1-y_j):
\verbatim
x1 + x2 + x3 <= 1 all strong at 1
x1 - y2 + x3 <= 0 y2 strong at 0; x1, x3 strong at 1
-y1 - y2 + x3 <= -1 y1, y2 strong at 0, x3 strong at 1
-y1 - y2 - y3 <= -2 all strong at 0
\endverbatim
The first line is a standard SOS1 on binary variables.
Variables with +1 coefficients are `SOS-style' and variables with -1
coefficients are `non-SOS-style'. So #numberNonSOSMembers_ simply tells you
how many variables have -1 coefficients. The implicit rhs for a clique is
1-numberNonSOSMembers_.
*/
class CbcClique : public CbcObject {
public:
/// Default Constructor
CbcClique ();
/** Useful constructor (which are integer indices) slack can denote a slack
in set. If type == NULL then as if 1
*/
CbcClique (CbcModel * model, int cliqueType, int numberMembers,
const int * which, const char * type,
int identifier, int slack = -1);
/// Copy constructor
CbcClique ( const CbcClique &);
/// Clone
virtual CbcObject * clone() const;
/// Assignment operator
CbcClique & operator=( const CbcClique& rhs);
/// Destructor
virtual ~CbcClique ();
/// Infeasibility - large is 0.5
virtual double infeasibility(const OsiBranchingInformation * info,
int &preferredWay) const;
using CbcObject::feasibleRegion ;
/// This looks at solution and sets bounds to contain solution
virtual void feasibleRegion();
/// Creates a branching object
virtual CbcBranchingObject * createCbcBranch(OsiSolverInterface * solver, const OsiBranchingInformation * info, int way) ;
/// Number of members
inline int numberMembers() const {
return numberMembers_;
}
/** \brief Number of variables with -1 coefficient
Number of non-SOS members, i.e., fixing to zero is strong.
See comments at head of class, and comments for #type_.
*/
inline int numberNonSOSMembers() const {
return numberNonSOSMembers_;
}
/// Members (indices in range 0 ... numberIntegers_-1)
inline const int * members() const {
return members_;
}
/*! \brief Type of each member, i.e., which way is strong.
This also specifies whether a variable has a +1 or -1 coefficient.
- 0 => -1 coefficient, 0 is strong value
- 1 => +1 coefficient, 1 is strong value
If unspecified, all coefficients are assumed to be positive.
Indexed as 0 .. numberMembers_-1
*/
inline char type(int index) const {
if (type_) return type_[index];
else return 1;
}
/// Clique type: 0 is <=, 1 is ==
inline int cliqueType() const {
return cliqueType_;
}
/// Redoes data when sequence numbers change
virtual void redoSequenceEtc(CbcModel * model, int numberColumns, const int * originalColumns);
protected:
/// data
/// Number of members
int numberMembers_;
/// Number of Non SOS members i.e. fixing to zero is strong
int numberNonSOSMembers_;
/// Members (indices in range 0 ... numberIntegers_-1)
int * members_;
/** \brief Strong value for each member.
This also specifies whether a variable has a +1 or -1 coefficient.
- 0 => -1 coefficient, 0 is strong value
- 1 => +1 coefficient, 1 is strong value
If unspecified, all coefficients are assumed to be positive.
Indexed as 0 .. numberMembers_-1
*/
char * type_;
/** \brief Clique type
0 defines a <= relation, 1 an equality. The assumed value of the rhs is
numberNonSOSMembers_+1. (See comments for the class.)
*/
int cliqueType_;
/** \brief Slack variable for the clique
Identifies the slack variable for the clique (typically added to convert
a <= relation to an equality). Value is sequence number within clique
menbers.
*/
int slack_;
};
/** Branching object for unordered cliques
Intended for cliques which are long enough to make it worthwhile
but <= 64 members. There will also be ones for long cliques.
Variable_ is the clique id number (redundant, as the object also holds a
pointer to the clique.
*/
class CbcCliqueBranchingObject : public CbcBranchingObject {
public:
// Default Constructor
CbcCliqueBranchingObject ();
// Useful constructor
CbcCliqueBranchingObject (CbcModel * model, const CbcClique * clique,
int way,
int numberOnDownSide, const int * down,
int numberOnUpSide, const int * up);
// Copy constructor
CbcCliqueBranchingObject ( const CbcCliqueBranchingObject &);
// Assignment operator
CbcCliqueBranchingObject & operator=( const CbcCliqueBranchingObject& rhs);
/// Clone
virtual CbcBranchingObject * clone() const;
// Destructor
virtual ~CbcCliqueBranchingObject ();
using CbcBranchingObject::branch ;
/// Does next branch and updates state
virtual double branch();
using CbcBranchingObject::print ;
/** \brief Print something about branch - only if log level high
*/
virtual void print();
/** Return the type (an integer identifier) of \c this */
virtual CbcBranchObjType type() const {
return CliqueBranchObj;
}
/** Compare the original object of \c this with the original object of \c
brObj. Assumes that there is an ordering of the original objects.
This method should be invoked only if \c this and brObj are of the same
type.
Return negative/0/positive depending on whether \c this is
smaller/same/larger than the argument.
*/
virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
/** Compare the \c this with \c brObj. \c this and \c brObj must be of the
same type and must have the same original object, but they may have
different feasible regions.
Return the appropriate CbcRangeCompare value (first argument being the
sub/superset if that's the case). In case of overlap (and if \c
replaceIfOverlap is true) replace the current branching object with one
whose feasible region is the overlap.
*/
virtual CbcRangeCompare compareBranchingObject
(const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
private:
/// data
const CbcClique * clique_;
/// downMask - bit set to fix to weak bounds, not set to leave unfixed
unsigned int downMask_[2];
/// upMask - bit set to fix to weak bounds, not set to leave unfixed
unsigned int upMask_[2];
};
/** Unordered Clique Branching Object class.
These are for cliques which are > 64 members
Variable is number of clique.
*/
class CbcLongCliqueBranchingObject : public CbcBranchingObject {
public:
// Default Constructor
CbcLongCliqueBranchingObject ();
// Useful constructor
CbcLongCliqueBranchingObject (CbcModel * model, const CbcClique * clique,
int way,
int numberOnDownSide, const int * down,
int numberOnUpSide, const int * up);
// Copy constructor
CbcLongCliqueBranchingObject ( const CbcLongCliqueBranchingObject &);
// Assignment operator
CbcLongCliqueBranchingObject & operator=( const CbcLongCliqueBranchingObject& rhs);
/// Clone
virtual CbcBranchingObject * clone() const;
// Destructor
virtual ~CbcLongCliqueBranchingObject ();
using CbcBranchingObject::branch ;
/// Does next branch and updates state
virtual double branch();
using CbcBranchingObject::print ;
/** \brief Print something about branch - only if log level high
*/
virtual void print();
/** Return the type (an integer identifier) of \c this */
virtual CbcBranchObjType type() const {
return LongCliqueBranchObj;
}
/** Compare the original object of \c this with the original object of \c
brObj. Assumes that there is an ordering of the original objects.
This method should be invoked only if \c this and brObj are of the same
type.
Return negative/0/positive depending on whether \c this is
smaller/same/larger than the argument.
*/
virtual int compareOriginalObject(const CbcBranchingObject* brObj) const;
/** Compare the \c this with \c brObj. \c this and \c brObj must be os the
same type and must have the same original object, but they may have
different feasible regions.
Return the appropriate CbcRangeCompare value (first argument being the
sub/superset if that's the case). In case of overlap (and if \c
replaceIfOverlap is true) replace the current branching object with one
whose feasible region is the overlap.
*/
virtual CbcRangeCompare compareBranchingObject
(const CbcBranchingObject* brObj, const bool replaceIfOverlap = false);
private:
/// data
const CbcClique * clique_;
/// downMask - bit set to fix to weak bounds, not set to leave unfixed
unsigned int * downMask_;
/// upMask - bit set to fix to weak bounds, not set to leave unfixed
unsigned int * upMask_;
};
#endif
| 34.049342 | 126 | 0.669501 | [
"object",
"model"
] |
1371f46c629b1083bd09650a06accaa011e9c136 | 3,168 | cpp | C++ | Granite/third_party/fossilize/cli/SPIRV-Tools/source/fuzz/fuzzer_pass_add_global_variables.cpp | dmrlawson/parallel-rdp | f18e00728bb45e3a769ab7ad3b9064359ef82209 | [
"MIT"
] | 2 | 2021-11-08T02:53:14.000Z | 2021-11-08T09:40:43.000Z | source/fuzz/fuzzer_pass_add_global_variables.cpp | JaredTaoCore/spirv-tools | e95e07301ee6cdca38e8ea2fe3f6f60b8328618f | [
"Apache-2.0"
] | 1 | 2020-07-21T04:39:11.000Z | 2020-07-21T04:39:11.000Z | source/fuzz/fuzzer_pass_add_global_variables.cpp | JaredTaoCore/spirv-tools | e95e07301ee6cdca38e8ea2fe3f6f60b8328618f | [
"Apache-2.0"
] | 2 | 2020-07-06T04:48:31.000Z | 2020-07-23T16:36:46.000Z | // Copyright (c) 2020 Google LLC
//
// 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 "source/fuzz/fuzzer_pass_add_global_variables.h"
#include "source/fuzz/transformation_add_global_variable.h"
#include "source/fuzz/transformation_add_type_pointer.h"
namespace spvtools {
namespace fuzz {
FuzzerPassAddGlobalVariables::FuzzerPassAddGlobalVariables(
opt::IRContext* ir_context, FactManager* fact_manager,
FuzzerContext* fuzzer_context,
protobufs::TransformationSequence* transformations)
: FuzzerPass(ir_context, fact_manager, fuzzer_context, transformations) {}
FuzzerPassAddGlobalVariables::~FuzzerPassAddGlobalVariables() = default;
void FuzzerPassAddGlobalVariables::Apply() {
auto base_type_ids_and_pointers =
GetAvailableBaseTypesAndPointers(SpvStorageClassPrivate);
// These are the base types that are available to this fuzzer pass.
auto& base_types = base_type_ids_and_pointers.first;
// These are the pointers to those base types that are *initially* available
// to the fuzzer pass. The fuzzer pass might add pointer types in cases where
// none are available for a given base type.
auto& base_type_to_pointers = base_type_ids_and_pointers.second;
// Probabilistically keep adding global variables.
while (GetFuzzerContext()->ChoosePercentage(
GetFuzzerContext()->GetChanceOfAddingGlobalVariable())) {
// Choose a random base type; the new variable's type will be a pointer to
// this base type.
uint32_t base_type =
base_types[GetFuzzerContext()->RandomIndex(base_types)];
uint32_t pointer_type_id;
std::vector<uint32_t>& available_pointers_to_base_type =
base_type_to_pointers.at(base_type);
// Determine whether there is at least one pointer to this base type.
if (available_pointers_to_base_type.empty()) {
// There is not. Make one, to use here, and add it to the available
// pointers for the base type so that future variables can potentially
// use it.
pointer_type_id = GetFuzzerContext()->GetFreshId();
available_pointers_to_base_type.push_back(pointer_type_id);
ApplyTransformation(TransformationAddTypePointer(
pointer_type_id, SpvStorageClassPrivate, base_type));
} else {
// There is - grab one.
pointer_type_id =
available_pointers_to_base_type[GetFuzzerContext()->RandomIndex(
available_pointers_to_base_type)];
}
ApplyTransformation(TransformationAddGlobalVariable(
GetFuzzerContext()->GetFreshId(), pointer_type_id,
FindOrCreateZeroConstant(base_type), true));
}
}
} // namespace fuzz
} // namespace spvtools
| 41.684211 | 80 | 0.750631 | [
"vector"
] |
13796b45a5bb54f6411aed96b5a9a2c8b6727ae5 | 18,639 | cpp | C++ | src/hkxclasses/behavior/modifiers/bsdirectatmodifier.cpp | BrannigansLaw/Skyrim-Behavior-Editor- | 7b7167cb18e28f435a64069acbf61eca49a07be3 | [
"MIT"
] | 18 | 2019-05-15T08:01:43.000Z | 2022-02-12T15:29:37.000Z | src/hkxclasses/behavior/modifiers/bsdirectatmodifier.cpp | Zartar/Skyrim-Behavior-Editor- | 7b7167cb18e28f435a64069acbf61eca49a07be3 | [
"MIT"
] | 12 | 2018-01-06T21:19:55.000Z | 2019-01-05T15:08:16.000Z | src/hkxclasses/behavior/modifiers/bsdirectatmodifier.cpp | alexsylex/Skyrim-Behavior-Editor- | 7b7167cb18e28f435a64069acbf61eca49a07be3 | [
"MIT"
] | 9 | 2019-06-23T11:56:34.000Z | 2021-12-28T12:58:42.000Z | #include "bsdirectatmodifier.h"
#include "src/xml/hkxxmlreader.h"
#include "src/filetypes/behaviorfile.h"
uint BSDirectAtModifier::refCount = 0;
const QString BSDirectAtModifier::classname = "BSDirectAtModifier";
BSDirectAtModifier::BSDirectAtModifier(HkxFile *parent, long ref)
: hkbModifier(parent, ref),
userData(2),
enable(true),
directAtTarget(true),
sourceBoneIndex(-1),
startBoneIndex(-1),
endBoneIndex(-1),
limitHeadingDegrees(0),
limitPitchDegrees(0),
offsetHeadingDegrees(0),
offsetPitchDegrees(0),
onGain(0),
offGain(0),
userInfo(0),
directAtCamera(false),
directAtCameraX(0),
directAtCameraY(0),
directAtCameraZ(0),
active(false),
currentHeadingOffset(0),
currentPitchOffset(0)
{
setType(BS_DIRECT_AT_MODIFIER, TYPE_MODIFIER);
parent->addObjectToFile(this, ref);
refCount++;
name = "DirectAtModifier_"+QString::number(refCount);
}
const QString BSDirectAtModifier::getClassname(){
return classname;
}
QString BSDirectAtModifier::getName() const{
std::lock_guard <std::mutex> guard(mutex);
return name;
}
bool BSDirectAtModifier::readData(const HkxXmlReader &reader, long & index){
std::lock_guard <std::mutex> guard(mutex);
bool ok;
QByteArray text;
auto ref = reader.getNthAttributeValueAt(index - 1, 0);
auto checkvalue = [&](bool value, const QString & fieldname){
(!value) ? LogFile::writeToLog(getParentFilename()+": "+getClassname()+": readData()!\n'"+fieldname+"' has invalid data!\nObject Reference: "+ref) : NULL;
};
for (; index < reader.getNumElements() && reader.getNthAttributeNameAt(index, 1) != "class"; index++){
text = reader.getNthAttributeValueAt(index, 0);
if (text == "variableBindingSet"){
checkvalue(getVariableBindingSet().readShdPtrReference(index, reader), "variableBindingSet");
}else if (text == "userData"){
userData = reader.getElementValueAt(index).toULong(&ok);
checkvalue(ok, "userData");
}else if (text == "name"){
name = reader.getElementValueAt(index);
checkvalue((name != ""), "name");
}else if (text == "enable"){
enable = toBool(reader.getElementValueAt(index), &ok);
checkvalue(ok, "enable");
}else if (text == "directAtTarget"){
directAtTarget = toBool(reader.getElementValueAt(index), &ok);
checkvalue(ok, "directAtTarget");
}else if (text == "sourceBoneIndex"){
sourceBoneIndex = reader.getElementValueAt(index).toInt(&ok);
checkvalue(ok, "sourceBoneIndex");
}else if (text == "startBoneIndex"){
startBoneIndex = reader.getElementValueAt(index).toInt(&ok);
checkvalue(ok, "startBoneIndex");
}else if (text == "endBoneIndex"){
endBoneIndex = reader.getElementValueAt(index).toInt(&ok);
checkvalue(ok, "endBoneIndex");
}else if (text == "limitHeadingDegrees"){
limitHeadingDegrees = reader.getElementValueAt(index).toDouble(&ok);
checkvalue(ok, "limitHeadingDegrees");
}else if (text == "limitPitchDegrees"){
limitPitchDegrees = reader.getElementValueAt(index).toDouble(&ok);
checkvalue(ok, "limitPitchDegrees");
}else if (text == "offsetHeadingDegrees"){
offsetHeadingDegrees = reader.getElementValueAt(index).toDouble(&ok);
checkvalue(ok, "offsetHeadingDegrees");
}else if (text == "offsetPitchDegrees"){
offsetPitchDegrees = reader.getElementValueAt(index).toDouble(&ok);
checkvalue(ok, "offsetPitchDegrees");
}else if (text == "onGain"){
onGain = reader.getElementValueAt(index).toDouble(&ok);
checkvalue(ok, "onGain");
}else if (text == "offGain"){
offGain = reader.getElementValueAt(index).toDouble(&ok);
checkvalue(ok, "offGain");
}else if (text == "targetLocation"){
targetLocation = readVector4(reader.getElementValueAt(index), &ok);
checkvalue(ok, "targetLocation");
}else if (text == "userInfo"){
userInfo = reader.getElementValueAt(index).toInt(&ok);
checkvalue(ok, "userInfo");
}else if (text == "directAtCamera"){
directAtCamera = toBool(reader.getElementValueAt(index), &ok);
checkvalue(ok, "directAtCamera");
}else if (text == "directAtCameraX"){
directAtCameraX = reader.getElementValueAt(index).toDouble(&ok);
checkvalue(ok, "directAtCameraX");
}else if (text == "directAtCameraY"){
directAtCameraY = reader.getElementValueAt(index).toDouble(&ok);
checkvalue(ok, "directAtCameraY");
}else if (text == "directAtCameraZ"){
directAtCameraZ = reader.getElementValueAt(index).toDouble(&ok);
checkvalue(ok, "directAtCameraZ");
}else if (text == "active"){
active = toBool(reader.getElementValueAt(index), &ok);
checkvalue(ok, "active");
}else if (text == "currentHeadingOffset"){
currentHeadingOffset = reader.getElementValueAt(index).toDouble(&ok);
checkvalue(ok, "currentHeadingOffset");
}else if (text == "currentPitchOffset"){
currentPitchOffset = reader.getElementValueAt(index).toDouble(&ok);
checkvalue(ok, "currentPitchOffset");
}
}
index--;
return true;
}
bool BSDirectAtModifier::write(HkxXMLWriter *writer){
std::lock_guard <std::mutex> guard(mutex);
auto writedatafield = [&](const QString & name, const QString & value, bool allownull){
writer->writeLine(writer->parameter, QStringList(writer->name), QStringList(name), value, allownull);
};
if (writer && !getIsWritten()){
QString refString = "null";
QStringList list1 = {writer->name, writer->clas, writer->signature};
QStringList list2 = {getReferenceString(), getClassname(), "0x"+QString::number(getSignature(), 16)};
writer->writeLine(writer->object, list1, list2, "");
if (getVariableBindingSetData()){
refString = getVariableBindingSet()->getReferenceString();
}
writedatafield("variableBindingSet", refString, false);
writedatafield("userData", QString::number(userData), false);
writedatafield("name", name, false);
writedatafield("enable", getBoolAsString(enable), false);
writedatafield("directAtTarget", getBoolAsString(directAtTarget), false);
writedatafield("sourceBoneIndex", QString::number(sourceBoneIndex), false);
writedatafield("startBoneIndex", QString::number(startBoneIndex), false);
writedatafield("endBoneIndex", QString::number(endBoneIndex), false);
writedatafield("limitHeadingDegrees", QString::number(limitHeadingDegrees, char('f'), 6), false);
writedatafield("limitPitchDegrees", QString::number(limitPitchDegrees, char('f'), 6), false);
writedatafield("offsetHeadingDegrees", QString::number(offsetHeadingDegrees, char('f'), 6), false);
writedatafield("offsetPitchDegrees", QString::number(offsetPitchDegrees, char('f'), 6), false);
writedatafield("onGain", QString::number(onGain, char('f'), 6), false);
writedatafield("offGain", QString::number(offGain, char('f'), 6), false);
writedatafield("targetLocation", targetLocation.getValueAsString(), false);
writedatafield("userInfo", QString::number(userInfo), false);
writedatafield("directAtCamera", getBoolAsString(directAtCamera), false);
writedatafield("directAtCameraX", QString::number(directAtCameraX, char('f'), 6), false);
writedatafield("directAtCameraY", QString::number(directAtCameraY, char('f'), 6), false);
writedatafield("directAtCameraZ", QString::number(directAtCameraZ, char('f'), 6), false);
writedatafield("active", getBoolAsString(active), false);
writedatafield("currentHeadingOffset", QString::number(currentHeadingOffset, char('f'), 6), false);
writedatafield("currentPitchOffset", QString::number(currentPitchOffset, char('f'), 6), false);
writer->writeLine(writer->object, false);
setIsWritten();
writer->writeLine("\n");
if (getVariableBindingSetData() && !getVariableBindingSet()->write(writer)){
LogFile::writeToLog(getParentFilename()+": "+getClassname()+": write()!\nUnable to write 'variableBindingSet'!!!");
}
}
return true;
}
qreal BSDirectAtModifier::getCurrentPitchOffset() const{
std::lock_guard <std::mutex> guard(mutex);
return currentPitchOffset;
}
void BSDirectAtModifier::setCurrentPitchOffset(const qreal &value){
std::lock_guard <std::mutex> guard(mutex);
(value != currentPitchOffset) ? currentPitchOffset = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'currentPitchOffset' was not set!");
}
qreal BSDirectAtModifier::getCurrentHeadingOffset() const{
std::lock_guard <std::mutex> guard(mutex);
return currentHeadingOffset;
}
void BSDirectAtModifier::setCurrentHeadingOffset(const qreal &value){
std::lock_guard <std::mutex> guard(mutex);
(value != currentHeadingOffset) ? currentHeadingOffset = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'currentHeadingOffset' was not set!");
}
bool BSDirectAtModifier::getActive() const{
std::lock_guard <std::mutex> guard(mutex);
return active;
}
void BSDirectAtModifier::setActive(bool value){
std::lock_guard <std::mutex> guard(mutex);
(value != active) ? active = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'active' was not set!");
}
qreal BSDirectAtModifier::getDirectAtCameraZ() const{
std::lock_guard <std::mutex> guard(mutex);
return directAtCameraZ;
}
void BSDirectAtModifier::setDirectAtCameraZ(const qreal &value){
std::lock_guard <std::mutex> guard(mutex);
(value != directAtCameraZ) ? directAtCameraZ = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'directAtCameraZ' was not set!");
}
qreal BSDirectAtModifier::getDirectAtCameraY() const{
std::lock_guard <std::mutex> guard(mutex);
return directAtCameraY;
}
void BSDirectAtModifier::setDirectAtCameraY(const qreal &value){
std::lock_guard <std::mutex> guard(mutex);
(value != directAtCameraY) ? directAtCameraY = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'directAtCameraY' was not set!");
}
qreal BSDirectAtModifier::getDirectAtCameraX() const{
std::lock_guard <std::mutex> guard(mutex);
return directAtCameraX;
}
void BSDirectAtModifier::setDirectAtCameraX(const qreal &value){
std::lock_guard <std::mutex> guard(mutex);
(value != directAtCameraX) ? directAtCameraX = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'directAtCameraX' was not set!");
}
bool BSDirectAtModifier::getDirectAtCamera() const{
std::lock_guard <std::mutex> guard(mutex);
return directAtCamera;
}
void BSDirectAtModifier::setDirectAtCamera(bool value){
std::lock_guard <std::mutex> guard(mutex);
(value != directAtCamera) ? directAtCamera = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'directAtCamera' was not set!");
}
int BSDirectAtModifier::getUserInfo() const{
std::lock_guard <std::mutex> guard(mutex);
return userInfo;
}
void BSDirectAtModifier::setUserInfo(int value){
std::lock_guard <std::mutex> guard(mutex);
(value != userInfo) ? userInfo = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'userInfo' was not set!");
}
hkQuadVariable BSDirectAtModifier::getTargetLocation() const{
std::lock_guard <std::mutex> guard(mutex);
return targetLocation;
}
void BSDirectAtModifier::setTargetLocation(const hkQuadVariable &value){
std::lock_guard <std::mutex> guard(mutex);
(value != targetLocation) ? targetLocation = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'targetLocation' was not set!");
}
qreal BSDirectAtModifier::getOffGain() const{
std::lock_guard <std::mutex> guard(mutex);
return offGain;
}
void BSDirectAtModifier::setOffGain(const qreal &value){
std::lock_guard <std::mutex> guard(mutex);
(value != offGain) ? offGain = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'offGain' was not set!");
}
qreal BSDirectAtModifier::getOnGain() const{
std::lock_guard <std::mutex> guard(mutex);
return onGain;
}
void BSDirectAtModifier::setOnGain(const qreal &value){
std::lock_guard <std::mutex> guard(mutex);
(value != onGain) ? onGain = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'onGain' was not set!");
}
qreal BSDirectAtModifier::getOffsetPitchDegrees() const{
std::lock_guard <std::mutex> guard(mutex);
return offsetPitchDegrees;
}
void BSDirectAtModifier::setOffsetPitchDegrees(const qreal &value){
std::lock_guard <std::mutex> guard(mutex);
(value != offsetPitchDegrees) ? offsetPitchDegrees = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'offsetPitchDegrees' was not set!");
}
qreal BSDirectAtModifier::getOffsetHeadingDegrees() const{
std::lock_guard <std::mutex> guard(mutex);
return offsetHeadingDegrees;
}
void BSDirectAtModifier::setOffsetHeadingDegrees(const qreal &value){
std::lock_guard <std::mutex> guard(mutex);
(value != offsetHeadingDegrees) ? offsetHeadingDegrees = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'offsetHeadingDegrees' was not set!");
}
qreal BSDirectAtModifier::getLimitPitchDegrees() const{
std::lock_guard <std::mutex> guard(mutex);
return limitPitchDegrees;
}
void BSDirectAtModifier::setLimitPitchDegrees(const qreal &value){
std::lock_guard <std::mutex> guard(mutex);
(value != limitPitchDegrees) ? limitPitchDegrees = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'limitPitchDegrees' was not set!");
}
qreal BSDirectAtModifier::getLimitHeadingDegrees() const{
std::lock_guard <std::mutex> guard(mutex);
return limitHeadingDegrees;
}
void BSDirectAtModifier::setLimitHeadingDegrees(const qreal &value){
std::lock_guard <std::mutex> guard(mutex);
(value != limitHeadingDegrees) ? limitHeadingDegrees = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'limitHeadingDegrees' was not set!");
}
int BSDirectAtModifier::getEndBoneIndex() const{
std::lock_guard <std::mutex> guard(mutex);
return endBoneIndex;
}
void BSDirectAtModifier::setEndBoneIndex(int value){
std::lock_guard <std::mutex> guard(mutex);
(value != endBoneIndex && endBoneIndex < static_cast<BehaviorFile *>(getParentFile())->getNumberOfBones()) ? endBoneIndex = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'endBoneIndex' was not set!");
}
int BSDirectAtModifier::getStartBoneIndex() const{
std::lock_guard <std::mutex> guard(mutex);
return startBoneIndex;
}
void BSDirectAtModifier::setStartBoneIndex(int value){
std::lock_guard <std::mutex> guard(mutex);
(value != startBoneIndex && startBoneIndex < static_cast<BehaviorFile *>(getParentFile())->getNumberOfBones()) ? startBoneIndex = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'startBoneIndex' was not set!");
}
int BSDirectAtModifier::getSourceBoneIndex() const{
std::lock_guard <std::mutex> guard(mutex);
return sourceBoneIndex;
}
void BSDirectAtModifier::setSourceBoneIndex(int value){
std::lock_guard <std::mutex> guard(mutex);
(value != sourceBoneIndex && sourceBoneIndex < static_cast<BehaviorFile *>(getParentFile())->getNumberOfBones()) ? sourceBoneIndex = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'sourceBoneIndex' was not set!");
}
bool BSDirectAtModifier::getDirectAtTarget() const{
std::lock_guard <std::mutex> guard(mutex);
return directAtTarget;
}
void BSDirectAtModifier::setDirectAtTarget(bool value){
std::lock_guard <std::mutex> guard(mutex);
(value != directAtTarget) ? directAtTarget = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'directAtTarget' was not set!");
}
bool BSDirectAtModifier::getEnable() const{
std::lock_guard <std::mutex> guard(mutex);
return enable;
}
void BSDirectAtModifier::setEnable(bool value){
std::lock_guard <std::mutex> guard(mutex);
(value != enable) ? enable = value, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'enable' was not set!");
}
void BSDirectAtModifier::setName(const QString &newname){
std::lock_guard <std::mutex> guard(mutex);
(newname != name && newname != "") ? name = newname, setIsFileChanged(true) : LogFile::writeToLog(getClassname()+": 'name' was not set!");
}
bool BSDirectAtModifier::link(){
std::lock_guard <std::mutex> guard(mutex);
if (!static_cast<HkDynamicObject *>(this)->linkVar()){
LogFile::writeToLog(getParentFilename()+": "+getClassname()+": link()!\nFailed to properly link 'variableBindingSet' data field!\nObject Name: "+name);
}
return true;
}
void BSDirectAtModifier::unlink(){
HkDynamicObject::unlink();
}
QString BSDirectAtModifier::evaluateDataValidity(){
std::lock_guard <std::mutex> guard(mutex);
QString errors;
auto isvalid = true;
auto evaluateindices = [&](int & bone, const QString & fieldname){
if (bone >= static_cast<BehaviorFile *>(getParentFile())->getNumberOfBones()){
isvalid = false;
errors.append(getParentFilename()+": "+getClassname()+": Ref: "+getReferenceString()+": "+name+": "+fieldname+" out of range! Setting to last bone index!");
bone = static_cast<BehaviorFile *>(getParentFile())->getNumberOfBones() - 1;
}
};
auto temp = HkDynamicObject::evaluateDataValidity();
(temp != "") ? errors.append(temp+getParentFilename()+": "+getClassname()+": Ref: "+getReferenceString()+": "+name+": Invalid variable binding set!\n"): NULL;
if (name == ""){
isvalid = false;
errors.append(getParentFilename()+": "+getClassname()+": Ref: "+getReferenceString()+": "+name+": Invalid name!");
}
evaluateindices(sourceBoneIndex, "sourceBoneIndex");
evaluateindices(startBoneIndex, "startBoneIndex");
evaluateindices(endBoneIndex, "endBoneIndex");
setDataValidity(isvalid);
return errors;
}
BSDirectAtModifier::~BSDirectAtModifier(){
refCount--;
}
| 44.273159 | 240 | 0.685498 | [
"object"
] |
13797991cf59a78ef836844881291fff48909b87 | 14,635 | cpp | C++ | REDSI_1160929_1161573/boost_1_67_0/libs/coroutine/test/test_symmetric_coroutine.cpp | Wultyc/ISEP_1718_2A2S_REDSI_TrabalhoGrupo | eb0f7ef64e188fe871f47c2ef9cdef36d8a66bc8 | [
"MIT"
] | 32 | 2019-02-27T06:57:07.000Z | 2021-08-29T10:56:19.000Z | REDSI_1160929_1161573/boost_1_67_0/libs/coroutine/test/test_symmetric_coroutine.cpp | Wultyc/ISEP_1718_2A2S_REDSI_TrabalhoGrupo | eb0f7ef64e188fe871f47c2ef9cdef36d8a66bc8 | [
"MIT"
] | 1 | 2019-03-04T11:21:00.000Z | 2019-05-24T01:36:31.000Z | REDSI_1160929_1161573/boost_1_67_0/libs/coroutine/test/test_symmetric_coroutine.cpp | Wultyc/ISEP_1718_2A2S_REDSI_TrabalhoGrupo | eb0f7ef64e188fe871f47c2ef9cdef36d8a66bc8 | [
"MIT"
] | 5 | 2019-08-20T13:45:04.000Z | 2022-03-01T18:23:49.000Z |
// Copyright Oliver Kowalke 2009.
// 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)
#include <algorithm>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <string>
#include <vector>
#include <cstdio>
#include <boost/assert.hpp>
#include <boost/bind.hpp>
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/move/move.hpp>
#include <boost/range.hpp>
#include <boost/ref.hpp>
#include <boost/test/unit_test.hpp>
#include <boost/tuple/tuple.hpp>
#include <boost/utility.hpp>
#include <boost/coroutine/symmetric_coroutine.hpp>
namespace coro = boost::coroutines;
bool value1 = false;
int value2 = 0;
std::string value3;
typedef void( * coro_fn_void)(coro::symmetric_coroutine< void* >::yield_type &);
coro::symmetric_coroutine< void >::call_type * term_coro = 0;
struct X
{
int i;
X() :
i( 0)
{}
X( int i_) :
i( i_)
{}
};
X * p = 0;
struct Y
{
Y()
{ value2 = 7; }
~Y()
{ value2 = 0; }
};
template< typename X, typename I >
void trampoline( coro::symmetric_coroutine< void* >::yield_type & yield)
{
void * vp = yield.get();
X * x = static_cast< X * >( vp);
I i( yield);
x->d = & i;
i.suspend();
i.run();
}
struct B
{
virtual ~B() {}
virtual void foo() = 0;
};
class D : public B
{
public:
int count;
coro::symmetric_coroutine< void* >::call_type call;
coro::symmetric_coroutine< void* >::yield_type * yield;
D( coro::symmetric_coroutine< void* >::yield_type & yield_) :
B(),
count( 0),
call(),
yield( & yield_)
{}
void foo() {}
void resume()
{ call( 0); }
void suspend()
{ ( *yield)(); }
void run()
{
while ( yield && * yield)
{
++count;
suspend();
}
}
};
struct T
{
D * d;
T() :
d( 0)
{}
};
class copyable
{
public:
bool state;
copyable() :
state( false)
{}
copyable( int) :
state( true)
{}
void operator()( coro::symmetric_coroutine< bool >::yield_type & yield)
{
if ( yield)
value1 = yield.get();
}
};
class moveable
{
private:
BOOST_MOVABLE_BUT_NOT_COPYABLE( moveable)
public:
bool state;
moveable() :
state( false)
{}
moveable( int) :
state( true)
{}
moveable( BOOST_RV_REF( moveable) other) :
state( false)
{ std::swap( state, other.state); }
moveable & operator=( BOOST_RV_REF( moveable) other)
{
if ( this == & other) return * this;
moveable tmp( boost::move( other) );
std::swap( state, tmp.state);
return * this;
}
void operator()( coro::symmetric_coroutine< int >::yield_type &)
{ value1 = state; }
};
void empty( coro::symmetric_coroutine< void >::yield_type &) {}
void f2( coro::symmetric_coroutine< void >::yield_type &)
{ ++value2; }
void f3( coro::symmetric_coroutine< X >::yield_type & yield)
{ value2 = yield.get().i; }
void f4( coro::symmetric_coroutine< X& >::yield_type & yield)
{
X & x = yield.get();
p = & x;
}
void f5( coro::symmetric_coroutine< X* >::yield_type & yield)
{ p = yield.get(); }
void f6( coro::symmetric_coroutine< void >::yield_type & yield)
{
Y y;
yield( *term_coro);
}
void f7( coro::symmetric_coroutine< int >::yield_type & yield)
{
value2 = yield.get();
yield( *term_coro);
value2 = yield.get();
}
template< typename E >
void f9( coro::symmetric_coroutine< void >::yield_type &, E const& e)
{ throw e; }
void f10( coro::symmetric_coroutine< int >::yield_type & yield,
coro::symmetric_coroutine< int >::call_type & other)
{
int i = yield.get();
yield( other, i);
value2 = yield.get();
}
void f101( coro::symmetric_coroutine< int >::yield_type & yield)
{ value2 = yield.get(); }
void f11( coro::symmetric_coroutine< void >::yield_type & yield,
coro::symmetric_coroutine< void >::call_type & other)
{
yield( other);
value2 = 7;
}
void f111( coro::symmetric_coroutine< void >::yield_type &)
{ value2 = 3; }
void f12( coro::symmetric_coroutine< X& >::yield_type & yield,
coro::symmetric_coroutine< X& >::call_type & other)
{
yield( other, yield.get());
p = & yield.get();
}
void f121( coro::symmetric_coroutine< X& >::yield_type & yield)
{ p = & yield.get(); }
void f14( coro::symmetric_coroutine< int >::yield_type & yield,
coro::symmetric_coroutine< std::string >::call_type & other)
{
std::string str( boost::lexical_cast< std::string >( yield.get() ) );
yield( other, str);
value2 = yield.get();
}
void f141( coro::symmetric_coroutine< std::string >::yield_type & yield)
{ value3 = yield.get(); }
void f15( coro::symmetric_coroutine< int >::yield_type & yield,
int offset,
coro::symmetric_coroutine< int >::call_type & other)
{
int x = yield.get();
value2 += x + offset;
yield( other, x);
x = yield.get();
value2 += x + offset;
yield( other, x);
}
void f151( coro::symmetric_coroutine< int >::yield_type & yield,
int offset)
{
int x = yield.get();
value2 += x + offset;
yield();
x = yield.get();
value2 += x + offset;
}
void f16( coro::symmetric_coroutine< int >::yield_type & yield)
{
while ( yield)
{
value2 = yield.get();
yield();
}
}
void test_move()
{
{
coro::symmetric_coroutine< void >::call_type coro1;
coro::symmetric_coroutine< void >::call_type coro2( empty);
BOOST_CHECK( ! coro1);
BOOST_CHECK( coro2);
coro1 = boost::move( coro2);
BOOST_CHECK( coro1);
BOOST_CHECK( ! coro2);
}
{
value1 = false;
copyable cp( 3);
BOOST_CHECK( cp.state);
BOOST_CHECK( ! value1);
coro::symmetric_coroutine< bool >::call_type coro( cp);
coro( true);
BOOST_CHECK( cp.state);
BOOST_CHECK( value1);
}
{
value1 = false;
moveable mv( 7);
BOOST_CHECK( mv.state);
BOOST_CHECK( ! value1);
coro::symmetric_coroutine< int >::call_type coro( boost::move( mv) );
coro( 7);
BOOST_CHECK( ! mv.state);
BOOST_CHECK( value1);
}
}
void test_complete()
{
value2 = 0;
coro::symmetric_coroutine< void >::call_type coro( f2);
BOOST_CHECK( coro);
coro();
BOOST_CHECK( ! coro);
BOOST_CHECK_EQUAL( ( int)1, value2);
}
void test_yield()
{
value2 = 0;
coro::symmetric_coroutine< int >::call_type coro3(
boost::bind( f151, _1, 3) );
BOOST_CHECK( coro3);
coro::symmetric_coroutine< int >::call_type coro2(
boost::bind( f15, _1, 2, boost::ref( coro3) ) );
BOOST_CHECK( coro2);
coro::symmetric_coroutine< int >::call_type coro1(
boost::bind( f15, _1, 1, boost::ref( coro2) ) );
BOOST_CHECK( coro1);
BOOST_CHECK_EQUAL( ( int)0, value2);
coro1( 1);
BOOST_CHECK( coro3);
BOOST_CHECK( coro2);
BOOST_CHECK( coro1);
BOOST_CHECK_EQUAL( ( int)9, value2);
coro1( 2);
BOOST_CHECK( ! coro3);
BOOST_CHECK( coro2);
BOOST_CHECK( coro1);
BOOST_CHECK_EQUAL( ( int)21, value2);
}
void test_pass_value()
{
value2 = 0;
X x(7);
BOOST_CHECK_EQUAL( ( int)7, x.i);
BOOST_CHECK_EQUAL( 0, value2);
coro::symmetric_coroutine< X >::call_type coro( f3);
BOOST_CHECK( coro);
coro(7);
BOOST_CHECK( ! coro);
BOOST_CHECK_EQUAL( ( int)7, x.i);
BOOST_CHECK_EQUAL( 7, value2);
}
void test_pass_reference()
{
p = 0;
X x;
coro::symmetric_coroutine< X& >::call_type coro( f4);
BOOST_CHECK( coro);
coro( x);
BOOST_CHECK( ! coro);
BOOST_CHECK( p == & x);
}
void test_pass_pointer()
{
p = 0;
X x;
coro::symmetric_coroutine< X* >::call_type coro( f5);
BOOST_CHECK( coro);
coro( & x);
BOOST_CHECK( ! coro);
BOOST_CHECK( p == & x);
}
void test_unwind()
{
value2 = 0;
{
coro::symmetric_coroutine< void >::call_type coro( f6);
coro::symmetric_coroutine< void >::call_type coro_e( empty);
BOOST_CHECK( coro);
BOOST_CHECK( coro_e);
term_coro = & coro_e;
BOOST_CHECK_EQUAL( ( int) 0, value2);
coro();
BOOST_CHECK( coro);
BOOST_CHECK_EQUAL( ( int) 7, value2);
}
BOOST_CHECK_EQUAL( ( int) 0, value2);
}
void test_no_unwind()
{
value2 = 0;
{
coro::symmetric_coroutine< void >::call_type coro( f6,
coro::attributes(
coro::stack_allocator::traits_type::default_size(),
coro::no_stack_unwind) );
coro::symmetric_coroutine< void >::call_type coro_e( empty);
BOOST_CHECK( coro);
BOOST_CHECK( coro_e);
term_coro = & coro_e;
BOOST_CHECK_EQUAL( ( int) 0, value2);
coro();
BOOST_CHECK( coro);
BOOST_CHECK_EQUAL( ( int) 7, value2);
}
BOOST_CHECK_EQUAL( ( int) 7, value2);
}
void test_termination()
{
value2 = 0;
coro::symmetric_coroutine< int >::call_type coro( f7);
coro::symmetric_coroutine< void >::call_type coro_e( empty);
BOOST_CHECK( coro);
BOOST_CHECK( coro_e);
term_coro = & coro_e;
BOOST_CHECK_EQUAL( ( int) 0, value2);
coro(3);
BOOST_CHECK( coro);
BOOST_CHECK_EQUAL( ( int) 3, value2);
coro(7);
BOOST_CHECK( ! coro);
BOOST_CHECK_EQUAL( ( int) 7, value2);
}
void test_yield_to_void()
{
value2 = 0;
coro::symmetric_coroutine< void >::call_type coro_other( f111);
coro::symmetric_coroutine< void >::call_type coro( boost::bind( f11, _1, boost::ref( coro_other) ) );
BOOST_CHECK( coro_other);
BOOST_CHECK( coro);
BOOST_CHECK_EQUAL( ( int) 0, value2);
coro();
BOOST_CHECK( ! coro_other);
BOOST_CHECK( coro);
BOOST_CHECK_EQUAL( ( int) 3, value2);
coro();
BOOST_CHECK( ! coro_other);
BOOST_CHECK( ! coro);
BOOST_CHECK_EQUAL( ( int) 7, value2);
}
void test_yield_to_int()
{
value2 = 0;
coro::symmetric_coroutine< int >::call_type coro_other( f101);
coro::symmetric_coroutine< int >::call_type coro( boost::bind( f10, _1, boost::ref( coro_other) ) );
BOOST_CHECK( coro_other);
BOOST_CHECK( coro);
BOOST_CHECK_EQUAL( ( int) 0, value2);
coro(3);
BOOST_CHECK( ! coro_other);
BOOST_CHECK( coro);
BOOST_CHECK_EQUAL( ( int) 3, value2);
coro(7);
BOOST_CHECK( ! coro_other);
BOOST_CHECK( ! coro);
BOOST_CHECK_EQUAL( ( int) 7, value2);
}
void test_yield_to_ref()
{
p = 0;
coro::symmetric_coroutine< X& >::call_type coro_other( f121);
coro::symmetric_coroutine< X& >::call_type coro( boost::bind( f12, _1, boost::ref( coro_other) ) );
BOOST_CHECK( coro_other);
BOOST_CHECK( coro);
BOOST_CHECK( 0 == p);
X x1(3);
coro( x1);
BOOST_CHECK( ! coro_other);
BOOST_CHECK( coro);
BOOST_CHECK_EQUAL( p->i, x1.i);
BOOST_CHECK( p == & x1);
X x2(7);
coro(x2);
BOOST_CHECK( ! coro_other);
BOOST_CHECK( ! coro);
BOOST_CHECK_EQUAL( p->i, x2.i);
BOOST_CHECK( p == & x2);
}
void test_yield_to_different()
{
value2 = 0;
value3 = "";
coro::symmetric_coroutine< std::string >::call_type coro_other( f141);
coro::symmetric_coroutine< int >::call_type coro( boost::bind( f14, _1, boost::ref( coro_other) ) );
BOOST_CHECK( coro_other);
BOOST_CHECK( coro);
BOOST_CHECK_EQUAL( ( int) 0, value2);
BOOST_CHECK( value3.empty() );
coro(3);
BOOST_CHECK( ! coro_other);
BOOST_CHECK( coro);
BOOST_CHECK_EQUAL( "3", value3);
coro(7);
BOOST_CHECK( ! coro_other);
BOOST_CHECK( ! coro);
BOOST_CHECK_EQUAL( ( int) 7, value2);
}
void test_move_coro()
{
value2 = 0;
coro::symmetric_coroutine< int >::call_type coro1( f16);
coro::symmetric_coroutine< int >::call_type coro2;
BOOST_CHECK( coro1);
BOOST_CHECK( ! coro2);
coro1( 1);
BOOST_CHECK_EQUAL( ( int)1, value2);
coro2 = boost::move( coro1);
BOOST_CHECK( ! coro1);
BOOST_CHECK( coro2);
coro2( 2);
BOOST_CHECK_EQUAL( ( int)2, value2);
coro1 = boost::move( coro2);
BOOST_CHECK( coro1);
BOOST_CHECK( ! coro2);
coro1( 3);
BOOST_CHECK_EQUAL( ( int)3, value2);
coro2 = boost::move( coro1);
BOOST_CHECK( ! coro1);
BOOST_CHECK( coro2);
coro2( 4);
BOOST_CHECK_EQUAL( ( int)4, value2);
}
void test_vptr()
{
D * d = 0;
T t;
coro_fn_void fn = trampoline< T, D >;
coro::symmetric_coroutine< void* >::call_type call( fn);
call( & t);
d = t.d;
BOOST_CHECK( 0 != d);
d->call = boost::move( call);
BOOST_CHECK_EQUAL( ( int) 0, d->count);
d->resume();
BOOST_CHECK_EQUAL( ( int) 1, d->count);
d->resume();
BOOST_CHECK_EQUAL( ( int) 2, d->count);
}
boost::unit_test::test_suite * init_unit_test_suite( int, char* [])
{
boost::unit_test::test_suite * test =
BOOST_TEST_SUITE("Boost.coroutine: symmetric coroutine test suite");
test->add( BOOST_TEST_CASE( & test_move) );
test->add( BOOST_TEST_CASE( & test_complete) );
test->add( BOOST_TEST_CASE( & test_yield) );
test->add( BOOST_TEST_CASE( & test_pass_value) );
test->add( BOOST_TEST_CASE( & test_pass_reference) );
test->add( BOOST_TEST_CASE( & test_pass_pointer) );
test->add( BOOST_TEST_CASE( & test_termination) );
test->add( BOOST_TEST_CASE( & test_unwind) );
test->add( BOOST_TEST_CASE( & test_no_unwind) );
test->add( BOOST_TEST_CASE( & test_yield_to_void) );
test->add( BOOST_TEST_CASE( & test_yield_to_int) );
test->add( BOOST_TEST_CASE( & test_yield_to_ref) );
test->add( BOOST_TEST_CASE( & test_yield_to_different) );
test->add( BOOST_TEST_CASE( & test_move_coro) );
test->add( BOOST_TEST_CASE( & test_vptr) );
return test;
}
| 24.190083 | 106 | 0.571917 | [
"vector"
] |
137a506675550ee2fbfde9e052e02c108319f447 | 7,704 | cpp | C++ | bin/windows/cpp/obj/src/com/haxepunk/tweens/misc/MultiVarTween.cpp | DrSkipper/twogames | 916e8af6cd45cf85fbca4a6ea8ee12e24dd6689b | [
"MIT"
] | null | null | null | bin/windows/cpp/obj/src/com/haxepunk/tweens/misc/MultiVarTween.cpp | DrSkipper/twogames | 916e8af6cd45cf85fbca4a6ea8ee12e24dd6689b | [
"MIT"
] | null | null | null | bin/windows/cpp/obj/src/com/haxepunk/tweens/misc/MultiVarTween.cpp | DrSkipper/twogames | 916e8af6cd45cf85fbca4a6ea8ee12e24dd6689b | [
"MIT"
] | null | null | null | #include <hxcpp.h>
#ifndef INCLUDED_Reflect
#include <Reflect.h>
#endif
#ifndef INCLUDED_com_haxepunk_Tween
#include <com/haxepunk/Tween.h>
#endif
#ifndef INCLUDED_com_haxepunk_TweenType
#include <com/haxepunk/TweenType.h>
#endif
#ifndef INCLUDED_com_haxepunk_tweens_misc_MultiVarTween
#include <com/haxepunk/tweens/misc/MultiVarTween.h>
#endif
#ifndef INCLUDED_flash_events_EventDispatcher
#include <flash/events/EventDispatcher.h>
#endif
#ifndef INCLUDED_flash_events_IEventDispatcher
#include <flash/events/IEventDispatcher.h>
#endif
#ifndef INCLUDED_hxMath
#include <hxMath.h>
#endif
namespace com{
namespace haxepunk{
namespace tweens{
namespace misc{
Void MultiVarTween_obj::__construct(Dynamic complete,::com::haxepunk::TweenType type)
{
HX_STACK_PUSH("MultiVarTween::new","com/haxepunk/tweens/misc/MultiVarTween.hx",17);
{
HX_STACK_LINE(18)
this->_vars = Array_obj< ::String >::__new();
HX_STACK_LINE(19)
this->_start = Array_obj< Float >::__new();
HX_STACK_LINE(20)
this->_range = Array_obj< Float >::__new();
HX_STACK_LINE(22)
super::__construct((int)0,type,complete,null());
}
;
return null();
}
MultiVarTween_obj::~MultiVarTween_obj() { }
Dynamic MultiVarTween_obj::__CreateEmpty() { return new MultiVarTween_obj; }
hx::ObjectPtr< MultiVarTween_obj > MultiVarTween_obj::__new(Dynamic complete,::com::haxepunk::TweenType type)
{ hx::ObjectPtr< MultiVarTween_obj > result = new MultiVarTween_obj();
result->__construct(complete,type);
return result;}
Dynamic MultiVarTween_obj::__Create(hx::DynamicArray inArgs)
{ hx::ObjectPtr< MultiVarTween_obj > result = new MultiVarTween_obj();
result->__construct(inArgs[0],inArgs[1]);
return result;}
Void MultiVarTween_obj::update( ){
{
HX_STACK_PUSH("MultiVarTween::update","com/haxepunk/tweens/misc/MultiVarTween.hx",69);
HX_STACK_THIS(this);
HX_STACK_LINE(70)
this->super::update();
HX_STACK_LINE(71)
int i = this->_vars->length; HX_STACK_VAR(i,"i");
HX_STACK_LINE(73)
while((((i)-- > (int)0))){
HX_STACK_LINE(75)
Dynamic o = this->_object; HX_STACK_VAR(o,"o");
HX_STACK_LINE(75)
if (((o != null()))){
HX_STACK_LINE(75)
o->__SetField(this->_vars->__get(i),(this->_start->__get(i) + (this->_range->__get(i) * this->_t)),true);
}
}
}
return null();
}
Void MultiVarTween_obj::tween( Dynamic object,Dynamic properties,Float duration,Dynamic ease){
{
HX_STACK_PUSH("MultiVarTween::tween","com/haxepunk/tweens/misc/MultiVarTween.hx",33);
HX_STACK_THIS(this);
HX_STACK_ARG(object,"object");
HX_STACK_ARG(properties,"properties");
HX_STACK_ARG(duration,"duration");
HX_STACK_ARG(ease,"ease");
HX_STACK_LINE(34)
this->_object = object;
HX_STACK_LINE(35)
{
HX_STACK_LINE(35)
Dynamic array = this->_vars; HX_STACK_VAR(array,"array");
HX_STACK_LINE(35)
array->__Field(HX_CSTRING("splice"),true)((int)0,array->__Field(HX_CSTRING("length"),true));
}
HX_STACK_LINE(36)
{
HX_STACK_LINE(36)
Dynamic array = this->_start; HX_STACK_VAR(array,"array");
HX_STACK_LINE(36)
array->__Field(HX_CSTRING("splice"),true)((int)0,array->__Field(HX_CSTRING("length"),true));
}
HX_STACK_LINE(37)
{
HX_STACK_LINE(37)
Dynamic array = this->_range; HX_STACK_VAR(array,"array");
HX_STACK_LINE(37)
array->__Field(HX_CSTRING("splice"),true)((int)0,array->__Field(HX_CSTRING("length"),true));
}
HX_STACK_LINE(38)
this->_target = duration;
HX_STACK_LINE(39)
this->_ease = ease;
HX_STACK_LINE(40)
::String p; HX_STACK_VAR(p,"p");
HX_STACK_LINE(42)
Array< ::String > fields = null(); HX_STACK_VAR(fields,"fields");
HX_STACK_LINE(43)
if ((::Reflect_obj::isObject(properties))){
HX_STACK_LINE(44)
fields = ::Reflect_obj::fields(properties);
}
else{
HX_STACK_LINE(48)
hx::Throw (HX_CSTRING("Unsupported MultiVar properties container - use Object containing key/value pairs."));
}
HX_STACK_LINE(52)
{
HX_STACK_LINE(52)
int _g = (int)0; HX_STACK_VAR(_g,"_g");
HX_STACK_LINE(52)
while(((_g < fields->length))){
HX_STACK_LINE(52)
::String p1 = fields->__get(_g); HX_STACK_VAR(p1,"p1");
HX_STACK_LINE(52)
++(_g);
HX_STACK_LINE(54)
Float a = ( (((object == null()))) ? Dynamic(null()) : Dynamic(object->__Field(p1,true)) ); HX_STACK_VAR(a,"a");
HX_STACK_LINE(56)
if ((::Math_obj::isNaN(a))){
HX_STACK_LINE(57)
hx::Throw (((HX_CSTRING("The property \"") + p1) + HX_CSTRING("\" is not numeric.")));
}
HX_STACK_LINE(60)
this->_vars->push(p1);
HX_STACK_LINE(61)
this->_start->push(a);
HX_STACK_LINE(62)
this->_range->push((::Reflect_obj::field(properties,p1) - a));
}
}
HX_STACK_LINE(64)
this->start();
}
return null();
}
HX_DEFINE_DYNAMIC_FUNC4(MultiVarTween_obj,tween,(void))
MultiVarTween_obj::MultiVarTween_obj()
{
}
void MultiVarTween_obj::__Mark(HX_MARK_PARAMS)
{
HX_MARK_BEGIN_CLASS(MultiVarTween);
HX_MARK_MEMBER_NAME(_range,"_range");
HX_MARK_MEMBER_NAME(_start,"_start");
HX_MARK_MEMBER_NAME(_vars,"_vars");
HX_MARK_MEMBER_NAME(_object,"_object");
super::__Mark(HX_MARK_ARG);
HX_MARK_END_CLASS();
}
void MultiVarTween_obj::__Visit(HX_VISIT_PARAMS)
{
HX_VISIT_MEMBER_NAME(_range,"_range");
HX_VISIT_MEMBER_NAME(_start,"_start");
HX_VISIT_MEMBER_NAME(_vars,"_vars");
HX_VISIT_MEMBER_NAME(_object,"_object");
super::__Visit(HX_VISIT_ARG);
}
Dynamic MultiVarTween_obj::__Field(const ::String &inName,bool inCallProp)
{
switch(inName.length) {
case 5:
if (HX_FIELD_EQ(inName,"_vars") ) { return _vars; }
if (HX_FIELD_EQ(inName,"tween") ) { return tween_dyn(); }
break;
case 6:
if (HX_FIELD_EQ(inName,"_range") ) { return _range; }
if (HX_FIELD_EQ(inName,"_start") ) { return _start; }
if (HX_FIELD_EQ(inName,"update") ) { return update_dyn(); }
break;
case 7:
if (HX_FIELD_EQ(inName,"_object") ) { return _object; }
}
return super::__Field(inName,inCallProp);
}
Dynamic MultiVarTween_obj::__SetField(const ::String &inName,const Dynamic &inValue,bool inCallProp)
{
switch(inName.length) {
case 5:
if (HX_FIELD_EQ(inName,"_vars") ) { _vars=inValue.Cast< Array< ::String > >(); return inValue; }
break;
case 6:
if (HX_FIELD_EQ(inName,"_range") ) { _range=inValue.Cast< Array< Float > >(); return inValue; }
if (HX_FIELD_EQ(inName,"_start") ) { _start=inValue.Cast< Array< Float > >(); return inValue; }
break;
case 7:
if (HX_FIELD_EQ(inName,"_object") ) { _object=inValue.Cast< Dynamic >(); return inValue; }
}
return super::__SetField(inName,inValue,inCallProp);
}
void MultiVarTween_obj::__GetFields(Array< ::String> &outFields)
{
outFields->push(HX_CSTRING("_range"));
outFields->push(HX_CSTRING("_start"));
outFields->push(HX_CSTRING("_vars"));
outFields->push(HX_CSTRING("_object"));
super::__GetFields(outFields);
};
static ::String sStaticFields[] = {
String(null()) };
static ::String sMemberFields[] = {
HX_CSTRING("_range"),
HX_CSTRING("_start"),
HX_CSTRING("_vars"),
HX_CSTRING("_object"),
HX_CSTRING("update"),
HX_CSTRING("tween"),
String(null()) };
static void sMarkStatics(HX_MARK_PARAMS) {
HX_MARK_MEMBER_NAME(MultiVarTween_obj::__mClass,"__mClass");
};
static void sVisitStatics(HX_VISIT_PARAMS) {
HX_VISIT_MEMBER_NAME(MultiVarTween_obj::__mClass,"__mClass");
};
Class MultiVarTween_obj::__mClass;
void MultiVarTween_obj::__register()
{
hx::Static(__mClass) = hx::RegisterClass(HX_CSTRING("com.haxepunk.tweens.misc.MultiVarTween"), hx::TCanCast< MultiVarTween_obj> ,sStaticFields,sMemberFields,
&__CreateEmpty, &__Create,
&super::__SGetClass(), 0, sMarkStatics, sVisitStatics);
}
void MultiVarTween_obj::__boot()
{
}
} // end namespace com
} // end namespace haxepunk
} // end namespace tweens
} // end namespace misc
| 28.639405 | 158 | 0.714694 | [
"object"
] |
137cb65f77d60a7db2e239c61b86ae6be5b4c551 | 3,930 | cpp | C++ | source/og-core/renderer/gl/PixelBufferGL.cpp | OpenWebGlobe/Application-SDK | b819ca8ccb44b70815f6c5332cfb041ea23dab61 | [
"MIT"
] | 4 | 2015-12-20T01:38:05.000Z | 2019-07-02T11:01:29.000Z | source/og-core/renderer/gl/PixelBufferGL.cpp | OpenWebGlobe/Application-SDK | b819ca8ccb44b70815f6c5332cfb041ea23dab61 | [
"MIT"
] | null | null | null | source/og-core/renderer/gl/PixelBufferGL.cpp | OpenWebGlobe/Application-SDK | b819ca8ccb44b70815f6c5332cfb041ea23dab61 | [
"MIT"
] | 6 | 2015-01-20T09:18:39.000Z | 2021-02-06T08:19:30.000Z | /*******************************************************************************
Project : i3D OpenGlobe SDK - Reference Implementation
Version : 1.0
Author : Martin Christen, martin.christen@fhnw.ch
Copyright : (c) 2006-2010 by FHNW/IVGI. All Rights Reserved
$License$
*******************************************************************************/
#include "renderer/gl/PixelBufferGL.h"
#include "renderer/gl/TextureGL.h"
namespace GL
{
//-----------------------------------------------------------------------------
PixelBufferGL::PixelBufferGL()
{
_bHasHardware = false;
_pboId = 0;
_nBufferSize = 0;
}
//-----------------------------------------------------------------------------
PixelBufferGL::~PixelBufferGL()
{
}
//-----------------------------------------------------------------------------
void PixelBufferGL::Destroy()
{
if (_pboId != 0 /*&& _bHasHardware*/)
{
glDeleteBuffersARB(1, &_pboId);
_nBufferSize = 0;
_pboId = 0;
}
}
//-----------------------------------------------------------------------------
void PixelBufferGL::CreateBuffer(size_t nBytes)
{
if (GLEW_ARB_pixel_buffer_object)
{
if (_pboId != 0)
{
Destroy();
}
_nBufferSize = nBytes;
_bHasHardware = true;
glGenBuffersARB(1, &_pboId);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, _pboId);
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, nBytes, 0, GL_STREAM_DRAW_ARB);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
}
}
//-----------------------------------------------------------------------------
size_t PixelBufferGL::GetBufferSize()
{
return _nBufferSize;
}
//-----------------------------------------------------------------------------
void* PixelBufferGL::Lock(BufferUsage bu)
{
if (_nBufferSize == 0)
return 0;
if (bu == PIXELBUFFER_READ)
{
return 0;
}
else if (bu == PIXELBUFFER_WRITE)
{
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, _pboId);
glBufferDataARB(GL_PIXEL_UNPACK_BUFFER_ARB, _nBufferSize, 0, GL_STREAM_DRAW_ARB);
GLubyte* ptr = (GLubyte*)glMapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, GL_WRITE_ONLY_ARB);
return (void*) ptr;
}
else
{
assert(false);
}
return 0;
}
//-----------------------------------------------------------------------------
void PixelBufferGL::Unlock()
{
if (_nBufferSize == 0)
return;
// release pointer to mapping buffer
glUnmapBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB);
// it is good idea to release PBOs with ID 0 after use.
// Once bound with 0, all pixel operations behave normal ways.
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, 0);
}
//-----------------------------------------------------------------------------
bool PixelBufferGL::CopyToTexture(shared_ptr<ITexture>& iTexture)
{
if (!iTexture)
{
assert(false);
return false;
}
int width = iTexture->GetWidth();
int height = iTexture->GetHeight();
GLenum ePixelFormat;
GLenum eInternalFormat;
GLenum eType;
_ConvertTexturePixelFormat(iTexture->GetPixelFormat(),
iTexture->GetPixelDataType(), ePixelFormat, eInternalFormat, eType);
iTexture->BindTexture(0);
glBindBufferARB(GL_PIXEL_UNPACK_BUFFER_ARB, _pboId);
// copy pixels from PBO to texture object
// Use offset instead of ponter.
switch(iTexture->GetTextureTarget())
{
case Texture::GFX_TEXTURE_2D:
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, ePixelFormat, eType, 0);
break;
case Texture::GFX_TEXTURE_RECTANGLE:
glTexSubImage2D(GL_TEXTURE_RECTANGLE_ARB, 0, 0, 0, width, height, ePixelFormat, eType, 0);
break;
default:
assert(false); // texture target not supported, stupid!!!
return false;
}
return true;
}
//-----------------------------------------------------------------------------
} // namespace
| 24.259259 | 98 | 0.52112 | [
"object"
] |
137fd20248768d19d7db3d10808079ea0064c7be | 5,378 | cpp | C++ | src/MathToolsArma_Polytopes.cpp | CRL-Technion/Variable-speed-Dubins-with-wind | 4c0cf8bb1ae11bcd78bffbba5392b892fee53608 | [
"MIT"
] | 3 | 2021-06-04T08:13:41.000Z | 2021-11-11T07:39:15.000Z | src/MathToolsArma_Polytopes.cpp | CRL-Technion/Variable-speed-Dubins-with-wind | 4c0cf8bb1ae11bcd78bffbba5392b892fee53608 | [
"MIT"
] | null | null | null | src/MathToolsArma_Polytopes.cpp | CRL-Technion/Variable-speed-Dubins-with-wind | 4c0cf8bb1ae11bcd78bffbba5392b892fee53608 | [
"MIT"
] | 2 | 2021-02-24T23:16:00.000Z | 2021-05-18T01:19:08.000Z | #include<MathTools.h>
#include<MathToolsArma_Polytopes.h>
#include<MathToolsArma_Combinatronics.h>
#include<MathToolsArma_VectorOperators.h>
// cddlib
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <math.h>
#include <string.h>
//
// -----------------------------------------------
// REJECTION SAMPLING
// -----------------------------------------------
// uniformRejectionSample
// x is a N dimensional vector and each dimension of x is partitioned into an
// equal number S of values.
// e.g. if the first dimension x1 varies from xmin, xmax then the partitioning
// is [xmin, xmin + (xmax-xmin)/S, ... , xmax];
// This is repeated for every dimension. The cartesian product of the
// resulting set is computed (it containts S^N number of samples). Every
// sample in this resulting cartesian product set is tested to see if it
// satisfies the constraints. Only the samples that satisfy the constraints are
// returned. The numSamplesMax input specifies an upper bound on the number of
// samples that will be generated, i.e. the largest admissible S is chosen
// such that S^N <= numSamplesMax
arma::mat MathTools::uniformRejectionSample(int numSamplesMax, arma::vec xl,
arma::vec xu, arma::vec gl,
arma::vec gu, arma::mat A){
int n = xl.n_elem; // get the dimension of x
int numSamplesPerDim = uniformSamplesPerDim(numSamplesMax, n);
arma::mat basisVectorMatrix(n,numSamplesPerDim);
arma::vec basisVectorCurrent;
for (int i = 0; i < n; i++){
basisVectorCurrent = arma::linspace<arma::vec>(xl(i), xu(i),
numSamplesPerDim);
basisVectorMatrix.row(i) = basisVectorCurrent.t();
}
// generate cartesian product
arma::mat cp = MathTools::cartesianProduct(basisVectorMatrix);
int numSamplesCandidates = pow(numSamplesPerDim,n);
arma::mat validSamples = arma::zeros<arma::mat>(numSamplesCandidates, n);
arma::vec testVector;
arma::vec testResult;
// check if constraints are satisfied, if so add to
int k = 0;
for (int j = 0; j < cp.n_rows; j++){
testVector = cp.row(j).t();
testResult = A*(testVector);
if (MathTools::checkVectorBounds(testResult, gl, gu)){
validSamples.row(k) = testVector.t();
k++;
}
}
validSamples.shed_rows(k-1,numSamplesCandidates-1);
return validSamples;
}
// uniformSamplesPerDim
int MathTools::uniformSamplesPerDim(int numSamplesMax, int numDims){
int numSamplesPerDim = 1;
int numSamples = 1;
// increment numSamplesPerDim until the max is reached
// recall that the number of samples in numSamplesPerDim^numDims
while (numSamples <= numSamplesMax){
numSamplesPerDim++;
numSamples = pow(numSamplesPerDim,numDims);
}
return numSamplesPerDim-1;
}
// -----------------------------------------------
// BARYCENTRIC SAMPLING
// -----------------------------------------------
// barycentricSample
arma::mat MathTools::barycentricSample(int numSamplesMax, arma::vec xl,
arma::vec xu, arma::vec gl, arma::vec gu,
arma::mat A){
arma::mat vertices = MathTools::vertexEnumeration(xl, xu, gl, gu, A);
int n = xl.n_elem;
arma::mat samples = MathTools::verticesToBarycentricSamples(numSamplesMax,
vertices, n);
return samples;
}
// barycentricSample
arma::mat MathTools::barycentricSample(int numSamplesMax, arma::vec xl,
arma::vec xu, arma::vec gu, arma::mat A){
arma::mat vertices = MathTools::vertexEnumeration(xl, xu, gu, A);
int n = xl.n_elem;
arma::mat samples = MathTools::verticesToBarycentricSamples(numSamplesMax,
vertices, n);
return samples;
}
// verticesToBarycentricSamples
arma::mat MathTools::verticesToBarycentricSamples(int &numSamplesMax,
arma::mat &vertices,
int &n){
int numVertices = vertices.n_rows;
int numSamplesPerVertex = MathTools::barycentricSamplesPerVertex(
numSamplesMax,
numVertices);
arma::mat weightsInt = MathTools::constantSumSubsets(numSamplesPerVertex,
numVertices);
arma::mat weights = weightsInt / numSamplesPerVertex;
arma::mat samples(weights.n_rows, n);
for (int i = 0; i < weights.n_rows; i++){
arma::vec sample = arma::zeros<arma::vec>(n);
for (int j = 0; j < numVertices; j++){
sample += weights(i,j) * vertices.row(j).t();
}
samples.row(i) = sample.t();
}
return samples;
}
// returns the number of samples per vertex required such that the resulting
// number of barycentric samples does not exceed numSamplesMax
int MathTools::barycentricSamplesPerVertex(int numSamplesMax, int numVertices){
int numSamplesPerVertex = 1;
int numSamples = 1;
while (numSamples <= numSamplesMax){
numSamplesPerVertex++;
numSamples = MathTools::binomial(numSamplesPerVertex + numVertices - 1,
numVertices - 1 );
}
return numSamplesPerVertex-1;
}
| 39.255474 | 81 | 0.606359 | [
"vector"
] |
1388e2e2bbefe9769031924fb6e2862858d2b81a | 3,092 | hpp | C++ | stapl_release/benchmarks/kripke/stapled/Kripke/Kernel/kernel_work_functions.hpp | parasol-ppl/PPL_utils | 92728bb89692fda1705a0dee436592d97922a6cb | [
"BSD-3-Clause"
] | null | null | null | stapl_release/benchmarks/kripke/stapled/Kripke/Kernel/kernel_work_functions.hpp | parasol-ppl/PPL_utils | 92728bb89692fda1705a0dee436592d97922a6cb | [
"BSD-3-Clause"
] | null | null | null | stapl_release/benchmarks/kripke/stapled/Kripke/Kernel/kernel_work_functions.hpp | parasol-ppl/PPL_utils | 92728bb89692fda1705a0dee436592d97922a6cb | [
"BSD-3-Clause"
] | null | null | null | /*
// Copyright (c) 2000-2009, Texas Engineering Experiment Station (TEES), a
// component of the Texas A&M University System.
// All rights reserved.
// The information and source code contained herein is the exclusive
// property of TEES and may not be disclosed, examined or reproduced
// in whole or in part without explicit written authorization from TEES.
*/
#ifndef STAPL_BENCHMARKS_KERNEL_WORK_FUNCTIONS_HPP
#define STAPL_BENCHMARKS_KERNEL_WORK_FUNCTIONS_HPP
#include <GroupDirSet.hpp>
//////////////////////////////////////////////////////////////////////
/// @brief Functor used in Kernel::LTimes to clear phi in each vertex.
//////////////////////////////////////////////////////////////////////
struct clear_phi
{
private:
double m_value;
int m_total_num_groups;
int m_total_moments;
public:
typedef void result_type;
clear_phi(double const& value, int total_num_groups, int total_moments)
: m_value(value), m_total_num_groups(total_num_groups),
m_total_moments(total_moments)
{ }
//////////////////////////////////////////////////////////////////////
/// @brief Calls assign on the phi vector with the value provided
/// at construction.
/// @param v Proxy over the vertex representing a spatial zone
//////////////////////////////////////////////////////////////////////
template <typename Vertex>
result_type operator()(Vertex v)
{
auto phi_ref = v.property().phi();
std::array<typename Vertex::property_type::storage_type::index, 2>
index{{0, 0}};
for (int i = 0; i != m_total_num_groups; ++i)
for (int j = 0; j != m_total_moments; ++j)
{
index[0] = i;
index[1] = j;
phi_ref(index) = m_value;
}
}
void define_type(stapl::typer& t)
{
t.member(m_value);
t.member(m_total_num_groups);
t.member(m_total_moments);
}
};
struct allocate_vertex_members
{
private:
Nesting_Order m_nest;
Nesting_Order m_nest_phi;
int m_total_num_groups;
int m_total_moments;
int m_total_dirs;
std::vector<std::vector<Group_Dir_Set>> m_gd_sets;
public:
typedef void result_type;
allocate_vertex_members(Nesting_Order nest, Nesting_Order nest_phi,
int total_num_groups, int total_moments, int total_dirs,
std::vector<std::vector<Group_Dir_Set>> const& gd_sets)
: m_nest(nest), m_nest_phi(nest_phi), m_total_num_groups(total_num_groups),
m_total_moments(total_moments), m_total_dirs(total_dirs),
m_gd_sets(gd_sets)
{}
template <typename Vertex>
result_type operator()(Vertex v)
{
v.property().allocate(m_nest, m_nest_phi,
m_total_num_groups, m_total_moments, m_total_dirs,
m_gd_sets);
}
void define_type(stapl::typer& t)
{
t.member(m_nest);
t.member(m_nest_phi);
t.member(m_total_num_groups);
t.member(m_total_moments);
t.member(m_total_dirs);
t.member(m_gd_sets);
}
};
#endif
| 30.019417 | 79 | 0.600582 | [
"vector"
] |
1389344af089a928bf171a6d74ac840d4f853b97 | 15,018 | cpp | C++ | rmf_fleet_adapter/rmf_rxcpp/RxCpp-4.1.0/Rx/v2/test/sources/scope.cpp | Capstone-S13/rmf_ros2 | 66721dd2ab5a458c050bad154c6a17d8e4b5c8f4 | [
"Apache-2.0"
] | 1,451 | 2018-05-04T21:36:08.000Z | 2022-03-27T07:42:45.000Z | rmf_fleet_adapter/rmf_rxcpp/RxCpp-4.1.0/Rx/v2/test/sources/scope.cpp | Capstone-S13/rmf_ros2 | 66721dd2ab5a458c050bad154c6a17d8e4b5c8f4 | [
"Apache-2.0"
] | 150 | 2018-05-10T10:38:19.000Z | 2022-03-24T14:15:11.000Z | rmf_fleet_adapter/rmf_rxcpp/RxCpp-4.1.0/Rx/v2/test/sources/scope.cpp | Capstone-S13/rmf_ros2 | 66721dd2ab5a458c050bad154c6a17d8e4b5c8f4 | [
"Apache-2.0"
] | 220 | 2018-05-05T08:11:16.000Z | 2022-03-13T10:34:41.000Z | #include "../test.h"
SCENARIO("scope, cold observable", "[scope][sources]"){
GIVEN("a test cold observable of ints"){
auto sc = rxsc::make_test();
auto w = sc.create_worker();
const rxsc::test::messages<int> on;
rxu::detail::maybe<rx::test::testable_observable<int>> xs;
typedef rx::resource<std::vector<int>> resource;
WHEN("created by scope"){
auto res = w.start(
[&]() {
return rx::observable<>::
scope(
[&](){
return resource(rxu::to_vector({1, 2, 3, 4, 5}));
},
[&](resource r){
auto msg = std::vector<rxsc::test::messages<int>::recorded_type>();
int time = 10;
auto values = r.get();
std::for_each(values.begin(), values.end(), [&](int &v){
msg.push_back(on.next(time, v));
time += 10;
});
msg.push_back(on.completed(time));
xs.reset(sc.make_cold_observable(msg));
return xs.get();
}
)
// forget type to workaround lambda deduction bug on msvc 2013
.as_dynamic();
}
);
THEN("the output stops on completion"){
auto required = rxu::to_vector({
on.next(210, 1),
on.next(220, 2),
on.next(230, 3),
on.next(240, 4),
on.next(250, 5),
on.completed(260)
});
auto actual = res.get_observer().messages();
REQUIRE(required == actual);
}
THEN("there was one subscription and one unsubscription"){
auto required = rxu::to_vector({
on.subscribe(200, 260)
});
auto actual = xs.get().subscriptions();
REQUIRE(required == actual);
}
}
}
}
SCENARIO("scope, hot observable", "[scope][sources]"){
GIVEN("a test hot observable of ints"){
auto sc = rxsc::make_test();
auto w = sc.create_worker();
const rxsc::test::messages<int> on;
rxu::detail::maybe<rx::test::testable_observable<int>> xs;
typedef rx::resource<std::vector<int>> resource;
WHEN("created by scope"){
auto res = w.start(
[&]() {
return rx::observable<>::
scope(
[&](){
return resource(rxu::to_vector({1, 2, 3, 4, 5}));
},
[&](resource r){
auto msg = std::vector<rxsc::test::messages<int>::recorded_type>();
int time = 210;
auto values = r.get();
std::for_each(values.begin(), values.end(), [&](int &v){
msg.push_back(on.next(time, v));
time += 10;
});
msg.push_back(on.completed(time));
xs.reset(sc.make_hot_observable(msg));
return xs.get();
}
)
// forget type to workaround lambda deduction bug on msvc 2013
.as_dynamic();
}
);
THEN("the output stops on completion"){
auto required = rxu::to_vector({
on.next(210, 1),
on.next(220, 2),
on.next(230, 3),
on.next(240, 4),
on.next(250, 5),
on.completed(260)
});
auto actual = res.get_observer().messages();
REQUIRE(required == actual);
}
THEN("there was one subscription and one unsubscription"){
auto required = rxu::to_vector({
on.subscribe(200, 260)
});
auto actual = xs.get().subscriptions();
REQUIRE(required == actual);
}
}
}
}
SCENARIO("scope, complete", "[scope][sources]"){
GIVEN("a test cold observable of ints"){
auto sc = rxsc::make_test();
auto w = sc.create_worker();
const rxsc::test::messages<int> on;
int resource_factory_invoked = 0;
int observable_factory_invoked = 0;
rxu::detail::maybe<rx::test::testable_observable<int>> xs;
typedef rx::resource<int> resource;
WHEN("created by scope"){
auto res = w.start(
[&]() {
return rx::observable<>::
scope(
[&](){
++resource_factory_invoked;
return resource(sc.clock());
},
[&](resource r){
++observable_factory_invoked;
xs.reset(sc.make_cold_observable(rxu::to_vector({
on.next(100, r.get()),
on.completed(200)
})));
return xs.get();
}
)
// forget type to workaround lambda deduction bug on msvc 2013
.as_dynamic();
}
);
THEN("Resource factory is used once"){
REQUIRE(1 == resource_factory_invoked);
}
THEN("Observable factory is used once"){
REQUIRE(1 == observable_factory_invoked);
}
THEN("the output stops on completion"){
auto required = rxu::to_vector({
on.next(300, 200),
on.completed(400)
});
auto actual = res.get_observer().messages();
REQUIRE(required == actual);
}
THEN("there was one subscription and one unsubscription"){
auto required = rxu::to_vector({
on.subscribe(200, 400)
});
auto actual = xs.get().subscriptions();
REQUIRE(required == actual);
}
}
}
}
SCENARIO("scope, error", "[scope][sources]"){
GIVEN("a test cold observable of ints"){
auto sc = rxsc::make_test();
auto w = sc.create_worker();
const rxsc::test::messages<int> on;
std::runtime_error ex("scope on_error from source");
int resource_factory_invoked = 0;
int observable_factory_invoked = 0;
rxu::detail::maybe<rx::test::testable_observable<int>> xs;
typedef rx::resource<int> resource;
WHEN("created by scope"){
auto res = w.start(
[&]() {
return rx::observable<>::
scope(
[&](){
++resource_factory_invoked;
return resource(sc.clock());
},
[&](resource r){
++observable_factory_invoked;
xs.reset(sc.make_cold_observable(rxu::to_vector({
on.next(100, r.get()),
on.error(200, ex)
})));
return xs.get();
}
)
// forget type to workaround lambda deduction bug on msvc 2013
.as_dynamic();
}
);
THEN("Resource factory is used once"){
REQUIRE(1 == resource_factory_invoked);
}
THEN("Observable factory is used once"){
REQUIRE(1 == observable_factory_invoked);
}
THEN("the output stops on error"){
auto required = rxu::to_vector({
on.next(300, 200),
on.error(400, ex)
});
auto actual = res.get_observer().messages();
REQUIRE(required == actual);
}
THEN("there was one subscription and one unsubscription"){
auto required = rxu::to_vector({
on.subscribe(200, 400)
});
auto actual = xs.get().subscriptions();
REQUIRE(required == actual);
}
}
}
}
SCENARIO("scope, dispose", "[scope][sources]"){
GIVEN("a test cold observable of ints"){
auto sc = rxsc::make_test();
auto w = sc.create_worker();
const rxsc::test::messages<int> on;
int resource_factory_invoked = 0;
int observable_factory_invoked = 0;
rxu::detail::maybe<rx::test::testable_observable<int>> xs;
typedef rx::resource<int> resource;
WHEN("created by scope"){
auto res = w.start(
[&]() {
return rx::observable<>::
scope(
[&](){
++resource_factory_invoked;
return resource(sc.clock());
},
[&](resource r){
++observable_factory_invoked;
xs.reset(sc.make_cold_observable(rxu::to_vector({
on.next(100, r.get()),
on.next(1000, r.get() + 1)
})));
return xs.get();
}
)
// forget type to workaround lambda deduction bug on msvc 2013
.as_dynamic();
}
);
THEN("Resource factory is used once"){
REQUIRE(1 == resource_factory_invoked);
}
THEN("Observable factory is used once"){
REQUIRE(1 == observable_factory_invoked);
}
THEN("the output contains resulting ints"){
auto required = rxu::to_vector({
on.next(300, 200)
});
auto actual = res.get_observer().messages();
REQUIRE(required == actual);
}
THEN("there was one subscription and one unsubscription"){
auto required = rxu::to_vector({
on.subscribe(200, 1000)
});
auto actual = xs.get().subscriptions();
REQUIRE(required == actual);
}
}
}
}
SCENARIO("scope, throw resource selector", "[scope][sources][!throws]"){
GIVEN("a test cold observable of ints"){
auto sc = rxsc::make_test();
auto w = sc.create_worker();
const rxsc::test::messages<int> on;
std::runtime_error ex("scope on_error from source");
int resource_factory_invoked = 0;
int observable_factory_invoked = 0;
typedef rx::resource<int> resource;
WHEN("created by scope"){
auto res = w.start(
[&]() {
return rx::observable<>::
scope(
[&]() -> resource {
++resource_factory_invoked;
rxu::throw_exception(ex);
//return resource(sc.clock());
},
[&](resource){
++observable_factory_invoked;
return rx::observable<>::never<int>();
}
)
// forget type to workaround lambda deduction bug on msvc 2013
.as_dynamic();
}
);
THEN("Resource factory is used once"){
REQUIRE(1 == resource_factory_invoked);
}
THEN("Observable factory is not used"){
REQUIRE(0 == observable_factory_invoked);
}
THEN("the output stops on error"){
auto required = rxu::to_vector({
on.error(200, ex)
});
auto actual = res.get_observer().messages();
REQUIRE(required == actual);
}
}
}
}
SCENARIO("scope, throw resource usage", "[scope][sources][!throws]"){
GIVEN("a test cold observable of ints"){
auto sc = rxsc::make_test();
auto w = sc.create_worker();
const rxsc::test::messages<int> on;
std::runtime_error ex("scope on_error from source");
int resource_factory_invoked = 0;
int observable_factory_invoked = 0;
typedef rx::resource<int> resource;
WHEN("created by scope"){
auto res = w.start(
[&]() {
return rx::observable<>::
scope(
[&](){
++resource_factory_invoked;
return resource(sc.clock());
},
[&](resource) -> rx::observable<int> {
++observable_factory_invoked;
rxu::throw_exception(ex);
}
)
// forget type to workaround lambda deduction bug on msvc 2013
.as_dynamic();
}
);
THEN("Resource factory is used once"){
REQUIRE(1 == resource_factory_invoked);
}
THEN("Observable factory is used once"){
REQUIRE(1 == observable_factory_invoked);
}
THEN("the output stops on error"){
auto required = rxu::to_vector({
on.error(200, ex)
});
auto actual = res.get_observer().messages();
REQUIRE(required == actual);
}
}
}
}
| 35.336471 | 99 | 0.404914 | [
"vector"
] |
138d3caf952abf87f46657a26b04c45b5cb0577d | 17,357 | cpp | C++ | src/backends/dx/Utility/StringUtility.cpp | shiinamiyuki/LuisaCompute | f8358f8ec138950a84f570c0ede24cc76fc159de | [
"BSD-3-Clause"
] | 31 | 2020-11-21T08:16:53.000Z | 2021-09-05T13:46:32.000Z | src/backends/dx/Utility/StringUtility.cpp | shiinamiyuki/LuisaCompute | f8358f8ec138950a84f570c0ede24cc76fc159de | [
"BSD-3-Clause"
] | 1 | 2021-03-08T04:15:26.000Z | 2021-03-19T04:40:02.000Z | src/backends/dx/Utility/StringUtility.cpp | shiinamiyuki/LuisaCompute | f8358f8ec138950a84f570c0ede24cc76fc159de | [
"BSD-3-Clause"
] | 4 | 2020-12-02T09:41:22.000Z | 2021-03-06T06:36:40.000Z |
#include <Utility/StringUtility.h>
#include <Common/BitArray.h>
void StringUtil::IndicesOf(const vstd::string& str, const vstd::string& sign, vstd::vector<uint>& v) {
v.clear();
if (str.empty()) return;
int count = str.length() - sign.length() + 1;
v.reserve(10);
for (int i = 0; i < count; ++i) {
bool success = true;
for (int j = 0; j < sign.length(); ++j) {
if (sign[j] != str[i + j]) {
success = false;
break;
}
}
if (success)
v.push_back(i);
}
}
void StringUtil::SplitCodeString(
char const* beg,
char const* end,
vstd::vector<vstd::string_view>& results,
void* ptr,
funcPtr_t<CharCutState(void*, char)> func) {
for (char const* i = beg; i < end; ++i) {
CharCutState state = func(ptr, *i);
switch (state) {
case CharCutState::Different:
if (beg < i)
results.emplace_back(beg, i);
beg = i;
break;
case CharCutState::Cull:
if (beg < i)
results.emplace_back(beg, i);
beg = i + 1;
break;
}
}
if (beg < end)
results.emplace_back(beg, end);
}
void StringUtil::IndicesOf(const vstd::string& str, char sign, vstd::vector<uint>& v) {
v.clear();
int count = str.length();
v.reserve(10);
for (int i = 0; i < count; ++i) {
if (sign == str[i]) {
v.push_back(i);
}
}
}
void StringUtil::CutToLine(const char* str, const char* end, vstd::vector<vstd::string>& lines) {
lines.clear();
lines.reserve(32);
vstd::vector<char> c;
c.reserve(32);
for (char const* ite = str; ite < end; ++ite) {
if (*ite == '\n') {
if (!c.empty()) {
lines.emplace_back(c.data(), c.data() + c.size());
c.clear();
}
} else if (*ite != '\r')
c.push_back(*ite);
}
if (!c.empty()) {
lines.emplace_back(c.data(), c.data() + c.size());
}
}
void StringUtil::CutToLine_ContainEmptyLine(const char* str, const char* end, vstd::vector<vstd::string>& lines) {
lines.clear();
lines.reserve(32);
vstd::vector<char> c;
c.reserve(32);
for (char const* ite = str; ite < end; ++ite) {
if (*ite == '\n') {
if (!c.empty()) {
lines.emplace_back(c.data(), c.data() + c.size());
c.clear();
} else {
lines.emplace_back();
}
} else if (*ite != '\r')
c.push_back(*ite);
}
if (!c.empty()) {
lines.emplace_back(c.data(), c.data() + c.size());
}
}
void StringUtil::CutToLine_ContainEmptyLine(const char* str, const char* end, vstd::vector<vstd::string_view>& lines) {
lines.clear();
lines.reserve(32);
char const* start = str;
for (char const* ite = str; ite < end; ++ite) {
if (*ite == '\n') {
if (start != ite) {
if (*(ite - 1) == '\r') {
auto a = ite - 1;
lines.emplace_back(start, a);
} else
lines.emplace_back(start, ite);
start = ite + 1;
} else {
lines.emplace_back();
}
}
}
if (start != end) {
if (*(end - 1) == '\r') {
auto a = end - 1;
if (start != a)
lines.emplace_back(start, a);
} else
lines.emplace_back(start, end);
}
}
void StringUtil::CutToLine(const char* str, const char* end, vstd::vector<vstd::string_view>& lines) {
lines.clear();
lines.reserve(32);
char const* start = str;
for (char const* ite = str; ite < end; ++ite) {
if (*ite == '\n') {
if (start != ite) {
if (*(ite - 1) == '\r') {
auto a = ite - 1;
if (start != a)
lines.emplace_back(start, a);
} else
lines.emplace_back(start, ite);
start = ite + 1;
}
}
}
if (start != end) {
if (*(end - 1) == '\r') {
auto a = end - 1;
if (start != a)
lines.emplace_back(start, a);
} else
lines.emplace_back(start, end);
}
}
void StringUtil::CutToLine(const vstd::string& str, vstd::vector<vstd::string>& lines) {
return CutToLine(str.data(), str.data() + str.size(), lines);
}
void StringUtil::CutToLine_ContainEmptyLine(const vstd::string& str, vstd::vector<vstd::string>& lines) {
return CutToLine_ContainEmptyLine(str.data(), str.data() + str.size(), lines);
}
void StringUtil::CutToLine(const vstd::string& str, vstd::vector<vstd::string_view>& lines) {
return CutToLine(str.data(), str.data() + str.size(), lines);
}
void StringUtil::CutToLine_ContainEmptyLine(const vstd::string& str, vstd::vector<vstd::string_view>& lines) {
return CutToLine_ContainEmptyLine(str.data(), str.data() + str.size(), lines);
}
void StringUtil::ReadLines(std::ifstream& ifs, vstd::vector<vstd::string>& lines) {
ifs.seekg(0, std::ios::end);
int64_t size = ifs.tellg();
ifs.seekg(0, std::ios::beg);
vstd::vector<char> buffer(size);
memset(buffer.data(), 0, size);
ifs.read(buffer.data(), size);
for (int64_t sz = buffer.size() - 1; sz >= 0; --sz) {
if (buffer[sz] != '\0') {
buffer.resize(sz + 1);
break;
}
}
CutToLine(buffer.data(), buffer.data() + buffer.size(), lines);
}
int StringUtil::GetFirstIndexOf(const vstd::string& str, char sign) {
int count = str.length();
for (int i = 0; i < count; ++i) {
if (sign == str[i]) {
return i;
}
}
return -1;
}
int StringUtil::GetFirstIndexOf(const vstd::string& str, const vstd::string& sign) {
int count = str.length() - sign.length() + 1;
for (int i = 0; i < count; ++i) {
bool success = true;
for (int j = 0; j < sign.length(); ++j) {
if (sign[j] != str[i + j]) {
success = false;
break;
}
}
if (success)
return i;
}
return -1;
}
void StringUtil::Split(const vstd::string& str, char sign, vstd::vector<vstd::string>& v) {
vstd::vector<uint> indices;
IndicesOf(str, sign, indices);
v.clear();
v.reserve(10);
vstd::string s;
s.reserve(str.size());
uint startPos = 0;
for (auto index = indices.begin(); index != indices.end(); ++index) {
s.clear();
s.push_back_all(&str[startPos], *index - startPos);
startPos = *index + 1;
if (!s.empty())
v.push_back(s);
}
s.clear();
s.push_back_all(&str[startPos], str.length() - startPos);
if (!s.empty())
v.push_back(s);
}
void StringUtil::Split(const vstd::string& str, char sign, vstd::vector<vstd::string_view>& v) {
vstd::vector<uint> indices;
IndicesOf(str, sign, indices);
v.clear();
v.reserve(10);
vstd::string_view s;
int startPos = 0;
for (auto index = indices.begin(); index != indices.end(); ++index) {
s = vstd::string_view(&str[startPos], *index - startPos);
startPos = *index + 1;
if (s.size() > 0)
v.push_back(s);
}
s = vstd::string_view(&str[startPos], str.length() - startPos);
if (s.size() > 0)
v.push_back(s);
}
void StringUtil::Split(const vstd::string& str, const vstd::string& sign, vstd::vector<vstd::string>& v) {
vstd::vector<uint> indices;
IndicesOf(str, sign, indices);
v.clear();
v.reserve(10);
vstd::string s;
s.reserve(str.size());
uint startPos = 0;
for (auto index = indices.begin(); index != indices.end(); ++index) {
s.clear();
s.push_back_all(&str[startPos], *index - startPos);
startPos = *index + 1;
if (!s.empty())
v.push_back(s);
}
s.clear();
s.push_back_all(&str[startPos], str.length() - startPos);
if (!s.empty())
v.push_back(s);
}
void StringUtil::Split(const vstd::string& str, const vstd::string& sign, vstd::vector<vstd::string_view>& v) {
vstd::vector<uint> indices;
IndicesOf(str, sign, indices);
v.clear();
v.reserve(10);
vstd::string_view s;
int startPos = 0;
for (auto index = indices.begin(); index != indices.end(); ++index) {
s = vstd::string_view(&str[startPos], *index - startPos);
startPos = *index + 1;
if (s.size() > 0)
v.push_back(s);
}
s = vstd::string_view(&str[startPos], str.length() - startPos);
if (s.size() > 0)
v.push_back(s);
}
inline void mtolower(char& c) {
if ((c >= 'A') && (c <= 'Z'))
c = c + ('a' - 'A');
}
inline void mtoupper(char& c) {
if ((c >= 'a') && (c <= 'z'))
c = c + ('A' - 'a');
}
void StringUtil::ToLower(vstd::string& str) {
char* c = str.data();
const uint size = str.length();
for (uint i = 0; i < size; ++i) {
mtolower(c[i]);
}
}
bool StringUtil::CheckStringIsInteger(const char* beg, const char* end) {
if (end - beg == 0) return true;
if (*beg == '-') beg++;
for (const char* i = beg; i != end; ++i) {
if (*i < '0' || *i > '9') return false;
}
return true;
}
bool StringUtil::CheckStringIsFloat(const char* beg, const char* end) {
if (end - beg == 0) return true;
if (*beg == '-') beg++;
const char* i = beg;
for (; i != end; ++i) {
if (*i == '.') {
++i;
break;
}
if (*i < '0' || *i > '9') return false;
}
for (; i != end; ++i) {
if (*i < '0' || *i > '9') return false;
}
return true;
}
void StringUtil::ToUpper(vstd::string& str) {
char* c = str.data();
const uint size = str.length();
for (uint i = 0; i < size; ++i) {
mtoupper(c[i]);
}
}
void StringUtil::CullCharacater(vstd::string const& source, vstd::string& dest, std::initializer_list<char> const& lists) {
BitArray bit(256);
for (auto i : lists) {
bit[(uint8_t)i] = 1;
}
dest.clear();
char* end = source.data() + source.size();
char* last = source.data();
size_t sz = 0;
for (char* ite = source.data(); ite != end; ++ite) {
if (bit[(uint8_t)*ite]) {
if (sz > 0) {
dest.push_back_all(last, sz);
sz = 0;
}
last = ite + 1;
} else {
sz++;
}
}
if (sz > 0) {
dest.push_back_all(last, sz);
}
}
void StringUtil::CullCharacater(vstd::string_view const& source, vstd::string& dest, std::initializer_list<char> const& lists) {
BitArray bit(256);
for (auto i : lists) {
bit[(uint8_t)i] = 1;
}
dest.clear();
char const* end = source.end();
char const* last = source.begin();
size_t sz = 0;
for (char const* ite = last; ite != end; ++ite) {
if (bit[(uint8_t)*ite]) {
if (sz > 0) {
dest.push_back_all(last, sz);
sz = 0;
}
last = ite + 1;
} else {
sz++;
}
}
if (sz > 0) {
dest.push_back_all(last, sz);
}
}
struct CharControl {
BitArray spaceChar;
CharControl() : spaceChar(256) {
spaceChar[(uint8_t)' '] = 1;
spaceChar[(uint8_t)'\t'] = 1;
spaceChar[(uint8_t)'\r'] = 1;
spaceChar[(uint8_t)'\n'] = 1;
spaceChar[(uint8_t)'\\'] = 1;
}
};
bool StringUtil::IsCharSpace(char c) {
static CharControl charControl;
return charControl.spaceChar[(uint8_t)c];
}
bool StringUtil::IsCharNumber(char c) {
return c >= '0' && c <= '9';
}
bool StringUtil::IsCharCharacter(char c) {
return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z');
}
bool StringUtil::IsCharAvaliableCode(char c) {
char cs[] = {' ', '\t', '\r', '\n', '\\'};
for (auto& i : cs) {
if (i == c) return false;
}
return true;
}
bool StringUtil::ReadStringFromFile(vstd::string const& path, vstd::string& data) {
std::ifstream ifs(path.c_str());
if (!ifs) return false;
ifs.seekg(0, std::ios::end);
auto sz = ifs.tellg();
ifs.seekg(0, std::ios::beg);
data.clear();
data.resize(sz);
memset(data.data(), 0, data.size());
ifs.read(data.data(), data.size());
for (int64_t sz = data.size() - 1; sz >= 0; --sz) {
if (data[sz] != '\0') {
data.resize(sz + 1);
return true;
}
}
return true;
}
namespace StringUtilGlobal {
template<bool containType>
void InputCommentFunc(
vstd::vector<StringUtil::CodeChunk>& vec,
StringUtil::CodeType type,
char const*& lastPtr,
char const*& ite,
char const* end,
char const* leftSign,
size_t const leftSignSize,
char const* rightSign,
size_t const rightSignSize) {
if (end - ite < leftSignSize) return;
if (StringUtil::CompareCharArray(ite, leftSign, leftSignSize)) {
if (
reinterpret_cast<int64_t>(ite) - reinterpret_cast<int64_t>(lastPtr) > 0) {
vec.emplace_back(lastPtr, ite, StringUtil::CodeType::Code);
}
char const* commentStart = ite;
ite += leftSignSize;
char const* iteEnd = end - (rightSignSize - 1);
while (ite < iteEnd) {
if (StringUtil::CompareCharArray(ite, rightSign, rightSignSize)) {
ite += rightSignSize;
if constexpr (containType)
auto&& code = vec.emplace_back(commentStart, ite, type);
lastPtr = ite;
return;
}
ite++;
}
if (
reinterpret_cast<int64_t>(end) - reinterpret_cast<int64_t>(commentStart) > 0) {
vec.emplace_back(commentStart, end, type);
}
lastPtr = end;
}
}
}// namespace StringUtilGlobal
bool StringUtil::CompareCharArray(char const* first, char const* second, size_t chrLen) {
return memcmp(first, second, chrLen) == 0;
}
bool StringUtil::CompareCharArray(
char const* first,
char const* second,
char const* secondEnd) {
auto len = strlen(first);
if (secondEnd - second < len) return false;
return CompareCharArray(first, second, len);
}
bool StringUtil::CompareCharArray(
char const* first,
size_t len,
char const* second,
char const* secondEnd) {
if (secondEnd - second < len) return false;
return CompareCharArray(first, second, len);
}
void StringUtil::SampleCodeFile(vstd::string const& fileData, vstd::vector<CodeChunk>& results, bool separateCodeAndString, bool disposeComment) {
using namespace StringUtilGlobal;
results.clear();
if (fileData.empty()) return;
char const* begin = fileData.data();
char const* end = fileData.data() + fileData.size();
char const* codeStart = begin;
auto CollectTailFunc = [&](vstd::vector<CodeChunk>& res) -> void {
if (
reinterpret_cast<int64_t>(end) - reinterpret_cast<int64_t>(codeStart) > 0) {
res.emplace_back(codeStart, end, CodeType::Code);
}
};
if (separateCodeAndString) {
vstd::vector<CodeChunk> codeAndComments;
for (char const* ite = begin; ite < end; ++ite) {
if (disposeComment) {
InputCommentFunc<false>(
codeAndComments,
CodeType::Comment,
codeStart,
ite,
end,
"//",
2,
"\n",
1);
InputCommentFunc<false>(
codeAndComments,
CodeType::Comment,
codeStart,
ite,
end,
"/*",
2,
"*/",
2);
} else {
InputCommentFunc<true>(
codeAndComments,
CodeType::Comment,
codeStart,
ite,
end,
"//",
2,
"\n",
1);
InputCommentFunc<true>(
codeAndComments,
CodeType::Comment,
codeStart,
ite,
end,
"/*",
2,
"*/",
2);
}
}
CollectTailFunc(codeAndComments);
for (auto& chunk : codeAndComments) {
if (chunk.type == CodeType::Code) {
begin = chunk.str.data();
codeStart = begin;
end = chunk.str.data() + chunk.str.size();
for (char const* ite = begin; ite < end; ++ite) {
InputCommentFunc<true>(
results,
CodeType::String,
codeStart,
ite,
end,
"\"",
1,
"\"",
1);
InputCommentFunc<true>(
results,
CodeType::String,
codeStart,
ite,
end,
"'",
1,
"'",
1);
}
CollectTailFunc(results);
} else {
results.push_back(chunk);
}
}
} else {
for (char const* ite = begin; ite < end; ++ite) {
if (disposeComment) {
InputCommentFunc<false>(
results,
CodeType::Comment,
codeStart,
ite,
end,
"//",
2,
"\n",
1);
InputCommentFunc<false>(
results,
CodeType::Comment,
codeStart,
ite,
end,
"/*",
2,
"*/",
2);
} else {
InputCommentFunc<true>(
results,
CodeType::Comment,
codeStart,
ite,
end,
"//",
2,
"\n",
1);
InputCommentFunc<true>(
results,
CodeType::Comment,
codeStart,
ite,
end,
"/*",
2,
"*/",
2);
}
}
CollectTailFunc(results);
}
}
void StringUtil::SeparateString(
vstd::string const& str,
funcPtr_t<bool(char const*, char const*)> judgeFunc,
vstd::vector<std::pair<vstd::string, bool>>& vec) {
vec.clear();
char const* lastBeg = str.data();
bool flag = false;
char const* end = str.data() + str.size();
char const* ite;
for (ite = lastBeg; ite < end; ++ite) {
bool cur = judgeFunc(ite, end);
if (cur != flag) {
if (
reinterpret_cast<int64_t>(ite) - reinterpret_cast<int64_t>(lastBeg) > 0) {
auto&& pair = vec.emplace_back();
pair.second = flag;
pair.first.push_back_all(lastBeg, ite - lastBeg);
}
lastBeg = ite;
flag = cur;
}
}
if (
reinterpret_cast<int64_t>(ite) - reinterpret_cast<int64_t>(lastBeg) > 0) {
auto&& pair = vec.emplace_back();
pair.second = flag;
pair.first.push_back_all(lastBeg, ite - lastBeg);
}
}
void StringUtil::SeparateString(
vstd::string const& str,
funcPtr_t<bool(char const*, char const*)> judgeFunc,
vstd::vector<vstd::string>& vec) {
vec.clear();
char const* lastBeg = str.data();
bool flag = false;
char const* end = str.data() + str.size();
char const* ite;
for (ite = lastBeg; ite < end; ++ite) {
bool cur = judgeFunc(ite, end);
if (cur != flag) {
if (flag && reinterpret_cast<int64_t>(ite) - reinterpret_cast<int64_t>(lastBeg) > 0) {
vec.emplace_back(lastBeg, ite);
}
flag = cur;
lastBeg = ite;
}
}
if (flag && reinterpret_cast<int64_t>(ite) - reinterpret_cast<int64_t>(lastBeg) > 0) {
vec.emplace_back(lastBeg, ite);
}
}
int64_t StringUtil::StringToInt(const vstd::string& str) {
if (str.empty()) return 0;
int64_t v;
int64_t result = 0;
uint start = 0;
if (str[0] == '-') {
v = -1;
start = 1;
} else
v = 1;
for (; start < str.size(); ++start) {
result = result * 10 + ((int)str[start] - 48);
}
return result * v;
}
int64_t StringUtil::StringToInt(const char* chr, const char* end) {
size_t size = end - chr;
if (size == 0) return 0;
int64_t v;
int64_t result = 0;
size_t start = 0;
if (*chr == '-') {
v = -1;
start = 1;
} else
v = 1;
for (; start < size; ++start) {
result = result * 10 + ((int)chr[start] - 48);
}
return result * v;
} | 24.343619 | 146 | 0.598663 | [
"vector"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.