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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d6394686c0687b9a1ce096e0add5cbec319ca0e5 | 7,967 | cpp | C++ | src/other/ext/openscenegraph/src/osgDB/ReaderWriter.cpp | lf-/brlcad | f91ea585c1a930a2e97c3f5a8274db8805ebbb46 | [
"BSD-4-Clause",
"BSD-3-Clause"
] | null | null | null | src/other/ext/openscenegraph/src/osgDB/ReaderWriter.cpp | lf-/brlcad | f91ea585c1a930a2e97c3f5a8274db8805ebbb46 | [
"BSD-4-Clause",
"BSD-3-Clause"
] | null | null | null | src/other/ext/openscenegraph/src/osgDB/ReaderWriter.cpp | lf-/brlcad | f91ea585c1a930a2e97c3f5a8274db8805ebbb46 | [
"BSD-4-Clause",
"BSD-3-Clause"
] | null | null | null | /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* 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
* OpenSceneGraph Public License for more details.
*/
#include <osgDB/ReaderWriter>
#include <osgDB/Registry>
#include <osgDB/FileNameUtils>
#include <osgDB/FileUtils>
#include <osgDB/Archive>
using namespace osgDB;
osg::Object* ReaderWriter::ReadResult::getObject() { return _object.get(); }
osg::Image* ReaderWriter::ReadResult::getImage() { return dynamic_cast<osg::Image*>(_object.get()); }
osg::HeightField* ReaderWriter::ReadResult::getHeightField() { return dynamic_cast<osg::HeightField*>(_object.get()); }
osg::Node* ReaderWriter::ReadResult::getNode() { return dynamic_cast<osg::Node*>(_object.get()); }
osgDB::Archive* ReaderWriter::ReadResult::getArchive() { return dynamic_cast<osgDB::Archive*>(_object.get()); }
osg::Shader* ReaderWriter::ReadResult::getShader() { return dynamic_cast<osg::Shader*>(_object.get()); }
osg::Script* ReaderWriter::ReadResult::getScript() { return dynamic_cast<osg::Script*>(_object.get()); }
osg::Object* ReaderWriter::ReadResult::takeObject() { osg::Object* obj = _object.get(); if (obj) { obj->ref(); _object=NULL; obj->unref_nodelete(); } return obj; }
osg::Image* ReaderWriter::ReadResult::takeImage() { osg::Image* image=dynamic_cast<osg::Image*>(_object.get()); if (image) { image->ref(); _object=NULL; image->unref_nodelete(); } return image; }
osg::HeightField* ReaderWriter::ReadResult::takeHeightField() { osg::HeightField* hf=dynamic_cast<osg::HeightField*>(_object.get()); if (hf) { hf->ref(); _object=NULL; hf->unref_nodelete(); } return hf; }
osg::Node* ReaderWriter::ReadResult::takeNode() { osg::Node* node=dynamic_cast<osg::Node*>(_object.get()); if (node) { node->ref(); _object=NULL; node->unref_nodelete(); } return node; }
osgDB::Archive* ReaderWriter::ReadResult::takeArchive() { osgDB::Archive* archive=dynamic_cast<osgDB::Archive*>(_object.get()); if (archive) { archive->ref(); _object=NULL; archive->unref_nodelete(); } return archive; }
osg::Shader* ReaderWriter::ReadResult::takeShader() { osg::Shader* shader=dynamic_cast<osg::Shader*>(_object.get()); if (shader) { shader->ref(); _object=NULL; shader->unref_nodelete(); } return shader; }
osg::Script* ReaderWriter::ReadResult::takeScript() { osg::Script* script=dynamic_cast<osg::Script*>(_object.get()); if (script) { script->ref(); _object=NULL; script->unref_nodelete(); } return script; }
std::string ReaderWriter::ReadResult::statusMessage() const
{
std::string description;
switch (_status)
{
case NOT_IMPLEMENTED:
description += "not implemented";
break;
case FILE_NOT_HANDLED:
description += "file not handled";
break;
case FILE_NOT_FOUND:
description += "file not found";
break;
case ERROR_IN_READING_FILE:
description += "read error";
break;
case FILE_LOADED:
description += "file loaded";
break;
case FILE_LOADED_FROM_CACHE:
description += "file loaded from cache";
break;
case FILE_REQUESTED:
description += "file requested";
break;
case INSUFFICIENT_MEMORY_TO_LOAD:
description += "insufficient memory to load";
break;
}
if (!_message.empty())
description += " (" + _message + ")";
return description;
}
std::string ReaderWriter::WriteResult::statusMessage() const
{
std::string description;
switch (_status)
{
case NOT_IMPLEMENTED:
description += "not implemented";
break;
case FILE_NOT_HANDLED:
description += "file not handled";
break;
case ERROR_IN_WRITING_FILE:
description += "write error";
break;
case FILE_SAVED:
description += "file saved";
break;
}
if (!_message.empty())
description += " (" + _message + ")";
return description;
}
ReaderWriter::~ReaderWriter()
{
}
bool ReaderWriter::acceptsExtension(const std::string& extension) const
{
// check for an exact match
std::string lowercase_ext = convertToLowerCase(extension);
return (_supportedExtensions.count(lowercase_ext)!=0);
}
bool ReaderWriter::acceptsProtocol(const std::string& protocol) const
{
std::string lowercase_protocol = convertToLowerCase(protocol);
return (_supportedProtocols.count(lowercase_protocol)!=0);
}
void ReaderWriter::supportsProtocol(const std::string& fmt, const std::string& description)
{
Registry::instance()->registerProtocol(fmt);
_supportedProtocols[convertToLowerCase(fmt)] = description;
}
void ReaderWriter::supportsExtension(const std::string& fmt, const std::string& description)
{
_supportedExtensions[convertToLowerCase(fmt)] = description;
}
void ReaderWriter::supportsOption(const std::string& fmt, const std::string& description)
{
_supportedOptions[fmt] = description;
}
ReaderWriter::Features ReaderWriter::supportedFeatures() const
{
int features = FEATURE_NONE;
std::string dummyFilename;
if (readObject(dummyFilename,0).status()!=ReadResult::NOT_IMPLEMENTED) features |= FEATURE_READ_OBJECT;
if (readImage(dummyFilename,0).status()!=ReadResult::NOT_IMPLEMENTED) features |= FEATURE_READ_IMAGE;
if (readHeightField(dummyFilename,0).status()!=ReadResult::NOT_IMPLEMENTED) features |= FEATURE_READ_HEIGHT_FIELD;
if (readShader(dummyFilename,0).status()!=ReadResult::NOT_IMPLEMENTED) features |= FEATURE_READ_SHADER;
if (readNode(dummyFilename,0).status()!=ReadResult::NOT_IMPLEMENTED) features |= FEATURE_READ_NODE;
osg::ref_ptr<osg::Image> image = new osg::Image;
osg::ref_ptr<osg::HeightField> hf = new osg::HeightField;
osg::ref_ptr<osg::Shader> shader = new osg::Shader;
osg::ref_ptr<osg::Node> node = new osg::Node;
if (writeObject(*image, dummyFilename,0).status()!=WriteResult::NOT_IMPLEMENTED) features |= FEATURE_WRITE_OBJECT;
if (writeImage(*image,dummyFilename,0).status()!=WriteResult::NOT_IMPLEMENTED) features |= FEATURE_WRITE_IMAGE;
if (writeHeightField(*hf,dummyFilename,0).status()!=WriteResult::NOT_IMPLEMENTED) features |= FEATURE_WRITE_HEIGHT_FIELD;
if (writeShader(*shader,dummyFilename,0).status()!=WriteResult::NOT_IMPLEMENTED) features |= FEATURE_WRITE_SHADER;
if (writeNode(*node, dummyFilename,0).status()!=WriteResult::NOT_IMPLEMENTED) features |= FEATURE_WRITE_NODE;
return Features(features);
}
ReaderWriter::FeatureList ReaderWriter::featureAsString(ReaderWriter::Features feature)
{
typedef struct {
ReaderWriter::Features feature;
const char *s;
} FeatureStringList;
FeatureStringList list[] = {
{ FEATURE_READ_OBJECT, "readObject" },
{ FEATURE_READ_IMAGE, "readImage" },
{ FEATURE_READ_HEIGHT_FIELD, "readHeightField" },
{ FEATURE_READ_NODE, "readNode" },
{ FEATURE_READ_SHADER, "readShader" },
{ FEATURE_WRITE_OBJECT, "writeObject" },
{ FEATURE_WRITE_IMAGE, "writeImage" },
{ FEATURE_WRITE_HEIGHT_FIELD, "writeHeightField" },
{ FEATURE_WRITE_NODE, "writeNode" },
{ FEATURE_WRITE_SHADER, "writeShader" },
{ FEATURE_NONE,0 }
};
FeatureList result;
for(FeatureStringList *p=list; p->feature != 0; p++)
{
if ((feature & p->feature) != 0)
result.push_back(p->s);
}
return result;
}
bool ReaderWriter::fileExists(const std::string& filename, const Options* /*options*/) const
{
return ::osgDB::fileExists(filename);
}
| 41.712042 | 219 | 0.699762 | [
"object"
] |
d63a460e14b8228cf9445e7f01b77c789fb60f3d | 2,140 | cpp | C++ | src/behavior/policy/greedy_Q_policy.cpp | MarkieMark/fastrl | e4f0b9b60a7ecb6f13bbb79936ea82acb8adae0e | [
"Apache-2.0"
] | 4 | 2019-04-19T00:11:36.000Z | 2020-04-08T09:50:37.000Z | src/behavior/policy/greedy_Q_policy.cpp | MarkieMark/fastrl | e4f0b9b60a7ecb6f13bbb79936ea82acb8adae0e | [
"Apache-2.0"
] | null | null | null | src/behavior/policy/greedy_Q_policy.cpp | MarkieMark/fastrl | e4f0b9b60a7ecb6f13bbb79936ea82acb8adae0e | [
"Apache-2.0"
] | null | null | null | #include "greedy_Q_policy.h"
#include "policy_utils.h"
/**
* Mark Benjamin 1st June 2017
*/
GreedyQPolicy::GreedyQPolicy(QProvider *provider) {
qplanner = provider;
}
void GreedyQPolicy::setSolver(MDPSolverInterface *solver) {
// TODO c++ casting may need to follow hierarchy paths
#pragma clang diagnostic push
#pragma ide diagnostic ignored "OCDFAInspection"
qplanner = dynamic_cast<QProvider*>(solver);
#pragma clang diagnostic pop
if (qplanner == nullptr){
throw runtime_error("Planner is not a QProvider / QComputablePlanner");
}
}
#pragma clang diagnostic push
#pragma ide diagnostic ignored "cert-msc30-c"
Action* GreedyQPolicy::action(State *s) {
vector<QValue *> qValues = qplanner->qValues(s);
vector<QValue *> maxActions = vector<QValue *>();
maxActions.push_back(qValues[0]);
double maxQ = qValues[0]->q;
for (auto it = qValues.begin() + 1; it < qValues.end(); ++it) {
if ((*it)->q == maxQ) {
maxActions.push_back((*it));
} else if ((*it)->q > maxQ){
maxActions.clear();
maxActions.push_back((*it));
maxQ = (*it)->q;
}
}
return maxActions[rand() % maxActions.size()]->a;
}
#pragma clang diagnostic pop
double GreedyQPolicy::actionProb(State *s, Action *a) {
return PolicyUtils::actionProbFromEnum(this, s, a);
}
vector<ActionProb *> GreedyQPolicy::policyDistribution(State *s) {
vector<QValue *> qValues = qplanner->qValues(s);
long nMax = 1;
double maxQ = qValues[0]->q;
for (auto it = qValues.begin() + 1; it < qValues.end(); ++it) {
if ((*it)->q == maxQ) {
nMax++;
} else if ((*it)->q > maxQ) {
nMax = 1;
maxQ = (*it)->q;
}
}
vector<ActionProb *> res = vector<ActionProb *>();
double uniformMax = 1./(double)nMax;
double p;
for (QValue * q : qValues) {
p = 0;
if (q->q == maxQ) {
p = uniformMax;
}
auto * ap = new ActionProb(q->a, p);
res.push_back(ap);
}
return res;
}
bool GreedyQPolicy::definedFor(State *s) { return true; }
| 28.918919 | 79 | 0.594393 | [
"vector"
] |
d649f1bbf4a2e6697dcf06706bc27540077b44fb | 674 | cpp | C++ | codeforces/266b.queue-at-the-school/266b.cpp | KayvanMazaheri/acm | aeb05074bc9b9c92f35b6a741183da09a08af85d | [
"MIT"
] | 3 | 2018-01-19T14:09:23.000Z | 2018-02-01T00:40:55.000Z | codeforces/266b.queue-at-the-school/266b.cpp | KayvanMazaheri/acm | aeb05074bc9b9c92f35b6a741183da09a08af85d | [
"MIT"
] | null | null | null | codeforces/266b.queue-at-the-school/266b.cpp | KayvanMazaheri/acm | aeb05074bc9b9c92f35b6a741183da09a08af85d | [
"MIT"
] | null | null | null | // K1
// :)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
#include <queue>
#include <bitset>
#include <string>
#include <cmath>
#include <iomanip>
#include <set>
#include <map>
#define EPS 1e-8
#define PI 3.141592653589793
#define X first
#define Y second
#define FX(x) fixed << setprecision((x))
using namespace std;
typedef pair<int, int> point;
typedef set<int>::iterator ITR;
const int MAXN = 1e9;
int main()
{
int n, t;
cin >> n >> t;
string s;
cin >> s;
for(int i=0; i<t; i++)
{
for(int j=0; j < n-1; j++)
if (s[j] == 'B' && s[j+1] == 'G')
{
swap(s[j], s[j+1]);
j++;
}
}
cout << s << endl;
return 0;
}
| 14.340426 | 40 | 0.587537 | [
"vector"
] |
d651518c3a17243a773a532308de8314e9946b21 | 15,762 | cc | C++ | components/autofill/core/common/autofill_features.cc | mghgroup/Glide-Browser | 6a4c1eaa6632ec55014fee87781c6bbbb92a2af5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | components/autofill/core/common/autofill_features.cc | mghgroup/Glide-Browser | 6a4c1eaa6632ec55014fee87781c6bbbb92a2af5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | null | null | null | components/autofill/core/common/autofill_features.cc | mghgroup/Glide-Browser | 6a4c1eaa6632ec55014fee87781c6bbbb92a2af5 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 2 | 2021-01-05T23:43:46.000Z | 2021-01-07T23:36:34.000Z | // Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/autofill/core/common/autofill_features.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/metrics/field_trial_params.h"
#include "base/strings/string16.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
#include "components/autofill/core/common/autofill_prefs.h"
#include "components/autofill/core/common/autofill_switches.h"
#include "components/prefs/pref_service.h"
#include "ui/base/l10n/l10n_util.h"
namespace autofill {
namespace features {
// Controls if Autofill sends votes for the new address types.
const base::Feature kAutofillAddressEnhancementVotes{
"kAutofillAddressEnhancementVotes", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether the AddressNormalizer is supplied. If available, it may be
// used to normalize address and will incur fetching rules from the server.
const base::Feature kAutofillAddressNormalizer{
"AutofillAddressNormalizer", base::FEATURE_ENABLED_BY_DEFAULT};
// Controls if a full country name instead of a country code in a field with a
// type derived from HTML_TYPE_COUNTRY_CODE can be used to set the profile
// country.
const base::Feature kAutofillAllowHtmlTypeCountryCodesWithFullNames{
"AutofillAllowHtmlTypeCountryCodesWithFullNames",
base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether autofill activates on non-HTTP(S) pages. Useful for
// automated with data URLS in cases where it's too difficult to use the
// embedded test server. Generally avoid using.
const base::Feature kAutofillAllowNonHttpActivation{
"AutofillAllowNonHttpActivation", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kAutofillAlwaysFillAddresses{
"AlwaysFillAddresses", base::FEATURE_ENABLED_BY_DEFAULT};
// Controls the use of GET (instead of POST) to fetch cacheable autofill query
// responses.
const base::Feature kAutofillCacheQueryResponses{
"AutofillCacheQueryResponses", base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kAutofillCreateDataForTest{
"AutofillCreateDataForTest", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kAutofillCreditCardAssist{
"AutofillCreditCardAssist", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether we download server credit cards to the ephemeral
// account-based storage when sync the transport is enabled.
const base::Feature kAutofillEnableAccountWalletStorage {
"AutofillEnableAccountWalletStorage",
#if defined(OS_CHROMEOS) || defined(OS_ANDROID) || defined(OS_IOS)
// Wallet transport is only currently available on Win/Mac/Linux.
// (Somehow, swapping this check makes iOS unhappy?)
base::FEATURE_DISABLED_BY_DEFAULT
#else
base::FEATURE_ENABLED_BY_DEFAULT
#endif
};
// Controls whether to detect and fill the augmented phone country code field
// when enabled.
const base::Feature kAutofillEnableAugmentedPhoneCountryCode{
"AutofillEnableAugmentedPhoneCountryCode",
base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether we use COMPANY as part of Autofill
const base::Feature kAutofillEnableCompanyName{
"AutofillEnableCompanyName", base::FEATURE_ENABLED_BY_DEFAULT};
// Controls whether we show "Hide suggestions" item in the suggestions menu.
const base::Feature kAutofillEnableHideSuggestionsUI{
"AutofillEnableHideSuggestionsUI", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls if Autofill supports new structure in names.
// TODO(crbug.com/1098943): Remove once launched.
const base::Feature kAutofillEnableSupportForMoreStructureInNames{
"AutofillEnableSupportForMoreStructureInNames",
base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether or not a minimum number of fields is required before
// heuristic field type prediction is run for a form.
const base::Feature kAutofillEnforceMinRequiredFieldsForHeuristics{
"AutofillEnforceMinRequiredFieldsForHeuristics",
base::FEATURE_ENABLED_BY_DEFAULT};
// Controls whether or not a minimum number of fields is required before
// crowd-sourced field type predictions are queried for a form.
const base::Feature kAutofillEnforceMinRequiredFieldsForQuery{
"AutofillEnforceMinRequiredFieldsForQuery",
base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether or not a minimum number of fields is required before
// field type votes are uploaded to the crowd-sourcing server.
const base::Feature kAutofillEnforceMinRequiredFieldsForUpload{
"AutofillEnforceMinRequiredFieldsForUpload",
base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether or not all datalist shall be extracted into FormFieldData.
// This feature is enabled in both WebView and WebLayer where all datalists
// instead of only the focused one shall be extracted and sent to Android
// autofill service when the autofill session created.
const base::Feature kAutofillExtractAllDatalists{
"AutofillExtractAllDatalists", base::FEATURE_DISABLED_BY_DEFAULT};
// Autofill uses the local heuristic such that address forms are only filled if
// at least 3 fields are fillable according to local heuristics. Unfortunately,
// the criterion for fillability is only that the field type is unknown. So many
// field types that we don't fill (search term, price, ...) count towards that
// counter, effectively reducing the threshold for some forms.
const base::Feature kAutofillFixFillableFieldTypes{
"AutofillFixFillableFieldTypes", base::FEATURE_DISABLED_BY_DEFAULT};
// If enabled, prefilled country and state values are not reset before
// an address profile import.
// TODO(crbug.com/1100231): Remove once fix is tested.
const base::Feature kAutofillImportPrefilledCountryAndStateValues{
"AutofillImportPrefilledCountryAndStateValues",
base::FEATURE_ENABLED_BY_DEFAULT};
// When enabled, Autofill keeps the initial field values in the |FormStructure|
// cache for all field types.
const base::Feature kAutofillKeepInitialFormValuesInCache{
"AutofillKeepCachedFormValues", base::FEATURE_ENABLED_BY_DEFAULT};
// When enabled, Autofill will use FieldRendererIds instead of unique_names
// to align forms in FormStructure::RetrieveFromCache().
const base::Feature kAutofillRetrieveFromCacheWithRendererIds{
"AutofillRetrieveFromCacheWithRendererIds",
base::FEATURE_DISABLED_BY_DEFAULT};
// When enabled, autofill suggestions are displayed in the keyboard accessory
// instead of the regular popup.
const base::Feature kAutofillKeyboardAccessory{
"AutofillKeyboardAccessory", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kAutofillPruneSuggestions{
"AutofillPruneSuggestions", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kAutofillMetadataUploads{"AutofillMetadataUploads",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kAutofillOffNoServerData{"AutofillOffNoServerData",
base::FEATURE_DISABLED_BY_DEFAULT};
// When enabled, autofill server will override field types with rater
// consensus data before returning to client.
const base::Feature kAutofillOverrideWithRaterConsensus{
"AutofillOverrideWithRaterConsensus", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kAutofillPreferServerNamePredictions{
"AutofillPreferServerNamePredictions", base::FEATURE_DISABLED_BY_DEFAULT};
// If feature is enabled, autofill will be disabled for mixed forms (forms on
// HTTPS sites that submit over HTTP).
const base::Feature kAutofillPreventMixedFormsFilling{
"AutofillPreventMixedFormsFilling", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kAutofillProfileClientValidation{
"AutofillProfileClientValidation", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kAutofillProfileImportFromUnifiedSection{
"AutofillProfileImportFromUnifiedSection",
base::FEATURE_DISABLED_BY_DEFAULT};
// TODO(crbug.com/1101280): Remove once feature is tested.
const base::Feature kAutofillProfileImportFromUnfocusableFields{
"AutofillProfileImportFromUnfocusableFields",
base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether Autofill uses server-side validation to ensure that fields
// with invalid data are not suggested.
const base::Feature kAutofillProfileServerValidation{
"AutofillProfileServerValidation", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether autofill rejects using non-verified company names that are
// in the format of a birthyear.
const base::Feature kAutofillRejectCompanyBirthyear{
"AutofillRejectCompanyBirthyear", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether autofill rejects using non-verified company names that are
// social titles (e.g., "Mrs.") in some languages.
const base::Feature kAutofillRejectCompanySocialTitle{
"AutofillRejectCompanySocialTitle", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether or not a group of fields not enclosed in a form can be
// considered a form. If this is enabled, unowned fields will only constitute
// a form if there are signals to suggest that this might a checkout page.
const base::Feature kAutofillRestrictUnownedFieldsToFormlessCheckout{
"AutofillRestrictUnownedFieldsToFormlessCheckout",
base::FEATURE_DISABLED_BY_DEFAULT};
// On Canary and Dev channels only, this feature flag instructs chrome to send
// rich form/field metadata with queries. This will trigger the use of richer
// field-type predictions model on the server, for testing/evaluation of those
// models prior to a client-push.
const base::Feature kAutofillRichMetadataQueries{
"AutofillRichMetadataQueries", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether UPI/VPA values will be saved and filled into payment forms.
const base::Feature kAutofillSaveAndFillVPA{"AutofillSaveAndFillVPA",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kAutofillSaveOnProbablySubmitted{
"AutofillSaveOnProbablySubmitted", base::FEATURE_ENABLED_BY_DEFAULT};
// Enables or Disables (mostly for hermetic testing) autofill server
// communication. The URL of the autofill server can further be controlled via
// the autofill-server-url param. The given URL should specify the complete
// autofill server API url up to the parent "directory" of the "query" and
// "upload" resources.
// i.e., https://other.autofill.server:port/tbproxy/af/
const base::Feature kAutofillServerCommunication{
"AutofillServerCommunication", base::FEATURE_ENABLED_BY_DEFAULT};
// Controls whether autofill suggestions are filtered by field values previously
// filled by website.
const base::Feature kAutofillShowAllSuggestionsOnPrefilledForms{
"AutofillShowAllSuggestionsOnPrefilledForms",
base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether we show warnings in the Dev console for misused autocomplete
// types.
const base::Feature kAutofillShowAutocompleteConsoleWarnings{
"AutofillShowAutocompleteConsoleWarnings",
base::FEATURE_DISABLED_BY_DEFAULT};
// Controls attaching the autofill type predictions to their respective
// element in the DOM.
const base::Feature kAutofillShowTypePredictions{
"AutofillShowTypePredictions", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether inferred label is considered for comparing in
// FormFieldData.SimilarFieldAs.
const base::Feature kAutofillSkipComparingInferredLabels{
"AutofillSkipComparingInferredLabels", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether to skip fields whose last seen value differs from the
// initially value.
const base::Feature kAutofillSkipFillingFieldsWithChangedValues{
"AutofillSkipFillingFieldsWithChangedValues",
base::FEATURE_ENABLED_BY_DEFAULT};
// Controls whether Autofill should search prefixes of all words/tokens when
// filtering profiles, or only on prefixes of the whole string.
const base::Feature kAutofillTokenPrefixMatching{
"AutofillTokenPrefixMatching", base::FEATURE_DISABLED_BY_DEFAULT};
// Enables the touch to fill feature for Android.
const base::Feature kAutofillTouchToFill = {"TouchToFillAndroid",
base::FEATURE_ENABLED_BY_DEFAULT};
const base::Feature kAutofillUploadThrottling{"AutofillUploadThrottling",
base::FEATURE_ENABLED_BY_DEFAULT};
// Controls whether to use the API or use the legacy server.
const base::Feature kAutofillUseApi{"AutofillUseApi",
base::FEATURE_ENABLED_BY_DEFAULT};
// Controls whether suggestions' labels use the improved label disambiguation
// format.
const base::Feature kAutofillUseImprovedLabelDisambiguation{
"AutofillUseImprovedLabelDisambiguation",
base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether to use the combined heuristic and the autocomplete section
// implementation for section splitting or not. See https://crbug.com/1076175.
const base::Feature kAutofillUseNewSectioningMethod{
"AutofillUseNewSectioningMethod", base::FEATURE_DISABLED_BY_DEFAULT};
// TODO(crbug.com/1075604): Remove once launched.
// Controls whether the page language is used as a fall-back locale to translate
// the country name when a profile is imported from a form.
const base::Feature kAutofillUsePageLanguageToTranslateCountryNames{
"AutofillUsePageLanguageToTranslateCountryNames",
base::FEATURE_ENABLED_BY_DEFAULT};
// Controls whether to use the |ParseCityStateCountryZipCode| or not for
// predicting the heuristic type.
// |ParseCityStateCountryZipCode| is intended to prevent the misclassification
// of the country field into |ADDRESS_HOME_STATE| while determining the
// heuristic type. The misclassification happens sometimes because the regular
// expression for |ADDRESS_HOME_STATE| contains the term "region" which is also
// used for country selectors.
const base::Feature kAutofillUseParseCityStateCountryZipCodeInHeuristic{
"AutofillUseParseCityStateCountryZipCodeInHeuristic",
base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether or not autofill utilizes the country code from the Chrome
// variation service. The country code is used for determining the address
// requirements for address profile creation and as source for a default country
// used in a new address profile.
const base::Feature kAutofillUseVariationCountryCode{
"AutofillUseVariationCountryCode", base::FEATURE_DISABLED_BY_DEFAULT};
#if defined(OS_ANDROID)
// Controls whether the Autofill manual fallback for Addresses and Payments is
// present on Android.
const base::Feature kAutofillManualFallbackAndroid{
"AutofillManualFallbackAndroid", base::FEATURE_DISABLED_BY_DEFAULT};
// Controls whether to use modernized style for the Autofill dropdown.
const base::Feature kAutofillRefreshStyleAndroid{
"AutofillRefreshStyleAndroid", base::FEATURE_DISABLED_BY_DEFAULT};
#endif // OS_ANDROID
#if defined(OS_ANDROID) || defined(OS_IOS)
const base::Feature kAutofillUseMobileLabelDisambiguation{
"AutofillUseMobileLabelDisambiguation", base::FEATURE_DISABLED_BY_DEFAULT};
const char kAutofillUseMobileLabelDisambiguationParameterName[] = "variant";
const char kAutofillUseMobileLabelDisambiguationParameterShowAll[] = "show-all";
const char kAutofillUseMobileLabelDisambiguationParameterShowOne[] = "show-one";
#endif // defined(OS_ANDROID) || defined(OS_IOS)
bool IsAutofillCreditCardAssistEnabled() {
#if !defined(OS_ANDROID) && !defined(OS_IOS)
return false;
#else
return base::FeatureList::IsEnabled(kAutofillCreditCardAssist);
#endif
}
} // namespace features
} // namespace autofill
| 46.771513 | 80 | 0.798249 | [
"model"
] |
d653729691d191e919a1d422c02504bccb5b48bd | 16,962 | cpp | C++ | libmuscle/cpp/src/libmuscle/tests/test_instance.cpp | cffbots/muscle3 | ecc3db8b9910f1a1fe86110f543bae00579ff748 | [
"Apache-2.0"
] | 11 | 2018-03-12T10:43:46.000Z | 2020-06-01T10:58:56.000Z | libmuscle/cpp/src/libmuscle/tests/test_instance.cpp | cffbots/muscle3 | ecc3db8b9910f1a1fe86110f543bae00579ff748 | [
"Apache-2.0"
] | 85 | 2018-03-03T15:10:56.000Z | 2022-03-18T14:05:14.000Z | libmuscle/cpp/src/libmuscle/tests/test_instance.cpp | cffbots/muscle3 | ecc3db8b9910f1a1fe86110f543bae00579ff748 | [
"Apache-2.0"
] | 6 | 2018-03-12T10:47:11.000Z | 2022-02-03T13:44:07.000Z | // Inject mocks
#define LIBMUSCLE_MOCK_COMMUNICATOR <mocks/mock_communicator.hpp>
#define LIBMUSCLE_MOCK_LOGGER <mocks/mock_logger.hpp>
#define LIBMUSCLE_MOCK_MMP_CLIENT <mocks/mock_mmp_client.hpp>
// into the real implementation,
#include <ymmsl/ymmsl.hpp>
#include <libmuscle/close_port.cpp>
#include <libmuscle/data.cpp>
#include <libmuscle/instance.cpp>
#include <libmuscle/logging.cpp>
#include <libmuscle/mcp/data_pack.cpp>
#include <libmuscle/message.cpp>
#include <libmuscle/port.cpp>
#include <libmuscle/settings_manager.cpp>
#include <libmuscle/timestamp.cpp>
// then add mock implementations as needed.
#include <mocks/mock_communicator.cpp>
#include <mocks/mock_logger.cpp>
#include <mocks/mock_mmp_client.cpp>
// Test code dependencies
#include <memory>
#include <stdexcept>
#include <typeinfo>
#include <gtest/gtest.h>
#include <libmuscle/instance.hpp>
#include <libmuscle/settings_manager.hpp>
#include <mocks/mock_communicator.hpp>
using libmuscle::impl::ClosePort;
using libmuscle::impl::Instance;
using libmuscle::impl::Message;
using libmuscle::impl::MockCommunicator;
using libmuscle::impl::MockMMPClient;
using libmuscle::impl::PortsDescription;
using ymmsl::Reference;
int main(int argc, char *argv[]) {
::testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}
// Helpers for accessing internal state
namespace libmuscle { namespace impl {
struct TestInstance {
static Reference & instance_name_(Instance & instance) {
return instance.impl_()->instance_name_;
}
static SettingsManager & settings_manager_(Instance & instance) {
return instance.impl_()->settings_manager_;
}
};
} }
using libmuscle::impl::TestInstance;
/* Mocks have internal state, which needs to be reset before each test. This
* means that the tests are not reentrant, and cannot be run in parallel.
* It's all fast enough, so that's not a problem.
*/
void reset_mocks() {
MockCommunicator::reset();
MockMMPClient::reset();
}
std::vector<char const *> test_argv() {
char const * arg0 = "\0";
char const * arg1 = "--muscle-instance=test_instance[13][42]";
char const * arg2 = "--muscle-manager=node042:9000";
return std::vector<char const *>({arg0, arg1, arg2});
}
TEST(libmuscle_instance, create_instance) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::F_INIT, {"in1"}},
{Operator::O_F, {"out1", "out2[]"}}
}));
ASSERT_EQ(TestInstance::instance_name_(instance), "test_instance[13][42]");
ASSERT_EQ(MockMMPClient::num_constructed, 1);
ASSERT_EQ(MockMMPClient::last_location, "node042:9000");
ASSERT_EQ(MockCommunicator::num_constructed, 1);
ASSERT_EQ(MockMMPClient::last_registered_name, "test_instance[13][42]");
ASSERT_EQ(MockMMPClient::last_registered_locations.at(0), "tcp:test1,test2");
ASSERT_EQ(MockMMPClient::last_registered_locations.at(1), "tcp:test3");
ASSERT_EQ(MockMMPClient::last_registered_ports.size(), 3);
auto & settings = TestInstance::settings_manager_(instance);
ASSERT_EQ(settings.base["test_int"], 10);
ASSERT_EQ(settings.base["test_string"], "testing");
ASSERT_TRUE(settings.overlay.empty());
}
TEST(libmuscle_instance, send) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::O_F, {"out"}}
}));
MockCommunicator::list_ports_return_value = PortsDescription({
{Operator::O_F, {"out"}}
});
MockCommunicator::get_port_return_value.emplace(
"out", Port("out", Operator::O_F, false, true, 0, {}));
Message msg(3.0, 4.0, "Testing");
instance.send("out", msg);
ASSERT_EQ(MockCommunicator::last_sent_port, "out");
ASSERT_FALSE(MockCommunicator::last_sent_slot.is_set());
ASSERT_EQ(MockCommunicator::last_sent_message.timestamp(), 3.0);
ASSERT_EQ(MockCommunicator::last_sent_message.next_timestamp(), 4.0);
ASSERT_EQ(MockCommunicator::last_sent_message.data().as<std::string>(), "Testing");
}
TEST(libmuscle_instance, send_invalid_port) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::O_F, {"out"}}
}));
MockCommunicator::port_exists_return_value = false;
Message msg(3.0, 4.0, "Testing");
ASSERT_THROW(instance.send("out", msg), std::logic_error);
}
TEST(libmuscle_instance, get_setting) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data());
Settings settings;
settings["test1"] = "test";
settings["test2"] = {1.0, 2.0};
settings["test3"] = 10;
settings["test4"] = 10000000000l; // does not fit 32 bits
settings["test5"] = 10.0;
settings["test6"] = 1.0f / 3.0f; // not exactly representable
TestInstance::settings_manager_(instance).base = settings;
ASSERT_TRUE(instance.get_setting("test1").is_a<std::string>());
ASSERT_EQ(instance.get_setting("test1").as<std::string>(), "test");
ASSERT_EQ(instance.get_setting_as<std::string>("test1"), "test");
ASSERT_EQ(instance.get_setting_as<std::vector<double>>("test2"), std::vector<double>({1.0, 2.0}));
ASSERT_EQ(instance.get_setting_as<int64_t>("test3"), 10l);
ASSERT_EQ(instance.get_setting_as<int64_t>("test4"), 10000000000l);
ASSERT_EQ(static_cast<int>(instance.get_setting_as<int32_t>("test3")), 10);
ASSERT_THROW(instance.get_setting_as<int32_t>("test4"), std::bad_cast);
ASSERT_EQ(instance.get_setting_as<double>("test5"), 10.0);
ASSERT_EQ(instance.get_setting_as<double>("test6"), 1.0f / 3.0f);
ASSERT_EQ(instance.get_setting_as<double>("test3"), 10.0);
ASSERT_THROW(instance.get_setting("testx"), std::out_of_range);
ASSERT_THROW(instance.get_setting_as<int64_t>("test1"), std::bad_cast);
}
TEST(libmuscle_instance, receive) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::S, {"in"}}
}));
MockCommunicator::list_ports_return_value = PortsDescription({
{Operator::S, {"in"}}
});
MockCommunicator::get_port_return_value.emplace(
"in", Port("in", Operator::S, false, true, 0, {}));
MockCommunicator::next_received_message["in"] =
std::make_unique<Message>(1.0, 2.0, "Testing receive", Settings());
Message msg(instance.receive("in"));
ASSERT_EQ(msg.timestamp(), 1.0);
ASSERT_TRUE(msg.has_next_timestamp());
ASSERT_EQ(msg.next_timestamp(), 2.0);
ASSERT_TRUE(msg.data().is_a<std::string>());
ASSERT_EQ(msg.data().as<std::string>(), "Testing receive");
// make sure Instance shuts down cleanly
MockCommunicator::next_received_message["in"] =
std::make_unique<Message>(0.0, ClosePort(), Settings());
}
TEST(libmuscle_instance, receive_f_init) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::F_INIT, {"in"}}
}));
MockCommunicator::list_ports_return_value = PortsDescription({
{Operator::F_INIT, {"in"}}
});
MockCommunicator::get_port_return_value.emplace(
"in", Port("in", Operator::F_INIT, false, true, 0, {}));
MockCommunicator::next_received_message["in"] =
std::make_unique<Message>(1.0, 2.0, "Testing receive", Settings());
ASSERT_TRUE(instance.reuse_instance());
Message msg(instance.receive("in"));
ASSERT_EQ(msg.timestamp(), 1.0);
ASSERT_TRUE(msg.has_next_timestamp());
ASSERT_EQ(msg.next_timestamp(), 2.0);
ASSERT_TRUE(msg.data().is_a<std::string>());
ASSERT_EQ(msg.data().as<std::string>(), "Testing receive");
Port port("in", Operator::F_INIT, false, true, 0, {});
port.set_closed();
MockCommunicator::get_port_return_value.at("in") = port;
ASSERT_THROW(instance.receive("in"), std::logic_error);
}
TEST(libmuscle_instance, receive_default) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::S, {"in"}}
}));
MockCommunicator::list_ports_return_value = PortsDescription({
{Operator::S, {"in"}}
});
MockCommunicator::get_port_return_value.emplace(
"in", Port("in", Operator::S, false, false, 0, {}));
Message default_msg(1.0, 2.0, "Testing receive");
Message msg(instance.receive("in", default_msg));
ASSERT_EQ(msg.timestamp(), 1.0);
ASSERT_TRUE(msg.has_next_timestamp());
ASSERT_EQ(msg.next_timestamp(), 2.0);
ASSERT_TRUE(msg.data().is_a<std::string>());
ASSERT_EQ(msg.data().as<std::string>(), "Testing receive");
ASSERT_THROW(instance.receive("not_connected"), std::logic_error);
}
TEST(libmuscle_instance, receive_invalid_port) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::S, {"in"}}
}));
MockCommunicator::list_ports_return_value = PortsDescription({
{Operator::S, {"in"}}
});
MockCommunicator::get_port_return_value.emplace(
"in", Port("in", Operator::S, false, false, 0, {}));
ASSERT_THROW(instance.receive("does_not_exist", 1), std::logic_error);
}
TEST(libmuscle_instance, receive_with_settings) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::F_INIT, {"in"}}
}));
MockCommunicator::list_ports_return_value = PortsDescription({
{Operator::F_INIT, {"in"}}
});
MockCommunicator::get_port_return_value.emplace(
"in", Port("in", Operator::F_INIT, false, true, 0, {}));
Settings recv_settings;
recv_settings["test1"] = 12;
MockCommunicator::next_received_message["in"] =
std::make_unique<Message>(1.0, "Testing with settings", recv_settings);
ASSERT_TRUE(instance.reuse_instance(false));
Message msg(instance.receive_with_settings("in"));
ASSERT_EQ(msg.timestamp(), 1.0);
ASSERT_FALSE(msg.has_next_timestamp());
ASSERT_TRUE(msg.data().is_a<std::string>());
ASSERT_EQ(msg.data().as<std::string>(), "Testing with settings");
ASSERT_TRUE(msg.has_settings());
ASSERT_EQ(msg.settings().at("test1"), 12);
// make sure Instance shuts down cleanly
MockCommunicator::next_received_message["in"] =
std::make_unique<Message>(0.0, ClosePort(), Settings());
}
TEST(libmuscle_instance, receive_parallel_universe) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::F_INIT, {"in"}}
}));
MockCommunicator::list_ports_return_value = PortsDescription({
{Operator::F_INIT, {"in"}}
});
Port port("in", Operator::F_INIT, false, true, 0, {});
port.set_closed();
MockCommunicator::get_port_return_value.emplace("in", port);
Settings recv_settings;
recv_settings["test1"] = 12;
MockCommunicator::next_received_message["in"] =
std::make_unique<Message>(1.0, "Testing", recv_settings);
recv_settings["test2"] = "test";
MockCommunicator::next_received_message["muscle_settings_in"] =
std::make_unique<Message>(1.0, recv_settings, Settings());
ASSERT_THROW(instance.reuse_instance(), std::logic_error);
}
TEST(libmuscle_instance, receive_with_settings_default) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::F_INIT, {"not_connected"}}
}));
MockCommunicator::list_ports_return_value = PortsDescription({
{Operator::F_INIT, {"not_connected"}}
});
MockCommunicator::get_port_return_value.emplace(
"not_connected", Port("in", Operator::F_INIT, false, false, 0, {}));
Settings default_settings;
default_settings["test1"] = 12;
Message default_msg(1.0, "Testing with settings", default_settings);
ASSERT_TRUE(instance.reuse_instance(false));
Message msg(instance.receive_with_settings("not_connected", default_msg));
ASSERT_EQ(msg.timestamp(), 1.0);
ASSERT_FALSE(msg.has_next_timestamp());
ASSERT_TRUE(msg.data().is_a<std::string>());
ASSERT_EQ(msg.data().as<std::string>(), "Testing with settings");
ASSERT_TRUE(msg.has_settings());
ASSERT_EQ(msg.settings().at("test1"), 12);
}
TEST(libmuscle_instance, reuse_instance_receive_overlay) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::F_INIT, {"in"}}
}));
Settings test_base_settings;
test_base_settings["test1"] = 24;
test_base_settings["test2"] = {1.3, 2.0};
Settings test_overlay;
test_overlay["test2"] = "abc";
MockCommunicator::settings_in_connected_return_value = true;
MockCommunicator::next_received_message["muscle_settings_in"] =
std::make_unique<Message>(0.0, test_overlay, test_base_settings);
instance.reuse_instance();
ASSERT_EQ(TestInstance::settings_manager_(instance).overlay.size(), 2);
ASSERT_EQ(TestInstance::settings_manager_(instance).overlay.at("test1"), 24);
ASSERT_EQ(TestInstance::settings_manager_(instance).overlay.at("test2"), "abc");
}
TEST(libmuscle_instance, reuse_instance_closed_port) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::F_INIT, {"in", "not_connected"}},
{Operator::O_F, {"out"}}
}));
MockCommunicator::settings_in_connected_return_value = true;
MockCommunicator::next_received_message["muscle_settings_in"] =
std::make_unique<Message>(0.0, Settings(), Settings());
MockCommunicator::next_received_message["in"] =
std::make_unique<Message>(0.0, ClosePort(), Settings());
MockCommunicator::list_ports_return_value = PortsDescription({
{Operator::F_INIT, {"in", "not_connected"}},
{Operator::O_F, {"out"}}
});
MockCommunicator::get_port_return_value.emplace(
"not_connected",
Port("not_connected", Operator::F_INIT, false, false, 0, {}));
MockCommunicator::get_port_return_value.emplace(
"in", Port("in", Operator::F_INIT, false, true, 0, {}));
MockCommunicator::get_port_return_value.emplace(
"out", Port("out", Operator::O_F, false, true, 0, {}));
ASSERT_FALSE(instance.reuse_instance());
}
TEST(libmuscle_instance, reuse_instance_vector_port) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({
{Operator::F_INIT, {"in[]"}}
}));
MockCommunicator::settings_in_connected_return_value = true;
MockCommunicator::next_received_message["muscle_settings_in"] =
std::make_unique<Message>(0.0, Settings(), Settings());
for (int i = 0; i < 10; ++i) {
Reference port_slot("in");
port_slot += i;
std::ostringstream oss;
oss << "test " << i;
MockCommunicator::next_received_message[port_slot] =
std::make_unique<Message>(0.0, oss.str(), Settings());
}
MockCommunicator::list_ports_return_value = PortsDescription({
{Operator::F_INIT, {"in"}}
});
MockCommunicator::get_port_return_value.emplace(
"in", Port("in", Operator::F_INIT, true, true, 0, {10}));
ASSERT_TRUE(instance.reuse_instance());
auto msg = instance.receive("in", 5);
ASSERT_EQ(msg.timestamp(), 0.0);
ASSERT_FALSE(msg.has_next_timestamp());
ASSERT_EQ(msg.data().as<std::string>(), "test 5");
// make sure Instance shuts down cleanly
for (int i = 0; i < 10; ++i) {
Reference port_slot("in");
port_slot += i;
MockCommunicator::next_received_message[port_slot] =
std::make_unique<Message>(0.0, ClosePort(), Settings());
}
}
TEST(libmuscle_instance, reuse_instance_no_f_init_ports) {
reset_mocks();
auto argv = test_argv();
Instance instance(argv.size(), argv.data(),
PortsDescription({}));
MockCommunicator::settings_in_connected_return_value = false;
ASSERT_TRUE(instance.reuse_instance());
ASSERT_FALSE(instance.reuse_instance());
}
| 34.758197 | 102 | 0.650631 | [
"vector"
] |
d6593224065e6eb622db03df910115fe3da1ab3b | 24,004 | cpp | C++ | LIB/libVision.cpp | adda25/mruby-LibVision | 032efbd70235d0045ad630425e15dc5ef1df8f23 | [
"MIT"
] | null | null | null | LIB/libVision.cpp | adda25/mruby-LibVision | 032efbd70235d0045ad630425e15dc5ef1df8f23 | [
"MIT"
] | null | null | null | LIB/libVision.cpp | adda25/mruby-LibVision | 032efbd70235d0045ad630425e15dc5ef1df8f23 | [
"MIT"
] | null | null | null | #include <iostream>
#include <vector>
#include <string>
#include <map>
#include <opencv2/opencv.hpp>
#include <raspicam/raspicam_cv.h>
#include <raspicam/raspicam.h>
#include "libVision.h"
#include <stdio.h>
#ifdef __cplusplus
/*
____ ____ _ ____ _ _
/ ___| _ _ | _ \ __ _ _ __| | __/ ___|(_) __| | ___
| | _| |_ _| |_ | | | |/ _` | '__| |/ /\___ \| |/ _` |/ _ \
| |__|_ _|_ _| | |_| | (_| | | | < ___) | | (_| | __/
\____||_| |_| |____/ \__,_|_| |_|\_\|____/|_|\__,_|\___|
*/
LibVision::LibVision() {
#if DEBUG_MODE
LIB_VISION_DPRINT("init");
#endif
// Populate lookup table
this->lbFunctions.insert(
std::make_pair("openCamera", &LibVision::openCamera));
this->lbFunctions.insert(
std::make_pair("closeCamera", &LibVision::closeCamera));
this->lbFunctions.insert(
std::make_pair("acquireFrame", &LibVision::acquireFrame));
this->lbFunctions.insert(std::make_pair("saveFrame", &LibVision::saveFrame));
this->lbFunctions.insert(
std::make_pair("loadImageFromMem", &LibVision::loadImageFromMemory));
this->lbFunctions.insert(
std::make_pair("preprocessingOTSU", &LibVision::preprocessingFrameOTSU));
this->lbFunctions.insert(
std::make_pair("preprocessingADPT", &LibVision::preprocessingFrameADPT));
this->lbFunctions.insert(
std::make_pair("detectSquares", &LibVision::detectSquares));
this->lbFunctions.insert(
std::make_pair("detectCircles", &LibVision::detectCircles));
this->lbFunctions.insert(
std::make_pair("detectPenta", &LibVision::detectPenta));
this->lbFunctions.insert(std::make_pair("detectExa", &LibVision::detectExa));
this->lbFunctions.insert(
std::make_pair("holdSquarePatterns", &LibVision::checkSquarePatterns));
this->lbFunctions.insert(
std::make_pair("holdOnlyRightColored", &LibVision::checkColor));
this->lbFunctions.insert(
std::make_pair("setCurrentBackground", &LibVision::setCurrentBackground));
this->lbFunctions.insert(
std::make_pair("subtractBackground", &LibVision::subtractBackground));
this->lbFunctions.insert(
std::make_pair("saveCandidates", &LibVision::saveCandidates));
this->lbFunctions.insert(
std::make_pair("clearCandidates", &LibVision::clearCandidates));
this->lbFunctions.insert(
std::make_pair("drawCandidates", &LibVision::drawAllCandidates));
// Lookup table debug functions
this->lbFunctions.insert(
std::make_pair("printPolygonsFounds", &LibVision::debugPrintPolys));
this->lbFunctions.insert(
std::make_pair("printMethods", &LibVision::debugPrintMethods));
// Print available functions
#if SHOW_INFO
this->debugPrintMethods();
#endif
// Alloc lbParams
initParams();
}
LibVision::~LibVision() {
#if DEBUG_MODE
std::cout << "LibVision::deinit" << std::endl;
#endif
}
void LibVision::initParams() {
this->lbParams = (LibVisionParams *)malloc(sizeof(LibVisionParams));
if (this->lbParams == NULL) {
#if DEBUG_MODE
std::cout << "LibVision-> alloc lbParams fails at: " << __LINE__
<< std::endl;
#endif
}
this->lbParams->imagePath = (char *)malloc(256 * sizeof(char));
// Saved frame path
this->lbParams->savedImagePath = (char *)malloc(256 * sizeof(char));
// Alloc LibVisionParams colorRange
this->lbParams->colorRange = (int *)malloc(6 * sizeof(int));
if (this->lbParams->colorRange == NULL) {
free(this->lbParams->colorRange);
}
static const int defaultColorRange[6] = {0, 0, 0, 10, 10, 10}; // Black
memcpy(this->lbParams->colorRange, defaultColorRange,
sizeof(defaultColorRange));
// Alloc LibVisionParams polygons
this->lbParams->polygonsFounds = 0;
// Default params
this->lbParams->otsuThresh = 130;
this->lbParams->adptThreshSize = 7;
this->lbParams->adptThreshMean = 7;
// Set Raspberry camera
this->lbParams->cameraIsAvailable = FALSE;
}
void LibVision::requireOperations(char *operations[], size_t size) {
#if DEBUG_MODE
LIB_VISION_DPRINT("requireOperations");
#endif
for (uint i = 0; i < (int)size; i++) {
if (operations[i] == NULL) {
continue;
}
if (this->lbFunctions[std::string(operations[i])]) {
LibVisionFunction lvfp = this->lbFunctions[std::string(operations[i])];
(this->*lvfp)();
}
}
}
/*
* Operations
*/
void LibVision::openCamera() {
this->camera = new raspicam::RaspiCam_Cv();
#if DEBUG_MODE
if (this->camera->open()) {
this->lbParams->cameraIsAvailable = TRUE;
#if DEBUG_MODE
LIB_VISION_DPRINT("openCamera -> camera is available");
#endif
} else {
#if DEBUG_MODE
LIB_VISION_DPRINT("openCamera -> camera is not available");
#endif
}
#endif
}
void LibVision::closeCamera() {
#if DEBUG_MODE
LIB_VISION_DPRINT("closeCamera");
#endif
if (this->lbParams->cameraIsAvailable == TRUE) {
this->camera->release();
}
}
void LibVision::acquireFrame() {
#if DEBUG_MODE
LIB_VISION_DPRINT("acquireFrame");
#endif
if (this->lbParams->cameraIsAvailable == FALSE) {
#if DEBUG_MODE
LIB_VISION_DPRINT("acquireFrame --> camera is not available");
#endif
return;
}
this->camera->grab();
this->camera->retrieve(this->lastFrame);
this->opFrame = this->lastFrame;
}
void LibVision::saveFrame() {
#if DEBUG_MODE
LIB_VISION_DPRINT("saveFrame");
#endif
if (this->lbParams->savedImagePath == NULL) {
#if DEBUG_MODE
LIB_VISION_DPRINT("saveFrame: savedImagePath is NULL --> return");
#endif
return;
}
std::cout << "Saved path: " << this->lbParams->savedImagePath << std::endl;
cv::imwrite(this->lbParams->savedImagePath, this->opFrame);
}
void LibVision::loadImageFromMemory() {
#if DEBUG_MODE
std::cout << "LibVision::setFramePathname --> " << lbParams->imagePath
<< std::endl;
#endif
if (lbParams->imagePath == NULL) {
#if DEBUG_MODE
LIB_VISION_DPRINT("loadImageFromMemory --> imagepath is NULL");
#endif
return;
}
this->lastFrame =
cv::imread(std::string(lbParams->imagePath), CV_LOAD_IMAGE_COLOR);
if (this->lastFrame.cols == 0 || this->lastFrame.rows == 0) {
#if DEBUG_MODE
LIB_VISION_DPRINT("loadImageFromMemory --> loaded image is empty");
#endif
return;
}
this->lastFrame.copyTo(this->opFrame);
}
void LibVision::preprocessingFrameOTSU() {
#if DEBUG_MODE
LIB_VISION_DPRINT("preprocessingFrameOTSU");
#endif
if (this->lastFrame.cols == 0 || this->lastFrame.rows == 0) {
#if DEBUG_MODE
LIB_VISION_DPRINT("preprocessingFrameOTSU -> lastFrame is empty");
#endif
return;
}
if (lbParams->otsuThresh < 0 || lbParams->otsuThresh > 255) {
lbParams->otsuThresh = DEFAULT_OTSU_THRESH;
#if DEBUG_MODE
LIB_VISION_DPRINT("preprocessingFrameOTSU -> otsu thresh set to default");
#endif
}
cv::cvtColor(this->lastFrame, this->lastGrayFrame, CV_RGBA2GRAY);
cv::threshold(lastGrayFrame, lastThrFrame, lbParams->otsuThresh, 255,
CV_THRESH_BINARY_INV && CV_THRESH_OTSU);
}
void LibVision::preprocessingFrameADPT() {
#if DEBUG_MODE
LIB_VISION_DPRINT("preprocessingFrameADPT");
#endif
if (this->lastFrame.cols == 0 || this->lastFrame.rows == 0) {
#if DEBUG_MODE
LIB_VISION_DPRINT("preprocessingFrameADPT -> lastFrame is empty");
#endif
return;
}
if (lbParams->adptThreshSize < 3) {
lbParams->adptThreshSize = DEFAULT_ADPT_SIZE;
#if DEBUG_MODE
LIB_VISION_DPRINT("preprocessingFrameADPT -> adpt size set to default");
#endif
}
cv::cvtColor(this->lastFrame, this->lastGrayFrame, CV_RGBA2GRAY);
cv::adaptiveThreshold(lastGrayFrame, lastThrFrame, 255,
CV_ADAPTIVE_THRESH_MEAN_C, CV_THRESH_BINARY_INV,
lbParams->adptThreshSize, lbParams->adptThreshMean);
}
void LibVision::setCurrentBackground() {
if (this->lastFrame.rows == 0 || this->lastFrame.cols == 0) {
#if DEBUG_MODE
LIB_VISION_DPRINT("setCurrentBackground -> lastFrame is empty");
#endif
return;
}
cv::cvtColor(this->lastFrame, this->backgroundFrame, CV_RGBA2GRAY);
}
void LibVision::subtractBackground() {
if (this->backgroundFrame.rows == 0 || this->backgroundFrame.cols == 0) {
#if DEBUG_MODE
LIB_VISION_DPRINT("subtractBackground -> backgroundFrame is empty");
#endif
return;
}
cv::Mat currentLastFrameGray;
cv::cvtColor(this->lastFrame, currentLastFrameGray, CV_RGBA2GRAY);
cv::bitwise_xor(currentLastFrameGray, this->backgroundFrame, opFrame);
#if DEBUG_WITH_IMAGES
showImageForDebug(opFrame);
#endif
}
std::vector<std::vector<cv::Point> >
LibVision::findContours(int minContourPointsAllowed) {
static std::vector<std::vector<cv::Point> > allContours;
std::vector<std::vector<cv::Point> > contours;
allContours.reserve(2000);
if (lastThrFrame.rows == 0 || lastThrFrame.cols == 0) {
#if DEBUG_MODE
LIB_VISION_DPRINT(
"no threshold frame, call preprocessingFrame_* --> return empty");
#endif
return contours;
}
cv::Mat thrFrameCopy;
lastThrFrame.copyTo(thrFrameCopy);
cv::findContours(thrFrameCopy, allContours, CV_RETR_LIST,
CV_CHAIN_APPROX_NONE);
contours.clear();
for (int i = 0; i < allContours.size(); i++) {
if (allContours[i].size() > minContourPointsAllowed)
contours.push_back(allContours[i]);
}
allContours.clear();
return contours;
}
std::vector<std::vector<cv::Point> >
LibVision::findCandidates(std::vector<std::vector<cv::Point> > contours,
uint vertexCount) {
static std::vector<cv::Point> approxCurve;
std::vector<std::vector<cv::Point> > candidates;
for (int i = 0; i < contours.size(); i++) {
if (vertexCount == 1000) {
// Circles
cv::approxPolyDP(contours[i], approxCurve, 3, true);
if (approxCurve.size() > 8) {
candidates.push_back(approxCurve);
}
} else {
// Others
cv::approxPolyDP(contours[i], approxCurve,
cv::arcLength(cv::Mat(contours[i]), true) * 0.02, true);
if (approxCurve.size() == vertexCount &&
cv::isContourConvex(approxCurve)) {
if (verifyDistance(approxCurve[0], approxCurve[2])) {
candidates.push_back(approxCurve);
}
}
}
approxCurve.clear();
}
return candidates;
}
inline bool LibVision::verifyDistance(cv::Point p_o, cv::Point p_t) {
const int min_dist = 30; // DEF
float dx = p_o.x - p_t.x;
float dy = p_o.y - p_t.y;
float dist = sqrtf(powf(dx, 2) + powf(dy, 2));
if (dist > min_dist) {
return true;
}
return false;
}
inline void LibVision::sortVertices(std::vector<cv::Point> &approxCurve) {
std::vector<cv::Point> approxCurveBuffer;
cv::Point v1 = approxCurve[1] - approxCurve[0];
cv::Point v2 = approxCurve[2] - approxCurve[0];
double o = (v1.x * v2.y) - (v1.y * v2.x);
if (o < 0.0) {
std::swap(approxCurve[1], approxCurve[3]);
}
}
void LibVision::detectSquares() {
#if DEBUG_MODE
LIB_VISION_DPRINT("detectSquares");
#endif
this->candidates = this->findCandidates(this->findContours(100), 4);
#if DEBUG_WITH_IMAGES
this->drawCandidates(this->candidates);
#endif
}
void LibVision::detectCircles() {
#if DEBUG_MODE
LIB_VISION_DPRINT("detectCircles");
#endif
this->candidates = this->findCandidates(this->findContours(1), 1000);
#if DEBUG_WITH_IMAGES
this->drawCandidates(this->candidates);
#endif
}
void LibVision::detectPenta() {
#if DEBUG_MODE
LIB_VISION_DPRINT("detectPentagons");
#endif
this->candidates = this->findCandidates(this->findContours(100), 5);
#if DEBUG_WITH_IMAGES
this->drawCandidates(this->candidates);
#endif
}
void LibVision::detectExa() {
#if DEBUG_MODE
LIB_VISION_DPRINT("detectExagons");
#endif
this->candidates = this->findCandidates(this->findContours(100), 6);
#if DEBUG_WITH_IMAGES
this->drawCandidates(this->candidates);
#endif
}
void LibVision::checkSquarePatterns() {
#if DEBUG_MODE
LIB_VISION_DPRINT("checkSquaresPatterns");
#endif
if (candidates.size() == 0) {
#if DEBUG_MODE
LIB_VISION_DPRINT("no candidates, call detectSquares --> exit");
#endif
return;
}
if (lbParams->patternImagePath == NULL) {
#if DEBUG_MODE
LIB_VISION_DPRINT("patternImagePath is NULL --> exit");
#endif
return;
}
cv::Mat patternImage =
cv::imread(std::string(lbParams->patternImagePath), CV_LOAD_IMAGE_COLOR);
if (patternImage.rows == 0 || patternImage.cols == 0) {
#if DEBUG_MODE
LIB_VISION_DPRINT("impossible to load pattern image --> exit");
#endif
return;
}
std::vector<std::vector<cv::Point> > newCandidates;
for (int i = 0; i < this->candidates.size(); i++) {
if (this->candidates[i].size() != 4) {
continue;
}
cv::Mat warpThRoi = this->thresholdAfterWarp(
this->getWarpPerspective(lastFrame, candidates[i]));
int r = 0;
int idM = calcCorrelationCoefficient(warpThRoi, patternImage, &r);
if (idM == 1) {
// Pattern found
newCandidates.push_back(this->candidates[i]);
#if DEBUG_WITH_IMAGES
showImageForDebug(warpThRoi, 3000);
#endif
#if DEBUG_MODE
std::cout << "LibVision::patternFound N --> " << i << std::endl;
#endif
}
}
this->candidates = newCandidates;
}
void LibVision::saveCandidates() {
#if DEBUG_MODE
LIB_VISION_DPRINT("saveCandidates");
#endif
// Calc new current lbParams Polygons size
int newSize = lbParams->polygonsFounds + (int)this->candidates.size();
// Alloc new size
if (lbParams->polygonsFounds == 0) {
lbParams->polygons = (Polygon *)malloc(newSize * sizeof(Polygon));
} else {
lbParams->polygons =
(Polygon *)realloc(lbParams->polygons, newSize * sizeof(Polygon));
}
if (lbParams->polygons == NULL) {
free(lbParams->polygons);
}
// Save new data
for (int i = 0; i < (int)this->candidates.size(); i++) {
int numberOfPointsOfNewPoly = (int)this->candidates[i].size();
lbParams->polygons[i + lbParams->polygonsFounds].polyPoints =
(ScreenPoint *)malloc(numberOfPointsOfNewPoly * sizeof(ScreenPoint));
if (lbParams->polygons[i + lbParams->polygonsFounds].polyPoints == NULL) {
free(lbParams->polygons[i + lbParams->polygonsFounds].polyPoints);
}
lbParams->polygons[i + lbParams->polygonsFounds].numberOfPoints =
numberOfPointsOfNewPoly;
for (int j = 0; j < numberOfPointsOfNewPoly; j++) {
lbParams->polygons[i + lbParams->polygonsFounds].polyPoints[j].x =
this->candidates[i][j].x;
lbParams->polygons[i + lbParams->polygonsFounds].polyPoints[j].y =
this->candidates[i][j].y;
}
}
// Save new state
lbParams->polygonsFounds = newSize;
}
void LibVision::clearCandidates() {
#if DEBUG_MODE
LIB_VISION_DPRINT("clearCandidates");
#endif
for (int i = 0; i < lbParams->polygonsFounds; i++) {
free(lbParams->polygons[i].polyPoints);
}
if (lbParams->polygonsFounds == 0) {
return;
}
free(lbParams->polygons);
lbParams->polygonsFounds = 0;
}
void LibVision::drawCandidates(std::vector<std::vector<cv::Point> > candidates) {
cv::Mat temp;
if (this->lastFrame.rows == 0 || this->lastFrame.cols == 0) {
return;
}
this->lastFrame.copyTo(temp);
for (int i = 0; i < candidates.size(); i++) {
for (int j = 0; j < candidates[i].size() - 1; j++) {
cv::line(temp, candidates[i][j], candidates[i][j + 1],
cv::Scalar(0, 0, 255), 2);
}
cv::line(temp, candidates[i][candidates[i].size() - 1], candidates[i][0],
cv::Scalar(0, 0, 255), 2);
}
temp.copyTo(opFrame);
#if DEBUG_WITH_IMAGES
showImageForDebug(temp);
#endif
}
void LibVision::checkColor() {
std::vector<std::vector<cv::Point> > newCandidates;
cv::Scalar minCol =
cv::Scalar(lbParams->colorRange[0], lbParams->colorRange[1],
lbParams->colorRange[2]);
cv::Scalar maxCol =
cv::Scalar(lbParams->colorRange[3], lbParams->colorRange[4],
lbParams->colorRange[5]);
std::cout << "DEBUG COLOR RANGE: " << minCol << " " << maxCol << std::endl;
for (size_t i = 0; i < this->candidates.size(); i++) {
if (checkColorForRegion(candidates[i], minCol, maxCol)) {
newCandidates.push_back(candidates[i]);
}
}
this->candidates = newCandidates;
}
bool LibVision::checkColorForRegion(std::vector<cv::Point> candidate,
cv::Scalar minColor, cv::Scalar maxColor) {
unsigned int colors[3];
unsigned int *c = colors;
cv::Mat frameWithColor;
cv::Point pMaxR;
cv::Mat channels[3];
cv::Mat subframe;
if (!computeSubRect(candidate, subframe)) {
return false;
}
if (subframe.cols == 0 || subframe.rows == 0) {
return false;
}
cv::inRange(subframe, minColor, maxColor, frameWithColor);
cv::split(frameWithColor, channels);
cv::minMaxLoc(channels[0], NULL, NULL, NULL, &pMaxR);
cv::Vec3b intensity = frameWithColor.at<cv::Vec3b>(pMaxR.y, pMaxR.x);
*(c) = static_cast<int>(intensity.val[0]);
*(c + 1) = static_cast<int>(intensity.val[1]);
*(c + 2) = static_cast<int>(intensity.val[2]);
if (*(c) == 255 && *(c + 1) == 255 && *(c + 2) == 255) {
#if DEBUG_WITH_IMAGES
showImageForDebug(subframe, 500);
#endif
return true;
}
return false;
}
bool LibVision::computeSubRect(std::vector<cv::Point> candidate, cv::Mat &roi) {
const float _SIDE_PLUS = 0;
const float _SIDE_PLUS_2 = 0;
const float _MIN_X = _SIDE_PLUS;
const float _MAX_X = lastFrame.cols - _SIDE_PLUS;
const float _MIN_Y = _SIDE_PLUS;
const float _MAX_Y = lastFrame.rows - _SIDE_PLUS;
int xMin = 0, xMax = 0, yMin = 0, yMax = 0;
float x_corners[candidate.size()];
float y_corners[candidate.size()];
for (size_t c = 0; c < candidate.size(); c++) {
x_corners[c] = candidate[c].x;
y_corners[c] = candidate[c].y;
}
std::qsort(y_corners, 4, sizeof(int), LibVision::compare);
std::qsort(x_corners, 4, sizeof(int), LibVision::compare);
xMin = x_corners[0] - _SIDE_PLUS_2;
xMax = x_corners[3] + _SIDE_PLUS_2;
yMin = y_corners[0] - _SIDE_PLUS_2;
yMax = y_corners[3] + _SIDE_PLUS_2;
if (xMin > _MIN_X && xMax < _MAX_X && yMin > _MIN_Y && yMax < _MAX_Y) {
if (xMax < xMin || yMax < yMin) {
std::cout << "Error in subrect" << std::endl;
return false;
}
cv::Mat roiD = lastFrame(cv::Rect(xMin, yMin, xMax - xMin, yMax - yMin));
roiD.copyTo(roi);
return true;
}
return false;
}
cv::Mat LibVision::getWarpPerspective(cv::Mat roi,
std::vector<cv::Point> candidate) {
cv::Point2f pointsRes[4], pointsIn[4];
for (int j = 0; j < 4; j++) {
pointsIn[j] = candidate[j];
}
int warpSize = 56;
pointsRes[0] = cv::Point2f(0, 0);
pointsRes[1] = cv::Point2f(warpSize - 1, 0);
pointsRes[2] = cv::Point2f(warpSize - 1, warpSize - 1);
pointsRes[3] = cv::Point2f(0, warpSize - 1);
cv::Mat prsxTrnsf = cv::getPerspectiveTransform(pointsIn, pointsRes);
cv::Mat warpRoi;
cv::warpPerspective(roi, warpRoi, prsxTrnsf, cv::Size(warpSize, warpSize));
return warpRoi;
}
cv::Mat LibVision::thresholdAfterWarp(cv::Mat roi) {
cv::Mat patternCandidatesRoiThresh;
cv::threshold(roi, patternCandidatesRoiThresh, DEFAULT_OTSU_THRESH, 255,
CV_THRESH_BINARY_INV && CV_THRESH_OTSU);
cv::bitwise_not(patternCandidatesRoiThresh, patternCandidatesRoiThresh);
return patternCandidatesRoiThresh;
}
int LibVision::calcCorrelationCoefficient(cv::Mat src, cv::Mat img, int *rot) {
unsigned int j;
int i;
double tempsim;
int warpSize = 56;
double N = (double)(warpSize * warpSize / 4);
double nom, den;
float confThreshold = 0.9;
cv::Scalar mean_ext, std_ext, mean_int, std_int;
std::vector<cv::Mat> loadedPatterns;
int msize = warpSize;
cv::Mat src2(msize, msize, CV_8UC1);
cv::Point2f center((msize - 1) / 2.0f, (msize - 1) / 2.0f);
cv::Mat rot_mat(2, 3, CV_32F);
cv::resize(img, src2, cv::Size(msize, msize));
cv::Mat subImg = src2(cv::Range(msize / 4, 3 * msize / 4),
cv::Range(msize / 4, 3 * msize / 4));
loadedPatterns.push_back(subImg);
rot_mat = cv::getRotationMatrix2D(center, 90, 1.0);
for (int i = 1; i < 4; i++) {
cv::Mat dst = cv::Mat(msize, msize, CV_8UC1);
rot_mat = cv::getRotationMatrix2D(center, -i * 90, 1.0);
cv::warpAffine(src2, dst, rot_mat, cv::Size(msize, msize));
cv::Mat subImg = dst(cv::Range(msize / 4, 3 * msize / 4),
cv::Range(msize / 4, 3 * msize / 4));
loadedPatterns.push_back(subImg);
}
cv::Mat normROI = cv::Mat(warpSize, warpSize, CV_8UC1); // normalized ROI
// Masks for exterior(black) and interior area inside the pattern
cv::Mat patMask = cv::Mat::ones(warpSize, warpSize, CV_8UC1);
cv::Mat submat = patMask(cv::Range(warpSize / 4, 3 * warpSize / 4),
cv::Range(warpSize / 4, 3 * warpSize / 4));
cv::Mat patMaskInt = cv::Mat::zeros(warpSize, warpSize, CV_8UC1);
submat = patMaskInt(cv::Range(warpSize / 4, 3 * warpSize / 4),
cv::Range(warpSize / 4, 3 * warpSize / 4));
submat = cv::Scalar(1);
cv::meanStdDev(src, mean_ext, std_ext, patMask);
cv::meanStdDev(src, mean_int, std_int, patMaskInt);
if ((mean_ext.val[0] > mean_int.val[0]))
return -1;
cv::Mat inter = src(cv::Range(warpSize / 4, 3 * warpSize / 4),
cv::Range(warpSize / 4, 3 * warpSize / 4));
double normSrcSq = pow(norm(inter), 2);
int zero_mean_mode = 1;
float maxCor = -1.0;
// int index = 0;
int ori = 0;
for (j = 0; j < (loadedPatterns.size() / 4); j++) {
for (i = 0; i < 4; i++) {
double const nnn = pow(norm(loadedPatterns.at(j * 4 + i)), 2);
if (zero_mean_mode == 1) {
double const mmm = mean(loadedPatterns.at(j * 4 + i)).val[0];
nom = inter.dot(loadedPatterns.at(j * 4 + i)) -
(N * mean_int.val[0] * mmm);
den = sqrt((normSrcSq - (N * mean_int.val[0] * mean_int.val[0])) *
(nnn - (N * mmm * mmm)));
tempsim = nom / den;
} else {
tempsim =
inter.dot(loadedPatterns.at(j * 4 + i)) / (sqrt(normSrcSq * nnn));
}
if (tempsim > maxCor) {
maxCor = tempsim;
ori = i;
}
}
}
*rot = ori;
if (maxCor > confThreshold)
return 1;
else
return 0;
}
void LibVision::debugPrintPolys() {
printf("LibVision::polygonsFounds: %d \n", lbParams->polygonsFounds);
for (int i = 0; i < lbParams->polygonsFounds; i++) {
printf("-> Number of vertex: %d \n", lbParams->polygons[i].numberOfPoints);
for (int j = 0; j < lbParams->polygons[i].numberOfPoints; j++) {
printf("--> Polygon index: %d vertexIndex: %d \t x: %d \t y: %d \n", i,
j, lbParams->polygons[i].polyPoints[j].x,
lbParams->polygons[i].polyPoints[j].y);
}
printf("\n");
}
}
void LibVision::debugPrintMethods() {
LIB_VISION_DPRINT("list of available functions");
for (std::map<std::string, LibVisionFunction>::iterator it =
lbFunctions.begin();
it != lbFunctions.end(); ++it) {
std::cout << "--> " << it->first << "\n";
}
}
void LibVision::testInterface() { std::cout << "Test succesful" << std::endl; }
#endif
#pragma mark -
/*
____ ___ _ __
/ ___| |_ _|_ __ | |_ ___ _ __ / _| __ _ ___ ___
| | | || '_ \| __/ _ \ '__| |_ / _` |/ __/ _ \
| |___ | || | | | || __/ | | _| (_| | (_| __/
\____| |___|_| |_|\__\___|_| |_| \__,_|\___\___|
*/
#define LIB_VISION_CLASS(o) reinterpret_cast<LibVision *>(o)
CLibVision_ptr CLibVision_init() {
return reinterpret_cast<void *>(new LibVision());
}
void CLibVision_deinit(CLibVision_ptr rl) { delete LIB_VISION_CLASS(rl); }
void CLibVision_testInterface(CLibVision_ptr rl) {
LIB_VISION_CLASS(rl)->testInterface();
}
void CLibVision_requireOperations(CLibVision_ptr rl, char *operations[],
size_t size) {
LIB_VISION_CLASS(rl)->requireOperations(operations, size);
}
LibVisionParams *CLibVision_params(CLibVision_ptr rl) {
return LIB_VISION_CLASS(rl)->lbParams;
}
| 32.090909 | 81 | 0.646934 | [
"vector"
] |
d6673b02b57c7edbdf2c2b3545852218e5e4bd9c | 34,455 | cpp | C++ | Engine/Source/Runtime/OpenGLDrv/Private/OpenGLRenderTarget.cpp | PopCap/GameIdea | 201e1df50b2bc99afc079ce326aa0a44b178a391 | [
"BSD-2-Clause"
] | null | null | null | Engine/Source/Runtime/OpenGLDrv/Private/OpenGLRenderTarget.cpp | PopCap/GameIdea | 201e1df50b2bc99afc079ce326aa0a44b178a391 | [
"BSD-2-Clause"
] | 2 | 2015-06-21T17:38:11.000Z | 2015-06-22T20:54:42.000Z | Engine/Source/Runtime/OpenGLDrv/Private/OpenGLRenderTarget.cpp | PopCap/GameIdea | 201e1df50b2bc99afc079ce326aa0a44b178a391 | [
"BSD-2-Clause"
] | null | null | null | // Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
/*=============================================================================
OpenGLRenderTarget.cpp: OpenGL render target implementation.
=============================================================================*/
#include "OpenGLDrvPrivate.h"
#include "ScreenRendering.h"
// gDEBugger is currently very buggy. For example, it cannot show render buffers correctly and doesn't
// know what combined depth/stencil is. This define makes OpenGL render directly to textures and disables
// stencil. It results in broken post process effects, but allows to debug the rendering in gDEBugger.
//#define GDEBUGGER_MODE
#define ALL_SLICES uint32(0xffffffff)
/**
* Key used to map a set of unique render/depth stencil target combinations to
* a framebuffer resource
*/
class FOpenGLFramebufferKey
{
struct RenderTargetInfo
{
FOpenGLTextureBase* Texture;
GLuint Resource;
uint32 MipmapLevel;
uint32 ArrayIndex;
};
public:
FOpenGLFramebufferKey(
uint32 InNumRenderTargets,
FOpenGLTextureBase** InRenderTargets,
uint32* InRenderTargetArrayIndices,
uint32* InRenderTargetMipmapLevels,
FOpenGLTextureBase* InDepthStencilTarget,
EOpenGLCurrentContext InContext
)
: DepthStencilTarget(InDepthStencilTarget)
, Context(InContext)
{
uint32 RenderTargetIndex;
for( RenderTargetIndex = 0; RenderTargetIndex < InNumRenderTargets; ++RenderTargetIndex )
{
FMemory::Memzero(RenderTargets[RenderTargetIndex]); // since memcmp is used, we need to zero memory
RenderTargets[RenderTargetIndex].Texture = InRenderTargets[RenderTargetIndex];
RenderTargets[RenderTargetIndex].Resource = (InRenderTargets[RenderTargetIndex]) ? InRenderTargets[RenderTargetIndex]->Resource : 0;
RenderTargets[RenderTargetIndex].MipmapLevel = InRenderTargetMipmapLevels[RenderTargetIndex];
RenderTargets[RenderTargetIndex].ArrayIndex = (InRenderTargetArrayIndices == NULL || InRenderTargetArrayIndices[RenderTargetIndex] == -1) ? ALL_SLICES : InRenderTargetArrayIndices[RenderTargetIndex];
}
for( ; RenderTargetIndex < MaxSimultaneousRenderTargets; ++RenderTargetIndex )
{
FMemory::Memzero(RenderTargets[RenderTargetIndex]); // since memcmp is used, we need to zero memory
RenderTargets[RenderTargetIndex].ArrayIndex = ALL_SLICES;
}
}
/**
* Equality is based on render and depth stencil targets
* @param Other - instance to compare against
* @return true if equal
*/
friend bool operator ==(const FOpenGLFramebufferKey& A,const FOpenGLFramebufferKey& B)
{
return !FMemory::Memcmp(A.RenderTargets, B.RenderTargets, sizeof(A.RenderTargets) ) && A.DepthStencilTarget == B.DepthStencilTarget && A.Context == B.Context;
}
/**
* Get the hash for this type.
* @param Key - struct to hash
* @return uint32 hash based on type
*/
friend uint32 GetTypeHash(const FOpenGLFramebufferKey &Key)
{
return FCrc::MemCrc_DEPRECATED(Key.RenderTargets, sizeof(Key.RenderTargets)) ^ GetTypeHash(Key.DepthStencilTarget) ^ GetTypeHash(Key.Context);
}
const FOpenGLTextureBase* GetRenderTarget( int32 Index ) const { return RenderTargets[Index].Texture; }
const FOpenGLTextureBase* GetDepthStencilTarget( void ) const { return DepthStencilTarget; }
private:
RenderTargetInfo RenderTargets[MaxSimultaneousRenderTargets];
FOpenGLTextureBase* DepthStencilTarget;
EOpenGLCurrentContext Context;
};
typedef TMap<FOpenGLFramebufferKey,GLuint> FOpenGLFramebufferCache;
/** Lazily initialized framebuffer cache singleton. */
static FOpenGLFramebufferCache& GetOpenGLFramebufferCache()
{
static FOpenGLFramebufferCache OpenGLFramebufferCache;
return OpenGLFramebufferCache;
}
GLuint FOpenGLDynamicRHI::GetOpenGLFramebuffer(uint32 NumSimultaneousRenderTargets, FOpenGLTextureBase** RenderTargets, uint32* ArrayIndices, uint32* MipmapLevels, FOpenGLTextureBase* DepthStencilTarget )
{
VERIFY_GL_SCOPE();
check( NumSimultaneousRenderTargets <= MaxSimultaneousRenderTargets );
uint32 FramebufferRet = GetOpenGLFramebufferCache().FindRef(FOpenGLFramebufferKey(NumSimultaneousRenderTargets, RenderTargets, ArrayIndices, MipmapLevels, DepthStencilTarget, PlatformOpenGLCurrentContext(PlatformDevice)));
if( FramebufferRet > 0 )
{
// Found and is valid. We never store zero as a result, increasing all results by 1 to avoid range overlap.
return FramebufferRet-1;
}
// Check for rendering to screen back buffer.
if(0 < NumSimultaneousRenderTargets && RenderTargets[0] && RenderTargets[0]->Resource == GL_NONE)
{
// Use the default framebuffer (screen back/depth buffer)
return GL_NONE;
}
#if PLATFORM_ANDROID
static const auto CVarMobileOnChipMSAA = IConsoleManager::Get().FindTConsoleVariableDataInt(TEXT("r.MobileOnChipMSAA"));
#endif
// Not found. Preparing new one.
GLuint Framebuffer;
glGenFramebuffers(1, &Framebuffer);
VERIFY_GL(glGenFramebuffer)
glBindFramebuffer(GL_FRAMEBUFFER, Framebuffer);
VERIFY_GL(glBindFramebuffer)
int32 FirstNonzeroRenderTarget = -1;
for( int32 RenderTargetIndex = NumSimultaneousRenderTargets - 1; RenderTargetIndex >= 0 ; --RenderTargetIndex )
{
FOpenGLTextureBase* RenderTarget = RenderTargets[RenderTargetIndex];
if (!RenderTarget)
{
continue;
}
if (ArrayIndices == NULL || ArrayIndices[RenderTargetIndex] == -1)
{
// If no index was specified, bind the entire object, rather than a slice
switch( RenderTarget->Target )
{
case GL_TEXTURE_2D:
case GL_TEXTURE_2D_MULTISAMPLE:
#if PLATFORM_ANDROID
if (FOpenGL::SupportsMultisampledRenderToTexture() && CVarMobileOnChipMSAA->GetValueOnRenderThread())
{
glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + RenderTargetIndex, RenderTarget->Target, RenderTarget->Resource, MipmapLevels[RenderTargetIndex], 2);
VERIFY_GL(glFramebufferTexture2DMultisampleEXT);
}
else
#endif
{
FOpenGL::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + RenderTargetIndex, RenderTarget->Target, RenderTarget->Resource, MipmapLevels[RenderTargetIndex]);
}
break;
case GL_TEXTURE_3D:
case GL_TEXTURE_2D_ARRAY:
case GL_TEXTURE_CUBE_MAP:
case GL_TEXTURE_CUBE_MAP_ARRAY:
FOpenGL::FramebufferTexture(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + RenderTargetIndex, RenderTarget->Resource, MipmapLevels[RenderTargetIndex]);
break;
default:
FOpenGL::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + RenderTargetIndex, GL_RENDERBUFFER, RenderTarget->Resource);
break;
}
}
else
{
// Bind just one slice of the object
switch( RenderTarget->Target )
{
case GL_TEXTURE_2D:
case GL_TEXTURE_2D_MULTISAMPLE:
check( ArrayIndices[RenderTargetIndex] == 0);
#if PLATFORM_ANDROID
if (FOpenGL::SupportsMultisampledRenderToTexture() && CVarMobileOnChipMSAA->GetValueOnRenderThread())
{
glFramebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + RenderTargetIndex, RenderTarget->Target, RenderTarget->Resource, MipmapLevels[RenderTargetIndex], 2);
VERIFY_GL(glFramebufferTexture2DMultisampleEXT);
}
else
#endif
{
FOpenGL::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + RenderTargetIndex, RenderTarget->Target, RenderTarget->Resource, MipmapLevels[RenderTargetIndex]);
}
break;
case GL_TEXTURE_3D:
FOpenGL::FramebufferTexture3D(GL_FRAMEBUFFER,GL_COLOR_ATTACHMENT0 + RenderTargetIndex, RenderTarget->Target, RenderTarget->Resource, MipmapLevels[RenderTargetIndex], ArrayIndices[RenderTargetIndex]);
break;
case GL_TEXTURE_CUBE_MAP:
check( ArrayIndices[RenderTargetIndex] < 6);
FOpenGL::FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + RenderTargetIndex, GL_TEXTURE_CUBE_MAP_POSITIVE_X + ArrayIndices[RenderTargetIndex], RenderTarget->Resource, MipmapLevels[RenderTargetIndex]);
break;
case GL_TEXTURE_2D_ARRAY:
case GL_TEXTURE_CUBE_MAP_ARRAY:
FOpenGL::FramebufferTextureLayer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + RenderTargetIndex, RenderTarget->Resource, MipmapLevels[RenderTargetIndex], ArrayIndices[RenderTargetIndex]);
break;
default:
check( ArrayIndices[RenderTargetIndex] == 0);
FOpenGL::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + RenderTargetIndex, GL_RENDERBUFFER, RenderTarget->Resource);
break;
}
}
FirstNonzeroRenderTarget = RenderTargetIndex;
}
if (DepthStencilTarget)
{
switch( DepthStencilTarget->Target )
{
case GL_TEXTURE_2D:
case GL_TEXTURE_2D_MULTISAMPLE:
#if PLATFORM_ANDROID
if (FOpenGL::SupportsMultisampledRenderToTexture() && CVarMobileOnChipMSAA->GetValueOnRenderThread())
{
FOpenGLTexture2D* DepthStencilTarget2D = (FOpenGLTexture2D*)DepthStencilTarget;
GLuint DepthBuffer;
glGenRenderbuffers(1, &DepthBuffer);
glBindRenderbuffer(GL_RENDERBUFFER, DepthBuffer);
glRenderbufferStorageMultisampleEXT(GL_RENDERBUFFER, 2, FOpenGL::SupportsPackedDepthStencil() ? GL_DEPTH24_STENCIL8 : GL_DEPTH_COMPONENT24, DepthStencilTarget2D->GetSizeX(), DepthStencilTarget2D->GetSizeY());
VERIFY_GL(glRenderbufferStorageMultisampleEXT);
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DepthBuffer);
VERIFY_GL(glFramebufferRenderbuffer);
}
else
#endif
{
if (!FOpenGL::SupportsCombinedDepthStencilAttachment() && DepthStencilTarget->Attachment == GL_DEPTH_STENCIL_ATTACHMENT)
{
FOpenGL::FramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, DepthStencilTarget->Target, DepthStencilTarget->Resource, 0);
FOpenGL::FramebufferTexture2D(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, DepthStencilTarget->Target, DepthStencilTarget->Resource, 0);
}
else
{
FOpenGL::FramebufferTexture2D(GL_FRAMEBUFFER, DepthStencilTarget->Attachment, DepthStencilTarget->Target, DepthStencilTarget->Resource, 0);
}
}
break;
case GL_TEXTURE_3D:
case GL_TEXTURE_2D_ARRAY:
case GL_TEXTURE_CUBE_MAP:
case GL_TEXTURE_CUBE_MAP_ARRAY:
FOpenGL::FramebufferTexture(GL_FRAMEBUFFER, DepthStencilTarget->Attachment, DepthStencilTarget->Resource, 0);
break;
default:
if (!FOpenGL::SupportsCombinedDepthStencilAttachment() && DepthStencilTarget->Attachment == GL_DEPTH_STENCIL_ATTACHMENT)
{
FOpenGL::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERBUFFER, DepthStencilTarget->Resource);
FOpenGL::FramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERBUFFER, DepthStencilTarget->Resource);
}
else
{
FOpenGL::FramebufferRenderbuffer(GL_FRAMEBUFFER, DepthStencilTarget->Attachment, GL_RENDERBUFFER, DepthStencilTarget->Resource);
}
break;
}
}
if (FirstNonzeroRenderTarget != -1)
{
FOpenGL::ReadBuffer(GL_COLOR_ATTACHMENT0 + FirstNonzeroRenderTarget);
FOpenGL::DrawBuffer(GL_COLOR_ATTACHMENT0 + FirstNonzeroRenderTarget);
}
else
{
FOpenGL::ReadBuffer(GL_NONE);
FOpenGL::DrawBuffer(GL_NONE);
}
// End frame can bind NULL / NULL
// An FBO with no attachments is framebuffer incomplete (INCOMPLETE_MISSING_ATTACHMENT)
// In this case just delete the FBO and map in the default
// In GL 4.x, NULL/NULL is valid and can be done =by specifying a default width/height
if ( FirstNonzeroRenderTarget == -1 && !DepthStencilTarget )
{
glDeleteFramebuffers( 1, &Framebuffer);
Framebuffer = 0;
glBindFramebuffer(GL_FRAMEBUFFER, Framebuffer);
}
FOpenGL::CheckFrameBuffer();
GetOpenGLFramebufferCache().Add(FOpenGLFramebufferKey(NumSimultaneousRenderTargets, RenderTargets, ArrayIndices, MipmapLevels, DepthStencilTarget, PlatformOpenGLCurrentContext(PlatformDevice)), Framebuffer+1);
return Framebuffer;
}
void ReleaseOpenGLFramebuffers(FOpenGLDynamicRHI* Device, FTextureRHIParamRef TextureRHI)
{
VERIFY_GL_SCOPE();
FOpenGLTextureBase* Texture = GetOpenGLTextureFromRHITexture(TextureRHI);
if (Texture)
{
for (FOpenGLFramebufferCache::TIterator It(GetOpenGLFramebufferCache()); It; ++It)
{
bool bPurgeFramebuffer = false;
FOpenGLFramebufferKey Key = It.Key();
const FOpenGLTextureBase* DepthStencilTarget = Key.GetDepthStencilTarget();
if( DepthStencilTarget && DepthStencilTarget->Target == Texture->Target && DepthStencilTarget->Resource == Texture->Resource )
{
bPurgeFramebuffer = true;
}
else
{
for( uint32 RenderTargetIndex = 0; RenderTargetIndex < MaxSimultaneousRenderTargets; ++RenderTargetIndex )
{
const FOpenGLTextureBase* RenderTarget = Key.GetRenderTarget(RenderTargetIndex);
if( RenderTarget && RenderTarget->Target == Texture->Target && RenderTarget->Resource == Texture->Resource )
{
bPurgeFramebuffer = true;
break;
}
}
}
if( bPurgeFramebuffer )
{
GLuint FramebufferToDelete = It.Value()-1;
check(FramebufferToDelete > 0);
Device->PurgeFramebufferFromCaches( FramebufferToDelete );
glDeleteFramebuffers( 1, &FramebufferToDelete );
It.RemoveCurrent();
}
}
}
}
void FOpenGLDynamicRHI::PurgeFramebufferFromCaches( GLuint Framebuffer )
{
VERIFY_GL_SCOPE();
if( Framebuffer == PendingState.Framebuffer )
{
PendingState.Framebuffer = 0;
FMemory::Memset(PendingState.RenderTargets, 0, sizeof(PendingState.RenderTargets));
FMemory::Memset(PendingState.RenderTargetMipmapLevels, 0, sizeof(PendingState.RenderTargetMipmapLevels));
FMemory::Memset(PendingState.RenderTargetArrayIndex, 0, sizeof(PendingState.RenderTargetArrayIndex));
PendingState.DepthStencil = 0;
PendingState.bFramebufferSetupInvalid = true;
}
if( Framebuffer == SharedContextState.Framebuffer )
{
SharedContextState.Framebuffer = -1;
}
if( Framebuffer == RenderingContextState.Framebuffer )
{
RenderingContextState.Framebuffer = -1;
}
}
void FOpenGLDynamicRHI::RHICopyToResolveTarget(FTextureRHIParamRef SourceTextureRHI, FTextureRHIParamRef DestTextureRHI, bool bKeepOriginalSurface, const FResolveParams& ResolveParams)
{
if (!SourceTextureRHI || !DestTextureRHI)
{
// no need to do anything (silently ignored)
return;
}
FOpenGLTextureBase* SourceTexture = GetOpenGLTextureFromRHITexture(SourceTextureRHI);
FOpenGLTextureBase* DestTexture = GetOpenGLTextureFromRHITexture(DestTextureRHI);
if (SourceTexture != DestTexture && FOpenGL::SupportsBlitFramebuffer())
{
VERIFY_GL_SCOPE();
check(GMaxRHIFeatureLevel >= ERHIFeatureLevel::SM5 || ResolveParams.SourceArrayIndex == 0);
check(GMaxRHIFeatureLevel >= ERHIFeatureLevel::SM5 || ResolveParams.DestArrayIndex == 0);
const bool bSrcCubemap = SourceTextureRHI->GetTextureCube() != NULL;
const bool bDestCubemap = DestTextureRHI->GetTextureCube() != NULL;
uint32 DestIndex = ResolveParams.DestArrayIndex * (bDestCubemap ? 6 : 1) + (bDestCubemap ? uint32(ResolveParams.CubeFace) : 0);
uint32 SrcIndex = ResolveParams.SourceArrayIndex * (bSrcCubemap ? 6 : 1) + (bSrcCubemap ? uint32(ResolveParams.CubeFace) : 0);
uint32 BaseX = 0;
uint32 BaseY = 0;
uint32 SizeX = 0;
uint32 SizeY = 0;
if (ResolveParams.Rect.IsValid())
{
BaseX = ResolveParams.Rect.X1;
BaseY = ResolveParams.Rect.Y1;
SizeX = ResolveParams.Rect.X2 - ResolveParams.Rect.X1;
SizeY = ResolveParams.Rect.Y2 - ResolveParams.Rect.Y1;
}
else
{
// Invalid rect mans that the entire source is to be copied
SizeX = GetOpenGLTextureSizeXFromRHITexture(SourceTextureRHI);
SizeY = GetOpenGLTextureSizeYFromRHITexture(SourceTextureRHI);
SizeX = FMath::Max<uint32>(1, SizeX >> ResolveParams.MipIndex);
SizeY = FMath::Max<uint32>(1, SizeY >> ResolveParams.MipIndex);
}
GPUProfilingData.RegisterGPUWork();
uint32 MipmapLevel = ResolveParams.MipIndex;
const bool bTrueBlit = !SourceTextureRHI->IsMultisampled()
&& !DestTextureRHI->IsMultisampled()
&& SourceTextureRHI->GetFormat() == DestTextureRHI->GetFormat();
if ( !bTrueBlit || !FOpenGL::SupportsCopyImage() )
{
// Color buffers can be GL_NONE for attachment purposes if they aren't used as render targets
const bool bIsColorBuffer = SourceTexture->Attachment != GL_DEPTH_STENCIL_ATTACHMENT
&& SourceTexture->Attachment != GL_DEPTH_ATTACHMENT;
check( bIsColorBuffer || (SrcIndex == 0 && DestIndex == 0));
check( bIsColorBuffer || MipmapLevel == 0);
GLuint SrcFramebuffer = bIsColorBuffer ?
GetOpenGLFramebuffer(1, &SourceTexture, &SrcIndex, &MipmapLevel, NULL) :
GetOpenGLFramebuffer(0, NULL, NULL, NULL, SourceTexture);
GLuint DestFramebuffer = bIsColorBuffer ?
GetOpenGLFramebuffer(1, &DestTexture, &DestIndex, &MipmapLevel, NULL) :
GetOpenGLFramebuffer(0, NULL, NULL, NULL, DestTexture);
glBindFramebuffer(UGL_DRAW_FRAMEBUFFER, DestFramebuffer);
FOpenGL::DrawBuffer(bIsColorBuffer ? GL_COLOR_ATTACHMENT0 : GL_NONE);
glBindFramebuffer(UGL_READ_FRAMEBUFFER, SrcFramebuffer);
FOpenGL::ReadBuffer(bIsColorBuffer ? GL_COLOR_ATTACHMENT0 : GL_NONE);
// ToDo - Scissor and possibly color mask can impact blits
// These should be disabled
GLbitfield Mask = GL_NONE;
if (bIsColorBuffer)
{
Mask = GL_COLOR_BUFFER_BIT;
}
else if (SourceTexture->Attachment == GL_DEPTH_ATTACHMENT)
{
Mask = GL_DEPTH_BUFFER_BIT;
}
else
{
Mask = GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT;
}
FOpenGL::BlitFramebuffer(
BaseX, BaseY, BaseX + SizeX, BaseY + SizeY,
BaseX, BaseY, BaseX + SizeX, BaseY + SizeY,
Mask,
GL_NEAREST
);
}
else
{
// CopyImageSubData seems like a better analog to what UE wants in most cases
// It has no interactions with any other state, and there is no filtering/conversion
// It does not support MSAA resolves though
FOpenGL::CopyImageSubData( SourceTexture->Resource,
SourceTexture->Target,
MipmapLevel,
BaseX,
BaseY,
SrcIndex,
DestTexture->Resource,
DestTexture->Target,
MipmapLevel,
BaseX,
BaseY,
DestIndex,
SizeX,
SizeY,
1);
}
REPORT_GL_FRAMEBUFFER_BLIT_EVENT( Mask );
// For CPU readback resolve targets we should issue the resolve to the internal PBO immediately.
// This makes any subsequent locking of that texture much cheaper as it won't have to stall on a pixel pack op.
bool bLockableTarget = DestTextureRHI->GetTexture2D() && (DestTextureRHI->GetFlags() & TexCreate_CPUReadback) && !(DestTextureRHI->GetFlags() & (TexCreate_RenderTargetable|TexCreate_DepthStencilTargetable));
if(bTrueBlit && bLockableTarget && FOpenGL::SupportsPixelBuffers() && !ResolveParams.Rect.IsValid())
{
FOpenGLTexture2D* DestTex = (FOpenGLTexture2D*)DestTexture;
DestTex->Resolve(MipmapLevel, DestIndex);
}
GetContextStateForCurrentContext().Framebuffer = (GLuint)-1;
}
else
{
// no need to do anything (silently ignored)
}
}
void FOpenGLDynamicRHI::ReadSurfaceDataRaw(FOpenGLContextState& ContextState, FTextureRHIParamRef TextureRHI,FIntRect Rect,TArray<uint8>& OutData, FReadSurfaceDataFlags InFlags)
{
VERIFY_GL_SCOPE();
FOpenGLTexture2D* Texture2D = (FOpenGLTexture2D*)TextureRHI->GetTexture2D();
if( !Texture2D )
{
return; // just like in D3D11
}
FOpenGLTextureBase* Texture = (FOpenGLTextureBase*)Texture2D;
GLuint FramebufferToDelete = 0;
GLuint RenderbufferToDelete = 0;
const FOpenGLTextureFormat& GLFormat = GOpenGLTextureFormats[TextureRHI->GetFormat()];
bool bFloatFormat = false;
bool bUnsupportedFormat = false;
bool bDepthFormat = false;
bool bDepthStencilFormat = false;
switch( TextureRHI->GetFormat() )
{
case PF_DepthStencil:
bDepthStencilFormat = true;
// pass-through
case PF_ShadowDepth:
case PF_D24:
bDepthFormat = true;
break;
case PF_A32B32G32R32F:
case PF_FloatRGBA:
case PF_FloatRGB:
case PF_R32_FLOAT:
case PF_G16R16F:
case PF_G16R16F_FILTER:
case PF_G32R32F:
case PF_R16F:
case PF_R16F_FILTER:
case PF_FloatR11G11B10:
bFloatFormat = true;
break;
case PF_DXT1:
case PF_DXT3:
case PF_DXT5:
case PF_UYVY:
case PF_BC5:
case PF_PVRTC2:
case PF_PVRTC4:
case PF_ATC_RGB:
case PF_ATC_RGBA_E:
case PF_ATC_RGBA_I:
bUnsupportedFormat = true;
break;
default: // the rest is assumed to be integer formats with one or more of ARG and B components in OpenGL
break;
}
if( bUnsupportedFormat )
{
#if UE_BUILD_DEBUG
check(0);
#endif
return;
}
check( !bDepthFormat || FOpenGL::SupportsDepthStencilReadSurface() );
check( !bFloatFormat || FOpenGL::SupportsFloatReadSurface() );
const GLenum Attachment = bDepthFormat ? (FOpenGL::SupportsPackedDepthStencil() && bDepthStencilFormat ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT) : GL_COLOR_ATTACHMENT0;
const bool bIsColorBuffer = Texture->Attachment == GL_COLOR_ATTACHMENT0;
uint32 MipmapLevel = 0;
GLuint SourceFramebuffer = bIsColorBuffer ? GetOpenGLFramebuffer(1, &Texture, NULL, &MipmapLevel, NULL) : GetOpenGLFramebuffer(0, NULL, NULL, NULL, Texture);
if (TextureRHI->IsMultisampled())
{
// OpenGL doesn't allow to read pixels from multisample framebuffers, we need a single sample copy
glGenFramebuffers(1, &FramebufferToDelete);
glBindFramebuffer(GL_FRAMEBUFFER, FramebufferToDelete);
GLuint Renderbuffer = 0;
glGenRenderbuffers(1, &RenderbufferToDelete);
glBindRenderbuffer(GL_RENDERBUFFER, RenderbufferToDelete);
glRenderbufferStorage(GL_RENDERBUFFER, GLFormat.InternalFormat[false], Texture2D->GetSizeX(), Texture2D->GetSizeY());
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, Attachment, GL_RENDERBUFFER, RenderbufferToDelete);
FOpenGL::CheckFrameBuffer();
glBindFramebuffer(UGL_READ_FRAMEBUFFER, SourceFramebuffer);
FOpenGL::BlitFramebuffer(
0, 0, Texture2D->GetSizeX(), Texture2D->GetSizeY(),
0, 0, Texture2D->GetSizeX(), Texture2D->GetSizeY(),
(bDepthFormat ? (bDepthStencilFormat ? (GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT) : GL_DEPTH_BUFFER_BIT) : GL_COLOR_BUFFER_BIT),
GL_NEAREST
);
SourceFramebuffer = FramebufferToDelete;
}
uint32 SizeX = Rect.Width();
uint32 SizeY = Rect.Height();
OutData.Empty( SizeX * SizeY * sizeof(FColor) );
uint8* TargetBuffer = (uint8*)&OutData[OutData.AddUninitialized(SizeX * SizeY * sizeof(FColor))];
glBindFramebuffer(UGL_READ_FRAMEBUFFER, SourceFramebuffer);
FOpenGL::ReadBuffer( (!bDepthFormat && !bDepthStencilFormat && !SourceFramebuffer) ? GL_BACK : Attachment);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
if( bDepthFormat )
{
// Get the depth as luminosity, with non-transparent alpha.
// If depth values are between 0 and 1, keep them, otherwise rescale them linearly so they fit within 0-1 range
int32 DepthValueCount = SizeX * SizeY;
int32 FloatDepthDataSize = sizeof(float) * DepthValueCount;
float* FloatDepthData = (float*)FMemory::Malloc( FloatDepthDataSize );
glReadPixels(Rect.Min.X, Rect.Min.Y, SizeX, SizeY, GL_DEPTH_COMPONENT, GL_FLOAT, FloatDepthData );
// Determine minimal and maximal float value present in received data
float MinValue = FLT_MAX;
float MaxValue = FLT_MIN;
float* DataPtr = FloatDepthData;
for( int32 DepthValueIndex = 0; DepthValueIndex < DepthValueCount; ++DepthValueIndex, ++DataPtr )
{
if( *DataPtr < MinValue )
{
MinValue = *DataPtr;
}
if( *DataPtr > MaxValue )
{
MaxValue = *DataPtr;
}
}
// If necessary, rescale the data.
if( ( MinValue < 0.f ) || ( MaxValue > 1.f ) )
{
DataPtr = FloatDepthData;
float RescaleFactor = MaxValue - MinValue;
for( int32 DepthValueIndex = 0; DepthValueIndex < DepthValueCount; ++DepthValueIndex, ++DataPtr )
{
*DataPtr = ( *DataPtr - MinValue ) / RescaleFactor;
}
}
// Convert the data into rgba8 buffer
DataPtr = FloatDepthData;
uint8* TargetPtr = TargetBuffer;
for( int32 DepthValueIndex = 0; DepthValueIndex < DepthValueCount; ++DepthValueIndex )
{
uint8 Value = (uint8)( *DataPtr++ * 255.0f );
*TargetPtr++ = Value;
*TargetPtr++ = Value;
*TargetPtr++ = Value;
*TargetPtr++ = 255;
}
FMemory::Free( FloatDepthData );
}
else if( bFloatFormat )
{
bool bLinearToGamma = InFlags.GetLinearToGamma();
// Determine minimal and maximal float value present in received data. Treat alpha separately.
int32 PixelComponentCount = 4 * SizeX * SizeY;
int32 FloatBGRADataSize = sizeof(float) * PixelComponentCount;
float* FloatBGRAData = (float*)FMemory::Malloc( FloatBGRADataSize );
if ( FOpenGL::SupportsBGRA8888() )
{
glReadPixels(Rect.Min.X, Rect.Min.Y, SizeX, SizeY, GL_BGRA, GL_FLOAT, FloatBGRAData );
}
else
{
glReadPixels(Rect.Min.X, Rect.Min.Y, SizeX, SizeY, GL_RGBA, GL_FLOAT, FloatBGRAData );
}
// Determine minimal and maximal float values present in received data. Treat each component separately.
float MinValue[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
float MaxValue[4] = { 1.0f, 1.0f, 1.0f, 1.0f };
float* DataPtr = FloatBGRAData;
for( int32 PixelComponentIndex = 0; PixelComponentIndex < PixelComponentCount; ++PixelComponentIndex, ++DataPtr )
{
int32 ComponentIndex = PixelComponentIndex % 4;
MinValue[ComponentIndex] = FMath::Min<float>(*DataPtr,MinValue[ComponentIndex]);
MaxValue[ComponentIndex] = FMath::Max<float>(*DataPtr,MaxValue[ComponentIndex]);
}
// Convert the data into BGRA8 buffer
DataPtr = FloatBGRAData;
uint8* TargetPtr = TargetBuffer;
float RescaleFactor[4] = { MaxValue[0] - MinValue[0], MaxValue[1] - MinValue[1], MaxValue[2] - MinValue[2], MaxValue[3] - MinValue[3] };
for( int32 PixelIndex = 0; PixelIndex < PixelComponentCount / 4; ++PixelIndex )
{
float R = (DataPtr[2] - MinValue[2]) / RescaleFactor[2];
float G = (DataPtr[1] - MinValue[1]) / RescaleFactor[1];
float B = (DataPtr[0] - MinValue[0]) / RescaleFactor[0];
float A = (DataPtr[3] - MinValue[3]) / RescaleFactor[3];
if ( !FOpenGL::SupportsBGRA8888() )
{
Swap<float>( R,B );
}
FColor NormalizedColor = FLinearColor( R,G,B,A ).ToFColor(bLinearToGamma);
FMemory::Memcpy(TargetPtr,&NormalizedColor,sizeof(FColor));
DataPtr += 4;
TargetPtr += 4;
}
FMemory::Free( FloatBGRAData );
}
#if PLATFORM_ANDROID
else
{
// OpenGL ES is limited in what it can do with ReadPixels
int32 PixelComponentCount = 4 * SizeX * SizeY;
int32 RGBADataSize = sizeof(GLubyte)* PixelComponentCount;
GLubyte* RGBAData = (GLubyte*)FMemory::Malloc(RGBADataSize);
glReadPixels(Rect.Min.X, Rect.Min.Y, SizeX, SizeY, GL_RGBA, GL_UNSIGNED_BYTE, RGBAData);
GLubyte* DataPtr = RGBAData;
uint8* TargetPtr = TargetBuffer;
for (int32 PixelIndex = 0; PixelIndex < PixelComponentCount / 4; ++PixelIndex)
{
TargetPtr[0] = DataPtr[2];
TargetPtr[1] = DataPtr[1];
TargetPtr[2] = DataPtr[0];
TargetPtr[3] = DataPtr[3];
DataPtr += 4;
TargetPtr += 4;
}
FMemory::Free(RGBAData);
}
#else
else
{
// It's a simple int format. OpenGL converts them internally to what we want.
glReadPixels(Rect.Min.X, Rect.Min.Y, SizeX, SizeY, GL_BGRA, UGL_ABGR8, TargetBuffer );
// @to-do HTML5.
}
#endif
glPixelStorei(GL_PACK_ALIGNMENT, 4);
if( FramebufferToDelete )
{
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glDeleteFramebuffers( 1, &FramebufferToDelete );
}
if( RenderbufferToDelete )
{
glDeleteRenderbuffers( 1, &RenderbufferToDelete );
}
ContextState.Framebuffer = (GLuint)-1;
}
void FOpenGLDynamicRHI::RHIReadSurfaceData(FTextureRHIParamRef TextureRHI,FIntRect Rect,TArray<FColor>& OutData, FReadSurfaceDataFlags InFlags)
{
TArray<uint8> Temp;
FOpenGLContextState& ContextState = GetContextStateForCurrentContext();
ReadSurfaceDataRaw(ContextState, TextureRHI, Rect, Temp, InFlags);
uint32 Size = Rect.Width() * Rect.Height();
OutData.Empty();
OutData.AddUninitialized(Size);
FMemory::Memcpy(OutData.GetData(), Temp.GetData(), Size * sizeof(FColor));
}
void FOpenGLDynamicRHI::RHIMapStagingSurface(FTextureRHIParamRef TextureRHI,void*& OutData,int32& OutWidth,int32& OutHeight)
{
VERIFY_GL_SCOPE();
FOpenGLTexture2D* Texture2D = (FOpenGLTexture2D*)TextureRHI->GetTexture2D();
check(Texture2D);
check(Texture2D->IsStaging());
OutWidth = Texture2D->GetSizeX();
OutHeight = Texture2D->GetSizeY();
uint32 Stride = 0;
OutData = Texture2D->Lock( 0, 0, RLM_ReadOnly, Stride );
}
void FOpenGLDynamicRHI::RHIUnmapStagingSurface(FTextureRHIParamRef TextureRHI)
{
VERIFY_GL_SCOPE();
FOpenGLTexture2D* Texture2D = (FOpenGLTexture2D*)TextureRHI->GetTexture2D();
check(Texture2D);
Texture2D->Unlock( 0, 0 );
}
void FOpenGLDynamicRHI::RHIReadSurfaceFloatData(FTextureRHIParamRef TextureRHI,FIntRect Rect,TArray<FFloat16Color>& OutData,ECubeFace CubeFace,int32 ArrayIndex,int32 MipIndex)
{
VERIFY_GL_SCOPE();
//reading from arrays only supported on SM5 and up.
check(FOpenGL::SupportsFloatReadSurface() && (ArrayIndex == 0 || GMaxRHIFeatureLevel >= ERHIFeatureLevel::SM5));
FOpenGLTextureBase* Texture = GetOpenGLTextureFromRHITexture(TextureRHI);
check(TextureRHI->GetFormat() == PF_FloatRGBA);
uint32 MipmapLevel = MipIndex;
// Temp FBO is introduced to prevent a ballooning of FBO objects, which can have a detrimental
// impact on object management performance in the driver, only for CubeMapArray presently
// as it is the target that really drives FBO permutations
const bool bTempFBO = Texture->Target == GL_TEXTURE_CUBE_MAP_ARRAY;
uint32 Index = uint32(CubeFace) + ( (Texture->Target == GL_TEXTURE_CUBE_MAP_ARRAY) ? 6 : 1) * ArrayIndex;
GLuint SourceFramebuffer = 0;
if (bTempFBO)
{
glGenFramebuffers( 1, &SourceFramebuffer);
glBindFramebuffer(UGL_READ_FRAMEBUFFER, SourceFramebuffer);
FOpenGL::FramebufferTextureLayer(UGL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, Texture->Resource, MipmapLevel, Index);
}
else
{
SourceFramebuffer = GetOpenGLFramebuffer(1, &Texture, &Index, &MipmapLevel, NULL);
}
uint32 SizeX = Rect.Width();
uint32 SizeY = Rect.Height();
OutData.Empty(SizeX * SizeY);
OutData.AddUninitialized(SizeX * SizeY);
glBindFramebuffer(UGL_READ_FRAMEBUFFER, SourceFramebuffer);
FOpenGL::ReadBuffer(SourceFramebuffer == 0 ? GL_BACK : GL_COLOR_ATTACHMENT0);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
if (FOpenGL::GetReadHalfFloatPixelsEnum() == GL_FLOAT)
{
// Slow path: Some Adreno devices won't work with HALF_FLOAT ReadPixels
TArray<FLinearColor> FloatData;
// 4 float components per texel (RGBA)
FloatData.AddUninitialized(SizeX * SizeY);
FMemory::Memzero(FloatData.GetData(),SizeX * SizeY*sizeof(FLinearColor));
glReadPixels(Rect.Min.X, Rect.Min.Y, SizeX, SizeY, GL_RGBA, GL_FLOAT, FloatData.GetData());
FLinearColor* FloatDataPtr = FloatData.GetData();
for (uint32 DataIndex = 0; DataIndex < SizeX * SizeY; ++DataIndex, ++FloatDataPtr)
{
OutData[DataIndex] = FFloat16Color(*FloatDataPtr);
}
}
else
{
glReadPixels(Rect.Min.X, Rect.Min.Y, SizeX, SizeY, GL_RGBA, FOpenGL::GetReadHalfFloatPixelsEnum(), OutData.GetData());
}
glPixelStorei(GL_PACK_ALIGNMENT, 4);
if (bTempFBO)
{
glDeleteFramebuffers( 1, &SourceFramebuffer);
}
GetContextStateForCurrentContext().Framebuffer = (GLuint)-1;
}
void FOpenGLDynamicRHI::RHIRead3DSurfaceFloatData(FTextureRHIParamRef TextureRHI,FIntRect Rect,FIntPoint ZMinMax,TArray<FFloat16Color>& OutData)
{
VERIFY_GL_SCOPE();
check( FOpenGL::SupportsFloatReadSurface() );
check( FOpenGL::SupportsTexture3D() );
check( TextureRHI->GetFormat() == PF_FloatRGBA );
FRHITexture3D* Texture3DRHI = TextureRHI->GetTexture3D();
FOpenGLTextureBase* Texture = GetOpenGLTextureFromRHITexture(TextureRHI);
uint32 SizeX = Rect.Width();
uint32 SizeY = Rect.Height();
uint32 SizeZ = ZMinMax.Y - ZMinMax.X;
// Allocate the output buffer.
OutData.Empty(SizeX * SizeY * SizeZ * sizeof(FFloat16Color));
OutData.AddZeroed(SizeX * SizeY * SizeZ);
// Set up the source as a temporary FBO
uint32 MipmapLevel = 0;
uint32 Index = 0;
GLuint SourceFramebuffer = 0;
glGenFramebuffers( 1, &SourceFramebuffer);
glBindFramebuffer(UGL_READ_FRAMEBUFFER, SourceFramebuffer);
// Set up the destination as a temporary texture
GLuint TempTexture = 0;
FOpenGL::GenTextures(1, &TempTexture);
glActiveTexture( GL_TEXTURE0 );
glBindTexture( GL_TEXTURE_3D, TempTexture );
FOpenGL::TexImage3D( GL_TEXTURE_3D, 0, GL_RGBA16F, SizeX, SizeY, SizeZ, 0, GL_RGBA, GL_HALF_FLOAT, NULL );
// Copy the pixels within the specified region, minimizing the amount of data that needs to be transferred from GPU to CPU memory
for ( uint32 Z=0; Z < SizeZ; ++Z )
{
FOpenGL::FramebufferTextureLayer(UGL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, Texture->Resource, MipmapLevel, ZMinMax.X + Z);
FOpenGL::ReadBuffer(SourceFramebuffer == 0 ? GL_BACK : GL_COLOR_ATTACHMENT0);
FOpenGL::CopyTexSubImage3D( GL_TEXTURE_3D, 0, 0, 0, Z, Rect.Min.X, Rect.Min.Y, SizeX, SizeY );
}
// Grab the raw data from the temp texture.
glPixelStorei( GL_PACK_ALIGNMENT, 1 );
FOpenGL::GetTexImage( GL_TEXTURE_3D, 0, GL_RGBA, GL_HALF_FLOAT, OutData.GetData() );
glPixelStorei( GL_PACK_ALIGNMENT, 4 );
// Clean up
FOpenGLContextState& ContextState = GetContextStateForCurrentContext();
auto& TextureState = ContextState.Textures[0];
glBindTexture(GL_TEXTURE_3D, (TextureState.Target == GL_TEXTURE_3D) ? TextureState.Resource : 0);
glActiveTexture( GL_TEXTURE0 + ContextState.ActiveTexture );
glDeleteFramebuffers( 1, &SourceFramebuffer);
FOpenGL::DeleteTextures( 1, &TempTexture );
ContextState.Framebuffer = (GLuint)-1;
}
void FOpenGLDynamicRHI::BindPendingFramebuffer( FOpenGLContextState& ContextState )
{
VERIFY_GL_SCOPE();
check((GMaxRHIFeatureLevel >= ERHIFeatureLevel::SM5) || !PendingState.bFramebufferSetupInvalid);
if (ContextState.Framebuffer != PendingState.Framebuffer)
{
if (PendingState.Framebuffer)
{
glBindFramebuffer(GL_FRAMEBUFFER, PendingState.Framebuffer);
if ( FOpenGL::SupportsMultipleRenderTargets() )
{
FOpenGL::ReadBuffer( PendingState.FirstNonzeroRenderTarget >= 0 ? GL_COLOR_ATTACHMENT0 + PendingState.FirstNonzeroRenderTarget : GL_NONE);
GLenum DrawFramebuffers[MaxSimultaneousRenderTargets];
for (int32 RenderTargetIndex = 0; RenderTargetIndex < MaxSimultaneousRenderTargets; ++RenderTargetIndex)
{
DrawFramebuffers[RenderTargetIndex] = PendingState.RenderTargets[RenderTargetIndex] ? GL_COLOR_ATTACHMENT0 + RenderTargetIndex : GL_NONE;
}
FOpenGL::DrawBuffers( MaxSimultaneousRenderTargets, DrawFramebuffers );
}
}
else
{
glBindFramebuffer(GL_FRAMEBUFFER, 0);
FOpenGL::ReadBuffer(GL_BACK);
FOpenGL::DrawBuffer(GL_BACK);
}
ContextState.Framebuffer = PendingState.Framebuffer;
}
}
| 35.778816 | 223 | 0.750544 | [
"render",
"object"
] |
6996b61b36e83594225011cfc11cd406c6aff117 | 499 | cpp | C++ | src/LibKyra/Expressions/CallExpr.cpp | LukasPietzschmann/Slanguage | c00cc4712e24a201ab5ce55659d1ce38a3d8df41 | [
"MIT"
] | 7 | 2021-08-16T07:18:47.000Z | 2021-09-28T08:03:00.000Z | src/LibKyra/Expressions/CallExpr.cpp | LukasPietzschmann/Slanguage | c00cc4712e24a201ab5ce55659d1ce38a3d8df41 | [
"MIT"
] | null | null | null | src/LibKyra/Expressions/CallExpr.cpp | LukasPietzschmann/Slanguage | c00cc4712e24a201ab5ce55659d1ce38a3d8df41 | [
"MIT"
] | null | null | null | #include "CallExpr.hpp"
namespace Kyra {
CallExpr::CallExpr(const Position& position, const Expression::Ptr& function, std::vector<Expression::Ptr> arguments) :
Expression(position), m_function(function), m_arguments(std::move(arguments)) {}
void CallExpr::accept(ExpressionVisitor& visitor) { return visitor.visitCallExpr(*this); }
Expression::Ptr CallExpr::getFunction() const { return m_function; }
const std::vector<Expression::Ptr>& CallExpr::getArguments() const { return m_arguments; }
} | 41.583333 | 119 | 0.765531 | [
"vector"
] |
69a2685af646c940ec4f1b5239eb63e8824dc183 | 36,415 | cpp | C++ | ui/DebugDraw.cpp | dev-bz/DeepMimic4Droid | 413d7aeeb65aa762de5f5ab41e6228727f227c65 | [
"MIT"
] | 6 | 2018-12-29T01:02:02.000Z | 2021-05-10T17:58:08.000Z | ui/DebugDraw.cpp | dev-bz/DeepMimic4Droid | 413d7aeeb65aa762de5f5ab41e6228727f227c65 | [
"MIT"
] | 1 | 2018-12-29T01:00:09.000Z | 2020-02-22T09:55:57.000Z | ui/DebugDraw.cpp | dev-bz/DeepMimic4Droid | 413d7aeeb65aa762de5f5ab41e6228727f227c65 | [
"MIT"
] | null | null | null | /*
* Copyright (c) 2006-2013 Erin Catto http://www.box2d.org
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
* 3. This notice may not be removed or altered from any source distribution.
*/
#include "DebugDraw.h"
#if defined(__APPLE_CC__)
#include <OpenGL/gl3.h>
#else
//#include <glew/glew.h>
#include <GLES3/gl3.h>
#endif
//#include <glfw/glfw3.h>
//#include <glwk/glwk.h>
#include <stdarg.h>
#include <stdio.h>
#ifndef DEMO
#include <LinearMath/btVector3.h>
#include <assert.h>
#include <math.h>
#include <string.h>
#endif
#define glBindVertexArray(a) // glBindVertexArrayOES
#define glGenVertexArrays(a, b) // glGenVertexArraysOES
#define glDeleteVertexArrays(a, b) // glDeleteVertexArraysOES
#include "RenderGL3.h"
#define BUFFER_OFFSET(x) ((const void *)(x))
DebugDraw g_debugDraw;
Camera g_camera;
Camera s_camera;
#ifdef DEMO
btIDebugDraw *debugDraw = &g_debugDraw;
#endif
// int g_width, g_height;
float shadow[16] = {0.8, 0, 0.6, 0, -0.6, 0, 0.8, 0, 0, -1, 0, 0, 0, 0, 0, 1};
// float shadow[16] = {1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1};
// float world[16] = {-0.6, 0, -0.8, 0, 0, 1, 0, 0, 0.8, 0, -0.6, 0, 0, -5, 0,
// 1};
float world[16] = {1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, -1, -7, 1};
float proj[16] = {0.0f};
float shadow_proj[16] = {0.0f};
float m_time = 0;
float eye = 0.08;
float scale = 1.0f;
extern "C" void debugCreate(int w, int h) {
g_debugDraw.Create();
s_camera.m_width = 10;
s_camera.m_height = 10;
g_camera.m_width = w;
g_camera.m_height = h;
g_camera.vr = w > h;
const char *fontPath = "/system/fonts/DroidSansMono.ttf"; // VeraMono.ttf";
int test = 0;
if (RenderGLInit(fontPath, &test) == false) {
fprintf(stderr, "Could not init GUI renderer.\n");
assert(false);
}
}
extern "C" void debugDestroy() { g_debugDraw.Destroy(); }
extern "C" void debugFlush() {
g_debugDraw.Flush();
glEnable(GL_BLEND);
if (g_camera.vr)
RenderGLFlush(0, 0);
else
RenderGLFlush(g_camera.m_width, g_camera.m_height);
}
extern "C" void drawMesh(const float *m, const void *v, const void *n,
const void *i, int size, const btVector3 c);
extern "C" void debugTest() {
s_camera.BuildProjectionMatrix(shadow_proj, 0.2f);
g_camera.BuildProjectionMatrix(proj, 0.2f);
proj[0] /= scale;
proj[5] /= scale;
m_time += 0.0125;
// world[14] = sin(m_time) * 2.5 - 5;
shadow[14] = sin(m_time + 1.0) * 0.5 - 3.5; /*
const btVector3 from(0, -100, 0);
const btVector3 to(0, 100, 0);
const btVector3 color(1, 1, 1);
//g_debugDraw.drawLine(from, to, color);
*/
}
extern "C" void glPrintf(const char *fmt, const char *err);
//
static void sCheckGLError() {
GLenum errCode = glGetError();
if (errCode != GL_NO_ERROR) {
fprintf(stderr, "OpenGL error = %d\n", errCode);
// assert(false);
}
}
// Prints shader compilation errors
static void sPrintLog(GLuint object) {
GLint log_length = 0;
if (glIsShader(object)) {
GLint tmp = 0;
glGetShaderiv(object, GL_INFO_LOG_LENGTH, &log_length);
glGetShaderiv(object, GL_SHADER_SOURCE_LENGTH, &tmp);
if (log_length < tmp) log_length = tmp;
} else if (glIsProgram(object))
glGetProgramiv(object, GL_INFO_LOG_LENGTH, &log_length);
else {
glPrintf("%s", "printlog: Not a shader or a program\n");
return;
}
char *log = (char *)malloc(log_length);
if (glIsShader(object)) {
GLint tmp = 0;
glGetShaderSource(object, log_length, &tmp, log);
glPrintf("Source:\n%s", log);
glGetShaderInfoLog(object, log_length, NULL, log);
} else if (glIsProgram(object))
glGetProgramInfoLog(object, log_length, NULL, log);
glPrintf("Log:\n%s", log);
free(log);
}
void gPrintLog(GLuint object) {
GLint compile_ok = GL_FALSE;
glGetShaderiv(object, GL_COMPILE_STATUS, &compile_ok);
if (compile_ok == GL_FALSE) {
fprintf(stderr, "Error compiling shader!\n");
sPrintLog(object);
glDeleteShader(object);
}
}
//
static GLuint sCreateShaderFromString(const char *source, GLenum type) {
GLuint res = glCreateShader(type);
const char *sources[] = {source};
glShaderSource(res, 1, sources, NULL);
glCompileShader(res);
GLint compile_ok = GL_FALSE;
glGetShaderiv(res, GL_COMPILE_STATUS, &compile_ok);
if (compile_ok == GL_FALSE) {
fprintf(stderr, "Error compiling shader of type %d!\n", type);
sPrintLog(res);
glDeleteShader(res);
return 0;
}
return res;
}
//
static GLuint sCreateShaderProgram(const char *vs, const char *fs) {
GLuint vsId = sCreateShaderFromString(vs, GL_VERTEX_SHADER);
GLuint fsId = sCreateShaderFromString(fs, GL_FRAGMENT_SHADER);
assert(vsId != 0 && fsId != 0);
GLuint programId = glCreateProgram();
glAttachShader(programId, vsId);
glAttachShader(programId, fsId);
#ifndef __gl3_h_
if (glBindFragDataLocation) glBindFragDataLocation(programId, 0, "color");
#endif
glLinkProgram(programId);
glDeleteShader(vsId);
glDeleteShader(fsId);
GLint status = GL_FALSE;
glGetProgramiv(programId, GL_LINK_STATUS, &status);
assert(status != GL_FALSE);
return programId;
}
//
GLuint sCreateTargetTexture(int width, int height) {
GLuint texture;
glGenTextures(1, &texture);
glBindTexture(GL_TEXTURE_2D, texture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA16F, width, height, 0, GL_RGBA,
GL_FLOAT, 0);
#if 0
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
#else
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
#endif
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
return texture;
}
int sCreateFrameBuffer(int width, int height, int targetTextureId) {
GLuint framebuffer;
glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);
GLuint depthbuffer;
glGenRenderbuffers(1, &depthbuffer);
glBindRenderbuffer(GL_RENDERBUFFER, depthbuffer);
glRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH_COMPONENT16, width, height);
glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
GL_RENDERBUFFER, depthbuffer);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
targetTextureId, 0);
int status = glCheckFramebufferStatus(GL_FRAMEBUFFER);
if (status != GL_FRAMEBUFFER_COMPLETE) {
fprintf(stderr, "Framebuffer is not complete: %x", status);
}
glBindRenderbuffer(GL_RENDERBUFFER, 0);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
return framebuffer;
}
//
struct GLRenderPoints {
void Create() {
const char *vs =
"//#version 400\n"
"uniform mat4 projectionMatrix;\n"
"/*layout(location = 0) */attribute vec3 v_position;\n"
"/*layout(location = 1) */attribute vec4 v_color;\n"
"/*layout(location = 2) */attribute float v_size;\n"
"varying vec4 f_color;\n"
"void main(void)\n"
"{\n"
" f_color = v_color;\n"
" gl_Position = projectionMatrix * vec4(v_position, 1.0);\n"
" gl_PointSize = v_size;\n"
"}\n";
const char *fs = "//#version 400\n"
"varying vec4 f_color;\n"
"//out vec4 color;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = f_color;\n"
"}\n";
m_programId = sCreateShaderProgram(vs, fs);
m_projectionUniform = glGetUniformLocation(m_programId, "projectionMatrix");
#if 0
glBindAttribLocation(m_programId, 0, "v_position");
glBindAttribLocation(m_programId, 1, "v_color");
glBindAttribLocation(m_programId, 2, "v_size");
m_vertexAttribute = 0;
m_colorAttribute = 1;
m_sizeAttribute = 2;
#else
m_vertexAttribute = /*0;*/ glGetAttribLocation(m_programId, "v_position");
m_colorAttribute = /*1;*/ glGetAttribLocation(m_programId, "v_color");
m_sizeAttribute = /*2;*/ glGetAttribLocation(m_programId, "v_size");
#endif
// Generate
glGenVertexArrays(1, &m_vaoId);
glGenBuffers(3, m_vboIds);
glBindVertexArray(m_vaoId);
glEnableVertexAttribArray(m_vertexAttribute);
glEnableVertexAttribArray(m_colorAttribute);
glEnableVertexAttribArray(m_sizeAttribute);
// Vertex buffer
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[0]);
glVertexAttribPointer(m_vertexAttribute, 3, GL_FLOAT, GL_FALSE,
sizeof(btVector3), BUFFER_OFFSET(0));
glBufferData(GL_ARRAY_BUFFER, sizeof(m_vertices), m_vertices,
GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[1]);
glVertexAttribPointer(m_colorAttribute, 4, GL_FLOAT, GL_FALSE,
sizeof(btVector3), BUFFER_OFFSET(0));
glBufferData(GL_ARRAY_BUFFER, sizeof(m_colors), m_colors, GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[2]);
glVertexAttribPointer(m_sizeAttribute, 1, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(0));
glBufferData(GL_ARRAY_BUFFER, sizeof(m_sizes), m_sizes, GL_DYNAMIC_DRAW);
sCheckGLError();
// Cleanup
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
m_count = 0;
}
void Destroy() {
if (m_vaoId) {
glDeleteVertexArrays(1, &m_vaoId);
glDeleteBuffers(2, m_vboIds);
m_vaoId = 0;
}
if (m_programId) {
glDeleteProgram(m_programId);
m_programId = 0;
}
}
void Vertex(const btVector3 &v, const btVector3 &c, float size) {
if (m_count == e_maxVertices) Flush();
m_vertices[m_count] = v;
m_colors[m_count] = c;
m_sizes[m_count] = size;
++m_count;
}
void Flush() {
if (m_count == 0) return;
glUseProgram(m_programId);
glUniformMatrix4fv(m_projectionUniform, 1, GL_FALSE, proj);
glBindVertexArray(m_vaoId);
// glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[0]);
glBufferSubData(GL_ARRAY_BUFFER, 0, m_count * sizeof(btVector3),
m_vertices);
glVertexAttribPointer(m_vertexAttribute, 3, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[1]);
glBufferSubData(GL_ARRAY_BUFFER, 0, m_count * sizeof(btVector3), m_colors);
glVertexAttribPointer(m_colorAttribute, 4, GL_FLOAT, GL_FALSE, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[2]);
glBufferSubData(GL_ARRAY_BUFFER, 0, m_count * sizeof(float), m_sizes);
glVertexAttribPointer(m_sizeAttribute, 1, GL_FLOAT, GL_FALSE, 0, 0); /*
glEnableVertexAttribArray(m_vertexAttribute);
glEnableVertexAttribArray(m_colorAttribute);
glEnableVertexAttribArray(m_sizeAttribute);*/
#ifdef GL_PROGRAM_POINT_SIZE
glEnable(GL_PROGRAM_POINT_SIZE);
#endif
glDrawArrays(GL_POINTS, 0, m_count);
#ifdef GL_PROGRAM_POINT_SIZE
glDisable(GL_PROGRAM_POINT_SIZE);
#endif
sCheckGLError();
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
glUseProgram(0);
m_count = 0;
}
enum { e_maxVertices = 512 };
btVector3 m_vertices[e_maxVertices];
btVector3 m_colors[e_maxVertices];
float m_sizes[e_maxVertices];
int m_count;
GLuint m_vaoId;
GLuint m_vboIds[3];
GLuint m_programId;
GLint m_projectionUniform;
GLint m_vertexAttribute;
GLint m_colorAttribute;
GLint m_sizeAttribute;
};
//
struct GLRenderLines {
void Create() {
const char *vs = "//#version 400\n"
"uniform mat4 projectionMatrix;\n"
"uniform mat4 worldMatrix;\n"
"/*layout(location = 0) */attribute vec3 v_position;\n"
"/*layout(location = 1) */attribute vec4 v_color;\n"
"varying vec4 f_color;\n"
"void main(void)\n"
"{\n"
" f_color = vec4(v_color.rgb,1.0);\n"
" gl_Position = projectionMatrix * worldMatrix* "
"vec4(v_position, 1.0);\n"
"}\n";
const char *fs = "//#version 400\n"
"varying vec4 f_color;\n"
"//out vec4 color;\n"
"void main(void)\n"
"{\n"
" gl_FragColor = f_color;\n"
"}\n";
m_programId = sCreateShaderProgram(vs, fs);
m_projectionUniform = glGetUniformLocation(m_programId, "projectionMatrix");
m_worldUniform = glGetUniformLocation(m_programId, "worldMatrix");
#if 0
glBindAttribLocation(m_programId, 0, "v_position");
glBindAttribLocation(m_programId, 1, "v_color");
m_vertexAttribute = 0;
m_colorAttribute = 1;
#else
m_vertexAttribute = /*0;*/ glGetAttribLocation(m_programId, "v_position");
m_colorAttribute = /*1;*/ glGetAttribLocation(m_programId, "v_color");
#endif
// Generate
glGenVertexArrays(1, &m_vaoId);
glGenBuffers(2, m_vboIds);
glBindVertexArray(m_vaoId);
glEnableVertexAttribArray(m_vertexAttribute);
glEnableVertexAttribArray(m_colorAttribute);
// Vertex buffer
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[0]);
glVertexAttribPointer(m_vertexAttribute, 3, GL_FLOAT, GL_FALSE,
sizeof(btVector3), BUFFER_OFFSET(0));
glBufferData(GL_ARRAY_BUFFER, sizeof(m_vertices), m_vertices,
GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[1]);
glVertexAttribPointer(m_colorAttribute, 4, GL_FLOAT, GL_FALSE,
sizeof(btVector3), BUFFER_OFFSET(0));
glBufferData(GL_ARRAY_BUFFER, sizeof(m_colors), m_colors, GL_DYNAMIC_DRAW);
sCheckGLError();
// Cleanup
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
m_count = 0;
glFlush();
}
void Destroy() {
if (m_vaoId) {
glDeleteVertexArrays(1, &m_vaoId);
glDeleteBuffers(2, m_vboIds);
m_vaoId = 0;
}
if (m_programId) {
glDeleteProgram(m_programId);
m_programId = 0;
}
}
void Vertex(const btVector3 &v, const btVector3 &c) {
if (m_count == e_maxVertices) Flush();
m_vertices[m_count] = v;
m_colors[m_count] = c;
++m_count;
}
void Flush() {
if (m_count == 0) return;
glUseProgram(m_programId);
glUniformMatrix4fv(m_projectionUniform, 1, GL_FALSE, proj);
glBindVertexArray(m_vaoId);
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[0]);
glBufferSubData(GL_ARRAY_BUFFER, 0, m_count * sizeof(btVector3),
m_vertices);
glVertexAttribPointer(m_vertexAttribute, 3, GL_FLOAT, GL_FALSE,
sizeof(btVector3), 0);
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[1]);
glBufferSubData(GL_ARRAY_BUFFER, 0, m_count * sizeof(btVector3), m_colors);
glVertexAttribPointer(m_colorAttribute, 4, GL_FLOAT, GL_FALSE,
sizeof(btVector3), 0);
if (g_camera.vr) {
glViewport(0, 0, g_camera.m_width / 2, g_camera.m_height);
world[12] = eye;
glUniformMatrix4fv(m_worldUniform, 1, GL_FALSE, world);
glDrawArrays(GL_LINES, 0, m_count);
glViewport(g_camera.m_width / 2, 0, g_camera.m_width / 2,
g_camera.m_height);
world[12] = -eye;
}
{
glUniformMatrix4fv(m_worldUniform, 1, GL_FALSE, world);
glDrawArrays(GL_LINES, 0, m_count);
}
sCheckGLError();
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
glUseProgram(0);
m_count = 0;
}
enum { e_maxVertices = 2 * 512 };
btVector3 m_vertices[e_maxVertices];
btVector3 m_colors[e_maxVertices];
int m_count;
GLuint m_vaoId;
GLuint m_vboIds[2];
GLuint m_programId;
GLint m_projectionUniform, m_worldUniform;
GLint m_vertexAttribute;
GLint m_colorAttribute;
};
//
struct GLRenderTriangles {
void Create() {
const char *vs = "#version 310 es\n"
"uniform mat4 projectionMatrix;\n"
"uniform mat4 worldMatrix;\n"
"layout(location = 0) in vec3 vposition;\n"
"layout(location = 1) in vec4 vcolor;\n"
"out vec4 fcolor;\n"
"void main()\n"
"{\n"
" fcolor = vcolor;\n"
" gl_Position = projectionMatrix * worldMatrix * "
"vec4(vposition, 1.0);\n"
"}\n";
const char *fs = "#version 310 es\n"
"#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
"precision highp float;\n"
"#else\n"
"precision mediump float;\n"
"#endif\n"
"in vec4 fcolor;\n"
"out vec4 color;\n"
"void main()\n"
"{\n"
" color = fcolor;\n"
"}\n";
m_programId = sCreateShaderProgram(vs, fs);
m_projectionUniform = glGetUniformLocation(m_programId, "projectionMatrix");
m_worldUniform = glGetUniformLocation(m_programId, "worldMatrix");
#if 0
glBindAttribLocation(m_programId, 0, "v_position");
glBindAttribLocation(m_programId, 1, "v_color");
m_vertexAttribute = 0;
m_colorAttribute = 1;
#else
m_vertexAttribute = /*0;*/ glGetAttribLocation(m_programId, "vposition");
m_colorAttribute = /*1;*/ glGetAttribLocation(m_programId, "vcolor");
#endif
// Generate
glGenVertexArrays(1, &m_vaoId);
glGenBuffers(2, m_vboIds);
glBindVertexArray(m_vaoId);
glEnableVertexAttribArray(m_vertexAttribute);
glEnableVertexAttribArray(m_colorAttribute);
// Vertex buffer
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[0]);
glVertexAttribPointer(m_vertexAttribute, 3, GL_FLOAT, GL_FALSE,
sizeof(btVector3), BUFFER_OFFSET(0));
glBufferData(GL_ARRAY_BUFFER, sizeof(m_vertices), m_vertices,
GL_DYNAMIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[1]);
glVertexAttribPointer(m_colorAttribute, 4, GL_FLOAT, GL_FALSE,
sizeof(btVector3), BUFFER_OFFSET(0));
glBufferData(GL_ARRAY_BUFFER, sizeof(m_colors), m_colors, GL_DYNAMIC_DRAW);
sCheckGLError();
// Cleanup
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
m_count = 0;
}
void Destroy() {
if (m_vaoId) {
glDeleteVertexArrays(1, &m_vaoId);
glDeleteBuffers(2, m_vboIds);
m_vaoId = 0;
}
if (m_programId) {
glDeleteProgram(m_programId);
m_programId = 0;
}
}
void Vertex(const btVector3 &v, const btVector4 &c) {
if (m_count == e_maxVertices) Flush();
m_vertices[m_count] = v;
m_colors[m_count] = c;
++m_count;
}
void Flush() {
if (m_count == 0) return;
glUseProgram(m_programId);
glUniformMatrix4fv(m_projectionUniform, 1, GL_FALSE, proj);
glUniformMatrix4fv(m_worldUniform, 1, GL_FALSE, world);
glBindVertexArray(m_vaoId);
/*glEnableVertexAttribArray(m_vertexAttribute);
glEnableVertexAttribArray(m_colorAttribute);*/
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[0]);
glBufferSubData(GL_ARRAY_BUFFER, 0, m_count * sizeof(btVector3),
m_vertices);
glVertexAttribPointer(m_vertexAttribute, 3, GL_FLOAT, GL_FALSE,
sizeof(btVector3), 0);
glBindBuffer(GL_ARRAY_BUFFER, m_vboIds[1]);
glBufferSubData(GL_ARRAY_BUFFER, 0, m_count * sizeof(btVector3), m_colors);
glVertexAttribPointer(m_colorAttribute, 4, GL_FLOAT, GL_FALSE,
sizeof(btVector3), 0);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDrawArrays(GL_TRIANGLES, 0, m_count);
glDisable(GL_BLEND);
sCheckGLError();
glBindBuffer(GL_ARRAY_BUFFER, 0);
glBindVertexArray(0);
glUseProgram(0);
m_count = 0;
}
enum { e_maxVertices = 3 * 512 };
btVector3 m_vertices[e_maxVertices];
btVector4 m_colors[e_maxVertices];
int m_count;
GLuint m_vaoId;
GLuint m_vboIds[2];
GLuint m_programId;
GLint m_projectionUniform;
GLint m_worldUniform;
GLint m_vertexAttribute;
GLint m_colorAttribute;
};
// extern float rotate;
struct GLRenderObjects {
struct tMesh {
const void *vert;
const void *normal;
GLfloat color[4];
const void *index;
int size;
GLfloat mtx[16];
};
void Create() {
const GLchar *v2d = "#version 310 es\n"
"layout(location=0)in vec4 aPosition;\n"
"void main(){\n"
" gl_Position=vec4(aPosition.xyz*0.75,1.0);\n"
"}";
const GLchar *f2d = "#version 310 es\n"
"#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
"precision highp float;\n"
"#else\n"
"precision mediump float;\n"
"#endif\n"
"out vec4 fragColor;\n"
"uniform sampler2D t;\n"
"void main(){\n"
"fragColor=texture(t,gl_PointCoord*0.5+0.5);\n"
"}";
m_programId2d = sCreateShaderProgram(v2d, f2d);
if (!m_programId2d) return;
const char *s_vs =
"//#version 400\n"
"uniform mat4 projectionMatrix;\n"
"uniform mat4 modelMatrix;\n"
"uniform mat4 worldMatrix;\n"
"/*layout(location = 0) */attribute vec3 v_position;\n"
"varying float f_color;\n"
"void main(void){\n"
" vec4 p = worldMatrix* modelMatrix * vec4(v_position, 1.0);\n"
" f_color=p.z/p.w;\n"
" gl_Position = projectionMatrix *p;\n"
"}\n";
const char *s_fs = "//#version 400\n"
"varying float f_color;\n"
"void main(void){\n"
" gl_FragColor.z = f_color;\n"
"}\n";
s_programId = sCreateShaderProgram(s_vs, s_fs);
if (!s_programId) return;
s_projectionUniform = glGetUniformLocation(s_programId, "projectionMatrix");
s_modelUniform = glGetUniformLocation(s_programId, "modelMatrix");
s_worldUniform = glGetUniformLocation(s_programId, "worldMatrix");
#if 0
glBindAttribLocation(m_programId, 0, "v_position");
glBindAttribLocation(m_programId, 1, "v_color");
m_vertexAttribute = 0;
m_colorAttribute = 1;
#else
s_vertexAttribute = /*0;*/ glGetAttribLocation(s_programId, "v_position");
#endif
const char *vs = "#version 310 es\n"
"uniform mat4 projectionMatrix;\n"
"uniform mat4 projectionShadowMatrix;\n"
"uniform mat4 modelMatrix;\n"
"uniform mat4 worldMatrix;\n"
"uniform mat4 shadowMatrix;\n"
//"uniform float deep;\n"
"layout(location=0) in vec3 vposition;\n"
"layout(location=1) in vec3 vnormal;\n"
"layout(location=2) in vec4 vcolor;\n"
"out vec4 fposition;\n"
"out vec4 fcolor;\n"
"out vec3 fshadow;\n"
"out vec3 fnormal;\n"
"void main(){\n"
" fcolor = vcolor;\n"
" vec4 p= modelMatrix* vec4(vposition, 1.0);\n"
" fnormal= mat3(shadowMatrix* modelMatrix) * vnormal;\n"
" fshadow = vec3(shadowMatrix * p)/p.w+fnormal*0.075;\n"
" fposition = projectionShadowMatrix *shadowMatrix*p;\n"
" gl_Position = projectionMatrix *worldMatrix*p;\n"
"}\n";
#define BEST_SHADOW
const char *fs =
"#version 310 es\n"
"#ifdef GL_FRAGMENT_PRECISION_HIGH\n"
"precision highp float;\n"
"#else\n"
"precision mediump float;\n"
"#endif\n"
"in vec4 fposition;\n"
"in vec4 fcolor;\n"
"in vec3 fshadow;\n"
"in vec3 fnormal;\n"
"out vec4 oColor;\n"
"uniform sampler2D t;\n"
#ifdef BEST_SHADOW
"\
const vec2 coord[16]=vec2[16](\
vec2(-0.6474742,0.6028621),\
vec2( 0.0939157, 0.6783564 ),\
vec2( -0.3371512, 0.04865054 ),\
vec2( -0.4010732, 0.914994 ),\
vec2( -0.2793565, 0.4456959 ),\
vec2( -0.6683437, -0.1396244 ),\
vec2( -0.6369296, -0.6966243 ),\
vec2( -0.2684143, -0.3756073 ),\
vec2( 0.1146429, -0.8692533 ),\
vec2( 0.0697926, 0.01110036 ),\
vec2( 0.4677842, 0.5375957 ),\
vec2( 0.377133, -0.3518053 ),\
vec2( 0.6722369, 0.03702459 ),\
vec2( 0.6890426, -0.5889201 ),\
vec2( -0.8208677, 0.2444565 ),\
vec2( 0.8431721, 0.3903837 ));\n"
#endif
"void main(){\n"
" vec2 ss=(vec2(fposition)*0.5/fposition.w)+0.5;\n"
" float light=3.0/(2.0+dot(fshadow,fshadow*0.05));\n"
" vec3 dir=normalize(fshadow);\n"
" float dt=dot(dir,fnormal);\n"
" float lt=acos(dt)*0.35/3.14159;\n"
"if(ss.x>=0.0 && ss.x<=1.0 && ss.y>=0.0 && ss.y<=1.0){"
#ifdef BEST_SHADOW
"float theta=fract((dot(fshadow.xy,vec2(0.0,80.0)))*43.5453);\n"
"float sh=0.0;\n"
"theta=2.0*3.14159*theta-3.14159;\n"
"vec2 q=1.0-ss*2.0;float ct=pow(min(1.0,dot(q,q)),2.0);"
"for(int i=0;i<16;++i){\n"
" float co=cos(theta);float si=sin(theta);\n"
" vec2 "
"sss=vec2(coord[i].x*co-coord[i].y*si,coord[i].x*si+coord[i].y*co);\n"
" sh+=fshadow.z>texture(t, ss+sss*0.005).z?1.0:ct;\n"
"}\n"
"lt=sh*0.0625*max(0.0,-dt)*0.65+lt;//0.05882353;\n"
#else
" float s = texture(t,ss).z;\n"
" vec2 q=1.0-ss*2.0;float ct=pow(min(1.0,dot(q,q)),2.0);"
" lt=(s<fshadow.z?1.0:ct)*max(0.0,-dt)*0.65+lt;\n"
#endif
"}else lt=max(0.0,-dt)*0.65+lt;\n"
"oColor=lt*light*fcolor;\n"
"}\n";
m_programId = sCreateShaderProgram(vs, fs);
if (!m_programId) return;
m_projectionUniform = glGetUniformLocation(m_programId, "projectionMatrix");
m_projectionShadowUniform =
glGetUniformLocation(m_programId, "projectionShadowMatrix");
m_modelUniform = glGetUniformLocation(m_programId, "modelMatrix");
m_worldUniform = glGetUniformLocation(m_programId, "worldMatrix");
m_shadowUniform = glGetUniformLocation(m_programId, "shadowMatrix");
// m_deepUniform = glGetUniformLocation(m_programId, "deep");
#if 0
glBindAttribLocation(m_programId, 0, "v_position");
glBindAttribLocation(m_programId, 1, "v_color");
m_vertexAttribute = 0;
m_colorAttribute = 1;
#else
m_vertexAttribute = /*0;*/ glGetAttribLocation(m_programId, "vposition");
m_normalAttribute = /*1;*/ glGetAttribLocation(m_programId, "vnormal");
m_colorAttribute = /*2;*/ glGetAttribLocation(m_programId, "vcolor");
#endif
// Generate
sCheckGLError();
// Vertex buffer
mTargetTexture =
sCreateTargetTexture(mFramebufferWidth, mFramebufferHeight);
mFramebuffer = sCreateFrameBuffer(mFramebufferWidth, mFramebufferHeight,
mTargetTexture);
m_count = 0;
}
void Destroy() {
if (m_programId) {
glDeleteProgram(m_programId);
m_programId = 0;
}
}
void Vertex(const float *m, const void *v, const void *n, const void *i,
int size, const btVector3 &c) {
if (m_count == e_maxVertices) Flush();
auto &shape = m_vertices[m_count];
shape.vert = v;
shape.normal = n;
shape.index = i;
shape.size = size;
shape.color[0] = c.x();
shape.color[1] = c.y();
shape.color[2] = c.z();
shape.color[3] = 1.0f;
for (int i = 0; i < 16; ++i) shape.mtx[i] = m[i];
++m_count;
}
#define SHADOW 1
void Flush() {
if (m_count == 0) return;
glDisable(GL_BLEND);
#if 1
glUseProgram(s_programId);
// glBindVertexArray(0);
glUniformMatrix4fv(s_projectionUniform, 1, GL_FALSE, shadow_proj);
glUniformMatrix4fv(s_worldUniform, 1, GL_FALSE, shadow);
glEnableVertexAttribArray(s_vertexAttribute);
#if SHADOW
glBindFramebuffer(GL_FRAMEBUFFER, mFramebuffer);
glClearColor(0.5, 0.4, -1000.3, 1.0);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glViewport(0, 0, mFramebufferWidth, mFramebufferHeight);
#endif
for (int i = 0; i < m_count; ++i) {
auto &shape = m_vertices[i];
glUniformMatrix4fv(s_modelUniform, 1, GL_FALSE, m_vertices[i].mtx);
glVertexAttribPointer(s_vertexAttribute, 3, GL_FLOAT, GL_FALSE, 0,
shape.vert);
if (shape.index) {
glDrawElements(GL_TRIANGLES, shape.size, GL_UNSIGNED_SHORT,
shape.index);
} else {
glDrawArrays(GL_TRIANGLES, 0, shape.size);
}
}
#if SHADOW
glFlush();
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glClearColor(0.2, 0.3, 0.4, 1.0);
// glViewport(0, 0, g_camera.m_width, g_camera.m_height);
#endif
#endif
#if 1
glUseProgram(m_programId);
// glBindVertexArray(0);
glUniformMatrix4fv(m_projectionUniform, 1, GL_FALSE, proj);
glUniformMatrix4fv(m_projectionShadowUniform, 1, GL_FALSE, shadow_proj);
glUniformMatrix4fv(m_shadowUniform, 1, GL_FALSE, shadow);
// glUniform1f(m_deepUniform, rotate);
glEnableVertexAttribArray(m_vertexAttribute);
glEnableVertexAttribArray(m_normalAttribute);
glEnableVertexAttribArray(m_colorAttribute);
glVertexAttribDivisor(m_colorAttribute, 1);
glBindTexture(GL_TEXTURE_2D, mTargetTexture);
if (g_camera.vr) {
glViewport(0, 0, g_camera.m_width / 2, g_camera.m_height);
world[12] = eye;
glUniformMatrix4fv(m_worldUniform, 1, GL_FALSE, world);
for (int i = 0; i < m_count; ++i) {
auto &shape = m_vertices[i];
glUniformMatrix4fv(m_modelUniform, 1, GL_FALSE, m_vertices[i].mtx);
glVertexAttribPointer(m_vertexAttribute, 3, GL_FLOAT, GL_FALSE, 0,
shape.vert);
glVertexAttribPointer(m_normalAttribute, 3, GL_FLOAT, GL_FALSE, 0,
shape.normal);
glVertexAttribPointer(m_colorAttribute, 4, GL_FLOAT, GL_FALSE, 0,
shape.color);
if (shape.index) {
glDrawElements(GL_TRIANGLES, shape.size, GL_UNSIGNED_SHORT,
shape.index);
} else {
glDrawArrays(GL_TRIANGLES, 0, shape.size);
}
}
glViewport(g_camera.m_width / 2, 0, g_camera.m_width / 2,
g_camera.m_height);
world[12] = -eye;
} else
glViewport(0, 0, g_camera.m_width, g_camera.m_height);
{
glUniformMatrix4fv(m_worldUniform, 1, GL_FALSE, world);
for (int i = 0; i < m_count; ++i) {
auto &shape = m_vertices[i];
glUniformMatrix4fv(m_modelUniform, 1, GL_FALSE, m_vertices[i].mtx);
glVertexAttribPointer(m_vertexAttribute, 3, GL_FLOAT, GL_FALSE, 0,
shape.vert);
glVertexAttribPointer(m_normalAttribute, 3, GL_FLOAT, GL_FALSE, 0,
shape.normal);
glVertexAttribPointer(m_colorAttribute, 4, GL_FLOAT, GL_FALSE, 0,
shape.color);
if (shape.index) {
glDrawElements(GL_TRIANGLES, shape.size, GL_UNSIGNED_SHORT,
shape.index);
} else {
glDrawArrays(GL_TRIANGLES, 0, shape.size);
}
}
}
glVertexAttribDivisor(m_colorAttribute, 0);
#else
glUseProgram(m_programId2d);
glBindTexture(GL_TEXTURE_2D, mTargetTexture);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, plane);
glEnableVertexAttribArray(0);
glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
glBindTexture(GL_TEXTURE_2D, 0);
#endif
glUseProgram(0);
// glDisableVertexAttribArray(m_normalAttribute);
// glDisableVertexAttribArray(m_vertexAttribute);
m_count = 0;
}
enum { e_maxVertices = 3 * 512 };
tMesh m_vertices[e_maxVertices];
int m_count;
GLuint m_programId, s_programId, m_programId2d;
GLint m_projectionUniform, m_projectionShadowUniform, m_modelUniform,
m_worldUniform, m_shadowUniform;
GLuint m_deepUniform;
GLint s_projectionUniform, s_modelUniform, s_worldUniform;
GLint m_vertexAttribute, m_normalAttribute, m_colorAttribute;
GLint s_vertexAttribute;
int mFramebuffer;
int mFramebufferWidth = 512;
int mFramebufferHeight = 512;
GLuint mTargetTexture;
GLfloat plane[12] = {-1, 1, 0, 1, 1, 0, 1, -1, 0, -1, -1, 0};
};
//
DebugDraw::DebugDraw() {
m_points = NULL;
m_lines = NULL;
m_triangles = NULL;
m_objects = NULL;
}
//
DebugDraw::~DebugDraw() {}
//
void DebugDraw::Create() {
m_points = new GLRenderPoints;
m_points->Create();
m_lines = new GLRenderLines;
m_lines->Create();
m_triangles = new GLRenderTriangles;
m_triangles->Create();
m_objects = new GLRenderObjects;
m_objects->Create();
}
//
void DebugDraw::Destroy() {
m_points->Destroy();
delete m_points;
m_points = NULL;
m_lines->Destroy();
delete m_lines;
m_lines = NULL;
m_triangles->Destroy();
delete m_triangles;
m_triangles = NULL;
m_objects->Destroy();
delete m_objects;
m_objects = NULL;
}
#ifdef DEMO
void DebugDraw::drawLine(const btVector3 &from, const btVector3 &to,
const btVector3 &color) {
m_lines->Vertex(from, color);
m_lines->Vertex(to, color);
}
void DebugDraw::drawContactPoint(const btVector3 &PointOnB,
const btVector3 &normalOnB, btScalar distance,
int lifeTime, const btVector3 &color) {}
void DebugDraw::reportErrorWarning(const char *warningString) {}
void DebugDraw::draw3dText(const btVector3 &location, const char *textString) {}
void DebugDraw::setDebugMode(int debugMode) {}
int DebugDraw::getDebugMode() const {
return btIDebugDraw::DBG_DrawContactPoints | btIDebugDraw::DBG_DrawWireframe;
}
#endif
void DebugDraw::Flush() {
m_objects->Flush();
m_triangles->Flush();
m_lines->Flush();
m_points->Flush();
}
extern "C" void drawMesh(const float *m, const void *v, const void *n,
const void *i, int size, const btVector3 c) {
g_debugDraw.m_objects->Vertex(m, v, n, i, size, c);
}
extern "C" void drawTest() {
btVector4 c(1, 1, 1, 0.5);
g_debugDraw.m_triangles->Vertex(btVector3(1, 0, 0.1), c);
g_debugDraw.m_triangles->Vertex(btVector3(-1, 0, -0.1), c);
g_debugDraw.m_triangles->Vertex(btVector3(0, 3, 0), c);
g_debugDraw.m_triangles->Vertex(btVector3(-1, 0, -0.1), c);
g_debugDraw.m_triangles->Vertex(btVector3(1, 0, 0.1), c);
g_debugDraw.m_triangles->Vertex(btVector3(0, 3, 0), c);
}
extern "C" void drawLine(const float *m, const void *v, const void *n,
const int i, int size, const btVector3 c) {
const float *mm = (const float *)v;
for (int j = i + 51; j < size + i; ++j) {
int p = (j % size) * 3;
int pp = ((j + 1) % size) * 3;
g_debugDraw.m_lines->Vertex(btVector3(mm[p + 0], mm[p + 1], mm[p + 2]), c);
g_debugDraw.m_lines->Vertex(btVector3(mm[pp + 0], mm[pp + 1], mm[pp + 2]),
c);
}
// g_debugDraw.m_lines->Flush();
}
extern "C" void gluPerspectivef(GLfloat *m, GLfloat fovy, GLfloat aspect,
GLfloat zNear, GLfloat zFar);
void Camera::BuildProjectionMatrix(float *m, float zBias) {
if (vr)
gluPerspectivef(m, 40.00, m_width * 0.5f / m_height, zBias, zBias * 1000);
else
gluPerspectivef(m, 60.00, (float)m_width / m_height, zBias, zBias * 1000);
/*float w = float(m_width);
float h = float(m_height);
float ratio = w / h;
m[0] = 2.0f / (50*ratio);
m[1] = 0.0f;
m[2] = 0.0f;
m[3] = 0.0f;
m[4] = 0.0f;
m[5] = 2.0f / (50);
m[6] = 0.0f;
m[7] = 0.0f;
m[8] = 0.0f;
m[9] = 0.0f;
m[10] = 1.0f;
m[11] = 0.0f;
m[12] = 0;
m[13] = 0;
m[14] = zBias;
m[15] = 1.0f;*/
} | 36.59799 | 80 | 0.632459 | [
"object",
"shape"
] |
69a50c3f46c070bde760ff62b0544e0a5ac5b97f | 7,401 | hpp | C++ | src/utility/logger.hpp | mnewhouse/tselements | bd1c6724018e862156948a680bb1bc70dd28bef6 | [
"MIT"
] | null | null | null | src/utility/logger.hpp | mnewhouse/tselements | bd1c6724018e862156948a680bb1bc70dd28bef6 | [
"MIT"
] | null | null | null | src/utility/logger.hpp | mnewhouse/tselements | bd1c6724018e862156948a680bb1bc70dd28bef6 | [
"MIT"
] | null | null | null | /*
* TS Elements
* Copyright 2015-2018 M. Newhouse
* Released under the MIT license.
*/
#pragma once
#include <vector>
#include <mutex>
#include <atomic>
#include <thread>
#include <fstream>
#include <boost/interprocess/streams/vectorstream.hpp>
namespace ts
{
namespace logger
{
namespace impl
{
struct flush_helper
{
template <typename DispatcherType>
void operator()(DispatcherType& dispatcher) const
{
flush_impl(dispatcher, 0);
}
private:
template <typename DispatcherType>
void flush_impl(DispatcherType& dispatcher, ...) const
{
}
template <typename DispatcherType>
std::enable_if_t<true, decltype(std::declval<DispatcherType>().flush(), (void)0)>
flush_impl(DispatcherType& dispatcher, int) const
{
dispatcher.flush();
}
};
}
struct EmptyConfig
{
};
struct DefaultFilter
{
template <typename Config>
void operator()(const Config& config);
};
class LogFileDispatcher;
struct DefaultLoggerTraits
{
using config_type = EmptyConfig;
using dispatcher_type = LogFileDispatcher;
};
template <typename Tag>
struct LoggerTraits
{
using config_type = typename Tag::config_type;
using dispatcher_type = typename Tag::config_type;
};
// ScopedLogger initializes a logger singleton on construction, and shuts it down
// on destruction, RAII-style.
template <typename Tag>
struct ScopedLogger
{
public:
template <typename... Args>
ScopedLogger(Args&&... args);
~ScopedLogger();
ScopedLogger(const ScopedLogger&) = delete;
ScopedLogger<Tag>& operator=(const ScopedLogger&) = delete;
};
struct flush_t {};
static const flush_t flush;
struct endl_t {};
static const endl_t endl;
// Logger class template. It is a singleton, and for internal use only.
// The public interface is in the LoggerFront class template.
template <typename Tag>
class Logger
{
public:
using dispatcher_type = typename LoggerTraits<Tag>::dispatcher_type;
using config_type = typename LoggerTraits<Tag>::config_type;
template <typename... Args>
explicit Logger(config_type config, Args&&... args)
: dispatcher_(std::forward<Args>(args)...),
config_(config)
{
}
const config_type& config() const;
struct LockReleaser;
using Lock = std::unique_ptr<Logger<Tag>, LockReleaser>;
Lock acquire_lock();
void release_lock();
template <typename T>
Logger<Tag>& operator<<(const T& value);
Logger<Tag>& operator<<(flush_t);
Logger<Tag>& operator<<(endl_t);
void dispatch();
private:
dispatcher_type dispatcher_;
config_type config_;
boost::interprocess::basic_vectorstream<std::vector<char>> stream_;
std::string buffer_;
std::mutex mutex_;
};
template <typename Tag>
struct Logger<Tag>::LockReleaser
{
void operator()(Logger<Tag>* logger) const
{
logger->release_lock();
}
};
template <typename Tag>
class LoggerFront
{
public:
LoggerFront();
~LoggerFront();
template <typename T>
LoggerFront& operator<<(const T& value);
using config_type = typename LoggerTraits<Tag>::config_type;
const config_type& config() const;
private:
friend ScopedLogger<Tag>;
template <typename... Args>
static void initialize(Args&&... args);
static void shutdown();
static std::unique_ptr<Logger<Tag>> logger_instance_;
typename Logger<Tag>::Lock lock_;
};
// Asynchronous log file dispatcher.
class AsyncLogFileDispatcher
{
public:
AsyncLogFileDispatcher(const std::string& out_file);
~AsyncLogFileDispatcher();
template <typename InputIt>
void dispatch(InputIt it, InputIt end);
private:
void worker_thread(const std::string& file_name);
std::vector<char> out_buffer_;
std::atomic<bool> is_running_;
std::thread worker_thread_;
std::mutex mutex_;
};
class LogFileDispatcher
{
public:
LogFileDispatcher(const std::string& out_file);
template <typename InputIt>
void dispatch(InputIt it, InputIt end);
void flush();
private:
std::ofstream stream_;
};
}
}
// Singleton instance
template <typename Tag>
std::unique_ptr<ts::logger::Logger<Tag>> ts::logger::LoggerFront<Tag>::logger_instance_;
template <typename Tag>
ts::logger::LoggerFront<Tag>::LoggerFront()
: lock_(logger_instance_ ? logger_instance_->acquire_lock() : nullptr)
{
}
template <typename Tag>
ts::logger::LoggerFront<Tag>::~LoggerFront()
{
if (logger_instance_)
{
logger_instance_->dispatch();
}
}
template <typename Tag>
const typename ts::logger::LoggerFront<Tag>::config_type& ts::logger::LoggerFront<Tag>::config() const
{
return logger_instance_->config();
}
template <typename Tag>
template <typename... Args>
void ts::logger::LoggerFront<Tag>::initialize(Args&&... args)
{
logger_instance_ = std::make_unique<Logger<Tag>>(std::forward<Args>(args)...);
}
template <typename Tag>
void ts::logger::LoggerFront<Tag>::shutdown()
{
logger_instance_ = nullptr;
}
template <typename Tag>
template <typename T>
ts::logger::LoggerFront<Tag>& ts::logger::LoggerFront<Tag>::operator<<(const T& value)
{
*logger_instance_ << value;
return *this;
}
template <typename Tag>
const typename ts::logger::Logger<Tag>::config_type& ts::logger::Logger<Tag>::config() const
{
return config_;
}
// Locking functions.
template <typename Tag>
typename ts::logger::Logger<Tag>::Lock ts::logger::Logger<Tag>::acquire_lock()
{
mutex_.lock();
return Lock(this);
}
template <typename Tag>
void ts::logger::Logger<Tag>::release_lock()
{
mutex_.unlock();
}
template <typename Tag>
template <typename T>
ts::logger::Logger<Tag>& ts::logger::Logger<Tag>::operator<<(const T& value)
{
stream_ << value;
return *this;
}
template <typename Tag>
ts::logger::Logger<Tag>& ts::logger::Logger<Tag>::operator<<(flush_t)
{
dispatch();
impl::flush_helper helper;
helper(dispatcher_);
return *this;
}
template <typename Tag>
ts::logger::Logger<Tag>& ts::logger::Logger<Tag>::operator<<(endl_t)
{
return *this << "\n" << flush;
}
template <typename Tag>
void ts::logger::Logger<Tag>::dispatch()
{
const auto& data = stream_.vector();
dispatcher_.dispatch(data.begin(), data.end());
stream_.clear();
}
template <typename Tag>
template <typename... Args>
ts::logger::ScopedLogger<Tag>::ScopedLogger(Args&&... args)
{
LoggerFront<Tag>::initialize(std::forward<Args>(args)...);
}
template <typename Tag>
ts::logger::ScopedLogger<Tag>::~ScopedLogger()
{
LoggerFront<Tag>::shutdown();
}
// Dispatch functions
template <typename InputIt>
void ts::logger::AsyncLogFileDispatcher::dispatch(InputIt it, InputIt end)
{
std::unique_lock<std::mutex> lock(mutex_);
out_buffer_.insert(out_buffer_.end(), it, end);
}
template <typename InputIt>
void ts::logger::LogFileDispatcher::dispatch(InputIt it, InputIt end)
{
if (stream_)
{
std::copy(it, end, std::ostreambuf_iterator<char>(stream_));
}
}
| 22.564024 | 102 | 0.653155 | [
"vector"
] |
69a5a9a5c656e76521ad40a3124bb349d15c25d9 | 5,218 | cpp | C++ | FMU/tests/source/unittest_DataStore.cpp | kwabenantim/No-MASS | 843ccaa461923e227a8e854daaa6952d14cb8bed | [
"MIT"
] | null | null | null | FMU/tests/source/unittest_DataStore.cpp | kwabenantim/No-MASS | 843ccaa461923e227a8e854daaa6952d14cb8bed | [
"MIT"
] | 1 | 2020-08-28T18:11:26.000Z | 2020-08-28T18:11:26.000Z | FMU/tests/source/unittest_DataStore.cpp | kwabenantim/No-MASS | 843ccaa461923e227a8e854daaa6952d14cb8bed | [
"MIT"
] | 2 | 2020-02-05T10:49:42.000Z | 2020-08-28T08:23:28.000Z | // Copyright 2015 Jacob Chapman
#include <limits.h>
#include <vector>
#include "tests/Gen.hpp"
#include "Configuration.hpp"
#include "Utility.hpp"
#include "DataStore.hpp"
#include "gtest/gtest.h"
class Test_DataStore : public ::testing::Test {
protected:
int res;
virtual void SetUp();
virtual void AfterConfiguration();
};
void Test_DataStore::SetUp() {
DataStore::clear();
Configuration::outputRegexs.clear();
}
void Test_DataStore::AfterConfiguration() {
}
TEST_F(Test_DataStore, regex) {
//Configuration::outputRegexs.push_back("[a-zA-Z0-9\_]+");
Configuration::outputRegexs.push_back(".*");
//EXPECT_EQ(Configuration::outputRegexs.at(0), "*");
res = DataStore::addVariable("helloWorld");
EXPECT_EQ(res, 0);
res = DataStore::addVariable("hello1World");
EXPECT_EQ(res, 1);
res = DataStore::addVariable("hello2_World");
EXPECT_EQ(res, 2);
res = DataStore::addVariable("hello2_World");
EXPECT_EQ(res, 2);
DataStore::clear();
Configuration::outputRegexs.clear();
Configuration::outputRegexs.push_back("helloWorld");
res = DataStore::addVariable("helloWorld");
EXPECT_EQ(res, 0);
res = DataStore::addVariable("hello1World");
EXPECT_EQ(res, -1);
res = DataStore::addVariable("helloWorld1");
EXPECT_EQ(res, -1);
}
TEST_F(Test_DataStore, regex1) {
Configuration::outputRegexs.push_back("helloWorld.*");
res = DataStore::addVariable("helloWorld");
EXPECT_EQ(res, 0);
res = DataStore::addVariable("hello1World");
EXPECT_EQ(res, -1);
res = DataStore::addVariable("helloWorld1");
EXPECT_EQ(res, 1);
}
TEST_F(Test_DataStore, regex2) {
Configuration::outputRegexs.push_back(".*elloWorld.*");
res = DataStore::addVariable("helloWorld");
EXPECT_EQ(res, 0);
res = DataStore::addVariable("hello1World");
EXPECT_EQ(res, -1);
res = DataStore::addVariable("helloWorld1");
EXPECT_EQ(res, 1);
res = DataStore::addVariable("1helloWorld1");
EXPECT_EQ(res, 2);
}
TEST_F(Test_DataStore, regex3) {
Configuration::outputRegexs.push_back(".*ello.*World.*");
res = DataStore::addVariable("helloWorld");
EXPECT_EQ(res, 0);
res = DataStore::addVariable("hello1World");
EXPECT_EQ(res, 1);
res = DataStore::addVariable("helloWorld1");
EXPECT_EQ(res, 2);
res = DataStore::addVariable("1helloWorld1");
EXPECT_EQ(res, 3);
}
TEST_F(Test_DataStore, many) {
Configuration::outputRegexs.push_back(".*ello.*World.*");
for (int i = 0; i < 10000; i++) {
int res = -1;
res = DataStore::addVariable("1helloWorld" + std::to_string(i));
double val = Utility::randomDouble(0,100);
DataStore::addValue(res, val);
double ret = DataStore::getValue(res);
EXPECT_NEAR(val, ret, 0.001);
}
DataStore::clear();
}
TEST_F(Test_DataStore, save) {
Configuration::info.save = true;
Configuration::outputRegexs.clear();
Configuration::outputRegexs.push_back(".*ello.*World.*");
int res = -1;
std::vector<std::string> names;
std::vector<int> ids;
std::vector<std::vector<double>> values;
std::string name;
name = "1helloWorlderrrrrr";
res = DataStore::addVariable(name);
names.push_back(name);
ids.push_back(res);
values.push_back(std::vector<double>());
int z = 10;
int y = 10;
for (int i = 0; i < z; i++) {
name = "1helloWorld" + std::to_string(i);
res = DataStore::addVariable(name);
names.push_back(name);
ids.push_back(res);
std::vector<double> vs;
for(int j = 0; j < y; j++) {
double val = Utility::randomDouble(0,100);
DataStore::addValue(res, val);
vs.push_back(val);
double ret = DataStore::getValue(res);
EXPECT_NEAR(val, ret, 0.001);
}
values.push_back(vs);
}
name = "1helloWorlderrrrrr2";
res = DataStore::addVariable(name);
names.push_back(name);
ids.push_back(res);
values.push_back(std::vector<double>());
for (int i = 0; i < z; i++) {
name = "2helloWorld" + std::to_string(i);
res = DataStore::addVariable(name);
names.push_back(name);
ids.push_back(res);
std::vector<double> vs;
for(int j = 0; j < y; j++) {
double val = Utility::randomDouble(1,100);
DataStore::addValue(res, val);
vs.push_back(val);
double ret = DataStore::getValue(res);
EXPECT_NEAR(val, ret, 0.001);
}
values.push_back(vs);
}
DataStore::print();
DataStore::clear();
std::vector<std::string> head = Utility::csvToTableHead("NoMASS.out");
Utility::uTable<double> t = Utility::csvToTable<double>("NoMASS.out", true);
std::vector<std::vector<double>> v;
for(int i = 0; i < t[0].size(); i++){
std::vector<double> vs;
for(int j = 0; j < t.size(); j++){
vs.push_back(t[j][i]);
}
v.push_back(vs);
}
for(int i = 1; i < head.size(); i++){
std::string h = head[i];
std::vector<double> vs = v[i];
int x = 0;
for (;x<names.size();x++){
name = names[x];
if(name == h){
break;
}
}
std::vector<double> vs2 = values[x];
if (vs[0] > 0){
EXPECT_EQ(vs.size(), vs2.size());
for(int j = 0; j < vs.size(); j++){
EXPECT_NEAR(vs[j], vs2[j], 0.01);
}
}else {
EXPECT_EQ(0, vs2.size());
}
}
}
| 26.48731 | 78 | 0.630701 | [
"vector"
] |
69a6a03843273fdaccde61adcce9c6a718f33f7a | 3,796 | cxx | C++ | all-tests/test-get.cxx | Hungerarray/winbgim | 4a0bc7da71cacba61bcf6dcb7d3e2ad1ef8ebb82 | [
"MIT"
] | null | null | null | all-tests/test-get.cxx | Hungerarray/winbgim | 4a0bc7da71cacba61bcf6dcb7d3e2ad1ef8ebb82 | [
"MIT"
] | null | null | null | all-tests/test-get.cxx | Hungerarray/winbgim | 4a0bc7da71cacba61bcf6dcb7d3e2ad1ef8ebb82 | [
"MIT"
] | null | null | null | // FILE: testget.cpp
// Written by Michael Main -- Nov 4, 1998
//
// Illustrates several features of the modified winbgim functions.
// To use these features, please download the newest versions of
// winbgim.h and winbgim.cpp as described in:
// http://www.cs.colorado.edu/~main/bgi/README.html
// Then create a project file that contains testget.cpp and winbgim.cpp.
// The project file should use have:
// Target type: Application (exe)
// Platform: Win32
// Target model: Console
// Using Static Libraries
//
// Compile and run the program to see:
// 1. Numbers that print in the graphics window.
// 2. Using the getch( ) function to get arrow and other special keys.
//
// Note:
// winbgim contains its own versions of getch, delay, and kbhit.
// You do not need to include conio.h to use these functions.
// If you are going to print numbers to the graphics screen as shown below,
// you do need to include stdio.h (which contains sprintf).
#include <cstdio> // Provides sprintf
#include <iostream> // Provides cout
#include <graphics.h>
using namespace std;
void outintxy(int x, int y, int value);
int main( )
{
int i;
char c;
int height;
// Initialize the graphics window.
initwindow(300, 400);
// Convert some numbers to strings and draw them in graphics window:
height = textheight("M") + 2;
outtextxy(10, height, "Here are some numbers:");
for (i = 2*height; i <= height*10; i += height)
outintxy(20, i, i);
// Get some characters from the keyboard until an X is typed:
outtextxy(20, 13*height, "Click in this graphics window,");
outtextxy(20, 14*height, "and then press arrow keys.");
outtextxy(20, 15*height, "Watch the console window while pressing.");
outtextxy(20, 16*height, "Press X to exit.");
do
{
c = (char) getch( );
if (c != 0)
cout << "That is ASCII value: " << (int) c << endl;
else
{ // Process one of the special keys:
c = (char) getch( );
switch (c)
{
case KEY_HOME: cout << "Home key." << endl; break;
case KEY_UP: cout << "Up key." << endl; break;
case KEY_PGUP: cout << "PgUp key." << endl; break;
case KEY_LEFT: cout << "Left key." << endl; break;
case KEY_CENTER: cout << "Center key." << endl; break;
case KEY_RIGHT: cout << "Right key." << endl; break;
case KEY_END: cout << "End key." << endl; break;
case KEY_DOWN: cout << "Down key." << endl; break;
case KEY_PGDN: cout << "PgDn key." << endl; break;
case KEY_INSERT: cout << "Insert key." << endl; break;
case KEY_DELETE: cout << "Delete key." << endl; break;
case KEY_F1: cout << "F1 key." << endl; break;
case KEY_F2: cout << "F2 key." << endl; break;
case KEY_F3: cout << "F3 key." << endl; break;
case KEY_F4: cout << "F4 key." << endl; break;
case KEY_F5: cout << "F5 key." << endl; break;
case KEY_F6: cout << "F6 key." << endl; break;
case KEY_F7: cout << "F7 key." << endl; break;
case KEY_F8: cout << "F8 key." << endl; break;
case KEY_F9: cout << "F9 key." << endl; break;
default: cout << "Unknown extended key." << endl;
}
}
} while ((c != 'x') && (c != 'X'));
}
void outintxy(int x, int y, int value)
{
char digit_string[20];
sprintf(digit_string, "%d", value);
outtextxy(x, y, digit_string);
}
| 38.343434 | 77 | 0.547418 | [
"model"
] |
69af79c99bea844c7aa8ec3e2c5025267374fc50 | 11,130 | hpp | C++ | gsa/wit/COIN/Bcp/include/BCP_problem_core.hpp | kant/CMMPPT | c64b339712db28a619880c4c04839aef7d3b6e2b | [
"Apache-2.0"
] | 1 | 2019-10-25T05:25:23.000Z | 2019-10-25T05:25:23.000Z | gsa/wit/COIN/Bcp/include/BCP_problem_core.hpp | kant/CMMPPT | c64b339712db28a619880c4c04839aef7d3b6e2b | [
"Apache-2.0"
] | 2 | 2019-09-04T17:34:59.000Z | 2020-09-16T08:10:57.000Z | gsa/wit/COIN/Bcp/include/BCP_problem_core.hpp | kant/CMMPPT | c64b339712db28a619880c4c04839aef7d3b6e2b | [
"Apache-2.0"
] | 18 | 2019-07-22T19:01:25.000Z | 2022-03-03T15:36:11.000Z | // Copyright (C) 2000, International Business Machines
// Corporation and others. All Rights Reserved.
#ifndef _BCP_PROBLEM_CORE_H
#define _BCP_PROBLEM_CORE_H
// This file is fully docified.
#include "BCP_vector.hpp"
#include "BCP_matrix.hpp"
#include "BCP_buffer.hpp"
#include "BCP_enum.hpp"
#include "BCP_obj_change.hpp"
//#############################################################################
class BCP_var_core;
class BCP_cut_core;
class BCP_indexed_pricing_list;
class BCP_buffer;
class BCP_internal_brobj;
//#############################################################################
/**
This class describes the core of the MIP problem, the variables/cuts in it
as well as the matrix corresponding the core variables and cuts. Core cuts
and variables never leave the formulation. */
class BCP_problem_core{
private:
/**@name Private and disabled methods */
/*@{*/
/** Delete all data members. This method purges the pointer vector members,
i.e., deletes the object the pointers in the vectors point to. */
inline void clear();
/** The copy constructor is declared but not defined to disable it. */
BCP_problem_core(const BCP_problem_core&);
/** The assignment operator is declared but not defined to disable it. */
BCP_problem_core& operator=(const BCP_problem_core&);
/*@}*/
public:
/**@name Data members */
/*@{*/
/** A vector of pointers to the variables in the core of the problem. These
are the variables that always stay in the problem formulation. */
BCP_vec<BCP_var_core*> vars;
/** A vector of pointers to the cuts in the core of the problem. These are
the cuts that always stay in the problem formulation. */
BCP_vec<BCP_cut_core*> cuts;
/** A pointer to the constraint matrix corresponding to the core variables
and cuts. */
BCP_lp_relax* matrix;
/*@}*/
public:
/**@name Constructors and destructor */
/*@{*/
/** The default constructor creates an empty core description: no
variables/cuts and an empty matrix. */
BCP_problem_core();
/** This constructor "takes over" the arguments. The created core
description will have the content of the arguments in its data members
while the arguments lose their content. */
BCP_problem_core(BCP_vec<BCP_var_core*>& v, BCP_vec<BCP_cut_core*>& c,
BCP_lp_relax*& m) : vars(), cuts(), matrix(m) {
vars.swap(v);
cuts.swap(c);
m = 0;
}
/** The desctructor deletes all data members. */
~BCP_problem_core();
/*@}*/
/**@name Query methods */
/*@{*/
/** Return the number of variables in the core. */
inline size_t varnum() const { return vars.size(); }
/** Return the number of cuts in the core. */
inline size_t cutnum() const { return cuts.size(); }
/*@}*/
/**@name Packing and unpacking methods */
/*@{*/
/** Pack the contents of the core description into the buffer. */
void pack(BCP_buffer& buf) const; // *INLINE ?*
/** Unpack the contents of the core description from the buffer. */
void unpack(BCP_buffer& buf); // *INLINE ?*
/*@}*/
};
//#############################################################################
// The following class holds the change in the core. It may be WrtParent,
// WrtCore or Explicit. In the latter case indices is empty.
/**
This class describes changes in the core of the problem. While the set of
core variables and cuts always remains the same, their bounds and stati may
change during processing. An object of this type may store the description
of the bounds and stati of the core of three possible ways:
<ul>
<li> explicitly: the bounds and stati of everything in the core is stored
in this class. In this case <code>..._pos</code> is empty and
<code>..._ch</code> stores the bounds and stati.
<li> with respect to parent: this is the case when a sequence of core
changes have to be applied to get the current state. Each core
change in the sequence describes the changes to be done after the
previous change has been applied.
<li> with respect to core: the current state of the core is given as one
set of changes with respect to the very original state of the core.
</ul>
This class is internal to the framework, the user shouldn't worry about it.
*/
class BCP_problem_core_change{
private:
/**@name Private and disabled methods */
/*@{*/
/** Clear all vector data members. */
inline void clear();
/** The copy constructor is disabled by declaring it private and not
defining it. */
BCP_problem_core_change(const BCP_problem_core_change&); // disabled
/** The assignment operator is disabled by declaring it private and not
defining it. */
BCP_problem_core_change& operator=(const BCP_problem_core_change& x);
/*@}*/
public:
/**@name Data members */
/*@{*/
/** Describes how the change is stored. The interpretation of the other
data members depends on the storage type.
<ul>
<li><code>BCP_Storage_NoData</code>: when no data is stored (i.e.,
the change is not described yet) the other members are undefined.
<li><code>BCP_Storage_WrtCore</code>: with respect to core storage
(as explained in the class description).
<li><code>BCP_Storage_WrtParent</code>: with respect to parent
storage (as explained in the class description).
<li><code>BCP_Storage_Explicit</code>: Explicit storage (as explained
in the class description).
</ul>
*/
BCP_storage_t _storage;
/** The positions of the core variables (in the <code>vars</code> member of
\URL[<code>BCP_problem_core</code>]{BCP_problem_core.html}) whose
bounds and/or stati have changed. */
BCP_vec<int> var_pos;
/** The new lb/ub/status triplet for each variable for which any of those
three have changed. */
BCP_vec<BCP_obj_change> var_ch;
/** The positions of the core cuts (in the <code>cuts</code> member of
\URL[<code>BCP_problem_core</code>]{BCP_problem_core.html}) whose
bounds and/or stati have changed. */
BCP_vec<int> cut_pos;
/** The new lb/ub/status triplet for each cut for which any of those three
have changed. */
BCP_vec<BCP_obj_change> cut_ch;
/*@}*/
public:
/**@name Constructors and destructor */
/*@{*/
/** This constructor creates a core change with the given storage. The
other members are empty, i.e., the created object contains NoData; is
Explicit and empty; is WrtCore or WrtParent but there's no change. <br>
Note that the argument defaults to WrtCore, this constructor is
the default constructor as well, and as the default constructor it
creates a "no change WrtCore" core change. */
BCP_problem_core_change(BCP_storage_t store = BCP_Storage_WrtCore) :
_storage(store), var_pos(), var_ch(), cut_pos(), cut_ch() {}
/** This constructor creates an Explicit core change description. The first
<code>bvarnum</code> variables in <code>vars</code> are the core
variables. Similarly for the cuts. */
BCP_problem_core_change(int bvarnum, BCP_var_set& vars,
int bcutnum, BCP_cut_set& cuts);
/** Create a core change describing the changes from <code>old_bc</node> to
<code>new_bc</code>. Both core change arguments must have explicit
storage. The only reason for passing <code>storage</code> as an
argument (and not setting it automatically to WrtParent) is that
<code>old_bc</code> might be the original core in which case storage
must be set to WrtCore. */
BCP_problem_core_change(BCP_storage_t storage,
BCP_problem_core_change& ocore,
BCP_problem_core_change& ncore);
/** The destructor deletes all data members. */
~BCP_problem_core_change() {}
/*@}*/
/**@name Query methods */
/*@{*/
/** Return the storage type. */
inline BCP_storage_t storage() const { return _storage; }
/** Return the number of changed variables (the length of the array
<code>var_ch</code>). */
inline size_t varnum() const { return var_ch.size(); }
/** Return the number of changed cuts (the length of the array
<code>cut_ch</code>). */
inline size_t cutnum() const { return cut_ch.size(); }
/*@}*/
/**@name Modifying methods */
/*@{*/
/** Set the core change description to be an explicit description (in the
form of a change) of the given <code>core</code>. */
BCP_problem_core_change& operator=(const BCP_problem_core& core);
/** If the current storage is not already explicit then replace it with an
explicit description of the core generated by applying the currently
stored changes to <code>expl_core</code> (which of course, must be
explicitly stored). <br>
NOTE: An exception is thrown if the currently stored change is not
stored as explicit or WrtCore; or the storage of
<code>expl_core</code> is not explicit. */
void ensure_explicit(const BCP_problem_core_change& expl_core);
/** Replace the current explicitly stored core change with one stored with
respect to the explicitly stored original core change in
<code>orig_core</code> if the WrtCore description is shorter (requires
less space to pack into a buffer).<br>
NOTE: An exception is thrown if either the current storage or that of
<code>expl_core</code> is not explicit. */
void make_wrtcore_if_shorter(const BCP_problem_core_change& orig_core);
/** Swap the contents of the current core change with that of
<code>other</code>. */
void swap(BCP_problem_core_change& other);
/** Update the current change according to <code>core_change</code>. If the
storage type of <code>core_change</code> is
<ul>
<li> NoData or Explicit then it is simply copied over into this
change.
<li> WrtParent then the current change is supposed to be the parent
and this explicitly stored core change will be updated with the
changes in <code>core_change</code> (an exception is thrown if
the current change is not explicitly stored).
<li> WrtCore storage then the current change will be replaced by
<code>expl_core</code> updated with <code>core_change</code>
(the storage of <code>expl_core</code> must be explicit or an
exception is thrown).
</ul>
NOTE: When this function exits the stored change will have either
explicit or NoData storage. */
void update(const BCP_problem_core_change& expl_core,
const BCP_problem_core_change& core_change);
/*@}*/
/**@name Packing and unpacking */
/*@{*/
/** Return the buffer size needed to pack the data in the core change. */
int pack_size() const;
/** Pack the core change into the buffer. */
void pack(BCP_buffer& buf) const;
/** Unpack the core change data from the buffer. */
void unpack(BCP_buffer& buf);
/*@}*/
};
#endif
| 41.842105 | 79 | 0.66496 | [
"object",
"vector"
] |
69b3bce70f6d646e2ceb1d75cfb40000babbd49f | 6,357 | hpp | C++ | sdk/messages/state/differential_base.hpp | ddr95070/RMIsaac | ee3918f685f0a88563248ddea11d089581077973 | [
"FSFAP"
] | null | null | null | sdk/messages/state/differential_base.hpp | ddr95070/RMIsaac | ee3918f685f0a88563248ddea11d089581077973 | [
"FSFAP"
] | null | null | null | sdk/messages/state/differential_base.hpp | ddr95070/RMIsaac | ee3918f685f0a88563248ddea11d089581077973 | [
"FSFAP"
] | 1 | 2022-01-28T16:37:51.000Z | 2022-01-28T16:37:51.000Z | /*
Copyright (c) 2019, NVIDIA CORPORATION. All rights reserved.
NVIDIA CORPORATION and its licensors retain all intellectual property
and proprietary rights in and to this software, related documentation
and any modifications thereto. Any use, reproduction, disclosure or
distribution of this software and related documentation without an express
license agreement from NVIDIA CORPORATION is strictly prohibited.
*/
#pragma once
#include "packages/composite/gems/typed_composite_view.hpp"
#include "packages/engine_gems/state/state.hpp"
namespace isaac {
namespace messages {
// State for a differential base with time (T), position (P), speed (V), and acceleration (A)
template <template <int> class Base>
struct DifferentialBaseTPVALayout : public Base<8> {
// Time stamp
ISAAC_COMPOSITE_SCALAR(0, time);
// Position of the base
ISAAC_COMPOSITE_SCALAR(1, pos_x);
ISAAC_COMPOSITE_SCALAR(2, pos_y);
// Heading of the base
ISAAC_COMPOSITE_SCALAR(3, heading);
// Linear speed of the base
ISAAC_COMPOSITE_SCALAR(4, linear_speed);
// Angular speed of the base
ISAAC_COMPOSITE_SCALAR(5, angular_speed);
// Linear acceleration of the base
ISAAC_COMPOSITE_SCALAR(6, linear_acceleration);
// Angular acceleration of the base
ISAAC_COMPOSITE_SCALAR(7, angular_acceleration);
};
using DifferentialBaseTPVAState = DifferentialBaseTPVALayout<state::StateD>;
using DifferentialBaseTPVACompositeConstView =
composite::TypedCompositeView<const double, DifferentialBaseTPVALayout>;
using DifferentialBaseTPVACompositeView =
composite::TypedCompositeView<double, DifferentialBaseTPVALayout>;
// State for a differential base with time (T), position (P), and speed (V)
template <template <int> class Base>
struct DifferentialBaseTPVLayout : public Base<6> {
// Time stamp
ISAAC_COMPOSITE_SCALAR(0, time);
// Position of the base
ISAAC_COMPOSITE_SCALAR(1, pos_x);
ISAAC_COMPOSITE_SCALAR(2, pos_y);
// Heading of the base
ISAAC_COMPOSITE_SCALAR(3, heading);
// Linear speed of the base
ISAAC_COMPOSITE_SCALAR(4, linear_speed);
// Angular speed of the base
ISAAC_COMPOSITE_SCALAR(5, angular_speed);
};
using DifferentialBaseTPVState = DifferentialBaseTPVLayout<state::StateD>;
using DifferentialBaseTPVCompositeConstView =
composite::TypedCompositeView<const double, DifferentialBaseTPVLayout>;
using DifferentialBaseTPVCompositeView =
composite::TypedCompositeView<double, DifferentialBaseTPVLayout>;
// State for a differential base with position (P), speed (V), and acceleration (A)
template <template <int> class Base>
struct DifferentialBasePVALayout : public Base<7> {
// Position of the base
ISAAC_COMPOSITE_SCALAR(0, pos_x);
ISAAC_COMPOSITE_SCALAR(1, pos_y);
// Heading of the base
ISAAC_COMPOSITE_SCALAR(2, heading);
// Linear speed of the base
ISAAC_COMPOSITE_SCALAR(3, linear_speed);
// Angular speed of the base
ISAAC_COMPOSITE_SCALAR(4, angular_speed);
// Linear acceleration of the base
ISAAC_COMPOSITE_SCALAR(5, linear_acceleration);
// Angular acceleration of the base
ISAAC_COMPOSITE_SCALAR(6, angular_acceleration);
};
using DifferentialBasePVAState = DifferentialBasePVALayout<state::StateD>;
using DifferentialBasePVACompositeConstView =
composite::TypedCompositeView<const double, DifferentialBasePVALayout>;
using DifferentialBasePVACompositeView =
composite::TypedCompositeView<double, DifferentialBasePVALayout>;
// Alias for backward compatibility.
// State vector for a 2D base which can rotate around its origin, but only move in the direction
// of the X axis.
using DifferentialBaseState = DifferentialBasePVAState;
// State for a differential base with time (T), position (P), and speed (V)
template <template <int> class Base>
struct DifferentialBasePVLayout : public Base<5> {
// Position of the base
ISAAC_COMPOSITE_SCALAR(0, pos_x);
ISAAC_COMPOSITE_SCALAR(1, pos_y);
// Heading of the base
ISAAC_COMPOSITE_SCALAR(2, heading);
// Linear speed of the base
ISAAC_COMPOSITE_SCALAR(3, linear_speed);
// Angular speed of the base
ISAAC_COMPOSITE_SCALAR(4, angular_speed);
};
using DifferentialBasePVState = DifferentialBasePVLayout<state::StateD>;
using DifferentialBasePVCompositeConstView =
composite::TypedCompositeView<const double, DifferentialBasePVLayout>;
using DifferentialBasePVCompositeView =
composite::TypedCompositeView<double, DifferentialBasePVLayout>;
// State for a differential base with speed (V) and acceleration (A)
template <template <int> class Base>
struct DifferentialBaseVALayout : public Base<4> {
// Linear speed of the base
ISAAC_COMPOSITE_SCALAR(0, linear_speed);
// Angular speed of the base
ISAAC_COMPOSITE_SCALAR(1, angular_speed);
// Linear acceleration of the base
ISAAC_COMPOSITE_SCALAR(2, linear_acceleration);
// Angular acceleration of the base
ISAAC_COMPOSITE_SCALAR(3, angular_acceleration);
};
using DifferentialBaseVAState = DifferentialBaseVALayout<state::StateD>;
// Alias for backward compatibility.
// Observation of the dynamics of the base
using DifferentialBaseDynamics = DifferentialBaseVAState;
// State for a differential base with speed (V)
template <template <int> class Base>
struct DifferentialBaseVLayout : public Base<2> {
// Linear speed of the base
ISAAC_COMPOSITE_SCALAR(0, linear_speed);
// Angular speed of the base
ISAAC_COMPOSITE_SCALAR(1, angular_speed);
};
using DifferentialBaseVState = DifferentialBaseVLayout<state::StateD>;
using DifferentialBaseVCompositeConstView =
composite::TypedCompositeView<const double, DifferentialBaseVLayout>;
using DifferentialBaseVCompositeView =
composite::TypedCompositeView<double, DifferentialBaseVLayout>;
// Alias for backward compatibility.
// Controls used by a differential base
using DifferentialBaseControl = DifferentialBaseVState;
// State for two wheels of a differential base with speed (V) and acceleration (A)
template <template <int> class Base>
struct DifferentialWheelVALayout : public Base<4> {
// Speeds
ISAAC_COMPOSITE_SCALAR(0, left_wheel_speed);
ISAAC_COMPOSITE_SCALAR(1, right_wheel_speed);
// Accelerations
ISAAC_COMPOSITE_SCALAR(2, left_wheel_acceleration);
ISAAC_COMPOSITE_SCALAR(3, right_wheel_acceleration);
};
using DifferentialWheelVAState = DifferentialWheelVALayout<state::StateD>;
} // namespace messages
} // namespace isaac
| 40.234177 | 96 | 0.791568 | [
"vector"
] |
69b5d4d8433604f1c5352a91e345fbc900de2bc3 | 486 | hpp | C++ | src/engine.hpp | lemywinx/CarbonRain | 430a399fb3fbe06a18202d1d3bddf95984249c14 | [
"Apache-2.0"
] | 1 | 2020-07-14T12:20:55.000Z | 2020-07-14T12:20:55.000Z | src/engine.hpp | lemywinx/carbon-rain | 430a399fb3fbe06a18202d1d3bddf95984249c14 | [
"Apache-2.0"
] | null | null | null | src/engine.hpp | lemywinx/carbon-rain | 430a399fb3fbe06a18202d1d3bddf95984249c14 | [
"Apache-2.0"
] | null | null | null | #ifndef ENGINE_H
#define ENGINE_H
#include <libtcod/libtcod.hpp>
class Actor;
class Map;
class Engine {
public :
enum GameStatus {
STARTUP,
IDLE,
NEW_TURN,
VICTORY,
DEFEAT
} gameStatus;
int fovRadius;
TCODList<Actor *> actors;
Actor *player;
Map *map;
Engine();
~Engine();
void update();
void render();
};
extern Engine engine;
#endif
| 14.727273 | 33 | 0.506173 | [
"render"
] |
69bc0d075142f3434fe85fbbdda2a59eeff9cd7d | 4,634 | cxx | C++ | panda/src/net/netDatagram.cxx | kestred/panda3d | 16bfd3750f726a8831771b81649d18d087917fd5 | [
"PHP-3.01",
"PHP-3.0"
] | 3 | 2018-03-09T12:07:29.000Z | 2021-02-25T06:50:25.000Z | panda/src/net/netDatagram.cxx | Sinkay/panda3d | 16bfd3750f726a8831771b81649d18d087917fd5 | [
"PHP-3.01",
"PHP-3.0"
] | null | null | null | panda/src/net/netDatagram.cxx | Sinkay/panda3d | 16bfd3750f726a8831771b81649d18d087917fd5 | [
"PHP-3.01",
"PHP-3.0"
] | null | null | null | // Filename: netDatagram.cxx
// Created by: jns (07Feb00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University. All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license. You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////
#include "netDatagram.h"
TypeHandle NetDatagram::_type_handle;
////////////////////////////////////////////////////////////////////
// Function: NetDatagram::Constructor
// Access: Public
// Description: Constructs an empty datagram.
////////////////////////////////////////////////////////////////////
NetDatagram::
NetDatagram() {
}
////////////////////////////////////////////////////////////////////
// Function: NetDatagram::Constructor
// Access: Public
// Description: Constructs a datagram from an existing block of data.
////////////////////////////////////////////////////////////////////
NetDatagram::
NetDatagram(const void *data, size_t size) :
Datagram(data, size) {
}
////////////////////////////////////////////////////////////////////
// Function: NetDatagram::Copy Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
NetDatagram::
NetDatagram(const Datagram ©) :
Datagram(copy)
{
}
////////////////////////////////////////////////////////////////////
// Function: NetDatagram::Copy Constructor
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
NetDatagram::
NetDatagram(const NetDatagram ©) :
Datagram(copy),
_connection(copy._connection),
_address(copy._address)
{
}
////////////////////////////////////////////////////////////////////
// Function: NetDatagram::Copy Assignment Operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
void NetDatagram::
operator = (const Datagram ©) {
Datagram::operator = (copy);
_connection.clear();
_address.clear();
}
////////////////////////////////////////////////////////////////////
// Function: NetDatagram::Copy Assignment Operator
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
void NetDatagram::
operator = (const NetDatagram ©) {
Datagram::operator = (copy);
_connection = copy._connection;
_address = copy._address;
}
////////////////////////////////////////////////////////////////////
// Function: NetDatagram::clear
// Access: Public, Virtual
// Description: Resets the datagram to empty, in preparation for
// building up a new datagram.
////////////////////////////////////////////////////////////////////
void NetDatagram::
clear() {
Datagram::clear();
_connection.clear();
_address.clear();
}
////////////////////////////////////////////////////////////////////
// Function: NetDatagram::set_connection
// Access: Public
// Description: Specifies the socket to which the datagram should be
// written.
////////////////////////////////////////////////////////////////////
void NetDatagram::
set_connection(const PT(Connection) &connection) {
_connection = connection;
}
////////////////////////////////////////////////////////////////////
// Function: NetDatagram::set_connection
// Access: Public
// Description: Retrieves the socket from which the datagram was
// read, or to which it is scheduled to be written.
////////////////////////////////////////////////////////////////////
PT(Connection) NetDatagram::
get_connection() const {
return _connection;
}
////////////////////////////////////////////////////////////////////
// Function: NetDatagram::set_address
// Access: Public
// Description: Specifies the host to which the datagram should be
// sent.
////////////////////////////////////////////////////////////////////
void NetDatagram::
set_address(const NetAddress &address) {
_address = address;
}
////////////////////////////////////////////////////////////////////
// Function: NetDatagram::set_address
// Access: Public
// Description: Retrieves the host from which the datagram was
// read, or to which it is scheduled to be sent.
////////////////////////////////////////////////////////////////////
const NetAddress &NetDatagram::
get_address() const {
return _address;
}
| 32.633803 | 70 | 0.442167 | [
"3d"
] |
69ce6db6345a0ae614aced5ca2409863e4024b86 | 3,408 | cpp | C++ | core/base/log.cpp | bartbalaz/gentroller | b40c4fb5661619e9540f0d4b88f6f22aafb9156c | [
"BSD-3-Clause"
] | null | null | null | core/base/log.cpp | bartbalaz/gentroller | b40c4fb5661619e9540f0d4b88f6f22aafb9156c | [
"BSD-3-Clause"
] | null | null | null | core/base/log.cpp | bartbalaz/gentroller | b40c4fb5661619e9540f0d4b88f6f22aafb9156c | [
"BSD-3-Clause"
] | null | null | null |
#include <sstream>
#include <iostream>
#include <libgen.h>
#include <string.h>
#include <stdarg.h>
#include "boost/date_time/posix_time/posix_time.hpp"
#include "exception.hpp"
#include "application.hpp"
#include "log.hpp"
namespace pt = boost::posix_time;
using namespace Bx::Base;
Log Log::_logInstance;
std::vector<std::string> Log::_levelVec = { "ftl", "err", "wrn", "inf", "dbg" };
std::string Log::_logLevelHelp;
std::string Log::_defaultLogLevel("dbg");
Log::Log():
_logLevel(dbg)
{
}
Log::~Log()
{
file("");
}
void
Log::level(const char* logLevel)
{
std::string logLevelString(logLevel);
Log::level(logLevelString);
}
void
Log::level(std::string& logLevel)
{
unsigned i(0);
if(logLevel.size())
{
for(; i < _levelVec.size(); i++)
{
if(_levelVec[i] == logLevel)
{
break;
}
}
if (_levelVec[i] == logLevel)
{
_logInstance._logLevel = (logLevel_t) i;
}
}
}
void
Log::level(logLevel_t logLevel)
{
_logInstance._logLevel = logLevel;
}
void
Log::file(const char* name)
{
std::string fileName(name);
Log::file(fileName);
}
void
Log::file(std::string& name)
{
pt::ptime localTime = pt::second_clock::local_time();
if(_logInstance._logFile.is_open())
{
_logInstance._logFile << "Log file: " << name << " closed at "
<< pt::to_simple_string (localTime) << std::endl;
_logInstance._logFile.close();
}
if(name.size())
{
_logInstance._logFile.open(name, std::ios::trunc | std::ios::out);
if(_logInstance._logFile.is_open())
{
_logInstance._logFile << "Log file: '" << name << "' opened at "
<< pt::to_simple_string (localTime) << std::endl
<< "Application version information: " << std::endl
<< Application::appInfo() << std::endl;
}
}
}
void
Log::log(logLevel_t logLevel, int error, const char* pFileName,
const int lineNum, const char* pFormat,...)
{
if(logLevel <= _logInstance._logLevel)
{
char msg[core_msg_size];
char fileName[::strlen(pFileName)+1];
strcpy(fileName, pFileName);
va_list argptr;
va_start(argptr, pFormat);
vsnprintf(msg, core_msg_size, pFormat, argptr);
va_end(argptr);
// Get current time stamp
pt::ptime localTime = pt::second_clock::local_time();
// Prepare the buffer
std::stringstream ss;
ss << _levelVec[logLevel] << "|"<< localTime.date().year() << "/"
<< localTime.date().month()
<< "/" << localTime.date().day()
<< "|" << localTime.time_of_day().hours()
<< ":" << localTime.time_of_day().minutes()
<< ":" << localTime.time_of_day().seconds() << "|"
<< ::basename(fileName) << "(" << lineNum << "):"
<< msg;
if(error >= 0)
{
ss << " e:" << error << "(" << strerror(error) << ")";
}
ss << std::endl;
std::cout << ss.str();
if(_logInstance._logFile.is_open())
{
_logInstance._logFile << ss.str();
}
}
}
std::string&
Log::logLevelHelp()
{
if (!_logLevelHelp.size())
{
for(std::vector<std::string>::const_iterator i = _levelVec.begin();
i != _levelVec.end(); i++)
{
_logLevelHelp += (i == _levelVec.begin() ? "" : ", ") + (*i);
}
_logLevelHelp += "\ndefault: " + _defaultLogLevel;
}
return _logLevelHelp;
}
std::string&
Log::defaultLogLevel()
{
return _defaultLogLevel;
}
| 19.699422 | 80 | 0.588322 | [
"vector"
] |
69dcc5b91cc9b072dd33f10557665a64c12f11dd | 916 | hpp | C++ | ChaosGL/Buffer.hpp | chaosarts/ChaosGL.cpp | 7d851a404824609547fb9261790b87cee7699d5c | [
"Apache-2.0"
] | null | null | null | ChaosGL/Buffer.hpp | chaosarts/ChaosGL.cpp | 7d851a404824609547fb9261790b87cee7699d5c | [
"Apache-2.0"
] | null | null | null | ChaosGL/Buffer.hpp | chaosarts/ChaosGL.cpp | 7d851a404824609547fb9261790b87cee7699d5c | [
"Apache-2.0"
] | null | null | null | /*
* Buffer.h
*
* Created on: 07.03.2016
* Author: chaos
*/
#ifndef ChaosGL_Buffer_hpp
#define ChaosGL_Buffer_hpp
#include "ChaosGL.hpp"
#include <stdlib.h>
namespace chaosgl
{
class Buffer
{
private:
/** Provides the buffer id */
GLuint* const _id;
public:
/** Provides the target of the buffer */
const GLenum target;
/**
* Creates a new buffer object
* @param target
*/
Buffer(GLenum target);
/**
* Destructor
*/
virtual ~Buffer();
/**
* Returns the id of the buffer
*/
GLuint getId ();
/**
* Binds the buffer
*/
void bind ();
/**
* Unbinds the buffer
*/
void unbind ();
/**
* Buffers data
*/
void buffer (GLsizeiptr size, const GLvoid* data, GLenum usage);
/**
* Determines whether the object is a buffer or not
*/
GLboolean isBuffer ();
};
}
#endif /* BUFFER_H_ */
| 12.722222 | 66 | 0.568777 | [
"object"
] |
69e22c4cff32af89a2dde7d4de83404501c336c8 | 12,875 | cpp | C++ | src/init.cpp | PICOVERAVR/VkGrass | c7651a430c1746c7808bfcb38b6c2b3274dbfa54 | [
"MIT"
] | null | null | null | src/init.cpp | PICOVERAVR/VkGrass | c7651a430c1746c7808bfcb38b6c2b3274dbfa54 | [
"MIT"
] | null | null | null | src/init.cpp | PICOVERAVR/VkGrass | c7651a430c1746c7808bfcb38b6c2b3274dbfa54 | [
"MIT"
] | null | null | null | #include <cstring> // for strcmp
#include <set>
#include "options.hpp"
#include "extensions.hpp"
#include "main.hpp"
void appvk::windowSizeCallback(GLFWwindow* w, int width, int height) {
(void)width;
(void)height;
appvk* papp = reinterpret_cast<appvk*>(glfwGetWindowUserPointer(w));
papp->resizeOccurred = true;
}
void appvk::createWindow() {
glfwInit();
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
w = glfwCreateWindow(screenWidth, screenHeight, "Demo", nullptr, nullptr);
if (!w) {
throw std::runtime_error("cannot create window!");
}
// this enables us to read/write class members from our static callback
// (since static members have no implicit "*this" parameter)
glfwSetWindowUserPointer(w, this);
glfwSetFramebufferSizeCallback(w, windowSizeCallback);
}
void appvk::checkValidation() {
if (debug) {
uint32_t numLayers = 0;
vkEnumerateInstanceLayerProperties(&numLayers, nullptr);
std::vector<VkLayerProperties> layers(numLayers);
vkEnumerateInstanceLayerProperties(&numLayers, layers.data());
for (const auto& validationLayer : validationLayers) {
bool found = false;
for (const auto& currentLayer : layers) {
if (!strcmp(validationLayer, currentLayer.layerName)) {
found = true;
}
}
if (!found) {
throw std::runtime_error("can't find all validation layers!");
}
}
cout << "found validation layers\n";
}
}
const std::vector<const char*> appvk::getExtensions() {
// glfw helper function that specifies the extension needed to draw stuff
uint32_t glfwNumExtensions = 0;
const char** glfwExtensions = glfwGetRequiredInstanceExtensions(&glfwNumExtensions);
// default insertion constructor
std::vector<const char*> extensions(glfwExtensions, glfwExtensions + glfwNumExtensions);
if (debug) {
extensions.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
extensions.push_back(VK_EXT_VALIDATION_FEATURES_EXTENSION_NAME);
}
return extensions;
}
VKAPI_ATTR VkBool32 appvk::debugCallback(
VkDebugUtilsMessageSeverityFlagBitsEXT mSev,
VkDebugUtilsMessageTypeFlagsEXT mType,
const VkDebugUtilsMessengerCallbackDataEXT* data,
void* userData) {
(void) mSev;
(void) mType;
(void) data;
(void) userData;
cerr << "\t" << data->pMessage << "\n";
return VK_FALSE; // don't abort on error
}
void appvk::populateDebugMessenger(VkDebugUtilsMessengerCreateInfoEXT &createInfo) {
createInfo.sType = VK_STRUCTURE_TYPE_DEBUG_UTILS_MESSENGER_CREATE_INFO_EXT;
createInfo.messageSeverity = VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT;
if (verbose) {
createInfo.messageSeverity |= VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT;
}
createInfo.messageType = VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT;
createInfo.pfnUserCallback = debugCallback;
createInfo.pUserData = nullptr;
}
void appvk::setupDebugMessenger() {
VkDebugUtilsMessengerCreateInfoEXT createInfo{};
populateDebugMessenger(createInfo);
if (CreateDebugUtilsMessengerEXT(instance, &createInfo, nullptr, &debugMessenger) != VK_SUCCESS) {
throw std::runtime_error("cannot create debug messenger!");
}
}
void appvk::createInstance() {
if (debug) {
checkValidation();
}
VkApplicationInfo appInfo{};
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
appInfo.pApplicationName = "demo";
appInfo.apiVersion = VK_API_VERSION_1_2;
VkInstanceCreateInfo createInfo{};
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
createInfo.pApplicationInfo = &appInfo;
VkDebugUtilsMessengerCreateInfoEXT debugCreateInfo{}; // outside if statement to avoid getting deallocated early
// enable sync validation to detect missing/incorrect barriers between operations
VkValidationFeaturesEXT validFeatures{};
VkValidationFeatureEnableEXT feats[] = {
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT
};
if (debug) {
createInfo.enabledLayerCount = validationLayers.size();
createInfo.ppEnabledLayerNames = validationLayers.data();
populateDebugMessenger(debugCreateInfo);
validFeatures.sType = VK_STRUCTURE_TYPE_VALIDATION_FEATURES_EXT;
validFeatures.enabledValidationFeatureCount = 1;
validFeatures.pEnabledValidationFeatures = feats;
// passing debugCreateInfo here so that our debug utils handle errors in createInstance or destroyInstance
createInfo.pNext = &debugCreateInfo;
debugCreateInfo.pNext = &validFeatures;
}
auto extensions = getExtensions();
createInfo.enabledExtensionCount = static_cast<uint32_t>(extensions.size());
createInfo.ppEnabledExtensionNames = extensions.data();
if (vkCreateInstance(&createInfo, nullptr, &instance) != VK_SUCCESS) {
throw std::runtime_error("instance creation failed!");
}
}
// extension support is device-specific, so check for it here
bool appvk::checkDeviceExtensions(VkPhysicalDevice pdev) {
uint32_t numExtensions;
vkEnumerateDeviceExtensionProperties(pdev, nullptr, &numExtensions, nullptr);
std::vector<VkExtensionProperties> deviceExtensions(numExtensions);
vkEnumerateDeviceExtensionProperties(pdev, nullptr, &numExtensions, deviceExtensions.data());
std::set<std::string_view> tempExtensionList(requiredExtensions.begin(), requiredExtensions.end());
// erase any extensions found
for (const auto& extension : deviceExtensions) {
tempExtensionList.erase(extension.extensionName);
}
return tempExtensionList.empty();
}
VkSampleCountFlagBits appvk::getSamples(unsigned int try_samples) {
VkPhysicalDeviceProperties dprop;
vkGetPhysicalDeviceProperties(pdev, &dprop);
// find max sample count that both color and depth buffer support and return it
VkSampleCountFlags count = dprop.limits.framebufferColorSampleCounts & dprop.limits.framebufferDepthSampleCounts;
if (count & VK_SAMPLE_COUNT_16_BIT && try_samples == 16) { return VK_SAMPLE_COUNT_16_BIT; }
if (count & VK_SAMPLE_COUNT_8_BIT && try_samples == 8) { return VK_SAMPLE_COUNT_8_BIT; }
if (count & VK_SAMPLE_COUNT_4_BIT && try_samples == 4) { return VK_SAMPLE_COUNT_4_BIT; }
if (count & VK_SAMPLE_COUNT_2_BIT && try_samples == 2) { return VK_SAMPLE_COUNT_2_BIT; }
return VK_SAMPLE_COUNT_1_BIT;
}
void appvk::checkChooseDevice(VkPhysicalDevice pd, manufacturer m) {
VkPhysicalDeviceProperties dprop{}; // basic information
VkPhysicalDeviceFeatures dfeat{}; // detailed feature list
vkGetPhysicalDeviceProperties(pd, &dprop);
vkGetPhysicalDeviceFeatures(pd, &dfeat);
const std::string_view name = std::string_view(dprop.deviceName);
cout << "found \"" << name << "\" running " <<
VK_VERSION_MAJOR(dprop.apiVersion) <<
"." << VK_VERSION_MINOR(dprop.apiVersion) <<
"." << VK_VERSION_PATCH(dprop.apiVersion);
VkBool32 correctm;
switch (m) {
case nvidia:
correctm = name.find("GeForce") != std::string_view::npos;
break;
case intel:
correctm = name.find("Intel") != std::string_view::npos;
break;
case any:
correctm = VK_TRUE;
break;
}
VkBool32 correctf = dfeat.geometryShader |
dfeat.tessellationShader |
checkDeviceExtensions(pd);
if (correctm && correctf && pdev == VK_NULL_HANDLE) {
pdev = pd;
msaaSamples = getSamples(options::msaaSamples);
cout << " (selected)";
}
cout << "\n";
}
void appvk::pickPhysicalDevice(manufacturer m) {
uint32_t numDevices;
vkEnumeratePhysicalDevices(instance, &numDevices, nullptr);
if (numDevices == 0) {
throw std::runtime_error("no vulkan-capable gpu found!");
}
std::vector<VkPhysicalDevice> devices(numDevices);
vkEnumeratePhysicalDevices(instance, &numDevices, devices.data());
for (const auto& device : devices) {
checkChooseDevice(device, m);
}
if (pdev == VK_NULL_HANDLE) {
throw std::runtime_error("no usable gpu found!");
}
}
appvk::queueIndices appvk::findQueueFamily(VkPhysicalDevice pd) {
queueIndices qi;
uint32_t numQueues;
vkGetPhysicalDeviceQueueFamilyProperties(pd, &numQueues, nullptr);
std::vector<VkQueueFamilyProperties> queues(numQueues);
vkGetPhysicalDeviceQueueFamilyProperties(pd, &numQueues, queues.data());
for (size_t i = 0; i < numQueues; i++) {
VkBool32 presSupported = false;
vkGetPhysicalDeviceSurfaceSupportKHR(pdev, i, surf, &presSupported);
if (queues[i].queueFlags & VK_QUEUE_GRAPHICS_BIT && presSupported) {
qi.graphics = i;
}
if (queues[i].queueFlags & VK_QUEUE_COMPUTE_BIT) {
qi.compute = i;
}
if (queues[i].queueFlags & VK_QUEUE_TRANSFER_BIT) {
qi.transfer = i;
}
}
return qi;
}
void appvk::createLogicalDevice() {
queueIndices qi = findQueueFamily(pdev); // check for the proper queue
swapChainSupportDetails d = querySwapChainSupport(pdev); // verify swap chain information before creating a new logical device
if (!qi.graphics.has_value() || d.formats.size() == 0 || d.presentModes.size() == 0) {
throw std::runtime_error("cannot find a suitable logical device!");
}
VkDeviceQueueCreateInfo queueInfo{};
queueInfo.sType = VK_STRUCTURE_TYPE_DEVICE_QUEUE_CREATE_INFO;
queueInfo.queueFamilyIndex = *(qi.graphics);
queueInfo.queueCount = 1;
float pri = 1.0f;
queueInfo.pQueuePriorities = &pri; // highest priority
VkPhysicalDevicePipelineExecutablePropertiesFeaturesKHR execProp{};
execProp.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_PIPELINE_EXECUTABLE_PROPERTIES_FEATURES_KHR;
execProp.pipelineExecutableInfo = VK_TRUE;
// this structure is the same as deviceFeatures but has a pNext member too
VkPhysicalDeviceFeatures2 feat2{};
feat2.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
feat2.pNext = &execProp;
feat2.features = {}; // set everything not used to zero
feat2.features.samplerAnisotropy = VK_TRUE;
VkDeviceCreateInfo createInfo{};
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
createInfo.pNext = &feat2;
createInfo.pQueueCreateInfos = &queueInfo;
createInfo.queueCreateInfoCount = 1;
createInfo.pEnabledFeatures = nullptr;
createInfo.enabledExtensionCount = requiredExtensions.size();
createInfo.ppEnabledExtensionNames = requiredExtensions.data();
if (vkCreateDevice(pdev, &createInfo, nullptr, &dev)) {
throw std::runtime_error("cannot create virtual device!");
}
vkGetDeviceQueue(dev, *(qi.graphics), 0, &gQueue); // creating a device also creates queues for it
}
appvk::~appvk() {
cleanupSwapChain();
vkDestroyDescriptorSetLayout(dev, dSetLayout, nullptr);
vkDestroyDescriptorSetLayout(dev, skySetLayout, nullptr);
vkDestroyCommandPool(dev, cp, nullptr);
vkDestroySampler(dev, terrainSamp, nullptr);
vkDestroyImageView(dev, terrainView, nullptr);
vkFreeMemory(dev, terrainMem, nullptr);
vkDestroyImage(dev, terrainImage, nullptr);
vkDestroySampler(dev, grassSamp, nullptr);
vkDestroyImageView(dev, grassView, nullptr);
vkFreeMemory(dev, grassMem, nullptr);
vkDestroyImage(dev, grassImage, nullptr);
vkDestroySampler(dev, cubeSamp, nullptr);
vkDestroyImageView(dev, cubeView, nullptr);
vkFreeMemory(dev, cubeMem, nullptr);
vkDestroyImage(dev, cubeImage, nullptr);
vkFreeMemory(dev, terrainIndMem, nullptr);
vkDestroyBuffer(dev, terrainIndBuf, nullptr);
vkFreeMemory(dev, terrainVertMem, nullptr);
vkDestroyBuffer(dev, terrainVertBuf, nullptr);
vkFreeMemory(dev, grassVertMem, nullptr);
vkDestroyBuffer(dev, grassVertBuf, nullptr);
vkFreeMemory(dev, grassVertInstMem, nullptr);
vkDestroyBuffer(dev, grassVertInstBuf, nullptr);
vkFreeMemory(dev, skyVertMem, nullptr);
vkDestroyBuffer(dev, skyVertBuf, nullptr);
vkDestroyDevice(dev, nullptr);
vkDestroySurfaceKHR(instance, surf, nullptr);
if (debug) {
DestroyDebugUtilsMessengerEXT(instance, debugMessenger, nullptr);
}
vkDestroyInstance(instance, nullptr);
glfwDestroyWindow(w);
glfwTerminate();
} | 35.46832 | 130 | 0.699184 | [
"vector"
] |
69e2b506f1d27fab4d24911430bf3017ef2fc383 | 1,168 | cpp | C++ | LeetCode/C++/General/Easy/MinimumAbsoluteDifference/main.cpp | busebd12/InterviewPreparation | e68c41f16f7790e44b10a229548186e13edb5998 | [
"MIT"
] | null | null | null | LeetCode/C++/General/Easy/MinimumAbsoluteDifference/main.cpp | busebd12/InterviewPreparation | e68c41f16f7790e44b10a229548186e13edb5998 | [
"MIT"
] | null | null | null | LeetCode/C++/General/Easy/MinimumAbsoluteDifference/main.cpp | busebd12/InterviewPreparation | e68c41f16f7790e44b10a229548186e13edb5998 | [
"MIT"
] | null | null | null | #include <algorithm>
#include <iostream>
#include <vector>
using namespace std;
/*
* Approach: we sort the input vector and then make two passes over the input vector.
* In the first pass, we find the minimum absolute difference between any two numbers.
* In the second pass, we find all pairs of numbers that have a difference equal to the
* absolute minimum difference and add them to the vector<vector<int>> result. Finally,
* we return our vector<vector<int>> result.
*
* Time complexity: O(n log n)
* Space complexity: O(1)
*/
vector<vector<int>> minimumAbsDifference(vector<int> & arr)
{
vector<vector<int>> result;
if(arr.empty())
{
return result;
}
sort(arr.begin(), arr.end());
int difference=numeric_limits<int>::max();
auto n=arr.size();
for(auto i=1;i<n;++i)
{
int currentDifference=arr[i] - arr[i-1];
difference=min(difference, currentDifference);
}
for(auto i=1;i<n;++i)
{
int currentDifference=arr[i] - arr[i-1];
if(currentDifference==difference)
{
result.push_back({{arr[i-1], arr[i]}});
}
}
return result;
} | 23.36 | 87 | 0.632705 | [
"vector"
] |
69e6743a0abe006c927cea47616a40cb52f46199 | 939 | cpp | C++ | c++/solution1405.cpp | imafish/leetcodetests | abee2c2d6c0b25a21ef4294bceb7e069b6547b85 | [
"MIT"
] | null | null | null | c++/solution1405.cpp | imafish/leetcodetests | abee2c2d6c0b25a21ef4294bceb7e069b6547b85 | [
"MIT"
] | null | null | null | c++/solution1405.cpp | imafish/leetcodetests | abee2c2d6c0b25a21ef4294bceb7e069b6547b85 | [
"MIT"
] | null | null | null | #include "afx.h"
using namespace std;
class Solution
{
public:
string longestDiverseString(int a, int b, int c)
{
string result;
vector<std::pair<int, char>> data{{a, 'a'}, {b, 'b'}, {c, 'c'}};
bool going = true;
while (going)
{
sort(data.begin(), data.end(), [](auto &l, auto &r) -> bool
{ return l.first > r.first; });
going = false;
for (auto &[cnt, ch] : data)
{
if (cnt == 0)
{
continue;
}
int len = result.length();
if (len >= 2 && result[len - 1] == ch && result[len - 2] == ch)
{
continue;
}
going = true;
cnt--;
result.push_back(ch);
break;
}
}
return result;
}
};
| 23.475 | 79 | 0.366347 | [
"vector"
] |
69eaf559f69d785e7ee32bae2bff56fa05716655 | 81,392 | cpp | C++ | tcs/direct_steam_receivers.cpp | mfwatki2/ssc | 289a6df2e0563bbad588da947e2a9fcc3f9dda55 | [
"MIT"
] | 3 | 2017-09-04T12:19:13.000Z | 2017-09-12T15:44:38.000Z | tcs/direct_steam_receivers.cpp | mfwatki2/ssc | 289a6df2e0563bbad588da947e2a9fcc3f9dda55 | [
"MIT"
] | 1 | 2018-03-26T06:50:20.000Z | 2018-03-26T06:50:20.000Z | tcs/direct_steam_receivers.cpp | mfwatki2/ssc | 289a6df2e0563bbad588da947e2a9fcc3f9dda55 | [
"MIT"
] | 2 | 2018-02-12T22:23:55.000Z | 2018-08-23T07:32:54.000Z | /*******************************************************************************************************
* Copyright 2017 Alliance for Sustainable Energy, LLC
*
* NOTICE: This software was developed at least in part by Alliance for Sustainable Energy, LLC
* (“Alliance”) under Contract No. DE-AC36-08GO28308 with the U.S. Department of Energy and the U.S.
* The Government retains for itself and others acting on its behalf a nonexclusive, paid-up,
* irrevocable worldwide license in the software to reproduce, prepare derivative works, distribute
* copies to the public, perform publicly and display publicly, and to permit others to do so.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted
* provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, the above government
* rights notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, the above government
* rights notice, this list of conditions and the following disclaimer in the documentation and/or
* other materials provided with the distribution.
*
* 3. The entire corresponding source code of any redistribution, with or without modification, by a
* research entity, including but not limited to any contracting manager/operator of a United States
* National Laboratory, any institution of higher learning, and any non-profit organization, must be
* made publicly available under this license for as long as the redistribution is made available by
* the research entity.
*
* 4. Redistribution of this software, without modification, must refer to the software by the same
* designation. Redistribution of a modified version of this software (i) may not refer to the modified
* version by the same designation, or by any confusingly similar designation, and (ii) must refer to
* the underlying software originally provided by Alliance as “System Advisor Model” or “SAM”. Except
* to comply with the foregoing, the terms “System Advisor Model”, “SAM”, or any confusingly similar
* designation may not be used to refer to any modified version of this software or any modified
* version of the underlying software originally provided by Alliance without the prior written consent
* of Alliance.
*
* 5. The name of the copyright holder, contributors, the United States Government, the United States
* Department of Energy, or any of their employees may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER,
* CONTRIBUTORS, UNITED STATES GOVERNMENT OR UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR
* EMPLOYEES, 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 <algorithm>
#include "direct_steam_receivers.h"
#include "sam_csp_util.h"
//#include <shared/lib_util.h>
#include "lib_util.h"
//#include "waterprop.h"
#include "water_properties.h"
// void flow_patterns_DSR( int n_panels, int flow_type, util::matrix_t<int> & flow_pattern );
// double Nusselt_FC( double ksDin, double Re );
double h_mixed( HTFProperties &air, double T_node_K, double T_amb_K, double v_wind, double ksD, double hl_ffact, double P_atm_Pa,
double grav, double beta, double h_rec, double d_rec, double m );
double Flow_Boiling( double T_sat, double T_surf, double G, double d, double x_in, double q_t_flux, double rho_l, double rho_v, double k_l,
double mu_l, double Pr_l, double enth_l, double h_diff, double grav, double mu_v, double c_v, double k_v, double RelRough );
bool C_DSG_macro_receiver::Initialize_Receiver( int n_panels, double d_rec, double per_rec, double hl_ffact, int flowtype, bool is_iscc, int n_panels_sh, double sh_h_frac )
{
m_n_panels = n_panels;
m_is_iscc = is_iscc;
// The number of receiver panels should not be less than 12
if( !is_iscc && m_n_panels < 12 ) {return false;}
// Pass message about error?
// ISCC can interpolate flux for less than 12 panels - can think about adding this for CSP-only DSG
m_d_rec = d_rec;
m_per_rec = per_rec;
m_hl_ffact = hl_ffact;
m_flowtype = flowtype;
m_per_panel = m_per_rec / (double)m_n_panels;
if(m_is_iscc)
{
m_sh_h_frac = sh_h_frac;
m_n_panels_sh = n_panels_sh;
}
else
{
m_sh_h_frac = 0.0;
m_n_panels_sh = 0;
}
return true;
}
bool C_DSG_Boiler::Initialize_Boiler( C_DSG_macro_receiver dsg_rec, double h_rec_full, double d_tube, double th_tube,
double eps_tube, double mat_tube, double h_sh_max, double th_fin,
double L_fin, double eps_fin, double mat_fin, bool is_iscc_sh )
{
m_dsg_rec = dsg_rec;
m_d_tube = d_tube;
m_th_tube = th_tube;
m_eps_tube = eps_tube;
m_mat_tube = mat_tube;
tube_material.SetFluid((int)m_mat_tube);
m_th_fin = th_fin;
m_L_fin = L_fin;
m_eps_fin = eps_fin;
m_mat_fin = mat_fin;
m_h_sh_max = h_sh_max;
if( m_dsg_rec.is_iscc() )
{
if(is_iscc_sh) // ISCC: Superheater
{
m_n_panels = m_dsg_rec.Get_n_panels_sh();
}
else // ISCC: Boiler
{
m_n_panels = m_dsg_rec.Get_n_panels_rec();
}
} // DSG
else
{
m_n_panels = m_dsg_rec.Get_n_panels_rec();
}
int n_lines = 0;
if( m_dsg_rec.is_iscc() )
{
if( is_iscc_sh ) // ISCC superheater
{
util::matrix_t<int> flow_pattern_temp;
// Get full-receiver flow pattern
CSP::flow_patterns(m_dsg_rec.Get_n_panels_rec(), 0, m_dsg_rec.Get_flowtype(), n_lines, flow_pattern_temp);
m_n_fr = n_lines;
m_nodes = m_n_panels / m_n_fr;
flow_pattern.resize_fill(m_n_fr, m_nodes, -1);
for( int i = 0; i < m_n_fr; i++ )
{
for( int j = 0; j < m_nodes; j++ )
{
flow_pattern.at(i, j) = flow_pattern_temp.at(i, (m_dsg_rec.Get_n_panels_rec() - m_n_panels)/2 + j);
}
}
m_h_rec.resize_fill(m_n_panels, h_rec_full*m_dsg_rec.Get_sh_h_frac());
}
else // ISCC Boiler
{
CSP::flow_patterns(m_n_panels, 0, m_dsg_rec.Get_flowtype(), n_lines, flow_pattern);
m_n_fr = n_lines;
m_nodes = m_n_panels / m_n_fr;
int m_nodes_sh = m_dsg_rec.Get_n_panels_sh() / m_n_fr;
m_h_rec.resize(m_n_panels);
for( int j = 0; j < m_n_fr; j++ )
{
for( int i = 0; i < m_nodes; i++ )
{
if(i >= m_nodes - m_nodes_sh)
m_h_rec[i + m_nodes*j] = h_rec_full*(1.0 - m_dsg_rec.Get_sh_h_frac());
else
m_h_rec[i + m_nodes*j] = h_rec_full;
}
}
}
}
else
{
// Get flow pattern
CSP::flow_patterns(m_n_panels, 0, m_dsg_rec.Get_flowtype(), n_lines, flow_pattern);
m_n_fr = n_lines;
m_nodes = m_n_panels / m_n_fr;
m_h_rec.resize_fill(m_n_panels, h_rec_full); //[m] Height of receiver section - can vary per panel in iscc model
}
/* Sorted number of independent panels in each flow path - applied when m_n_comb > 1 and panels should be modeled together
/ Example: For 12 panel receiver with 2 parallel flow panels:*/
flow_pattern_adj.resize( m_n_fr, m_nodes );
for( int j = 0; j < m_n_fr; j++ )
for( int i = 0; i < m_nodes; i++ )
flow_pattern_adj.at( j, i ) = i + (m_nodes)*(j);
m_d_in = m_d_tube - 2.0*m_th_tube; //[m] Inner diameter of tube
m_L = m_h_rec; //[m] Distance through one node
m_A_n_proj.resize(m_n_panels);
m_A_n_in_act.resize(m_n_panels);
m_A_fin.resize(m_n_panels);
for( int i = 0; i < m_n_panels; i++ )
{
m_A_n_proj[i] = m_d_tube * m_L[i]; //[m^2] Projected Area ** Node ** - can vary per panel in iscc model
m_A_n_in_act[i] = CSP::pi*m_d_in*0.5*m_L[i]; //[m^2] ACTIVE inside surface area - nodal - can vary per panl in iscc model
m_A_fin[i] = m_L_fin*0.5*m_L[i]; //[m^2] Area of 1/2 of fin - can vary per panel in iscc model
}
//m_A_n_proj = m_d_tube * m_L.at(0); //[m^2] Projected Area ** Node **
//m_A_n_in_act = CSP::pi*m_d_in*0.5*m_L.at(0); //[m^2] ACTIVE inside surface area - nodal
//m_A_fin = m_L_fin*0.5*m_L.at(0); //[m^2] Area of 1/2 of fin
// DELSOL flux map has already included absorptance, so set to 1 here
m_abs_tube = m_abs_fin = 1.0;
m_m_mixed = 3.2; //[-] Exponential for calculating mixed convection
m_fin_nodes = 10; //[-] Model fin with 10 nodes
m_per_panel = m_dsg_rec.Get_per_panel();
m_nodes = m_n_panels / m_n_fr;
double w_assem = m_d_tube + m_L_fin; //[m] Total width of one tube/fin assembly
m_n_par = (int) (m_per_panel/w_assem); //[-] Number of parallel assemblies per panel
m_A_t_cs = CSP::pi*pow(m_d_in,2)/4.0; //[m^2] Cross-sectional area of tubing
m_ksD = (m_d_tube/2.0)/m_dsg_rec.Get_d_rec(); //[-] The effective roughness of the cylinder [Siebers, Kraabel 1984]
m_rel_rough = (4.5E-5)/m_d_in; //[-] Relative roughness of the tubes: http.www.efunda/formulae/fluids/roughness.cfm
m_L_eff_90 = 30.0; //[m] Effective length for pressure drop for 90 degree bend
m_L_eff_45 = 16.0; //[m] Effective length for pressure drop for 45 degree bend
if( m_L_fin < 0.0001 )
{
m_model_fin = false;
m_dx_fin = -1.234;
m_q_fin = 0.0;
}
else
{
m_model_fin = true;
m_dx_fin = (m_L_fin/2.0)/( (double) m_fin_nodes -1.0); //[m] Distance between nodes in numerical fin model
}
m_L_fin_eff = 0.5*m_L_fin; //[m] Half the distance between tubes = 1/2 fin length. Assuming symmetric, so it is all that needs to be modeled
m_q_inc.resize(m_n_panels);
m_q_inc.fill(0.0);
m_q_adj.resize( m_n_fr*m_nodes );
m_q_adj.fill( 0.0 );
m_q_conv.resize( m_n_fr*m_nodes );
m_q_conv.fill( 0.0 );
m_q_rad.resize( m_n_fr*m_nodes );
m_q_rad.fill( 0.0 );
m_q_abs.resize( m_n_fr*m_nodes );
m_q_abs.fill( 0.0 );
m_x_path_out.resize( m_n_fr );
m_x_path_out.fill( 0.0 );
m_h_path_out.resize( m_n_fr );
m_h_path_out.fill( 0.0 );
m_P_path_out.resize( m_n_fr );
m_P_path_out.fill( 0.0 );
m_m_dot_path.resize( m_n_fr );
m_m_dot_path.fill( 0.0 );
m_q_wf_total.resize( m_n_fr );
m_q_wf_total.fill( 0.0 );
ambient_air.SetFluid( ambient_air.Air );
return true;
}
void C_DSG_Boiler::Get_Other_Boiler_Outputs( double & m_dot_in, double & T_max, double & q_out, double & q_in, double & q_conv, double & q_rad, double & q_abs )
{
m_dot_in = mO_m_dot_in;
T_max = mO_b_T1_max;
q_out = mO_b_q_out;
q_in = mO_b_q_in;
q_conv = mO_b_q_conv;
q_rad = mO_b_q_rad;
q_abs = mO_b_q_abs;
return;
}
bool C_DSG_Boiler::Solve_Boiler( double I_T_amb_K, double I_T_sky_K, double I_v_wind, double I_P_atm_Pa, double I_T_fw_K, double I_P_in_pb_kPa,
double I_x_out_target, double I_m_dot_in, double I_m_dot_lower, double I_m_dot_upper, bool I_checkflux,
util::matrix_t<double> & I_q_inc_b, int & O_boiler_exit, double & O_eta_b, double & O_T_boil_K, double & O_m_dot_vapor,
double & O_h_fw_kJkg, double & O_P_b_out_kPa, double & O_hx1_kJkg, double & O_rho_fw, double & O_q_out_W, double & O_T_in )
{
double T_amb = I_T_amb_K; //[K] Ambient temperature
double T_sky = I_T_sky_K; //[K] Sky temperature
double v_wind = I_v_wind; //[m/s] Wind Speed
double P_atm = I_P_atm_Pa; //[Pa] Ambient Pressure
double T_fw = I_T_fw_K; //[K] Feedwater temperature
double P_in_pb = I_P_in_pb_kPa; //[kPa] Inlet pressure
double x_out_target = I_x_out_target; //[-] Outlet quality
double m_dot_in = I_m_dot_in; //[kg/s] Guessed mass flow rate
double m_dot_lower = I_m_dot_lower; //[kg/s] Lower limit on possible mass flow rates
double m_dot_upper = I_m_dot_upper; //[kg/s] Upper limit on possible mass flow rates
bool checkflux = I_checkflux; //[-] Is this call just to check if enough flux
// Set outputs to values that will indicate model has not solved
O_boiler_exit = 0;
O_eta_b = -999.9;
O_T_boil_K = -999.9;
O_m_dot_vapor = -999.9;
O_h_fw_kJkg = -999.9;
O_P_b_out_kPa = -999.9;
O_hx1_kJkg = -999.9;
O_rho_fw = -999.9;
O_q_out_W = -999.9;
O_T_in = -999.9;
mO_m_dot_in = -999.9;
mO_b_T1_max = -999.9;
mO_b_q_out = -999.9;
mO_b_q_in = -999.9;
mO_b_q_conv = -999.9;
mO_b_q_rad = -999.9;
mO_b_q_abs = -999.9;
// *************************************************************
double energy_in = 0.0;
for( int i = 0; i < m_n_panels; i++ )
{
m_q_inc.at(i) = I_q_inc_b.at(i);
energy_in += m_per_panel*m_h_rec.at(i)*m_q_inc.at(i);
}
// Create new flux arrays that allow for multiple panels in parallel flow
// Q_adj sorts flux into flow path order and is indexed with Flow_Pat_Adj
for( int j = 0; j < m_n_fr; j++ )
{
for( int i = 0; i < m_nodes; i++ )
{
m_q_adj.at(flow_pattern_adj.at(j, i)) = m_q_inc.at(flow_pattern.at(j, i));
}
}
double beta = 1.0 / T_amb; //[1/K] Volumetric expansion coefficient
// [W/m^2-K] Calculates combined free and forced convection coefficient, same as used in fin HT model
double h_c = h_mixed( ambient_air, T_fw, T_amb, v_wind, m_ksD, m_dsg_rec.Get_hl_ffact(), P_atm, CSP::grav, beta, m_h_rec.at(0), m_dsg_rec.Get_d_rec(), m_m_mixed );
// Check if enough flux is available to produce positive net energy through each flow path
for( int j = 0; j < m_n_fr; j++ )
{
double q_wf_total = 0.0;
for( int i = 0; i < m_nodes; i++ )
{
m_q_conv.at(flow_pattern_adj.at(j, i)) = h_c*(m_A_n_proj[flow_pattern_adj.at(j,i)] + 2.0*m_A_fin[flow_pattern_adj.at(j,i)])*(T_fw - T_amb); //[W] Convective heat transfer
m_q_rad.at( flow_pattern_adj.at(j,i)) = m_eps_tube*CSP::sigma*(m_A_n_proj[flow_pattern_adj.at(j,i)]+2.0*m_A_fin[flow_pattern_adj.at(j,i)])*(0.5*(pow(T_fw,4) - pow(T_sky,4)) + 0.5*(pow(T_fw,4) - pow(T_amb,4))); //[W] Radiative heat transfer: 8/10/11, view factor to ground ~ ambient (1/2)
m_q_abs.at( flow_pattern_adj.at(j,i)) = m_q_adj.at( flow_pattern_adj.at(j,i))*m_abs_tube*(m_A_n_proj[flow_pattern_adj.at(j,i)]+2.0*m_A_fin[flow_pattern_adj.at(j,i)]); //[W] Irradiance absorbed by panel
q_wf_total += m_q_abs.at( flow_pattern_adj.at(j,i)) - m_q_conv.at( flow_pattern_adj.at(j,i)) - m_q_rad.at( flow_pattern_adj.at(j,i)); //[W] Heat transfer to working fluid
}
if( q_wf_total < 0.0 )
{
O_boiler_exit = 2; // Set flag for controller
return false;
}
}
if( checkflux ) return true;
// Set bounds on possible mass flow rate guesses
double m_dot_min = m_dot_lower;
double m_dot_max = m_dot_upper;
// ************ Guess Average (w/r/t flow paths) Outlet Pressure *******
double P_out_guess = 0.99 * P_in_pb; //[kPa]
double diff_Pout = 999.0;
int iter_P_out = 0;
int iter_x = -9;
double diff_x_out, h_n_out_total, h_in;
diff_x_out = h_n_out_total = h_in = std::numeric_limits<double>::quiet_NaN();
double x_n_out = 999.0;
double P_out_avg=0;
double T_n_in, h_fw, rho_fw, T_in, T1_max;
T_n_in = h_fw = rho_fw = T_in = T1_max = std::numeric_limits<double>::quiet_NaN();
// Adjust steam drum pressure to equal calculated boiler outlet pressure
while ( fabs(diff_Pout) > 0.01 && iter_P_out < 20 )
{
iter_P_out++;
// Guess a new boiler outlet pressure based on previous results
if( iter_P_out > 1 )
{
P_out_guess = 0.5*P_out_guess + 0.5*P_out_avg;
// Can also reset mass flow rate guesses and limits
// If new pressure is lower then, by convention, feedwater enthalpy will be lower, requiring more specific energy into the flow
// to reach a specified quality, therefore, mass flow rate will decrease
if( P_out_avg < P_out_guess )
{
m_dot_lower = 0.95*m_dot_in;
m_dot_upper = m_dot_in;
m_dot_min = m_dot_lower;
m_dot_max = m_dot_upper;
}
else
{
m_dot_lower = m_dot_in;
m_dot_upper = 1.05*m_dot_in;
m_dot_min = m_dot_lower;
m_dot_max = m_dot_upper;
}
}
water_PQ( P_out_guess, 0.0, &wp );
double h_x0 = wp.enth; //[kJ/kg] Enthalpy of saturated liquid recirculating to steam drum
water_TP( T_fw, P_out_guess, &wp );
h_fw = wp.enth; rho_fw = wp.dens; //[kJ/kg] Enthalpy and [kg/m^3] density of feedwater entering steam drum
h_in = x_out_target*h_fw + (1.0 - x_out_target)*h_x0; //[kJ/kg] Energy balance to find enthalpy of feedwater/recirc mixture
//P(kPa),T(C),enth(kJ/kg),dens(kg/m3),inte(kJ/kg),entr(kJ/kg-K),cp(kJ/kg-K),cond(W/m-K),visc(kg/m-s)
water_PH( P_in_pb, h_in, &wp );
double rho_in = wp.dens; //[kg/m^3] Find density of mixture
double deltaP_in = rho_in*CSP::grav*m_L.at(flow_pattern_adj.at(0,0)); //[Pa] Hydrostatic pressure assuming water level is at top of tubes
//8/20/11 Need to account for the gravity head so we don't observe large pressure drops while not exceeding Dyreby props pressure limits
double P_in = (P_in_pb + deltaP_in/1000.0); //[kPa] Inlet pressure adding gravity head from steam drum
water_PH( P_in, h_in, &wp );
T_in = wp.temp; //[K] Temperature at first panel inlet
h_in = h_in*1000.0; //[J/kg] convert from kJ/kg
int iter_x = 0;
diff_x_out = 999.0;
int Pave_flag = 0;
int mdot_flag = 0;
int x_br_upper = 0;
int x_br_lower = 0;
bool mupflag = false;
bool mlowflag = false;
double y_m_upper, y_m_lower;
y_m_upper = y_m_lower = std::numeric_limits<double>::quiet_NaN();
// Adjust mass flow rate to reach target quality
// 297 -> TRNSYS GOTO
bool break_to_massflow_calc = false;
while( fabs(diff_x_out) > 0.0035 && iter_x < 20 )
{
break_to_massflow_calc = false;
iter_x++; //[-] Increase iteration counter
T1_max = 0.0; //[K]
double diff_m_dot = (m_dot_upper - m_dot_lower)/m_dot_upper;
if( iter_x > 1 )
{
if( Pave_flag==0 && mdot_flag == 0 )
{
if( mupflag && mlowflag )
{
if( diff_x_out > 0.0 )
{
x_br_upper = 1;
m_dot_upper = m_dot_in;
y_m_upper = diff_x_out;
}
else
{
x_br_upper = 1;
m_dot_lower = m_dot_in;
y_m_lower = diff_x_out;
}
m_dot_in = y_m_upper/(y_m_upper-y_m_lower)*(m_dot_lower-m_dot_upper) + m_dot_upper;
}
else
{
if( diff_x_out > 0.0 )
{
x_br_upper = 1;
m_dot_upper = m_dot_in;
mupflag = true;
y_m_upper = diff_x_out;
}
else
{
x_br_lower = 1;
m_dot_lower = m_dot_in;
mlowflag = true;
y_m_lower = diff_x_out;
}
m_dot_in = 0.5*m_dot_upper + 0.5*m_dot_lower;
}
}
else if( Pave_flag == 1 )
{
x_br_upper = 2;
m_dot_upper = m_dot_in;
m_dot_in = 0.5*m_dot_upper + 0.5*m_dot_lower;
}
else if( mdot_flag == 1)
{
x_br_lower = 2;
m_dot_lower = m_dot_in;
m_dot_in = 0.5*m_dot_upper + 0.5*m_dot_lower;
}
}
if( diff_m_dot < 0.01 )
{
if( m_dot_upper < 1.01*m_dot_min && x_br_lower==0 ) x_br_lower = 3;
if( m_dot_lower > 0.99*m_dot_max && x_br_upper==0 ) x_br_upper = 3;
// Should not occuer with enough iterations
// if( x_br_lower==1 && x_br_upper==1 )
// Exit quality is too high / Pressure drop is too higher
if( x_br_lower==1 && x_br_upper==2 )
{
O_boiler_exit = 3; // too much flux
return false;
}
// Exit quality too high // No upper limit on mass flow rate
else if( x_br_lower==1 && x_br_upper==3 )
{
O_boiler_exit = 3; // too much flux
return false;
}
// Mass flow rate too low for energy balance / Exit quality too low
else if( x_br_lower==2 && x_br_upper==1 )
{
O_boiler_exit = 2; // not enough flux
return false;
}
// Mass flow rate too low for energy balance / Pressure drop too high
else if( x_br_lower==2 && x_br_upper==2 )
{
O_boiler_exit = 3; // too much flux
return false;
}
// Mass flow rate too low for energy balance / No upper limit on mass flow rate
else if( x_br_lower==2 && x_br_upper==3 )
{
O_boiler_exit = 3; // too much flux
return false;
}
// No lower limit on mass flow rate / Exit quality too low
else if( x_br_lower==3 && x_br_upper==1 )
{
O_boiler_exit = 2; // not enough flux
return false;
}
// No lower limit on mass flow rate / Pressure drop too high
else if( x_br_lower==3 && x_br_upper==2 )
{
O_boiler_exit = 3; // too much flux
return false;
}
}
// Mass flow rate in one tube - assuming one flow path (for m_dot_total)
double m_dot_total = m_dot_in /( (double) m_n_par ); //[kg/s]
m_m_dot_path.fill( m_dot_total / (double) m_n_fr ); //[kg/s] mass flow rate in each flow path
double h_n_in, rho_n_in, P_n_in, dp, diff_T_ht, m_dot;
double h_n_out, P_out, rho_n_ave, u_n;
// Solve for outlet conditions of each flow path
for( int j = 0; j < m_n_fr; j++ )
{
h_n_in = h_in; //[J/kg] Inlet enthlapy of first node
T_n_in = T_in; //[K] Inlet temperature of first node
rho_n_in = rho_in; //[kg/m^3] Inlet density of first node
P_n_in = P_in*1000.0; //[Pa] Inlet pressure of first node
dp = 2.4E4; //[Pa] Guess small pressure drop
diff_T_ht = 45.0; //[K] Estimate of difference between surface temp and inlet temp
m_dot = m_m_dot_path.at(j); //[kg/s] Use m_dot so we don't have to carry array through
double T_1, grav_mult;
T_1 = grav_mult = std::numeric_limits<double>::quiet_NaN();
for( int i = 0; i < m_nodes; i++ ) // Now solve energy balance for each node (or panel) in flow path. Output of i is input to i+1
{
if(i==0)
T_1 = T_n_in + 45.0;
else
T_1 = T_n_in + 1.5*diff_T_ht;
if( i%2 == 1 )
grav_mult = -1.0; // For odd numbered panels, flow is downwards
else
grav_mult = 1.0; // For even numbered panels, flow is upwards
double diff_P_ave = 9999999.0; //[Pa] Set diff > tolerance
int iter_P_ave = 0; //[-] Set iteration counter
P_out = max(1.E6, P_n_in - dp); //[Pa] Guess outlet pressure of flow path
double P_ave = 0.5*P_n_in + 0.5*P_out; //[Pa] Guess average pressure through flow path
bool P_upguess = false; //[-] Has upper guess on pressure been set?
bool P_lowguess = false; //[-] Has lower guess on pressure been set?
double P_upper = P_n_in; //[Pa] Initial upper pressure is equal to inlet pressure
double P_lower = 500000.0; //[Pa] Some minimum outlet pressure
double diff_P_bracket = 999.0; //[Pa] Difference between upper and lower guesses
bool lowpres_flag = false; //[-] Did model trip due to low pressure
int P_br_low = 0; //[-] Flag to show how energy balanced solved
int Pave_flag = 0; //[-]
int mdot_flag = 0; //[-]
double P_b_min = 1.E6; //[Pa] Minimum boiler outlet pressure
double rho_n_out,T_in1;
rho_n_out = T_in1 = std::numeric_limits<double>::quiet_NaN();
// An average pressure of the node is used as one independent variable to calculate additional properties
// After pressure drop through node is calculated, want to make sure calculated average pressure is within some % of average used for props
while( fabs(diff_P_ave) > 0.001 && iter_P_ave < 125 )
{
// 348 -> GOTO NUMBER from TRNSYS
iter_P_ave++; //[-] Increase iteration counter
if(iter_P_ave > 1)
{
if( P_upguess && P_lowguess )
{
if(diff_P_ave < 0.0)
{
P_br_low = 1;
P_upper = P_ave;
}
else
P_upper = P_ave;
P_ave = 0.5*P_lower + 0.5*P_upper;
}
else
{
if(diff_P_ave < 0.0)
{
P_br_low = 1;
P_lower = P_ave;
P_lowguess = true;
}
else
{
P_upper = P_ave;
P_upguess = true;
}
P_ave = (P_n_in + P_out)/2.0;
}
P_ave = max(1.E6, P_ave);
P_out = 2.0*(P_ave - 0.5*P_n_in);
diff_P_bracket = (P_upper - P_lower)/P_lower;
}
// If a pressure near the minimum pressure has caused the code to guess a lower pressure, then flag and guess lower mass flow
if( P_upper < 1.01*P_b_min )
{
Pave_flag = 1;
break_to_massflow_calc = true;
break;
// GOTO 297
}
lowpres_flag = false; //[-] Reset flag marking an outlet pressure below allowed minimum
double diff_T_1 = 999.0; //[K] Set diff > tolerance
int iter_T_1 = 0; //[-] Initialize iteration counter
double T_1_max = 800.0; //[K] Set some maximum allowable surface temperature to control iteration
double G = m_dot/m_A_t_cs; //[kg/m^2-s] Quantity in boiling correlation
// Set limits on surface temperature iteration
double T_1_upper = T_1_max; //[K]
double T_1_lower = T_n_in-15.0; //[K]
double T_1_min = T_1_lower; //[K]
T_1 = min( max(T_1_lower, T_1), T_1_upper ); //[K]
double diff_T1_g = 999.9; //[K] Reset difference between upper and lower iteration limits
// Reset iteration logic and integer flags
bool Tupflag = false; //[-] Has a temperature difference at the upper bound been established
bool Tlowflag = false; //[-] Has a temperature difference at the lower bound been established
bool HT_flag = false; //[-] Did the energy balance encounter low heat transfer rates
bool enth_flag = false; //[-] Did the energy balance encounter high heat transfer rates
int T1_br_lower = 0; //[-] Flag to show how energy balance solved
int T1_br_upper = 0; //[-] Flag to show how energy balance solved
// Reset temperature calculation errors at high and low guesses
double y_T_upper = 0.0; //[K] Temperature difference at upper bound
double y_T_lower = 0.0; //[K] Temperature difference at lower bound
// Need properties at saturated vapor in case some guess in energy balance results in x<1
water_PQ( min(P_ave/1000.0,19.E3),1.0, &wp );
double h_b_max = wp.enth; //[kJ/kg]
double T_2_guess, T_2; //[K]
double q_wf,x_n_ave,mu_l,mu_v,rho_l,f_fd; //[W]
q_wf = x_n_ave = mu_l = mu_v = rho_l = f_fd = std::numeric_limits<double>::quiet_NaN();
// This loop ensures that the outlet flow conditions for each panel are solved correctly by finding the correct T1 (outer surface temp)
while( fabs(diff_T_1/T_1) > 0.0025 && iter_T_1 < 50 )
{
iter_T_1++; //[-] Add to iteration counter
if(iter_T_1 > 1)
{
if( !HT_flag && !enth_flag )
{
if( fabs(diff_T_1)>50.0 ) // If error is very large, use bisection rather than false interpolation method
{
if( diff_T_1 > 0.0 ) // If old temp is higher than new temp, then old temp is too high, so:
{
T1_br_upper = 2;
T_1_upper = T_1; //[K] Set upper limit
}
else
{
T1_br_lower = 2;
T_1_lower = T_1; //[K] Set lower limit
Tlowflag = false;
}
T_1 = 0.5*T_1_lower + 0.5*T_1_upper; //[K] Bisection method to calculate next T_1 guess
}
else if( Tupflag && Tlowflag ) // If bracket results are set, use false position
{
if( diff_T_1 > 0.0 )
{
T1_br_upper = 2;
T_1_upper = T_1; //[K] Set upper limit
y_T_upper = diff_T_1; //[K] Set upper bracket result
}
else
{
T1_br_lower = 2;
T_1_lower = T_1; //[K] Set lower limit
y_T_lower = diff_T_1; //[K] Set lower bracket result
}
T_1 = y_T_upper/(y_T_upper-y_T_lower)*(T_1_lower-T_1_upper) + T_1_upper; //[K] False position method
}
else
{
if(diff_T_1 > 0.0)
{
T1_br_upper = 2;
T_1_upper = T_1; //[K] Set upper limit
y_T_upper = diff_T_1; //[K] Set upper bracket result
Tupflag = true; //[-] Set logic to show that upper bracket is set
}
else
{
T1_br_lower = 2;
T_1_lower = T_1; //[K] Set lower limit
y_T_lower = diff_T_1; //[K] Set upper bracket result
Tlowflag = true; //[-] Set logic to show that lower bracket is set
}
if(Tupflag && Tlowflag)
T_1 = y_T_upper/(y_T_upper-y_T_lower)*(T_1_lower-T_1_upper) + T_1_upper; //[K] False position method
else
{
T_1 = T_1 - diff_T_1;
if( T_1 < T_1_lower || T_1 > T_1_max )
T_1 = 0.5*T_1_lower + 0.5*T_1_upper;
else
T_1 = max( T_1_lower, min(T_1_max, T_1) );
}
}
}
else if( enth_flag )
{
T1_br_lower = 1;
T_1_lower = T_1;
T_1 = 0.5*T_1_lower + 0.5*T_1_upper; //[K] Bisection method
enth_flag = false;
}
else if( HT_flag )
{
T1_br_upper = 1;
T_1_upper = T_1;
T_1 = 0.5*T_1_lower + 0.5*T_1_upper;
HT_flag = false;
}
}
diff_T1_g = (T_1_upper - T_1_lower); //[K] If iteration window is small, look for way out
//If the bracket from which to guess to T_1 is small, then try to exit loop
if( diff_T1_g < 0.01 )
{
if( T_1_lower > T_1_max - 0.02 && T1_br_upper==0 ) T1_br_upper = 3;
if( T_1_upper < 0.02 + T_1_min && T1_br_lower==0 ) T1_br_lower = 3;
/* T1_br_lower==1: Enth_flag, the resulting enthalpy from the heat addition is too large for steam property look-up routine
!T1_br_lower==2: Calculated surface temperature is higher than guessed
!T1_br_lower==3: Lower limit has not been set during iteration and is equal to inlet temperature
!T1_br_upper==1: HT Flag, negative (or nearly negative) energy input to boiler
!T1_br_upper==2: Calculated surface temperature is lower than guessed
!T1_br_upper==3: Upper limit has not been set during iteration and is equal to maximum value
!*********** New 8/26/11 ************************************
! Basically means any energy gain to fluid will result in fluid reaching an enthalpy too high for fluid props. This should
! not happen since code is stopping if outlet on previous panel is greater than target temp
!IF( ((T1_br_lower==1).and.(T1_br_upper==1)) )THEN */
// Need to increase mass flow rate in hopes of eliminating enth_flag
if( T1_br_lower==1 && T1_br_upper==2 )
{
mdot_flag = 1;
break_to_massflow_calc = true;
break;
// GOTO 297
}
// Need to increase mass flow rate in hopes of eliminating enth_flag
if( T1_br_lower==1 && T1_br_upper==3 )
{
mdot_flag = 1;
break_to_massflow_calc = true;
break;
// GOTO 297
}
// Increase mass flow rate to bring down average fluid temp
else if( T1_br_lower==2 && T1_br_upper==1 )
{
mdot_flag = 1;
break_to_massflow_calc = true;
break;
// GOTO 297
}
// This should not happen given enough iterations
// ELSEIF( ((T1_br_lower==2).and.(T1_br_upper==2)) )THEN
// Increase mass flow rate
else if( T1_br_lower==2 && T1_br_upper==3 )
{
mdot_flag = 1;
break_to_massflow_calc = true;
break;
// GOTO 297
}
// Increase mass flow rate
else if( T1_br_lower==3 && T1_br_upper==1 )
{
mdot_flag = 1;
break_to_massflow_calc = true;
break;
// GOTO 297
}
// Increase mass flow rate
else if( T1_br_lower==3 && T1_br_upper==2 )
{
mdot_flag = 1;
break_to_massflow_calc = true;
break;
// GOTO 297
}
//Should not happen
//ELSEIF( ((T1_br_lower==3).and.(T1_br_upper==3)) )THEN
//*********************************************************************************
}
// Calculate energy inputs and outputs on surface (with guessed T_1)
if(m_model_fin)
{
// Add fin model
}
double h_c = h_mixed(ambient_air, T_1, T_amb, v_wind, m_ksD, m_dsg_rec.Get_hl_ffact(), P_atm, CSP::grav, beta, m_h_rec.at(flow_pattern_adj.at(j, i)), m_dsg_rec.Get_d_rec(), m_m_mixed); //[W/m^2-K] Function calculates combined free and forced convection coefficient, same as used in fin HT model
m_q_conv.at( flow_pattern_adj.at(j,i)) = h_c*m_A_n_proj[flow_pattern_adj.at(j,i)]*(T_1 - T_amb); //[W] Convective heat transfer
m_q_rad.at( flow_pattern_adj.at(j,i)) = m_eps_tube*CSP::sigma*m_A_n_proj[flow_pattern_adj.at(j,i)]*(0.5*(pow(T_1,4)-pow(T_sky,4))+0.5*(pow(T_1,4)-pow(T_amb,4))); //[W] Radiative heat transfer: 8/10/11, view factor to ground and ambient each 0.5
m_q_abs.at(flow_pattern_adj.at(j, i)) = m_q_adj.at(flow_pattern_adj.at(j, i))*m_abs_tube*m_A_n_proj[flow_pattern_adj.at(j,i)] + 2.0*m_q_fin*m_L.at(flow_pattern_adj.at(j, i)); //[W] Absorbed radiation + fin contributions
q_wf = m_q_abs.at(flow_pattern_adj.at(j,i)) - m_q_conv.at(flow_pattern_adj.at(j,i)) - m_q_rad.at(flow_pattern_adj.at(j,i)); //[W] Thermal power transferred to working fluid
// Equation: m_dot*(h_out - h_in) = q_wf
h_n_out = q_wf/m_dot + h_n_in; //[J/kg] Calculate outlet enthalpy according to calculated energy addition to working fluid
double h_n_ave = (h_n_in + h_n_out)/2.0; //[J/kg] Determine average enthalpy in node
// If the outlet enthalpy is greater than property routine can handle, flag and reguess T_1
if( h_n_out > 1.5*h_b_max*1000.0 )
{
enth_flag = true;
continue;
}
double mu_n_ave, k_n_ave, c_n_ave;
mu_n_ave = k_n_ave = c_n_ave = std::numeric_limits<double>::quiet_NaN();
bool props_succeed = true;
do
{
props_succeed = true;
water_PH( min(P_ave/1000.0,19.E3),h_n_ave/1000.0, &wp );
rho_n_ave = wp.dens; x_n_ave = wp.qual;
mu_n_ave = water_visc(wp.dens, wp.temp)*1.E-6;
k_n_ave = water_cond(wp.dens, wp.temp);
c_n_ave = wp.cp*1000.0;
T_in1 = wp.temp;
// Check for Dyreby props failing near vapor dome
if( c_n_ave < 0.0 || k_n_ave < 0.0 )
{
h_n_ave = 0.99 * h_n_ave;
props_succeed = false;
}
} while( !props_succeed );
double q_t_flux = q_wf/m_A_n_in_act[flow_pattern_adj.at(j,i)]; //[W/m^2] Heat FLUX transferred to working fluid: required for boiling heat transfer correlation
u_n = m_dot/(rho_n_ave*m_A_t_cs); //[m/s] Velocity through tube
double h_l, k_l, c_l, h_v, rho_v, k_v, c_v, h_fluid;
h_l = k_l = c_l = h_v = rho_v = k_v = c_v = h_fluid = std::numeric_limits<double>::quiet_NaN();
if( x_n_ave < 1.0 && x_n_ave > 0.0 )
{
// Need props at saturated liquid for boiling correlations
water_PQ( min(P_ave/1000.0,19.E3), 0.0, &wp );
h_l = wp.enth*1000.0; rho_l = wp.dens;
mu_l = water_visc(wp.dens, wp.temp)*1.E-6;
k_l = water_cond(wp.dens, wp.temp);
c_l = wp.cp*1000.0;
// Need props at saturated vapor for boiling correlations
water_PQ( min(P_ave/1000.0,19.E3), 1.0, &wp );
h_v = wp.enth*1000.0; rho_v = wp.dens;
mu_v = water_visc(wp.dens, wp.temp)*1.E-6;
k_v = water_cond(wp.dens, wp.temp);
c_v = wp.cp*1000.0;
double h_diff = h_v - h_l; //[J/kg] Heat of Vaporization
double alpha_l = k_l/(rho_l*c_l); //[m^2/s] Thermal diffusivity of saturated liquid
double Pr_l = (mu_l/rho_l)/alpha_l; //[-] Prandtl number of saturated liquid
if( q_t_flux >= 0.0 )
{// Determine heat transfer coefficient for boiling flow
h_fluid = Flow_Boiling( T_in1,T_in1,G,m_d_in,x_n_ave,q_t_flux,rho_l,rho_v,k_l,mu_l,Pr_l,h_l,h_diff,CSP::grav,mu_v,c_v,k_v,m_rel_rough );
}
else
{
int iter_T_2 = 0;
double diff_T_2 = 999.9;
while( iter_T_2 < 20 && fabs(diff_T_2) > 0.01 )
{
iter_T_2++;
if( iter_T_1 == 1 ) T_2_guess = T_in1 - 1.0; //[K] If first iteration on energy balance, then T_2 is not set
else T_2_guess = T_2;
h_fluid = Flow_Boiling( T_in1,T_2_guess,G,m_d_in,x_n_ave,q_t_flux,rho_l,rho_v,k_l,mu_l,Pr_l,h_l,h_diff,CSP::grav,mu_v,c_v,k_v,m_rel_rough );
h_fluid = max( k_n_ave/m_d_in, h_fluid );
double R_conv = 1.0/(h_fluid * m_A_n_in_act[flow_pattern_adj.at(j,i)]); //[K/W] Thermal resistance to convection
T_2 = q_wf*R_conv + T_in1;
diff_T_2 = (T_2_guess - T_2)/T_2; //[-]
} // End iteration on T_2 and h_fluid for condensing flow
} // End if/then to find h_fluid for either condensing or boiling flow
} // End equations to find h_fluid for 2-phase flow
else
{
double Re = rho_n_ave*u_n*m_d_in / mu_n_ave; //[-] Reynolds number
f_fd = pow( (-2.0*log10(2.0*m_rel_rough/7.54 - 5.02*log10(2.0*m_rel_rough/7.54 + 13.0/Re)/Re)), -2); //[-] (Moody) friction factor (Zigrang and Sylvester)
double alpha_n = k_n_ave/(rho_n_ave*c_n_ave); //[m^2/s] Thermal diffusivity of fluid
double Pr = mu_n_ave/(alpha_n*rho_n_ave); //[-] Prandtl number
double Nusselt = ((f_fd/8.0)*(Re-1000.0)*Pr)/(1.0+12.7*sqrt(f_fd/8.0)*(pow(Pr,2.0/3.0)-1.0)); //[-] Turbulent Nusselt number (Gnielinski)
h_fluid = Nusselt*k_n_ave/m_d_in; //[W/m^2-K] Convective heat transfer coefficient
} // End equations to find h_fluid for single phase flow
h_fluid = max( k_n_ave/m_d_in, h_fluid );
double R_conv = 1.0 / (h_fluid * m_A_n_in_act[flow_pattern_adj.at(j,i)]); //[K/W] Thermal resistance to convection
T_2 = q_wf*R_conv + T_in1; //[K] Calculate T_2
double k_n = tube_material.cond( (T_1+T_2)/2.0 ); //[W/m-K] Conductivity of tube using average temperature
double R_n = log(m_d_tube / m_d_in) / (k_n*2.0*CSP::pi*m_L.at(flow_pattern_adj.at(j, i)) / 2.0); //[K/W] Thermal resistance of ACTIVE tube
diff_T_1 = T_1 - (T_2 + q_wf*R_n); //[K] Calculate difference between assumed T_1 and calculated T_1
} // End tube energy balance iteration
if( break_to_massflow_calc )
break;
if(x_n_ave < -1.0)
{
x_n_out = -10.0;
water_PH( min(P_out/1000.0,19.E3),h_n_out/1000.0,&wp );
rho_n_out = wp.dens;
}
else if(x_n_ave > 1.0)
{
x_n_out = 10.0;
water_PH( min(P_out/1000.0,19.E3),h_n_out/1000.0,&wp );
rho_n_out = wp.dens;
}
else
{
water_PH( min(P_out/1000.0,19.E3),h_n_out/1000.0,&wp );
rho_n_out = wp.dens; x_n_out = wp.qual;
}
double deltaP_tube = std::numeric_limits<double>::quiet_NaN();;
// Calculate the pressure drop through the panel
if( x_n_ave < 1.0 && x_n_ave > 0.0 ) // 2-Phase pressure drop
{
// Frictional pressure drop equations taken from Chexal et al. pages 7-6, 7-7, 7-9
//double mu_f = (1.0 - x_n_ave)*mu_l + x_n_ave*mu_v; //[kg/m-s] Mixture viscosity
double Re_LO = G*m_d_in / mu_l; //[-] Liquid only Reynolds number
//double Re_TP = G*m_d_in / mu_f; //[-] Mixture Reynolds number
double f_wLO = 0.0791/pow(Re_LO,0.25); //[-] Liquid only friction factor: Blasius single-phase Fanning friction factor
double f_wTP = f_wLO; //[-] 2-phase friction factor defined as liquid
double phi_LOsq = f_wTP*rho_l/(f_wLO*rho_n_ave); //[-] 2-phase friction multiplier
double dpdz_fLO = 4.0/m_d_in*0.5*f_wLO*G*G/rho_l; //[-] Liquid-only pressure drop
double dpdx_fTP = dpdz_fLO*phi_LOsq; //[-] 2-phase friction factor
double dpdx_grav = grav_mult*rho_n_ave*CSP::grav; //[Pa/m] Pressure due to elevation
double dp_acc = G*G*(1.0/rho_n_out - 1.0/rho_n_in); //[Pa/m] Pressure loss due to acceleration of fluid
deltaP_tube = (dpdx_fTP + dpdx_grav)*m_L.at(flow_pattern_adj.at(j, i)) + dp_acc + (dpdx_fTP*m_L_eff_90*m_d_in*4.0 + dpdx_fTP*m_L_eff_45*m_d_in*2.0); //[Pa] Pressure loss through tube
} // End 2-phase pressure drop calcs
else
{
deltaP_tube = (f_fd*m_L.at(flow_pattern_adj.at(j, i))*rho_n_ave*pow(u_n, 2) / (2.0*m_d_in)) + 2.0*(f_fd*m_L_eff_45*rho_n_ave*pow(u_n, 2) / 2.0) + 4.0*(f_fd*m_L_eff_90*rho_n_ave*pow(u_n, 2) / 2.0); //[Pa] Pressure loss through tube
deltaP_tube = deltaP_tube + grav_mult*rho_n_ave*CSP::grav*m_L.at(flow_pattern_adj.at(j, i));
}
P_out = P_n_in - deltaP_tube; //[Pa] Outlet pressure
diff_P_ave = (P_ave - (P_n_in+P_out)/2.0)/P_n_in; //[Pa] Difference between ave. pressure guessed and ave. pressure calculated
} // Average pressure iteration
if( break_to_massflow_calc )
break;
// Don't let boiler approach superheater: it affects the temperature limits on the energy balance
if( x_n_out > 0.85 && i < m_nodes - 1 )
{
mdot_flag = 1;
break_to_massflow_calc = true;
break;
// GOTO 297 -->> where does this go?
}
P_n_in = P_out; //[Pa] Calculate inlet pressure of next node
h_n_in = h_n_out; //[J/kg] Set inlet enthalpy for next node
rho_n_in = rho_n_out; //[kg/m^3] Set inlet density for next node
bool props_succeed = true;
do
{
props_succeed = true;
water_PH( min(P_out/1000.0,19.E3),h_n_in/1000.0,&wp);
T_n_in = wp.temp; //[K] Calculate temperature corresponding to outlet enthalpy and pressure
// Check for Dyreby props failing near vapor dome
if( T_n_in < 0.0 )
{
h_n_in = 0.999 * h_n_in;
props_succeed = false;
}
} while( !props_succeed );
diff_T_ht = max( 0.0, T_1 - T_n_in ); //[K] Difference between surface temp and inlet temp: used to estimate T_1 of next node
T1_max = max( T1_max, T_n_in + (T_1 - T_in1) ); //[K] Track maximum temperature
// Tfin_max_out = max( Tfin_max_out, Tfin_max )
} // End evaluation of 1 flow path
if( break_to_massflow_calc )
break;
double uplast_mult = std::numeric_limits<double>::quiet_NaN();;
if( m_nodes%2 == 0 ) uplast_mult = 1.0;
else uplast_mult = 0.0;
m_x_path_out.at(j) = x_n_out; //[-] Outlet quality of path
m_h_path_out.at(j) = h_n_out; //[J/kg] Keep track of enthalpy outlet of flow path
m_P_path_out.at(j) = P_out - uplast_mult*rho_n_ave*CSP::grav*m_L.at(flow_pattern_adj.at(j, m_nodes-1)); //[Pa] Keep track of pressure outlet of flow path
} // End evaluation of flow paths
if( break_to_massflow_calc )
continue;
double P_path_out_sum = 0.0;
for( int i = 0; i < m_n_fr; i++ )
P_path_out_sum += m_P_path_out.at(i);
P_out_avg = min( P_path_out_sum/((double)m_n_fr)/1.E3, 19.E3 ); //[kPa] Average (flow paths) outlet pressure
// All flow paths have been solved (with equal pressure drops), so complete cumulative calculations to determine final mixed enthalpy
double h_by_m = 0.0; //[W] Enthalpy-mass flow rate product
for( int i = 0; i < m_n_fr; i++ )
h_by_m = h_by_m + m_h_path_out.at(i)*m_m_dot_path.at(i);
h_n_out_total = h_by_m / m_dot_total; //[J/kg] Total mass flow rate / mixed enthalpy product
// 7.15.14, twn: add report for water error code
int water_error = water_PH( P_out_avg, h_n_out_total/1000.0, &wp );
x_n_out = wp.qual;
diff_x_out = x_out_target - x_n_out;
} // End loop to Adjust mass flow rate to reach target quality
diff_Pout = (P_out_guess - P_out_avg)/P_out_guess;
} // End total boiler outlet pressure iteration
if( iter_x == 20 && fabs(diff_x_out) > 0.0035 )
{
// Message: Boiler model did not converge on the correct quality
}
double energy_out = m_dot_in*(h_n_out_total - h_in); //[W] Energy transferred to steam
double m_dot_v_total = x_n_out*m_dot_in; //[kg/s] Total mass flow rate of vapor
//double m_dot_l_total = m_dot_in - m_dot_v_total; //[kg/s] Total mass flow rate of liquid
//m_q_conv.resize( m_n_fr*m_comb_nodes, 1 );
double q_conv_sum = 0.0, q_rad_sum = 0.0, q_abs_sum = 0.0;
for( int i = 0; i < m_n_fr*m_nodes; i++ )
{
q_conv_sum += m_q_conv.at( i );
q_rad_sum += m_q_rad.at( i );
q_abs_sum += m_q_abs.at( i );
}
double q_conv_boiler = q_conv_sum*(double)m_n_par/1.E6; //[MW] Total convective loss from boiler
double q_rad_boiler = q_rad_sum*(double)m_n_par/1.E6; //[MW] Total radiative loss from boiler
double q_abs_boiler = q_abs_sum*(double)m_n_par/1.E6; //[MW] Total energy rate absorbed by boiler
double eta_rec = energy_out / energy_in; //[-] Efficiency of receiver
water_PQ( P_out_avg, 1.0, &wp );
double h_x1 = wp.enth; //[kJ/kg] Superheater inlet enthalpy
O_eta_b = eta_rec;
O_T_boil_K = T_n_in;
O_m_dot_vapor = m_dot_v_total;
O_h_fw_kJkg = h_fw;
O_P_b_out_kPa = P_out_avg;
O_hx1_kJkg = h_x1;
O_rho_fw = rho_fw;
O_q_out_W = energy_out;
O_T_in = T_in;
mO_m_dot_in = m_dot_in;
mO_b_T1_max = T1_max;
mO_b_q_out = energy_out;
mO_b_q_in = energy_in;
mO_b_q_conv = q_conv_boiler;
mO_b_q_rad = q_rad_boiler;
mO_b_q_abs = q_abs_boiler;
/*
!!Outputs
XOUT(1) = m_dot_in ![kg/s] Total mass flow rate through boiler (liquid and vapor)
XOUT(2) = m_dot_v_total ![kg/s] Total mass flow rate of vapor exiting boiler
XOUT(3) = m_dot_l_total ![kg/s] Total mass flow rate of liquid exiting boiler
XOUT(4) = eta_rec ![-] Efficiency of receiver
XOUT(5) = T1_max ![K] Maximum calculated boiler tube outer surface temperature
XOUT(6) = Tfin_max_out ![K] Maximum fin (or rib) temperature (if applicable)
XOUT(7) = T_n_in ![K] Saturation Temperature
XOUT(8) = Energy_out ![W] Energy transferred to steam
XOUT(9) = eta_fin ![-] Efficiency of fin between tubes (if applicable)
XOUT(10) = Energy_in ![W] Flux * receiverArea
XOUT(11) = maxval(x_path_out) ![-] Maximum outlet quality
XOUT(12) = minval(x_path_out) ![-] Minimum outlet quality
XOUT(13) = P_out_avg ![kPa] Average outlet pressure
XOUT(14) = T_in ![K] Boiler Inlet Temperature
XOUT(15) = rho_n_out ![kg/m^3] Outlet Density
XOUT(16) = h_fw ![kJ/kg] Feedwater enthalpy
XOUT(17) = rho_fw ![kg/m^3] Feedwater density
XOUT(18) = h_x1 ![kJ/kg] Superheater inlet enthalpy
XOUT(19) = Q_conv_boiler ![MW] Total convective loss from boiler
XOUT(20) = Q_rad_boiler ![MW] Total radiative loss from boiler
XOUT(21) = Q_abs_boiler ![MW] Total energy rate absorbed by boiler */
return true;
}
void C_DSG_Boiler::Get_Other_Superheater_Outputs( double & q_conv_MW, double & q_rad_MW, double & q_abs_MW, double & T_surf_max_K, double & v_exit, double & q_in )
{
q_conv_MW = mO_sh_q_conv;
q_rad_MW = mO_sh_q_rad;
q_abs_MW = mO_sh_q_abs;
T_surf_max_K = mO_sh_T_surf_max;
v_exit = mO_sh_v_exit;
q_in = mO_sh_q_in;
return;
}
bool C_DSG_Boiler::Solve_Superheater( double I_T_amb_K, double I_T_sky_K, double I_v_wind, double I_P_atm_Pa, double I_P_in_kPa, double I_m_dot_in, double I_h_in_kJkg,
double I_P_sh_out_min_Pa, bool I_checkflux, util::matrix_t<double> & I_q_inc_b, int & sh_exit, double I_T_target_out_K,
double & O_P_sh_out_kPa, double & O_eta_rec, double & O_rho_sh_out, double & O_h_sh_out_kJkg, double & O_q_out_W )
{
// Inputs
double T_amb = I_T_amb_K; //[K] Ambient temperature
double T_sky = I_T_sky_K; //[K] Sky temperature
double v_wind = I_v_wind; //[m/s] Wind Speed
double P_atm = I_P_atm_Pa; //[Pa] Ambient Pressure
double P_in = I_P_in_kPa; //[kPa] Pressure entering superheater
double m_dot_in = I_m_dot_in; //[kg/s] Total mass flow rate through system
double h_in = I_h_in_kJkg; //[kPa] Inlet pressure
double P_sh_out_min = I_P_sh_out_min_Pa; //[Pa] Minimum allowable outlet pressure of superheater
double T_target_out = I_T_target_out_K; //[K] Target outlet temperature of boiler
bool checkflux = I_checkflux; //[-]
// Set outputs to values that indicate model did not solve
O_P_sh_out_kPa = -999.9;
O_eta_rec = -999.9;
O_rho_sh_out = -999.9;
O_h_sh_out_kJkg = -999.9;
O_q_out_W = -999.9;
// Mass flow rate in one tube * ASSUMING ONE FLOW PATH *
double m_dot_total = m_dot_in / ((double)m_n_par); //[kg/s]
double T_in = std::numeric_limits<double>::quiet_NaN();
do
{
water_PH( P_in, h_in, &wp );
T_in = wp.temp; //[K]
if( fabs(T_in) < 1.E4 )
break;
h_in *= 0.99;
} while(true);
h_in = h_in * 1000.0; //[kJ/kg]
P_in = P_in * 1000.0; //[Pa]
//( T_in - 273.15, P_in, &wp );
//double h_in = wp.H*1000.0; //[J/kg]
//P_in = P_in*1.E3; //[Pa]
water_TQ( T_in, 1.0, &wp );
double u_n_exit = 0.0; //[m/s]
double energy_in = 0.0;
for( int i = 0; i < m_n_panels; i++ )
{
m_q_inc.at(i) = I_q_inc_b.at(i);
energy_in += m_per_panel*m_h_rec.at(i)*m_q_inc.at(i);
}
// Create new flux arrays that allow for multiple panels in parallel flow
// Q_adj sorts flux into flow path order and is indexed with Flow_Pat_Adj
for( int j = 0; j < m_n_fr; j++ )
{
for( int i = 0; i < m_nodes; i++ )
{
m_q_adj.at(flow_pattern_adj.at(j, i)) = m_q_inc.at(flow_pattern.at(j, i));
}
}
double beta = 1.0 / T_amb; //[1/K] Volumetric expansion coefficient
double T_1 = T_in + 30.0; //[K] Guess T_1 of first panel
m_m_dot_path.fill( m_dot_total/(double)m_n_fr ); //[kg/s] Mass flow rate through each flow route (divide evenly for now)
// [W/m^2-K] Calculates combined free and forced convection coefficient, same as used in fin HT model
double h_c = h_mixed(ambient_air, T_in, T_amb, v_wind, m_ksD, m_dsg_rec.Get_hl_ffact(), P_atm, CSP::grav, beta, m_h_rec.at(0), m_dsg_rec.Get_d_rec(), m_m_mixed);
// Check if enough flux is available to produce positive net energy through each flow path
for( int j = 0; j < m_n_fr; j++ )
{
m_q_wf_total.at(j) = 0.0;
for( int i = 0; i < m_nodes; i++ )
{
m_q_conv.at( flow_pattern_adj.at(j,i)) = h_c*m_A_n_proj[flow_pattern_adj.at(j,i)]*(T_in - T_amb); //[W] Convective heat transfer
m_q_rad.at( flow_pattern_adj.at(j,i)) = m_eps_tube*CSP::sigma*m_A_n_proj[flow_pattern_adj.at(j,i)]*(0.5*(pow(T_in,4) - pow(T_sky,4)) + 0.5*(pow(T_in,4) - pow(T_amb,4))); //[W] Radiative heat transfer: 8/10/11, view factor to ground ~ ambient (1/2)
m_q_abs.at( flow_pattern_adj.at(j,i)) = m_q_adj.at( flow_pattern_adj.at(j,i))*m_abs_tube*m_A_n_proj[flow_pattern_adj.at(j,i)]; //[W] Irradiance absorbed by panel
m_q_wf_total.at(j) += m_q_abs.at( flow_pattern_adj.at(j,i)) - m_q_conv.at( flow_pattern_adj.at(j,i)) - m_q_rad.at( flow_pattern_adj.at(j,i)); //[W] Heat transfer to working fluid
}
if( m_q_wf_total.at(j) < 0.0 )
{
sh_exit = 2; // Set flag for controller
return false;
}
}
if( checkflux == 1 )
{
return true;
}
water_TP( T_target_out, P_in/1.E3, &wp );
double h_out_target = wp.enth * 1000.0; //[J/kg]
// -> Required rate of energy addition [W] = mass flow rate [kg/s] * (enthalpy rise [J/kg])
// q_wf_min = m_dot_total*(h_out_target - h_in)
double q_wf_min = m_dot_total*(h_out_target - h_in);
double sum_q_wf_total = 0;
for( int i = 0; i < m_n_fr; i++ )
sum_q_wf_total += m_q_wf_total.at(i);
if( sum_q_wf_total < q_wf_min )
{
sh_exit = 2; // Set flag for calling code
return true;
}
double T1_max = 0.0; //[K] Set T1_max
// Solve for outlet conditions of each flow path
for( int j = 0; j < m_n_fr; j++ )
{
double h_n_in = h_in; //[J/kg-K] Inlet enthalpy of first node
double T_n_in = T_in; //[K] Inlet temperature of first node
double P_n_in = P_in; //[Pa] Inlet pressure of first node
double dp = 2.E4; //[Pa] Guess small pressure drop
double diff_T_ht = 45.0; //[K] Estimate of difference between surface temp and inlet temp
double m_dot = m_m_dot_path.at(j); //[kg/s] Use m_dot so we don't have to carry array through
double T_n_ave, h_n_out, P_out, u_n;
for( int i = 0; i < m_nodes; i++ )
{
if(i==0) T_1 = T_n_in + 45.0;
else T_1 = T_n_in + 1.5*diff_T_ht;
double diff_P_ave = 9999999.9; // Set diff > tolerance
int iter_P_ave = 0; //[-] Set iteration counter
double P_ave = max(1.E6, P_n_in - dp/2.0); //[Pa] Guess average pressure through flow path
bool P_upguess = false;
bool P_lowguess = false;
double P_upper = P_n_in;
double P_lower = P_sh_out_min;
double diff_P_bracket = 999.9;
bool lowpres_flag = false;
int P_br_low = 0;
double f_fd, rho_n_ave;
f_fd = rho_n_ave = std::numeric_limits<double>::quiet_NaN();
// An average pressure of the node is used as one indepedent variable to calculate additional properties
// After pressure drop through node is calculated, want to make sure calculated average pressure is within some % of average used for props
while( fabs(diff_P_ave) > 0.001 && iter_P_ave < 125 )
{
iter_P_ave++;
if( iter_P_ave > 1 )
{
if( !lowpres_flag )
{
if( P_upguess && P_lowguess )
{
if( diff_P_ave < 0.0)
{
P_br_low = 1;
P_lower = P_ave;
}
else
{
P_upper = P_ave;
}
P_ave = 0.5*P_lower + 0.5*P_upper;
}
else
{
if( diff_P_ave < 0.0 )
{
P_br_low = 1;
P_lower = P_ave;
P_lowguess = true;
}
else
{
P_upper = P_ave;
P_upguess = true;
}
P_ave = (P_n_in + P_out)/2.0;
}
} // end '!lowpres_flag'
else if( lowpres_flag )
{
P_br_low = 2;
P_lower = P_ave;
P_lowguess = true;
P_ave = 0.5*P_lower + 0.5*P_upper;
} // end 'else if lowpres_flag'
diff_P_bracket = (P_upper - P_lower)/P_lower;
} // end 'if iter_P_ave > 1'
// If bracket from which to choose average pressure is small, then try to get out of loop
if( diff_P_bracket < 0.0005 )
{
/*Set lower pressure limit
!P_br_low==1: Calculated average pressure is less than guessed
!P_br_low==2: Calculated outlet pressure is less than specified minimum
!Set upper pressure limit
!P_br_up==1: Calculated average pressure is greater than guessed
!If pressure flag, then decrease mass flow of problem flow path
!IF(P_br_low==2)THEN
! IF(j==1) Pave_flag = 1
! IF(j==2) Pave_flag = 2
! GOTO 204
!ENDIF */
if( P_br_low == 2)
{
sh_exit = 1;
return false;
}
// Should be able to iterate out of this
// If( P_br_low==1 )
} // end 'if diff_P_bracket < 0.0005'
lowpres_flag = false; //[-] Reset flag marking an outlet pressure below allowed minimum
double diff_T_1 = 999.9; //[K] Set diff > tolerance
int iter_T_1 = 0; //[-] Set iteration counter
double T_1_max = 1000.0; //[K] Set some maximum allowable surface temperature to control iteration
// Set limits on surface temperature iteration
double T_1_upper = T_1_max; //[K]
double T_1_lower = T_n_in - 15.0; //[K]
double T_1_min = T_1_lower; //[K]
T_1 = min( max( T_1_lower, T_1 ), T_1_upper ); //[K]
double diff_T1_g = 999.9; //[K] Reset difference between upper and lower iteration limits
// Reset iteration logic and integer flags
bool Tupflag = false;
bool Tlowflag = false;
bool HT_flag = false;
bool enth_flag = false;
int T1_br_lower = 0; //[-]
int T1_br_upper = 0; //[-]
// Reset temperature calculation errors at high and low guesses
double y_T_upper = 0.0; //[K]
double y_T_lower = 0.0; //[K]
// Need properties at saturated vapor in case some guess in energy balalnce results in x<1
water_PQ( P_ave/1000.0, 1.0, &wp );
double cp_x1 = wp.cp*1000.0; //[J/kg-K]
double rho_x1 = wp.dens;
double mu_x1 = water_visc(wp.dens, wp.temp)*1.E-6;
double k_x1 = water_cond(wp.dens, wp.temp);
double q_wf = std::numeric_limits<double>::quiet_NaN();
// This loop ensures that the outlet flow conditions for each panel are solved correctly by finding the correct T1 (outer surface temp)
while( fabs(diff_T_1/T_1)>0.0025 && iter_T_1 < 50 )
{
// GOTO 272 -> do something with this!?!?
iter_T_1++;
if( iter_T_1 > 1 )
{
if( !HT_flag && !enth_flag )
{
if( fabs(diff_T_1)>50.0 ) // If error is very large, use bisection rather than false interpolation method
{
if(diff_T_1 > 0.0) // If old temp is higher than new temp, then old temp is too high, so:
{
T1_br_upper = 2;
T_1_upper = T_1; //[K] Set upper limit
Tupflag = false;
}
else
{
T1_br_lower = 2;
T_1_lower = T_1; //[K] Set lower limit
Tlowflag = false;
}
T_1 = 0.5*T_1_lower + 0.5*T_1_upper;
}
else if( Tupflag && Tlowflag ) // If bracket results are set, use false position
{
if(diff_T_1>0.0)
{
T1_br_upper = 2;
T_1_upper = T_1; //[K] Set upper limit
y_T_upper = diff_T_1; //[K] Set upper bracket result
}
else // If old temp is lower than new temp, then old temp is too low, so:
{
T1_br_lower = 2;
T_1_lower = T_1; //[K] Set lower limit
y_T_lower = diff_T_1; //[K] Set lower bracket result
}
T_1 = y_T_upper/(y_T_upper-y_T_lower)*(T_1_lower - T_1_upper) + T_1_upper; //[K] False position method
}
else
{
if(diff_T_1 > 0.0)
{
T1_br_upper = 2;
T_1_upper = T_1; //[K] Set upper limit
y_T_upper = diff_T_1; //[K] Set upper bracket results
Tupflag = true; //[-] Set logic to show that upper bracket is set
}
else
{
T1_br_lower = 2;
T_1_lower = T_1; //[K] Set lower limit
y_T_lower = diff_T_1; //[K] Set lower bracket result
Tlowflag = true; //[-] Set logic to show that lower bracket is set
}
if( Tupflag && Tlowflag )
T_1 = y_T_upper/(y_T_upper-y_T_lower)*(T_1_lower - T_1_upper) + T_1_upper; //[K] False position
else
{
T_1 = T_1 - diff_T_1;
if( T_1 < T_1_lower )
T_1 = 0.5*T_1_lower + 0.5*T_1_upper;
else
T_1 = max( T_1_lower, min( T_1_max, T_1 ) );
}
}
/*
IF(((.not.(HT_flag)).and.(.not.(enth_flag)))) THEN */
}
else if( enth_flag )
{
T1_br_lower = 1;
T_1_lower = T_1;
T_1 = 0.5*T_1_lower + 0.5*T_1_upper;
enth_flag = false;
}
else if( HT_flag )
{
T1_br_upper = 1;
T_1_upper = T_1;
T_1 = 0.5*T_1_lower + 0.5*T_1_upper;
HT_flag = false;
}
} // end 'if iter_T_1 > 1'
// GOTO 474 -> do something with this!!!?@?!?!@
diff_T1_g = (T_1_upper - T_1_lower);
// If the bracket from which to guess T_1 is small, then try to exit loop
if( diff_T1_g < 0.01 )
{
if( T_1_lower > T_1_max - 0.02 && T1_br_upper==0 ) T1_br_upper = 3;
if( T_1_upper < 0.02 + T_1_min && T1_br_lower==0 ) T1_br_lower = 3;
/*T1_br_lower==1: Enth_flag, the resulting enthalpy from the heat addition is too large for steam property look-up routine
!T1_br_lower==2: Calculated surface temperature is higher than guessed
!T1_br_lower==3: Lower limit has not been set during iteration and is equal to inlet temperature
!T1_br_upper==1: HT Flag, negative (or nearly negative) energy input to boiler
!T1_br_upper==2: Calculated surface temperature is lower than guessed
!T1_br_upper==3: Upper limit has not been set during iteration and is equal to maximum value */
// Need to increase mass flow rate
if( T1_br_lower==1 && T1_br_upper==2 )
{
sh_exit = 3;
return false;
}
// Need to increase mass flow rate
else if( T1_br_lower==1 && T1_br_upper==3 )
{
sh_exit = 3;
return false;
}
// Need to increase mass flow rate
else if( T1_br_lower==2 && T1_br_upper==3 )
{
sh_exit = 3;
return false;
}
// Flux is too low
else if( T1_br_lower==3 && T1_br_upper==2 )
{
sh_exit = 3;
}
} // end 'if diff_T1_g < 0.01'
//[W/m^2-K] Function calculates combined free and forced convection coefficient, same as used in fin HT model
double h_c = h_mixed(ambient_air, T_1, T_amb, v_wind, m_ksD, m_dsg_rec.Get_hl_ffact(), P_atm, CSP::grav, beta, m_h_rec.at(flow_pattern_adj.at(j, i)), m_dsg_rec.Get_d_rec(), m_m_mixed);
m_q_conv.at(flow_pattern_adj.at(j,i)) = h_c*m_A_n_proj[flow_pattern_adj.at(j,i)]*(T_1 - T_amb); // Convective heat transfer
m_q_rad.at(flow_pattern_adj.at(j,i)) = m_eps_tube*CSP::sigma*m_A_n_proj[flow_pattern_adj.at(j,i)]*(0.5*(pow(T_1,4)-pow(T_sky,4))+0.5*(pow(T_1,4)-pow(T_amb,4))); //[W] Radiative heat transfer
m_q_abs.at(flow_pattern_adj.at(j,i)) = m_q_adj.at(flow_pattern_adj.at(j,i))*m_A_n_proj[flow_pattern_adj.at(j,i)]*m_abs_tube;
q_wf = m_q_abs.at(flow_pattern_adj.at(j,i)) - m_q_conv.at(flow_pattern_adj.at(j,i)) - m_q_rad.at(flow_pattern_adj.at(j,i));
// Equation: m_dot*(h_out - h_in) = q_wf
h_n_out = q_wf/m_dot + h_n_in; //[J/kg] Calculate outlet enthalpy according to calculated energy addition to working fluid
double h_n_ave = (h_n_in + h_n_out)/2.0; //[J/kg] Determine average enthalpy in node
// If the outlet enthalpy is greater than property routine can handle, flag and reguess T_1
if( h_n_out > m_h_sh_max )
{
enth_flag = true;
continue;
}
double mu_n_ave, k_n_ave, c_n_ave, x_n_ave;
mu_n_ave = k_n_ave = c_n_ave = x_n_ave = std::numeric_limits<double>::quiet_NaN();
bool props_succeed = true;
do
{
water_PH( P_ave/1000.0, h_n_ave/1000.0, &wp );
rho_n_ave = wp.dens; T_n_ave = wp.temp;
mu_n_ave = water_visc(wp.dens, wp.temp)*1.E-6;
k_n_ave = water_cond(wp.dens, wp.temp);
c_n_ave = wp.cp*1000.0; x_n_ave = wp.qual;
props_succeed = true;
if( c_n_ave < 0.0 || k_n_ave < 0.0 )
{
h_n_ave = 0.99*h_n_ave;
props_succeed = false;
}
} while (!props_succeed);
if(x_n_ave < 1.0)
{
c_n_ave = cp_x1;
rho_n_ave = rho_x1;
k_n_ave = k_x1;
mu_n_ave = mu_x1;
}
u_n = m_dot/(rho_n_ave*m_A_t_cs); //[m/s] Velocity through tube
double Re = rho_n_ave*u_n*m_d_in/mu_n_ave; //[-] Reynolds number
f_fd = pow( (-2.0*log10(2.0*m_rel_rough/7.54 - 5.02*log10(2.0*m_rel_rough/7.54 + 13.0/Re)/Re)), -2 ); //[-] (Moody) friction factor (Zigrang and Sylvester)
double alpha_n = k_n_ave/(rho_n_ave*c_n_ave); //[m^2/s] Thermal diffusivity of fluid
double Pr = mu_n_ave/(alpha_n*rho_n_ave); //[-] Prandtl number
double Nusselt = ((f_fd/8.0)*(Re-1000.0)*Pr)/(1.0+12.7*sqrt(f_fd/8.0)*(pow(Pr,2.0/3.0)-1.0)); //[-] Turbulent Nusselt Number
double h_fluid = max( k_n_ave/m_d_in, Nusselt*k_n_ave/m_d_in ); //[W/m^2-K] Convective heat transfer coefficient - set minimum to conductive ht
// Equation: q_wf = h_fluid*Area*(T_2 - T_n_ave)
double T_2 = q_wf/(h_fluid*m_A_n_in_act[flow_pattern_adj.at(j,i)]) + T_n_ave; //[K] Temperature of inner tube surface
double k_n = tube_material.cond( (T_1 + T_2)/2.0 ); //[W/m-K] Conductivity of tube using average temperature
double R_n = log(m_d_tube / m_d_in) / (k_n*2.0*CSP::pi*m_L.at(flow_pattern_adj.at(j, i)) / 2.0); //[K/W] Thermal resistance of ACTIVE tube
diff_T_1 = T_1 - (T_2 + q_wf*R_n); //[K] Calculate difference between guessed and calculated T_1
} // end loop solving tube energy balance (key on T_1)
//DELTAP [Pa] = DELTAP_tube DELTAP_45 DELTAP_90
dp = (f_fd*m_L.at(flow_pattern_adj.at(j, i))*rho_n_ave*pow(u_n, 2) / (2.0*m_d_in)) + 2.0*(f_fd*m_L_eff_45*rho_n_ave*pow(u_n, 2) / 2.0) + 4.0*(f_fd*m_L_eff_90*rho_n_ave*pow(u_n, 2) / 2.0);
P_out = P_n_in - dp; //[Pa] Calculate node outlet pressure
diff_P_ave = (P_ave-(P_n_in+P_out)/2.0)/P_in; //[Pa] Difference between guessed and calculated average pressure
if(P_out < P_sh_out_min)
{
lowpres_flag = true;
break;
}
} // End loop solving for correct average pressure of node
P_n_in = P_out; //[Pa] Calculate inlet pressure of next node
h_n_in = h_n_out; //[J/kg] Set inlet enthalpy for next node
water_PH( P_out/1000.0, h_n_in/1000.0, &wp );
T_n_in = wp.temp; //[K]
//if( T_n_in > T_target_out+50.0 && iter_P_ave < 125 )
if( T_n_in > T_target_out+50.0 && i < m_nodes - 1 )
{
sh_exit = 3;
return false;
}
diff_T_ht = max( 0.0, T_1 - T_n_in ); //[K] Difference between surface temp and inlet temp: used to estimate T_1 of next node
// Change max temperature to estimate surface temp at hot end, not center (where energy balance is calculated)
T1_max = max( T1_max, T_n_in + (T_1 - T_n_ave) );
} // End loop to solve for a flow path
m_h_path_out.at(j) = h_n_out; //[J/kg] Keep track of enthalpy outlet of flow path
m_P_path_out.at(j) = P_out; //[Pa] Keep track of pressure outlet of flow path
u_n_exit = max(u_n_exit, u_n); //[m/s] Maximum outlet velocity
} // End for loop to solve for each flow path
// Energy balance to combine outlet flows (if more than 1): m1h1 + m2h2 = m3h3
double mh_sum = 0.0;
for( int j = 0; j < m_n_fr; j++ )
mh_sum += m_m_dot_path.at(j)*m_h_path_out.at(j); //[W] Total mh products for flow routes
double h_out_comb = mh_sum / m_dot_total; //[J/kg] Calculate final combined outlet enthalpy
h_out_comb = min(h_out_comb, m_h_sh_max); //[J/kg]
double P_path_out_sum = 0.0;
for( int j = 0; j < m_n_fr; j++ )
P_path_out_sum += m_P_path_out.at(j);
double P_out_avg = min( P_path_out_sum/(double)m_n_fr/1.E3, 19.0E3 ); //[kPa] Average (flow paths) outlet pressure
water_PH( P_out_avg, h_out_comb/1000.0, &wp );
double rho_out = wp.dens;
double energy_out = m_dot_in * (h_out_comb - h_in); //[W]
double eta_rec = energy_out / energy_in; //[-]
double q_rad_sh_sum = 0.0;
double q_conv_sh_sum = 0.0;
double q_abs_sh_sum = 0.0;
for( int j = 0; j < m_n_fr*m_nodes; j++ )
{
q_rad_sh_sum += m_q_rad.at(j);
q_conv_sh_sum += m_q_conv.at(j);
q_abs_sh_sum += m_q_abs.at(j);
}
double q_rad_sh = q_rad_sh_sum*(double)m_n_par/1.E6; //[MW] Total radiative loss from superheater
double q_conv_sh = q_conv_sh_sum*(double)m_n_par/1.E6; //[MW] Total convective loss from superheater
double q_abs_sh = q_abs_sh_sum*(double)m_n_par/1.E6; //[MW] Total energy rate absorbed by superheater
O_P_sh_out_kPa = P_out_avg; //[kPa]
O_eta_rec = eta_rec;
O_rho_sh_out = rho_out;
O_h_sh_out_kJkg = h_out_comb/1.E3; //[kJ/kg]
O_q_out_W = energy_out; //[W]
mO_sh_q_conv = q_conv_sh;
mO_sh_q_rad = q_rad_sh;
mO_sh_q_abs = q_abs_sh;
mO_sh_T_surf_max = T1_max;
mO_sh_v_exit = u_n_exit;
mO_sh_q_in = energy_in;
return true;
}
/*
Superheater(info,XIN,XOUT,N_panels,PAR,Q_inc,h_out_target,sh_exit,checkflux)
hmmmmmm?
XOUT = 0. !Set all outputs to 0 so it is simple to tell if they have been set
!Set Outputs
XOUT(1) = eta_rec ![-] Thermal efficiency of receiver
XOUT(2) = T_out ![K] Temperature of steam exiting superheater
XOUT(3) = P_out ![Pa] Pressure of steam exiting superheater
XOUT(4) = Energy_out ![W] Rate of energy transferred to steam in superheater
XOUT(5) = h_out_comb ![J/kg] Outlet enthalpy
XOUT(6) = h_in ![J/kg] Inlet enthalpy
XOUT(7) = T1_max ![K] Maximum average temperature of superheater surface
XOUT(8) = P_in - P_out_avg*1000.d0 ![Pa] Pressure drop through superheater
XOUT(9) = u_n_exit ![m/s] Velocity of flow
XOUT(10) = Energy_in ![W] Flux * receiverArea
XOUT(11) = P_out_avg*1000.d0 ![Pa] SH outlet pressure
XOUT(12) = rho_out ![kg/m^3] SH outlet density
XOUT(13) = Q_conv_SH ![MW] Total convective loss from superheater
XOUT(14) = Q_rad_SH ![MW] Total radiative loss from superheater
XOUT(15) = Q_abs_SH ![MW] Total energy rate absorbed by superheater
END SUBROUTINE
*/
//****************************************************************************************
//***** Flow Boiling Model: local HT coefficient: Nellis and Klein (2008)
//****************************************************************************************
double Flow_Boiling( double T_sat, double T_surf, double G, double d, double x_in, double q_t_flux, double rho_l, double rho_v, double k_l,
double mu_l, double Pr_l, double enth_l, double h_diff, double grav, double mu_v, double c_v, double k_v, double RelRough )
{
double x = x_in; //[-] Set quality
double Re_l = G*d*(1.0-x)/mu_l; //[-] Eq. 7-10: Reynolds number of saturated liquid flow
double h_fluid;
if( q_t_flux < 0.0 ) // Flow condensation correlations: Section 7.5.2 in Nellis and Klein
{
double X_tt = pow(rho_v/rho_l,0.5)*pow(mu_l/mu_v,0.1)*pow((1.0-x)/x,0.9); // Eq. 7-105: Lockhard Martinelli parameter
if( G > 500.0 )
h_fluid = k_l/d * 0.023 * pow(Re_l,0.8) * pow(Pr_l,0.4) * (1.0 + pow(2.22/X_tt,0.89)); // Eq. 7-104
else
{
double Ga = 9.81*rho_l*(rho_l - rho_v)*pow(d,3)/pow(mu_l,2); // Eq. 7-109
double Fr_mod;
if( Re_l <= 1250.0 )
Fr_mod = 0.025*pow(Re_l,1.59)/pow(Ga,0.5)*pow( ((1.0+1.09*pow(X_tt,0.39))/X_tt), 1.5 ); // Eq. 7-107
else
Fr_mod = 1.26*pow(Re_l,1.04)/pow(Ga,0.5)*pow( ((1.0+1.09*pow(X_tt,0.39))/X_tt), 1.5 ); // Eq. 7-108
if( Fr_mod > 20.0 )
h_fluid = k_l/d * 0.023 * pow(Re_l,0.8) * pow(Pr_l,0.4) * (1.0 + 2.22/pow(X_tt,0.89)); // Eq. 7-110
else
{
double T_s;
if( T_surf > T_sat )
T_s = T_sat - 1.0;
else
T_s = T_surf;
double c_l = Pr_l*k_l/mu_l;
double vf = pow( (1.0 + (1.0-x)/x*pow((rho_v/rho_l),(2.0/3.0))),-1.0 ); // Eq. 7-113
double A = acos(2.0*vf - 1.0)/3.141; // Eq. 7-112
double Fr_1 = pow(G,2)/(pow(rho_l,2)*9.81*d); // Eq. 7-115
double C_1, C_2;
if( Fr_1 > 0.7 ) // Eq. 7-116
{
C_1 = 7.242;
C_2 = 1.655;
}
else // Eq. 7-117
{
C_1 = 4.172 + 5.48*Fr_1 - 1.564*pow(Fr_1,2);
C_2 = 1.773 - 0.169*Fr_1;
}
double Nu_fc = 0.0195*pow(Re_l,0.8)*pow(Pr_l,0.4)*(1.376 + C_1/pow(X_tt,C_2)); // Eq. 7-114
h_fluid = (k_l/d)*( (0.23/(1.0+1.11*pow(X_tt,0.58))) * pow(G*d/mu_l,0.12) * pow( (h_diff/(c_l*(T_sat-T_s))),0.25 )*pow(Ga,0.25) + A*Nu_fc); // Eq. 7-111
}
}
}
else
{
bool interp = false;
double h_fluid_v;
if( Re_l < 2300 ) // If Re < 2300
{
Re_l = 2300.0; // Set Re to 2300
x = 1.0 - Re_l*mu_l/(G*d); // Calculate x corresponding to Re=2300
interp = true; // Now need to interpolate to find final heat transfer coefficient
double u_n_v = G/rho_v;
//***** Heat transfer coefficient for x = 1 **********************
double Re_v = rho_v * u_n_v * d / mu_v; //[-] Reynolds number of single phase (x=1) flow
double f_fd = pow( (-2.0*log10(2.0*RelRough/7.54 - 5.02*log10(2.0*RelRough/7.54 + 13.0*Re_v)/Re_v)), -2 ); //[-] (Moody) friction factor (Zigrang and Sylvester)
double alpha_v = k_v/(rho_v*c_v); //[m^2/s] Thermal diffusivity of fluid
double Pr_v = mu_v/(alpha_v*rho_v); //[-] Prandtl number
double Nusselt = ((f_fd/8.0)*(Re_v-1000.0)*Pr_v)/(1.0+12.7*pow(f_fd/8.0,0.5)*(pow(Pr_v,2.0/3.0)-1.0)); //[-] Turbulent Nusselt Number (Gnielinski)
h_fluid_v = Nusselt*k_v/d; //[W/m^2-K] Convective heat transfer coefficient
}
double f_l = pow( (0.79*log(Re_l)-1.64), -2 ); //[-] Eq. 7-12: Friction factor for saturated liquid flow
double h_l = ((f_l/8.0)*(Re_l-1000.0)*Pr_l)/(1.0+12.7*(pow(Pr_l,2.0/3.0)-1.0)*pow(f_l/8.0,0.5))*(k_l/d); //[W/m^2-K] Eq. 7-9: Heat transfer correlation for saturated liquid flow
double Co = pow( (1.0/x - 1.0), 0.8 )*pow( (rho_v/rho_l), 0.5); //[-] Eq. 7-13: Dimensionless parameter
double Bo = q_t_flux/(G*h_diff); //[-] Eq. 7-14: Dimensionless parameter: Boiling number
//double Fr = pow(G, 2) / (grav*d*pow(rho_l, 2)); //[-] Eq. 7-15: Dimensionless parameter: Froude number
double N = Co; //[-] Eq. 7-16: For vertical tubes
double h_cb = 1.8*pow(N,-0.8); //[-] Eq. 7-17
double h_nb;
if( Bo >= 0.3E-4 )
h_nb = 230.0*pow(Bo,0.5);
else
h_nb = 1.0 + 46.0*pow(Bo,0.5);
double h_bs1, h_bs2;
if( Bo >= 11.E-4 )
{
h_bs1 = 14.7*pow(Bo,0.5)*exp(2.74*pow(N,-0.1)); //[-] Eq. 7-19
h_bs2 = 14.7*pow(Bo,0.5)*exp(2.47*pow(N,-0.15)); //[-] Eq. 7-20
}
else
{
h_bs1 = 15.43*pow(Bo,0.5)*exp(2.74*pow(N,-0.1)); //[-] Eq. 7-19
h_bs2 = 15.43*pow(Bo,0.5)*exp(2.47*pow(N,-0.15)); //[-] Eq. 7-20
}
double h_dim;
if(N<=0.1) //[-] Eq. 7-21
h_dim = max(h_cb,h_bs2);
else if(N<=1.0)
h_dim = max(h_cb,h_bs1);
else
h_dim = max(h_cb, h_nb);
h_fluid = h_dim * h_l; //[W/m^2-K] Eq. 7-8
if( interp )
h_fluid = (h_fluid_v - h_fluid)/(1.0 - x) * (x_in - x) + h_fluid;
}
return h_fluid;
}
double h_mixed( HTFProperties &air, double T_node_K, double T_amb_K, double v_wind, double ksD, double hl_ffact, double P_atm_Pa,
double grav, double beta, double h_rec, double d_rec, double m )
{
// Calculate convective heat transfer coefficient (originally in Type 222)
// Fluid properties are calculated using Film Temperature!
double T_film = (T_node_K + T_amb_K)/2.0; //[K] Film temperature
double k_film = air.cond( T_film ); //[W/m-K] Conductivity
double mu_film = air.visc( T_film ); //[kg/m-s] Dynamic viscosity
double rho_film = air.dens( T_film, P_atm_Pa ); //[kg/m^3] Density
// Forced convection
double Re_for = rho_film*v_wind*d_rec/mu_film; //[-] Reynolds number
double Nusselt_for = CSP::Nusselt_FC( ksD, Re_for ); //[-] S&K
double h_for = Nusselt_for*k_film/d_rec*hl_ffact; //[W/m^2-K] The forced convection heat transfer coefficient
// Free convection: use Ambient temperature for fluid props
double nu_amb = air.visc( T_amb_K ) / air.dens( T_amb_K, P_atm_Pa ); //[m^2/s] Kinematic viscosity
double Gr_nat = max( 0.0, grav*beta*(T_node_K - T_amb_K)*pow( h_rec, 3 )/pow( nu_amb, 2 )); //[-] Grashof number at ambient conditions, MJW 8.4.2010 :: Hard limit of 0 on Gr #
double Nusselt_nat = 0.098*pow( Gr_nat, 1./3. )*pow( (T_node_K/T_amb_K), -0.14 ); //[-] Nusselt number
double h_nat = Nusselt_nat*air.cond( T_amb_K )/h_rec*hl_ffact; //[W/m^2-K] The natural convection cofficient ; conductivity calculation corrected
double h_mixed = pow( pow( h_for, m ) + pow( h_nat, m ), 1.0/m )*4.0; //[W/m^2-K] MJW 7.30.2010:: (4.0) is a correction factor to match convection losses at Solar II (correspondance with G. Kolb, SNL)
return h_mixed;
}
/*
double Nusselt_FC( double ksDin, double Re )
{
// This is the forced convection correlation presented in [Siebers and Kraabel, 1984]
// The value of ks\D determines the interpolation that takes place between these 4 data points
double ksD = ksDin;
double Nomval = ksD;
int rerun = 0;
double Nu_FC, ValHi, ValLo, Nu_Lo, Nu_Hi, ValHi2, ValLo2;
// Select the bounding conditions
bool repeat_loop = true;
do
{
repeat_loop = false;
// Point 1: ksD = 0.0
if(ksD < 75.E-5)
{
Nu_FC = 0.3 + 0.488*pow( Re, 0.5 )*pow( (1.0+pow( (Re/282000), 0.625 )), 0.8);
ValHi = 75.E-5;
ValLo = 0.0;
}
else // Point 2: ksD = 75 E-5
{
if( ksD>=75.E-5 && ksD<300.E-5 )
{
ValHi = 300.E-5;
ValLo = 75.E-5;
if( Re <= 7.E5 )
Nu_FC = 0.3 + 0.488*pow( Re, 0.5 )*pow( (1.0+pow( (Re/282000), 0.625 )), 0.8);
else
{
if( Re>7.0E5 && Re<2.2E7 )
Nu_FC = 2.57E-3*pow( Re, 0.98 );
else
Nu_FC = 0.0455*pow( Re, 0.81 );
}
}
else // Point 3: ksD = 300E-5
{
if( ksD>=300.E-5 && ksD<900.E-5 )
{
ValHi = 900.E-5;
ValLo = 300.E-5;
if( Re <= 1.8E5 )
Nu_FC = 0.3 + 0.488*pow( Re, 0.5 )*pow( (1.0+pow( (Re/282000), 0.625 )), 0.8);
else
{
if( Re>1.8E5 && Re<4.E6 )
Nu_FC = 0.0135*pow( Re, 0.89 );
else
Nu_FC = 0.0455*pow( Re, 0.81 );
}
}
else // Point 4: ksD = 900 E -5
{
if( ksD >= 900.0E-5 )
{
ValHi = 900.0E-5;
ValLo = 900.0E-5;
if( Re <= 1E5 )
Nu_FC = 0.3 + 0.488*pow( Re, 0.5 )*pow( (1.0+pow( (Re/282000), 0.625 )), 0.8);
else
Nu_FC = 0.0455*pow( Re, 0.81 );
}
}
}
}
if( rerun != 1 )
{
rerun = 1;
Nu_Lo = Nu_FC;
ksD = ValHi;
ValLo2 = ValLo;
ValHi2 = ValHi;
repeat_loop = true;
}
} while( repeat_loop );
Nu_Hi = Nu_FC;
double chi;
if( Nomval >= 900.E-5 )
chi = 0.0;
else
chi = (Nomval - ValLo2)/(ValHi2 - ValLo2);
Nu_FC = Nu_Lo + (Nu_Hi - Nu_Lo)*chi;
return Nu_FC;
} */
/*
void flow_patterns_DSR( int n_panels, int flow_type, util::matrix_t<int> & flow_pattern )
{
// !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
// ! This subroutine takes the number of panels, the requested flow type, and
// ! returns the corresponding flow pattern (the order of panels through which the
// ! WF passes, this code is modified from the version in Type222
// !++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
int n_lines;
int n_p_quarter = n_panels/4;
switch( flow_type )
{
case 1:
// This flow pattern begins at the northmost 2 panels, splits into 2 flows, and crosses over
// at the quarter position, exiting in 2 flows on the southmost 2 panels. This is the flow
// configuration that was used for SOLAR II
// !Example = [13,14,15,16,17,18,6,5,4,3,2,1] [12,11,10,9,8,7,19,20,21,22,23,24]
n_lines = 2;
//flow_pattern.resize( n_lines, n_panels/n_lines );
for( int i = 0; i < n_p_quarter; i++)
{
flow_pattern.at( 0, n_p_quarter + i) = n_p_quarter - 1 - i; // NE Quadrant - final half of flow path 0
flow_pattern.at( 1, i ) = 2*n_p_quarter - 1 - i; // SE Quadrant - first half of flow path 1
flow_pattern.at( 0, i ) = 2*n_p_quarter + i; // SW Quadrant - first half of flow path 0
flow_pattern.at( 1, n_p_quarter + i) = 3*n_p_quarter + i; // NW Quadrant - final half of flow path 1
}
return;
case 2:
// This flow pattern is the same as flow pattern #1, but in reverse. The salt enters
// on the 2 southmost panels, crosses over, and exits on the 2 northmost panels.
// Example = [1,2,3,4,5,6,17,16,15,14,13,12] [24,23,22,21,20,19,18,7,8,9,10,11,12]
n_lines = 2;
//flow_pattern.resize( n_lines, n_panels/n_lines );
for( int i = 0; i < n_p_quarter; i++)
{
flow_pattern.at( 0, i ) = i; // NE Quadrant - first half of flow path 0
flow_pattern.at( 1, n_p_quarter + i ) = n_p_quarter + i; // SE Quadrant - final half of flow path 1
flow_pattern.at( 0, n_p_quarter + i ) = 3*n_p_quarter - 1 - i; // SW Quadrant - final half of flow path 0
flow_pattern.at( 1, i ) = 4*n_p_quarter - 1 - i; // NW Quadrant - first half of flow path 1
}
return;
};
return;
}
*/
/*
integer,intent(in)::N_panels
integer,dimension(N_panels)::Flow_pattern(2,N_panels/2),Z_all(N_panels)
integer::nlines,flowtype,i
case(2)
!This flow pattern is the same as flow pattern #1, but in reverse. The salt enters
! on the 2 southmost panels, crosses over, and exits on the 2 northmost panels.
nlines = 2
!New: Accounts for receiver with numbers of panels divisible by 2 but not 4
Flow_pattern(1,:) = (/ (i,i=1,N_panels/4),(N_panels-N_panels/4-i+1,i=1,N_panels-N_panels/4-N_panels/2) /)
Flow_pattern(2,:) = (/ (N_panels-i+1,i=1,N_panels/4),(N_panels/4+i,i=1,N_panels/2-N_panels/4) /)
![1,2,3,4,5,6,17,16,15,14,13,12,24,23,22,21,20,19,18,7,8,9,10,11,12]
!Old: Only accounts for receiver with numbers of panels divisible by 4
! Flow_pattern(1,:) = (/ (i,i=1,N_panels/4),((3*N_panels/4-(i-1)),i=1,N_panels/4) /)
! Flow_pattern(2,:) = (/ ((N_panels-(i-1)),i=1,N_panels/4),(i,i=N_panels/4+1,N_panels/2) /)
*/
| 39.761602 | 301 | 0.622371 | [
"model"
] |
69ed68fcada456211f569f5906a56f239dde773d | 2,434 | cpp | C++ | TensorProductQuadrature.cpp | T3ks/SPQR | b554d172fc798caa7a708bfbbb71a21d136403b1 | [
"BSD-3-Clause"
] | 1 | 2016-09-11T12:02:57.000Z | 2016-09-11T12:02:57.000Z | TensorProductQuadrature.cpp | T3ks/SPQR | b554d172fc798caa7a708bfbbb71a21d136403b1 | [
"BSD-3-Clause"
] | null | null | null | TensorProductQuadrature.cpp | T3ks/SPQR | b554d172fc798caa7a708bfbbb71a21d136403b1 | [
"BSD-3-Clause"
] | 2 | 2017-01-28T02:25:12.000Z | 2020-06-12T16:43:19.000Z | #include "TensorProductQuadrature.hpp"
/** \brief default constructor without arguments
*
*/
TensorProductQuadrature::TensorProductQuadrature(void) {}
/** \brief constructor with quadrature degrees calls init_quadrature
* \param[in] degs maximum quadrature degrees in each dimension
*
*/
TensorProductQuadrature::TensorProductQuadrature(const Eigen::VectorXi &lvl,
UnivariateQuadrature &Q) {
initQuadrature(lvl, Q);
}
/** \brief initializes the tensor product quadrature based on the
* Gauss Legendre quadrature (C routine)
* \param[in] degs maximum quadrature degrees in each dimension
*
*/
void TensorProductQuadrature::initQuadrature(const Eigen::VectorXi &lvl,
UnivariateQuadrature &Q) {
Eigen::VectorXi base;
Eigen::VectorXi nPtsInQuad;
int remainder = 0;
int quotient = 0;
int maxLvl = 0;
for (int i = 0; i < lvl.size(); ++i)
if (maxLvl < lvl(i)) maxLvl = lvl(i);
Q.resizeQuadrature(maxLvl);
nPtsInQuad.resize(lvl.size());
const std::vector<Quadrature> &refQ = Q.get_Q();
for (int i = 0; i < lvl.size(); ++i) nPtsInQuad(i) = refQ[lvl(i)].w.size();
_nPts = nPtsInQuad.prod();
_points.resize(lvl.size(), _nPts);
_weights.resize(_nPts);
base = computeBase(nPtsInQuad);
for (int i = 0; i < _nPts; ++i) {
_weights(i) = 1.;
remainder = i;
for (int j = 0; j < lvl.size(); ++j) {
quotient = remainder / base(j);
_points(j, i) = refQ[lvl(j)].xi(quotient);
_weights(i) *= refQ[lvl(j)].w(quotient);
remainder -= base(j) * quotient;
}
}
}
/** \brief this function needs a comment
*
*/
Eigen::VectorXi TensorProductQuadrature::computeBase(
const Eigen::VectorXi &lvl) {
Eigen::VectorXi base;
base = Eigen::VectorXi::Ones(lvl.size());
for (int i = (int)lvl.size() - 1; i >= 0; --i)
base(lvl.size() - i - 1) = lvl.tail(i).prod();
return base;
}
/** \brief make an educated guess, what this function does...
*
*/
const Eigen::VectorXd &TensorProductQuadrature::get_weights(void) const {
return _weights;
}
/** \brief make an educated guess, what this function does...
*
*/
const Eigen::MatrixXd &TensorProductQuadrature::get_points(void) const {
return _points;
}
/** \brief make an educated guess, what this function does...
*
*/
int TensorProductQuadrature::get_nPts(void) const { return _nPts; }
| 27.977011 | 77 | 0.639277 | [
"vector"
] |
69f3c796839fa1d29767d2d485da58ba15889c16 | 7,835 | cc | C++ | tools/upgrade-flux-file.cc | adafruit/fluxengine | 3f56b9aa4ebe7e1e56e43a9cf7590f987cc64bcf | [
"MIT"
] | 1 | 2022-01-16T10:31:25.000Z | 2022-01-16T10:31:25.000Z | tools/upgrade-flux-file.cc | adafruit/fluxengine | 3f56b9aa4ebe7e1e56e43a9cf7590f987cc64bcf | [
"MIT"
] | null | null | null | tools/upgrade-flux-file.cc | adafruit/fluxengine | 3f56b9aa4ebe7e1e56e43a9cf7590f987cc64bcf | [
"MIT"
] | null | null | null | #include "globals.h"
#include "fluxmap.h"
#include "fluxsink/fluxsink.h"
#include "bytes.h"
#include "fmt/format.h"
#include <string.h>
#include <fstream>
#include <sqlite3.h>
/* --- SQL library ------------------------------------------------------- */
enum
{
FLUX_VERSION_0, /* without properties table */
FLUX_VERSION_1,
FLUX_VERSION_2, /* new bytecode with index marks */
FLUX_VERSION_3, /* simplified bytecode with six-bit timer */
};
enum
{
COMPRESSION_NONE,
COMPRESSION_ZLIB
};
static bool hasProperties(sqlite3* db);
void sqlCheck(sqlite3* db, int i)
{
if (i != SQLITE_OK)
Error() << "database error: " << sqlite3_errmsg(db);
}
sqlite3* sqlOpen(const std::string filename, int flags)
{
sqlite3* db;
int i = sqlite3_open_v2(filename.c_str(), &db, flags, NULL);
if (i != SQLITE_OK)
Error() << "failed: " << sqlite3_errstr(i);
return db;
}
void sqlClose(sqlite3* db)
{
sqlite3_close(db);
}
void sqlStmt(sqlite3* db, const char* sql)
{
char* errmsg;
int i = sqlite3_exec(db, sql, NULL, NULL, &errmsg);
if (i != SQLITE_OK)
Error() << "database error: %s" << errmsg;
}
bool hasProperties(sqlite3* db)
{
sqlite3_stmt* stmt;
sqlCheck(db,
sqlite3_prepare_v2(db,
"SELECT COUNT(*) FROM sqlite_master WHERE type='table' AND "
"name='properties'",
-1,
&stmt,
NULL));
int i = sqlite3_step(stmt);
if (i != SQLITE_ROW)
Error() << "Error accessing sqlite metadata";
bool has_properties = sqlite3_column_int(stmt, 0) != 0;
sqlCheck(db, sqlite3_finalize(stmt));
return has_properties;
}
void sql_bind_blob(sqlite3* db,
sqlite3_stmt* stmt,
const char* name,
const void* ptr,
size_t bytes)
{
sqlCheck(db,
sqlite3_bind_blob(stmt,
sqlite3_bind_parameter_index(stmt, name),
ptr,
bytes,
SQLITE_TRANSIENT));
}
void sql_bind_int(sqlite3* db, sqlite3_stmt* stmt, const char* name, int value)
{
sqlCheck(db,
sqlite3_bind_int(
stmt, sqlite3_bind_parameter_index(stmt, name), value));
}
void sql_bind_string(
sqlite3* db, sqlite3_stmt* stmt, const char* name, const char* value)
{
sqlCheck(db,
sqlite3_bind_text(stmt,
sqlite3_bind_parameter_index(stmt, name),
value,
-1,
SQLITE_TRANSIENT));
}
std::vector<std::pair<unsigned, unsigned>> sqlFindFlux(sqlite3* db)
{
std::vector<std::pair<unsigned, unsigned>> output;
sqlite3_stmt* stmt;
sqlCheck(db,
sqlite3_prepare_v2(
db, "SELECT track, side FROM zdata", -1, &stmt, NULL));
for (;;)
{
int i = sqlite3_step(stmt);
if (i == SQLITE_DONE)
break;
if (i != SQLITE_ROW)
Error() << "failed to read from database: " << sqlite3_errmsg(db);
unsigned track = sqlite3_column_int(stmt, 0);
unsigned side = sqlite3_column_int(stmt, 1);
output.push_back(std::make_pair(track, side));
}
sqlCheck(db, sqlite3_finalize(stmt));
return output;
}
long sqlReadIntProperty(sqlite3* db, const std::string& name)
{
if (!hasProperties(db))
return 0;
sqlite3_stmt* stmt;
sqlCheck(db,
sqlite3_prepare_v2(db,
"SELECT value FROM properties WHERE key=:key",
-1,
&stmt,
NULL));
sql_bind_string(db, stmt, ":key", name.c_str());
int i = sqlite3_step(stmt);
long result = 0;
if (i != SQLITE_DONE)
{
if (i != SQLITE_ROW)
Error() << "failed to read from database: " << sqlite3_errmsg(db);
result = sqlite3_column_int(stmt, 0);
}
sqlCheck(db, sqlite3_finalize(stmt));
return result;
}
int sqlGetVersion(sqlite3* db)
{
return sqlReadIntProperty(db, "version");
}
/* --- Actual program ---------------------------------------------------- */
static void syntax()
{
std::cerr
<< "syntax: upgrade-flux-file <filename>\n"
<< "This tool upgrades the flux file in-place to the current format.\n";
exit(0);
}
static Bytes sqlReadFluxBytes(sqlite3* db, int track, int side)
{
sqlite3_stmt* stmt;
sqlCheck(db,
sqlite3_prepare_v2(db,
"SELECT data, compression FROM zdata WHERE track=:track AND "
"side=:side",
-1,
&stmt,
NULL));
sql_bind_int(db, stmt, ":track", track);
sql_bind_int(db, stmt, ":side", side);
Bytes data;
int i = sqlite3_step(stmt);
if (i != SQLITE_DONE)
{
if (i != SQLITE_ROW)
Error() << "failed to read from database: " << sqlite3_errmsg(db);
const uint8_t* blobptr = (const uint8_t*)sqlite3_column_blob(stmt, 0);
size_t bloblen = sqlite3_column_bytes(stmt, 0);
int compression = sqlite3_column_int(stmt, 1);
data = Bytes(blobptr, bloblen);
switch (compression)
{
case COMPRESSION_NONE:
break;
case COMPRESSION_ZLIB:
data = data.decompress();
break;
default:
Error() << fmt::format(
"unsupported compression type {}", compression);
}
}
sqlCheck(db, sqlite3_finalize(stmt));
return data;
}
static bool isSqlite(const std::string& filename)
{
char buffer[16];
std::ifstream(filename, std::ios::in | std::ios::binary).read(buffer, 16);
if (strncmp(buffer, "SQLite format 3", 16) == 0)
return true;
return false;
}
static void translateFluxVersion2(Fluxmap& fluxmap, const Bytes& bytes)
{
unsigned pending = 0;
for (uint8_t b : bytes)
{
switch (b)
{
case 0x80: /* pulse */
fluxmap.appendInterval(pending);
fluxmap.appendPulse();
pending = 0;
break;
case 0x81: /* index */
fluxmap.appendInterval(pending);
fluxmap.appendIndex();
pending = 0;
break;
default:
pending += b;
break;
}
}
fluxmap.appendInterval(pending);
}
int main(int argc, const char* argv[])
{
if ((argc != 2) || (strcmp(argv[1], "--help") == 0))
syntax();
std::string filename = argv[1];
if (!isSqlite(filename))
{
std::cout << "File is up to date.\n";
exit(0);
}
std::string outFilename = filename + ".out.flux";
auto db = sqlOpen(filename, SQLITE_OPEN_READONLY);
int version = sqlGetVersion(db);
{
auto fluxsink = FluxSink::createFl2FluxSink(outFilename);
for (const auto& locations : sqlFindFlux(db))
{
unsigned cylinder = locations.first;
unsigned head = locations.second;
Bytes bytes = sqlReadFluxBytes(db, cylinder, head);
Fluxmap fluxmap;
switch (version)
{
case FLUX_VERSION_2:
translateFluxVersion2(fluxmap, bytes);
break;
case FLUX_VERSION_3:
fluxmap.appendBytes(bytes);
break;
default:
Error() << fmt::format(
"you cannot upgrade version {} files (please file a "
"bug)",
version);
}
fluxsink->writeFlux(cylinder, head, fluxmap);
std::cout << '.' << std::flush;
}
std::cout << "Writing output file...\n";
}
if (rename(outFilename.c_str(), filename.c_str()) != 0)
Error() << fmt::format(
"couldn't replace input file: {}", strerror(errno));
return 0;
}
| 25.438312 | 80 | 0.550223 | [
"vector"
] |
0e0f9c722d91f581185ea63be4be5bdb5adf1a54 | 6,080 | cc | C++ | components/cast/message_port/message_port_unittest.cc | Ron423c/chromium | 2edf7b980065b648f8b2a6e52193d83832fe36b7 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 575 | 2015-06-18T23:58:20.000Z | 2022-03-23T09:32:39.000Z | components/cast/message_port/message_port_unittest.cc | Ron423c/chromium | 2edf7b980065b648f8b2a6e52193d83832fe36b7 | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 113 | 2015-05-04T09:58:14.000Z | 2022-01-31T19:35:03.000Z | components/cast/message_port/message_port_unittest.cc | DamieFC/chromium | 54ce2d3c77723697efd22cfdb02aea38f9dfa25c | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 52 | 2015-07-14T10:40:50.000Z | 2022-03-15T01:11:49.000Z | // Copyright 2020 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/cast/message_port/message_port.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "build/build_config.h"
#include "components/cast/message_port/test_message_port_receiver.h"
#include "testing/gtest/include/gtest/gtest.h"
#if defined(OS_FUCHSIA)
#include "components/cast/message_port/message_port_fuchsia.h"
#include "fuchsia/fidl/chromium/cast/cpp/fidl.h"
#else
#include "components/cast/message_port/message_port_cast.h" // nogncheck
#include "third_party/blink/public/common/messaging/web_message_port.h" // nogncheck
#endif // defined(OS_FUCHSIA)
#ifdef PostMessage
#undef PostMessage
#endif
namespace cast_api_bindings {
class MessagePortTest : public ::testing::Test {
public:
MessagePortTest()
: task_environment_(base::test::TaskEnvironment::MainThreadType::IO) {
MessagePort::CreatePair(&client_, &server_);
}
~MessagePortTest() override = default;
void SetDefaultReceivers() {
client_->SetReceiver(&client_receiver_);
server_->SetReceiver(&server_receiver_);
}
// Posts multiple |messages| from |sender| to |receiver| and validates their
// arrival order
void PostMessages(const std::vector<std::string>& messages,
MessagePort* sender,
TestMessagePortReceiver* receiver) {
for (const auto& message : messages) {
sender->PostMessage(message);
}
EXPECT_TRUE(receiver->RunUntilMessageCountEqual(messages.size()));
for (size_t i = 0; i < messages.size(); i++) {
EXPECT_EQ(receiver->buffer()[i].first, messages[i]);
}
}
// Posts a |port| from |sender| to |receiver| and validates its arrival.
// Returns the transferred |port|.
std::unique_ptr<MessagePort> PostMessageWithTransferables(
std::unique_ptr<MessagePort> port,
MessagePort* sender,
TestMessagePortReceiver* receiver) {
std::vector<std::unique_ptr<MessagePort>> ports;
ports.emplace_back(std::move(port));
sender->PostMessageWithTransferables("", std::move(ports));
EXPECT_TRUE(receiver->RunUntilMessageCountEqual(1));
EXPECT_EQ(receiver->buffer()[0].second.size(), (size_t)1);
return std::move(receiver->buffer()[0].second[0]);
}
void TestPostMessage() {
SetDefaultReceivers();
PostMessages({"from client"}, client_.get(), &server_receiver_);
PostMessages({"from server"}, server_.get(), &client_receiver_);
}
protected:
std::unique_ptr<MessagePort> client_;
std::unique_ptr<MessagePort> server_;
TestMessagePortReceiver client_receiver_;
TestMessagePortReceiver server_receiver_;
private:
const base::test::TaskEnvironment task_environment_;
};
TEST_F(MessagePortTest, Close) {
SetDefaultReceivers();
ASSERT_TRUE(client_->CanPostMessage());
ASSERT_TRUE(server_->CanPostMessage());
server_->Close();
client_receiver_.RunUntilDisconnected();
ASSERT_FALSE(client_->CanPostMessage());
ASSERT_FALSE(server_->CanPostMessage());
}
TEST_F(MessagePortTest, OnError) {
server_receiver_.SetOnMessageResult(false);
SetDefaultReceivers();
client_->PostMessage("");
#if defined(OS_FUCHSIA)
// blink::WebMessagePort reports failure when PostMessage returns false, but
// fuchsia::web::MessagePort will not report the error until the port closes
server_receiver_.RunUntilMessageCountEqual(1);
server_.reset();
#endif
client_receiver_.RunUntilDisconnected();
}
TEST_F(MessagePortTest, PostMessage) {
TestPostMessage();
}
TEST_F(MessagePortTest, PostMessageMultiple) {
SetDefaultReceivers();
PostMessages({"c1", "c2", "c3"}, client_.get(), &server_receiver_);
PostMessages({"s1", "s2", "s3"}, server_.get(), &client_receiver_);
}
TEST_F(MessagePortTest, PostMessageWithTransferables) {
std::unique_ptr<MessagePort> port0;
std::unique_ptr<MessagePort> port1;
TestMessagePortReceiver port0_receiver;
TestMessagePortReceiver port1_receiver;
MessagePort::CreatePair(&port0, &port1);
// If the ports are represented by multiple types as in the case of
// MessagePortFuchsia, make sure both are transferrable
SetDefaultReceivers();
port0 = PostMessageWithTransferables(std::move(port0), client_.get(),
&server_receiver_);
port1 = PostMessageWithTransferables(std::move(port1), server_.get(),
&client_receiver_);
// Make sure the ports are still usable
port0->SetReceiver(&port0_receiver);
port1->SetReceiver(&port1_receiver);
PostMessages({"from port0"}, port0.get(), &port1_receiver);
PostMessages({"from port1"}, port1.get(), &port0_receiver);
}
TEST_F(MessagePortTest, WrapPlatformPort) {
// Initialize ports from the platform type instead of agnostic CreatePair
#if defined(OS_FUCHSIA)
fidl::InterfaceHandle<fuchsia::web::MessagePort> port0;
fidl::InterfaceRequest<fuchsia::web::MessagePort> port1 = port0.NewRequest();
client_ = MessagePortFuchsia::Create(std::move(port0));
server_ = MessagePortFuchsia::Create(std::move(port1));
#else
auto pair = blink::WebMessagePort::CreatePair();
client_ = MessagePortCast::Create(std::move(pair.first));
server_ = MessagePortCast::Create(std::move(pair.second));
#endif // defined(OS_FUCHSIA)
TestPostMessage();
}
TEST_F(MessagePortTest, UnwrapPlatformPortCast) {
// Test unwrapping via TakePort (rewrapped for test methods)
#if defined(OS_FUCHSIA)
client_ = MessagePortFuchsia::Create(
MessagePortFuchsia::FromMessagePort(client_.get())->TakeClientHandle());
server_ = MessagePortFuchsia::Create(
MessagePortFuchsia::FromMessagePort(server_.get())->TakeServiceRequest());
#else
client_ = MessagePortCast::Create(
MessagePortCast::FromMessagePort(client_.get())->TakePort());
server_ = MessagePortCast::Create(
MessagePortCast::FromMessagePort(server_.get())->TakePort());
#endif // defined(OS_FUCHSIA)
TestPostMessage();
}
} // namespace cast_api_bindings
| 34.350282 | 85 | 0.731086 | [
"vector"
] |
97b91716671e80fbfe3682afff1f1100814ad259 | 1,931 | cpp | C++ | Exam/Task-2/task-2.cpp | kgolov/uni-data-structures | 8d8b2ff75ffa0ceed3ebe7bbc294680134b7d1c1 | [
"MIT"
] | null | null | null | Exam/Task-2/task-2.cpp | kgolov/uni-data-structures | 8d8b2ff75ffa0ceed3ebe7bbc294680134b7d1c1 | [
"MIT"
] | null | null | null | Exam/Task-2/task-2.cpp | kgolov/uni-data-structures | 8d8b2ff75ffa0ceed3ebe7bbc294680134b7d1c1 | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
using namespace std;
int main() {
int n;
cin >> n;
vector<int> arr(n);
for (int i = 0; i < n; i++) {
cin >> arr[i];
}
int queries;
cin >> queries;
int input;
for (int i = 0; i < queries; i++) {
cin >> input;
int left = 0;
int right = n - 1;
int middle;
int foundAtIndex = -1;
while (left <= right) {
middle = left + (right - left) / 2;
if (input < arr[middle]) {
right = middle - 1;
}
else if (input > arr[middle]) {
left = middle + 1;
}
else {
foundAtIndex = middle;
break;
}
}
if (foundAtIndex != -1) {
int leftIndex = foundAtIndex;
int rightIndex = foundAtIndex;
while (leftIndex >= 0 && arr[leftIndex] == input) {
leftIndex--;
}
leftIndex++;
while (rightIndex < n && arr[rightIndex] == input) {
rightIndex++;
}
rightIndex--;
cout << leftIndex << " " << rightIndex << endl;
}
else {
// We must find the first bigger one than the needed
left = 0;
right = n - 1;
if (input > arr[right]) {
cout << right + 1 << endl;
continue;
}
int firstBigger = 0;
while (left <= right) {
middle = left + (right - left) / 2;
if (arr[middle] > input) {
firstBigger = middle;
right = middle - 1;
}
else if (arr[middle] < input) {
left = middle + 1;
}
}
cout << firstBigger << endl;
}
}
return 0;
}
| 22.453488 | 64 | 0.380114 | [
"vector"
] |
97bb53a9500a4531d50aa94b8e3756c78398bd00 | 5,140 | cc | C++ | nansae/core/trie_test.cc | danielslee/nansae-corelib | ca365c39a8c05b1392435916a4326181d30a3ccf | [
"Apache-2.0"
] | null | null | null | nansae/core/trie_test.cc | danielslee/nansae-corelib | ca365c39a8c05b1392435916a4326181d30a3ccf | [
"Apache-2.0"
] | null | null | null | nansae/core/trie_test.cc | danielslee/nansae-corelib | ca365c39a8c05b1392435916a4326181d30a3ccf | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2015-2017 Daniel Shihoon Lee <daniel@nansae.im>
*
* 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 "nansae/core/trie.h"
#include "gtest/gtest.h"
#include <cstring>
#include <iostream>
TEST(Trie, findWord) {
NSL::Trie t;
t.addWord(NSL::String(u8"빨"), 7);
t.addWord(NSL::String(u8"빨갛"), 0);
t.addWord(NSL::String(u8"빨간"), 1);
t.addWord(NSL::String(u8"빨개"), 2);
t.addWord(NSL::String(u8"파랗"), 3);
t.addWord(NSL::String(u8"파란"), 4);
t.addWord(NSL::String(u8"빨래"), 5);
t.addWord(NSL::String(u8"빨리"), 6);
t.freeze();
ASSERT_EQ(t.findWord(NSL::String(u8"빨간")), 1);
ASSERT_EQ(t.findWord(NSL::String(u8"파랗")), 3);
ASSERT_EQ(t.findWord(NSL::String(u8"빨")), 7);
ASSERT_EQ(t.findWord(NSL::String(u8"빨가")), NIME_TRIE_WORD_NOT_FOUND);
ASSERT_EQ(t.findWord(NSL::String(u8"빨간색")), NIME_TRIE_WORD_NOT_FOUND);
}
TEST(Trie, findWordIdPaires) {
NSL::Trie t;
t.addWord(NSL::String(u8"빨"), 7);
t.addWord(NSL::String(u8"빨갛"), 0);
t.addWord(NSL::String(u8"빨간"), 1);
t.addWord(NSL::String(u8"빨개"), 2);
t.addWord(NSL::String(u8"파랗"), 3);
t.addWord(NSL::String(u8"파란"), 4);
t.addWord(NSL::String(u8"빨래"), 5);
t.addWord(NSL::String(u8"빨리"), 6);
t.addWord(NSL::String(u8"파"), 9);
t.freeze();
std::vector<NSL::Trie::WordIdPair> prefixes =
t.findWordPrefixes(NSL::String(u8"빨간색"));
ASSERT_EQ(prefixes[0].str, NSL::String(u8"빨"));
ASSERT_EQ(prefixes[1].str, NSL::String(u8"빨간"));
prefixes = t.findWordPrefixes(NSL::String(u8"파랗다"));
ASSERT_EQ(prefixes[0].str, NSL::String(u8"파"));
ASSERT_EQ(prefixes[1].str, NSL::String(u8"파랗"));
}
TEST(Trie, writeLoad) {
NSL::Trie t;
t.addWord(NSL::String(u8"빨갛"), 0);
t.addWord(NSL::String(u8"빨간"), 1);
t.addWord(NSL::String(u8"빨개"), 2);
t.addWord(NSL::String(u8"파랗"), 3);
t.addWord(NSL::String(u8"파란"), 4);
t.addWord(NSL::String(u8"빨래"), 5);
t.addWord(NSL::String(u8"빨리"), 6);
t.freeze();
std::stringstream s;
t.writeToStream(s);
NSL::Trie t2;
t2.freeze();
t2.loadFromStream(s);
ASSERT_EQ(t2.findWord(NSL::String(u8"빨간")), 1);
ASSERT_EQ(t2.findWord(NSL::String(u8"파랗")), 3);
ASSERT_EQ(t2.findWord(NSL::String(u8"빨가")), NIME_TRIE_WORD_NOT_FOUND);
ASSERT_EQ(t2.findWord(NSL::String(u8"빨간색")), NIME_TRIE_WORD_NOT_FOUND);
}
TEST(Trie, doubleInsert) {
NSL::Trie t;
t.addWord(NSL::String(u8"빨갛"), 0);
t.addWord(NSL::String(u8"빨간"), 1);
t.addWord(NSL::String(u8"빨개"), 2);
t.addWord(NSL::String(u8"파랗"), 3);
t.addWord(NSL::String(u8"파란"), 4);
t.addWord(NSL::String(u8"빨래"), 5);
t.addWord(NSL::String(u8"빨리"), 6);
ASSERT_EQ(t.addWord(NSL::String(u8"빨개"), 0, false), 2);
ASSERT_EQ(t.addWord(NSL::String(u8"파랗"), 0, false), 3);
ASSERT_EQ(t.addWord(NSL::String(u8"빨래"), 0, false), 5);
ASSERT_EQ(t.addWord(NSL::String(u8"빨리"), 0, false), 6);
t.freeze();
std::stringstream s;
t.writeToStream(s);
NSL::Trie t2;
t2.freeze();
t2.loadFromStream(s);
ASSERT_EQ(t2.findWord(NSL::String(u8"빨간")), 1);
ASSERT_EQ(t2.findWord(NSL::String(u8"파랗")), 3);
ASSERT_EQ(t2.findWord(NSL::String(u8"빨가")), NIME_TRIE_WORD_NOT_FOUND);
ASSERT_EQ(t2.findWord(NSL::String(u8"빨간색")), NIME_TRIE_WORD_NOT_FOUND);
}
TEST(Trie, doubleInsert2) {
NSL::Trie t;
ASSERT_EQ(t.addWord(NSL::String(u8"자기완성"), 0, false), 0);
ASSERT_EQ(t.addWord(NSL::String(u8"자"), 1, false), 1);
ASSERT_EQ(t.addWord(NSL::String(u8"자기"), 2, false), 2);
ASSERT_EQ(t.addWord(NSL::String(u8"자기완성"), 0, false), 0);
ASSERT_EQ(t.addWord(NSL::String(u8"자"), 1, false), 1);
ASSERT_EQ(t.addWord(NSL::String(u8"자기"), 2, false), 2);
t.freeze();
ASSERT_EQ(t.findWord(NSL::String(u8"자")), 1);
ASSERT_EQ(t.findWord(NSL::String(u8"자기완성")), 0);
}
TEST(Trie, iteration) {
NSL::Trie t;
t.addWord(NSL::String(u8"빨갛"), 0);
t.addWord(NSL::String(u8"빨간"), 1);
t.addWord(NSL::String(u8"빨개"), 2);
t.addWord(NSL::String(u8"파랗"), 3);
t.addWord(NSL::String(u8"파란"), 4);
t.addWord(NSL::String(u8"빨래"), 5);
t.addWord(NSL::String(u8"빨리"), 6);
t.freeze();
std::vector<NSL::String> words = {
NSL::String("빨갛"), NSL::String(u8"빨간"), NSL::String(u8"빨개"),
NSL::String(u8"파랗"), NSL::String(u8"파란"), NSL::String(u8"빨래"),
NSL::String(u8"빨리")};
bool idFound[] = {false, false, false, false, false, false, false};
for (NSL::Trie::WordIdPair wip : t) {
ASSERT_EQ(words[wip.id], wip.str);
NSL::Trie::WordIdPair copy(wip);
ASSERT_EQ(words[copy.id].toStdString(), copy.str.toStdString());
idFound[wip.id] = true;
// std::cout << wip.str.toStdString() << ": " << wip.id << "\n";
}
for (int i = 0; i < 7; i++) {
ASSERT_EQ(idFound[i], true);
}
}
| 31.533742 | 75 | 0.641634 | [
"vector"
] |
97c170d1ce148bbdfc6237a451b00f6ae8308c6f | 7,556 | cpp | C++ | src/renderImage.cpp | Wasabi2007/AlphaToMesh | 67f909eb5d510090f51c2596ec543f82b989defa | [
"Unlicense",
"MIT"
] | 1 | 2021-10-30T06:46:50.000Z | 2021-10-30T06:46:50.000Z | src/renderImage.cpp | Wasabi2007/AlphaToMesh | 67f909eb5d510090f51c2596ec543f82b989defa | [
"Unlicense",
"MIT"
] | null | null | null | src/renderImage.cpp | Wasabi2007/AlphaToMesh | 67f909eb5d510090f51c2596ec543f82b989defa | [
"Unlicense",
"MIT"
] | null | null | null | //
// Created by Jerry on 18.07.2015.
//
#include "../lodepng/lodepng.h"
#include "renderImage.h"
#include <string>
#include <gtx/string_cast.hpp>
renderImage::renderImage(const char* filename):renderImage(imageStruct::load(filename)){
}
renderImage::renderImage(imageStruct* img):
img(img),VertexArrayID{0},vertexbuffer{0},
elementbuffer{0}, VertexShader{0}, FragmentShader{0},
ProgrammShader{0}, Texture{0},MVP{1}{
initGeom();
initShader();
initTexture();
}
void renderImage::Render() {
glBindVertexArray(VertexArrayID);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer);
glUseProgram(ProgrammShader);
glBindTexture(GL_TEXTURE_2D, Texture);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
}
void renderImage::initGeom() {
glGenVertexArrays(1, &VertexArrayID);
//cout << "gogo" << endl;
glBindVertexArray(VertexArrayID);
// An array of 3 vectors which represents 3 vertices
const GLfloat g_vertex_buffer_data[] = {
0.0f, 0.0f, 0.0f,//Position
0.0f, 0.0f, //UV
float(img->width), 0.0f, 0.0f,//Position
1.0f, 0.0f, //UV
float(img->width), float(img->height), 0.0f,//Position
1.0f, 1.0f, //UV
0.0f, float(img->height), 0.0f,//Position
0.0f, 1.0f, //UV
};
// Generate 1 buffer, put the resulting identifier in vertexbuffer
glGenBuffers(1, &vertexbuffer);
// The following commands will talk about our 'vertexbuffer' buffer
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
// Give our vertices to OpenGL.
glBufferData(GL_ARRAY_BUFFER, sizeof(g_vertex_buffer_data), g_vertex_buffer_data, GL_STATIC_DRAW);
// 1rst attribute buffer : vertices
glEnableVertexAttribArray(1);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glVertexAttribPointer(
1, // attribute 0. No particular reason for 0, but must match the layout in the shader.
3, // size
GL_FLOAT, // type
GL_FALSE, // normalized?
(3*4)+8, // stride
(void*)0 // array buffer offset
);
glEnableVertexAttribArray(2);
glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer);
glVertexAttribPointer(
2, // attribute 0. No particular reason for 0, but must match the layout in the shader.
2, // size
GL_FLOAT, // type
GL_FALSE, // normalized?
(3*4)+8, // stride
(void*)(3*4) // array buffer offset
);
static std::vector<unsigned int> indices;
indices.clear();
// fill "indices" as needed
indices.push_back(0);
indices.push_back(1);
indices.push_back(2);
indices.push_back(2);
indices.push_back(3);
indices.push_back(0);
// Generate a buffer for the indices
glGenBuffers(1, &elementbuffer);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer);
glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned int), &indices[0], GL_STATIC_DRAW);
}
void renderImage::initShader() {
// Create the shaders
VertexShader = glCreateShader(GL_VERTEX_SHADER);
FragmentShader = glCreateShader(GL_FRAGMENT_SHADER);
// Read the Vertex Shader code from the file
std::string VertexShaderCode;
VertexShaderCode += "#version 330\n";
VertexShaderCode += "in vec4 in_pos;\n";
VertexShaderCode += "in vec2 in_uv;\n";
VertexShaderCode += "uniform mat4 MVP;\n";
VertexShaderCode += "out vec2 var_uv;\n";
VertexShaderCode += "void main(){\n";
VertexShaderCode += "gl_Position=MVP*in_pos;\n";
VertexShaderCode += "var_uv=in_uv;\n";
VertexShaderCode += "}\n";
// Read the Fragment Shader code from the file
std::string FragmentShaderCode;
FragmentShaderCode += "#version 330\n";
FragmentShaderCode += "in vec2 var_uv;\n";
FragmentShaderCode += "uniform sampler2D tex;\n";
FragmentShaderCode += "out vec4 out_color;\n";
FragmentShaderCode += "void main(){\n";
FragmentShaderCode += "out_color=texture(tex,var_uv);\n";
FragmentShaderCode += "}\n";
GLint Result = GL_FALSE;
int InfoLogLength;
char const * VertexSourcePointer = VertexShaderCode.c_str();
glShaderSource(VertexShader, 1, &VertexSourcePointer , NULL);
glCompileShader(VertexShader);
// Check Vertex Shader
glGetShaderiv(VertexShader, GL_COMPILE_STATUS, &Result);
glGetShaderiv(VertexShader, GL_INFO_LOG_LENGTH, &InfoLogLength);
std::vector<char> VertexShaderErrorMessage(InfoLogLength);
glGetShaderInfoLog(VertexShader, InfoLogLength, NULL, &VertexShaderErrorMessage[0]);
fprintf(stdout, "%s\n", &VertexShaderErrorMessage[0]);
// Compile Fragment Shader
char const * FragmentSourcePointer = FragmentShaderCode.c_str();
glShaderSource(FragmentShader, 1, &FragmentSourcePointer , NULL);
glCompileShader(FragmentShader);
// Check Fragment Shader
glGetShaderiv(FragmentShader, GL_COMPILE_STATUS, &Result);
glGetShaderiv(FragmentShader, GL_INFO_LOG_LENGTH, &InfoLogLength);
std::vector<char> FragmentShaderErrorMessage(InfoLogLength);
glGetShaderInfoLog(FragmentShader, InfoLogLength, NULL, &FragmentShaderErrorMessage[0]);
fprintf(stdout, "%s\n", &FragmentShaderErrorMessage[0]);
// Link the program
//fprintf(stdout, "Linking program\n");
ProgrammShader = glCreateProgram();
glAttachShader(ProgrammShader, VertexShader);
glAttachShader(ProgrammShader, FragmentShader);
glBindAttribLocation(ProgrammShader, 1, "in_pos");//Attribut Nummer 1 soll in in_pos im Vertex Shader zur Verf�gung stehen
glBindAttribLocation(ProgrammShader, 2, "in_uv");//Attribut Nummer 3 soll in in_uv im Vertex Shader zur Verf�gung stehen
glBindFragDataLocation(ProgrammShader, 0, "out_color");//out_color ist Farbe 0 (die in dem Framebuffer geschrieben werden)
glLinkProgram(ProgrammShader);
// Check the program
glGetProgramiv(ProgrammShader, GL_LINK_STATUS, &Result);
glGetProgramiv(ProgrammShader, GL_INFO_LOG_LENGTH, &InfoLogLength);
std::vector<char> ProgramErrorMessage( InfoLogLength );
glGetProgramInfoLog(ProgrammShader, InfoLogLength, NULL, &ProgramErrorMessage[0]);
fprintf(stdout, "%s\n", &ProgramErrorMessage[0]);
glUseProgram(ProgrammShader);
glUniform1i(glGetUniformLocation(ProgrammShader, "tex"), 0);
reloadMVP(mat4());
}
renderImage::~renderImage(){
glDeleteShader(VertexShader);
glDeleteShader(FragmentShader);
glDeleteShader(ProgrammShader);
}
void renderImage::reloadMVP(mat4 mvp){
MVP = mvp;
//std::cout << glm::to_string(MVP) << std::endl;
glUseProgram(ProgrammShader);
GLint MatrixID = glGetUniformLocation(ProgrammShader, "MVP");
glUniformMatrix4fv(MatrixID, 1, GL_FALSE, &MVP[0][0]);
}
void renderImage::initTexture() {
glGenTextures(1, &Texture);
glBindTexture(GL_TEXTURE_2D, Texture);
glTexImage2D(GL_TEXTURE_2D, 0,GL_RGBA, img->width, img->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, img->image.data());
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
}
| 35.980952 | 127 | 0.659211 | [
"render",
"vector"
] |
97c902477825af56401f5257f8e9aa71d0b3ca7d | 3,655 | cpp | C++ | CH5 Errors/E14.cpp | essentialblend/cplusplus-mega | 23a91280532f246c96ad4d918bff4b8e15c30ac6 | [
"MIT"
] | null | null | null | CH5 Errors/E14.cpp | essentialblend/cplusplus-mega | 23a91280532f246c96ad4d918bff4b8e15c30ac6 | [
"MIT"
] | null | null | null | CH5 Errors/E14.cpp | essentialblend/cplusplus-mega | 23a91280532f246c96ad4d918bff4b8e15c30ac6 | [
"MIT"
] | null | null | null | // Read (day-of-the-week,value) pairs from standard input. Collect all the values for each day of the week in a vector<int>. Write out the values of the seven day-of-the-week vectors. Print out the sum of the values in each vector. Ignore illegal days of the week, such as Funday, but accept common synonyms such as Mon and monday. Write out the number of rejected values.
#include <iostream>
#include <vector>
std::vector<int> monArr{};
std::vector<int> tueArr{};
std::vector<int> wedArr{};
std::vector<int> thuArr{};
std::vector<int> friArr{};
std::vector<int> satArr{};
std::vector<int> sunArr{};
int rejectedDays{ 0 };
int SortPairs(std::string dayStr, int dayVal)
{
int contStr = 0;
if (dayStr == "Monday" || dayStr == "monday" || dayStr == "Mon" || dayStr == "mon")
{
monArr.push_back(dayVal);
}
else if (dayStr == "Tuesday" || dayStr == "tuesday" || dayStr == "Tue" || dayStr == "tue")
{
tueArr.push_back(dayVal);
}
else if (dayStr == "Wednesday" || dayStr == "wednesday" || dayStr == "Wed" || dayStr == "wed")
{
wedArr.push_back(dayVal);
}
else if (dayStr == "Thursday" || dayStr == "thursday" || dayStr == "Thu" || dayStr == "thu")
{
thuArr.push_back(dayVal);
}
else if (dayStr == "Friday" || dayStr == "friday" || dayStr == "Fri" || dayStr == "fri")
{
friArr.push_back(dayVal);
}
else if (dayStr == "Saturday" || dayStr == "saturday" || dayStr == "Sat" || dayStr == "sat")
{
satArr.push_back(dayVal);
}
else if (dayStr == "Sunday" || dayStr == "sunday" || dayStr == "Sun" || dayStr == "sun")
{
sunArr.push_back(dayVal);
}
else if (dayStr == "|" && dayVal == 0)
{
contStr = -1;
}
else
{
rejectedDays++;
}
return contStr;
}
int GetSums(std::vector<int> dayArr)
{
int sum{ 0 };
for (int i{ 0 }; i < dayArr.size(); ++i)
{
sum += dayArr[i];
}
return sum;
}
void DisplayData(std::string dayString, std::vector<int> dayArr)
{
if (dayArr.size() > 0)
{
std::cout << dayString << ": ";
for (int i{ 0 }; i < dayArr.size(); ++i)
{
if (i == (dayArr.size() - 1))
{
std::cout << dayArr[i] << ".\n";
std::cout << "The sum is: " << GetSums(dayArr) << ".\n\n";
}
else
{
std::cout << dayArr[i] << ", ";
}
}
}
}
int main()
try
{
std::string userDay;
int userNum{ 0 };
int contVal{ 0 };
std::cout << "Enter a day and a #, foll. by a space (Tuesday 15): ";
while (std::cin >> userDay >> userNum)
{
/*if (!(std::cin >> userDay >> userNum))
{
throw std::runtime_error("Invalid input type!");
}*/
contVal = SortPairs(userDay, userNum);
if (contVal == -1)
{
std::cout << "Values........\n";
DisplayData("Mondays: ", monArr);
DisplayData("Tuesdays: ", tueArr);
DisplayData("Wednesdays: ", wedArr);
DisplayData("Thursdays: ", thuArr);
DisplayData("Fridays: ", friArr);
DisplayData("Saturdays: ", satArr);
DisplayData("Sundays: ", sunArr);
std::cout << rejectedDays << " values were REJECTED!!\n";
return 0;
}
}
}
catch (std::exception& e)
{
std::cout << "Runtime error: " << e.what();
}
catch (...)
{
std::cout << "Unknown exception!";
} | 29.24 | 373 | 0.499316 | [
"vector"
] |
97c9e043b9cd9385c3af8a0487b1bf314ab01dfb | 51,544 | cpp | C++ | source/LibFgWin/FgDirect3D.cpp | SingularInversions/FaceGenBaseLibrary | e928b482fa78597cfcf3923f7252f7902ec0dfa9 | [
"MIT"
] | 41 | 2016-04-09T07:48:10.000Z | 2022-03-01T15:46:08.000Z | source/LibFgWin/FgDirect3D.cpp | SingularInversions/FaceGenBaseLibrary | e928b482fa78597cfcf3923f7252f7902ec0dfa9 | [
"MIT"
] | 9 | 2015-09-23T10:54:50.000Z | 2020-01-04T21:16:57.000Z | source/LibFgWin/FgDirect3D.cpp | SingularInversions/FaceGenBaseLibrary | e928b482fa78597cfcf3923f7252f7902ec0dfa9 | [
"MIT"
] | 29 | 2015-10-01T14:44:42.000Z | 2022-01-05T01:28:43.000Z | //
// Coypright (c) 2021 Singular Inversions Inc. (facegen.com)
// Use, modification and distribution is subject to the MIT License,
// see accompanying file LICENSE.txt or facegen.com/base_library_license.txt
//
// * Requires D3D 11.1 runtime / DXGI 11.1 (guaranteed on Win7 SP1 and higher, released 12.08.
// Direct3D 11 subset of DirectX 11.
// * Requires GPU hardware support for 11.0 (no OIT) or 11.1 (OIT)
// * D3D 11.2 is NOT supported on Win7 but we don't need its features anyway.
// * D3D 11.0 is the earliest version to use shader model 5.0. As of 19.08 you can't buy a standalone
// GPU that doesn't support 11.1, and only the very lowest Intel CPU onboard GPU doesn't.
// * D3D Uses LEFT-handed coordinate systems with CLOCKWISE winding.
// * D3VS - Direct3D View Space / Camera Space (LEFT handed coordinate system)
// Origin at principal point, no units specified
// X - camera's right
// Y - camera's up
// Z - camera direction
// * D3PS - Direct3D Projection Space (LEFT handed coordinate system)
// X - image right, clip [-1,1]
// Y - image up, clip [-1,1]
// Z - depth (near to far) [0,1]
// * D3SS - Direct3D Screen Space
// Top left pixel (0,0) bottom right pixel (X-1,Y-1)
// * D3TC = DirectD Texture Coordinates
// X - image right [0,1]
// Y - image down [0,1]
// * Indexed rendering was not possible as D3D does not support multiple indices per
// vertex so that would require some complex logic to determine which vertes to duplicate
// for uv seams. Expanding all per-vertex data is ~6x memory so if this becomes an issue then
// add triangle stripping (via indices created at file load time).
// * Quad rendering is not built-in (to any modern GPU) and complicated to do manually, so create
// the edges in CPU and use line rendering on GPU.
//
#include "stdafx.h"
// The corresponding DLLs appear to always be included with Win 7SP1,8,10:
#pragma comment (lib,"dxgi.lib")
#pragma comment (lib,"d3d11.lib")
// However the following was NOT present on some windows machines so we don't use the compilation API:
// d3dcompiler.lib -> d3dcompiler_47.dll
#include "FgDirect3D.hpp"
#include "FgGuiWin.hpp"
#include "FgFileSystem.hpp"
#include "FgHex.hpp"
#include "Fg3dMesh.hpp"
#define FG_ASSERT_D3D(hr) handleHResult(__FILE__,__LINE__,hr)
using namespace std;
namespace Fg {
String8s
getGpusDescription()
{
String8s ret;
IDXGIAdapter1 * pAdapter;
IDXGIFactory1* pFactory = nullptr;
if(FAILED(CreateDXGIFactory1(__uuidof(IDXGIFactory) ,(void**)&pFactory)))
return ret;
for (uint ii=0;pFactory->EnumAdapters1(ii,&pAdapter) != DXGI_ERROR_NOT_FOUND;++ii) {
DXGI_ADAPTER_DESC1 desc;
pAdapter->GetDesc1(&desc);
ret.push_back("Adapter"+toStr(ii)+": "+String8(wstring(desc.Description)));
}
if(pFactory)
pFactory->Release();
return ret;
}
String8
getDefaultGpuDescription()
{
String8s gpus = getGpusDescription();
if (gpus.empty())
return "No GPUs detected";
else
return gpus[0];
}
void
PipelineState::attachVertexShader(ComPtr<ID3D11Device> pDevice)
{
string shaderIR = loadRaw(dataDir()+"base/shaders/dx11_shared_VS.cso");
HRESULT hr;
hr = pDevice->CreateVertexShader(shaderIR.data(),shaderIR.size(),nullptr,m_pVertexShader.GetAddressOf());
FG_ASSERT_HR(hr);
array<pair<char const *,DXGI_FORMAT>,3> semantics {{
{"POSITION",DXGI_FORMAT_R32G32B32_FLOAT},
{"NORMAL", DXGI_FORMAT_R32G32B32_FLOAT},
{"TEXCOORD",DXGI_FORMAT_R32G32_FLOAT}
}};
vector<D3D11_INPUT_ELEMENT_DESC> inputLayoutDescs;
D3D11_INPUT_ELEMENT_DESC elementDesc = {};
for (auto sem : semantics) {
elementDesc.SemanticName = sem.first;
elementDesc.SemanticIndex = 0;
elementDesc.AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
elementDesc.InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
elementDesc.Format = sem.second;
inputLayoutDescs.push_back(elementDesc);
}
hr = pDevice->CreateInputLayout(
inputLayoutDescs.data(),static_cast<uint32_t>(inputLayoutDescs.size()),
shaderIR.data(),shaderIR.size(),
m_pInputLayout.ReleaseAndGetAddressOf());
FG_ASSERT_HR(hr);
}
void
PipelineState::attachVertexShader2(ComPtr<ID3D11Device> pDevice)
{
string shaderIR = loadRaw(dataDir()+"base/shaders/dx11_transparent_VS.cso");
HRESULT hr;
hr = pDevice->CreateVertexShader(shaderIR.data(),shaderIR.size(),nullptr,m_pVertexShader.GetAddressOf());
FG_ASSERT_HR(hr);
vector<D3D11_INPUT_ELEMENT_DESC> inputLayoutDescs;
D3D11_INPUT_ELEMENT_DESC elementDesc = {};
elementDesc.SemanticName = "SV_VertexID";
elementDesc.SemanticIndex = 0;
elementDesc.AlignedByteOffset = D3D11_APPEND_ALIGNED_ELEMENT;
elementDesc.InputSlotClass = D3D11_INPUT_PER_VERTEX_DATA;
elementDesc.Format = DXGI_FORMAT_R32_UINT;
inputLayoutDescs.push_back(elementDesc);
hr = pDevice->CreateInputLayout(
inputLayoutDescs.data(),static_cast<uint32_t>(inputLayoutDescs.size()),
shaderIR.data(),shaderIR.size(),
m_pInputLayout.ReleaseAndGetAddressOf());
FG_ASSERT_HR(hr);
}
void
PipelineState::attachPixelShader(ComPtr<ID3D11Device> pDevice,string const & fname)
{
string shaderIR = loadRaw(dataDir()+"base/shaders/"+fname);
HRESULT hr = pDevice->CreatePixelShader(shaderIR.data(),shaderIR.size(),
nullptr, m_pPixelShader.GetAddressOf());
FG_ASSERT_HR(hr);
}
void
PipelineState::apply(ComPtr<ID3D11DeviceContext> pContext)
{
pContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
pContext->IASetInputLayout(m_pInputLayout.Get());
pContext->VSSetShader(m_pVertexShader.Get(),nullptr,0);
pContext->PSSetShader(m_pPixelShader.Get(),nullptr,0);
}
D3d::D3d(HWND hwnd,NPT<RendMeshes> rmsN,NPT<double> lrsN) : rendMeshesN{rmsN}, logRelSize{lrsN}
{
origMeshesDimsN = link1<RendMeshes,Vec3F>(rendMeshesN,[](RendMeshes const & rms)
{
Mat32F bounds {floatMax(),-floatMax(), floatMax(),-floatMax(), floatMax(),-floatMax()};
for (RendMesh const & rm : rms) {
Mat32F bnds = cBounds(rm.origMeshN.cref().verts);
bounds = cBoundsUnion(bounds,bnds);
}
return bounds.colVec(1) - bounds.colVec(0);
});
HRESULT hr = 0;
{
// Use dummy size; window size not yet determined:
uint const width = 8,
height = 8;
//Create device and swapchain
DXGI_SWAP_CHAIN_DESC desc = {};
desc.BufferCount = 2; // Front and back buffer
desc.BufferDesc.Width = width;
desc.BufferDesc.Height = height;
desc.BufferDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.BufferDesc.RefreshRate.Numerator = 60;
desc.BufferDesc.RefreshRate.Denominator = 1;
desc.BufferUsage = DXGI_USAGE_RENDER_TARGET_OUTPUT;
desc.OutputWindow = hwnd;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Windowed = true;
uint32_t createFlag = 0;
#ifdef _DEBUG
createFlag |= D3D11_CREATE_DEVICE_DEBUG;
#endif
// We must attempt multiple setup calls until we find the best available driver.
// Software driver for 11.1 with OIT didn't work (Win7SP1) so don't go there.
Svec<tuple<D3D_FEATURE_LEVEL,D3D_DRIVER_TYPE,DXGI_SWAP_EFFECT> > configs = {
// FLIP_DISCARD only supported by Win 10 but must be used in that case as some systems
// with fail to consistently display buffer without it:
{D3D_FEATURE_LEVEL_11_1,D3D_DRIVER_TYPE_HARDWARE,DXGI_SWAP_EFFECT_FLIP_DISCARD},
{D3D_FEATURE_LEVEL_11_1,D3D_DRIVER_TYPE_HARDWARE,DXGI_SWAP_EFFECT_DISCARD},
{D3D_FEATURE_LEVEL_11_0,D3D_DRIVER_TYPE_HARDWARE,DXGI_SWAP_EFFECT_DISCARD},
// Warp driver is very fast:
{D3D_FEATURE_LEVEL_11_0,D3D_DRIVER_TYPE_WARP,DXGI_SWAP_EFFECT_DISCARD},
{D3D_FEATURE_LEVEL_11_0,D3D_DRIVER_TYPE_REFERENCE,DXGI_SWAP_EFFECT_DISCARD}
};
string failString;
for (auto config : configs) {
supports11_1 = (get<0>(config) == D3D_FEATURE_LEVEL_11_1);
supportsFlip = (get<2>(config) == DXGI_SWAP_EFFECT_FLIP_DISCARD);
desc.SwapEffect = get<2>(config);
// If a system doesn't support 11.1 this returns E_INVALIDARG (0x80070057)
// If a system doesn't support 11.0 this returns DXGI_ERROR_UNSUPPORTED (0x887A0004)
// E_FAIL (0x80004005) "debug layer enabled but not installed" happens quite a bit ...
// DXGI_ERROR_SDK_COMPONENT_MISSING (0x887A002D) SDK needed for debug layer ? only seen once
hr = D3D11CreateDeviceAndSwapChain( // Creates an immediate mode rendering context
nullptr, // Use first video adapter (card/driver) if more than one of this type
get<1>(config), // Driver type
nullptr, // No software rasterizer DLL handle
createFlag,
&get<0>(config),1, // Feature level
D3D11_SDK_VERSION,
&desc,
pSwapChain.GetAddressOf(), // Returned
pDevice.GetAddressOf(), // Returned
nullptr,nullptr);
if (SUCCEEDED(hr))
break;
failString += "HR="+toHexString(hr)+" ";
}
if (FAILED(hr))
throwWindows("No Direct3D 11.0 support",failString);
this->initializeRenderTexture(Vec2UI(width,height));
pDevice->GetImmediateContext(pContext.GetAddressOf());
}
opaquePassPSO.attachVertexShader(pDevice);
opaquePassPSO.attachPixelShader(pDevice,"dx11_opaque_PS.cso");
if (supports11_1) {
transparentFirstPassPSO.attachVertexShader(pDevice);
transparentFirstPassPSO.attachPixelShader(pDevice,"dx11_transparent_PS1.cso");
transparentSecondPassPSO.attachVertexShader2(pDevice);
transparentSecondPassPSO.attachPixelShader(pDevice,"dx11_transparent_PS2.cso");
}
{
auto desc = CD3D11_BLEND_DESC(CD3D11_DEFAULT());
desc.RenderTarget[0].RenderTargetWriteMask = 0;
hr = pDevice->CreateBlendState(&desc,pBlendStateColorWriteDisable.GetAddressOf());
FG_ASSERT_D3D(hr);
}
{
auto desc = CD3D11_BLEND_DESC(CD3D11_DEFAULT());
hr = pDevice->CreateBlendState(&desc,pBlendStateDefault.GetAddressOf());
FG_ASSERT_D3D(hr);
}
{
auto desc = CD3D11_BLEND_DESC(CD3D11_DEFAULT());
desc.RenderTarget[0].BlendEnable = true;
desc.RenderTarget[0].SrcBlend = D3D11_BLEND_SRC_ALPHA;
desc.RenderTarget[0].DestBlend = D3D11_BLEND_INV_SRC_ALPHA;
desc.RenderTarget[0].BlendOp = D3D11_BLEND_OP_ADD;
desc.RenderTarget[0].SrcBlendAlpha = D3D11_BLEND_ONE;
desc.RenderTarget[0].DestBlendAlpha = D3D11_BLEND_ONE;
desc.RenderTarget[0].BlendOpAlpha = D3D11_BLEND_OP_MAX;
desc.RenderTarget[0].RenderTargetWriteMask = D3D11_COLOR_WRITE_ENABLE_ALL;
hr = pDevice->CreateBlendState(&desc,pBlendStateLerp.GetAddressOf());
FG_ASSERT_D3D(hr);
}
{
auto desc = CD3D11_DEPTH_STENCIL_DESC(CD3D11_DEFAULT());
desc.DepthEnable = false;
hr = pDevice->CreateDepthStencilState(&desc,pDepthStencilStateDisable.GetAddressOf());
FG_ASSERT_D3D(hr);
}
{
auto desc = CD3D11_DEPTH_STENCIL_DESC(CD3D11_DEFAULT());
desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ALL;
desc.DepthFunc = D3D11_COMPARISON_LESS_EQUAL;
hr = pDevice->CreateDepthStencilState(&desc,pDepthStencilStateWrite.GetAddressOf());
FG_ASSERT_D3D(hr);
}
{
auto desc = CD3D11_DEPTH_STENCIL_DESC(CD3D11_DEFAULT());
desc.DepthWriteMask = D3D11_DEPTH_WRITE_MASK_ZERO;
hr = pDevice->CreateDepthStencilState(&desc,pDepthStencilStateWriteDisable.GetAddressOf());
FG_ASSERT_D3D(hr);
}
{
auto desc = CD3D11_DEPTH_STENCIL_DESC(CD3D11_DEFAULT());
hr = pDevice->CreateDepthStencilState(&desc,pDepthStencilStateDefault.GetAddressOf());
FG_ASSERT_D3D(hr);
}
// Just in case 1x1 image has memory alignment and two-sided interpolation edge-case issues:
greyMap = makeMap(ImgRgba8(Vec2UI(2,2),Rgba8(200,200,200,255)));
blackMap = makeMap(ImgRgba8(Vec2UI(2,2),Rgba8(0,0,0,255)));
whiteMap = makeMap(ImgRgba8(Vec2UI(2,2),Rgba8(255,255,255,255)));
{
// Need floating point for subdivision to work:
auto tintFn = [](float b,float t) -> Svec<Vec4UC>
{
float constexpr c = 255;
Svec<Vec4F> init {{c,b,b,t},{c,c,b,t},{b,c,b,t},{b,c,c,t},{b,b,c,t},{c,b,c,t},};
return mapCast<Vec4UC>(subdivide(subdivide(init)));
};
Svec<Vec4UC> colsL = tintFn(200,255),
colsT = tintFn(200,127),
colsS = tintFn(100,255);
size_t N = colsL.size(); // 6 * 2 * 2 = 24 colors
tintMaps.reserve(N);
for (size_t ii=0; ii<N; ++ii) {
tintMaps.push_back(TintMap{
makeMap(ImgRgba8{Vec2UI{2},Rgba8{colsL[ii].m}}),
makeMap(ImgRgba8{Vec2UI{2},Rgba8{colsT[ii].m}}),
makeMap(ImgRgba8{Vec2UI{2},Rgba8{colsS[ii].m}}),
});
}
}
noModulationMap = makeMap(ImgRgba8(Vec2UI(2,2),Rgba8(64,64,64,255)));
icosahedron = reverseWinding(cIcosahedron()); // CC to CW
}
D3d::~D3d()
{
// Release any GPU data pointers held outside this object:
RendMeshes const & rms = rendMeshesN.cref();
for (RendMesh const & rm : rms) {
rm.gpuData->reset();
for (RendSurf const & rs : rm.rendSurfs)
rs.gpuData->reset();
}
if (pContext != nullptr) {
pContext->ClearState();
}
}
void
D3d::initializeRenderTexture(Vec2UI windowSize)
{
HRESULT hr;
{ // Create RTV from BackBuffer.
// There is no need to hold the pointer to the buffer since it's held by the view and
// will be automatically released when the view is released:
ComPtr<ID3D11Texture2D> pBackBuffer;
hr = pSwapChain->GetBuffer(
0,__uuidof(ID3D11Texture2D),reinterpret_cast<LPVOID*>(pBackBuffer.GetAddressOf()));
FG_ASSERT_D3D(hr);
hr = pDevice->CreateRenderTargetView(pBackBuffer.Get(),nullptr,pRTV.ReleaseAndGetAddressOf());
FG_ASSERT_D3D(hr);
}
{ //Create DSV from Depth Buffer
ComPtr<ID3D11Texture2D> pDepthBuffer;
D3D11_TEXTURE2D_DESC desc = {};
desc.ArraySize = 1;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.Format = DXGI_FORMAT_D24_UNORM_S8_UINT;
desc.Width = windowSize[0];
desc.Height = windowSize[1];
desc.MipLevels = 1;
desc.BindFlags = D3D11_BIND_DEPTH_STENCIL;
hr = pDevice->CreateTexture2D(&desc,nullptr,pDepthBuffer.GetAddressOf());
FG_ASSERT_D3D(hr);
hr = pDevice->CreateDepthStencilView(pDepthBuffer.Get(),nullptr,pDSV.ReleaseAndGetAddressOf());
FG_ASSERT_D3D(hr);
}
if (!supports11_1)
return;
{ //Create Head texture for OIT
ComPtr<ID3D11Texture2D> pTextureOIT;
D3D11_TEXTURE2D_DESC desc = {};
desc.ArraySize = 1;
desc.Width = windowSize[0];
desc.Height = windowSize[1];
desc.MipLevels = 1;
desc.SampleDesc.Count = 1;
desc.SampleDesc.Quality = 0;
desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE;
desc.Format = DXGI_FORMAT_R32_UINT;
hr = pDevice->CreateTexture2D(&desc,nullptr,pTextureOIT.GetAddressOf());
FG_ASSERT_D3D(hr);
hr = pDevice->CreateUnorderedAccessView(
pTextureOIT.Get(),nullptr,pUAVTextureHeadOIT.ReleaseAndGetAddressOf());
FG_ASSERT_D3D(hr);
}
{ //Create LinkedList with atomic counter for OIT
struct ListNode
{
uint32_t Next;
uint32_t Color;
float Depth;
};
uint32_t constexpr maxAverageLayers = 16;
ComPtr<ID3D11Buffer> pBufferOIT;
D3D11_BUFFER_DESC obd = {};
obd.ByteWidth = sizeof(ListNode) * windowSize[0] * windowSize[1] * maxAverageLayers;
obd.CPUAccessFlags = 0;
obd.BindFlags = (D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS);
obd.Usage = D3D11_USAGE_DEFAULT;
obd.MiscFlags = D3D11_RESOURCE_MISC_BUFFER_STRUCTURED;
obd.StructureByteStride = sizeof(ListNode);
hr = pDevice->CreateBuffer(&obd,nullptr,pBufferOIT.GetAddressOf());
FG_ASSERT_D3D(hr);
D3D11_UNORDERED_ACCESS_VIEW_DESC uavd = {};
uavd.ViewDimension = D3D11_UAV_DIMENSION_BUFFER;
uavd.Buffer.FirstElement = 0;
uavd.Buffer.Flags = D3D11_BUFFER_UAV_FLAG_COUNTER;
uavd.Buffer.NumElements = windowSize[0] * windowSize[1] * maxAverageLayers;
hr = pDevice->CreateUnorderedAccessView(
pBufferOIT.Get(),&uavd,pUAVBufferLinkedListOIT.ReleaseAndGetAddressOf());
FG_ASSERT_D3D(hr);
}
}
void
D3d::resize(Vec2UI windowSize)
{
if (pContext == nullptr)
return;
pContext->OMSetRenderTargets(0,nullptr,nullptr);
pRTV.Reset();
HRESULT hr = pSwapChain->ResizeBuffers(2,windowSize[0],windowSize[1],DXGI_FORMAT_UNKNOWN,0);
FG_ASSERT_D3D(hr);
this->initializeRenderTexture(windowSize);
CD3D11_VIEWPORT viewport {0.0f,0.0f,scast<float>(windowSize[0]),scast<float>(windowSize[1])};
pContext->RSSetViewports(1,&viewport);
}
WinPtr<ID3D11Buffer>
D3d::makeConstBuff(const Scene & scene)
{
D3D11_BUFFER_DESC bd = {};
bd.Usage = D3D11_USAGE_DEFAULT; // read/write by GPU only
bd.ByteWidth = sizeof(Scene);
bd.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
bd.CPUAccessFlags = 0;
ID3D11Buffer* ptr;
HRESULT hr = pDevice->CreateBuffer(&bd,nullptr,&ptr);
FG_ASSERT_D3D(hr);
pContext->UpdateSubresource(ptr,0,nullptr,&scene,0,0);
return WinPtr<ID3D11Buffer>(ptr);
}
WinPtr<ID3D11Buffer>
D3d::makeVertBuff(const Verts & verts)
{
if (verts.empty())
return WinPtr<ID3D11Buffer>(); // D3D gives error for zero size buffer creation
ID3D11Buffer* ptr;
D3D11_BUFFER_DESC bd = {};
bd.Usage = D3D11_USAGE_DEFAULT; // read/write by GPU only
bd.ByteWidth = sizeof(Vert) * uint(verts.size());
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.CPUAccessFlags = 0;
D3D11_SUBRESOURCE_DATA initData = {};
initData.pSysMem = verts.data();
HRESULT hr = pDevice->CreateBuffer(&bd,&initData,&ptr);
FG_ASSERT_D3D(hr);
return WinPtr<ID3D11Buffer>(ptr);
}
// Returns null pointer if no surf points:
WinPtr<ID3D11Buffer>
D3d::makeSurfPoints(RendMesh const & rendMesh,Mesh const & origMesh)
{
// This isn't quite right since it will recalc when anything in rendMeshesN changes ...
// but it's not clear what the perfect solution would look like.
// Use the median dimension because we don't want use of a full body mesh to make the
// markers too small to see, and use of a very flat face cutout to make them too big.
float sz = cMedian(origMeshesDimsN.val().m) * (1.0f / 160.0f),
relSize = float(exp(logRelSize.node.val())),
scale = cMax(1.0f,relSize);
sz /= scale; // Shrink points as they are zoomed in for greater visual accuracy
Verts verts;
Vec3Fs const & rendVerts = rendMesh.posedVertsN.cref();
for (Surf const & origSurf : origMesh.surfaces) {
for (SurfPoint const & sp : origSurf.surfPoints) {
Vec3F pos = cSurfPointPos(sp.triEquivIdx,sp.weights,origSurf.tris,origSurf.quads,rendVerts);
for (Vec3UI tri : icosahedron.tris) {
for (uint idx : tri.m) {
Vert v;
v.pos = pos + icosahedron.verts[idx] * sz;
v.norm = icosahedron.verts[idx]; // icosahedron verts are unit distance from origin
v.uv = Vec2F{0};
verts.push_back(v);
}
}
}
}
return makeVertBuff(verts);
}
// Returns null pointer if no marked verts:
WinPtr<ID3D11Buffer>
D3d::makeMarkedVerts(RendMesh const & rendMesh,Mesh const & origMesh)
{
Verts verts;
Vec3Fs const & rendVerts = rendMesh.posedVertsN.cref();
for (MarkedVert const & mv : origMesh.markedVerts) {
Vert v;
v.pos = rendVerts[mv.idx];
v.norm = Vec3F{0,0,1}; // Random non-zero value can be normalized by shader
v.uv = Vec2F{0};
verts.push_back(v);
}
return makeVertBuff(verts);
}
WinPtr<ID3D11Buffer>
D3d::makeAllVerts(Vec3Fs const & verts)
{
Verts avs;
for (Vec3F pos : verts) {
Vert v;
v.pos = pos;
v.norm = Vec3F(0,0,1); // Random non-zero value can be normalized by shader
v.uv = Vec2F(0);
avs.push_back(v);
}
return makeVertBuff(avs);
}
D3d::Verts
D3d::makeVertList(
RendMesh const & rendMesh,
Mesh const & origMesh,
size_t surfNum,
bool shadeFlat)
{
D3d::Verts vertList;
Surf const & origSurf = origMesh.surfaces[surfNum];
MeshNormals const & normals = rendMesh.normalsN.cref();
Vec3Fs const & norms = normals.vert;
FacetNormals const & normFlats = normals.facet[surfNum];
Vec3Fs const & verts = rendMesh.posedVertsN.cref();
vertList.reserve(3*size_t(origSurf.numTriEquivs()));
for (size_t tt=0; tt<origSurf.numTriEquivs(); ++tt) {
TriUv tri = origSurf.getTriEquiv(tt);
for (uint ii=2; ii<3; --ii) { // Reverse order due to D3D LEFT-handed coordinate system
Vert v;
size_t posIdx = tri.posInds[ii];
v.pos = verts[posIdx];
if (shadeFlat)
v.norm = normFlats.triEquiv(tt);
else
v.norm = norms[posIdx];
if (!origMesh.uvs.empty()) {
v.uv = origMesh.uvs[tri.uvInds[ii]];
v.uv[1] = 1.0f - v.uv[1]; // Convert from OTCS to D3TCS
}
vertList.push_back(v);
}
}
return vertList;
}
D3d::Verts
D3d::makeLineVerts(RendMesh const & rendMesh,Mesh const & origMesh,size_t surfNum) {
D3d::Verts ret;
Vec3Fs const & verts = rendMesh.posedVertsN.cref();
Surf const & origSurf = origMesh.surfaces[surfNum];
Vec3UIs const & tris = origSurf.tris.posInds;
Vec4UIs const & quads = origSurf.quads.posInds;
ret.reserve(8*quads.size()+6*tris.size());
Vert v;
v.norm = Vec3F(0,0,1);
v.uv = Vec2F(0);
for (Vec3UI tri : tris) {
for (uint ii=0; ii<3; ++ii) {
v.pos = verts[tri[ii]];
ret.push_back(v);
v.pos = verts[tri[(ii+1)%3]];
ret.push_back(v);
}
}
for (Vec4UI quad : quads) {
for (uint ii=0; ii<4; ++ii) {
v.pos = verts[quad[ii]];
ret.push_back(v);
v.pos = verts[quad[(ii+1)%4]];
ret.push_back(v);
}
}
return ret;
}
WinPtr<ID3D11Texture2D>
D3d::loadMap(ImgRgba8 const & map) {
FGASSERT(!map.empty());
ImgRgba8s mipmap;
if (isPow2(map.dims()))
mipmap = cMipmap(map);
else { // power of 2 images are strongly preferred by GPUs so make it so:
// TODO: resampling is a slow way to do this and gives noticable lag for large images.
ImgRgba8 p2 = resampleToFit(map,mapPow2Ceil(map.dims()));
mipmap = cMipmap(p2);
}
uint numMips = cMin(uint(mipmap.size()),8);
D3D11_SUBRESOURCE_DATA initData[8] = {};
for (size_t mm=0; mm<numMips; ++mm) {
initData[mm].pSysMem = mipmap[mm].dataPtr();
initData[mm].SysMemPitch = mipmap[mm].width()*4;
}
D3D11_TEXTURE2D_DESC desc = {};
desc.Width = map.width();
desc.Height = map.height();
// MS Docs useless, but it appears 1 means no mipmaps provided and 0 means all
// mipmaps provided and 'initData' above must an array of mipmap pointers:
desc.MipLevels = numMips;
// One image in this array. Arr images must all be the same size and format
// and can be used for cube maps.
desc.ArraySize = 1;
// The 'NORM' part here means that it is mapped to a float by dividing by 255:
desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
desc.SampleDesc.Count = 1; // 1 sample per pixel (no FSAA)
desc.SampleDesc.Quality = 0; // For MSAA there are higher quality levels (which are slower)
desc.Usage = D3D11_USAGE_DEFAULT;
// D3D11_BIND_RENDER_TARGET was added to have GPU generate mipmaps but didn't work:
desc.BindFlags = D3D11_BIND_SHADER_RESOURCE;
desc.CPUAccessFlags = 0; // CPU does not need to acess
// Also required for gpu mipmap generation that didn't work:
//desc.MiscFlags = D3D11_RESOURCE_MISC_GENERATE_MIPS;
ID3D11Texture2D* ptr;
HRESULT hr = pDevice->CreateTexture2D(&desc,initData,&ptr);
FG_ASSERT_D3D(hr);
return WinPtr<ID3D11Texture2D>(ptr);
}
WinPtr<ID3D11ShaderResourceView>
D3d::makeMapView(ID3D11Texture2D* mapPtr)
{
D3D11_SHADER_RESOURCE_VIEW_DESC SRVDesc = {};
SRVDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;
SRVDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
SRVDesc.Texture2D.MipLevels = uint(-1); // Use all available mipmap levels
ID3D11ShaderResourceView* ptr;
HRESULT hr = pDevice->CreateShaderResourceView(mapPtr,&SRVDesc,&ptr);
FG_ASSERT_D3D(hr);
// Couldn't get this to work. mipmaps currently generated in CPU:
//pContext->GenerateMips(ptr);
return WinPtr<ID3D11ShaderResourceView>(ptr);
}
D3dMap
D3d::makeMap(ImgRgba8 const & map)
{
D3dMap ret;
ret.map = loadMap(map);
ret.view = makeMapView(ret.map.get());
return ret;
}
WinPtr<ID3D11SamplerState>
D3d::makeSamplerState()
{
D3D11_SAMPLER_DESC sampDesc = {};
sampDesc.Filter = D3D11_FILTER_MIN_MAG_MIP_LINEAR; // Always use trilinear
sampDesc.AddressU = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.AddressV = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.AddressW = D3D11_TEXTURE_ADDRESS_WRAP;
sampDesc.ComparisonFunc = D3D11_COMPARISON_NEVER;
sampDesc.MinLOD = 0;
sampDesc.MaxLOD = D3D11_FLOAT32_MAX; // Make use of all mipmap levels available
ID3D11SamplerState* ptr;
HRESULT hr = pDevice->CreateSamplerState(&sampDesc,&ptr);
FG_ASSERT_D3D(hr);
return WinPtr<ID3D11SamplerState>(ptr);
}
WinPtr<ID3D11Buffer>
D3d::setScene(Scene const & scene)
{
WinPtr<ID3D11Buffer> sceneBuff = makeConstBuff(scene);
{
ID3D11Buffer* sbs[] = { sceneBuff.get() };
pContext->VSSetConstantBuffers(0,1,sbs);
pContext->PSSetConstantBuffers(0,1,sbs);
}
return sceneBuff;
}
WinPtr<ID3D11Buffer>
D3d::makeScene(Lighting lighting,Mat44F worldToD3vs,Mat44F d3vsToD3ps)
{
lighting.lights.resize(2); // Ensure we have 2
Scene scene;
scene.mvm = worldToD3vs.transpose(); // D3D is column-major (of course)
scene.projection = d3vsToD3ps.transpose(); // "
scene.ambient = asHomogVec(lighting.ambient);
for (uint ii=0; ii<2; ++ii) {
Vec3F d = lighting.lights[ii].direction;
scene.lightDir[ii] = asHomogVec(Vec3F{d[0],d[1],-d[2]}); // OECS to D3VS
scene.lightColor[ii] = asHomogVec(lighting.lights[ii].colour);
}
return setScene(scene);
}
// Ambient-only version:
WinPtr<ID3D11Buffer>
D3d::makeScene(Vec3F ambient,Mat44F worldToD3vs,Mat44F d3vsToD3ps)
{
Light diffuseBlack(Vec3F(0),Vec3F(0,0,1));
Lighting lighting(ambient,svec(diffuseBlack,diffuseBlack));
return makeScene(lighting,worldToD3vs,d3vsToD3ps);
}
void
D3d::setBgImage(BackgroundImage const & bgi)
{
bgImg.reset();
ImgRgba8 const & img = bgi.imgN.cref();
if (img.empty())
return;
Vec2UI p2dims = mapMin(mapPow2Ceil(img.dims()),maxMapSize);
ImgRgba8 map(p2dims);
imgResize(img,map);
bgImg = makeMap(map);
}
void
D3d::renderBgImg(BackgroundImage const & bgi, Vec2UI viewportSize, bool transparentPass) {
WinPtr<ID3D11RasterizerState> rasterizer;
{
D3D11_RASTERIZER_DESC rd = {};
rd.FillMode = D3D11_FILL_SOLID;
rd.CullMode = D3D11_CULL_NONE; // : D3D11_CULL_BACK;
ID3D11RasterizerState* ptr;
pDevice->CreateRasterizerState(&rd,&ptr);
rasterizer.reset(ptr);
}
pContext->RSSetState(rasterizer.get());
WinPtr<ID3D11Buffer> bgImageVerts;
{ // Background image polys:
Vec2F im = Vec2F(bgi.origDimsN.val()),
xr(im[0]*viewportSize[1],im[1]*viewportSize[0]);
Vec2F sz = Vec2F(xr) / cMaxElem(xr) * exp(bgi.lnScale.val()),
off = bgi.offset.val();
float xo = off[0] * 2.0f,
yo = -off[1] * 2.0f,
xh = sz[0] + xo,
xl = -sz[0] + xo,
yh = sz[1] + yo,
yl = -sz[1] + yo;
Verts bgiVerts;
Vert v;
v.norm = Vec3F(0,0,1); // Normalized, direction irrelevant.
v.pos = Vec3F(xl,yh,1);
v.uv = Vec2F(0,0);
bgiVerts.push_back(v); // Top left
v.pos = Vec3F(xh,yh,1);
v.uv = Vec2F(1,0);
bgiVerts.push_back(v); // Top right
v.pos = Vec3F(xl,yl,1);
v.uv = Vec2F(0,1);
bgiVerts.push_back(v); // Bottom left
v.pos = Vec3F(xh,yh,1);
v.uv = Vec2F(1,0);
bgiVerts.push_back(v); // Top right
v.pos = Vec3F(xh,yl,1);
v.uv = Vec2F(1,1);
bgiVerts.push_back(v); // Bottom right
v.pos = Vec3F(xl,yl,1);
v.uv = Vec2F(0,1);
bgiVerts.push_back(v); // Bottom left
bgImageVerts = makeVertBuff(bgiVerts);
}
setVertexBuffer(bgImageVerts.get());
ID3D11ShaderResourceView* mapViews[3]; // Albedo, specular resp.
mapViews[0] = bgImg.view.get();
mapViews[1] = blackMap.view.get();
mapViews[2] = noModulationMap.view.get();
pContext->PSSetShaderResources(0,3,mapViews);
Scene scene;
scene.mvm = Mat44F::identity();
scene.projection = Mat44F::identity();
scene.ambient = Vec4F(1);
if (transparentPass) {
double ft = clamp(bgi.foregroundTransparency.val(),0.0,1.0);
scene.ambient[3] = static_cast<float>(ft);
}
WinPtr<ID3D11Buffer> sceneBuff = setScene(scene);
pContext->Draw(6,0);
}
D3dMesh &
D3d::getD3dMesh(RendMesh const & rm) const
{
Any & gpuMesh = *rm.gpuData;
if (!gpuMesh.valid())
gpuMesh.reset(D3dMesh{makeUpdateFlag(rm.posedVertsN)});
return gpuMesh.ref<D3dMesh>();
}
D3dSurf &
D3d::getD3dSurf(RendSurf const & rs) const
{
Any & gpuSurf = *rs.gpuData;
if (!gpuSurf.valid()) {
gpuSurf.reset(D3dSurf{
rs.smoothMapN,
rs.modulationMapN,
rs.specularMapN,
});
}
return gpuSurf.ref<D3dSurf>();
}
void
D3d::updateMap_(DfgFPtr const & flag,NPT<ImgRgba8> const & in,D3dMap & out)
{
if (flag->checkUpdate()) {
out.reset();
if (in.ptr) {
ImgRgba8 const & img = in.cref();
if (!img.empty())
out = makeMap(img);
}
}
}
void
D3d::renderBackBuffer(
BackgroundImage const & bgi,
Lighting lighting, // OECS
Mat44F worldToD3vs, // modelview
Mat44F d3vsToD3ps, // projection
Vec2UI viewportSize,
RendOptions const & rendOpts,
bool backgroundTransparent)
{
// No render view during create - created by first resize:
if (pRTV == nullptr)
return;
// Update 'd3dMeshes' (mesh and map data) if required:
RendMeshes const & rendMeshes = rendMeshesN.cref();
for (RendMesh const & rendMesh : rendMeshes) {
Mesh const & origMesh = rendMesh.origMeshN.cref();
D3dMesh & d3dMesh = getD3dMesh(rendMesh);
bool vertsChanged = d3dMesh.vertsFlag->checkUpdate();
bool trisChanged = vertsChanged || (flatShaded != rendOpts.flatShaded);
bool valid = !origMesh.verts.empty();
// Easier to always update these than have a flag for each and only update when resp. option selected:
if (vertsChanged) {
d3dMesh.allVerts.reset();
d3dMesh.markedPoints.reset();
if (valid) {
d3dMesh.allVerts = makeAllVerts(rendMesh.posedVertsN.cref());
d3dMesh.markedPoints = makeMarkedVerts(rendMesh,origMesh);
}
}
if (vertsChanged || logRelSize.checkUpdate()) {
d3dMesh.surfPoints.reset();
if (valid)
d3dMesh.surfPoints = makeSurfPoints(rendMesh,origMesh);
}
// TODO: don't duplicate shared maps ! (eg. multisurface mesh)
// Be forgiving to client; for instance model set may define different number of maps
// than .fgmesh defines surfaces. If fewer defined then render without maps:
size_t S = cMin(rendMesh.rendSurfs.size(),origMesh.surfaces.size());
for (size_t ss=0; ss<S; ++ss) {
RendSurf const & rs = rendMesh.rendSurfs[ss];
D3dSurf & d3dSurf = getD3dSurf(rs);
updateMap_(d3dSurf.albedoMapFlag,rs.smoothMapN,d3dSurf.albedoMap);
updateMap_(d3dSurf.modulationMapFlag,rs.modulationMapN,d3dSurf.modulationMap);
updateMap_(d3dSurf.specularMapFlag,rs.specularMapN,d3dSurf.specularMap);
if (trisChanged) {
d3dSurf.lineVerts.reset(); // Release but delay computation in case not needed
d3dSurf.triVerts.reset();
if (valid) {
Verts verts = makeVertList(rendMesh,origMesh,ss,rendOpts.flatShaded);
if (!verts.empty())
d3dSurf.triVerts = makeVertBuff(verts);
}
}
}
}
flatShaded = rendOpts.flatShaded;
// RENDER:
WinPtr<ID3D11Buffer> sceneBuff;
WinPtr<ID3D11SamplerState> samplerState = makeSamplerState();
ID3D11SamplerState * sss[] {samplerState.get()};
pContext->PSSetSamplers(0,1,sss);
//Opaque pass
pContext->ClearDepthStencilView(pDSV.Get(),D3D11_CLEAR_DEPTH,1.0f,0);
pContext->OMSetBlendState(pBlendStateDefault.Get(),nullptr,0xFFFFFFFF);
// Needed for both paths since 11.1 with facets disabled doesn't overwrite this buffer:
Arr<float,3> bg = rendOpts.backgroundColor.m;
Arr<float,4> bgColor {bg[0],bg[1],bg[2],255};
if (backgroundTransparent)
bgColor[3] = 0;
pContext->ClearRenderTargetView(pRTV.Get(),bgColor.data());
pContext->OMSetRenderTargets(1,dataPtr({pRTV.Get()}),pDSV.Get());
opaquePassPSO.apply(pContext);
if (bgImg.valid()) {
pContext->OMSetDepthStencilState(pDepthStencilStateDisable.Get(),0);
pContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
renderBgImg(bgi,viewportSize,false);
}
pContext->OMSetDepthStencilState(pDepthStencilStateDefault.Get(),0);
if (rendOpts.facets) {
pContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
sceneBuff = makeScene(lighting,worldToD3vs,d3vsToD3ps);
WinPtr<ID3D11RasterizerState> rasterizer;
{
D3D11_RASTERIZER_DESC rd = {};
rd.FillMode = D3D11_FILL_SOLID;
rd.CullMode = rendOpts.twoSided ? D3D11_CULL_NONE : D3D11_CULL_BACK;
if (rendOpts.wireframe || rendOpts.allVerts || rendOpts.surfPoints || rendOpts.markedVerts) {
// Increase depth values small amount to wireframe & allverts get shown.
// Only do this when necessary just in case some small confusting artifacts result.
rd.DepthBias = 1000;
rd.SlopeScaledDepthBias = 0.5f;
rd.DepthBiasClamp = 0.001f;
}
ID3D11RasterizerState* ptr;
pDevice->CreateRasterizerState(&rd,&ptr);
rasterizer.reset(ptr);
}
pContext->RSSetState(rasterizer.get());
renderTris(rendMeshes,rendOpts,false);
if (supports11_1) {
// OIT Pass 1
// Re-creating pUAVBufferLinkedListOIT here did not fix the GTX 980 visibility issue
pContext->ClearUnorderedAccessViewUint(
pUAVTextureHeadOIT.Get(),dataPtr({0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF,0xFFFFFFFF}));
pContext->OMSetRenderTargetsAndUnorderedAccessViews(
1,pRTV.GetAddressOf(),pDSV.Get(),1,2,
dataPtr({pUAVTextureHeadOIT.Get(),pUAVBufferLinkedListOIT.Get()}),
dataPtr({0x0u,0x0u }));
pContext->OMSetBlendState(pBlendStateColorWriteDisable.Get(),nullptr,0xFFFFFFFF);
pContext->OMSetDepthStencilState(pDepthStencilStateWriteDisable.Get(),0);
transparentFirstPassPSO.apply(pContext);
renderTris(rendMeshes,rendOpts,true);
// OIT Pass 2
pContext->OMSetBlendState(pBlendStateLerp.Get(),nullptr,0xFFFFFFFF);
pContext->OMSetDepthStencilState(pDepthStencilStateDisable.Get(),0);
transparentSecondPassPSO.apply(pContext);
// This vertex shader uses 'SV_VertexID' so generates indices and doesn't need a bound vertex buffer:
pContext->IASetVertexBuffers(0,0,nullptr,nullptr,nullptr);
pContext->Draw(3,0);
}
else
renderTris(rendMeshes,rendOpts,true);
}
pContext->OMSetRenderTargets(1,dataPtr({pRTV.Get()}),pDSV.Get());
pContext->OMSetDepthStencilState(pDepthStencilStateDefault.Get(),0);
opaquePassPSO.apply(pContext);
if (rendOpts.surfPoints) {
sceneBuff = makeScene(Lighting{Light{Vec3F{1,0,0}}},worldToD3vs,d3vsToD3ps);
ID3D11ShaderResourceView* mapViews[3];
mapViews[0] = whiteMap.view.get();
mapViews[1] = blackMap.view.get(); // No specular on point spheres
mapViews[2] = noModulationMap.view.get();
pContext->PSSetShaderResources(0,3,mapViews);
for (RendMesh const & rendMesh : rendMeshes) {
Mesh const & origMesh = rendMesh.origMeshN.cref();
if (origMesh.surfPointNum() > 0) {
D3dMesh & d3dMesh = getD3dMesh(rendMesh);
if (d3dMesh.surfPoints) { // Can be null if no surf points
setVertexBuffer(d3dMesh.surfPoints.get());
pContext->Draw(uint(origMesh.surfPointNum()*60),0);
}
}
}
}
if (rendOpts.wireframe) {
pContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST);
if (rendOpts.facets) // Render wireframe blue over facets, white otherwise:
sceneBuff = makeScene(Vec3F(0,0,1),worldToD3vs,d3vsToD3ps);
else
sceneBuff = makeScene(Vec3F(1,1,1),worldToD3vs,d3vsToD3ps);
WinPtr<ID3D11RasterizerState> rasterizer;
{
D3D11_RASTERIZER_DESC rd = {};
rd.FillMode = D3D11_FILL_WIREFRAME;
rd.CullMode = rendOpts.twoSided ? D3D11_CULL_NONE : D3D11_CULL_BACK;
ID3D11RasterizerState* ptr;
pDevice->CreateRasterizerState(&rd,&ptr);
rasterizer.reset(ptr);
}
pContext->RSSetState(rasterizer.get());
for (RendMesh const & rendMesh : rendMeshes) {
Mesh const & origMesh = rendMesh.origMeshN.cref();
size_t S = cMin(origMesh.surfaces.size(),rendMesh.rendSurfs.size());
//if (origMesh.surfaces.size() != rendMesh.rendSurfs.size())
// fgout << fgnl << "WARNING: wireframe render surf counts differ: "
// << origMesh.surfaces.size() << " != " << rendMesh.rendSurfs.size();
// Must loop through origMesh surfaces in case the mesh has been emptied (and the redsurfs remain):
for (size_t ss=0; ss<S; ++ss) {
D3dSurf & d3dSurf = getD3dSurf(rendMesh.rendSurfs[ss]);
Surf const & origSurf = origMesh.surfaces[ss];
if (origSurf.empty())
continue;
if (!d3dSurf.lineVerts) // GPU needs updating
d3dSurf.lineVerts = makeVertBuff(makeLineVerts(rendMesh, origMesh, ss));
setVertexBuffer(d3dSurf.lineVerts.get());
ID3D11ShaderResourceView* mapViews[3]; // Albedo, specular resp.
mapViews[0] = greyMap.view.get();
if (rendOpts.shiny)
mapViews[1] = whiteMap.view.get();
else if (d3dSurf.specularMap.valid())
mapViews[1] = d3dSurf.specularMap.view.get();
else
mapViews[1] = blackMap.view.get();
mapViews[2] = noModulationMap.view.get();
pContext->PSSetShaderResources(0,3,mapViews);
pContext->Draw(uint(origSurf.numTris() * 6 + origSurf.numQuads() * 8), 0);
}
}
}
pContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_POINTLIST);
ID3D11ShaderResourceView * mapViews[3] {whiteMap.view.get(),blackMap.view.get(),noModulationMap.view.get()};
if (rendOpts.allVerts) {
sceneBuff = makeScene(Vec3F{1,1,1},worldToD3vs,d3vsToD3ps);
for (size_t mm=0; mm<rendMeshes.size(); ++mm) {
RendMesh const & rendMesh = rendMeshes[mm];
D3dMesh const & d3dMesh = getD3dMesh(rendMesh);
if (d3dMesh.allVerts) {
Mesh const & origMesh = rendMesh.origMeshN.cref();
mapViews[0] = tintMaps[selectTintMap(mm,rendMeshes.size())].strong.view.get();
pContext->PSSetShaderResources(0,3,mapViews);
setVertexBuffer(d3dMesh.allVerts.get());
pContext->Draw(uint(origMesh.verts.size()),0);
}
}
}
mapViews[0] = whiteMap.view.get(); // modified by allverts render above
pContext->PSSetShaderResources(0,3,mapViews);
if (rendOpts.markedVerts) {
sceneBuff = makeScene(Vec3F{1,1,0},worldToD3vs,d3vsToD3ps);
for (RendMesh const & rendMesh : rendMeshes) {
Mesh const & origMesh = rendMesh.origMeshN.cref();
if (!origMesh.markedVerts.empty()) {
D3dMesh & d3dMesh = getD3dMesh(rendMesh);
if (d3dMesh.markedPoints) { // Can be null if no marked verts
setVertexBuffer(d3dMesh.markedPoints.get());
pContext->Draw(uint(origMesh.markedVerts.size()),0);
}
}
}
}
if (bgImg.valid()) {
pContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);
pContext->OMSetDepthStencilState(pDepthStencilStateDisable.Get(),0);
pContext->OMSetBlendState(pBlendStateLerp.Get(),nullptr,0xFFFFFFFF);
renderBgImg(bgi,viewportSize,true);
}
pContext->OMSetRenderTargets(0,nullptr,nullptr);
}
void
D3d::showBackBuffer()
{
// No render view during create - created by first resize:
if (pRTV == nullptr)
return;
// TODO: arguments below can be used for frame sync.
// TODO: switch to Present1()
HRESULT hr = pSwapChain->Present(0,0); // Swap back buffer to display
FG_ASSERT_D3D(hr);
}
ImgRgba8
D3d::capture(Vec2UI viewportSize)
{
HRESULT hr;
WinPtr<ID3D11Texture2D> pBuffer;
{
ID3D11Texture2D* ptr;
hr = pSwapChain->GetBuffer(0,__uuidof(ID3D11Texture2D),(LPVOID*)&ptr);
FG_ASSERT_D3D(hr);
pBuffer.reset(ptr);
}
D3D11_TEXTURE2D_DESC desc;
pBuffer->GetDesc(&desc);
desc.BindFlags = 0;
desc.CPUAccessFlags = D3D11_CPU_ACCESS_READ | D3D11_CPU_ACCESS_WRITE;
desc.Usage = D3D11_USAGE_STAGING;
WinPtr<ID3D11Texture2D> pTexture;
{
ID3D11Texture2D* ptr;
hr = pDevice->CreateTexture2D(&desc,NULL,&ptr);
FG_ASSERT_D3D(hr);
pTexture.reset(ptr);
}
pContext->CopyResource(pTexture.get(),pBuffer.get());
D3D11_MAPPED_SUBRESOURCE resource;
unsigned int subresource = D3D11CalcSubresource(0,0,0);
hr = pContext->Map(pTexture.get(),subresource,D3D11_MAP_READ_WRITE,0,&resource);
FG_ASSERT_D3D(hr);
ImgRgba8 ret(viewportSize);
uchar* dst = (uchar*)resource.pData;
for (size_t rr=0; rr<viewportSize[1]; ++rr) {
memcpy(&ret.xy(0,rr),dst,4ULL*viewportSize[0]);
dst += size_t(resource.RowPitch);
}
return ret;
}
void
D3d::setVertexBuffer(ID3D11Buffer * vertBuff)
{
UINT stride[] = { sizeof(Vert) };
UINT offset[] = { 0 };
ID3D11Buffer* buffers[] = { vertBuff };
// The way these buffers are interpreted by the HLSL is determined by 'IASetInputLayout' above:
pContext->IASetVertexBuffers(0,1,buffers,stride,offset);
}
size_t
D3d::selectTintMap(size_t idx,size_t num) const
{
// maximize color diffs, handle M=0 and M>tintTransMaps.size():
size_t colorStep = cMax(tintMaps.size()/cMax(num,size_t(1)),size_t(1));
return (idx*colorStep) % tintMaps.size();
}
void
D3d::renderTris(RendMeshes const & rendMeshes,RendOptions const & rendOpts,bool transparentPass)
{
size_t M = rendMeshes.size();
for (size_t mm=0; mm<M; ++mm) {
RendMesh const & rendMesh = rendMeshes[mm];
if (rendMesh.posedVertsN.cref().empty()) // Not selected
continue;
Mesh const & origMesh = rendMesh.origMeshN.cref();
size_t S = cMin(origMesh.surfaces.size(),rendMesh.rendSurfs.size());
for (size_t ss=0; ss<S; ++ss) {
Surf const & origSurf = origMesh.surfaces[ss];
if (origSurf.empty())
continue;
RendSurf const & rendSurf = rendMesh.rendSurfs[ss];
bool transparency =
(rendSurf.albedoHasTransparencyN.val() || (rendOpts.albedoMode==AlbedoMode::byMesh));
if (transparentPass == transparency) {
D3dSurf & d3dSurf = getD3dSurf(rendSurf);
FGASSERT(d3dSurf.triVerts);
setVertexBuffer(d3dSurf.triVerts.get());
ID3D11ShaderResourceView* mapViews[3]; // Albedo, Specular, Modulation resp.
mapViews[2] = noModulationMap.view.get();
if (rendOpts.albedoMode==AlbedoMode::map) {
if (d3dSurf.albedoMap.valid())
mapViews[0] = d3dSurf.albedoMap.view.get();
else
mapViews[0] = greyMap.view.get();
if (d3dSurf.modulationMap.valid())
mapViews[2] = d3dSurf.modulationMap.view.get();
}
else if (rendOpts.albedoMode==AlbedoMode::bySurf) {
size_t tintIdx = selectTintMap(ss,S);
mapViews[0] = tintMaps[tintIdx].light.view.get();
}
else if (rendOpts.albedoMode==AlbedoMode::byMesh) {
size_t tintIdx = selectTintMap(mm,M);
mapViews[0] = tintMaps[tintIdx].trans.view.get();
}
else
mapViews[0] = greyMap.view.get();
if (rendOpts.shiny)
mapViews[1] = whiteMap.view.get();
else if (d3dSurf.specularMap.valid())
mapViews[1] = d3dSurf.specularMap.view.get();
else
mapViews[1] = blackMap.view.get();
pContext->PSSetShaderResources(0,3,mapViews);
pContext->Draw(uint(origSurf.numTriEquivs())*3,0);
}
}
}
}
void
D3d::handleHResult(char const * fpath,uint lineNum,HRESULT hr)
{
if (hr == DXGI_ERROR_DEVICE_REMOVED) {
HRESULT hr2 = pDevice->GetDeviceRemovedReason();
if (hr2 == S_OK)
return; // Not actually an error after all ... WTF
if (hr2 == DXGI_ERROR_INVALID_CALL)
hr = hr2; // Report this error instead
else
throw ExceptD3dDeviceRemoved {};
}
if (hr < 0) {
string v11_1 = supports11_1 ? " D3D11.1" : " D3D11.0", // wrong way around throug Mod v3.22
flip = supportsFlip ? " flip" : " noflip";
throwWindows("D3D HRESULT",pathToName(fpath)+":"+toStr(lineNum)+":HR="+toHexString(hr)+v11_1+flip);
}
}
}
// */
| 43.497046 | 121 | 0.59295 | [
"mesh",
"render",
"object",
"vector",
"model"
] |
97cef360030cd6e69391afbff839bf67b126aea2 | 13,968 | cpp | C++ | postgres/src/v20170312/model/AnalysisItems.cpp | suluner/tencentcloud-sdk-cpp | a56c73cc3f488c4d1e10755704107bb15c5e000d | [
"Apache-2.0"
] | 43 | 2019-08-14T08:14:12.000Z | 2022-03-30T12:35:09.000Z | postgres/src/v20170312/model/AnalysisItems.cpp | suluner/tencentcloud-sdk-cpp | a56c73cc3f488c4d1e10755704107bb15c5e000d | [
"Apache-2.0"
] | 12 | 2019-07-15T10:44:59.000Z | 2021-11-02T12:35:00.000Z | postgres/src/v20170312/model/AnalysisItems.cpp | suluner/tencentcloud-sdk-cpp | a56c73cc3f488c4d1e10755704107bb15c5e000d | [
"Apache-2.0"
] | 28 | 2019-07-12T09:06:22.000Z | 2022-03-30T08:04:18.000Z | /*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. 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 <tencentcloud/postgres/v20170312/model/AnalysisItems.h>
using TencentCloud::CoreInternalOutcome;
using namespace TencentCloud::Postgres::V20170312::Model;
using namespace std;
AnalysisItems::AnalysisItems() :
m_databaseNameHasBeenSet(false),
m_userNameHasBeenSet(false),
m_normalQueryHasBeenSet(false),
m_clientAddrHasBeenSet(false),
m_callNumHasBeenSet(false),
m_callPercentHasBeenSet(false),
m_costTimeHasBeenSet(false),
m_costPercentHasBeenSet(false),
m_minCostTimeHasBeenSet(false),
m_maxCostTimeHasBeenSet(false),
m_avgCostTimeHasBeenSet(false),
m_firstTimeHasBeenSet(false),
m_lastTimeHasBeenSet(false)
{
}
CoreInternalOutcome AnalysisItems::Deserialize(const rapidjson::Value &value)
{
string requestId = "";
if (value.HasMember("DatabaseName") && !value["DatabaseName"].IsNull())
{
if (!value["DatabaseName"].IsString())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.DatabaseName` IsString=false incorrectly").SetRequestId(requestId));
}
m_databaseName = string(value["DatabaseName"].GetString());
m_databaseNameHasBeenSet = true;
}
if (value.HasMember("UserName") && !value["UserName"].IsNull())
{
if (!value["UserName"].IsString())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.UserName` IsString=false incorrectly").SetRequestId(requestId));
}
m_userName = string(value["UserName"].GetString());
m_userNameHasBeenSet = true;
}
if (value.HasMember("NormalQuery") && !value["NormalQuery"].IsNull())
{
if (!value["NormalQuery"].IsString())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.NormalQuery` IsString=false incorrectly").SetRequestId(requestId));
}
m_normalQuery = string(value["NormalQuery"].GetString());
m_normalQueryHasBeenSet = true;
}
if (value.HasMember("ClientAddr") && !value["ClientAddr"].IsNull())
{
if (!value["ClientAddr"].IsString())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.ClientAddr` IsString=false incorrectly").SetRequestId(requestId));
}
m_clientAddr = string(value["ClientAddr"].GetString());
m_clientAddrHasBeenSet = true;
}
if (value.HasMember("CallNum") && !value["CallNum"].IsNull())
{
if (!value["CallNum"].IsUint64())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.CallNum` IsUint64=false incorrectly").SetRequestId(requestId));
}
m_callNum = value["CallNum"].GetUint64();
m_callNumHasBeenSet = true;
}
if (value.HasMember("CallPercent") && !value["CallPercent"].IsNull())
{
if (!value["CallPercent"].IsLosslessDouble())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.CallPercent` IsLosslessDouble=false incorrectly").SetRequestId(requestId));
}
m_callPercent = value["CallPercent"].GetDouble();
m_callPercentHasBeenSet = true;
}
if (value.HasMember("CostTime") && !value["CostTime"].IsNull())
{
if (!value["CostTime"].IsLosslessDouble())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.CostTime` IsLosslessDouble=false incorrectly").SetRequestId(requestId));
}
m_costTime = value["CostTime"].GetDouble();
m_costTimeHasBeenSet = true;
}
if (value.HasMember("CostPercent") && !value["CostPercent"].IsNull())
{
if (!value["CostPercent"].IsLosslessDouble())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.CostPercent` IsLosslessDouble=false incorrectly").SetRequestId(requestId));
}
m_costPercent = value["CostPercent"].GetDouble();
m_costPercentHasBeenSet = true;
}
if (value.HasMember("MinCostTime") && !value["MinCostTime"].IsNull())
{
if (!value["MinCostTime"].IsLosslessDouble())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.MinCostTime` IsLosslessDouble=false incorrectly").SetRequestId(requestId));
}
m_minCostTime = value["MinCostTime"].GetDouble();
m_minCostTimeHasBeenSet = true;
}
if (value.HasMember("MaxCostTime") && !value["MaxCostTime"].IsNull())
{
if (!value["MaxCostTime"].IsLosslessDouble())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.MaxCostTime` IsLosslessDouble=false incorrectly").SetRequestId(requestId));
}
m_maxCostTime = value["MaxCostTime"].GetDouble();
m_maxCostTimeHasBeenSet = true;
}
if (value.HasMember("AvgCostTime") && !value["AvgCostTime"].IsNull())
{
if (!value["AvgCostTime"].IsLosslessDouble())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.AvgCostTime` IsLosslessDouble=false incorrectly").SetRequestId(requestId));
}
m_avgCostTime = value["AvgCostTime"].GetDouble();
m_avgCostTimeHasBeenSet = true;
}
if (value.HasMember("FirstTime") && !value["FirstTime"].IsNull())
{
if (!value["FirstTime"].IsString())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.FirstTime` IsString=false incorrectly").SetRequestId(requestId));
}
m_firstTime = string(value["FirstTime"].GetString());
m_firstTimeHasBeenSet = true;
}
if (value.HasMember("LastTime") && !value["LastTime"].IsNull())
{
if (!value["LastTime"].IsString())
{
return CoreInternalOutcome(Core::Error("response `AnalysisItems.LastTime` IsString=false incorrectly").SetRequestId(requestId));
}
m_lastTime = string(value["LastTime"].GetString());
m_lastTimeHasBeenSet = true;
}
return CoreInternalOutcome(true);
}
void AnalysisItems::ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const
{
if (m_databaseNameHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "DatabaseName";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, rapidjson::Value(m_databaseName.c_str(), allocator).Move(), allocator);
}
if (m_userNameHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "UserName";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, rapidjson::Value(m_userName.c_str(), allocator).Move(), allocator);
}
if (m_normalQueryHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "NormalQuery";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, rapidjson::Value(m_normalQuery.c_str(), allocator).Move(), allocator);
}
if (m_clientAddrHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "ClientAddr";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, rapidjson::Value(m_clientAddr.c_str(), allocator).Move(), allocator);
}
if (m_callNumHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "CallNum";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, m_callNum, allocator);
}
if (m_callPercentHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "CallPercent";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, m_callPercent, allocator);
}
if (m_costTimeHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "CostTime";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, m_costTime, allocator);
}
if (m_costPercentHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "CostPercent";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, m_costPercent, allocator);
}
if (m_minCostTimeHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "MinCostTime";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, m_minCostTime, allocator);
}
if (m_maxCostTimeHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "MaxCostTime";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, m_maxCostTime, allocator);
}
if (m_avgCostTimeHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "AvgCostTime";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, m_avgCostTime, allocator);
}
if (m_firstTimeHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "FirstTime";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, rapidjson::Value(m_firstTime.c_str(), allocator).Move(), allocator);
}
if (m_lastTimeHasBeenSet)
{
rapidjson::Value iKey(rapidjson::kStringType);
string key = "LastTime";
iKey.SetString(key.c_str(), allocator);
value.AddMember(iKey, rapidjson::Value(m_lastTime.c_str(), allocator).Move(), allocator);
}
}
string AnalysisItems::GetDatabaseName() const
{
return m_databaseName;
}
void AnalysisItems::SetDatabaseName(const string& _databaseName)
{
m_databaseName = _databaseName;
m_databaseNameHasBeenSet = true;
}
bool AnalysisItems::DatabaseNameHasBeenSet() const
{
return m_databaseNameHasBeenSet;
}
string AnalysisItems::GetUserName() const
{
return m_userName;
}
void AnalysisItems::SetUserName(const string& _userName)
{
m_userName = _userName;
m_userNameHasBeenSet = true;
}
bool AnalysisItems::UserNameHasBeenSet() const
{
return m_userNameHasBeenSet;
}
string AnalysisItems::GetNormalQuery() const
{
return m_normalQuery;
}
void AnalysisItems::SetNormalQuery(const string& _normalQuery)
{
m_normalQuery = _normalQuery;
m_normalQueryHasBeenSet = true;
}
bool AnalysisItems::NormalQueryHasBeenSet() const
{
return m_normalQueryHasBeenSet;
}
string AnalysisItems::GetClientAddr() const
{
return m_clientAddr;
}
void AnalysisItems::SetClientAddr(const string& _clientAddr)
{
m_clientAddr = _clientAddr;
m_clientAddrHasBeenSet = true;
}
bool AnalysisItems::ClientAddrHasBeenSet() const
{
return m_clientAddrHasBeenSet;
}
uint64_t AnalysisItems::GetCallNum() const
{
return m_callNum;
}
void AnalysisItems::SetCallNum(const uint64_t& _callNum)
{
m_callNum = _callNum;
m_callNumHasBeenSet = true;
}
bool AnalysisItems::CallNumHasBeenSet() const
{
return m_callNumHasBeenSet;
}
double AnalysisItems::GetCallPercent() const
{
return m_callPercent;
}
void AnalysisItems::SetCallPercent(const double& _callPercent)
{
m_callPercent = _callPercent;
m_callPercentHasBeenSet = true;
}
bool AnalysisItems::CallPercentHasBeenSet() const
{
return m_callPercentHasBeenSet;
}
double AnalysisItems::GetCostTime() const
{
return m_costTime;
}
void AnalysisItems::SetCostTime(const double& _costTime)
{
m_costTime = _costTime;
m_costTimeHasBeenSet = true;
}
bool AnalysisItems::CostTimeHasBeenSet() const
{
return m_costTimeHasBeenSet;
}
double AnalysisItems::GetCostPercent() const
{
return m_costPercent;
}
void AnalysisItems::SetCostPercent(const double& _costPercent)
{
m_costPercent = _costPercent;
m_costPercentHasBeenSet = true;
}
bool AnalysisItems::CostPercentHasBeenSet() const
{
return m_costPercentHasBeenSet;
}
double AnalysisItems::GetMinCostTime() const
{
return m_minCostTime;
}
void AnalysisItems::SetMinCostTime(const double& _minCostTime)
{
m_minCostTime = _minCostTime;
m_minCostTimeHasBeenSet = true;
}
bool AnalysisItems::MinCostTimeHasBeenSet() const
{
return m_minCostTimeHasBeenSet;
}
double AnalysisItems::GetMaxCostTime() const
{
return m_maxCostTime;
}
void AnalysisItems::SetMaxCostTime(const double& _maxCostTime)
{
m_maxCostTime = _maxCostTime;
m_maxCostTimeHasBeenSet = true;
}
bool AnalysisItems::MaxCostTimeHasBeenSet() const
{
return m_maxCostTimeHasBeenSet;
}
double AnalysisItems::GetAvgCostTime() const
{
return m_avgCostTime;
}
void AnalysisItems::SetAvgCostTime(const double& _avgCostTime)
{
m_avgCostTime = _avgCostTime;
m_avgCostTimeHasBeenSet = true;
}
bool AnalysisItems::AvgCostTimeHasBeenSet() const
{
return m_avgCostTimeHasBeenSet;
}
string AnalysisItems::GetFirstTime() const
{
return m_firstTime;
}
void AnalysisItems::SetFirstTime(const string& _firstTime)
{
m_firstTime = _firstTime;
m_firstTimeHasBeenSet = true;
}
bool AnalysisItems::FirstTimeHasBeenSet() const
{
return m_firstTimeHasBeenSet;
}
string AnalysisItems::GetLastTime() const
{
return m_lastTime;
}
void AnalysisItems::SetLastTime(const string& _lastTime)
{
m_lastTime = _lastTime;
m_lastTimeHasBeenSet = true;
}
bool AnalysisItems::LastTimeHasBeenSet() const
{
return m_lastTimeHasBeenSet;
}
| 28.104628 | 151 | 0.684636 | [
"model"
] |
97cf2d5d053f9e8bb6d436573084f49310c627be | 1,937 | cpp | C++ | cpp/2787.cpp | jinhan814/BOJ | 47d2a89a2602144eb08459cabac04d036c758577 | [
"MIT"
] | 9 | 2021-01-15T13:36:39.000Z | 2022-02-23T03:44:46.000Z | cpp/2787.cpp | jinhan814/BOJ | 47d2a89a2602144eb08459cabac04d036c758577 | [
"MIT"
] | 1 | 2021-07-31T17:11:26.000Z | 2021-08-02T01:01:03.000Z | cpp/2787.cpp | jinhan814/BOJ | 47d2a89a2602144eb08459cabac04d036c758577 | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
#define fastio cin.tie(0)->sync_with_stdio(0)
using namespace std;
constexpr int INF = 1e9 + 7;
struct HopcroftKarp { //Hopcroft-Karp algorithm, O(Esqrt(V)).
vector<vector<int>> adj;
vector<int> par, lv, work, check; int sz;
HopcroftKarp(int n) : adj(n), par(n, -1), lv(n), work(n), check(n), sz(n) {}
void add_edge(int a, int b) { adj[a].push_back(b); }
void BFS() {
queue<int> Q;
for (int i = 0; i < sz; i++) {
if (!check[i]) lv[i] = 0, Q.push(i);
else lv[i] = INF;
}
while (!Q.empty()) {
auto cur = Q.front(); Q.pop();
for (auto nxt : adj[cur]) {
if (par[nxt] != -1 && lv[par[nxt]] == INF) {
lv[par[nxt]] = lv[cur] + 1;
Q.push(par[nxt]);
}
}
}
}
bool DFS(int cur) {
for (int& i = work[cur]; i < adj[cur].size(); i++) {
int nxt = adj[cur][i];
if (par[nxt] == -1 || lv[par[nxt]] == lv[cur] + 1 && DFS(par[nxt])) {
check[cur] = 1, par[nxt] = cur;
return 1;
}
}
return 0;
}
int Match() {
int ret = 0;
for (int fl = 0; ; fl = 0) {
fill(work.begin(), work.end(), 0); BFS();
for (int i = 0; i < sz; i++) if (!check[i] && DFS(i)) fl++;
if (!fl) break;
ret += fl;
}
return ret;
}
};
bitset<201> check[201];
int main() {
fastio;
int n, m; cin >> n >> m;
vector<int> mx(n + 1, n), mn(n + 1, 1);
while (m--) {
int t, a, b, c; cin >> t >> a >> b >> c;
for (int i = a; i <= b; i++) {
if (t & 1) mx[i] = min(mx[i], c);
else mn[i] = max(mn[i], c);
}
for (int i = 1; i < a; i++) check[i][c] = 1;
for (int i = b + 1; i <= n; i++) check[i][c] = 1;
}
HopcroftKarp flow(2 * n + 1);
for (int i = 1; i <= n; i++)
for (int j = mn[i]; j <= mx[i]; j++)
if (!check[i][j]) flow.add_edge(i, n + j);
if (flow.Match() == n) {
vector<int> ans(n + 1);
for (int i = 1; i <= n; i++) ans[flow.par[n + i]] = i;
for (int i = 1; i <= n; i++) cout << ans[i] << ' ';
cout << '\n';
}
else cout << -1 << '\n';
} | 24.833333 | 77 | 0.478059 | [
"vector"
] |
97dd193fd28eaa73f1571f3431270120246504d5 | 27,641 | cpp | C++ | src/renderer/MasterRenderer.cpp | hzqst/Atlas-Engine | fe45c5529815d6ca28a3bad7920d95281efc0028 | [
"BSD-3-Clause"
] | 1 | 2021-09-30T21:51:46.000Z | 2021-09-30T21:51:46.000Z | src/renderer/MasterRenderer.cpp | hzqst/Atlas-Engine | fe45c5529815d6ca28a3bad7920d95281efc0028 | [
"BSD-3-Clause"
] | null | null | null | src/renderer/MasterRenderer.cpp | hzqst/Atlas-Engine | fe45c5529815d6ca28a3bad7920d95281efc0028 | [
"BSD-3-Clause"
] | null | null | null | #include "MasterRenderer.h"
#include "helper/GeometryHelper.h"
#include "helper/HaltonSequence.h"
#include "../common/Packing.h"
#define FEATURE_BASE_COLOR_MAP (1 << 1)
#define FEATURE_OPACITY_MAP (1 << 2)
#define FEATURE_NORMAL_MAP (1 << 3)
#define FEATURE_ROUGHNESS_MAP (1 << 4)
#define FEATURE_METALNESS_MAP (1 << 5)
#define FEATURE_AO_MAP (1 << 6)
#define FEATURE_TRANSMISSION (1 << 7)
namespace Atlas {
namespace Renderer {
MasterRenderer::MasterRenderer() {
Helper::GeometryHelper::GenerateRectangleVertexArray(vertexArray);
Helper::GeometryHelper::GenerateCubeVertexArray(cubeVertexArray);
rectangleShader.AddStage(AE_VERTEX_STAGE, "rectangle.vsh");
rectangleShader.AddStage(AE_FRAGMENT_STAGE, "rectangle.fsh");
rectangleShader.Compile();
texture2DShader.AddStage(AE_VERTEX_STAGE, "rectangle.vsh");
texture2DShader.AddStage(AE_FRAGMENT_STAGE, "rectangle.fsh");
texture2DShader.AddMacro("TEXTURE2D");
texture2DShader.Compile();
texture2DArrayShader.AddStage(AE_VERTEX_STAGE, "rectangle.vsh");
texture2DArrayShader.AddStage(AE_FRAGMENT_STAGE, "rectangle.fsh");
texture2DArrayShader.AddMacro("TEXTURE2D_ARRAY");
texture2DArrayShader.Compile();
lineShader.AddStage(AE_VERTEX_STAGE, "primitive.vsh");
lineShader.AddStage(AE_FRAGMENT_STAGE, "primitive.fsh");
GetUniforms();
createProbeFaceShader.AddStage(AE_COMPUTE_STAGE, "brdf/createProbeFace.csh");
filterDiffuseShader.AddStage(AE_VERTEX_STAGE, "brdf/filterProbe.vsh");
filterDiffuseShader.AddStage(AE_FRAGMENT_STAGE, "brdf/filterProbe.fsh");
downsampleDepth2x.AddStage(AE_COMPUTE_STAGE, "downsampleDepth2x.csh");
haltonSequence = Helper::HaltonSequence::Generate(2, 3, 16);
PreintegrateBRDF();
}
MasterRenderer::~MasterRenderer() {
}
void MasterRenderer::RenderScene(Viewport* viewport, RenderTarget* target, Camera* camera,
Scene::Scene* scene, Texture::Texture2D* texture, RenderBatch* batch) {
std::vector<PackedMaterial> materials;
std::unordered_map<void*, uint16_t> materialMap;
PrepareMaterials(scene, materials, materialMap);
auto materialBuffer = Buffer::Buffer(AE_SHADER_STORAGE_BUFFER, sizeof(PackedMaterial), 0,
materials.size(), materials.data());
if (scene->postProcessing.taa) {
auto jitter = 2.0f * haltonSequence[haltonIndex] - 1.0f;
jitter.x /= (float)target->GetWidth();
jitter.y /= (float)target->GetHeight();
camera->Jitter(jitter * 0.99f);
}
if (scene->sky.probe) {
if (scene->sky.probe->update) {
scene->sky.probe->filteredDiffuse.Bind(GL_TEXTURE0);
FilterProbe(scene->sky.probe);
scene->sky.probe->update = false;
}
}
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
// Clear the lights depth maps
depthFramebuffer.Bind();
auto lights = scene->GetLights();
for (auto light : lights) {
if (!light->GetShadow())
continue;
if (!light->GetShadow()->update)
continue;
for (int32_t i = 0; i < light->GetShadow()->componentCount; i++) {
if (light->GetShadow()->useCubemap) {
depthFramebuffer.AddComponentCubemap(GL_DEPTH_ATTACHMENT,
&light->GetShadow()->cubemap, i);
}
else {
depthFramebuffer.AddComponentTextureArray(GL_DEPTH_ATTACHMENT,
&light->GetShadow()->maps, i);
}
glClear(GL_DEPTH_BUFFER_BIT);
}
}
shadowRenderer.Render(viewport, target, camera, scene);
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
terrainShadowRenderer.Render(viewport, target, camera, scene);
glCullFace(GL_BACK);
// Shadows have been updated
for (auto light : lights) {
if (!light->GetShadow())
continue;
light->GetShadow()->update = false;
}
materialBuffer.BindBase(0);
target->geometryFramebuffer.Bind(true);
target->geometryFramebuffer.SetDrawBuffers({ GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3,
GL_COLOR_ATTACHMENT4, GL_COLOR_ATTACHMENT5 });
glEnable(GL_CULL_FACE);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
opaqueRenderer.Render(viewport, target, camera, scene, materialMap);
terrainRenderer.Render(viewport, target, camera, scene, materialMap);
glEnable(GL_CULL_FACE);
glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
target->geometryFramebuffer.SetDrawBuffers({ GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 });
decalRenderer.Render(viewport, target, camera, scene);
glDisable(GL_BLEND);
vertexArray.Bind();
directionalVolumetricRenderer.Render(viewport, target, camera, scene);
target->lightingFramebuffer.Bind(true);
target->lightingFramebuffer.SetDrawBuffers({ GL_COLOR_ATTACHMENT0 });
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
directionalLightRenderer.Render(viewport, target, camera, scene, &dfgPreintegrationTexture);
glEnable(GL_DEPTH_TEST);
target->lightingFramebuffer.SetDrawBuffers({ GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1 });
if (batch) {
glDepthMask(GL_TRUE);
RenderBatched(nullptr, camera, batch);
glDepthMask(GL_FALSE);
}
if (scene->sky.probe) {
skyboxRenderer.Render(viewport, target, camera, scene);
}
else {
atmosphereRenderer.Render(viewport, target, camera, scene);
}
glDepthMask(GL_TRUE);
oceanRenderer.Render(viewport, target, camera, scene);
glDisable(GL_DEPTH_TEST);
if (scene->postProcessing.taa) {
taaRenderer.Render(viewport, target, camera, scene);
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
target->historyFramebuffer.Unbind();
}
else {
target->lightingFramebuffer.Unbind();
}
vertexArray.Bind();
if (texture) {
framebuffer.AddComponentTexture(GL_COLOR_ATTACHMENT0, texture);
framebuffer.Bind();
}
postProcessRenderer.Render(viewport, target, camera, scene);
Atlas::Texture::Texture2D* postTex;
if (scene->postProcessing.sharpen) {
postTex = &target->postProcessTexture;
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
}
else {
postTex = target->postProcessFramebuffer.GetComponentTexture(GL_COLOR_ATTACHMENT0);
}
if (texture) {
framebuffer.AddComponentTexture(GL_COLOR_ATTACHMENT0, texture);
RenderTexture(viewport, postTex, 0.0f, 0.0f,
(float)viewport->width, (float)viewport->height,
false, &framebuffer);
}
else {
RenderTexture(viewport, postTex, 0.0f, 0.0f,
(float)viewport->width, (float)viewport->height);
}
}
void MasterRenderer::RenderTexture(Viewport* viewport, Texture::Texture2D* texture, float x, float y, float width, float height,
bool alphaBlending, Framebuffer* framebuffer) {
float viewportWidth = (float)viewport->width;
float viewportHeight = (float)viewport->height;
vec4 clipArea = vec4(0.0f, 0.0f, viewportWidth, viewportHeight);
vec4 blendArea = vec4(0.0f, 0.0f, viewportWidth, viewportHeight);
RenderTexture(viewport, texture, x, y, width, height, clipArea, blendArea, alphaBlending, framebuffer);
}
void MasterRenderer::RenderTexture(Viewport* viewport, Texture::Texture2D* texture, float x, float y, float width, float height,
vec4 clipArea, vec4 blendArea, bool alphaBlending, Framebuffer* framebuffer) {
vertexArray.Bind();
texture2DShader.Bind();
glDisable(GL_CULL_FACE);
if (framebuffer)
framebuffer->Bind();
glViewport(0, 0, viewport->width, viewport->height);
if (alphaBlending) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
texture2DProjectionMatrix->SetValue(glm::ortho(0.0f, (float)viewport->width, 0.0f, (float)viewport->height));
texture2DOffset->SetValue(vec2(x, y));
texture2DScale->SetValue(vec2(width, height));
texture2DBlendArea->SetValue(blendArea);
texture2DClipArea->SetValue(clipArea);
texture->Bind(GL_TEXTURE0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
if (alphaBlending)
glDisable(GL_BLEND);
if (framebuffer)
framebuffer->Unbind();
glEnable(GL_CULL_FACE);
}
void MasterRenderer::RenderTexture(Viewport* viewport, Texture::Texture2DArray* texture, int32_t depth, float x,
float y, float width, float height, bool alphaBlending, Framebuffer* framebuffer) {
float viewportWidth = (float)(!framebuffer ? viewport->width : framebuffer->width);
float viewportHeight = (float)(!framebuffer ? viewport->height : framebuffer->height);
vec4 clipArea = vec4(0.0f, 0.0f, viewportWidth, viewportHeight);
vec4 blendArea = vec4(0.0f, 0.0f, viewportWidth, viewportHeight);
RenderTexture(viewport, texture, depth, x, y, width, height, clipArea, blendArea, alphaBlending, framebuffer);
}
void MasterRenderer::RenderTexture(Viewport* viewport, Texture::Texture2DArray* texture, int32_t depth, float x, float y, float width, float height,
vec4 clipArea, vec4 blendArea, bool alphaBlending, Framebuffer* framebuffer) {
vertexArray.Bind();
texture2DArrayShader.Bind();
glDisable(GL_CULL_FACE);
if (framebuffer) {
framebuffer->Bind(true);
}
else {
glViewport(0, 0, viewport->width, viewport->height);
}
if (alphaBlending) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
float viewportWidth = (float)(!framebuffer ? viewport->width : framebuffer->width);
float viewportHeight = (float)(!framebuffer ? viewport->height : framebuffer->height);
texture2DArrayProjectionMatrix->SetValue(glm::ortho(0.0f, (float)viewportWidth, 0.0f, (float)viewportHeight));
texture2DArrayOffset->SetValue(vec2(x, y));
texture2DArrayScale->SetValue(vec2(width, height));
texture2DArrayBlendArea->SetValue(blendArea);
texture2DArrayClipArea->SetValue(clipArea);
texture2DArrayDepth->SetValue((float)depth);
texture->Bind(GL_TEXTURE0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
if (alphaBlending) {
glDisable(GL_BLEND);
}
if (framebuffer) {
framebuffer->Unbind();
}
glEnable(GL_CULL_FACE);
}
void MasterRenderer::RenderRectangle(Viewport* viewport, vec4 color, float x, float y, float width, float height,
bool alphaBlending, Framebuffer* framebuffer) {
float viewportWidth = (float)(!framebuffer ? viewport->width : framebuffer->width);
float viewportHeight = (float)(!framebuffer ? viewport->height : framebuffer->height);
if (x > viewportWidth || y > viewportHeight ||
y + height < 0 || x + width < 0) {
return;
}
vec4 clipArea = vec4(0.0f, 0.0f, viewportWidth, viewportHeight);
vec4 blendArea = vec4(0.0f, 0.0f, viewportWidth, viewportHeight);
RenderRectangle(viewport, color, x, y, width, height, clipArea, blendArea, alphaBlending, framebuffer);
}
void MasterRenderer::RenderRectangle(Viewport* viewport, vec4 color, float x, float y, float width, float height,
vec4 clipArea, vec4 blendArea, bool alphaBlending, Framebuffer* framebuffer) {
float viewportWidth = (float)(!framebuffer ? viewport->width : framebuffer->width);
float viewportHeight = (float)(!framebuffer ? viewport->height : framebuffer->height);
if (x > viewportWidth || y > viewportHeight ||
y + height < 0 || x + width < 0) {
return;
}
vertexArray.Bind();
rectangleShader.Bind();
glDisable(GL_CULL_FACE);
if (framebuffer) {
framebuffer->Bind(true);
}
else {
glViewport(0, 0, viewport->width, viewport->height);
}
if (alphaBlending) {
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
rectangleProjectionMatrix->SetValue(glm::ortho(0.0f, (float)viewportWidth, 0.0f, (float)viewportHeight));
rectangleOffset->SetValue(vec2(x, y));
rectangleScale->SetValue(vec2(width, height));
rectangleColor->SetValue(color);
rectangleBlendArea->SetValue(blendArea);
rectangleClipArea->SetValue(clipArea);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
if (alphaBlending) {
glDisable(GL_BLEND);
}
if (framebuffer) {
framebuffer->Unbind();
}
glEnable(GL_CULL_FACE);
}
void MasterRenderer::RenderBatched(Viewport* viewport, Camera* camera, RenderBatch* batch) {
batch->TransferData();
if (viewport)
glViewport(viewport->x, viewport->y,
viewport->width, viewport->height);
lineShader.Bind();
lineViewMatrix->SetValue(camera->viewMatrix);
lineProjectionMatrix->SetValue(camera->projectionMatrix);
if (batch->GetLineCount()) {
glLineWidth(batch->GetLineWidth());
batch->BindLineBuffer();
glDrawArrays(GL_LINES, 0, (GLsizei)batch->GetLineCount() * 2);
glLineWidth(1.0f);
}
if (batch->GetTriangleCount()) {
batch->BindTriangleBuffer();
glDrawArrays(GL_TRIANGLES, 0, GLsizei(batch->GetTriangleCount() * 3));
}
}
void MasterRenderer::RenderProbe(Lighting::EnvironmentProbe* probe, RenderTarget* target, Scene::Scene* scene) {
if (probe->resolution != target->GetWidth() ||
probe->resolution != target->GetHeight())
return;
std::vector<PackedMaterial> materials;
std::unordered_map<void*, uint16_t> materialMap;
Viewport viewport(0, 0, probe->resolution, probe->resolution);
PrepareMaterials(scene, materials, materialMap);
auto materialBuffer = Buffer::Buffer(AE_SHADER_STORAGE_BUFFER, sizeof(PackedMaterial), 0,
materials.size(), materials.data());
Lighting::EnvironmentProbe* skyProbe = nullptr;
if (scene->sky.probe) {
skyProbe = scene->sky.probe;
scene->sky.probe = nullptr;
}
vec3 faces[] = { vec3(1.0f, 0.0f, 0.0f), vec3(-1.0f, 0.0f, 0.0f),
vec3(0.0f, 1.0f, 0.0f), vec3(0.0f, -1.0f, 0.0f),
vec3(0.0f, 0.0f, 1.0f), vec3(0.0f, 0.0f, -1.0f) };
vec3 ups[] = { vec3(0.0f, -1.0f, 0.0f), vec3(0.0f, -1.0f, 0.0f),
vec3(0.0f, 0.0f, 1.0f), vec3(0.0f, 0.0f, -1.0f),
vec3(0.0f, -1.0f, 0.0f), vec3(0.0f, -1.0f, 0.0f) };
Camera camera(90.0f, 1.0f, 0.01f, 1000.0f);
camera.UpdateProjection();
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
for (uint8_t i = 0; i < 6; i++) {
vec3 dir = faces[i];
vec3 up = ups[i];
vec3 right = normalize(cross(up, dir));
up = normalize(cross(dir, right));
camera.viewMatrix = glm::lookAt(probe->GetPosition(), probe->GetPosition() + dir, up);
camera.invViewMatrix = glm::inverse(camera.viewMatrix);
camera.location = probe->GetPosition();
camera.direction = dir;
camera.right = right;
camera.up = up;
camera.frustum = Volume::Frustum(camera.projectionMatrix * camera.viewMatrix);
scene->Update(&camera, 0.0f);
// Clear the lights depth maps
depthFramebuffer.Bind();
auto lights = scene->GetLights();
for (auto light : lights) {
if (!light->GetShadow())
continue;
if (!light->GetShadow()->update)
continue;
for (int32_t j = 0; j < light->GetShadow()->componentCount; j++) {
if (light->GetShadow()->useCubemap) {
depthFramebuffer.AddComponentCubemap(GL_DEPTH_ATTACHMENT,
&light->GetShadow()->cubemap, j);
}
else {
depthFramebuffer.AddComponentTextureArray(GL_DEPTH_ATTACHMENT,
&light->GetShadow()->maps, j);
}
glClear(GL_DEPTH_BUFFER_BIT);
}
}
shadowRenderer.Render(&viewport, target, &camera, scene);
glEnable(GL_CULL_FACE);
glCullFace(GL_FRONT);
terrainShadowRenderer.Render(&viewport, target, &camera, scene);
glCullFace(GL_BACK);
// Shadows have been updated
for (auto light : lights) {
if (!light->GetShadow())
continue;
light->GetShadow()->update = false;
}
materialBuffer.BindBase(0);
target->geometryFramebuffer.Bind(true);
target->geometryFramebuffer.SetDrawBuffers({ GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2, GL_COLOR_ATTACHMENT3,
GL_COLOR_ATTACHMENT4, GL_COLOR_ATTACHMENT5 });
glEnable(GL_CULL_FACE);
glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT);
opaqueRenderer.Render(&viewport, target, &camera, scene, materialMap);
terrainRenderer.Render(&viewport, target, &camera, scene, materialMap);
glEnable(GL_CULL_FACE);
glDepthMask(GL_FALSE);
glDisable(GL_DEPTH_TEST);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
target->geometryFramebuffer.SetDrawBuffers({ GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1, GL_COLOR_ATTACHMENT2 });
decalRenderer.Render(&viewport, target, &camera, scene);
glDisable(GL_BLEND);
vertexArray.Bind();
directionalVolumetricRenderer.Render(&viewport, target, &camera, scene);
target->lightingFramebuffer.Bind(true);
target->lightingFramebuffer.SetDrawBuffers({ GL_COLOR_ATTACHMENT0 });
glClearColor(0.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
directionalLightRenderer.Render(&viewport, target, &camera, scene, &dfgPreintegrationTexture);
glEnable(GL_DEPTH_TEST);
target->lightingFramebuffer.SetDrawBuffers({ GL_COLOR_ATTACHMENT0,
GL_COLOR_ATTACHMENT1 });
glDepthMask(GL_TRUE);
oceanRenderer.Render(&viewport, target, &camera, scene);
createProbeFaceShader.Bind();
createProbeFaceShader.GetUniform("faceIndex")->SetValue((int32_t)i);
createProbeFaceShader.GetUniform("ipMatrix")->SetValue(camera.invProjectionMatrix);
int32_t groupCount = probe->resolution / 8;
groupCount += ((groupCount * 8 == probe->resolution) ? 0 : 1);
probe->cubemap.Bind(GL_WRITE_ONLY, 0);
probe->depth.Bind(GL_WRITE_ONLY, 1);
target->lightingFramebuffer.GetComponentTexture(GL_COLOR_ATTACHMENT0)->Bind(GL_TEXTURE0);
target->lightingFramebuffer.GetComponentTexture(GL_DEPTH_ATTACHMENT)->Bind(GL_TEXTURE1);
glDispatchCompute(groupCount, groupCount, 1);
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
}
if (skyProbe) {
scene->sky.probe = skyProbe;
}
}
void MasterRenderer::RenderIrradianceVolume(Scene::Scene* scene, int32_t bounces) {
// This whole function is pretty ineffective. Should use raytracing instead.
auto volume = scene->irradianceVolume;
if (!volume)
return;
Shader::Shader irradianceShader;
Shader::Shader momentsShader;
irradianceShader.AddStage(AE_VERTEX_STAGE, "irradiancevolume/filtering.vsh");
irradianceShader.AddStage(AE_FRAGMENT_STAGE, "irradiancevolume/filtering.fsh");
irradianceShader.AddMacro("IRRADIANCE");
irradianceShader.Compile();
momentsShader.AddStage(AE_VERTEX_STAGE, "irradiancevolume/filtering.vsh");
momentsShader.AddStage(AE_FRAGMENT_STAGE, "irradiancevolume/filtering.fsh");
momentsShader.Compile();
Framebuffer irradianceFrameuffer;
Framebuffer momentsFramebuffer;
Lighting::EnvironmentProbe probe(256);
auto target = new RenderTarget(256, 256);
ivec3 probeCount = volume->probeCount;
for (int32_t i = 0; i < bounces; i++) {
auto tempVolume = *scene->irradianceVolume;
for (int32_t y = 0; y < probeCount.y; y++) {
irradianceFrameuffer.AddComponentTextureArray(GL_COLOR_ATTACHMENT0, &tempVolume.irradianceArray, y);
glClear(GL_COLOR_BUFFER_BIT);
momentsFramebuffer.AddComponentTextureArray(GL_COLOR_ATTACHMENT0, &tempVolume.momentsArray, y);
glClear(GL_COLOR_BUFFER_BIT);
for (int32_t j = 0; j < probeCount.x * probeCount.z; j++) {
int32_t z = j / volume->probeCount.x;
int32_t x = j % volume->probeCount.x;
ivec3 offset = ivec3(x, y, z);
vec3 pos = volume->GetProbeLocation(offset);
probe.SetPosition(pos);
RenderProbe(&probe, target, scene);
probe.cubemap.Bind();
probe.cubemap.GenerateMipmap();
glDisable(GL_DEPTH_TEST);
glDisable(GL_CULL_FACE);
vertexArray.Bind();
auto imgOff = volume->GetIrradianceArrayOffset(offset);
glViewport(imgOff.x, imgOff.y, volume->irrRes, volume->irrRes);
irradianceFrameuffer.Bind();
irradianceShader.Bind();
irradianceShader.GetUniform("probeOffset")->SetValue(offset);
irradianceShader.GetUniform("probeRes")->SetValue(volume->irrRes);
probe.cubemap.Bind(GL_TEXTURE0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
imgOff = volume->GetMomentsArrayOffset(offset);
glViewport(imgOff.x, imgOff.y, volume->momRes, volume->momRes);
momentsFramebuffer.Bind();
momentsShader.Bind();
momentsShader.GetUniform("probeOffset")->SetValue(offset);
momentsShader.GetUniform("probeRes")->SetValue(volume->momRes);
probe.depth.Bind(GL_TEXTURE0);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glEnable(GL_DEPTH_TEST);
glEnable(GL_CULL_FACE);
// glFlush() leads to memory buildup (up to 4 Gb) while being faster (when increasing sample count in IrrdianceCalc)
// Buildup depends on the number of samples taken in the Irradiance shader function
// Note: glFlush() only guarantees, that the commands are being executed in finite time
// glFinsh() is slower (acts like a command fence) but no buildup
// On the other hand we can't just generate new commands without finishing or flushing
glFinish();
}
}
*scene->irradianceVolume = tempVolume;
volume->bounceCount++;
}
delete target;
}
void MasterRenderer::FilterProbe(Lighting::EnvironmentProbe* probe) {
mat4 projectionMatrix = glm::perspective(glm::radians(90.0f), 1.0f, 0.1f, 100.0f);
vec3 faces[] = { vec3(1.0f, 0.0f, 0.0f), vec3(-1.0f, 0.0f, 0.0f),
vec3(0.0f, 1.0f, 0.0f), vec3(0.0f, -1.0f, 0.0f),
vec3(0.0f, 0.0f, 1.0f), vec3(0.0f, 0.0f, -1.0f) };
vec3 ups[] = { vec3(0.0f, -1.0f, 0.0f), vec3(0.0f, -1.0f, 0.0f),
vec3(0.0f, 0.0f, 1.0f), vec3(0.0f, 0.0f, -1.0f),
vec3(0.0f, -1.0f, 0.0f), vec3(0.0f, -1.0f, 0.0f) };
Framebuffer framebuffer;
filterDiffuseShader.Bind();
auto matrixUniform = filterDiffuseShader.GetUniform("pvMatrix");
cubeVertexArray.Bind();
framebuffer.Bind();
probe->cubemap.Bind(GL_TEXTURE0);
glViewport(0, 0, probe->filteredDiffuse.width, probe->filteredDiffuse.height);
glDisable(GL_DEPTH_TEST);
for (uint8_t i = 0; i < 6; i++) {
auto matrix = projectionMatrix *
mat4(mat3(glm::lookAt(vec3(0.0f), faces[i], ups[i])));
matrixUniform->SetValue(matrix);
framebuffer.AddComponentCubemap(GL_COLOR_ATTACHMENT0, &probe->filteredDiffuse, i);
glClear(GL_COLOR_BUFFER_BIT);
glDrawArrays(GL_TRIANGLES, 0, 36);
}
glEnable(GL_DEPTH_TEST);
framebuffer.Unbind();
}
void MasterRenderer::Update() {
textRenderer.Update();
haltonIndex = (haltonIndex + 1) % haltonSequence.size();
}
void MasterRenderer::GetUniforms() {
rectangleProjectionMatrix = rectangleShader.GetUniform("pMatrix");
rectangleOffset = rectangleShader.GetUniform("rectangleOffset");
rectangleScale = rectangleShader.GetUniform("rectangleScale");
rectangleColor = rectangleShader.GetUniform("rectangleColor");
rectangleBlendArea = rectangleShader.GetUniform("rectangleBlendArea");
rectangleClipArea = rectangleShader.GetUniform("rectangleClipArea");
texture2DProjectionMatrix = texture2DShader.GetUniform("pMatrix");
texture2DOffset = texture2DShader.GetUniform("rectangleOffset");
texture2DScale = texture2DShader.GetUniform("rectangleScale");
texture2DBlendArea = texture2DShader.GetUniform("rectangleBlendArea");
texture2DClipArea = texture2DShader.GetUniform("rectangleClipArea");
texture2DArrayProjectionMatrix = texture2DArrayShader.GetUniform("pMatrix");
texture2DArrayOffset = texture2DArrayShader.GetUniform("rectangleOffset");
texture2DArrayScale = texture2DArrayShader.GetUniform("rectangleScale");
texture2DArrayBlendArea = texture2DArrayShader.GetUniform("rectangleBlendArea");
texture2DArrayClipArea = texture2DArrayShader.GetUniform("rectangleClipArea");
texture2DArrayDepth = texture2DArrayShader.GetUniform("textureDepth");
lineViewMatrix = lineShader.GetUniform("vMatrix");
lineProjectionMatrix = lineShader.GetUniform("pMatrix");
}
void MasterRenderer::PrepareMaterials(Scene::Scene* scene, std::vector<PackedMaterial>& materials,
std::unordered_map<void*, uint16_t>& materialMap) {
auto sceneMaterials = scene->GetMaterials();
uint16_t idx = 0;
for (auto material : sceneMaterials) {
PackedMaterial packed;
auto emissiveIntensity = glm::max(glm::max(material->emissiveColor.r,
material->emissiveColor.g), material->emissiveColor.b);
packed.baseColor = Common::Packing::PackUnsignedVector3x10_1x2(vec4(material->baseColor, 0.0f));
packed.emissiveColor = Common::Packing::PackUnsignedVector3x10_1x2(vec4(material->emissiveColor / emissiveIntensity, 0.0f));
packed.transmissionColor = Common::Packing::PackUnsignedVector3x10_1x2(vec4(material->transmissiveColor, 0.0f));
packed.emissiveIntensity = emissiveIntensity;
vec4 data0, data1;
data0.x = material->opacity;
data0.y = material->roughness;
data0.z = material->metalness;
data1.x = material->ao;
data1.y = material->HasNormalMap() ? material->normalScale : 0.0f;
data1.z = material->HasDisplacementMap() ? material->displacementScale : 0.0f;
packed.data0 = Common::Packing::PackUnsignedVector3x10_1x2(data0);
packed.data1 = Common::Packing::PackUnsignedVector3x10_1x2(data1);
packed.features = 0;
packed.features |= material->HasBaseColorMap() ? FEATURE_BASE_COLOR_MAP : 0;
packed.features |= material->HasOpacityMap() ? FEATURE_OPACITY_MAP : 0;
packed.features |= material->HasNormalMap() ? FEATURE_NORMAL_MAP : 0;
packed.features |= material->HasRoughnessMap() ? FEATURE_ROUGHNESS_MAP : 0;
packed.features |= material->HasMetalnessMap() ? FEATURE_METALNESS_MAP : 0;
packed.features |= material->HasAoMap() ? FEATURE_AO_MAP : 0;
packed.features |= glm::length(material->transmissiveColor) > 0.0f ? FEATURE_TRANSMISSION : 0;
materials.push_back(packed);
materialMap[material] = idx++;
}
auto meshes = scene->GetMeshes();
for (auto mesh : meshes) {
auto impostor = mesh->impostor;
if (!impostor)
continue;
PackedMaterial packed;
packed.baseColor = Common::Packing::PackUnsignedVector3x10_1x2(vec4(1.0f));
packed.emissiveColor = Common::Packing::PackUnsignedVector3x10_1x2(vec4(0.0f));
packed.transmissionColor = Common::Packing::PackUnsignedVector3x10_1x2(vec4(impostor->transmissiveColor, 1.0f));
vec4 data0, data1;
data0.x = 1.0f;
data0.y = 1.0f;
data0.z = 1.0f;
data1.x = 1.0f;
data1.y = 0.0f;
data1.z = 0.0f;
packed.data0 = Common::Packing::PackUnsignedVector3x10_1x2(data0);
packed.data1 = Common::Packing::PackUnsignedVector3x10_1x2(data1);
packed.features = 0;
packed.features |= FEATURE_BASE_COLOR_MAP |
FEATURE_ROUGHNESS_MAP | FEATURE_METALNESS_MAP | FEATURE_AO_MAP;
packed.features |= glm::length(impostor->transmissiveColor) > 0.0f ? FEATURE_TRANSMISSION : 0;
materials.push_back(packed);
materialMap[impostor] = idx++;
}
}
void MasterRenderer::PreintegrateBRDF() {
Shader::Shader shader;
shader.AddStage(AE_COMPUTE_STAGE, "brdf/preintegrateDFG.csh");
shader.Compile();
const int32_t res = 256;
dfgPreintegrationTexture = Texture::Texture2D(res, res, AE_RGBA16F);
int32_t groupCount = res / 8;
groupCount += ((res % groupCount) ? 1 : 0);
dfgPreintegrationTexture.Bind(GL_WRITE_ONLY, 0);
shader.Bind();
glMemoryBarrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT);
glDispatchCompute(groupCount, groupCount, 1);
glFlush();
}
}
} | 29.657725 | 150 | 0.705872 | [
"mesh",
"render",
"vector"
] |
97deb259b22b1b1410b6be462bd1f321a1cb5465 | 8,989 | cpp | C++ | VFD_MN19216/mbGFX_MN19216.cpp | sstefanov/VFD | ee855fe69203c5f2d4bba396544d92c85ea0f0d1 | [
"MIT"
] | null | null | null | VFD_MN19216/mbGFX_MN19216.cpp | sstefanov/VFD | ee855fe69203c5f2d4bba396544d92c85ea0f0d1 | [
"MIT"
] | null | null | null | VFD_MN19216/mbGFX_MN19216.cpp | sstefanov/VFD | ee855fe69203c5f2d4bba396544d92c85ea0f0d1 | [
"MIT"
] | null | null | null | /// A GFX 1-bit canvas context for graphics
/// double buffer:
/// buffer+offset is the one to draw, the other will be for display
#include <Arduino.h>
#include <SPI.h>
//#include <mbLog.h>
#include "mbGFX_MN19216.h"
//#include <LowLevelQuickDigitalIO.h>
//using namespace LowLevelQuickDigitalIO;
#include <digitalPinFast.h>
// display spi kann bis 200ns/5MHz geht aber auch mit 16 noch ???
#ifdef __STM32F1__
#else
SPISettings settingsA(16000000, LSBFIRST, SPI_MODE0);
#endif
#define TEST
// MOSI = 11; // PB3
// SCK = 13; // PB5
const byte pinLAT = 8; //PB0;
const byte pinBLK1 = 9; //PB1;
const byte pinBLK2 = 10; //PB2;
digitalPinFast f_pinLAT(pinLAT);
digitalPinFast f_pinBLK1(pinBLK1);
digitalPinFast f_pinBLK2(pinBLK2);
// offset table
const uint8_t _boffset[16] PROGMEM = {
0x10,
0x01,
0x20,
0x02,
0x40,
0x04,
0x80,
0x08,
0x20,
0x02,
0x10,
0x01,
0x80,
0x08,
0x40,
0x04
};
#ifdef TEST
const byte pinTEST = 4; // Test pin, toggle on timer interrupt
const byte pinTEST2 = 5; // Test pin, toggle on timer interrupt
bool tTEST;
digitalPinFast f_pinTEST(pinTEST);
digitalPinFast f_pinTEST2(pinTEST2);
#endif
//const byte pinGBLK = PA2; // Not used
//const byte pinGLAT = PA3; // Not used - VCC1
const byte pinGCLK = 6; //PD6; // A4 -> no output might be related to SPI function
const byte pinGSIN = 7; //PD7; // A6 = MISO seems to be used
digitalPinFast f_pinGCLK(pinGCLK);
digitalPinFast f_pinGSIN(pinGCLK);
const byte pinPWM = 3; // OC2B
#ifdef __STM32F1__
// SCLK=PA5 MOSI=PA7
#else
//#define SDCARD_MOSI_PIN 7
//#define SDCARD_SCK_PIN 14
#endif
// Create an IntervalTimer object
#ifdef __STM32F1__
HardwareTimer timer(2);
#else
//IntervalTimer myTimer;
#endif
byte *ptr;
unsigned long displayTime;
MN19216 *MN19216::_the = nullptr;
MN19216::MN19216() : Adafruit_GFX(192, 16) {
uint16_t bytes = (192 / 8) * 16;
if((buffer = (uint8_t *)malloc(bytes*2))) {
memset(buffer, 0, bytes*2);
}
_the = this;
}
MN19216::~MN19216(void) {
if(buffer) free(buffer);
}
void MN19216::begin()
{
pinMode(pinBLK1, OUTPUT);
pinMode(pinBLK2, OUTPUT);
pinMode(pinLAT, OUTPUT);
pinMode(pinGCLK , OUTPUT);
pinMode(pinGSIN , OUTPUT);
#ifdef TEST
pinMode(pinTEST, OUTPUT);
pinMode(pinTEST2, OUTPUT);
#endif
// pinMode(pinGBLK , OUTPUT);
// pinMode(pinGLAT , OUTPUT);
digitalWrite(pinBLK1, HIGH);
digitalWrite(pinBLK2, HIGH);
digitalWrite(pinLAT, LOW);
// digitalWrite(pinGBLK, HIGH);
// digitalWrite(pinGLAT, LOW);
digitalWrite(pinGCLK, HIGH);
digitalWrite(pinGSIN, LOW);
/* for(byte i = 0; i < 64; i++)
{
digitalWrite(pinGCLK, LOW);
digitalWrite(pinGCLK, HIGH);
}
*/
// digitalWrite(pinGLAT, HIGH);
// digitalWrite(pinGLAT, LOW);
#ifdef __STM32F1__
SPI.begin(); //Initiallize the SPI 1 port.
SPI.setBitOrder(LSBFIRST); // Set the SPI-1 bit order (*)
SPI.setDataMode(SPI_MODE0); //Set the SPI-1 data mode (**)
SPI.setClockDivider(SPI_CLOCK_DIV8); // Slow speed (72 / 16 = 4.5 MHz SPI speed) timer.pause();
timer.setPeriod(100000); // in microseconds
timer.setChannel1Mode(TIMER_OUTPUT_COMPARE);
timer.setCompare(TIMER_CH1, 1); // Interrupt 1 count after each update
timer.attachCompare1Interrupt(displayRefresh);
timer.refresh();
timer.resume();
#else
analogWrite(pinPWM, 128);
// SPI.setMOSI(SDCARD_MOSI_PIN);
// SPI.setSCK(SDCARD_SCK_PIN);
SPI.begin();
SPI.beginTransaction(settingsA);
// myTimer.begin(displayRefresh, 2000);
// Timer1.attachInterrupt(displayRefresh);
#endif
}
void MN19216::drawPixel(int16_t x, int16_t y, uint16_t color) {
// LOG << "drawPixel " << x <<"," << y <<"\n";
byte *ptr = _the->getBuffer() + _the->_offset;
#ifdef DEBUG
Serial.print(x);
Serial.print(", y=");
Serial.println(y);
#endif
if (buffer) {
if ((x < 0) || (y < 0) || (x >= _width) || (y >= _height))
return;
register uint8_t xr = x;
if (xr < 2)
xr += 190;
else
xr -= 2;
#ifdef DEBUG
Serial.print("1 xr = ");
Serial.println(xr);
#endif
register uint16_t bAddr = (xr / 4) * 8;
#ifdef DEBUG
Serial.print("1 bAddr:");
Serial.println(bAddr);
#endif
register uint8_t bOffset = ((17 - y) / 2) - 1;
#ifdef DEBUG
Serial.print("1 bOffset = ");
Serial.println(bOffset);
#endif
bAddr += bOffset;
#ifdef DEBUG
Serial.print("1 bAddr:");
Serial.println(bAddr);
#endif
uint8_t index = ((xr & 0x07) << 1) + (y & 0x01);
bOffset = pgm_read_byte(&_boffset[index]);
/*
Serial.println("_boffset:");
Serial.print("0x");
for (uint8_t i = 0; i < sizeof(_boffset); i++) {
Serial.print(pgm_read_byte(&_boffset[i]), HEX);
Serial.print(", 0x");
}
// LOG <<" adr:" <<adr <<", bitpos:" <<bitpos <<" bytepos:" <<bytepos <<"\n";
Serial.println("");
*/
#ifdef DEBUG
Serial.print("2 xr & 0x07 << 1:");
Serial.println((xr & 0x07) << 1);
Serial.print("2 y & 0x01:");
Serial.println(y);
Serial.print("2 index:");
Serial.println(index);
Serial.print("2 bOffset = 0x");
Serial.println(bOffset, HEX);
#endif
ptr += bAddr;
int z = (unsigned int)ptr;
#ifdef DEBUG
Serial.print(" ptr=0x");
Serial.println(z,HEX);
Serial.print(" was *ptr=0x");
Serial.print(*ptr,HEX);
#endif
if (color)
*ptr |= bOffset;
else
*ptr &= ~bOffset;
#ifdef DEBUG
Serial.print(" become *ptr=0x");
Serial.println(*ptr,HEX);
#endif
}
}
void MN19216::fillScreen(uint16_t color)
{
if(buffer) {
uint16_t bytes = (WIDTH / 8) * HEIGHT;
memset(buffer + _offset, color ? 0xFF : 0x00, bytes);
}
}
void MN19216::swapBuffers()
{
noInterrupts();
uint16_t bytes = (_width / 8) * _height;
if(_offset)
{
_offset = 0;
}
else
{
_offset = bytes;
}
unsigned long time = displayTime;
interrupts();
//LOG << "dispTime:" <<time <<"us\n";
Serial.print("dispTime:");
Serial.println(time);
// 1500us, mhm not so bad
}
void MN19216::nextGate(byte gate)
{
if(gate < 2)
digitalWrite(pinGSIN, HIGH);
else
digitalWrite(pinGSIN, LOW);
// clk
digitalWrite(pinGCLK, LOW);
digitalWrite(pinGCLK, HIGH);
}
// byte gate = 0;
void MN19216::displayRefresh()
{
#ifdef TEST
// tTEST = !tTEST;
// digitalWrite(pinTEST, tTEST ? HIGH : LOW);
// digitalWrite(pinTEST, HIGH);
f_pinTEST.digitalWriteFast(HIGH);
#endif // TEST
// unsigned long time = micros();
uint32_t bytes = ((_the->width()) / 8) * _the->height();
byte *drawBuffer = _the->getBuffer() + _the->_offset;
/* if (_the->_offset) {
drawBuffer = _the->getBuffer() - bytes;
}
else
{
drawBuffer = _the->getBuffer();// + bytes;
}
*/
byte gate = 0;
ptr = drawBuffer;
byte b1;
while (gate < 48) // 1 gate = 4 pixel
{
// nextGate(gate);
if (gate < 2)
digitalWrite(pinGSIN, HIGH);
else
digitalWrite(pinGSIN, LOW);
// gclk
digitalWrite(pinGCLK, LOW);
digitalWrite(pinGCLK, HIGH);
digitalWrite(pinGSIN, LOW);
gate++;
f_pinBLK1.digitalWriteFast(HIGH);
f_pinBLK2.digitalWriteFast(HIGH);
f_pinBLK1.digitalWriteFast(LOW);
for (byte i = 0; i < 8; i++) {
SPI.transfer(*ptr);
ptr++;
// SPI.transfer(B11110000 & ptr[i]);
}
f_pinBLK1.digitalWriteFast(HIGH);
// digitalWrite(pinBLK1, HIGH); // delay
// digitalWrite(pinLAT, HIGH);
// nextGate(gate);
if (gate < 2)
digitalWrite(pinGSIN, HIGH);
else
digitalWrite(pinGSIN, LOW);
// gclk
digitalWrite(pinGCLK, LOW);
digitalWrite(pinGCLK, HIGH);
digitalWrite(pinGSIN, LOW);
gate ++;
f_pinLAT.digitalWriteFast(HIGH);
f_pinLAT.digitalWriteFast(LOW);
f_pinBLK2.digitalWriteFast(LOW);
for(byte i = 0; i < 8; i++) {
SPI.transfer(*ptr);
ptr++;
// SPI.transfer(B00001111 & ptr[i]);
}
f_pinBLK2.digitalWriteFast(HIGH);
// digitalWrite(pinBLK2, HIGH); // delay
// digitalWrite(pinLAT, HIGH);
f_pinLAT.digitalWriteFast(HIGH);
f_pinLAT.digitalWriteFast(LOW);
}
// displayTime = micros() - time;;
#ifdef TEST
// tTEST = !tTEST;
// digitalWrite(pinTEST, tTEST ? HIGH : LOW);
// digitalWrite(pinTEST, LOW);
f_pinTEST.digitalWriteFast(LOW);
#endif // TEST
}
| 24.229111 | 103 | 0.580042 | [
"object"
] |
97e3ceb44ffa19bd3d3b074a71eef3f8512f579e | 8,644 | cpp | C++ | TouchMindLib/touchmind/ribbon/handler/NodeBackgroundColorCommandHandler.cpp | yohei-yoshihara/TouchMind | 3ad878aacde7322ae7c4f94d462e0a2d4a24d3fa | [
"MIT"
] | 15 | 2015-07-10T05:03:27.000Z | 2021-06-08T08:24:46.000Z | TouchMindLib/touchmind/ribbon/handler/NodeBackgroundColorCommandHandler.cpp | yohei-yoshihara/TouchMind | 3ad878aacde7322ae7c4f94d462e0a2d4a24d3fa | [
"MIT"
] | null | null | null | TouchMindLib/touchmind/ribbon/handler/NodeBackgroundColorCommandHandler.cpp | yohei-yoshihara/TouchMind | 3ad878aacde7322ae7c4f94d462e0a2d4a24d3fa | [
"MIT"
] | 10 | 2015-01-04T01:23:56.000Z | 2020-12-29T11:35:47.000Z | #include "stdafx.h"
#include "resource.h"
#include "touchmind/Common.h"
#include "touchmind/Context.h"
#include "touchmind/logging/Logging.h"
#include "touchmind/ribbon/dispatch/RibbonRequestDispatcher.h"
#include "touchmind/ribbon/RibbonFramework.h"
#include "touchmind/ribbon/PropertySet.h"
#include "touchmind/util/BitmapHelper.h"
#include "touchmind/util/ColorUtil.h"
#include "touchmind/model/CurvePoints.h"
#include "touchmind/view/GeometryBuilder.h"
#include "touchmind/view/node/NodeViewManager.h"
#include "touchmind/view/node/NodeFigureHelper.h"
#include "touchmind/ribbon/handler/NodeBackgroundColorCommandHandler.h"
HRESULT touchmind::ribbon::handler::NodeBackgroundColorCommandHandler::_CreateUIImage(D2D1_COLOR_F color,
IUIImage **ppUIImage) {
LOG_ENTER;
static UINT dpiList[] = {96, 120, 144, 192};
static UINT sizeList[] = {32, 40, 48, 64};
HRESULT hr = S_OK;
FLOAT dpiX, dpiY;
m_pContext->GetD2DFactory()->GetDesktopDpi(&dpiX, &dpiY);
UINT width = 0, height = 0;
for (UINT i = 0; i < ARRAYSIZE(dpiList); ++i) {
if (static_cast<UINT>(dpiX) <= dpiList[i]) {
width = height = sizeList[i];
break;
}
}
if (width == 0) {
width = height = 64;
}
CComPtr<IWICBitmap> pWICBitmap = nullptr;
CHK_RES(pWICBitmap,
touchmind::util::BitmapHelper::CreateBitmap(m_pContext->GetWICImagingFactory(), static_cast<UINT>(width),
static_cast<UINT>(height), &pWICBitmap));
CComPtr<ID2D1RenderTarget> pRenderTarget = nullptr;
CHK_RES(pRenderTarget, touchmind::util::BitmapHelper::CreateBitmapRenderTarget(
pWICBitmap, m_pContext->GetD2DFactory(), &pRenderTarget));
pRenderTarget->BeginDraw();
COLORREF colorref = util::ColorUtil::ToColorref(color);
D2D1_COLOR_F startColor;
D2D1_COLOR_F endColor;
touchmind::view::node::NodeFigureHelper plateFigure;
plateFigure.SetStrokeColor(D2D1::ColorF(0.0f, 0.0f, 0.0f, 1.0f));
touchmind::view::node::NodeViewManager::CreateBodyColor(colorref, startColor, endColor);
plateFigure.SetPlateStartColor(startColor);
plateFigure.SetPlateEndColor(endColor);
plateFigure.DrawPlate(D2D1::RectF(0.0f, 0.0f, static_cast<FLOAT>(width), static_cast<FLOAT>(height) * 0.7f),
plateFigure.GetCornerRoundSize(), m_pContext->GetD2DFactory(), pRenderTarget);
pRenderTarget->EndDraw();
HBITMAP hBitmap = nullptr;
touchmind::util::BitmapHelper::CreateBitmapFromWICBitmapSource(pWICBitmap, &hBitmap);
hr = m_pRibbonFramework->GetUIImageFromBitmap()->CreateImage(hBitmap, UI_OWNERSHIP_TRANSFER, ppUIImage);
LOG_LEAVE;
return hr;
}
touchmind::ribbon::handler::NodeBackgroundColorCommandHandler::NodeBackgroundColorCommandHandler()
: m_refCount(0)
, m_pContext(nullptr)
, m_pRibbonFramework(nullptr)
, m_pRibbonRequestDispatcher(nullptr) {
}
touchmind::ribbon::handler::NodeBackgroundColorCommandHandler::NodeBackgroundColorCommandHandler(
touchmind::Context *pContext, touchmind::ribbon::RibbonFramework *pRibbonFramework,
touchmind::ribbon::dispatch::RibbonRequestDispatcher *pRibbonRequestDispatcher)
: m_refCount(0)
, m_pContext(pContext)
, m_pRibbonFramework(pRibbonFramework)
, m_pRibbonRequestDispatcher(pRibbonRequestDispatcher) {
}
touchmind::ribbon::handler::NodeBackgroundColorCommandHandler::~NodeBackgroundColorCommandHandler() {
}
HRESULT
touchmind::ribbon::handler::NodeBackgroundColorCommandHandler::CreateInstance(IUICommandHandler **ppCommandHandler) {
HRESULT hr = S_OK;
if (!ppCommandHandler) {
hr = E_POINTER;
} else {
*ppCommandHandler = nullptr;
NodeBackgroundColorCommandHandler *pHandler = new NodeBackgroundColorCommandHandler();
if (pHandler != nullptr) {
*ppCommandHandler = pHandler;
hr = S_OK;
} else {
hr = E_OUTOFMEMORY;
}
}
return hr;
}
// IUnknown methods
IFACEMETHODIMP_(ULONG) touchmind::ribbon::handler::NodeBackgroundColorCommandHandler::AddRef() {
return InterlockedIncrement(&m_refCount);
}
IFACEMETHODIMP_(ULONG) touchmind::ribbon::handler::NodeBackgroundColorCommandHandler::Release() {
long refCount = InterlockedDecrement(&m_refCount);
if (refCount == 0) {
delete this;
}
return refCount;
}
IFACEMETHODIMP touchmind::ribbon::handler::NodeBackgroundColorCommandHandler::QueryInterface(REFIID riid,
void **ppInterface) {
if (riid == __uuidof(IUnknown)) {
*ppInterface = static_cast<IUnknown *>(this);
} else if (riid == __uuidof(IUICommandHandler)) {
*ppInterface = static_cast<IUICommandHandler *>(this);
} else {
*ppInterface = nullptr;
return E_NOINTERFACE;
}
(static_cast<IUnknown *>(*ppInterface))->AddRef();
return S_OK;
}
IFACEMETHODIMP touchmind::ribbon::handler::NodeBackgroundColorCommandHandler::Execute(
UINT cmdID, UI_EXECUTIONVERB verb, const PROPERTYKEY *pKey, const PROPVARIANT *pPropvarValue,
IUISimplePropertySet *pCommandExecutionProperties) {
UNREFERENCED_PARAMETER(cmdID);
UNREFERENCED_PARAMETER(pCommandExecutionProperties);
LOG(SEVERITY_LEVEL_DEBUG) << L"key = " << *pKey;
HRESULT hr = E_FAIL;
if (pKey && *pKey == UI_PKEY_ColorType) {
UINT color = 0;
UINT type = UI_SWATCHCOLORTYPE_NOCOLOR;
// The Ribbon framework passes color type as the primary property.
if (pPropvarValue != nullptr) {
// Retrieve color type.
hr = UIPropertyToUInt32(UI_PKEY_ColorType, *pPropvarValue, &type);
if (FAILED(hr)) {
return hr;
}
}
// The Ribbon framework passes color as additional property if the color type is RGB.
if (type == UI_SWATCHCOLORTYPE_RGB && pCommandExecutionProperties != nullptr) {
// Retrieve color.
PROPVARIANT var;
hr = pCommandExecutionProperties->GetValue(UI_PKEY_Color, &var);
if (FAILED(hr)) {
return hr;
}
UIPropertyToUInt32(UI_PKEY_Color, var, &color);
}
D2D1_COLOR_F colorF = touchmind::util::ColorUtil::ToColorF(static_cast<COLORREF>(color));
m_pRibbonRequestDispatcher->Execute_NodeBackgroundColor(verb, colorF);
m_pRibbonFramework->GetFramework()->InvalidateUICommand(cmdBackgroundColor, UI_INVALIDATIONS_PROPERTY,
&UI_PKEY_LargeImage);
}
return hr;
}
IFACEMETHODIMP touchmind::ribbon::handler::NodeBackgroundColorCommandHandler::UpdateProperty(
UINT cmdID, REFPROPERTYKEY key, const PROPVARIANT *pPropvarCurrentValue, PROPVARIANT *pPropvarNewValue) {
LOG_ENTER;
UNREFERENCED_PARAMETER(cmdID);
UNREFERENCED_PARAMETER(key);
UNREFERENCED_PARAMETER(pPropvarCurrentValue);
UNREFERENCED_PARAMETER(pPropvarNewValue);
HRESULT hr = E_FAIL;
if (key == UI_PKEY_Enabled) {
BOOL enabled = m_pRibbonRequestDispatcher->UpdateProperty_IsNodeBackgroundColorChangeable() ? TRUE : FALSE;
m_pRibbonFramework->GetFramework()->InvalidateUICommand(cmdBackgroundColor, UI_INVALIDATIONS_PROPERTY,
&UI_PKEY_ColorType);
m_pRibbonFramework->GetFramework()->InvalidateUICommand(cmdBackgroundColor, UI_INVALIDATIONS_PROPERTY,
&UI_PKEY_Color);
m_pRibbonFramework->GetFramework()->InvalidateUICommand(cmdBackgroundColor, UI_INVALIDATIONS_PROPERTY,
&UI_PKEY_LargeImage);
hr = UIInitPropertyFromBoolean(UI_PKEY_BooleanValue, enabled, pPropvarNewValue);
} else if (key == UI_PKEY_ColorType) {
hr = UIInitPropertyFromUInt32(key, UI_SWATCHCOLORTYPE_RGB, pPropvarNewValue);
} else if (key == UI_PKEY_Color) {
if (pPropvarCurrentValue == nullptr) {
hr = UIInitPropertyFromUInt32(key, RGB(255, 255, 255), pPropvarNewValue);
} else {
D2D1_COLOR_F colorF = m_pRibbonRequestDispatcher->UpdateProperty_GetNodeBackgroundColor();
COLORREF colorref = touchmind::util::ColorUtil::ToColorref(colorF);
hr = UIInitPropertyFromUInt32(key, colorref, pPropvarNewValue);
}
} else if (key == UI_PKEY_LargeImage) {
if (pPropvarCurrentValue != nullptr) {
CComPtr<IUIImage> uiImage = nullptr;
D2D1_COLOR_F colorF = m_pRibbonRequestDispatcher->UpdateProperty_GetNodeBackgroundColor();
hr = _CreateUIImage(colorF, &uiImage);
CHK_RES(uiImage, S_OK);
if (SUCCEEDED(hr)) {
hr = UIInitPropertyFromImage(key, uiImage, pPropvarNewValue);
}
}
}
LOG_LEAVE;
return hr;
}
| 40.392523 | 117 | 0.701296 | [
"model"
] |
97e4a9901462c089853b8afa6eb9157e88300b22 | 5,963 | cc | C++ | ui/app_list/app_list_view.cc | quisquous/chromium | b25660e05cddc9d0c3053b3514f07037acc69a10 | [
"BSD-3-Clause"
] | 2 | 2020-06-10T07:15:26.000Z | 2020-12-13T19:44:12.000Z | ui/app_list/app_list_view.cc | quisquous/chromium | b25660e05cddc9d0c3053b3514f07037acc69a10 | [
"BSD-3-Clause"
] | null | null | null | ui/app_list/app_list_view.cc | quisquous/chromium | b25660e05cddc9d0c3053b3514f07037acc69a10 | [
"BSD-3-Clause"
] | null | null | null | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ui/app_list/app_list_view.h"
#include "base/string_util.h"
#include "ui/app_list/app_list_background.h"
#include "ui/app_list/app_list_constants.h"
#include "ui/app_list/app_list_item_view.h"
#include "ui/app_list/app_list_model.h"
#include "ui/app_list/app_list_view_delegate.h"
#include "ui/app_list/contents_view.h"
#include "ui/app_list/pagination_model.h"
#include "ui/app_list/search_box_model.h"
#include "ui/app_list/search_box_view.h"
#include "ui/base/events/event.h"
#include "ui/gfx/insets.h"
#include "ui/gfx/path.h"
#include "ui/gfx/skia_util.h"
#include "ui/views/bubble/bubble_frame_view.h"
#include "ui/views/controls/textfield/textfield.h"
#include "ui/views/layout/box_layout.h"
#include "ui/views/widget/widget.h"
namespace app_list {
namespace {
// Inner padding space in pixels of bubble contents.
const int kInnerPadding = 1;
// The distance between the arrow tip and edge of the anchor view.
const int kArrowOffset = 10;
} // namespace
////////////////////////////////////////////////////////////////////////////////
// AppListView:
AppListView::AppListView(AppListViewDelegate* delegate)
: delegate_(delegate),
search_box_view_(NULL),
contents_view_(NULL) {
}
AppListView::~AppListView() {
// Deletes all child views while the models are still valid.
RemoveAllChildViews(true);
}
void AppListView::InitAsBubble(
gfx::NativeView parent,
PaginationModel* pagination_model,
views::View* anchor,
const gfx::Point& anchor_point,
views::BubbleBorder::ArrowLocation arrow_location) {
#if defined(OS_WIN)
set_background(views::Background::CreateSolidBackground(
kContentsBackgroundColor));
#else
set_background(NULL);
#endif
SetLayoutManager(new views::BoxLayout(views::BoxLayout::kVertical,
kInnerPadding,
kInnerPadding,
kInnerPadding));
search_box_view_ = new SearchBoxView(this);
AddChildView(search_box_view_);
contents_view_ = new ContentsView(this, pagination_model);
AddChildView(contents_view_);
search_box_view_->set_contents_view(contents_view_);
set_anchor_view(anchor);
set_anchor_point(anchor_point);
set_color(kContentsBackgroundColor);
set_margins(gfx::Insets());
set_move_with_anchor(true);
set_parent_window(parent);
set_close_on_deactivate(false);
// Shift anchor rect up 1px because app menu icon center is 1px above anchor
// rect center when shelf is on left/right.
set_anchor_insets(gfx::Insets(kArrowOffset - 1, kArrowOffset,
kArrowOffset + 1, kArrowOffset));
set_shadow(views::BubbleBorder::BIG_SHADOW);
views::BubbleDelegateView::CreateBubble(this);
SetBubbleArrowLocation(arrow_location);
#if !defined(OS_WIN)
GetBubbleFrameView()->set_background(new AppListBackground(
GetBubbleFrameView()->bubble_border()->GetBorderCornerRadius(),
search_box_view_));
contents_view_->SetPaintToLayer(true);
contents_view_->SetFillsBoundsOpaquely(false);
contents_view_->layer()->SetMasksToBounds(true);
#endif
CreateModel();
}
void AppListView::SetBubbleArrowLocation(
views::BubbleBorder::ArrowLocation arrow_location) {
GetBubbleFrameView()->bubble_border()->set_arrow_location(arrow_location);
SizeToContents(); // Recalcuates with new border.
GetBubbleFrameView()->SchedulePaint();
}
void AppListView::SetAnchorPoint(const gfx::Point& anchor_point) {
set_anchor_point(anchor_point);
SizeToContents(); // Repositions view relative to the anchor.
}
void AppListView::Close() {
if (delegate_.get())
delegate_->Close();
else
GetWidget()->Close();
}
void AppListView::UpdateBounds() {
SizeToContents();
}
void AppListView::CreateModel() {
if (delegate_.get()) {
// Creates a new model and update all references before releasing old one.
scoped_ptr<AppListModel> new_model(new AppListModel);
delegate_->SetModel(new_model.get());
search_box_view_->SetModel(new_model->search_box());
contents_view_->SetModel(new_model.get());
model_.reset(new_model.release());
}
}
views::View* AppListView::GetInitiallyFocusedView() {
return search_box_view_->search_box();
}
bool AppListView::WidgetHasHitTestMask() const {
return true;
}
void AppListView::GetWidgetHitTestMask(gfx::Path* mask) const {
DCHECK(mask);
mask->addRect(gfx::RectToSkRect(
GetBubbleFrameView()->GetContentsBounds()));
}
bool AppListView::OnKeyPressed(const ui::KeyEvent& event) {
if (event.key_code() == ui::VKEY_ESCAPE) {
Close();
return true;
}
return false;
}
void AppListView::ButtonPressed(views::Button* sender, const ui::Event& event) {
if (sender->GetClassName() != AppListItemView::kViewClassName)
return;
if (delegate_.get()) {
delegate_->ActivateAppListItem(
static_cast<AppListItemView*>(sender)->model(),
event.flags());
}
Close();
}
void AppListView::QueryChanged(SearchBoxView* sender) {
string16 query;
TrimWhitespace(model_->search_box()->text(), TRIM_ALL, &query);
bool should_show_search = !query.empty();
contents_view_->ShowSearchResults(should_show_search);
if (delegate_.get()) {
if (should_show_search)
delegate_->StartSearch();
else
delegate_->StopSearch();
}
}
void AppListView::OpenResult(const SearchResult& result, int event_flags) {
if (delegate_.get())
delegate_->OpenSearchResult(result, event_flags);
}
void AppListView::InvokeResultAction(const SearchResult& result,
int action_index,
int event_flags) {
if (delegate_.get())
delegate_->InvokeSearchResultAction(result, action_index, event_flags);
}
} // namespace app_list
| 29.230392 | 80 | 0.707194 | [
"model"
] |
97ed3126ae33ec4faeaf2240c0656666082276ae | 4,293 | cpp | C++ | tetris/src/game.cpp | j-petit/console_games | d77c4d4a133e915bb52bf278f7d11bcc68b7934e | [
"MIT"
] | null | null | null | tetris/src/game.cpp | j-petit/console_games | d77c4d4a133e915bb52bf278f7d11bcc68b7934e | [
"MIT"
] | null | null | null | tetris/src/game.cpp | j-petit/console_games | d77c4d4a133e915bb52bf278f7d11bcc68b7934e | [
"MIT"
] | null | null | null | #include "game.h"
#include <mutex>
#include <ncurses.h>
#include <thread>
#include <unistd.h>
using namespace cgame;
void cgame::printstr(const std::string &my_str) {
for (char ch : my_str) {
addch(ch);
}
}
void Game::logic() {}
void Game::draw() {
erase();
// draw playing field
int i = 0;
for (auto line : game_screen_v) {
move(game_origin_y + i, game_origin_x);
printstr(line);
i++;
}
// draw active block
for (int i = 0; i < active_block->bounding_square_size; i++) {
for (int j = 0; j < active_block->bounding_square_size; j++) {
char value = active_block->get_value(i, j);
if (value != ' ') {
mvaddch(game_origin_y + active_block->origin_y + j,
game_origin_x + active_block->origin_x + i,
active_block->get_value(i, j));
}
}
}
move(game_origin_y, game_origin_x + WIDTH + 10);
printstr("Score");
move(game_origin_y + 1, game_origin_x + WIDTH + 10);
printstr(std::to_string(score));
refresh();
}
void Game::input() {
if (getch() == '\033') { // if the first value is esc
getch(); // skip the [
switch (getch()) { // the real value
case 'A':
// Up
active_block->rotate();
if (collision_detection())
active_block->rotate_back();
break;
case 'B':
// Down
active_block->origin_y++;
if (collision_detection()) {
active_block->origin_y--;
new_active_block();
}
break;
case 'C':
// Right
active_block->origin_x++;
if (collision_detection())
active_block->origin_x--;
break;
case 'D':
// Left
active_block->origin_x--;
if (collision_detection())
active_block->origin_x++;
break;
}
}
}
void Game::start() {
initscr();
noecho();
curs_set(0);
timeout(0);
}
void Game::end() {
erase();
mvprintw(0, 0, "Game over. You scored ");
printw("%d", score);
mvprintw(1, 0, "Press key to exit");
timeout(-1);
getch();
endwin();
}
void Game::run() {
start();
Shape shape = block_generator.generate_block();
TetrisBlock block(shape);
active_block = std::make_unique<TetrisBlock>(block);
std::thread thread_move(&Game::move_down, this);
thread_move.detach();
while (!quit) {
usleep(1000);
input();
logic();
draw();
}
end();
}
void Game::move_down() {
while (true) {
active_block->origin_y++;
if (collision_detection()) {
active_block->origin_y--;
new_active_block();
}
usleep(700000);
}
}
Game::Game() : block_generator(1) {
for (unsigned int i = 0; i < HEIGHT; ++i) {
game_screen_v.push_back(generate_empty_line());
}
game_screen_v.push_back(std::string(WIDTH + 2, '#'));
}
std::string Game::generate_empty_line() {
std::string s(WIDTH, ' ');
s.insert(0, 1, '#');
s.append("#");
return s;
}
bool Game::collision_detection() {
for (int i = 0; i < active_block->bounding_square_size; i++) {
for (int j = 0; j < active_block->bounding_square_size; j++) {
if (active_block->get_value(i, j) != ' ') {
if (game_screen_v.at(active_block->origin_y +
j)[active_block->origin_x + i] != ' ') {
return true;
}
}
}
}
return false;
}
void Game::new_active_block() {
for (int i = 0; i < active_block->bounding_square_size; i++) {
for (int j = 0; j < active_block->bounding_square_size; j++) {
char value = active_block->get_value(i, j);
if (value != ' ') {
if (active_block->origin_y + j == 0) {
quit = true;
}
game_screen_v.at(active_block->origin_y +
j)[active_block->origin_x + i] = value;
}
}
}
for (int i = active_block->origin_y;
i < active_block->origin_y + active_block->bounding_square_size; ++i) {
if (i < HEIGHT && !(game_screen_v.at(i).find(' ') != std::string::npos)) {
game_screen_v.erase(game_screen_v.begin() + i);
game_screen_v.insert(game_screen_v.begin(), generate_empty_line());
score = score + 50;
}
}
Shape shape = block_generator.generate_block();
TetrisBlock block(shape);
m.lock();
active_block = std::make_unique<TetrisBlock>(block);
m.unlock();
}
| 23.459016 | 78 | 0.575821 | [
"shape"
] |
97f1687650471d08a4d89164f9a44775c1a691b9 | 12,474 | cc | C++ | ChiTech/ChiMesh/MeshCutting/cutmesh_2D_utils.cc | zachhardy/chi-tech | 18fb6cb691962a90820e2ef4fcb05473f4a6bdd6 | [
"MIT"
] | 1 | 2021-06-15T12:57:35.000Z | 2021-06-15T12:57:35.000Z | ChiTech/ChiMesh/MeshCutting/cutmesh_2D_utils.cc | zachhardy/chi-tech | 18fb6cb691962a90820e2ef4fcb05473f4a6bdd6 | [
"MIT"
] | 6 | 2020-08-17T16:27:12.000Z | 2020-08-19T13:59:45.000Z | ChiTech/ChiMesh/MeshCutting/cutmesh_2D_utils.cc | Naktakala/chi-tech | df5f517d5aff1d167db50ccbcf4229ac0cb668c4 | [
"MIT"
] | null | null | null | #include "meshcutting.h"
#include <algorithm>
//###################################################################
/**Make an edge for a polygon given its edge index.*/
std::pair<uint64_t,uint64_t> chi_mesh::mesh_cutting::
MakeEdgeFromPolygonEdgeIndex(const std::vector<uint64_t>& vertex_ids,
int edge_index)
{
int e = edge_index;
size_t num_verts = vertex_ids.size();
int next_v = (e < (num_verts-1)) ? e+1 : 0;
uint64_t v0_id = vertex_ids[e];
uint64_t v1_id = vertex_ids[next_v];
return std::make_pair(v0_id,v1_id);
}
//###################################################################
/***/
void chi_mesh::mesh_cutting::
PopulatePolygonFromVertices(const MeshContinuum &mesh,
const std::vector<uint64_t> &vertex_ids,
chi_mesh::Cell &cell)
{
cell.faces.clear();
cell.faces.reserve(vertex_ids.size());
cell.vertex_ids = vertex_ids;
cell.centroid = chi_mesh::Vector3(0.0,0.0,0.0);
for (uint64_t vid : cell.vertex_ids)
cell.centroid += mesh.vertices[vid];
cell.centroid /= double(cell.vertex_ids.size());
size_t num_verts = vertex_ids.size();
for (size_t v=0; v<num_verts; ++v)
{
size_t v1_ref = (v < (num_verts-1))? v+1 : 0;
uint64_t v0id = cell.vertex_ids[v];
uint64_t v1id = cell.vertex_ids[v1_ref];
const auto& v0 = mesh.vertices[v0id];
const auto& v1 = mesh.vertices[v1id];
chi_mesh::Vector3 v01 = v1 - v0;
chi_mesh::CellFace face;
face.vertex_ids = {v0id,v1id};
face.normal = v01.Cross(chi_mesh::Normal(0.0,0.0,1.0)).Normalized();
face.centroid = (v0+v1)/2.0;
cell.faces.push_back(face);
}
}
//###################################################################
/**Performs a quality check of a given polygon. The simple quality requirement
* is that, if we form a triangle with the cell-centroid and the vertices of
* each edge (in ccw orientation), no inverted triangles are present.*/
bool chi_mesh::mesh_cutting::
CheckPolygonQuality(const MeshContinuum &mesh, const chi_mesh::Cell &cell)
{
const chi_mesh::Vector3 khat(0.0,0.0,1.0);
auto& v0 = cell.centroid;
size_t num_edges = cell.vertex_ids.size();
for (int e=0; e<num_edges; ++e)
{
auto edge = MakeEdgeFromPolygonEdgeIndex(cell.vertex_ids,e);
const auto& v1 = mesh.vertices[edge.first];
const auto& v2 = mesh.vertices[edge.second];
auto v01 = v1-v0;
auto v02 = v2-v0;
if (v01.Cross(v02).Dot(khat)<0.0)
return false;
}//for edge
return true;
}
//###################################################################
/***/
void chi_mesh::mesh_cutting::
SplitConcavePolygonsIntoTriangles(MeshContinuum &mesh,
std::vector<chi_mesh::Cell*> &cell_list)
{
const chi_mesh::Vector3 khat(0.0,0.0,1.0);
//======================================== Make copy of cell-list
std::vector<chi_mesh::Cell*> original_cell_list = cell_list;
//======================================== Loop over cells in original list
for (auto& cell_ptr : original_cell_list)
{
auto& cell = *(chi_mesh::CellPolygon*)cell_ptr;
//======================================== Get cell info
size_t num_edges = cell.vertex_ids.size();
//================================= Make edges
std::vector<Edge> cell_edges(num_edges);
for (int e=0; e<num_edges; ++e)
cell_edges[e] = MakeEdgeFromPolygonEdgeIndex(cell.vertex_ids,e);
bool has_concavity = false;
for (int e=0; e<num_edges; ++e)
{
int ep1 = (e<(num_edges-1))? e+1 : 0; //e plus 1
auto& edge0 = cell_edges[e ];
auto& edge1 = cell_edges[ep1];
const auto& v0 = mesh.vertices[edge0.first];
const auto& v1 = mesh.vertices[edge0.second];
const auto& v2 = mesh.vertices[edge1.second];
auto v01 = v1-v0;
auto v12 = v2-v1;
if (v01.Cross(v12).Dot(khat)<0.0)
{
has_concavity = true;
break;
}
}//for e
if (has_concavity)
{
//======================================== Push centroid as vertex
mesh.vertices.push_back(cell.centroid);
size_t centroid_id = mesh.vertices.size()-1;
//======================================== Make triangles
//
std::vector<uint64_t> vertex_id_list;
for (int e=0; e<(num_edges-1); ++e)
{
const auto& edge = cell_edges[e];
auto new_cell = new chi_mesh::CellPolygon;
PopulatePolygonFromVertices(mesh,
{edge.first, edge.second, centroid_id},
*new_cell);
mesh.cells.push_back(new_cell);
cell_list.push_back(new_cell);
}
//Make the current cell morph to the last triangle
{
const auto& edge = cell_edges[num_edges-1];
PopulatePolygonFromVertices(mesh,
{edge.first, edge.second, centroid_id},
cell);
}
}//if has concavity
}//for cell
}
//###################################################################
/**Cuts a polygon.*/
void chi_mesh::mesh_cutting::
CutPolygon(const std::vector<ECI> &cut_edges,
const std::set<uint64_t> &cut_vertices,
const Vector3 &plane_point,
const Vector3 &plane_normal,
MeshContinuum &mesh,
chi_mesh::CellPolygon &cell)
{
const auto& p = plane_point;
const auto& n = plane_normal;
/**Utility lambda to check if a vertex is in "cut_vertices" list.*/
auto VertexIsCut = [&cut_vertices](uint64_t vid)
{
auto result = cut_vertices.find(vid);
if (result != cut_vertices.end())
return true;
return false;
};
/**Utility function to check if an edge is in the "cut_edges" list.*/
auto EdgeIsCut = [&cut_edges](const Edge& edge)
{
Edge edge_set(std::min(edge.first,edge.second),
std::max(edge.first,edge.second));
constexpr auto Arg1 = std::placeholders::_1;
constexpr auto Comparator = &ECI::Comparator;
auto result = std::find_if(cut_edges.begin(),
cut_edges.end(),
std::bind(Comparator,Arg1,edge_set));
if (result != cut_edges.end())
return std::make_pair(true,*result);
return std::make_pair(false,*result);
};
//============================================= Create and set vertex and edge
// cut flags for the current cell.
// Also populate edge_cut_info
size_t num_verts = cell.vertex_ids.size();
size_t num_edges = num_verts;
std::vector<bool> vertex_cut_flags(num_verts,false);
std::vector<bool> edge_cut_flags(num_edges,false);
std::vector<ECI> edge_cut_info(num_edges);
for (size_t e=0; e<num_edges; ++e)
{
vertex_cut_flags[e] = VertexIsCut(cell.vertex_ids[e]);
auto edge = MakeEdgeFromPolygonEdgeIndex(cell.vertex_ids, e);
auto cut_nature = EdgeIsCut(edge);
edge_cut_flags[e] = cut_nature.first;
if (cut_nature.first) edge_cut_info[e] = cut_nature.second;
edge_cut_info[e].vertex_ids = edge;
}//populate flags
//============================================= Lamda for edge loop
enum class CurVertex
{
AT_FIRST,
AT_CUT_POINT,
AT_SECOND,
NONE
};
struct CurCutInfo
{
int which_edge=0;
CurVertex which_vertex=CurVertex::AT_FIRST;
CurCutInfo() = default;
CurCutInfo(int in_which_edge, CurVertex in_which_vertex) :
which_edge(in_which_edge),
which_vertex(in_which_vertex) {}
};
/**This lamda function starts from a current cut-edge, which is either
* an edge where the first vertex is cut or an edge that is cut
* somewhere along its length, and then follows the edges in a ccw fashion
* until it finds another cut. This last cut is just as either an edge
* cut along its length or cut at the second vertex. This then completes
* an edge loop that can be used to define another polygon.*/
auto GetVerticesTillNextCut =
[&cell,&edge_cut_flags,&edge_cut_info,&VertexIsCut](
CurCutInfo start_cut_info)
{
size_t num_verts = cell.vertex_ids.size();
std::vector<uint64_t> vertex_ids;
vertex_ids.reserve(num_verts); //Ought to be more than enough
int e = start_cut_info.which_edge;
auto end_type = CurVertex::NONE;
switch (start_cut_info.which_vertex)
{
case CurVertex::AT_FIRST:
{
vertex_ids.push_back(edge_cut_info[e].vertex_ids.first);
vertex_ids.push_back(edge_cut_info[e].vertex_ids.second);
if (VertexIsCut(edge_cut_info[e].vertex_ids.second))
{
end_type = CurVertex::AT_SECOND;
goto skip_to_return_portion;
}
break;
}
case CurVertex::AT_CUT_POINT:
{
vertex_ids.push_back(edge_cut_info[e].cut_point_id);
vertex_ids.push_back(edge_cut_info[e].vertex_ids.second);
if (VertexIsCut(edge_cut_info[e].vertex_ids.second))
{
end_type = CurVertex::AT_SECOND;
goto skip_to_return_portion;
}
break;
}
case CurVertex::AT_SECOND:
case CurVertex::NONE:
default:
break;
}//switch type of starting cut
//Look at downstream ccw edges and check for
//edges cut or end-point cuts
for (int eref=0; eref<num_verts; ++eref)
{
e = (e<(num_verts-1))? e+1 : 0;
if (e == start_cut_info.which_edge) break;
if (edge_cut_flags[e])
{
vertex_ids.push_back(edge_cut_info[e].cut_point_id);
end_type = CurVertex::AT_CUT_POINT;
break;
}
else if (VertexIsCut(edge_cut_info[e].vertex_ids.second))
{
vertex_ids.push_back(edge_cut_info[e].vertex_ids.second);
end_type = CurVertex::AT_SECOND;
break;
}
else
vertex_ids.push_back(edge_cut_info[e].vertex_ids.second);
}//for eref
skip_to_return_portion:
CurCutInfo end_cut_info(e, end_type);
return std::make_pair(vertex_ids,end_cut_info);
};
typedef std::pair<std::vector<uint64_t>,CurCutInfo> LoopInfo;
//============================================= Process all edges and create
// edge loops with associated
// cells
std::vector<std::vector<uint64_t>> loops_to_add_to_mesh;
std::vector<CurCutInfo> cut_history;
for (size_t e=0; e<num_edges; ++e)
{
LoopInfo loop_info;
if (vertex_cut_flags[e])
loop_info = GetVerticesTillNextCut(CurCutInfo(e,CurVertex::AT_FIRST));
else if (edge_cut_flags[e])
loop_info = GetVerticesTillNextCut(CurCutInfo(e,CurVertex::AT_CUT_POINT));
else continue;
std::vector<uint64_t> verts_to_next_cut = loop_info.first;
int end_edge = loop_info.second.which_edge;
CurVertex end_type = loop_info.second.which_vertex;
//Notes:
// - If the end_edge == e then this means trouble as a polygon cannot
// be cut like that.
// - If end_edge < e then the end-edge is definitely the edge right before
// the first cut edge. We should still process this edge-loop, but stop
// searching.
if (end_edge < e) //if looped past num_edges
e = int(num_edges)-1; //stop search
else if (end_type == CurVertex::AT_SECOND)
e = end_edge; //resume search after end_e
else
e = end_edge - 1; //resume search at end_e. e will get ++ to end_edge
loops_to_add_to_mesh.push_back(verts_to_next_cut);
}//for e
//================================================== Add derivative cells to
// mesh
// Take the back cell and paste onto
// the current cell reference
if (not loops_to_add_to_mesh.empty())
{
auto& back_loop = loops_to_add_to_mesh.back();
PopulatePolygonFromVertices(mesh, back_loop, cell);
loops_to_add_to_mesh.pop_back();
}//if there are cells to add
// Now push-up new cells from the remainder
for (auto& loop : loops_to_add_to_mesh)
{
auto new_cell = new chi_mesh::CellPolygon;
PopulatePolygonFromVertices(mesh, loop, *new_cell);
mesh.cells.push_back(new_cell);
}
} | 31.984615 | 82 | 0.580728 | [
"mesh",
"vector"
] |
97f3d642cd4095de5c1134e4197e2d4338a16a4c | 727 | cpp | C++ | _Programming/cw1_task_2_1.cpp | DenysGusti/university | d90ddbc3cb023a0d8c8799223457999da4da23b1 | [
"MIT"
] | null | null | null | _Programming/cw1_task_2_1.cpp | DenysGusti/university | d90ddbc3cb023a0d8c8799223457999da4da23b1 | [
"MIT"
] | null | null | null | _Programming/cw1_task_2_1.cpp | DenysGusti/university | d90ddbc3cb023a0d8c8799223457999da4da23b1 | [
"MIT"
] | null | null | null | // Користувач вводить послідовність дійсних чисел розміру n.
// Видалити усі числа, які є менші за середнє значення і надрукувати результат.
#include <iostream>
#include <vector>
using namespace std;
int main() {
int n;
long double average{};
cout << "n = ";
cin >> n;
vector<long double> arr(n);
cout << "array: ";
for (auto &i: arr) {
cin >> i;
average += i;
}
average /= n;
cout << "average = " << average << '\n';
for (int i = n - 1; i >= 0; --i)
if (arr[i] < average)
arr.erase(arr.begin() + i);
cout << "new array: ";
for (const auto &i: arr)
cout << i << ' ';
cout << endl;
return 0;
}
// -1 2 -3 4 -5 6 -7 8 -9 10 | 24.233333 | 79 | 0.515818 | [
"vector"
] |
97fc32da69a3fd3aefb285e40468ca36008d6452 | 26,803 | cc | C++ | aimsalgo/src/aimsalgo/information/pdf.cc | brainvisa/aims-free | 5852c1164292cadefc97cecace022d14ab362dc4 | [
"CECILL-B"
] | 4 | 2019-07-09T05:34:10.000Z | 2020-10-16T00:03:15.000Z | aimsalgo/src/aimsalgo/information/pdf.cc | brainvisa/aims-free | 5852c1164292cadefc97cecace022d14ab362dc4 | [
"CECILL-B"
] | 72 | 2018-10-31T14:52:50.000Z | 2022-03-04T11:22:51.000Z | aimsalgo/src/aimsalgo/information/pdf.cc | brainvisa/aims-free | 5852c1164292cadefc97cecace022d14ab362dc4 | [
"CECILL-B"
] | null | null | null | /* This software and supporting documentation are distributed by
* Institut Federatif de Recherche 49
* CEA/NeuroSpin, Batiment 145,
* 91191 Gif-sur-Yvette cedex
* France
*
* This software is governed by the CeCILL-B license under
* French law and abiding by the rules of distribution of free software.
* You can use, modify and/or redistribute the software under the
* terms of the CeCILL-B license as circulated by CEA, CNRS
* and INRIA at the following URL "http://www.cecill.info".
*
* As a counterpart to the access to the source code and rights to copy,
* modify and redistribute granted by the license, users are provided only
* with a limited warranty and the software's author, the holder of the
* economic rights, and the successive licensors have only limited
* liability.
*
* In this respect, the user's attention is drawn to the risks associated
* with loading, using, modifying and/or developing or reproducing the
* software by the user in light of its specific status of free software,
* that may mean that it is complicated to manipulate, and that also
* therefore means that it is reserved for developers and experienced
* professionals having in-depth computer knowledge. Users are therefore
* encouraged to load and test the software's suitability as regards their
* requirements in conditions enabling the security of their systems and/or
* data to be ensured and, more generally, to use and operate it in the
* same conditions as regards security.
*
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-B license and that you accept its terms.
*/
// activate deprecation warning
#ifdef AIMSDATA_CLASS_NO_DEPREC_WARNING
#undef AIMSDATA_CLASS_NO_DEPREC_WARNING
#endif
#include <aims/information/pdf.h>
#include <aims/math/mathelem.h>
#include <aims/bucket/bucketMap.h>
#include <cartodata/volume/volume.h>
#include <iostream>
#include <list>
#include <math.h>
using namespace std;
using namespace aims;
using namespace carto;
inline
double parzen( double u, double h )
{
return exp( - 0.5 * sqr( u / h ) ) / ( sqrt( 2 * M_PI ) * h );
}
inline
double parzen2( double u, double h, int dim)
{
return exp( - 0.5 * u / (h * h) ) / ( pow(h, dim));
}
void AimsParzenJointPdf( const rc_ptr<Volume<short> >& data1,
const rc_ptr<Volume<short> >& data2,
rc_ptr<Volume<float> >& p12,
rc_ptr<Volume<float> >& p1,
rc_ptr<Volume<float> >& p2 )
{
int levels = p12->getSizeX();
ASSERT( p12->getSizeY() == levels && p1->getSizeX() == levels && p2->getSizeX() == levels );
float mini1 = float( data1->min() );
float maxi1 = float( data1->max() );
ASSERT( maxi1 != mini1 );
float mini2 = float( data2->min() );
float maxi2 = float( data2->max() );
if ( maxi2 == mini2 )
{
cerr << "Warning ! AimsParzenJointPdf : maxi2 == mini2" << endl;
return;
}
float h1 = ( maxi1 - mini1 ) / levels;
float h2 = ( maxi2 - mini2 ) / levels;
int i, j, k, n1, n2;
vector<int> dim = data1->getSize();
vector<int> p12dim = p12->getSize();
*p12 = 0.0;
for( k=0; k<dim[2]; ++k )
for( j=0; j<dim[1]; ++j )
for( i=0; i<dim[0]; ++i )
{
for( n2=0; n2<p12dim[1]; ++n2 )
for( n1=0; n1<p12dim[0]; ++n1 )
{
p12->at( n1, n2 ) += parzen( mini1 + ( n1 + 0.5 ) * h1 -
float( data1->at( i, j, k ) ), h1 )
* parzen( mini2 + ( n2 + 0.5 ) * h2 -
float( data2->at( i, j, k ) ), h2 );
}
}
float sum=0.0;
int x, y;
for( y=0; y<p12dim[1]; ++y )
for( x=0; x<p12dim[0]; ++x )
sum += p12->at( x, y );
if (sum)
for( y=0; y<p12dim[1]; ++y )
for( x=0; x<p12dim[0]; ++x )
p12->at( x, y ) /= sum;
*p1 = 0.0;
*p2 = 0.0;
for ( y = 0; y < levels; y++ )
for ( x = 0; x < levels; x++ )
{
p1->at( x ) += p12->at( x, y );
p2->at( y ) += p12->at( x, y );
}
}
void AimsParzenPdf(const rc_ptr<Volume<short> >& data,
rc_ptr<Volume<float> >& p)
{
int levels = p->getSizeX();
float mini = float( data->min() );
float maxi = float( data->max() );
ASSERT( maxi != mini );
float h = ( maxi - mini ) / levels;
int i, j, k, n;
vector<int> dim = data->getSize();
int nd = p->getSizeX();
*p = 0.0;
for( k=0; k<dim[2]; ++k )
for( j=0; j<dim[1]; ++j )
for( i=0; i<dim[0]; ++i )
{
for( n=0; n<nd; ++n )
p->at( n ) += parzen(mini + ( n + 0.5 ) * h
- float( data->at( i, j, k ) ), h);
}
float sum=0.0;
int x;
for( x=0; x<nd; ++x )
sum += p->at( x );
if (sum)
for( x=0; x<nd; ++x )
p->at( x ) /= sum;
}
void AimsWinParzenJointPdf(const rc_ptr<Volume<short> >& data1,
const rc_ptr<Volume<short> >& data2,
rc_ptr<Volume<float> >& p12,
rc_ptr<Volume<float> >& p1,
rc_ptr<Volume<float> >& p2,
const rc_ptr<Volume<float> >& mask)
{
int levels = p12->getSizeX();
ASSERT( p12->getSizeY() == levels && p1->getSizeX() == levels
&& p2->getSizeX() == levels );
float mini1 = float( data1->min() );
float maxi1 = float( data1->max() );
ASSERT(maxi1 != mini1);
float mini2 = float( data2->min() );
float maxi2 = float( data2->max() );
if ( maxi2 == mini2 )
{
cerr << "Warning ! AimsWinParzenJointPdf : maxi2 == mini2" << endl;
return;
}
float h1 = ( maxi1 - mini1 ) / levels;
float h2 = ( maxi2 - mini2 ) / levels;
int sMask = mask->getSizeX();
int sMaskdiv2 = sMask / 2;
ASSERT( sMask % 2 == 1 );
int i, j, k, n1, n2, v1, v2, val1, val2;
vector<int> dim = data1->getSize();
VolumeRef<float> mask2d( sMask, sMask );
for ( v1 = 0; v1 < sMask; v1++ )
for ( v2 = 0; v2 < sMask; v2++ )
mask2d( v1, v2 ) += mask->at( v1 ) * mask->at( v2 );
*p12 = 0.0;
for( k=0; k<dim[2]; ++k )
for( j=0; j<dim[1]; ++j )
for( i=0; i<dim[0]; ++i )
{
n1 = int((float(data1->at(i, j, k)) - mini1) / h1);
n2 = int((float(data2->at(i, j, k)) - mini2) / h2);
if ( n1 == levels )
n1--;
if ( n2 == levels )
n2--;
for (v1 = 0; v1 < sMask; v1++)
for (v2 = 0; v2 < sMask; v2++)
{
val1 = n1 + v1 - sMaskdiv2;
val2 = n2 + v2 - sMaskdiv2;
if (val1 >= 0 && val1 < levels &&
val2 >= 0 && val2 < levels)
p12->at(val1, val2) += mask2d(v1, v2);
}
}
float sum=0.0;
int x, y;
vector<int> pd = p12->getSize();
for ( y = 0; y < pd[1]; y++ )
for ( x = 0; x < pd[0]; x++ )
sum += p12->at( x, y );
if (sum)
for ( y = 0; y < pd[1]; y++ )
for ( x = 0; x < pd[0]; x++ )
p12->at( x, y ) /= sum;
*p1 = 0.0;
*p2 = 0.0;
for (y = 0; y < levels; y++)
for (x = 0; x < levels; x++)
{
p1->at( x ) += p12->at( x, y );
p2->at( y ) += p12->at( x, y );
}
}
void AimsWinParzenPdf(const rc_ptr<Volume<short> >& data,
rc_ptr<Volume<float> >& p,
const rc_ptr<Volume<float> >& mask)
{
int levels = p->getSizeX();
float mini = float( data->min() );
float maxi = float( data->max() );
ASSERT( maxi != mini );
float h = ( maxi - mini ) / levels;
int sMask = mask->getSizeX();
ASSERT( sMask % 2 == 1 );
int i, j, k, n, v, val;
vector<int> dim = data->getSize();
*p = 0.0;
for( k=0; k<dim[2]; ++k )
for( j=0; j<dim[1]; ++j )
for( i=0; i<dim[0]; ++i )
{
n = int( ( float( data->at( i, j, k ) ) - mini ) / h );
if ( n == levels )
n--;
for ( v = 0; v < sMask; v++ )
{
val = n + v - sMask / 2;
if ( val >= 0 && val < levels )
p->at( val ) += mask->at( v );
}
}
float sum=0.0;
int x, np = p->getSizeX();
for( x=0; x<np; ++x )
sum += p->at(x);
if (sum)
for( x=0; x<np; ++x )
p->at(x) /= sum;
}
void AimsJointPdf( const rc_ptr<Volume<short> >& data1,
const rc_ptr<Volume<short> >& data2,
rc_ptr<Volume<float> >& p12,
rc_ptr<Volume<float> >& p1, rc_ptr<Volume<float> >& p2 )
{
int levels = p12->getSizeX();
ASSERT( p12->getSizeY() == levels && p1->getSizeX() == levels
&& p2->getSizeX() == levels );
// TODO: data1 and data2 must necessarily have the same voxel size. It would
// probably be better to use the lower voxel sizes and field of view
// to determine the step and the grid to use during pdf updates
ASSERT( data1->getVoxelSize() == data2->getVoxelSize() );
int dx = min(data1->getSizeX(), data2->getSizeX()),
dy = min(data1->getSizeY(), data2->getSizeY()),
dz = min(data1->getSizeZ(), data2->getSizeZ());
float mini1 = float( data1->min() );
float maxi1 = float( data1->max() );
float maxi2 = float( data2->max() );
float mini2 = float( data2->min() );
double h1 = (( mini1 == maxi1) ? 1 : ( maxi1 - mini1 ) / levels);
double h2 = (( mini2 == maxi2) ? 1 : ( maxi2 - mini2 ) / levels);
int i, j, k, n1, n2;
*p12 = 0.0;
for(k = 0; k < dz; ++k)
for(j = 0; j < dy; ++j)
for(i = 0; i < dx; ++i)
{
n1 = int( ( float( data1->at( i, j, k ) ) - mini1 ) / h1 );
n2 = int( ( float( data2->at( i, j, k ) ) - mini2 ) / h2 );
if ( n1 == levels )
n1--;
if ( n2 == levels )
n2--;
p12->at( n1, n2 )++;
}
float sum=0.0;
int x, y;
vector<int> pd = p12->getSize();
for (y = 0; y<pd[1]; y++)
for (x = 0; x<pd[0]; x++)
sum += p12->at( x, y );
if (sum)
for (y = 0; y<pd[1]; y++)
for (x = 0; x<pd[0]; x++)
p12->at( x, y ) /= sum;
*p1 = 0.0;
*p2 = 0.0;
for ( y = 0; y < levels; y++ )
for ( x = 0; x < levels; x++ )
{
// Due to floatting point arithmetic, probability
// can be a little bit over 1. Min function is used
// to fix the issue
p1->at(x) = std::min((double)p1->at(x) + p12->at( x, y ),
(double)1.0);
p2->at(y) = std::min((double)p2->at(y) + p12->at( x, y ),
(double)1.0);
}
}
void AimsPdf( const rc_ptr<Volume<short> >& data, rc_ptr<Volume<float> >& p )
{
int levels = p->getSizeX();
float mini = float( data->min() );
float maxi = float( data->max() );
ASSERT( maxi != mini );
float h = ( maxi - mini ) / levels;
int i, j, k, n;
vector<int> dim = data->getSize();
*p = 0.0;
for( k=0; k<dim[2]; ++k )
for( j=0; j<dim[1]; ++j )
for( i=0; i<dim[0]; ++i )
{
n = int((float(data->at(i, j, k )) - mini) / h);
if (n == levels)
n--;
p->at(n)++;
}
float sum=0.0;
int x, np=p->getSizeX();
for( x=0; x<np; ++x )
sum += p->at( x );
if (sum)
for( x=0; x<np; ++x )
p->at( x ) /= sum;
}
static float minMask(const rc_ptr<Volume<short> >& d)
{
short mini;
line_NDIterator<short> it( &d->at( 0 ), d->getSize(), d->getStrides() );
short *t, *tt;
mini = 32767;
for( ; !it.ended(); ++it )
{
t = &*it;
for( tt=t + it.line_length(); t!=tt; it.inc_line_ptr( t ) )
if ( (*t < mini) && (*t != -32768))
mini = *t;
}
return ( (float)mini );
}
void AimsJointMaskPdf(const rc_ptr<Volume<short> >& data1,
const rc_ptr<Volume<short> >& data2,
rc_ptr<Volume<float> >& p12,
rc_ptr<Volume<float> >& p1,
rc_ptr<Volume<float> >& p2 )
{
int levels = p12->getSizeX();
ASSERT( p12->getSizeY() == levels && p1->getSizeX() == levels
&& p2->getSizeX() == levels );
// TODO: data1 and data2 must necessarily have the same voxel size. It would
// probably be better to use the lower voxel sizes and field of view
// to determine the step and the grid to use during pdf updates
ASSERT( data1->getVoxelSize() == data2->getVoxelSize() );
int dx = min(data1->getSizeX(), data2->getSizeX()),
dy = min(data1->getSizeY(), data2->getSizeY()),
dz = min(data1->getSizeZ(), data2->getSizeZ());
// float mini1 = float( data1->min() );
double mini1 = minMask( data1 );
double maxi1 = double( data1->max() );
double mini2 = minMask( data2 );
double maxi2 = double( data2->max() );
double h1 = (( mini1 == maxi1) ? 1 : ( maxi1 - mini1 ) / levels);
double h2 = (( mini2 == maxi2) ? 1 : ( maxi2 - mini2 ) / levels);
int i, j, k, n1, n2;
*p12 = 0.0;
#ifdef DEBUG
cout << "DEBUG>>min1 max1 min2 max2 " << mini1 << " " << maxi1 <<" " <<mini2<<" "<<maxi2<<endl;
#endif
for(k = 0; k < dz; ++k)
for(j = 0; j < dy; ++j)
for(i = 0; i < dx; ++i)
{
if (data1->at(i, j, k ) != short(-32768) && data2->at(i,j,k) != short(-32768))
{
n1 = int( ( double( data1->at( i, j, k ) ) - mini1 ) / h1 );
n2 = int( ( double( data2->at( i, j, k ) ) - mini2 ) / h2 );
if ( n1 == levels )
n1--;
if ( n2 == levels )
n2--;
p12->at( n1, n2 )++;
}
}
double sum=0.0;
int x, y;
vector<int> pd = p12->getSize();
for(y = 0; y<pd[1]; ++y)
for(x = 0; x<pd[0]; ++x)
sum += p12->at( x, y );
if (sum)
for(y = 0; y<pd[1]; ++y)
for(x = 0; x<pd[0]; ++x)
p12->at( x, y ) /= float(sum);
*p1 = 0.0;
*p2 = 0.0;
for( y = 0; y < levels; y++)
for ( x = 0; x < levels; x++ )
{
// Due to floatting point arithmetic, probability
// can be a little bit over 1. Min function is used
// to fix the issue
p1->at(x) = std::min((double)p1->at(x) + p12->at( x, y ),
(double)1.0);
p2->at(y) = std::min((double)p2->at(y) + p12->at( x, y ),
(double)1.0);
}
}
void AimsJointPVPdf(const rc_ptr<Volume<short> >& data1,
const rc_ptr<Volume<short> >& data2,
const rc_ptr<Volume<PVItem> >& comb,
rc_ptr<Volume<float> >& p12,
rc_ptr<Volume<float> >& p1,
rc_ptr<Volume<float> >& p2 )
{
int levels = p12->getSizeX();
const int TWO_THEN_SIXTEEN = 65536;
const float TWO_THEN_SIXTEEN_CUBE = 65536.0 * 65536.0 * 65536.0;
ASSERT( p12->getSizeY() == levels &&
p1->getSizeX() == levels &&
p2->getSizeX() == levels );
// float mini1 = float( data1->min() );
float mini1 = minMask( data1 );
float maxi1 = float( data1->max() );
ASSERT( maxi1 != mini1 );
// float mini2 = float( data2.minimum() );
float mini2 = minMask( data2 );
float maxi2 = float( data2->max() );
if ( maxi2 == mini2 )
{
cerr << "Warning ! AimsJointPdf : maxi2 == mini2" << endl;
return;
}
float h1 = ( maxi1 - mini1 ) / levels;
float h2 = ( maxi2 - mini2 ) / levels;
#ifdef DEBUG
cout << "DEBUG>> min1 max1 min2 max2 " << mini1 << " " << maxi1 << " " << mini2 << " " << maxi2 << endl;
#endif
int n1, n2;
*p12 = 0.0;
const_NDIterator<PVItem> it( &comb->at( 0 ), comb->getSize(),
comb->getStrides() );
const_NDIterator<short> it1( &data1->at( 0 ), data1->getSize(),
data1->getStrides() );
float tmp;
int pvf = 0;
for( ; !it.ended(); ++it, ++it1, pvf++)
if ( (*it).offset != -1L && *it1 != -32768)
{
n1 = (int) ((*it1 - mini1)/h1);
if (n1 == levels) n1--;
vector<int> pos = it.position();
vector<int> vp = pos; // orig position
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(TWO_THEN_SIXTEEN - pos[0]) *
(float)(TWO_THEN_SIXTEEN - pos[1]) *
(float)(TWO_THEN_SIXTEEN - pos[2]);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
++pos[0];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(vp[0]) *
(float)(TWO_THEN_SIXTEEN - vp[1]) *
(float)(TWO_THEN_SIXTEEN - vp[2]);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
++pos[1];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(vp[0]) *
(float)(vp[1]) *
(float)(TWO_THEN_SIXTEEN - vp[2]);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
--pos[0];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(TWO_THEN_SIXTEEN - vp[0]) *
(float)(vp[1]) *
(float)(TWO_THEN_SIXTEEN - vp[2]);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
++pos[2];
--pos[1];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(TWO_THEN_SIXTEEN - vp[0]) *
(float)(TWO_THEN_SIXTEEN - vp[1])*
(float)(vp[2]);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
++pos[0];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(vp[0]) *
(float)(TWO_THEN_SIXTEEN - vp[1]) *
(float)(vp[2]);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
++pos[1];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(vp[0])*
(float)(vp[1])*
(float)(vp[2]);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
--pos[0];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(TWO_THEN_SIXTEEN - vp[0]) *
(float)(vp[1])*
(float)(vp[2]);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
}
// Normalization
float sum = carto::sum( p12 );
if (sum)
*p12 /= sum;
// Partial pdf's
*p1 = 0.0;
*p2 = 0.0;
int x, y;
for ( y = 0; y < levels; y++ )
for ( x = 0; x < levels; x++ )
{
p1->at( x ) += p12->at( x, y );
p2->at( y ) += p12->at( x, y );
}
}
void AimsJointPVPdf(const aims::BucketMap<short>& data1,
const rc_ptr<Volume<short> >& data2,
const vector< PVVectorItem >& comb,
rc_ptr<Volume<float> >& p12,
rc_ptr<Volume<float> >& p1,
rc_ptr<Volume<float> >& p2 )
{
const int TWO_THEN_SIXTEEN = 65536;
const float TWO_THEN_SIXTEEN_CUBE = 65536.0 * 65536.0 * 65536.0;
int levels = p12->getSizeX();
ASSERT(p12->getSizeY() == levels &&
p1->getSizeX() == levels &&
p2->getSizeX() == levels);
BucketMap<short>::Bucket::const_iterator itb, itblast= data1.begin()->second.end() ;
float maxi1 = data1.begin()->second.begin()->second ;
float mini1 = data1.begin()->second.begin()->second ;
for(itb=data1.begin()->second.begin(); itb != itblast; ++itb)
{
if (maxi1 < itb->second ) maxi1 = itb->second;
if (mini1 > itb->second ) mini1 = itb->second;
}
float maxi2 = data2->max();
float mini2 = minMask( data2 );
if ( (maxi2 == mini2) || (maxi1 == mini1) )
{
cerr << "Warning ! AimsJointPdf : maxiData == miniData" << endl;
return;
}
float h1 = ( maxi1 - mini1 ) / levels;
float h2 = ( maxi2 - mini2 ) / levels;
int n1, n2;
*p12 = 0.0;
float tmp;
int i;
for(itb=data1.begin()->second.begin(), i=0; itb != itblast; ++itb, ++i)
if ( (comb[i]).offset != -1L )
{
unsigned short deltax = (comb[i]).x;
unsigned short deltay = (comb[i]).y;
unsigned short deltaz = (comb[i]).z;
n1 = (int) ((itb->second - mini1)/h1);
if (n1 == levels) n1--;
vector<int> pos( 3 );
pos[0] = comb[i].x;
pos[1] = comb[i].y;
pos[2] = comb[i].z;
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(TWO_THEN_SIXTEEN - deltax) *
(float)(TWO_THEN_SIXTEEN - deltay) *
(float)(TWO_THEN_SIXTEEN - deltaz);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
++pos[0];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(deltax) *
(float)(TWO_THEN_SIXTEEN - deltay) *
(float)(TWO_THEN_SIXTEEN - deltaz);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
++pos[1];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(deltax) *
(float)(deltay) *
(float)(TWO_THEN_SIXTEEN - deltaz);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
--pos[0];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(TWO_THEN_SIXTEEN - deltax) *
(float)(deltay) *
(float)(TWO_THEN_SIXTEEN - deltaz);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
++pos[2];
--pos[1];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(TWO_THEN_SIXTEEN - deltax) *
(float)(TWO_THEN_SIXTEEN - deltay)*
(float)(deltaz);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
++pos[0];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(deltax) *
(float)(TWO_THEN_SIXTEEN - deltay) *
(float)(deltaz);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
++pos[1];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(deltax)*
(float)(deltay)*
(float)(deltaz);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
--pos[0];
n2 = (int) (( data2->at( pos ) - mini2)/h2);
if (n2 == levels) n2--;
tmp = (float)(TWO_THEN_SIXTEEN - deltax) *
(float)(deltay)*
(float)(deltaz);
p12->at( n1, n2 ) += tmp / TWO_THEN_SIXTEEN_CUBE;
}
// Normalization
float sum = carto::sum( p12 );
int x, y;
if (sum)
*p12 /= sum;
// Partial pdf's
*p1 = 0.0;
*p2 = 0.0;
for ( y = 0; y < levels; y++ )
for ( x = 0; x < levels; x++ )
{
p1->at( x ) += p12->at( x, y );
p2->at( y ) += p12->at( x, y );
}
}
void AimsGeneralizedKnnParzenPdf( aims::knn::Database &db,
rc_ptr<Volume<float> > &pdf, unsigned int k )
{
int x, y, z;
double dx, dy, dz;
double h, sum, val, dist;
int dim = db.dim();
std::vector<double> vec(dim);
aims::knn::KnnGlobalFriedman knn(db, k);
std::pair<std::vector<unsigned int>, std::vector<double> > res;
knn.precompute();
*pdf = 0.;
sum = 0.;
vector<int> pd = pdf->getSize();
for ( z=0; z<pd[2]; ++z )
for ( y=0; y<pd[1]; ++y )
for ( x=0; x<pd[0]; ++x )
{
vec[0] = x;
vec[1] = y;
vec[2] = z;
res = knn.find(vec);
h = res.second[0];
if (h == 0) h = 10e-10;
const std::vector<unsigned int> &id = res.first;
for (int i = id.size() - 1; i >= 0; --i)
{
const double *d = db[id[i]];
dx = (x - d[0]);
dy = (y - d[1]);
dz = (z - d[2]);
dist = dx * dx + dy * dy + dz * dz;
val = parzen2(dist, h, dim);
pdf->at(x, y, z) += val;
sum += val;
}
}
if (sum)
*pdf /= sum;
}
void AimsKnnPdf(aims::knn::Database &db,
rc_ptr<Volume<float> > &pdf, unsigned int k)
{
int x, y, z;
double h, sum, val;
int dim = db.dim();
std::vector<double> vec(dim);
aims::knn::KnnGlobalFriedman knn(db, k);
std::pair<std::vector<unsigned int>, std::vector<double> > res;
knn.precompute();
*pdf = 0.;
sum = 0.;
vector<int> pd = pdf->getSize();
for ( z=0; z<pd[2]; ++z )
for ( y=0; y<pd[1]; ++y )
for ( x=0; x<pd[0]; ++x )
{
vec[0] = x;
vec[1] = y;
vec[2] = z;
res = knn.find(vec);
h = res.second[0];
if (h == 0) h = 10e-10;
h = pow(h, dim); // proportional to volume
val = k / h;
pdf->at(x, y, z) = val;
sum += val;
}
if (sum)
*pdf /= sum;
}
// compilation of some Volume classes on Aims types
#include <cartodata/volume/volume_d.h>
template class carto::Volume<PVItem>;
template class carto::VolumeProxy<PVItem>;
template class carto::VolumeRef<PVItem>;
template class carto::Creator<carto::Volume< PVItem> >;
| 29.880713 | 108 | 0.4573 | [
"vector"
] |
3f02dc7a177ce0298bd63ec852890c466248040e | 539 | cc | C++ | src/codeforces/accepted/822A.cc | cbarnson/UVa | 0dd73fae656613e28b5aaf5880c5dad529316270 | [
"Unlicense",
"MIT"
] | 2 | 2019-09-07T17:00:26.000Z | 2020-08-05T02:08:35.000Z | src/codeforces/accepted/822A.cc | cbarnson/UVa | 0dd73fae656613e28b5aaf5880c5dad529316270 | [
"Unlicense",
"MIT"
] | null | null | null | src/codeforces/accepted/822A.cc | cbarnson/UVa | 0dd73fae656613e28b5aaf5880c5dad529316270 | [
"Unlicense",
"MIT"
] | null | null | null | // Problem # : 822A
// Created on : 2018-Oct-31 17:23:35
#include <bits/stdc++.h>
#define FR(i, n) for (int i = 0; i < (int)(n); ++i)
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
typedef vector<int> vi;
ll fac(ll n) {
if (n < 2) return 1LL;
return n * fac(n - 1LL);
}
ll f[15] = {};
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
FR (i, 13)
f[i] = fac(i);
ll lo, hi;
cin >> lo >> hi;
if (lo > hi) swap(lo, hi);
hi = min(hi, 12LL);
cout << __gcd(f[lo], f[hi]) << endl;
}
| 16.84375 | 51 | 0.549165 | [
"vector"
] |
3f07ac7559f0041d8fa2c0ec2b53566fb4ea6336 | 1,705 | cc | C++ | onnxruntime/core/framework/data_transfer_manager.cc | hqucms/onnxruntime | 6e4e76414639f50836a64546603c8957227857b0 | [
"MIT"
] | 4 | 2019-06-06T23:48:57.000Z | 2021-06-03T11:51:45.000Z | onnxruntime/core/framework/data_transfer_manager.cc | hqucms/onnxruntime | 6e4e76414639f50836a64546603c8957227857b0 | [
"MIT"
] | 10 | 2019-03-25T21:47:46.000Z | 2019-04-30T02:33:05.000Z | onnxruntime/core/framework/data_transfer_manager.cc | hqucms/onnxruntime | 6e4e76414639f50836a64546603c8957227857b0 | [
"MIT"
] | 4 | 2021-06-05T19:52:22.000Z | 2021-11-30T13:58:13.000Z | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
#include "core/framework/data_transfer_manager.h"
namespace onnxruntime {
using namespace common;
Status DataTransferManager::RegisterDataTransfer(std::unique_ptr<IDataTransfer> data_transfer) {
if (nullptr == data_transfer) {
return Status(ONNXRUNTIME, INVALID_ARGUMENT, "data_transfer registered is nullptr.");
}
datatransfers_.push_back(std::move(data_transfer));
return Status::OK();
}
const IDataTransfer* DataTransferManager::GetDataTransfer(const OrtDevice& src_device, const OrtDevice& dst_device) const {
for (auto& data_transfer : datatransfers_) {
if (!data_transfer->CanCopy(src_device, dst_device)) {
continue;
}
return data_transfer.get();
}
return nullptr;
}
Status DataTransferManager::CopyTensor(const Tensor& src, Tensor& dst) const {
return CopyTensor(src, dst, 0);
}
Status DataTransferManager::CopyTensor(const Tensor& src, Tensor& dst, int exec_queue_id) const {
if (src.Shape().Size() != dst.Shape().Size()) {
return Status(ONNXRUNTIME, FAIL, "Tensor size mismatch");
}
for (auto& data_transfer : datatransfers_) {
if (!data_transfer->CanCopy(src.Location().device, dst.Location().device)) {
continue;
}
return data_transfer->CopyTensor(src, dst, exec_queue_id);
}
return ORT_MAKE_STATUS(ONNXRUNTIME,
FAIL,
"There's no data transfer registered for copying tensors from ",
src.Location().device.ToString(),
" to ",
dst.Location().device.ToString());
}
} // namespace onnxruntime
| 31 | 123 | 0.676833 | [
"shape"
] |
3f16bc735988c3ae161ab3c856d08b13c0324546 | 15,678 | cpp | C++ | elab/lnast_create.cpp | jsg831/livehd | 6a3fb84a8db2bdc3460bb391f82a796fef83d13b | [
"BSD-3-Clause"
] | null | null | null | elab/lnast_create.cpp | jsg831/livehd | 6a3fb84a8db2bdc3460bb391f82a796fef83d13b | [
"BSD-3-Clause"
] | null | null | null | elab/lnast_create.cpp | jsg831/livehd | 6a3fb84a8db2bdc3460bb391f82a796fef83d13b | [
"BSD-3-Clause"
] | null | null | null |
#include "lnast_create.hpp"
#include "iassert.hpp"
#include "mmap_str.hpp"
Lnast_create::Lnast_create() {}
mmap_lib::str Lnast_create::create_lnast_tmp() { return mmap_lib::str::concat("___", ++tmp_var_cnt); }
mmap_lib::str Lnast_create::get_lnast_name(mmap_lib::str vname) {
const auto &it = vname2lname.find(vname);
if (it == vname2lname.end()) { // OOPS, use before assignment (can not be IOs mapped before)
auto idx_dot = lnast->add_child(idx_stmts, Lnast_node::create_attr_get());
auto tmp_var = create_lnast_tmp();
lnast->add_child(idx_dot, Lnast_node::create_ref(tmp_var));
lnast->add_child(idx_dot, Lnast_node::create_ref(vname));
lnast->add_child(idx_dot, Lnast_node::create_const("__last_value"));
// vname2lname.emplace(vname, tmp_var);
return tmp_var;
}
return it->second;
}
mmap_lib::str Lnast_create::get_lnast_lhs_name(mmap_lib::str vname) {
const auto &it = vname2lname.find(vname);
if (it == vname2lname.end()) {
// vname2lname.emplace(vname,vname);
return vname;
}
return it->second;
}
void Lnast_create::new_lnast(mmap_lib::str name) {
lnast = std::make_unique<Lnast>(name);
lnast->set_root(Lnast_node(Lnast_ntype::create_top()));
auto node_stmts = Lnast_node::create_stmts();
idx_stmts = lnast->add_child(mmap_lib::Tree_index::root(), node_stmts);
vname2lname.clear();
tmp_var_cnt = 0;
}
// std::vector<std::shared_ptr<Lnast>> Lnast_create::pick_lnast() {
// std::vector<std::shared_ptr<Lnast>> v;
//
// for (auto &l : parsed_lnasts) {
// if (l.second) // do not push null ptr
// v.emplace_back(l.second);
// }
//
// parsed_lnasts.clear();
//
// return v;
// }
// Return a __tmp for (1<<expr)-1
mmap_lib::str Lnast_create::create_mask_stmts(mmap_lib::str dest_max_bit) {
if (dest_max_bit.empty())
return dest_max_bit;
// some fast precomputed values
if (dest_max_bit.is_i()) {
auto value = dest_max_bit.to_i();
if (value < 63 && value >= 0) {
uint64_t v = (1ULL << value) - 1;
return v;
}
}
auto shl_var = create_shl_stmts("1", dest_max_bit);
auto mask_h_var = create_minus_stmts(shl_var, "1");
return mask_h_var;
}
mmap_lib::str Lnast_create::create_bitmask_stmts(mmap_lib::str max_bit, mmap_lib::str min_bit) {
if (max_bit.is_i() && min_bit.is_i()) {
auto a = max_bit.to_i();
auto b = min_bit.to_i();
if (a < b) {
auto tmp = a;
a = b;
b = tmp;
}
auto mask = Lconst::get_mask_value(a, b);
return mask.to_pyrope();
}
if (max_bit == min_bit) {
return create_shl_stmts("1", max_bit);
}
// ((1<<(max_bit-min_bit))-1)<<min_bit
auto max_minus_min = create_minus_stmts(max_bit, min_bit);
auto tmp = create_shl_stmts("1", max_minus_min);
auto upper_mask = create_minus_stmts(tmp, "1");
return create_shl_stmts(upper_mask, min_bit);
}
mmap_lib::str Lnast_create::create_bit_not_stmts(mmap_lib::str var_name) {
if (var_name.empty())
return var_name;
auto res_var = create_lnast_tmp();
auto not_idx = lnast->add_child(idx_stmts, Lnast_node::create_bit_not());
lnast->add_child(not_idx, Lnast_node::create_ref(res_var));
if (var_name.is_string())
lnast->add_child(not_idx, Lnast_node::create_ref(var_name));
else
lnast->add_child(not_idx, Lnast_node::create_const(var_name));
return res_var;
}
mmap_lib::str Lnast_create::create_logical_not_stmts(mmap_lib::str var_name) {
if (var_name.empty())
return var_name;
auto res_var = create_lnast_tmp();
auto not_idx = lnast->add_child(idx_stmts, Lnast_node::create_logical_not());
lnast->add_child(not_idx, Lnast_node::create_ref(res_var));
if (var_name.is_string())
lnast->add_child(not_idx, Lnast_node::create_ref(var_name));
else
lnast->add_child(not_idx, Lnast_node::create_const(var_name));
return res_var;
}
mmap_lib::str Lnast_create::create_reduce_or_stmts(mmap_lib::str var_name) {
if (var_name.empty())
return var_name;
auto res_var = create_lnast_tmp();
auto or_idx = lnast->add_child(idx_stmts, Lnast_node::create_reduce_or());
lnast->add_child(or_idx, Lnast_node::create_ref(res_var));
if (var_name.is_string())
lnast->add_child(or_idx, Lnast_node::create_ref(var_name));
else
lnast->add_child(or_idx, Lnast_node::create_const(var_name));
return res_var;
}
mmap_lib::str Lnast_create::create_sra_stmts(mmap_lib::str a_var, mmap_lib::str b_var) {
I(!a_var.empty());
I(!b_var.empty());
auto res_var = create_lnast_tmp();
auto idx = lnast->add_child(idx_stmts, Lnast_node::create_sra());
lnast->add_child(idx, Lnast_node::create_ref(res_var));
if (a_var.is_string())
lnast->add_child(idx, Lnast_node::create_ref(a_var));
else
lnast->add_child(idx, Lnast_node::create_const(a_var));
if (b_var.is_string())
lnast->add_child(idx, Lnast_node::create_ref(b_var));
else
lnast->add_child(idx, Lnast_node::create_const(b_var));
return res_var;
}
mmap_lib::str Lnast_create::create_pick_bit_stmts(mmap_lib::str a_var, mmap_lib::str pos) {
auto v = create_sra_stmts(a_var, pos);
return create_bit_and_stmts(v, 1);
}
mmap_lib::str Lnast_create::create_sext_stmts(mmap_lib::str a_var, mmap_lib::str b_var) {
I(!a_var.empty());
I(!b_var.empty());
auto res_var = create_lnast_tmp();
auto idx = lnast->add_child(idx_stmts, Lnast_node::create_sext());
lnast->add_child(idx, Lnast_node::create_ref(res_var));
if (a_var.is_string())
lnast->add_child(idx, Lnast_node::create_ref(a_var));
else
lnast->add_child(idx, Lnast_node::create_const(a_var));
if (b_var.is_string())
lnast->add_child(idx, Lnast_node::create_ref(b_var));
else
lnast->add_child(idx, Lnast_node::create_const(b_var));
return res_var;
}
mmap_lib::str Lnast_create::create_bit_and_stmts(mmap_lib::str a_var, mmap_lib::str b_var) {
if (a_var.empty())
return b_var;
if (b_var.empty())
return a_var;
auto res_var = create_lnast_tmp();
auto and_idx = lnast->add_child(idx_stmts, Lnast_node::create_bit_and());
lnast->add_child(and_idx, Lnast_node::create_ref(res_var));
if (a_var.is_string())
lnast->add_child(and_idx, Lnast_node::create_ref(a_var));
else
lnast->add_child(and_idx, Lnast_node::create_const(a_var));
if (b_var.is_string())
lnast->add_child(and_idx, Lnast_node::create_ref(b_var));
else
lnast->add_child(and_idx, Lnast_node::create_const(b_var));
return res_var;
}
mmap_lib::str Lnast_create::create_bit_or_stmts(const std::vector<mmap_lib::str> &var) {
mmap_lib::str res_var;
Lnast_nid lid;
for (auto v : var) {
if (v.empty())
continue;
if (res_var.empty()) {
res_var = create_lnast_tmp();
lid = lnast->add_child(idx_stmts, Lnast_node::create_bit_or());
lnast->add_child(lid, Lnast_node::create_ref(res_var));
}
if (v.is_string())
lnast->add_child(lid, Lnast_node::create_ref(v));
else
lnast->add_child(lid, Lnast_node::create_const(v));
}
return res_var;
}
mmap_lib::str Lnast_create::create_bit_xor_stmts(mmap_lib::str a_var, mmap_lib::str b_var) {
if (a_var.empty())
return b_var;
if (b_var.empty())
return a_var;
auto res_var = create_lnast_tmp();
auto or_idx = lnast->add_child(idx_stmts, Lnast_node::create_bit_xor());
lnast->add_child(or_idx, Lnast_node::create_ref(res_var));
if (a_var.is_string())
lnast->add_child(or_idx, Lnast_node::create_ref(a_var));
else
lnast->add_child(or_idx, Lnast_node::create_const(a_var));
if (b_var.is_string())
lnast->add_child(or_idx, Lnast_node::create_ref(b_var));
else
lnast->add_child(or_idx, Lnast_node::create_const(b_var));
return res_var;
}
mmap_lib::str Lnast_create::create_shl_stmts(mmap_lib::str a_var, mmap_lib::str b_var) {
if (a_var.empty())
return a_var;
if (b_var.empty())
return a_var;
auto res_var = create_lnast_tmp();
auto shl_idx = lnast->add_child(idx_stmts, Lnast_node::create_shl());
lnast->add_child(shl_idx, Lnast_node::create_ref(res_var));
if (a_var.is_string())
lnast->add_child(shl_idx, Lnast_node::create_ref(a_var));
else
lnast->add_child(shl_idx, Lnast_node::create_const(a_var));
if (b_var.is_string())
lnast->add_child(shl_idx, Lnast_node::create_ref(b_var));
else
lnast->add_child(shl_idx, Lnast_node::create_const(b_var));
return res_var;
}
mmap_lib::str Lnast_create::create_mask_xor_stmts(mmap_lib::str a_var, mmap_lib::str b_var) {
I(!a_var.empty()); // mask
I(!b_var.empty()); // data
auto res_var = create_lnast_tmp();
auto shl_idx = lnast->add_child(idx_stmts, Lnast_node::create_mask_xor());
lnast->add_child(shl_idx, Lnast_node::create_ref(res_var));
if (a_var.is_string())
lnast->add_child(shl_idx, Lnast_node::create_ref(a_var));
else
lnast->add_child(shl_idx, Lnast_node::create_const(a_var));
if (b_var.is_string())
lnast->add_child(shl_idx, Lnast_node::create_ref(b_var));
else
lnast->add_child(shl_idx, Lnast_node::create_const(b_var));
return res_var;
}
void Lnast_create::create_dp_assign_stmts(mmap_lib::str lhs_var, mmap_lib::str rhs_var) {
I(lhs_var.size());
I(rhs_var.size());
auto idx_assign = lnast->add_child(idx_stmts, Lnast_node::create_dp_assign());
lnast->add_child(idx_assign, Lnast_node::create_ref(lhs_var));
if (rhs_var.is_string())
lnast->add_child(idx_assign, Lnast_node::create_ref(rhs_var));
else
lnast->add_child(idx_assign, Lnast_node::create_const(rhs_var));
}
void Lnast_create::create_assign_stmts(mmap_lib::str lhs_var, mmap_lib::str rhs_var) {
I(lhs_var.size());
I(rhs_var.size());
auto idx_assign = lnast->add_child(idx_stmts, Lnast_node::create_assign());
lnast->add_child(idx_assign, Lnast_node::create_ref(lhs_var));
if (rhs_var.is_string())
lnast->add_child(idx_assign, Lnast_node::create_ref(rhs_var));
else
lnast->add_child(idx_assign, Lnast_node::create_const(rhs_var));
}
void Lnast_create::create_declare_bits_stmts(mmap_lib::str a_var, bool is_signed, int bits) {
auto idx_dot = lnast->add_child(idx_stmts, Lnast_node::create_tuple_add());
lnast->add_child(idx_dot, Lnast_node::create_ref(a_var));
if (is_signed) {
lnast->add_child(idx_dot, Lnast_node::create_const("__sbits"));
} else {
lnast->add_child(idx_dot, Lnast_node::create_const("__ubits"));
}
lnast->add_child(idx_dot, Lnast_node::create_const(bits));
}
mmap_lib::str Lnast_create::create_minus_stmts(mmap_lib::str a_var, mmap_lib::str b_var) {
if (b_var.empty())
return a_var;
auto res_var = create_lnast_tmp();
auto sub_idx = lnast->add_child(idx_stmts, Lnast_node::create_minus());
lnast->add_child(sub_idx, Lnast_node::create_ref(res_var));
if (a_var.empty()) {
lnast->add_child(sub_idx, Lnast_node::create_const("0"));
} else {
if (a_var.is_string())
lnast->add_child(sub_idx, Lnast_node::create_ref(a_var));
else
lnast->add_child(sub_idx, Lnast_node::create_const(a_var));
}
if (b_var.is_string())
lnast->add_child(sub_idx, Lnast_node::create_ref(b_var));
else
lnast->add_child(sub_idx, Lnast_node::create_const(b_var));
return res_var;
}
mmap_lib::str Lnast_create::create_plus_stmts(mmap_lib::str a_var, mmap_lib::str b_var) {
if (a_var.empty())
return b_var;
if (b_var.empty())
return a_var;
auto res_var = create_lnast_tmp();
auto add_idx = lnast->add_child(idx_stmts, Lnast_node::create_plus());
lnast->add_child(add_idx, Lnast_node::create_ref(res_var));
if (a_var.is_string())
lnast->add_child(add_idx, Lnast_node::create_ref(a_var));
else
lnast->add_child(add_idx, Lnast_node::create_const(a_var));
if (b_var.is_string())
lnast->add_child(add_idx, Lnast_node::create_ref(b_var));
else
lnast->add_child(add_idx, Lnast_node::create_const(b_var));
return res_var;
}
mmap_lib::str Lnast_create::create_mult_stmts(mmap_lib::str a_var, mmap_lib::str b_var) {
if (a_var.empty() || a_var == "1")
return b_var;
if (b_var.empty() || b_var == "1")
return a_var;
auto res_var = create_lnast_tmp();
auto idx = lnast->add_child(idx_stmts, Lnast_node::create_mult());
lnast->add_child(idx, Lnast_node::create_ref(res_var));
if (a_var.is_string())
lnast->add_child(idx, Lnast_node::create_ref(a_var));
else
lnast->add_child(idx, Lnast_node::create_const(a_var));
if (b_var.is_string())
lnast->add_child(idx, Lnast_node::create_ref(b_var));
else
lnast->add_child(idx, Lnast_node::create_const(b_var));
return res_var;
}
mmap_lib::str Lnast_create::create_div_stmts(mmap_lib::str a_var, mmap_lib::str b_var) {
if (b_var.empty() || b_var == "1")
return a_var;
auto res_var = create_lnast_tmp();
auto idx = lnast->add_child(idx_stmts, Lnast_node::create_div());
lnast->add_child(idx, Lnast_node::create_ref(res_var));
if (a_var.empty()) {
lnast->add_child(idx, Lnast_node::create_const("1"));
} else {
if (a_var.is_string())
lnast->add_child(idx, Lnast_node::create_ref(a_var));
else
lnast->add_child(idx, Lnast_node::create_const(a_var));
}
if (b_var.is_string())
lnast->add_child(idx, Lnast_node::create_ref(b_var));
else
lnast->add_child(idx, Lnast_node::create_const(b_var));
return res_var;
}
mmap_lib::str Lnast_create::create_mod_stmts(mmap_lib::str a_var, mmap_lib::str b_var) {
I(a_var.size() && b_var.size());
auto res_var = create_lnast_tmp();
auto idx = lnast->add_child(idx_stmts, Lnast_node::create_mod());
lnast->add_child(idx, Lnast_node::create_ref(res_var));
if (a_var.is_string())
lnast->add_child(idx, Lnast_node::create_ref(a_var));
else
lnast->add_child(idx, Lnast_node::create_const(a_var));
if (b_var.is_string())
lnast->add_child(idx, Lnast_node::create_ref(b_var));
else
lnast->add_child(idx, Lnast_node::create_const(b_var));
return res_var;
}
#if 0
mmap_lib::str Lnast_create::create_select_stmts(mmap_lib::str sel_var, mmap_lib::str sel_field) {
I(sel_var.size() && sel_field.size());
auto res_var = create_lnast_tmp();
auto idx = lnast->add_child(idx_stmts, Lnast_node::create_select());
lnast->add_child(idx, Lnast_node::create_ref(res_var));
lnast->add_child(idx, Lnast_node::create_ref(sel_var));
if (sel_field.is_string())
lnast->add_child(idx, Lnast_node::create_ref(sel_field));
else
lnast->add_child(idx, Lnast_node::create_const(sel_field));
return res_var;
}
#endif
mmap_lib::str Lnast_create::create_get_mask_stmts(mmap_lib::str sel_var, mmap_lib::str bitmask) {
I(sel_var.size() && bitmask.size());
auto res_var = create_lnast_tmp();
auto idx = lnast->add_child(idx_stmts, Lnast_node::create_get_mask());
lnast->add_child(idx, Lnast_node::create_ref(res_var));
lnast->add_child(idx, Lnast_node::create_ref(sel_var));
if (bitmask.is_string())
lnast->add_child(idx, Lnast_node::create_ref(bitmask));
else
lnast->add_child(idx, Lnast_node::create_const(bitmask));
return res_var;
}
void Lnast_create::create_set_mask_stmts(mmap_lib::str sel_var, mmap_lib::str bitmask, mmap_lib::str value) {
I(sel_var.size() && bitmask.size() && value.size());
auto idx = lnast->add_child(idx_stmts, Lnast_node::create_set_mask());
lnast->add_child(idx, Lnast_node::create_ref(sel_var));
lnast->add_child(idx, Lnast_node::create_ref(sel_var));
if (bitmask.is_string())
lnast->add_child(idx, Lnast_node::create_ref(bitmask));
else
lnast->add_child(idx, Lnast_node::create_const(bitmask));
if (value.is_string())
lnast->add_child(idx, Lnast_node::create_ref(value));
else
lnast->add_child(idx, Lnast_node::create_const(value));
}
| 31.801217 | 109 | 0.705894 | [
"vector"
] |
3f188455c1be324dcfa78e3f870e5ff2af7b8fb7 | 848 | cc | C++ | individually_weekly/w11/C.cc | xsthunder/a | 3c30f31c59030d70462b71ef28c5eee19c6eddd6 | [
"MIT"
] | 1 | 2018-07-22T04:52:10.000Z | 2018-07-22T04:52:10.000Z | individually_weekly/w11/C.cc | xsthunder/a | 3c30f31c59030d70462b71ef28c5eee19c6eddd6 | [
"MIT"
] | 1 | 2018-08-11T13:29:59.000Z | 2018-08-11T13:31:28.000Z | individually_weekly/w11/C.cc | xsthunder/a | 3c30f31c59030d70462b71ef28c5eee19c6eddd6 | [
"MIT"
] | null | null | null | #include<iostream>
#include<vector>
#include<cstring>
#include<iomanip>
using namespace std;
#define iF if(Te)
#define MS(m) memset(m,0,sizeof(m))
#ifdef XS
#include<De>
const int Te=1;
#else
const int Te=0;
#endif
typedef unsigned U;
void inp();
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
inp();
return 0;
}
int m[300][300];
char s[300];
char ans[2][10]={
"No.\n",
"Yes.\n"
};
vector<int > v[300];
#define cor(x,y) m[x][y]
int flag=0;
int vis[300];
void find(int b){
if(vis[b])return ;
vis[b]=1;
if(b=='m'){
cout<<ans[1];
exit(0);
}
for(int i ='a';i<'z'+1;i++){
if(m[b][i])
find(i);
}
}
void inp(){
MS(m);
MS(vis);
while(1){
cin>>s;
if(s[0]=='0')break;
int len = strlen(s);
int a=s[0];
int b=s[len-1];
m[a][b]=1;
}
find('b');
cout<<ans[0];
}
//C.cc by xsthunder at Fri May 5 18:47:13 2017
| 13.901639 | 47 | 0.574292 | [
"vector"
] |
3f2bad7b2959ca5b477fbbc2ae74836780f7920a | 444,245 | cpp | C++ | glfuncs.cpp | tdriggs/ETGG2802 | fd30a4663bb22eda6f97427d3259d53d93af5071 | [
"MIT"
] | null | null | null | glfuncs.cpp | tdriggs/ETGG2802 | fd30a4663bb22eda6f97427d3259d53d93af5071 | [
"MIT"
] | null | null | null | glfuncs.cpp | tdriggs/ETGG2802 | fd30a4663bb22eda6f97427d3259d53d93af5071 | [
"MIT"
] | null | null | null | /*Data from gl.xml, which has this copyright:
#Copyright (c) 2013-2016 The Khronos Group Inc.
#
#Permission is hereby granted, free of charge, to any person obtaining a
#copy of this software and/or associated documentation files (the
#"Materials"), to deal in the Materials without restriction, including
#without limitation the rights to use, copy, modify, merge, publish,
#distribute, sublicense, and/or sell copies of the Materials, and to
#permit persons to whom the Materials are 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 Materials.
#
#THE MATERIALS ARE 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
#MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
#
#------------------------------------------------------------------------
#
#This file, gl.xml, is the OpenGL and OpenGL API Registry. The older
#".spec" file format has been retired and will no longer be updated with
#new extensions and API versions. The canonical version of the registry,
#together with documentation, schema, and Python generator scripts used
#to generate C header files for OpenGL and OpenGL ES, can always be found
#in the Khronos Registry at
# http://www.opengl.org/registry/
#
*/
#include "glfuncs.h"
#ifdef WIN32
#include <windows.h>
#else
#include <dlfcn.h>
#endif
#include "glcorearb.h"
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <stdexcept>
#include <cstdio>
using namespace std;
static void* mygetprocaddr(const char* funcname){
void* x = 0;
#ifdef WIN32
static HMODULE gllib = 0;
if (!gllib) {
gllib = LoadLibraryA("opengl32.dll");
if (!gllib)
throw runtime_error("Cannot load GL library");
}
typedef void* (__stdcall *GLT)(LPCSTR);
static GLT wglgpa;
if( !wglgpa ){
wglgpa = (GLT) GetProcAddress(gllib,"wglGetProcAddress");
if(!wglgpa)
throw runtime_error("Cannot find wglGetProcAddress");
}
x = (void*) wglgpa(funcname);
if (!x || x == (void*)1 || x == (void*)2 || x == (void*)3 || x == (void*)-1)
x = 0;
if(!x)
x = (void*)GetProcAddress(gllib, funcname);
#else
static void* gllib = 0;
if(!gllib){
gllib = dlopen("libGL.so", RTLD_NOW);
if (!gllib)
throw runtime_error("Cannot load GL library");
}
x = dlsym(gllib, funcname);
#endif
if (!x)
throw runtime_error(string("Could not load function ")+funcname);
return x;
}
void glActiveShaderProgram (GLuint pipeline_ , GLuint program_ ){
/* <command>
<proto>void <name>glActiveShaderProgram</name></proto>
<param><ptype>GLuint</ptype> <name>pipeline</name></param>
<param><ptype>GLuint</ptype> <name>program</name></param>
</command>
*/
static PFNGLACTIVESHADERPROGRAMPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLACTIVESHADERPROGRAMPROC ) mygetprocaddr("glActiveShaderProgram");
glfunc(pipeline_, program_);
return;
}
void glActiveTexture (GLenum texture_ ){
/* <command>
<proto>void <name>glActiveTexture</name></proto>
<param group="TextureUnit"><ptype>GLenum</ptype> <name>texture</name></param>
<glx opcode="197" type="render" />
</command>
*/
static PFNGLACTIVETEXTUREPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLACTIVETEXTUREPROC ) mygetprocaddr("glActiveTexture");
glfunc(texture_);
return;
}
void glAttachShader (GLuint program_ , GLuint shader_ ){
/* <command>
<proto>void <name>glAttachShader</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>shader</name></param>
</command>
*/
static PFNGLATTACHSHADERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLATTACHSHADERPROC ) mygetprocaddr("glAttachShader");
glfunc(program_, shader_);
return;
}
void glBeginConditionalRender (GLuint id_ , GLenum mode_ ){
/* <command>
<proto>void <name>glBeginConditionalRender</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param group="TypeEnum"><ptype>GLenum</ptype> <name>mode</name></param>
</command>
*/
static PFNGLBEGINCONDITIONALRENDERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBEGINCONDITIONALRENDERPROC ) mygetprocaddr("glBeginConditionalRender");
glfunc(id_, mode_);
return;
}
void glBeginQuery (GLenum target_ , GLuint id_ ){
/* <command>
<proto>void <name>glBeginQuery</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>id</name></param>
<glx opcode="231" type="render" />
</command>
*/
static PFNGLBEGINQUERYPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBEGINQUERYPROC ) mygetprocaddr("glBeginQuery");
glfunc(target_, id_);
return;
}
void glBeginQueryIndexed (GLenum target_ , GLuint index_ , GLuint id_ ){
/* <command>
<proto>void <name>glBeginQueryIndexed</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLuint</ptype> <name>id</name></param>
</command>
*/
static PFNGLBEGINQUERYINDEXEDPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBEGINQUERYINDEXEDPROC ) mygetprocaddr("glBeginQueryIndexed");
glfunc(target_, index_, id_);
return;
}
void glBeginTransformFeedback (GLenum primitiveMode_ ){
/* <command>
<proto>void <name>glBeginTransformFeedback</name></proto>
<param><ptype>GLenum</ptype> <name>primitiveMode</name></param>
</command>
*/
static PFNGLBEGINTRANSFORMFEEDBACKPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBEGINTRANSFORMFEEDBACKPROC ) mygetprocaddr("glBeginTransformFeedback");
glfunc(primitiveMode_);
return;
}
void glBindAttribLocation (GLuint program_ , GLuint index_ , const GLchar * name_ ){
/* <command>
<proto>void <name>glBindAttribLocation</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param>const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLBINDATTRIBLOCATIONPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDATTRIBLOCATIONPROC ) mygetprocaddr("glBindAttribLocation");
glfunc(program_, index_, name_);
return;
}
void glBindBuffer (GLenum target_ , GLuint buffer_ ){
/* <command>
<proto>void <name>glBindBuffer</name></proto>
<param group="BufferTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
</command>
*/
static PFNGLBINDBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDBUFFERPROC ) mygetprocaddr("glBindBuffer");
glfunc(target_, buffer_);
return;
}
void glBindBufferBase (GLenum target_ , GLuint index_ , GLuint buffer_ ){
/* <command>
<proto>void <name>glBindBufferBase</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
</command>
*/
static PFNGLBINDBUFFERBASEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDBUFFERBASEPROC ) mygetprocaddr("glBindBufferBase");
glfunc(target_, index_, buffer_);
return;
}
void glBindBufferRange (GLenum target_ , GLuint index_ , GLuint buffer_ , GLintptr offset_ , GLsizeiptr size_ ){
/* <command>
<proto>void <name>glBindBufferRange</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
</command>
*/
static PFNGLBINDBUFFERRANGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDBUFFERRANGEPROC ) mygetprocaddr("glBindBufferRange");
glfunc(target_, index_, buffer_, offset_, size_);
return;
}
void glBindBuffersBase (GLenum target_ , GLuint first_ , GLsizei count_ , const GLuint * buffers_ ){
/* <command>
<proto>void <name>glBindBuffersBase</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLuint</ptype> *<name>buffers</name></param>
</command>
*/
static PFNGLBINDBUFFERSBASEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDBUFFERSBASEPROC ) mygetprocaddr("glBindBuffersBase");
glfunc(target_, first_, count_, buffers_);
return;
}
void glBindBuffersRange (GLenum target_ , GLuint first_ , GLsizei count_ , const GLuint * buffers_ , const GLintptr * offsets_ , const GLsizeiptr * sizes_ ){
/* <command>
<proto>void <name>glBindBuffersRange</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLuint</ptype> *<name>buffers</name></param>
<param len="count">const <ptype>GLintptr</ptype> *<name>offsets</name></param>
<param len="count">const <ptype>GLsizeiptr</ptype> *<name>sizes</name></param>
</command>
*/
static PFNGLBINDBUFFERSRANGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDBUFFERSRANGEPROC ) mygetprocaddr("glBindBuffersRange");
glfunc(target_, first_, count_, buffers_, offsets_, sizes_);
return;
}
void glBindFragDataLocation (GLuint program_ , GLuint color_ , const GLchar * name_ ){
/* <command>
<proto>void <name>glBindFragDataLocation</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>color</name></param>
<param len="COMPSIZE(name)">const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLBINDFRAGDATALOCATIONPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDFRAGDATALOCATIONPROC ) mygetprocaddr("glBindFragDataLocation");
glfunc(program_, color_, name_);
return;
}
void glBindFragDataLocationIndexed (GLuint program_ , GLuint colorNumber_ , GLuint index_ , const GLchar * name_ ){
/* <command>
<proto>void <name>glBindFragDataLocationIndexed</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>colorNumber</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param>const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLBINDFRAGDATALOCATIONINDEXEDPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDFRAGDATALOCATIONINDEXEDPROC ) mygetprocaddr("glBindFragDataLocationIndexed");
glfunc(program_, colorNumber_, index_, name_);
return;
}
void glBindFramebuffer (GLenum target_ , GLuint framebuffer_ ){
/* <command>
<proto>void <name>glBindFramebuffer</name></proto>
<param group="FramebufferTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<glx opcode="236" type="render" />
</command>
*/
static PFNGLBINDFRAMEBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDFRAMEBUFFERPROC ) mygetprocaddr("glBindFramebuffer");
glfunc(target_, framebuffer_);
return;
}
void glBindImageTexture (GLuint unit_ , GLuint texture_ , GLint level_ , GLboolean layered_ , GLint layer_ , GLenum access_ , GLenum format_ ){
/* <command>
<proto>void <name>glBindImageTexture</name></proto>
<param><ptype>GLuint</ptype> <name>unit</name></param>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>layered</name></param>
<param><ptype>GLint</ptype> <name>layer</name></param>
<param><ptype>GLenum</ptype> <name>access</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
</command>
*/
static PFNGLBINDIMAGETEXTUREPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDIMAGETEXTUREPROC ) mygetprocaddr("glBindImageTexture");
glfunc(unit_, texture_, level_, layered_, layer_, access_, format_);
return;
}
void glBindImageTextures (GLuint first_ , GLsizei count_ , const GLuint * textures_ ){
/* <command>
<proto>void <name>glBindImageTextures</name></proto>
<param><ptype>GLuint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLuint</ptype> *<name>textures</name></param>
</command>
*/
static PFNGLBINDIMAGETEXTURESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDIMAGETEXTURESPROC ) mygetprocaddr("glBindImageTextures");
glfunc(first_, count_, textures_);
return;
}
void glBindProgramPipeline (GLuint pipeline_ ){
/* <command>
<proto>void <name>glBindProgramPipeline</name></proto>
<param><ptype>GLuint</ptype> <name>pipeline</name></param>
</command>
*/
static PFNGLBINDPROGRAMPIPELINEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDPROGRAMPIPELINEPROC ) mygetprocaddr("glBindProgramPipeline");
glfunc(pipeline_);
return;
}
void glBindRenderbuffer (GLenum target_ , GLuint renderbuffer_ ){
/* <command>
<proto>void <name>glBindRenderbuffer</name></proto>
<param group="RenderbufferTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>renderbuffer</name></param>
<glx opcode="235" type="render" />
</command>
*/
static PFNGLBINDRENDERBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDRENDERBUFFERPROC ) mygetprocaddr("glBindRenderbuffer");
glfunc(target_, renderbuffer_);
return;
}
void glBindSampler (GLuint unit_ , GLuint sampler_ ){
/* <command>
<proto>void <name>glBindSampler</name></proto>
<param><ptype>GLuint</ptype> <name>unit</name></param>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
</command>
*/
static PFNGLBINDSAMPLERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDSAMPLERPROC ) mygetprocaddr("glBindSampler");
glfunc(unit_, sampler_);
return;
}
void glBindSamplers (GLuint first_ , GLsizei count_ , const GLuint * samplers_ ){
/* <command>
<proto>void <name>glBindSamplers</name></proto>
<param><ptype>GLuint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLuint</ptype> *<name>samplers</name></param>
</command>
*/
static PFNGLBINDSAMPLERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDSAMPLERSPROC ) mygetprocaddr("glBindSamplers");
glfunc(first_, count_, samplers_);
return;
}
void glBindTexture (GLenum target_ , GLuint texture_ ){
/* <command>
<proto>void <name>glBindTexture</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="Texture"><ptype>GLuint</ptype> <name>texture</name></param>
<glx opcode="4117" type="render" />
</command>
*/
static PFNGLBINDTEXTUREPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDTEXTUREPROC ) mygetprocaddr("glBindTexture");
glfunc(target_, texture_);
return;
}
void glBindTextureUnit (GLuint unit_ , GLuint texture_ ){
/* <command>
<proto>void <name>glBindTextureUnit</name></proto>
<param><ptype>GLuint</ptype> <name>unit</name></param>
<param><ptype>GLuint</ptype> <name>texture</name></param>
</command>
*/
static PFNGLBINDTEXTUREUNITPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDTEXTUREUNITPROC ) mygetprocaddr("glBindTextureUnit");
glfunc(unit_, texture_);
return;
}
void glBindTextures (GLuint first_ , GLsizei count_ , const GLuint * textures_ ){
/* <command>
<proto>void <name>glBindTextures</name></proto>
<param><ptype>GLuint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLuint</ptype> *<name>textures</name></param>
</command>
*/
static PFNGLBINDTEXTURESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDTEXTURESPROC ) mygetprocaddr("glBindTextures");
glfunc(first_, count_, textures_);
return;
}
void glBindTransformFeedback (GLenum target_ , GLuint id_ ){
/* <command>
<proto>void <name>glBindTransformFeedback</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>id</name></param>
</command>
*/
static PFNGLBINDTRANSFORMFEEDBACKPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDTRANSFORMFEEDBACKPROC ) mygetprocaddr("glBindTransformFeedback");
glfunc(target_, id_);
return;
}
void glBindVertexArray (GLuint array_ ){
/* <command>
<proto>void <name>glBindVertexArray</name></proto>
<param><ptype>GLuint</ptype> <name>array</name></param>
<glx opcode="350" type="render" />
</command>
*/
static PFNGLBINDVERTEXARRAYPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDVERTEXARRAYPROC ) mygetprocaddr("glBindVertexArray");
glfunc(array_);
return;
}
void glBindVertexBuffer (GLuint bindingindex_ , GLuint buffer_ , GLintptr offset_ , GLsizei stride_ ){
/* <command>
<proto>void <name>glBindVertexBuffer</name></proto>
<param><ptype>GLuint</ptype> <name>bindingindex</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>offset</name></param>
<param><ptype>GLsizei</ptype> <name>stride</name></param>
</command>
*/
static PFNGLBINDVERTEXBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDVERTEXBUFFERPROC ) mygetprocaddr("glBindVertexBuffer");
glfunc(bindingindex_, buffer_, offset_, stride_);
return;
}
void glBindVertexBuffers (GLuint first_ , GLsizei count_ , const GLuint * buffers_ , const GLintptr * offsets_ , const GLsizei * strides_ ){
/* <command>
<proto>void <name>glBindVertexBuffers</name></proto>
<param><ptype>GLuint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLuint</ptype> *<name>buffers</name></param>
<param len="count">const <ptype>GLintptr</ptype> *<name>offsets</name></param>
<param len="count">const <ptype>GLsizei</ptype> *<name>strides</name></param>
</command>
*/
static PFNGLBINDVERTEXBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBINDVERTEXBUFFERSPROC ) mygetprocaddr("glBindVertexBuffers");
glfunc(first_, count_, buffers_, offsets_, strides_);
return;
}
void glBlendColor (GLfloat red_ , GLfloat green_ , GLfloat blue_ , GLfloat alpha_ ){
/* <command>
<proto>void <name>glBlendColor</name></proto>
<param group="ColorF"><ptype>GLfloat</ptype> <name>red</name></param>
<param group="ColorF"><ptype>GLfloat</ptype> <name>green</name></param>
<param group="ColorF"><ptype>GLfloat</ptype> <name>blue</name></param>
<param group="ColorF"><ptype>GLfloat</ptype> <name>alpha</name></param>
<glx opcode="4096" type="render" />
</command>
*/
static PFNGLBLENDCOLORPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBLENDCOLORPROC ) mygetprocaddr("glBlendColor");
glfunc(red_, green_, blue_, alpha_);
return;
}
void glBlendEquation (GLenum mode_ ){
/* <command>
<proto>void <name>glBlendEquation</name></proto>
<param group="BlendEquationMode"><ptype>GLenum</ptype> <name>mode</name></param>
<glx opcode="4097" type="render" />
</command>
*/
static PFNGLBLENDEQUATIONPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBLENDEQUATIONPROC ) mygetprocaddr("glBlendEquation");
glfunc(mode_);
return;
}
void glBlendEquationSeparate (GLenum modeRGB_ , GLenum modeAlpha_ ){
/* <command>
<proto>void <name>glBlendEquationSeparate</name></proto>
<param group="BlendEquationModeEXT"><ptype>GLenum</ptype> <name>modeRGB</name></param>
<param group="BlendEquationModeEXT"><ptype>GLenum</ptype> <name>modeAlpha</name></param>
<glx opcode="4228" type="render" />
</command>
*/
static PFNGLBLENDEQUATIONSEPARATEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBLENDEQUATIONSEPARATEPROC ) mygetprocaddr("glBlendEquationSeparate");
glfunc(modeRGB_, modeAlpha_);
return;
}
void glBlendEquationSeparatei (GLuint buf_ , GLenum modeRGB_ , GLenum modeAlpha_ ){
/* <command>
<proto>void <name>glBlendEquationSeparatei</name></proto>
<param><ptype>GLuint</ptype> <name>buf</name></param>
<param><ptype>GLenum</ptype> <name>modeRGB</name></param>
<param><ptype>GLenum</ptype> <name>modeAlpha</name></param>
</command>
*/
static PFNGLBLENDEQUATIONSEPARATEIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBLENDEQUATIONSEPARATEIPROC ) mygetprocaddr("glBlendEquationSeparatei");
glfunc(buf_, modeRGB_, modeAlpha_);
return;
}
void glBlendEquationi (GLuint buf_ , GLenum mode_ ){
/* <command>
<proto>void <name>glBlendEquationi</name></proto>
<param><ptype>GLuint</ptype> <name>buf</name></param>
<param><ptype>GLenum</ptype> <name>mode</name></param>
</command>
*/
static PFNGLBLENDEQUATIONIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBLENDEQUATIONIPROC ) mygetprocaddr("glBlendEquationi");
glfunc(buf_, mode_);
return;
}
void glBlendFunc (GLenum sfactor_ , GLenum dfactor_ ){
/* <command>
<proto>void <name>glBlendFunc</name></proto>
<param group="BlendingFactorSrc"><ptype>GLenum</ptype> <name>sfactor</name></param>
<param group="BlendingFactorDest"><ptype>GLenum</ptype> <name>dfactor</name></param>
<glx opcode="160" type="render" />
</command>
*/
static PFNGLBLENDFUNCPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBLENDFUNCPROC ) mygetprocaddr("glBlendFunc");
glfunc(sfactor_, dfactor_);
return;
}
void glBlendFuncSeparate (GLenum sfactorRGB_ , GLenum dfactorRGB_ , GLenum sfactorAlpha_ , GLenum dfactorAlpha_ ){
/* <command>
<proto>void <name>glBlendFuncSeparate</name></proto>
<param group="BlendFuncSeparateParameterEXT"><ptype>GLenum</ptype> <name>sfactorRGB</name></param>
<param group="BlendFuncSeparateParameterEXT"><ptype>GLenum</ptype> <name>dfactorRGB</name></param>
<param group="BlendFuncSeparateParameterEXT"><ptype>GLenum</ptype> <name>sfactorAlpha</name></param>
<param group="BlendFuncSeparateParameterEXT"><ptype>GLenum</ptype> <name>dfactorAlpha</name></param>
<glx opcode="4134" type="render" />
</command>
*/
static PFNGLBLENDFUNCSEPARATEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBLENDFUNCSEPARATEPROC ) mygetprocaddr("glBlendFuncSeparate");
glfunc(sfactorRGB_, dfactorRGB_, sfactorAlpha_, dfactorAlpha_);
return;
}
void glBlendFuncSeparatei (GLuint buf_ , GLenum srcRGB_ , GLenum dstRGB_ , GLenum srcAlpha_ , GLenum dstAlpha_ ){
/* <command>
<proto>void <name>glBlendFuncSeparatei</name></proto>
<param><ptype>GLuint</ptype> <name>buf</name></param>
<param><ptype>GLenum</ptype> <name>srcRGB</name></param>
<param><ptype>GLenum</ptype> <name>dstRGB</name></param>
<param><ptype>GLenum</ptype> <name>srcAlpha</name></param>
<param><ptype>GLenum</ptype> <name>dstAlpha</name></param>
</command>
*/
static PFNGLBLENDFUNCSEPARATEIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBLENDFUNCSEPARATEIPROC ) mygetprocaddr("glBlendFuncSeparatei");
glfunc(buf_, srcRGB_, dstRGB_, srcAlpha_, dstAlpha_);
return;
}
void glBlendFunci (GLuint buf_ , GLenum src_ , GLenum dst_ ){
/* <command>
<proto>void <name>glBlendFunci</name></proto>
<param><ptype>GLuint</ptype> <name>buf</name></param>
<param><ptype>GLenum</ptype> <name>src</name></param>
<param><ptype>GLenum</ptype> <name>dst</name></param>
</command>
*/
static PFNGLBLENDFUNCIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBLENDFUNCIPROC ) mygetprocaddr("glBlendFunci");
glfunc(buf_, src_, dst_);
return;
}
void glBlitFramebuffer (GLint srcX0_ , GLint srcY0_ , GLint srcX1_ , GLint srcY1_ , GLint dstX0_ , GLint dstY0_ , GLint dstX1_ , GLint dstY1_ , GLbitfield mask_ , GLenum filter_ ){
/* <command>
<proto>void <name>glBlitFramebuffer</name></proto>
<param><ptype>GLint</ptype> <name>srcX0</name></param>
<param><ptype>GLint</ptype> <name>srcY0</name></param>
<param><ptype>GLint</ptype> <name>srcX1</name></param>
<param><ptype>GLint</ptype> <name>srcY1</name></param>
<param><ptype>GLint</ptype> <name>dstX0</name></param>
<param><ptype>GLint</ptype> <name>dstY0</name></param>
<param><ptype>GLint</ptype> <name>dstX1</name></param>
<param><ptype>GLint</ptype> <name>dstY1</name></param>
<param group="ClearBufferMask"><ptype>GLbitfield</ptype> <name>mask</name></param>
<param><ptype>GLenum</ptype> <name>filter</name></param>
<glx opcode="4330" type="render" />
</command>
*/
static PFNGLBLITFRAMEBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBLITFRAMEBUFFERPROC ) mygetprocaddr("glBlitFramebuffer");
glfunc(srcX0_, srcY0_, srcX1_, srcY1_, dstX0_, dstY0_, dstX1_, dstY1_, mask_, filter_);
return;
}
void glBlitNamedFramebuffer (GLuint readFramebuffer_ , GLuint drawFramebuffer_ , GLint srcX0_ , GLint srcY0_ , GLint srcX1_ , GLint srcY1_ , GLint dstX0_ , GLint dstY0_ , GLint dstX1_ , GLint dstY1_ , GLbitfield mask_ , GLenum filter_ ){
/* <command>
<proto>void <name>glBlitNamedFramebuffer</name></proto>
<param><ptype>GLuint</ptype> <name>readFramebuffer</name></param>
<param><ptype>GLuint</ptype> <name>drawFramebuffer</name></param>
<param><ptype>GLint</ptype> <name>srcX0</name></param>
<param><ptype>GLint</ptype> <name>srcY0</name></param>
<param><ptype>GLint</ptype> <name>srcX1</name></param>
<param><ptype>GLint</ptype> <name>srcY1</name></param>
<param><ptype>GLint</ptype> <name>dstX0</name></param>
<param><ptype>GLint</ptype> <name>dstY0</name></param>
<param><ptype>GLint</ptype> <name>dstX1</name></param>
<param><ptype>GLint</ptype> <name>dstY1</name></param>
<param><ptype>GLbitfield</ptype> <name>mask</name></param>
<param><ptype>GLenum</ptype> <name>filter</name></param>
</command>
*/
static PFNGLBLITNAMEDFRAMEBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBLITNAMEDFRAMEBUFFERPROC ) mygetprocaddr("glBlitNamedFramebuffer");
glfunc(readFramebuffer_, drawFramebuffer_, srcX0_, srcY0_, srcX1_, srcY1_, dstX0_, dstY0_, dstX1_, dstY1_, mask_, filter_);
return;
}
void glBufferData (GLenum target_ , GLsizeiptr size_ , const void * data_ , GLenum usage_ ){
/* <command>
<proto>void <name>glBufferData</name></proto>
<param group="BufferTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
<param len="size">const void *<name>data</name></param>
<param group="BufferUsageARB"><ptype>GLenum</ptype> <name>usage</name></param>
</command>
*/
static PFNGLBUFFERDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBUFFERDATAPROC ) mygetprocaddr("glBufferData");
glfunc(target_, size_, data_, usage_);
return;
}
void glBufferStorage (GLenum target_ , GLsizeiptr size_ , const void * data_ , GLbitfield flags_ ){
/* <command>
<proto>void <name>glBufferStorage</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLsizeiptr</ptype> <name>size</name></param>
<param len="size">const void *<name>data</name></param>
<param><ptype>GLbitfield</ptype> <name>flags</name></param>
</command>
*/
static PFNGLBUFFERSTORAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBUFFERSTORAGEPROC ) mygetprocaddr("glBufferStorage");
glfunc(target_, size_, data_, flags_);
return;
}
void glBufferSubData (GLenum target_ , GLintptr offset_ , GLsizeiptr size_ , const void * data_ ){
/* <command>
<proto>void <name>glBufferSubData</name></proto>
<param group="BufferTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
<param len="size">const void *<name>data</name></param>
</command>
*/
static PFNGLBUFFERSUBDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLBUFFERSUBDATAPROC ) mygetprocaddr("glBufferSubData");
glfunc(target_, offset_, size_, data_);
return;
}
GLenum glCheckFramebufferStatus (GLenum target_ ){
/* <command>
<proto><ptype>GLenum</ptype> <name>glCheckFramebufferStatus</name></proto>
<param group="FramebufferTarget"><ptype>GLenum</ptype> <name>target</name></param>
<glx opcode="1427" type="vendor" />
</command>
*/
static PFNGLCHECKFRAMEBUFFERSTATUSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCHECKFRAMEBUFFERSTATUSPROC ) mygetprocaddr("glCheckFramebufferStatus");
GLenum retval = glfunc(target_);
return retval;
}
GLenum glCheckNamedFramebufferStatus (GLuint framebuffer_ , GLenum target_ ){
/* <command>
<proto><ptype>GLenum</ptype> <name>glCheckNamedFramebufferStatus</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>target</name></param>
</command>
*/
static PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCHECKNAMEDFRAMEBUFFERSTATUSPROC ) mygetprocaddr("glCheckNamedFramebufferStatus");
GLenum retval = glfunc(framebuffer_, target_);
return retval;
}
void glClampColor (GLenum target_ , GLenum clamp_ ){
/* <command>
<proto>void <name>glClampColor</name></proto>
<param group="ClampColorTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
<param group="ClampColorModeARB"><ptype>GLenum</ptype> <name>clamp</name></param>
<glx opcode="234" type="render" />
</command>
*/
static PFNGLCLAMPCOLORPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLAMPCOLORPROC ) mygetprocaddr("glClampColor");
glfunc(target_, clamp_);
return;
}
void glClear (GLbitfield mask_ ){
/* <command>
<proto>void <name>glClear</name></proto>
<param group="ClearBufferMask"><ptype>GLbitfield</ptype> <name>mask</name></param>
<glx opcode="127" type="render" />
</command>
*/
static PFNGLCLEARPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARPROC ) mygetprocaddr("glClear");
glfunc(mask_);
return;
}
void glClearBufferData (GLenum target_ , GLenum internalformat_ , GLenum format_ , GLenum type_ , const void * data_ ){
/* <command>
<proto>void <name>glClearBufferData</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(format,type)">const void *<name>data</name></param>
</command>
*/
static PFNGLCLEARBUFFERDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARBUFFERDATAPROC ) mygetprocaddr("glClearBufferData");
glfunc(target_, internalformat_, format_, type_, data_);
return;
}
void glClearBufferSubData (GLenum target_ , GLenum internalformat_ , GLintptr offset_ , GLsizeiptr size_ , GLenum format_ , GLenum type_ , const void * data_ ){
/* <command>
<proto>void <name>glClearBufferSubData</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(format,type)">const void *<name>data</name></param>
</command>
*/
static PFNGLCLEARBUFFERSUBDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARBUFFERSUBDATAPROC ) mygetprocaddr("glClearBufferSubData");
glfunc(target_, internalformat_, offset_, size_, format_, type_, data_);
return;
}
void glClearBufferfi (GLenum buffer_ , GLint drawbuffer_ , GLfloat depth_ , GLint stencil_ ){
/* <command>
<proto>void <name>glClearBufferfi</name></proto>
<param><ptype>GLenum</ptype> <name>buffer</name></param>
<param group="DrawBufferName"><ptype>GLint</ptype> <name>drawbuffer</name></param>
<param><ptype>GLfloat</ptype> <name>depth</name></param>
<param><ptype>GLint</ptype> <name>stencil</name></param>
</command>
*/
static PFNGLCLEARBUFFERFIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARBUFFERFIPROC ) mygetprocaddr("glClearBufferfi");
glfunc(buffer_, drawbuffer_, depth_, stencil_);
return;
}
void glClearBufferfv (GLenum buffer_ , GLint drawbuffer_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glClearBufferfv</name></proto>
<param><ptype>GLenum</ptype> <name>buffer</name></param>
<param group="DrawBufferName"><ptype>GLint</ptype> <name>drawbuffer</name></param>
<param len="COMPSIZE(buffer)">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLCLEARBUFFERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARBUFFERFVPROC ) mygetprocaddr("glClearBufferfv");
glfunc(buffer_, drawbuffer_, value_);
return;
}
void glClearBufferiv (GLenum buffer_ , GLint drawbuffer_ , const GLint * value_ ){
/* <command>
<proto>void <name>glClearBufferiv</name></proto>
<param><ptype>GLenum</ptype> <name>buffer</name></param>
<param group="DrawBufferName"><ptype>GLint</ptype> <name>drawbuffer</name></param>
<param len="COMPSIZE(buffer)">const <ptype>GLint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLCLEARBUFFERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARBUFFERIVPROC ) mygetprocaddr("glClearBufferiv");
glfunc(buffer_, drawbuffer_, value_);
return;
}
void glClearBufferuiv (GLenum buffer_ , GLint drawbuffer_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glClearBufferuiv</name></proto>
<param><ptype>GLenum</ptype> <name>buffer</name></param>
<param group="DrawBufferName"><ptype>GLint</ptype> <name>drawbuffer</name></param>
<param len="COMPSIZE(buffer)">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLCLEARBUFFERUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARBUFFERUIVPROC ) mygetprocaddr("glClearBufferuiv");
glfunc(buffer_, drawbuffer_, value_);
return;
}
void glClearColor (GLfloat red_ , GLfloat green_ , GLfloat blue_ , GLfloat alpha_ ){
/* <command>
<proto>void <name>glClearColor</name></proto>
<param group="ColorF"><ptype>GLfloat</ptype> <name>red</name></param>
<param group="ColorF"><ptype>GLfloat</ptype> <name>green</name></param>
<param group="ColorF"><ptype>GLfloat</ptype> <name>blue</name></param>
<param group="ColorF"><ptype>GLfloat</ptype> <name>alpha</name></param>
<glx opcode="130" type="render" />
</command>
*/
static PFNGLCLEARCOLORPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARCOLORPROC ) mygetprocaddr("glClearColor");
glfunc(red_, green_, blue_, alpha_);
return;
}
void glClearDepth (GLdouble depth_ ){
/* <command>
<proto>void <name>glClearDepth</name></proto>
<param><ptype>GLdouble</ptype> <name>depth</name></param>
<glx opcode="132" type="render" />
</command>
*/
static PFNGLCLEARDEPTHPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARDEPTHPROC ) mygetprocaddr("glClearDepth");
glfunc(depth_);
return;
}
void glClearDepthf (GLfloat d_ ){
/* <command>
<proto>void <name>glClearDepthf</name></proto>
<param><ptype>GLfloat</ptype> <name>d</name></param>
</command>
*/
static PFNGLCLEARDEPTHFPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARDEPTHFPROC ) mygetprocaddr("glClearDepthf");
glfunc(d_);
return;
}
void glClearNamedBufferData (GLuint buffer_ , GLenum internalformat_ , GLenum format_ , GLenum type_ , const void * data_ ){
/* <command>
<proto>void <name>glClearNamedBufferData</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param>const void *<name>data</name></param>
</command>
*/
static PFNGLCLEARNAMEDBUFFERDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARNAMEDBUFFERDATAPROC ) mygetprocaddr("glClearNamedBufferData");
glfunc(buffer_, internalformat_, format_, type_, data_);
return;
}
void glClearNamedBufferSubData (GLuint buffer_ , GLenum internalformat_ , GLintptr offset_ , GLsizeiptr size_ , GLenum format_ , GLenum type_ , const void * data_ ){
/* <command>
<proto>void <name>glClearNamedBufferSubData</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param>const void *<name>data</name></param>
</command>
*/
static PFNGLCLEARNAMEDBUFFERSUBDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARNAMEDBUFFERSUBDATAPROC ) mygetprocaddr("glClearNamedBufferSubData");
glfunc(buffer_, internalformat_, offset_, size_, format_, type_, data_);
return;
}
void glClearNamedFramebufferfi (GLuint framebuffer_ , GLenum buffer_ , GLint drawbuffer_ , GLfloat depth_ , GLint stencil_ ){
/* <command>
<proto>void <name>glClearNamedFramebufferfi</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>buffer</name></param>
<param><ptype>GLint</ptype> <name>drawbuffer</name></param>
<param><ptype>GLfloat</ptype> <name>depth</name></param>
<param><ptype>GLint</ptype> <name>stencil</name></param>
</command>
*/
static PFNGLCLEARNAMEDFRAMEBUFFERFIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARNAMEDFRAMEBUFFERFIPROC ) mygetprocaddr("glClearNamedFramebufferfi");
glfunc(framebuffer_, buffer_, drawbuffer_, depth_, stencil_);
return;
}
void glClearNamedFramebufferfv (GLuint framebuffer_ , GLenum buffer_ , GLint drawbuffer_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glClearNamedFramebufferfv</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>buffer</name></param>
<param><ptype>GLint</ptype> <name>drawbuffer</name></param>
<param>const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLCLEARNAMEDFRAMEBUFFERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARNAMEDFRAMEBUFFERFVPROC ) mygetprocaddr("glClearNamedFramebufferfv");
glfunc(framebuffer_, buffer_, drawbuffer_, value_);
return;
}
void glClearNamedFramebufferiv (GLuint framebuffer_ , GLenum buffer_ , GLint drawbuffer_ , const GLint * value_ ){
/* <command>
<proto>void <name>glClearNamedFramebufferiv</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>buffer</name></param>
<param><ptype>GLint</ptype> <name>drawbuffer</name></param>
<param>const <ptype>GLint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLCLEARNAMEDFRAMEBUFFERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARNAMEDFRAMEBUFFERIVPROC ) mygetprocaddr("glClearNamedFramebufferiv");
glfunc(framebuffer_, buffer_, drawbuffer_, value_);
return;
}
void glClearNamedFramebufferuiv (GLuint framebuffer_ , GLenum buffer_ , GLint drawbuffer_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glClearNamedFramebufferuiv</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>buffer</name></param>
<param><ptype>GLint</ptype> <name>drawbuffer</name></param>
<param>const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARNAMEDFRAMEBUFFERUIVPROC ) mygetprocaddr("glClearNamedFramebufferuiv");
glfunc(framebuffer_, buffer_, drawbuffer_, value_);
return;
}
void glClearStencil (GLint s_ ){
/* <command>
<proto>void <name>glClearStencil</name></proto>
<param group="StencilValue"><ptype>GLint</ptype> <name>s</name></param>
<glx opcode="131" type="render" />
</command>
*/
static PFNGLCLEARSTENCILPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARSTENCILPROC ) mygetprocaddr("glClearStencil");
glfunc(s_);
return;
}
void glClearTexImage (GLuint texture_ , GLint level_ , GLenum format_ , GLenum type_ , const void * data_ ){
/* <command>
<proto>void <name>glClearTexImage</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(format,type)">const void *<name>data</name></param>
</command>
*/
static PFNGLCLEARTEXIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARTEXIMAGEPROC ) mygetprocaddr("glClearTexImage");
glfunc(texture_, level_, format_, type_, data_);
return;
}
void glClearTexSubImage (GLuint texture_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint zoffset_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ , GLenum format_ , GLenum type_ , const void * data_ ){
/* <command>
<proto>void <name>glClearTexSubImage</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLint</ptype> <name>zoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(format,type)">const void *<name>data</name></param>
</command>
*/
static PFNGLCLEARTEXSUBIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLEARTEXSUBIMAGEPROC ) mygetprocaddr("glClearTexSubImage");
glfunc(texture_, level_, xoffset_, yoffset_, zoffset_, width_, height_, depth_, format_, type_, data_);
return;
}
GLenum glClientWaitSync (GLsync sync_ , GLbitfield flags_ , GLuint64 timeout_ ){
/* <command>
<proto><ptype>GLenum</ptype> <name>glClientWaitSync</name></proto>
<param group="sync"><ptype>GLsync</ptype> <name>sync</name></param>
<param><ptype>GLbitfield</ptype> <name>flags</name></param>
<param><ptype>GLuint64</ptype> <name>timeout</name></param>
</command>
*/
static PFNGLCLIENTWAITSYNCPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLIENTWAITSYNCPROC ) mygetprocaddr("glClientWaitSync");
GLenum retval = glfunc(sync_, flags_, timeout_);
return retval;
}
void glClipControl (GLenum origin_ , GLenum depth_ ){
/* <command>
<proto>void <name>glClipControl</name></proto>
<param><ptype>GLenum</ptype> <name>origin</name></param>
<param><ptype>GLenum</ptype> <name>depth</name></param>
</command>
*/
static PFNGLCLIPCONTROLPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCLIPCONTROLPROC ) mygetprocaddr("glClipControl");
glfunc(origin_, depth_);
return;
}
void glColorMask (GLboolean red_ , GLboolean green_ , GLboolean blue_ , GLboolean alpha_ ){
/* <command>
<proto>void <name>glColorMask</name></proto>
<param group="Boolean"><ptype>GLboolean</ptype> <name>red</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>green</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>blue</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>alpha</name></param>
<glx opcode="134" type="render" />
</command>
*/
static PFNGLCOLORMASKPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOLORMASKPROC ) mygetprocaddr("glColorMask");
glfunc(red_, green_, blue_, alpha_);
return;
}
void glColorMaski (GLuint index_ , GLboolean r_ , GLboolean g_ , GLboolean b_ , GLboolean a_ ){
/* <command>
<proto>void <name>glColorMaski</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>r</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>g</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>b</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>a</name></param>
</command>
*/
static PFNGLCOLORMASKIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOLORMASKIPROC ) mygetprocaddr("glColorMaski");
glfunc(index_, r_, g_, b_, a_);
return;
}
void glCompileShader (GLuint shader_ ){
/* <command>
<proto>void <name>glCompileShader</name></proto>
<param><ptype>GLuint</ptype> <name>shader</name></param>
</command>
*/
static PFNGLCOMPILESHADERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOMPILESHADERPROC ) mygetprocaddr("glCompileShader");
glfunc(shader_);
return;
}
void glCompressedTexImage1D (GLenum target_ , GLint level_ , GLenum internalformat_ , GLsizei width_ , GLint border_ , GLsizei imageSize_ , const void * data_ ){
/* <command>
<proto>void <name>glCompressedTexImage1D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="PixelInternalFormat"><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>border</name></param>
<param><ptype>GLsizei</ptype> <name>imageSize</name></param>
<param group="CompressedTextureARB" len="imageSize">const void *<name>data</name></param>
<glx opcode="214" type="render" />
<glx comment="PBO protocol" name="glCompressedTexImage1DPBO" opcode="314" type="render" />
</command>
*/
static PFNGLCOMPRESSEDTEXIMAGE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOMPRESSEDTEXIMAGE1DPROC ) mygetprocaddr("glCompressedTexImage1D");
glfunc(target_, level_, internalformat_, width_, border_, imageSize_, data_);
return;
}
void glCompressedTexImage2D (GLenum target_ , GLint level_ , GLenum internalformat_ , GLsizei width_ , GLsizei height_ , GLint border_ , GLsizei imageSize_ , const void * data_ ){
/* <command>
<proto>void <name>glCompressedTexImage2D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="PixelInternalFormat"><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>border</name></param>
<param><ptype>GLsizei</ptype> <name>imageSize</name></param>
<param group="CompressedTextureARB" len="imageSize">const void *<name>data</name></param>
<glx opcode="215" type="render" />
<glx comment="PBO protocol" name="glCompressedTexImage2DPBO" opcode="315" type="render" />
</command>
*/
static PFNGLCOMPRESSEDTEXIMAGE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOMPRESSEDTEXIMAGE2DPROC ) mygetprocaddr("glCompressedTexImage2D");
glfunc(target_, level_, internalformat_, width_, height_, border_, imageSize_, data_);
return;
}
void glCompressedTexImage3D (GLenum target_ , GLint level_ , GLenum internalformat_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ , GLint border_ , GLsizei imageSize_ , const void * data_ ){
/* <command>
<proto>void <name>glCompressedTexImage3D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="PixelInternalFormat"><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>border</name></param>
<param><ptype>GLsizei</ptype> <name>imageSize</name></param>
<param group="CompressedTextureARB" len="imageSize">const void *<name>data</name></param>
<glx opcode="216" type="render" />
<glx comment="PBO protocol" name="glCompressedTexImage3DPBO" opcode="316" type="render" />
</command>
*/
static PFNGLCOMPRESSEDTEXIMAGE3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOMPRESSEDTEXIMAGE3DPROC ) mygetprocaddr("glCompressedTexImage3D");
glfunc(target_, level_, internalformat_, width_, height_, depth_, border_, imageSize_, data_);
return;
}
void glCompressedTexSubImage1D (GLenum target_ , GLint level_ , GLint xoffset_ , GLsizei width_ , GLenum format_ , GLsizei imageSize_ , const void * data_ ){
/* <command>
<proto>void <name>glCompressedTexSubImage1D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLsizei</ptype> <name>imageSize</name></param>
<param group="CompressedTextureARB" len="imageSize">const void *<name>data</name></param>
<glx opcode="217" type="render" />
<glx comment="PBO protocol" name="glCompressedTexSubImage1DPBO" opcode="317" type="render" />
</command>
*/
static PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOMPRESSEDTEXSUBIMAGE1DPROC ) mygetprocaddr("glCompressedTexSubImage1D");
glfunc(target_, level_, xoffset_, width_, format_, imageSize_, data_);
return;
}
void glCompressedTexSubImage2D (GLenum target_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLsizei width_ , GLsizei height_ , GLenum format_ , GLsizei imageSize_ , const void * data_ ){
/* <command>
<proto>void <name>glCompressedTexSubImage2D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>xoffset</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLsizei</ptype> <name>imageSize</name></param>
<param group="CompressedTextureARB" len="imageSize">const void *<name>data</name></param>
<glx opcode="218" type="render" />
<glx comment="PBO protocol" name="glCompressedTexSubImage2DPBO" opcode="318" type="render" />
</command>
*/
static PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC ) mygetprocaddr("glCompressedTexSubImage2D");
glfunc(target_, level_, xoffset_, yoffset_, width_, height_, format_, imageSize_, data_);
return;
}
void glCompressedTexSubImage3D (GLenum target_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint zoffset_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ , GLenum format_ , GLsizei imageSize_ , const void * data_ ){
/* <command>
<proto>void <name>glCompressedTexSubImage3D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>xoffset</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>yoffset</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>zoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLsizei</ptype> <name>imageSize</name></param>
<param group="CompressedTextureARB" len="imageSize">const void *<name>data</name></param>
<glx opcode="219" type="render" />
<glx comment="PBO protocol" name="glCompressedTexSubImage3DPBO" opcode="319" type="render" />
</command>
*/
static PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOMPRESSEDTEXSUBIMAGE3DPROC ) mygetprocaddr("glCompressedTexSubImage3D");
glfunc(target_, level_, xoffset_, yoffset_, zoffset_, width_, height_, depth_, format_, imageSize_, data_);
return;
}
void glCompressedTextureSubImage1D (GLuint texture_ , GLint level_ , GLint xoffset_ , GLsizei width_ , GLenum format_ , GLsizei imageSize_ , const void * data_ ){
/* <command>
<proto>void <name>glCompressedTextureSubImage1D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLsizei</ptype> <name>imageSize</name></param>
<param>const void *<name>data</name></param>
</command>
*/
static PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOMPRESSEDTEXTURESUBIMAGE1DPROC ) mygetprocaddr("glCompressedTextureSubImage1D");
glfunc(texture_, level_, xoffset_, width_, format_, imageSize_, data_);
return;
}
void glCompressedTextureSubImage2D (GLuint texture_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLsizei width_ , GLsizei height_ , GLenum format_ , GLsizei imageSize_ , const void * data_ ){
/* <command>
<proto>void <name>glCompressedTextureSubImage2D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLsizei</ptype> <name>imageSize</name></param>
<param>const void *<name>data</name></param>
</command>
*/
static PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOMPRESSEDTEXTURESUBIMAGE2DPROC ) mygetprocaddr("glCompressedTextureSubImage2D");
glfunc(texture_, level_, xoffset_, yoffset_, width_, height_, format_, imageSize_, data_);
return;
}
void glCompressedTextureSubImage3D (GLuint texture_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint zoffset_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ , GLenum format_ , GLsizei imageSize_ , const void * data_ ){
/* <command>
<proto>void <name>glCompressedTextureSubImage3D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLint</ptype> <name>zoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLsizei</ptype> <name>imageSize</name></param>
<param>const void *<name>data</name></param>
</command>
*/
static PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOMPRESSEDTEXTURESUBIMAGE3DPROC ) mygetprocaddr("glCompressedTextureSubImage3D");
glfunc(texture_, level_, xoffset_, yoffset_, zoffset_, width_, height_, depth_, format_, imageSize_, data_);
return;
}
void glCopyBufferSubData (GLenum readTarget_ , GLenum writeTarget_ , GLintptr readOffset_ , GLintptr writeOffset_ , GLsizeiptr size_ ){
/* <command>
<proto>void <name>glCopyBufferSubData</name></proto>
<param><ptype>GLenum</ptype> <name>readTarget</name></param>
<param><ptype>GLenum</ptype> <name>writeTarget</name></param>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>readOffset</name></param>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>writeOffset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
</command>
*/
static PFNGLCOPYBUFFERSUBDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOPYBUFFERSUBDATAPROC ) mygetprocaddr("glCopyBufferSubData");
glfunc(readTarget_, writeTarget_, readOffset_, writeOffset_, size_);
return;
}
void glCopyImageSubData (GLuint srcName_ , GLenum srcTarget_ , GLint srcLevel_ , GLint srcX_ , GLint srcY_ , GLint srcZ_ , GLuint dstName_ , GLenum dstTarget_ , GLint dstLevel_ , GLint dstX_ , GLint dstY_ , GLint dstZ_ , GLsizei srcWidth_ , GLsizei srcHeight_ , GLsizei srcDepth_ ){
/* <command>
<proto>void <name>glCopyImageSubData</name></proto>
<param><ptype>GLuint</ptype> <name>srcName</name></param>
<param><ptype>GLenum</ptype> <name>srcTarget</name></param>
<param><ptype>GLint</ptype> <name>srcLevel</name></param>
<param><ptype>GLint</ptype> <name>srcX</name></param>
<param><ptype>GLint</ptype> <name>srcY</name></param>
<param><ptype>GLint</ptype> <name>srcZ</name></param>
<param><ptype>GLuint</ptype> <name>dstName</name></param>
<param><ptype>GLenum</ptype> <name>dstTarget</name></param>
<param><ptype>GLint</ptype> <name>dstLevel</name></param>
<param><ptype>GLint</ptype> <name>dstX</name></param>
<param><ptype>GLint</ptype> <name>dstY</name></param>
<param><ptype>GLint</ptype> <name>dstZ</name></param>
<param><ptype>GLsizei</ptype> <name>srcWidth</name></param>
<param><ptype>GLsizei</ptype> <name>srcHeight</name></param>
<param><ptype>GLsizei</ptype> <name>srcDepth</name></param>
</command>
*/
static PFNGLCOPYIMAGESUBDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOPYIMAGESUBDATAPROC ) mygetprocaddr("glCopyImageSubData");
glfunc(srcName_, srcTarget_, srcLevel_, srcX_, srcY_, srcZ_, dstName_, dstTarget_, dstLevel_, dstX_, dstY_, dstZ_, srcWidth_, srcHeight_, srcDepth_);
return;
}
void glCopyNamedBufferSubData (GLuint readBuffer_ , GLuint writeBuffer_ , GLintptr readOffset_ , GLintptr writeOffset_ , GLsizeiptr size_ ){
/* <command>
<proto>void <name>glCopyNamedBufferSubData</name></proto>
<param><ptype>GLuint</ptype> <name>readBuffer</name></param>
<param><ptype>GLuint</ptype> <name>writeBuffer</name></param>
<param><ptype>GLintptr</ptype> <name>readOffset</name></param>
<param><ptype>GLintptr</ptype> <name>writeOffset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
</command>
*/
static PFNGLCOPYNAMEDBUFFERSUBDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOPYNAMEDBUFFERSUBDATAPROC ) mygetprocaddr("glCopyNamedBufferSubData");
glfunc(readBuffer_, writeBuffer_, readOffset_, writeOffset_, size_);
return;
}
void glCopyTexImage1D (GLenum target_ , GLint level_ , GLenum internalformat_ , GLint x_ , GLint y_ , GLsizei width_ , GLint border_ ){
/* <command>
<proto>void <name>glCopyTexImage1D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="PixelInternalFormat"><ptype>GLenum</ptype> <name>internalformat</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>x</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>border</name></param>
<glx opcode="4119" type="render" />
</command>
*/
static PFNGLCOPYTEXIMAGE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOPYTEXIMAGE1DPROC ) mygetprocaddr("glCopyTexImage1D");
glfunc(target_, level_, internalformat_, x_, y_, width_, border_);
return;
}
void glCopyTexImage2D (GLenum target_ , GLint level_ , GLenum internalformat_ , GLint x_ , GLint y_ , GLsizei width_ , GLsizei height_ , GLint border_ ){
/* <command>
<proto>void <name>glCopyTexImage2D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="PixelInternalFormat"><ptype>GLenum</ptype> <name>internalformat</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>x</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>border</name></param>
<glx opcode="4120" type="render" />
</command>
*/
static PFNGLCOPYTEXIMAGE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOPYTEXIMAGE2DPROC ) mygetprocaddr("glCopyTexImage2D");
glfunc(target_, level_, internalformat_, x_, y_, width_, height_, border_);
return;
}
void glCopyTexSubImage1D (GLenum target_ , GLint level_ , GLint xoffset_ , GLint x_ , GLint y_ , GLsizei width_ ){
/* <command>
<proto>void <name>glCopyTexSubImage1D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>xoffset</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>x</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<glx opcode="4121" type="render" />
</command>
*/
static PFNGLCOPYTEXSUBIMAGE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOPYTEXSUBIMAGE1DPROC ) mygetprocaddr("glCopyTexSubImage1D");
glfunc(target_, level_, xoffset_, x_, y_, width_);
return;
}
void glCopyTexSubImage2D (GLenum target_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint x_ , GLint y_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glCopyTexSubImage2D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>xoffset</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>yoffset</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>x</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<glx opcode="4122" type="render" />
</command>
*/
static PFNGLCOPYTEXSUBIMAGE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOPYTEXSUBIMAGE2DPROC ) mygetprocaddr("glCopyTexSubImage2D");
glfunc(target_, level_, xoffset_, yoffset_, x_, y_, width_, height_);
return;
}
void glCopyTexSubImage3D (GLenum target_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint zoffset_ , GLint x_ , GLint y_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glCopyTexSubImage3D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>xoffset</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>yoffset</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>zoffset</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>x</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<glx opcode="4123" type="render" />
</command>
*/
static PFNGLCOPYTEXSUBIMAGE3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOPYTEXSUBIMAGE3DPROC ) mygetprocaddr("glCopyTexSubImage3D");
glfunc(target_, level_, xoffset_, yoffset_, zoffset_, x_, y_, width_, height_);
return;
}
void glCopyTextureSubImage1D (GLuint texture_ , GLint level_ , GLint xoffset_ , GLint x_ , GLint y_ , GLsizei width_ ){
/* <command>
<proto>void <name>glCopyTextureSubImage1D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLint</ptype> <name>x</name></param>
<param><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
</command>
*/
static PFNGLCOPYTEXTURESUBIMAGE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOPYTEXTURESUBIMAGE1DPROC ) mygetprocaddr("glCopyTextureSubImage1D");
glfunc(texture_, level_, xoffset_, x_, y_, width_);
return;
}
void glCopyTextureSubImage2D (GLuint texture_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint x_ , GLint y_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glCopyTextureSubImage2D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLint</ptype> <name>x</name></param>
<param><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
</command>
*/
static PFNGLCOPYTEXTURESUBIMAGE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOPYTEXTURESUBIMAGE2DPROC ) mygetprocaddr("glCopyTextureSubImage2D");
glfunc(texture_, level_, xoffset_, yoffset_, x_, y_, width_, height_);
return;
}
void glCopyTextureSubImage3D (GLuint texture_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint zoffset_ , GLint x_ , GLint y_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glCopyTextureSubImage3D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLint</ptype> <name>zoffset</name></param>
<param><ptype>GLint</ptype> <name>x</name></param>
<param><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
</command>
*/
static PFNGLCOPYTEXTURESUBIMAGE3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCOPYTEXTURESUBIMAGE3DPROC ) mygetprocaddr("glCopyTextureSubImage3D");
glfunc(texture_, level_, xoffset_, yoffset_, zoffset_, x_, y_, width_, height_);
return;
}
void glCreateBuffers (GLsizei n_ , GLuint * buffers_ ){
/* <command>
<proto>void <name>glCreateBuffers</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param><ptype>GLuint</ptype> *<name>buffers</name></param>
</command>
*/
static PFNGLCREATEBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATEBUFFERSPROC ) mygetprocaddr("glCreateBuffers");
glfunc(n_, buffers_);
return;
}
void glCreateFramebuffers (GLsizei n_ , GLuint * framebuffers_ ){
/* <command>
<proto>void <name>glCreateFramebuffers</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param><ptype>GLuint</ptype> *<name>framebuffers</name></param>
</command>
*/
static PFNGLCREATEFRAMEBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATEFRAMEBUFFERSPROC ) mygetprocaddr("glCreateFramebuffers");
glfunc(n_, framebuffers_);
return;
}
GLuint glCreateProgram (){
/* <command>
<proto><ptype>GLuint</ptype> <name>glCreateProgram</name></proto>
</command>
*/
static PFNGLCREATEPROGRAMPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATEPROGRAMPROC ) mygetprocaddr("glCreateProgram");
GLuint retval = glfunc();
return retval;
}
void glCreateProgramPipelines (GLsizei n_ , GLuint * pipelines_ ){
/* <command>
<proto>void <name>glCreateProgramPipelines</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param><ptype>GLuint</ptype> *<name>pipelines</name></param>
</command>
*/
static PFNGLCREATEPROGRAMPIPELINESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATEPROGRAMPIPELINESPROC ) mygetprocaddr("glCreateProgramPipelines");
glfunc(n_, pipelines_);
return;
}
void glCreateQueries (GLenum target_ , GLsizei n_ , GLuint * ids_ ){
/* <command>
<proto>void <name>glCreateQueries</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param><ptype>GLuint</ptype> *<name>ids</name></param>
</command>
*/
static PFNGLCREATEQUERIESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATEQUERIESPROC ) mygetprocaddr("glCreateQueries");
glfunc(target_, n_, ids_);
return;
}
void glCreateRenderbuffers (GLsizei n_ , GLuint * renderbuffers_ ){
/* <command>
<proto>void <name>glCreateRenderbuffers</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param><ptype>GLuint</ptype> *<name>renderbuffers</name></param>
</command>
*/
static PFNGLCREATERENDERBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATERENDERBUFFERSPROC ) mygetprocaddr("glCreateRenderbuffers");
glfunc(n_, renderbuffers_);
return;
}
void glCreateSamplers (GLsizei n_ , GLuint * samplers_ ){
/* <command>
<proto>void <name>glCreateSamplers</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param><ptype>GLuint</ptype> *<name>samplers</name></param>
</command>
*/
static PFNGLCREATESAMPLERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATESAMPLERSPROC ) mygetprocaddr("glCreateSamplers");
glfunc(n_, samplers_);
return;
}
GLuint glCreateShader (GLenum type_ ){
/* <command>
<proto><ptype>GLuint</ptype> <name>glCreateShader</name></proto>
<param><ptype>GLenum</ptype> <name>type</name></param>
</command>
*/
static PFNGLCREATESHADERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATESHADERPROC ) mygetprocaddr("glCreateShader");
GLuint retval = glfunc(type_);
return retval;
}
GLuint glCreateShaderProgramv (GLenum type_ , GLsizei count_ , const GLchar ** strings_ ){
/* <command>
<proto><ptype>GLuint</ptype> <name>glCreateShaderProgramv</name></proto>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLchar</ptype> *const*<name>strings</name></param>
</command>
*/
static PFNGLCREATESHADERPROGRAMVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATESHADERPROGRAMVPROC ) mygetprocaddr("glCreateShaderProgramv");
GLuint retval = glfunc(type_, count_, strings_);
return retval;
}
void glCreateTextures (GLenum target_ , GLsizei n_ , GLuint * textures_ ){
/* <command>
<proto>void <name>glCreateTextures</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param><ptype>GLuint</ptype> *<name>textures</name></param>
</command>
*/
static PFNGLCREATETEXTURESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATETEXTURESPROC ) mygetprocaddr("glCreateTextures");
glfunc(target_, n_, textures_);
return;
}
void glCreateTransformFeedbacks (GLsizei n_ , GLuint * ids_ ){
/* <command>
<proto>void <name>glCreateTransformFeedbacks</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param><ptype>GLuint</ptype> *<name>ids</name></param>
</command>
*/
static PFNGLCREATETRANSFORMFEEDBACKSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATETRANSFORMFEEDBACKSPROC ) mygetprocaddr("glCreateTransformFeedbacks");
glfunc(n_, ids_);
return;
}
void glCreateVertexArrays (GLsizei n_ , GLuint * arrays_ ){
/* <command>
<proto>void <name>glCreateVertexArrays</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param><ptype>GLuint</ptype> *<name>arrays</name></param>
</command>
*/
static PFNGLCREATEVERTEXARRAYSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCREATEVERTEXARRAYSPROC ) mygetprocaddr("glCreateVertexArrays");
glfunc(n_, arrays_);
return;
}
void glCullFace (GLenum mode_ ){
/* <command>
<proto>void <name>glCullFace</name></proto>
<param group="CullFaceMode"><ptype>GLenum</ptype> <name>mode</name></param>
<glx opcode="79" type="render" />
</command>
*/
static PFNGLCULLFACEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLCULLFACEPROC ) mygetprocaddr("glCullFace");
glfunc(mode_);
return;
}
void glDebugMessageCallback (GLDEBUGPROC callback_ , const void * userParam_ ){
/* <command>
<proto>void <name>glDebugMessageCallback</name></proto>
<param><ptype>GLDEBUGPROC</ptype> <name>callback</name></param>
<param>const void *<name>userParam</name></param>
</command>
*/
static PFNGLDEBUGMESSAGECALLBACKPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDEBUGMESSAGECALLBACKPROC ) mygetprocaddr("glDebugMessageCallback");
glfunc(callback_, userParam_);
return;
}
void glDebugMessageControl (GLenum source_ , GLenum type_ , GLenum severity_ , GLsizei count_ , const GLuint * ids_ , GLboolean enabled_ ){
/* <command>
<proto>void <name>glDebugMessageControl</name></proto>
<param><ptype>GLenum</ptype> <name>source</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param><ptype>GLenum</ptype> <name>severity</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLuint</ptype> *<name>ids</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>enabled</name></param>
</command>
*/
static PFNGLDEBUGMESSAGECONTROLPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDEBUGMESSAGECONTROLPROC ) mygetprocaddr("glDebugMessageControl");
glfunc(source_, type_, severity_, count_, ids_, enabled_);
return;
}
void glDebugMessageInsert (GLenum source_ , GLenum type_ , GLuint id_ , GLenum severity_ , GLsizei length_ , const GLchar * buf_ ){
/* <command>
<proto>void <name>glDebugMessageInsert</name></proto>
<param><ptype>GLenum</ptype> <name>source</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLenum</ptype> <name>severity</name></param>
<param><ptype>GLsizei</ptype> <name>length</name></param>
<param len="COMPSIZE(buf,length)">const <ptype>GLchar</ptype> *<name>buf</name></param>
</command>
*/
static PFNGLDEBUGMESSAGEINSERTPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDEBUGMESSAGEINSERTPROC ) mygetprocaddr("glDebugMessageInsert");
glfunc(source_, type_, id_, severity_, length_, buf_);
return;
}
void glDeleteBuffers (GLsizei n_ , const GLuint * buffers_ ){
/* <command>
<proto>void <name>glDeleteBuffers</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n">const <ptype>GLuint</ptype> *<name>buffers</name></param>
</command>
*/
static PFNGLDELETEBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETEBUFFERSPROC ) mygetprocaddr("glDeleteBuffers");
glfunc(n_, buffers_);
return;
}
void glDeleteFramebuffers (GLsizei n_ , const GLuint * framebuffers_ ){
/* <command>
<proto>void <name>glDeleteFramebuffers</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n">const <ptype>GLuint</ptype> *<name>framebuffers</name></param>
<glx opcode="4320" type="render" />
</command>
*/
static PFNGLDELETEFRAMEBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETEFRAMEBUFFERSPROC ) mygetprocaddr("glDeleteFramebuffers");
glfunc(n_, framebuffers_);
return;
}
void glDeleteProgram (GLuint program_ ){
/* <command>
<proto>void <name>glDeleteProgram</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<glx opcode="202" type="single" />
</command>
*/
static PFNGLDELETEPROGRAMPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETEPROGRAMPROC ) mygetprocaddr("glDeleteProgram");
glfunc(program_);
return;
}
void glDeleteProgramPipelines (GLsizei n_ , const GLuint * pipelines_ ){
/* <command>
<proto>void <name>glDeleteProgramPipelines</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n">const <ptype>GLuint</ptype> *<name>pipelines</name></param>
</command>
*/
static PFNGLDELETEPROGRAMPIPELINESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETEPROGRAMPIPELINESPROC ) mygetprocaddr("glDeleteProgramPipelines");
glfunc(n_, pipelines_);
return;
}
void glDeleteQueries (GLsizei n_ , const GLuint * ids_ ){
/* <command>
<proto>void <name>glDeleteQueries</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n">const <ptype>GLuint</ptype> *<name>ids</name></param>
<glx opcode="161" type="single" />
</command>
*/
static PFNGLDELETEQUERIESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETEQUERIESPROC ) mygetprocaddr("glDeleteQueries");
glfunc(n_, ids_);
return;
}
void glDeleteRenderbuffers (GLsizei n_ , const GLuint * renderbuffers_ ){
/* <command>
<proto>void <name>glDeleteRenderbuffers</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n">const <ptype>GLuint</ptype> *<name>renderbuffers</name></param>
<glx opcode="4317" type="render" />
</command>
*/
static PFNGLDELETERENDERBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETERENDERBUFFERSPROC ) mygetprocaddr("glDeleteRenderbuffers");
glfunc(n_, renderbuffers_);
return;
}
void glDeleteSamplers (GLsizei count_ , const GLuint * samplers_ ){
/* <command>
<proto>void <name>glDeleteSamplers</name></proto>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLuint</ptype> *<name>samplers</name></param>
</command>
*/
static PFNGLDELETESAMPLERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETESAMPLERSPROC ) mygetprocaddr("glDeleteSamplers");
glfunc(count_, samplers_);
return;
}
void glDeleteShader (GLuint shader_ ){
/* <command>
<proto>void <name>glDeleteShader</name></proto>
<param><ptype>GLuint</ptype> <name>shader</name></param>
<glx opcode="195" type="single" />
</command>
*/
static PFNGLDELETESHADERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETESHADERPROC ) mygetprocaddr("glDeleteShader");
glfunc(shader_);
return;
}
void glDeleteSync (GLsync sync_ ){
/* <command>
<proto>void <name>glDeleteSync</name></proto>
<param group="sync"><ptype>GLsync</ptype> <name>sync</name></param>
</command>
*/
static PFNGLDELETESYNCPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETESYNCPROC ) mygetprocaddr("glDeleteSync");
glfunc(sync_);
return;
}
void glDeleteTextures (GLsizei n_ , const GLuint * textures_ ){
/* <command>
<proto>void <name>glDeleteTextures</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param group="Texture" len="n">const <ptype>GLuint</ptype> *<name>textures</name></param>
<glx opcode="144" type="single" />
</command>
*/
static PFNGLDELETETEXTURESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETETEXTURESPROC ) mygetprocaddr("glDeleteTextures");
glfunc(n_, textures_);
return;
}
void glDeleteTransformFeedbacks (GLsizei n_ , const GLuint * ids_ ){
/* <command>
<proto>void <name>glDeleteTransformFeedbacks</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n">const <ptype>GLuint</ptype> *<name>ids</name></param>
</command>
*/
static PFNGLDELETETRANSFORMFEEDBACKSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETETRANSFORMFEEDBACKSPROC ) mygetprocaddr("glDeleteTransformFeedbacks");
glfunc(n_, ids_);
return;
}
void glDeleteVertexArrays (GLsizei n_ , const GLuint * arrays_ ){
/* <command>
<proto>void <name>glDeleteVertexArrays</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n">const <ptype>GLuint</ptype> *<name>arrays</name></param>
<glx opcode="351" type="render" />
</command>
*/
static PFNGLDELETEVERTEXARRAYSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDELETEVERTEXARRAYSPROC ) mygetprocaddr("glDeleteVertexArrays");
glfunc(n_, arrays_);
return;
}
void glDepthFunc (GLenum func_ ){
/* <command>
<proto>void <name>glDepthFunc</name></proto>
<param group="DepthFunction"><ptype>GLenum</ptype> <name>func</name></param>
<glx opcode="164" type="render" />
</command>
*/
static PFNGLDEPTHFUNCPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDEPTHFUNCPROC ) mygetprocaddr("glDepthFunc");
glfunc(func_);
return;
}
void glDepthMask (GLboolean flag_ ){
/* <command>
<proto>void <name>glDepthMask</name></proto>
<param group="Boolean"><ptype>GLboolean</ptype> <name>flag</name></param>
<glx opcode="135" type="render" />
</command>
*/
static PFNGLDEPTHMASKPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDEPTHMASKPROC ) mygetprocaddr("glDepthMask");
glfunc(flag_);
return;
}
void glDepthRange (GLdouble near_ , GLdouble far_ ){
/* <command>
<proto>void <name>glDepthRange</name></proto>
<param><ptype>GLdouble</ptype> <name>near</name></param>
<param><ptype>GLdouble</ptype> <name>far</name></param>
<glx opcode="174" type="render" />
</command>
*/
static PFNGLDEPTHRANGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDEPTHRANGEPROC ) mygetprocaddr("glDepthRange");
glfunc(near_, far_);
return;
}
void glDepthRangeArrayv (GLuint first_ , GLsizei count_ , const GLdouble * v_ ){
/* <command>
<proto>void <name>glDepthRangeArrayv</name></proto>
<param><ptype>GLuint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="COMPSIZE(count)">const <ptype>GLdouble</ptype> *<name>v</name></param>
</command>
*/
static PFNGLDEPTHRANGEARRAYVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDEPTHRANGEARRAYVPROC ) mygetprocaddr("glDepthRangeArrayv");
glfunc(first_, count_, v_);
return;
}
void glDepthRangeIndexed (GLuint index_ , GLdouble n_ , GLdouble f_ ){
/* <command>
<proto>void <name>glDepthRangeIndexed</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLdouble</ptype> <name>n</name></param>
<param><ptype>GLdouble</ptype> <name>f</name></param>
</command>
*/
static PFNGLDEPTHRANGEINDEXEDPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDEPTHRANGEINDEXEDPROC ) mygetprocaddr("glDepthRangeIndexed");
glfunc(index_, n_, f_);
return;
}
void glDepthRangef (GLfloat n_ , GLfloat f_ ){
/* <command>
<proto>void <name>glDepthRangef</name></proto>
<param><ptype>GLfloat</ptype> <name>n</name></param>
<param><ptype>GLfloat</ptype> <name>f</name></param>
</command>
*/
static PFNGLDEPTHRANGEFPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDEPTHRANGEFPROC ) mygetprocaddr("glDepthRangef");
glfunc(n_, f_);
return;
}
void glDetachShader (GLuint program_ , GLuint shader_ ){
/* <command>
<proto>void <name>glDetachShader</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>shader</name></param>
</command>
*/
static PFNGLDETACHSHADERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDETACHSHADERPROC ) mygetprocaddr("glDetachShader");
glfunc(program_, shader_);
return;
}
void glDisable (GLenum cap_ ){
/* <command>
<proto>void <name>glDisable</name></proto>
<param group="EnableCap"><ptype>GLenum</ptype> <name>cap</name></param>
<glx opcode="138" type="render" />
</command>
*/
static PFNGLDISABLEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDISABLEPROC ) mygetprocaddr("glDisable");
glfunc(cap_);
return;
}
void glDisableVertexArrayAttrib (GLuint vaobj_ , GLuint index_ ){
/* <command>
<proto>void <name>glDisableVertexArrayAttrib</name></proto>
<param><ptype>GLuint</ptype> <name>vaobj</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
</command>
*/
static PFNGLDISABLEVERTEXARRAYATTRIBPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDISABLEVERTEXARRAYATTRIBPROC ) mygetprocaddr("glDisableVertexArrayAttrib");
glfunc(vaobj_, index_);
return;
}
void glDisableVertexAttribArray (GLuint index_ ){
/* <command>
<proto>void <name>glDisableVertexAttribArray</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
</command>
*/
static PFNGLDISABLEVERTEXATTRIBARRAYPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDISABLEVERTEXATTRIBARRAYPROC ) mygetprocaddr("glDisableVertexAttribArray");
glfunc(index_);
return;
}
void glDisablei (GLenum target_ , GLuint index_ ){
/* <command>
<proto>void <name>glDisablei</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
</command>
*/
static PFNGLDISABLEIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDISABLEIPROC ) mygetprocaddr("glDisablei");
glfunc(target_, index_);
return;
}
void glDispatchCompute (GLuint num_groups_x_ , GLuint num_groups_y_ , GLuint num_groups_z_ ){
/* <command>
<proto>void <name>glDispatchCompute</name></proto>
<param><ptype>GLuint</ptype> <name>num_groups_x</name></param>
<param><ptype>GLuint</ptype> <name>num_groups_y</name></param>
<param><ptype>GLuint</ptype> <name>num_groups_z</name></param>
</command>
*/
static PFNGLDISPATCHCOMPUTEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDISPATCHCOMPUTEPROC ) mygetprocaddr("glDispatchCompute");
glfunc(num_groups_x_, num_groups_y_, num_groups_z_);
return;
}
void glDispatchComputeIndirect (GLintptr indirect_ ){
/* <command>
<proto>void <name>glDispatchComputeIndirect</name></proto>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>indirect</name></param>
</command>
*/
static PFNGLDISPATCHCOMPUTEINDIRECTPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDISPATCHCOMPUTEINDIRECTPROC ) mygetprocaddr("glDispatchComputeIndirect");
glfunc(indirect_);
return;
}
void glDrawArrays (GLenum mode_ , GLint first_ , GLsizei count_ ){
/* <command>
<proto>void <name>glDrawArrays</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<glx opcode="193" type="render" />
</command>
*/
static PFNGLDRAWARRAYSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWARRAYSPROC ) mygetprocaddr("glDrawArrays");
glfunc(mode_, first_, count_);
return;
}
void glDrawArraysIndirect (GLenum mode_ , const void * indirect_ ){
/* <command>
<proto>void <name>glDrawArraysIndirect</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param>const void *<name>indirect</name></param>
</command>
*/
static PFNGLDRAWARRAYSINDIRECTPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWARRAYSINDIRECTPROC ) mygetprocaddr("glDrawArraysIndirect");
glfunc(mode_, indirect_);
return;
}
void glDrawArraysInstanced (GLenum mode_ , GLint first_ , GLsizei count_ , GLsizei instancecount_ ){
/* <command>
<proto>void <name>glDrawArraysInstanced</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param><ptype>GLsizei</ptype> <name>instancecount</name></param>
</command>
*/
static PFNGLDRAWARRAYSINSTANCEDPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWARRAYSINSTANCEDPROC ) mygetprocaddr("glDrawArraysInstanced");
glfunc(mode_, first_, count_, instancecount_);
return;
}
void glDrawArraysInstancedBaseInstance (GLenum mode_ , GLint first_ , GLsizei count_ , GLsizei instancecount_ , GLuint baseinstance_ ){
/* <command>
<proto>void <name>glDrawArraysInstancedBaseInstance</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param><ptype>GLsizei</ptype> <name>instancecount</name></param>
<param><ptype>GLuint</ptype> <name>baseinstance</name></param>
</command>
*/
static PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWARRAYSINSTANCEDBASEINSTANCEPROC ) mygetprocaddr("glDrawArraysInstancedBaseInstance");
glfunc(mode_, first_, count_, instancecount_, baseinstance_);
return;
}
void glDrawBuffer (GLenum buf_ ){
/* <command>
<proto>void <name>glDrawBuffer</name></proto>
<param group="DrawBufferMode"><ptype>GLenum</ptype> <name>buf</name></param>
<glx opcode="126" type="render" />
</command>
*/
static PFNGLDRAWBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWBUFFERPROC ) mygetprocaddr("glDrawBuffer");
glfunc(buf_);
return;
}
void glDrawBuffers (GLsizei n_ , const GLenum * bufs_ ){
/* <command>
<proto>void <name>glDrawBuffers</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param group="DrawBufferModeATI" len="n">const <ptype>GLenum</ptype> *<name>bufs</name></param>
<glx opcode="233" type="render" />
</command>
*/
static PFNGLDRAWBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWBUFFERSPROC ) mygetprocaddr("glDrawBuffers");
glfunc(n_, bufs_);
return;
}
void glDrawElements (GLenum mode_ , GLsizei count_ , GLenum type_ , const void * indices_ ){
/* <command>
<proto>void <name>glDrawElements</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="DrawElementsType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(count,type)">const void *<name>indices</name></param>
</command>
*/
static PFNGLDRAWELEMENTSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWELEMENTSPROC ) mygetprocaddr("glDrawElements");
glfunc(mode_, count_, type_, indices_);
return;
}
void glDrawElementsBaseVertex (GLenum mode_ , GLsizei count_ , GLenum type_ , const void * indices_ , GLint basevertex_ ){
/* <command>
<proto>void <name>glDrawElementsBaseVertex</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="DrawElementsType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(count,type)">const void *<name>indices</name></param>
<param><ptype>GLint</ptype> <name>basevertex</name></param>
</command>
*/
static PFNGLDRAWELEMENTSBASEVERTEXPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWELEMENTSBASEVERTEXPROC ) mygetprocaddr("glDrawElementsBaseVertex");
glfunc(mode_, count_, type_, indices_, basevertex_);
return;
}
void glDrawElementsIndirect (GLenum mode_ , GLenum type_ , const void * indirect_ ){
/* <command>
<proto>void <name>glDrawElementsIndirect</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param>const void *<name>indirect</name></param>
</command>
*/
static PFNGLDRAWELEMENTSINDIRECTPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWELEMENTSINDIRECTPROC ) mygetprocaddr("glDrawElementsIndirect");
glfunc(mode_, type_, indirect_);
return;
}
void glDrawElementsInstanced (GLenum mode_ , GLsizei count_ , GLenum type_ , const void * indices_ , GLsizei instancecount_ ){
/* <command>
<proto>void <name>glDrawElementsInstanced</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="DrawElementsType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(count,type)">const void *<name>indices</name></param>
<param><ptype>GLsizei</ptype> <name>instancecount</name></param>
</command>
*/
static PFNGLDRAWELEMENTSINSTANCEDPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWELEMENTSINSTANCEDPROC ) mygetprocaddr("glDrawElementsInstanced");
glfunc(mode_, count_, type_, indices_, instancecount_);
return;
}
void glDrawElementsInstancedBaseInstance (GLenum mode_ , GLsizei count_ , GLenum type_ , const void * indices_ , GLsizei instancecount_ , GLuint baseinstance_ ){
/* <command>
<proto>void <name>glDrawElementsInstancedBaseInstance</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param len="count">const void *<name>indices</name></param>
<param><ptype>GLsizei</ptype> <name>instancecount</name></param>
<param><ptype>GLuint</ptype> <name>baseinstance</name></param>
</command>
*/
static PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWELEMENTSINSTANCEDBASEINSTANCEPROC ) mygetprocaddr("glDrawElementsInstancedBaseInstance");
glfunc(mode_, count_, type_, indices_, instancecount_, baseinstance_);
return;
}
void glDrawElementsInstancedBaseVertex (GLenum mode_ , GLsizei count_ , GLenum type_ , const void * indices_ , GLsizei instancecount_ , GLint basevertex_ ){
/* <command>
<proto>void <name>glDrawElementsInstancedBaseVertex</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="DrawElementsType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(count,type)">const void *<name>indices</name></param>
<param><ptype>GLsizei</ptype> <name>instancecount</name></param>
<param><ptype>GLint</ptype> <name>basevertex</name></param>
</command>
*/
static PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXPROC ) mygetprocaddr("glDrawElementsInstancedBaseVertex");
glfunc(mode_, count_, type_, indices_, instancecount_, basevertex_);
return;
}
void glDrawElementsInstancedBaseVertexBaseInstance (GLenum mode_ , GLsizei count_ , GLenum type_ , const void * indices_ , GLsizei instancecount_ , GLint basevertex_ , GLuint baseinstance_ ){
/* <command>
<proto>void <name>glDrawElementsInstancedBaseVertexBaseInstance</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param len="count">const void *<name>indices</name></param>
<param><ptype>GLsizei</ptype> <name>instancecount</name></param>
<param><ptype>GLint</ptype> <name>basevertex</name></param>
<param><ptype>GLuint</ptype> <name>baseinstance</name></param>
</command>
*/
static PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWELEMENTSINSTANCEDBASEVERTEXBASEINSTANCEPROC ) mygetprocaddr("glDrawElementsInstancedBaseVertexBaseInstance");
glfunc(mode_, count_, type_, indices_, instancecount_, basevertex_, baseinstance_);
return;
}
void glDrawRangeElements (GLenum mode_ , GLuint start_ , GLuint end_ , GLsizei count_ , GLenum type_ , const void * indices_ ){
/* <command>
<proto>void <name>glDrawRangeElements</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLuint</ptype> <name>start</name></param>
<param><ptype>GLuint</ptype> <name>end</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="DrawElementsType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(count,type)">const void *<name>indices</name></param>
</command>
*/
static PFNGLDRAWRANGEELEMENTSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWRANGEELEMENTSPROC ) mygetprocaddr("glDrawRangeElements");
glfunc(mode_, start_, end_, count_, type_, indices_);
return;
}
void glDrawRangeElementsBaseVertex (GLenum mode_ , GLuint start_ , GLuint end_ , GLsizei count_ , GLenum type_ , const void * indices_ , GLint basevertex_ ){
/* <command>
<proto>void <name>glDrawRangeElementsBaseVertex</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLuint</ptype> <name>start</name></param>
<param><ptype>GLuint</ptype> <name>end</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="DrawElementsType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(count,type)">const void *<name>indices</name></param>
<param><ptype>GLint</ptype> <name>basevertex</name></param>
</command>
*/
static PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWRANGEELEMENTSBASEVERTEXPROC ) mygetprocaddr("glDrawRangeElementsBaseVertex");
glfunc(mode_, start_, end_, count_, type_, indices_, basevertex_);
return;
}
void glDrawTransformFeedback (GLenum mode_ , GLuint id_ ){
/* <command>
<proto>void <name>glDrawTransformFeedback</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLuint</ptype> <name>id</name></param>
</command>
*/
static PFNGLDRAWTRANSFORMFEEDBACKPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWTRANSFORMFEEDBACKPROC ) mygetprocaddr("glDrawTransformFeedback");
glfunc(mode_, id_);
return;
}
void glDrawTransformFeedbackInstanced (GLenum mode_ , GLuint id_ , GLsizei instancecount_ ){
/* <command>
<proto>void <name>glDrawTransformFeedbackInstanced</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLsizei</ptype> <name>instancecount</name></param>
</command>
*/
static PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWTRANSFORMFEEDBACKINSTANCEDPROC ) mygetprocaddr("glDrawTransformFeedbackInstanced");
glfunc(mode_, id_, instancecount_);
return;
}
void glDrawTransformFeedbackStream (GLenum mode_ , GLuint id_ , GLuint stream_ ){
/* <command>
<proto>void <name>glDrawTransformFeedbackStream</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLuint</ptype> <name>stream</name></param>
</command>
*/
static PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWTRANSFORMFEEDBACKSTREAMPROC ) mygetprocaddr("glDrawTransformFeedbackStream");
glfunc(mode_, id_, stream_);
return;
}
void glDrawTransformFeedbackStreamInstanced (GLenum mode_ , GLuint id_ , GLuint stream_ , GLsizei instancecount_ ){
/* <command>
<proto>void <name>glDrawTransformFeedbackStreamInstanced</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLuint</ptype> <name>stream</name></param>
<param><ptype>GLsizei</ptype> <name>instancecount</name></param>
</command>
*/
static PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLDRAWTRANSFORMFEEDBACKSTREAMINSTANCEDPROC ) mygetprocaddr("glDrawTransformFeedbackStreamInstanced");
glfunc(mode_, id_, stream_, instancecount_);
return;
}
void glEnable (GLenum cap_ ){
/* <command>
<proto>void <name>glEnable</name></proto>
<param group="EnableCap"><ptype>GLenum</ptype> <name>cap</name></param>
<glx opcode="139" type="render" />
</command>
*/
static PFNGLENABLEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLENABLEPROC ) mygetprocaddr("glEnable");
glfunc(cap_);
return;
}
void glEnableVertexArrayAttrib (GLuint vaobj_ , GLuint index_ ){
/* <command>
<proto>void <name>glEnableVertexArrayAttrib</name></proto>
<param><ptype>GLuint</ptype> <name>vaobj</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
</command>
*/
static PFNGLENABLEVERTEXARRAYATTRIBPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLENABLEVERTEXARRAYATTRIBPROC ) mygetprocaddr("glEnableVertexArrayAttrib");
glfunc(vaobj_, index_);
return;
}
void glEnableVertexAttribArray (GLuint index_ ){
/* <command>
<proto>void <name>glEnableVertexAttribArray</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
</command>
*/
static PFNGLENABLEVERTEXATTRIBARRAYPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLENABLEVERTEXATTRIBARRAYPROC ) mygetprocaddr("glEnableVertexAttribArray");
glfunc(index_);
return;
}
void glEnablei (GLenum target_ , GLuint index_ ){
/* <command>
<proto>void <name>glEnablei</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
</command>
*/
static PFNGLENABLEIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLENABLEIPROC ) mygetprocaddr("glEnablei");
glfunc(target_, index_);
return;
}
void glEndConditionalRender (){
/* <command>
<proto>void <name>glEndConditionalRender</name></proto>
<glx opcode="349" type="render" />
</command>
*/
static PFNGLENDCONDITIONALRENDERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLENDCONDITIONALRENDERPROC ) mygetprocaddr("glEndConditionalRender");
glfunc();
return;
}
void glEndQuery (GLenum target_ ){
/* <command>
<proto>void <name>glEndQuery</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<glx opcode="232" type="render" />
</command>
*/
static PFNGLENDQUERYPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLENDQUERYPROC ) mygetprocaddr("glEndQuery");
glfunc(target_);
return;
}
void glEndQueryIndexed (GLenum target_ , GLuint index_ ){
/* <command>
<proto>void <name>glEndQueryIndexed</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
</command>
*/
static PFNGLENDQUERYINDEXEDPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLENDQUERYINDEXEDPROC ) mygetprocaddr("glEndQueryIndexed");
glfunc(target_, index_);
return;
}
void glEndTransformFeedback (){
/* <command>
<proto>void <name>glEndTransformFeedback</name></proto>
</command>
*/
static PFNGLENDTRANSFORMFEEDBACKPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLENDTRANSFORMFEEDBACKPROC ) mygetprocaddr("glEndTransformFeedback");
glfunc();
return;
}
GLsync glFenceSync (GLenum condition_ , GLbitfield flags_ ){
/* <command>
<proto group="sync"><ptype>GLsync</ptype> <name>glFenceSync</name></proto>
<param><ptype>GLenum</ptype> <name>condition</name></param>
<param><ptype>GLbitfield</ptype> <name>flags</name></param>
</command>
*/
static PFNGLFENCESYNCPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFENCESYNCPROC ) mygetprocaddr("glFenceSync");
GLsync retval = glfunc(condition_, flags_);
return retval;
}
void glFinish (){
/* <command>
<proto>void <name>glFinish</name></proto>
<glx opcode="108" type="single" />
</command>
*/
static PFNGLFINISHPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFINISHPROC ) mygetprocaddr("glFinish");
glfunc();
return;
}
void glFlush (){
/* <command>
<proto>void <name>glFlush</name></proto>
<glx opcode="142" type="single" />
</command>
*/
static PFNGLFLUSHPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFLUSHPROC ) mygetprocaddr("glFlush");
glfunc();
return;
}
void glFlushMappedBufferRange (GLenum target_ , GLintptr offset_ , GLsizeiptr length_ ){
/* <command>
<proto>void <name>glFlushMappedBufferRange</name></proto>
<param group="BufferTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>length</name></param>
</command>
*/
static PFNGLFLUSHMAPPEDBUFFERRANGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFLUSHMAPPEDBUFFERRANGEPROC ) mygetprocaddr("glFlushMappedBufferRange");
glfunc(target_, offset_, length_);
return;
}
void glFlushMappedNamedBufferRange (GLuint buffer_ , GLintptr offset_ , GLsizeiptr length_ ){
/* <command>
<proto>void <name>glFlushMappedNamedBufferRange</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>length</name></param>
</command>
*/
static PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFLUSHMAPPEDNAMEDBUFFERRANGEPROC ) mygetprocaddr("glFlushMappedNamedBufferRange");
glfunc(buffer_, offset_, length_);
return;
}
void glFramebufferParameteri (GLenum target_ , GLenum pname_ , GLint param_ ){
/* <command>
<proto>void <name>glFramebufferParameteri</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> <name>param</name></param>
</command>
*/
static PFNGLFRAMEBUFFERPARAMETERIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFRAMEBUFFERPARAMETERIPROC ) mygetprocaddr("glFramebufferParameteri");
glfunc(target_, pname_, param_);
return;
}
void glFramebufferRenderbuffer (GLenum target_ , GLenum attachment_ , GLenum renderbuffertarget_ , GLuint renderbuffer_ ){
/* <command>
<proto>void <name>glFramebufferRenderbuffer</name></proto>
<param group="FramebufferTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="FramebufferAttachment"><ptype>GLenum</ptype> <name>attachment</name></param>
<param group="RenderbufferTarget"><ptype>GLenum</ptype> <name>renderbuffertarget</name></param>
<param><ptype>GLuint</ptype> <name>renderbuffer</name></param>
<glx opcode="4324" type="render" />
</command>
*/
static PFNGLFRAMEBUFFERRENDERBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFRAMEBUFFERRENDERBUFFERPROC ) mygetprocaddr("glFramebufferRenderbuffer");
glfunc(target_, attachment_, renderbuffertarget_, renderbuffer_);
return;
}
void glFramebufferTexture (GLenum target_ , GLenum attachment_ , GLuint texture_ , GLint level_ ){
/* <command>
<proto>void <name>glFramebufferTexture</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>attachment</name></param>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
</command>
*/
static PFNGLFRAMEBUFFERTEXTUREPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFRAMEBUFFERTEXTUREPROC ) mygetprocaddr("glFramebufferTexture");
glfunc(target_, attachment_, texture_, level_);
return;
}
void glFramebufferTexture1D (GLenum target_ , GLenum attachment_ , GLenum textarget_ , GLuint texture_ , GLint level_ ){
/* <command>
<proto>void <name>glFramebufferTexture1D</name></proto>
<param group="FramebufferTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="FramebufferAttachment"><ptype>GLenum</ptype> <name>attachment</name></param>
<param><ptype>GLenum</ptype> <name>textarget</name></param>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<glx opcode="4321" type="render" />
</command>
*/
static PFNGLFRAMEBUFFERTEXTURE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFRAMEBUFFERTEXTURE1DPROC ) mygetprocaddr("glFramebufferTexture1D");
glfunc(target_, attachment_, textarget_, texture_, level_);
return;
}
void glFramebufferTexture2D (GLenum target_ , GLenum attachment_ , GLenum textarget_ , GLuint texture_ , GLint level_ ){
/* <command>
<proto>void <name>glFramebufferTexture2D</name></proto>
<param group="FramebufferTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="FramebufferAttachment"><ptype>GLenum</ptype> <name>attachment</name></param>
<param><ptype>GLenum</ptype> <name>textarget</name></param>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<glx opcode="4322" type="render" />
</command>
*/
static PFNGLFRAMEBUFFERTEXTURE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFRAMEBUFFERTEXTURE2DPROC ) mygetprocaddr("glFramebufferTexture2D");
glfunc(target_, attachment_, textarget_, texture_, level_);
return;
}
void glFramebufferTexture3D (GLenum target_ , GLenum attachment_ , GLenum textarget_ , GLuint texture_ , GLint level_ , GLint zoffset_ ){
/* <command>
<proto>void <name>glFramebufferTexture3D</name></proto>
<param group="FramebufferTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="FramebufferAttachment"><ptype>GLenum</ptype> <name>attachment</name></param>
<param><ptype>GLenum</ptype> <name>textarget</name></param>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>zoffset</name></param>
<glx opcode="4323" type="render" />
</command>
*/
static PFNGLFRAMEBUFFERTEXTURE3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFRAMEBUFFERTEXTURE3DPROC ) mygetprocaddr("glFramebufferTexture3D");
glfunc(target_, attachment_, textarget_, texture_, level_, zoffset_);
return;
}
void glFramebufferTextureLayer (GLenum target_ , GLenum attachment_ , GLuint texture_ , GLint level_ , GLint layer_ ){
/* <command>
<proto>void <name>glFramebufferTextureLayer</name></proto>
<param group="FramebufferTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="FramebufferAttachment"><ptype>GLenum</ptype> <name>attachment</name></param>
<param group="Texture"><ptype>GLuint</ptype> <name>texture</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>layer</name></param>
<glx opcode="237" type="render" />
</command>
*/
static PFNGLFRAMEBUFFERTEXTURELAYERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFRAMEBUFFERTEXTURELAYERPROC ) mygetprocaddr("glFramebufferTextureLayer");
glfunc(target_, attachment_, texture_, level_, layer_);
return;
}
void glFrontFace (GLenum mode_ ){
/* <command>
<proto>void <name>glFrontFace</name></proto>
<param group="FrontFaceDirection"><ptype>GLenum</ptype> <name>mode</name></param>
<glx opcode="84" type="render" />
</command>
*/
static PFNGLFRONTFACEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLFRONTFACEPROC ) mygetprocaddr("glFrontFace");
glfunc(mode_);
return;
}
void glGenBuffers (GLsizei n_ , GLuint * buffers_ ){
/* <command>
<proto>void <name>glGenBuffers</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n"><ptype>GLuint</ptype> *<name>buffers</name></param>
</command>
*/
static PFNGLGENBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGENBUFFERSPROC ) mygetprocaddr("glGenBuffers");
glfunc(n_, buffers_);
return;
}
void glGenFramebuffers (GLsizei n_ , GLuint * framebuffers_ ){
/* <command>
<proto>void <name>glGenFramebuffers</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n"><ptype>GLuint</ptype> *<name>framebuffers</name></param>
<glx opcode="1426" type="vendor" />
</command>
*/
static PFNGLGENFRAMEBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGENFRAMEBUFFERSPROC ) mygetprocaddr("glGenFramebuffers");
glfunc(n_, framebuffers_);
return;
}
void glGenProgramPipelines (GLsizei n_ , GLuint * pipelines_ ){
/* <command>
<proto>void <name>glGenProgramPipelines</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n"><ptype>GLuint</ptype> *<name>pipelines</name></param>
</command>
*/
static PFNGLGENPROGRAMPIPELINESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGENPROGRAMPIPELINESPROC ) mygetprocaddr("glGenProgramPipelines");
glfunc(n_, pipelines_);
return;
}
void glGenQueries (GLsizei n_ , GLuint * ids_ ){
/* <command>
<proto>void <name>glGenQueries</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n"><ptype>GLuint</ptype> *<name>ids</name></param>
<glx opcode="162" type="single" />
</command>
*/
static PFNGLGENQUERIESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGENQUERIESPROC ) mygetprocaddr("glGenQueries");
glfunc(n_, ids_);
return;
}
void glGenRenderbuffers (GLsizei n_ , GLuint * renderbuffers_ ){
/* <command>
<proto>void <name>glGenRenderbuffers</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n"><ptype>GLuint</ptype> *<name>renderbuffers</name></param>
<glx opcode="1423" type="vendor" />
</command>
*/
static PFNGLGENRENDERBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGENRENDERBUFFERSPROC ) mygetprocaddr("glGenRenderbuffers");
glfunc(n_, renderbuffers_);
return;
}
void glGenSamplers (GLsizei count_ , GLuint * samplers_ ){
/* <command>
<proto>void <name>glGenSamplers</name></proto>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count"><ptype>GLuint</ptype> *<name>samplers</name></param>
</command>
*/
static PFNGLGENSAMPLERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGENSAMPLERSPROC ) mygetprocaddr("glGenSamplers");
glfunc(count_, samplers_);
return;
}
void glGenTextures (GLsizei n_ , GLuint * textures_ ){
/* <command>
<proto>void <name>glGenTextures</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param group="Texture" len="n"><ptype>GLuint</ptype> *<name>textures</name></param>
<glx opcode="145" type="single" />
</command>
*/
static PFNGLGENTEXTURESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGENTEXTURESPROC ) mygetprocaddr("glGenTextures");
glfunc(n_, textures_);
return;
}
void glGenTransformFeedbacks (GLsizei n_ , GLuint * ids_ ){
/* <command>
<proto>void <name>glGenTransformFeedbacks</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n"><ptype>GLuint</ptype> *<name>ids</name></param>
</command>
*/
static PFNGLGENTRANSFORMFEEDBACKSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGENTRANSFORMFEEDBACKSPROC ) mygetprocaddr("glGenTransformFeedbacks");
glfunc(n_, ids_);
return;
}
void glGenVertexArrays (GLsizei n_ , GLuint * arrays_ ){
/* <command>
<proto>void <name>glGenVertexArrays</name></proto>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param len="n"><ptype>GLuint</ptype> *<name>arrays</name></param>
<glx opcode="206" type="single" />
</command>
*/
static PFNGLGENVERTEXARRAYSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGENVERTEXARRAYSPROC ) mygetprocaddr("glGenVertexArrays");
glfunc(n_, arrays_);
return;
}
void glGenerateMipmap (GLenum target_ ){
/* <command>
<proto>void <name>glGenerateMipmap</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<glx opcode="4325" type="render" />
</command>
*/
static PFNGLGENERATEMIPMAPPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGENERATEMIPMAPPROC ) mygetprocaddr("glGenerateMipmap");
glfunc(target_);
return;
}
void glGenerateTextureMipmap (GLuint texture_ ){
/* <command>
<proto>void <name>glGenerateTextureMipmap</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
</command>
*/
static PFNGLGENERATETEXTUREMIPMAPPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGENERATETEXTUREMIPMAPPROC ) mygetprocaddr("glGenerateTextureMipmap");
glfunc(texture_);
return;
}
void glGetActiveAtomicCounterBufferiv (GLuint program_ , GLuint bufferIndex_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetActiveAtomicCounterBufferiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>bufferIndex</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETACTIVEATOMICCOUNTERBUFFERIVPROC ) mygetprocaddr("glGetActiveAtomicCounterBufferiv");
glfunc(program_, bufferIndex_, pname_, params_);
return;
}
void glGetActiveAttrib (GLuint program_ , GLuint index_ , GLsizei bufSize_ , GLsizei * length_ , GLint * size_ , GLenum * type_ , GLchar * name_ ){
/* <command>
<proto>void <name>glGetActiveAttrib</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="1"><ptype>GLint</ptype> *<name>size</name></param>
<param len="1"><ptype>GLenum</ptype> *<name>type</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETACTIVEATTRIBPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETACTIVEATTRIBPROC ) mygetprocaddr("glGetActiveAttrib");
glfunc(program_, index_, bufSize_, length_, size_, type_, name_);
return;
}
void glGetActiveSubroutineName (GLuint program_ , GLenum shadertype_ , GLuint index_ , GLsizei bufsize_ , GLsizei * length_ , GLchar * name_ ){
/* <command>
<proto>void <name>glGetActiveSubroutineName</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>shadertype</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLsizei</ptype> <name>bufsize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufsize"><ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETACTIVESUBROUTINENAMEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETACTIVESUBROUTINENAMEPROC ) mygetprocaddr("glGetActiveSubroutineName");
glfunc(program_, shadertype_, index_, bufsize_, length_, name_);
return;
}
void glGetActiveSubroutineUniformName (GLuint program_ , GLenum shadertype_ , GLuint index_ , GLsizei bufsize_ , GLsizei * length_ , GLchar * name_ ){
/* <command>
<proto>void <name>glGetActiveSubroutineUniformName</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>shadertype</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLsizei</ptype> <name>bufsize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufsize"><ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETACTIVESUBROUTINEUNIFORMNAMEPROC ) mygetprocaddr("glGetActiveSubroutineUniformName");
glfunc(program_, shadertype_, index_, bufsize_, length_, name_);
return;
}
void glGetActiveSubroutineUniformiv (GLuint program_ , GLenum shadertype_ , GLuint index_ , GLenum pname_ , GLint * values_ ){
/* <command>
<proto>void <name>glGetActiveSubroutineUniformiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>shadertype</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>values</name></param>
</command>
*/
static PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETACTIVESUBROUTINEUNIFORMIVPROC ) mygetprocaddr("glGetActiveSubroutineUniformiv");
glfunc(program_, shadertype_, index_, pname_, values_);
return;
}
void glGetActiveUniform (GLuint program_ , GLuint index_ , GLsizei bufSize_ , GLsizei * length_ , GLint * size_ , GLenum * type_ , GLchar * name_ ){
/* <command>
<proto>void <name>glGetActiveUniform</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="1"><ptype>GLint</ptype> *<name>size</name></param>
<param len="1"><ptype>GLenum</ptype> *<name>type</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETACTIVEUNIFORMPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETACTIVEUNIFORMPROC ) mygetprocaddr("glGetActiveUniform");
glfunc(program_, index_, bufSize_, length_, size_, type_, name_);
return;
}
void glGetActiveUniformBlockName (GLuint program_ , GLuint uniformBlockIndex_ , GLsizei bufSize_ , GLsizei * length_ , GLchar * uniformBlockName_ ){
/* <command>
<proto>void <name>glGetActiveUniformBlockName</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>uniformBlockIndex</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>uniformBlockName</name></param>
</command>
*/
static PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETACTIVEUNIFORMBLOCKNAMEPROC ) mygetprocaddr("glGetActiveUniformBlockName");
glfunc(program_, uniformBlockIndex_, bufSize_, length_, uniformBlockName_);
return;
}
void glGetActiveUniformBlockiv (GLuint program_ , GLuint uniformBlockIndex_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetActiveUniformBlockiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>uniformBlockIndex</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(program,uniformBlockIndex,pname)"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETACTIVEUNIFORMBLOCKIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETACTIVEUNIFORMBLOCKIVPROC ) mygetprocaddr("glGetActiveUniformBlockiv");
glfunc(program_, uniformBlockIndex_, pname_, params_);
return;
}
void glGetActiveUniformName (GLuint program_ , GLuint uniformIndex_ , GLsizei bufSize_ , GLsizei * length_ , GLchar * uniformName_ ){
/* <command>
<proto>void <name>glGetActiveUniformName</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>uniformIndex</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>uniformName</name></param>
</command>
*/
static PFNGLGETACTIVEUNIFORMNAMEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETACTIVEUNIFORMNAMEPROC ) mygetprocaddr("glGetActiveUniformName");
glfunc(program_, uniformIndex_, bufSize_, length_, uniformName_);
return;
}
void glGetActiveUniformsiv (GLuint program_ , GLsizei uniformCount_ , const GLuint * uniformIndices_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetActiveUniformsiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLsizei</ptype> <name>uniformCount</name></param>
<param len="uniformCount">const <ptype>GLuint</ptype> *<name>uniformIndices</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(uniformCount,pname)"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETACTIVEUNIFORMSIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETACTIVEUNIFORMSIVPROC ) mygetprocaddr("glGetActiveUniformsiv");
glfunc(program_, uniformCount_, uniformIndices_, pname_, params_);
return;
}
void glGetAttachedShaders (GLuint program_ , GLsizei maxCount_ , GLsizei * count_ , GLuint * shaders_ ){
/* <command>
<proto>void <name>glGetAttachedShaders</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLsizei</ptype> <name>maxCount</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>count</name></param>
<param len="maxCount"><ptype>GLuint</ptype> *<name>shaders</name></param>
</command>
*/
static PFNGLGETATTACHEDSHADERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETATTACHEDSHADERSPROC ) mygetprocaddr("glGetAttachedShaders");
glfunc(program_, maxCount_, count_, shaders_);
return;
}
GLint glGetAttribLocation (GLuint program_ , const GLchar * name_ ){
/* <command>
<proto><ptype>GLint</ptype> <name>glGetAttribLocation</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param>const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETATTRIBLOCATIONPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETATTRIBLOCATIONPROC ) mygetprocaddr("glGetAttribLocation");
GLint retval = glfunc(program_, name_);
return retval;
}
void glGetBooleani_v (GLenum target_ , GLuint index_ , GLboolean * data_ ){
/* <command>
<proto>void <name>glGetBooleani_v</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param group="Boolean" len="COMPSIZE(target)"><ptype>GLboolean</ptype> *<name>data</name></param>
</command>
*/
static PFNGLGETBOOLEANI_VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETBOOLEANI_VPROC ) mygetprocaddr("glGetBooleani_v");
glfunc(target_, index_, data_);
return;
}
void glGetBooleanv (GLenum pname_ , GLboolean * data_ ){
/* <command>
<proto>void <name>glGetBooleanv</name></proto>
<param group="GetPName"><ptype>GLenum</ptype> <name>pname</name></param>
<param group="Boolean" len="COMPSIZE(pname)"><ptype>GLboolean</ptype> *<name>data</name></param>
<glx opcode="112" type="single" />
</command>
*/
static PFNGLGETBOOLEANVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETBOOLEANVPROC ) mygetprocaddr("glGetBooleanv");
glfunc(pname_, data_);
return;
}
void glGetBufferParameteri64v (GLenum target_ , GLenum pname_ , GLint64 * params_ ){
/* <command>
<proto>void <name>glGetBufferParameteri64v</name></proto>
<param group="BufferTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
<param group="BufferPNameARB"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint64</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETBUFFERPARAMETERI64VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETBUFFERPARAMETERI64VPROC ) mygetprocaddr("glGetBufferParameteri64v");
glfunc(target_, pname_, params_);
return;
}
void glGetBufferParameteriv (GLenum target_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetBufferParameteriv</name></proto>
<param group="BufferTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
<param group="BufferPNameARB"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETBUFFERPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETBUFFERPARAMETERIVPROC ) mygetprocaddr("glGetBufferParameteriv");
glfunc(target_, pname_, params_);
return;
}
void glGetBufferPointerv (GLenum target_ , GLenum pname_ , void ** params_ ){
/* <command>
<proto>void <name>glGetBufferPointerv</name></proto>
<param group="BufferTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
<param group="BufferPointerNameARB"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="1">void **<name>params</name></param>
</command>
*/
static PFNGLGETBUFFERPOINTERVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETBUFFERPOINTERVPROC ) mygetprocaddr("glGetBufferPointerv");
glfunc(target_, pname_, params_);
return;
}
void glGetBufferSubData (GLenum target_ , GLintptr offset_ , GLsizeiptr size_ , void * data_ ){
/* <command>
<proto>void <name>glGetBufferSubData</name></proto>
<param group="BufferTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
<param len="size">void *<name>data</name></param>
</command>
*/
static PFNGLGETBUFFERSUBDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETBUFFERSUBDATAPROC ) mygetprocaddr("glGetBufferSubData");
glfunc(target_, offset_, size_, data_);
return;
}
void glGetCompressedTexImage (GLenum target_ , GLint level_ , void * img_ ){
/* <command>
<proto>void <name>glGetCompressedTexImage</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CompressedTextureARB" len="COMPSIZE(target,level)">void *<name>img</name></param>
<glx opcode="160" type="single" />
<glx comment="PBO protocol" name="glGetCompressedTexImagePBO" opcode="335" type="render" />
</command>
*/
static PFNGLGETCOMPRESSEDTEXIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETCOMPRESSEDTEXIMAGEPROC ) mygetprocaddr("glGetCompressedTexImage");
glfunc(target_, level_, img_);
return;
}
void glGetCompressedTextureImage (GLuint texture_ , GLint level_ , GLsizei bufSize_ , void * pixels_ ){
/* <command>
<proto>void <name>glGetCompressedTextureImage</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param>void *<name>pixels</name></param>
</command>
*/
static PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETCOMPRESSEDTEXTUREIMAGEPROC ) mygetprocaddr("glGetCompressedTextureImage");
glfunc(texture_, level_, bufSize_, pixels_);
return;
}
void glGetCompressedTextureSubImage (GLuint texture_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint zoffset_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ , GLsizei bufSize_ , void * pixels_ ){
/* <command>
<proto>void <name>glGetCompressedTextureSubImage</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLint</ptype> <name>zoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param>void *<name>pixels</name></param>
</command>
*/
static PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETCOMPRESSEDTEXTURESUBIMAGEPROC ) mygetprocaddr("glGetCompressedTextureSubImage");
glfunc(texture_, level_, xoffset_, yoffset_, zoffset_, width_, height_, depth_, bufSize_, pixels_);
return;
}
GLuint glGetDebugMessageLog (GLuint count_ , GLsizei bufSize_ , GLenum * sources_ , GLenum * types_ , GLuint * ids_ , GLenum * severities_ , GLsizei * lengths_ , GLchar * messageLog_ ){
/* <command>
<proto><ptype>GLuint</ptype> <name>glGetDebugMessageLog</name></proto>
<param><ptype>GLuint</ptype> <name>count</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="count"><ptype>GLenum</ptype> *<name>sources</name></param>
<param len="count"><ptype>GLenum</ptype> *<name>types</name></param>
<param len="count"><ptype>GLuint</ptype> *<name>ids</name></param>
<param len="count"><ptype>GLenum</ptype> *<name>severities</name></param>
<param len="count"><ptype>GLsizei</ptype> *<name>lengths</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>messageLog</name></param>
</command>
*/
static PFNGLGETDEBUGMESSAGELOGPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETDEBUGMESSAGELOGPROC ) mygetprocaddr("glGetDebugMessageLog");
GLuint retval = glfunc(count_, bufSize_, sources_, types_, ids_, severities_, lengths_, messageLog_);
return retval;
}
void glGetDoublei_v (GLenum target_ , GLuint index_ , GLdouble * data_ ){
/* <command>
<proto>void <name>glGetDoublei_v</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="COMPSIZE(target)"><ptype>GLdouble</ptype> *<name>data</name></param>
</command>
*/
static PFNGLGETDOUBLEI_VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETDOUBLEI_VPROC ) mygetprocaddr("glGetDoublei_v");
glfunc(target_, index_, data_);
return;
}
void glGetDoublev (GLenum pname_ , GLdouble * data_ ){
/* <command>
<proto>void <name>glGetDoublev</name></proto>
<param group="GetPName"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLdouble</ptype> *<name>data</name></param>
<glx opcode="114" type="single" />
</command>
*/
static PFNGLGETDOUBLEVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETDOUBLEVPROC ) mygetprocaddr("glGetDoublev");
glfunc(pname_, data_);
return;
}
GLenum glGetError (){
/* <command>
<proto group="ErrorCode"><ptype>GLenum</ptype> <name>glGetError</name></proto>
<glx opcode="115" type="single" />
</command>
*/
static PFNGLGETERRORPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETERRORPROC ) mygetprocaddr("glGetError");
GLenum retval = glfunc();
return retval;
}
void glGetFloati_v (GLenum target_ , GLuint index_ , GLfloat * data_ ){
/* <command>
<proto>void <name>glGetFloati_v</name></proto>
<param group="TypeEnum"><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="COMPSIZE(target)"><ptype>GLfloat</ptype> *<name>data</name></param>
</command>
*/
static PFNGLGETFLOATI_VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETFLOATI_VPROC ) mygetprocaddr("glGetFloati_v");
glfunc(target_, index_, data_);
return;
}
void glGetFloatv (GLenum pname_ , GLfloat * data_ ){
/* <command>
<proto>void <name>glGetFloatv</name></proto>
<param group="GetPName"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLfloat</ptype> *<name>data</name></param>
<glx opcode="116" type="single" />
</command>
*/
static PFNGLGETFLOATVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETFLOATVPROC ) mygetprocaddr("glGetFloatv");
glfunc(pname_, data_);
return;
}
GLint glGetFragDataIndex (GLuint program_ , const GLchar * name_ ){
/* <command>
<proto><ptype>GLint</ptype> <name>glGetFragDataIndex</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param>const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETFRAGDATAINDEXPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETFRAGDATAINDEXPROC ) mygetprocaddr("glGetFragDataIndex");
GLint retval = glfunc(program_, name_);
return retval;
}
GLint glGetFragDataLocation (GLuint program_ , const GLchar * name_ ){
/* <command>
<proto><ptype>GLint</ptype> <name>glGetFragDataLocation</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param len="COMPSIZE(name)">const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETFRAGDATALOCATIONPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETFRAGDATALOCATIONPROC ) mygetprocaddr("glGetFragDataLocation");
GLint retval = glfunc(program_, name_);
return retval;
}
void glGetFramebufferAttachmentParameteriv (GLenum target_ , GLenum attachment_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetFramebufferAttachmentParameteriv</name></proto>
<param group="FramebufferTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="FramebufferAttachment"><ptype>GLenum</ptype> <name>attachment</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="1428" type="vendor" />
</command>
*/
static PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETFRAMEBUFFERATTACHMENTPARAMETERIVPROC ) mygetprocaddr("glGetFramebufferAttachmentParameteriv");
glfunc(target_, attachment_, pname_, params_);
return;
}
void glGetFramebufferParameteriv (GLenum target_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetFramebufferParameteriv</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETFRAMEBUFFERPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETFRAMEBUFFERPARAMETERIVPROC ) mygetprocaddr("glGetFramebufferParameteriv");
glfunc(target_, pname_, params_);
return;
}
GLenum glGetGraphicsResetStatus (){
/* <command>
<proto><ptype>GLenum</ptype> <name>glGetGraphicsResetStatus</name></proto>
</command>
*/
static PFNGLGETGRAPHICSRESETSTATUSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETGRAPHICSRESETSTATUSPROC ) mygetprocaddr("glGetGraphicsResetStatus");
GLenum retval = glfunc();
return retval;
}
void glGetInteger64i_v (GLenum target_ , GLuint index_ , GLint64 * data_ ){
/* <command>
<proto>void <name>glGetInteger64i_v</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="COMPSIZE(target)"><ptype>GLint64</ptype> *<name>data</name></param>
</command>
*/
static PFNGLGETINTEGER64I_VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETINTEGER64I_VPROC ) mygetprocaddr("glGetInteger64i_v");
glfunc(target_, index_, data_);
return;
}
void glGetInteger64v (GLenum pname_ , GLint64 * data_ ){
/* <command>
<proto>void <name>glGetInteger64v</name></proto>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint64</ptype> *<name>data</name></param>
</command>
*/
static PFNGLGETINTEGER64VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETINTEGER64VPROC ) mygetprocaddr("glGetInteger64v");
glfunc(pname_, data_);
return;
}
void glGetIntegeri_v (GLenum target_ , GLuint index_ , GLint * data_ ){
/* <command>
<proto>void <name>glGetIntegeri_v</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="COMPSIZE(target)"><ptype>GLint</ptype> *<name>data</name></param>
</command>
*/
static PFNGLGETINTEGERI_VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETINTEGERI_VPROC ) mygetprocaddr("glGetIntegeri_v");
glfunc(target_, index_, data_);
return;
}
void glGetIntegerv (GLenum pname_ , GLint * data_ ){
/* <command>
<proto>void <name>glGetIntegerv</name></proto>
<param group="GetPName"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>data</name></param>
<glx opcode="117" type="single" />
</command>
*/
static PFNGLGETINTEGERVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETINTEGERVPROC ) mygetprocaddr("glGetIntegerv");
glfunc(pname_, data_);
return;
}
void glGetInternalformati64v (GLenum target_ , GLenum internalformat_ , GLenum pname_ , GLsizei bufSize_ , GLint64 * params_ ){
/* <command>
<proto>void <name>glGetInternalformati64v</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="bufSize"><ptype>GLint64</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETINTERNALFORMATI64VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETINTERNALFORMATI64VPROC ) mygetprocaddr("glGetInternalformati64v");
glfunc(target_, internalformat_, pname_, bufSize_, params_);
return;
}
void glGetInternalformativ (GLenum target_ , GLenum internalformat_ , GLenum pname_ , GLsizei bufSize_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetInternalformativ</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="bufSize"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETINTERNALFORMATIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETINTERNALFORMATIVPROC ) mygetprocaddr("glGetInternalformativ");
glfunc(target_, internalformat_, pname_, bufSize_, params_);
return;
}
void glGetMultisamplefv (GLenum pname_ , GLuint index_ , GLfloat * val_ ){
/* <command>
<proto>void <name>glGetMultisamplefv</name></proto>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="COMPSIZE(pname)"><ptype>GLfloat</ptype> *<name>val</name></param>
</command>
*/
static PFNGLGETMULTISAMPLEFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETMULTISAMPLEFVPROC ) mygetprocaddr("glGetMultisamplefv");
glfunc(pname_, index_, val_);
return;
}
void glGetNamedBufferParameteri64v (GLuint buffer_ , GLenum pname_ , GLint64 * params_ ){
/* <command>
<proto>void <name>glGetNamedBufferParameteri64v</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint64</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETNAMEDBUFFERPARAMETERI64VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNAMEDBUFFERPARAMETERI64VPROC ) mygetprocaddr("glGetNamedBufferParameteri64v");
glfunc(buffer_, pname_, params_);
return;
}
void glGetNamedBufferParameteriv (GLuint buffer_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetNamedBufferParameteriv</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETNAMEDBUFFERPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNAMEDBUFFERPARAMETERIVPROC ) mygetprocaddr("glGetNamedBufferParameteriv");
glfunc(buffer_, pname_, params_);
return;
}
void glGetNamedBufferPointerv (GLuint buffer_ , GLenum pname_ , void ** params_ ){
/* <command>
<proto>void <name>glGetNamedBufferPointerv</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param>void **<name>params</name></param>
</command>
*/
static PFNGLGETNAMEDBUFFERPOINTERVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNAMEDBUFFERPOINTERVPROC ) mygetprocaddr("glGetNamedBufferPointerv");
glfunc(buffer_, pname_, params_);
return;
}
void glGetNamedBufferSubData (GLuint buffer_ , GLintptr offset_ , GLsizeiptr size_ , void * data_ ){
/* <command>
<proto>void <name>glGetNamedBufferSubData</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
<param>void *<name>data</name></param>
</command>
*/
static PFNGLGETNAMEDBUFFERSUBDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNAMEDBUFFERSUBDATAPROC ) mygetprocaddr("glGetNamedBufferSubData");
glfunc(buffer_, offset_, size_, data_);
return;
}
void glGetNamedFramebufferAttachmentParameteriv (GLuint framebuffer_ , GLenum attachment_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetNamedFramebufferAttachmentParameteriv</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>attachment</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNAMEDFRAMEBUFFERATTACHMENTPARAMETERIVPROC ) mygetprocaddr("glGetNamedFramebufferAttachmentParameteriv");
glfunc(framebuffer_, attachment_, pname_, params_);
return;
}
void glGetNamedFramebufferParameteriv (GLuint framebuffer_ , GLenum pname_ , GLint * param_ ){
/* <command>
<proto>void <name>glGetNamedFramebufferParameteriv</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> *<name>param</name></param>
</command>
*/
static PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNAMEDFRAMEBUFFERPARAMETERIVPROC ) mygetprocaddr("glGetNamedFramebufferParameteriv");
glfunc(framebuffer_, pname_, param_);
return;
}
void glGetNamedRenderbufferParameteriv (GLuint renderbuffer_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetNamedRenderbufferParameteriv</name></proto>
<param><ptype>GLuint</ptype> <name>renderbuffer</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNAMEDRENDERBUFFERPARAMETERIVPROC ) mygetprocaddr("glGetNamedRenderbufferParameteriv");
glfunc(renderbuffer_, pname_, params_);
return;
}
void glGetObjectLabel (GLenum identifier_ , GLuint name_ , GLsizei bufSize_ , GLsizei * length_ , GLchar * label_ ){
/* <command>
<proto>void <name>glGetObjectLabel</name></proto>
<param><ptype>GLenum</ptype> <name>identifier</name></param>
<param><ptype>GLuint</ptype> <name>name</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>label</name></param>
</command>
*/
static PFNGLGETOBJECTLABELPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETOBJECTLABELPROC ) mygetprocaddr("glGetObjectLabel");
glfunc(identifier_, name_, bufSize_, length_, label_);
return;
}
void glGetObjectPtrLabel (const void * ptr_ , GLsizei bufSize_ , GLsizei * length_ , GLchar * label_ ){
/* <command>
<proto>void <name>glGetObjectPtrLabel</name></proto>
<param>const void *<name>ptr</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>label</name></param>
</command>
*/
static PFNGLGETOBJECTPTRLABELPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETOBJECTPTRLABELPROC ) mygetprocaddr("glGetObjectPtrLabel");
glfunc(ptr_, bufSize_, length_, label_);
return;
}
void glGetProgramBinary (GLuint program_ , GLsizei bufSize_ , GLsizei * length_ , GLenum * binaryFormat_ , void * binary_ ){
/* <command>
<proto>void <name>glGetProgramBinary</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="1"><ptype>GLenum</ptype> *<name>binaryFormat</name></param>
<param len="bufSize">void *<name>binary</name></param>
</command>
*/
static PFNGLGETPROGRAMBINARYPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMBINARYPROC ) mygetprocaddr("glGetProgramBinary");
glfunc(program_, bufSize_, length_, binaryFormat_, binary_);
return;
}
void glGetProgramInfoLog (GLuint program_ , GLsizei bufSize_ , GLsizei * length_ , GLchar * infoLog_ ){
/* <command>
<proto>void <name>glGetProgramInfoLog</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>infoLog</name></param>
<glx opcode="201" type="single" />
</command>
*/
static PFNGLGETPROGRAMINFOLOGPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMINFOLOGPROC ) mygetprocaddr("glGetProgramInfoLog");
glfunc(program_, bufSize_, length_, infoLog_);
return;
}
void glGetProgramInterfaceiv (GLuint program_ , GLenum programInterface_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetProgramInterfaceiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>programInterface</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETPROGRAMINTERFACEIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMINTERFACEIVPROC ) mygetprocaddr("glGetProgramInterfaceiv");
glfunc(program_, programInterface_, pname_, params_);
return;
}
void glGetProgramPipelineInfoLog (GLuint pipeline_ , GLsizei bufSize_ , GLsizei * length_ , GLchar * infoLog_ ){
/* <command>
<proto>void <name>glGetProgramPipelineInfoLog</name></proto>
<param><ptype>GLuint</ptype> <name>pipeline</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>infoLog</name></param>
</command>
*/
static PFNGLGETPROGRAMPIPELINEINFOLOGPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMPIPELINEINFOLOGPROC ) mygetprocaddr("glGetProgramPipelineInfoLog");
glfunc(pipeline_, bufSize_, length_, infoLog_);
return;
}
void glGetProgramPipelineiv (GLuint pipeline_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetProgramPipelineiv</name></proto>
<param><ptype>GLuint</ptype> <name>pipeline</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETPROGRAMPIPELINEIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMPIPELINEIVPROC ) mygetprocaddr("glGetProgramPipelineiv");
glfunc(pipeline_, pname_, params_);
return;
}
GLuint glGetProgramResourceIndex (GLuint program_ , GLenum programInterface_ , const GLchar * name_ ){
/* <command>
<proto><ptype>GLuint</ptype> <name>glGetProgramResourceIndex</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>programInterface</name></param>
<param len="COMPSIZE(name)">const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETPROGRAMRESOURCEINDEXPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMRESOURCEINDEXPROC ) mygetprocaddr("glGetProgramResourceIndex");
GLuint retval = glfunc(program_, programInterface_, name_);
return retval;
}
GLint glGetProgramResourceLocation (GLuint program_ , GLenum programInterface_ , const GLchar * name_ ){
/* <command>
<proto><ptype>GLint</ptype> <name>glGetProgramResourceLocation</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>programInterface</name></param>
<param len="COMPSIZE(name)">const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETPROGRAMRESOURCELOCATIONPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMRESOURCELOCATIONPROC ) mygetprocaddr("glGetProgramResourceLocation");
GLint retval = glfunc(program_, programInterface_, name_);
return retval;
}
GLint glGetProgramResourceLocationIndex (GLuint program_ , GLenum programInterface_ , const GLchar * name_ ){
/* <command>
<proto><ptype>GLint</ptype> <name>glGetProgramResourceLocationIndex</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>programInterface</name></param>
<param len="COMPSIZE(name)">const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMRESOURCELOCATIONINDEXPROC ) mygetprocaddr("glGetProgramResourceLocationIndex");
GLint retval = glfunc(program_, programInterface_, name_);
return retval;
}
void glGetProgramResourceName (GLuint program_ , GLenum programInterface_ , GLuint index_ , GLsizei bufSize_ , GLsizei * length_ , GLchar * name_ ){
/* <command>
<proto>void <name>glGetProgramResourceName</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>programInterface</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETPROGRAMRESOURCENAMEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMRESOURCENAMEPROC ) mygetprocaddr("glGetProgramResourceName");
glfunc(program_, programInterface_, index_, bufSize_, length_, name_);
return;
}
void glGetProgramResourceiv (GLuint program_ , GLenum programInterface_ , GLuint index_ , GLsizei propCount_ , const GLenum * props_ , GLsizei bufSize_ , GLsizei * length_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetProgramResourceiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>programInterface</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLsizei</ptype> <name>propCount</name></param>
<param len="propCount">const <ptype>GLenum</ptype> *<name>props</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufSize"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETPROGRAMRESOURCEIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMRESOURCEIVPROC ) mygetprocaddr("glGetProgramResourceiv");
glfunc(program_, programInterface_, index_, propCount_, props_, bufSize_, length_, params_);
return;
}
void glGetProgramStageiv (GLuint program_ , GLenum shadertype_ , GLenum pname_ , GLint * values_ ){
/* <command>
<proto>void <name>glGetProgramStageiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>shadertype</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="1"><ptype>GLint</ptype> *<name>values</name></param>
</command>
*/
static PFNGLGETPROGRAMSTAGEIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMSTAGEIVPROC ) mygetprocaddr("glGetProgramStageiv");
glfunc(program_, shadertype_, pname_, values_);
return;
}
void glGetProgramiv (GLuint program_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetProgramiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="199" type="single" />
</command>
*/
static PFNGLGETPROGRAMIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETPROGRAMIVPROC ) mygetprocaddr("glGetProgramiv");
glfunc(program_, pname_, params_);
return;
}
void glGetQueryBufferObjecti64v (GLuint id_ , GLuint buffer_ , GLenum pname_ , GLintptr offset_ ){
/* <command>
<proto>void <name>glGetQueryBufferObjecti64v</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
</command>
*/
static PFNGLGETQUERYBUFFEROBJECTI64VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETQUERYBUFFEROBJECTI64VPROC ) mygetprocaddr("glGetQueryBufferObjecti64v");
glfunc(id_, buffer_, pname_, offset_);
return;
}
void glGetQueryBufferObjectiv (GLuint id_ , GLuint buffer_ , GLenum pname_ , GLintptr offset_ ){
/* <command>
<proto>void <name>glGetQueryBufferObjectiv</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
</command>
*/
static PFNGLGETQUERYBUFFEROBJECTIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETQUERYBUFFEROBJECTIVPROC ) mygetprocaddr("glGetQueryBufferObjectiv");
glfunc(id_, buffer_, pname_, offset_);
return;
}
void glGetQueryBufferObjectui64v (GLuint id_ , GLuint buffer_ , GLenum pname_ , GLintptr offset_ ){
/* <command>
<proto>void <name>glGetQueryBufferObjectui64v</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
</command>
*/
static PFNGLGETQUERYBUFFEROBJECTUI64VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETQUERYBUFFEROBJECTUI64VPROC ) mygetprocaddr("glGetQueryBufferObjectui64v");
glfunc(id_, buffer_, pname_, offset_);
return;
}
void glGetQueryBufferObjectuiv (GLuint id_ , GLuint buffer_ , GLenum pname_ , GLintptr offset_ ){
/* <command>
<proto>void <name>glGetQueryBufferObjectuiv</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
</command>
*/
static PFNGLGETQUERYBUFFEROBJECTUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETQUERYBUFFEROBJECTUIVPROC ) mygetprocaddr("glGetQueryBufferObjectuiv");
glfunc(id_, buffer_, pname_, offset_);
return;
}
void glGetQueryIndexediv (GLenum target_ , GLuint index_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetQueryIndexediv</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETQUERYINDEXEDIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETQUERYINDEXEDIVPROC ) mygetprocaddr("glGetQueryIndexediv");
glfunc(target_, index_, pname_, params_);
return;
}
void glGetQueryObjecti64v (GLuint id_ , GLenum pname_ , GLint64 * params_ ){
/* <command>
<proto>void <name>glGetQueryObjecti64v</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint64</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETQUERYOBJECTI64VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETQUERYOBJECTI64VPROC ) mygetprocaddr("glGetQueryObjecti64v");
glfunc(id_, pname_, params_);
return;
}
void glGetQueryObjectiv (GLuint id_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetQueryObjectiv</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="165" type="single" />
</command>
*/
static PFNGLGETQUERYOBJECTIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETQUERYOBJECTIVPROC ) mygetprocaddr("glGetQueryObjectiv");
glfunc(id_, pname_, params_);
return;
}
void glGetQueryObjectui64v (GLuint id_ , GLenum pname_ , GLuint64 * params_ ){
/* <command>
<proto>void <name>glGetQueryObjectui64v</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLuint64</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETQUERYOBJECTUI64VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETQUERYOBJECTUI64VPROC ) mygetprocaddr("glGetQueryObjectui64v");
glfunc(id_, pname_, params_);
return;
}
void glGetQueryObjectuiv (GLuint id_ , GLenum pname_ , GLuint * params_ ){
/* <command>
<proto>void <name>glGetQueryObjectuiv</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLuint</ptype> *<name>params</name></param>
<glx opcode="166" type="single" />
</command>
*/
static PFNGLGETQUERYOBJECTUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETQUERYOBJECTUIVPROC ) mygetprocaddr("glGetQueryObjectuiv");
glfunc(id_, pname_, params_);
return;
}
void glGetQueryiv (GLenum target_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetQueryiv</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="164" type="single" />
</command>
*/
static PFNGLGETQUERYIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETQUERYIVPROC ) mygetprocaddr("glGetQueryiv");
glfunc(target_, pname_, params_);
return;
}
void glGetRenderbufferParameteriv (GLenum target_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetRenderbufferParameteriv</name></proto>
<param group="RenderbufferTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="1424" type="vendor" />
</command>
*/
static PFNGLGETRENDERBUFFERPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETRENDERBUFFERPARAMETERIVPROC ) mygetprocaddr("glGetRenderbufferParameteriv");
glfunc(target_, pname_, params_);
return;
}
void glGetSamplerParameterIiv (GLuint sampler_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetSamplerParameterIiv</name></proto>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETSAMPLERPARAMETERIIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSAMPLERPARAMETERIIVPROC ) mygetprocaddr("glGetSamplerParameterIiv");
glfunc(sampler_, pname_, params_);
return;
}
void glGetSamplerParameterIuiv (GLuint sampler_ , GLenum pname_ , GLuint * params_ ){
/* <command>
<proto>void <name>glGetSamplerParameterIuiv</name></proto>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLuint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETSAMPLERPARAMETERIUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSAMPLERPARAMETERIUIVPROC ) mygetprocaddr("glGetSamplerParameterIuiv");
glfunc(sampler_, pname_, params_);
return;
}
void glGetSamplerParameterfv (GLuint sampler_ , GLenum pname_ , GLfloat * params_ ){
/* <command>
<proto>void <name>glGetSamplerParameterfv</name></proto>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLfloat</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETSAMPLERPARAMETERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSAMPLERPARAMETERFVPROC ) mygetprocaddr("glGetSamplerParameterfv");
glfunc(sampler_, pname_, params_);
return;
}
void glGetSamplerParameteriv (GLuint sampler_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetSamplerParameteriv</name></proto>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETSAMPLERPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSAMPLERPARAMETERIVPROC ) mygetprocaddr("glGetSamplerParameteriv");
glfunc(sampler_, pname_, params_);
return;
}
void glGetShaderInfoLog (GLuint shader_ , GLsizei bufSize_ , GLsizei * length_ , GLchar * infoLog_ ){
/* <command>
<proto>void <name>glGetShaderInfoLog</name></proto>
<param><ptype>GLuint</ptype> <name>shader</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>infoLog</name></param>
<glx opcode="200" type="single" />
</command>
*/
static PFNGLGETSHADERINFOLOGPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSHADERINFOLOGPROC ) mygetprocaddr("glGetShaderInfoLog");
glfunc(shader_, bufSize_, length_, infoLog_);
return;
}
void glGetShaderPrecisionFormat (GLenum shadertype_ , GLenum precisiontype_ , GLint * range_ , GLint * precision_ ){
/* <command>
<proto>void <name>glGetShaderPrecisionFormat</name></proto>
<param><ptype>GLenum</ptype> <name>shadertype</name></param>
<param><ptype>GLenum</ptype> <name>precisiontype</name></param>
<param len="2"><ptype>GLint</ptype> *<name>range</name></param>
<param len="2"><ptype>GLint</ptype> *<name>precision</name></param>
</command>
*/
static PFNGLGETSHADERPRECISIONFORMATPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSHADERPRECISIONFORMATPROC ) mygetprocaddr("glGetShaderPrecisionFormat");
glfunc(shadertype_, precisiontype_, range_, precision_);
return;
}
void glGetShaderSource (GLuint shader_ , GLsizei bufSize_ , GLsizei * length_ , GLchar * source_ ){
/* <command>
<proto>void <name>glGetShaderSource</name></proto>
<param><ptype>GLuint</ptype> <name>shader</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>source</name></param>
</command>
*/
static PFNGLGETSHADERSOURCEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSHADERSOURCEPROC ) mygetprocaddr("glGetShaderSource");
glfunc(shader_, bufSize_, length_, source_);
return;
}
void glGetShaderiv (GLuint shader_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetShaderiv</name></proto>
<param><ptype>GLuint</ptype> <name>shader</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="198" type="single" />
</command>
*/
static PFNGLGETSHADERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSHADERIVPROC ) mygetprocaddr("glGetShaderiv");
glfunc(shader_, pname_, params_);
return;
}
const GLubyte * glGetString (GLenum name_ ){
/* <command>
<proto group="String">const <ptype>GLubyte</ptype> *<name>glGetString</name></proto>
<param group="StringName"><ptype>GLenum</ptype> <name>name</name></param>
<glx opcode="129" type="single" />
</command>
*/
static PFNGLGETSTRINGPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSTRINGPROC ) mygetprocaddr("glGetString");
const GLubyte * retval = glfunc(name_);
return retval;
}
const GLubyte * glGetStringi (GLenum name_ , GLuint index_ ){
/* <command>
<proto group="String">const <ptype>GLubyte</ptype> *<name>glGetStringi</name></proto>
<param><ptype>GLenum</ptype> <name>name</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
</command>
*/
static PFNGLGETSTRINGIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSTRINGIPROC ) mygetprocaddr("glGetStringi");
const GLubyte * retval = glfunc(name_, index_);
return retval;
}
GLuint glGetSubroutineIndex (GLuint program_ , GLenum shadertype_ , const GLchar * name_ ){
/* <command>
<proto><ptype>GLuint</ptype> <name>glGetSubroutineIndex</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>shadertype</name></param>
<param>const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETSUBROUTINEINDEXPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSUBROUTINEINDEXPROC ) mygetprocaddr("glGetSubroutineIndex");
GLuint retval = glfunc(program_, shadertype_, name_);
return retval;
}
GLint glGetSubroutineUniformLocation (GLuint program_ , GLenum shadertype_ , const GLchar * name_ ){
/* <command>
<proto><ptype>GLint</ptype> <name>glGetSubroutineUniformLocation</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>shadertype</name></param>
<param>const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSUBROUTINEUNIFORMLOCATIONPROC ) mygetprocaddr("glGetSubroutineUniformLocation");
GLint retval = glfunc(program_, shadertype_, name_);
return retval;
}
void glGetSynciv (GLsync sync_ , GLenum pname_ , GLsizei bufSize_ , GLsizei * length_ , GLint * values_ ){
/* <command>
<proto>void <name>glGetSynciv</name></proto>
<param group="sync"><ptype>GLsync</ptype> <name>sync</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="bufSize"><ptype>GLint</ptype> *<name>values</name></param>
</command>
*/
static PFNGLGETSYNCIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETSYNCIVPROC ) mygetprocaddr("glGetSynciv");
glfunc(sync_, pname_, bufSize_, length_, values_);
return;
}
void glGetTexImage (GLenum target_ , GLint level_ , GLenum format_ , GLenum type_ , void * pixels_ ){
/* <command>
<proto>void <name>glGetTexImage</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param group="PixelType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(target,level,format,type)">void *<name>pixels</name></param>
<glx opcode="135" type="single" />
<glx comment="PBO protocol" name="glGetTexImagePBO" opcode="344" type="render" />
</command>
*/
static PFNGLGETTEXIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXIMAGEPROC ) mygetprocaddr("glGetTexImage");
glfunc(target_, level_, format_, type_, pixels_);
return;
}
void glGetTexLevelParameterfv (GLenum target_ , GLint level_ , GLenum pname_ , GLfloat * params_ ){
/* <command>
<proto>void <name>glGetTexLevelParameterfv</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="GetTextureParameter"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLfloat</ptype> *<name>params</name></param>
<glx opcode="138" type="single" />
</command>
*/
static PFNGLGETTEXLEVELPARAMETERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXLEVELPARAMETERFVPROC ) mygetprocaddr("glGetTexLevelParameterfv");
glfunc(target_, level_, pname_, params_);
return;
}
void glGetTexLevelParameteriv (GLenum target_ , GLint level_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetTexLevelParameteriv</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="GetTextureParameter"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="139" type="single" />
</command>
*/
static PFNGLGETTEXLEVELPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXLEVELPARAMETERIVPROC ) mygetprocaddr("glGetTexLevelParameteriv");
glfunc(target_, level_, pname_, params_);
return;
}
void glGetTexParameterIiv (GLenum target_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetTexParameterIiv</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="GetTextureParameter"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="203" type="single" />
</command>
*/
static PFNGLGETTEXPARAMETERIIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXPARAMETERIIVPROC ) mygetprocaddr("glGetTexParameterIiv");
glfunc(target_, pname_, params_);
return;
}
void glGetTexParameterIuiv (GLenum target_ , GLenum pname_ , GLuint * params_ ){
/* <command>
<proto>void <name>glGetTexParameterIuiv</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="GetTextureParameter"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLuint</ptype> *<name>params</name></param>
<glx opcode="204" type="single" />
</command>
*/
static PFNGLGETTEXPARAMETERIUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXPARAMETERIUIVPROC ) mygetprocaddr("glGetTexParameterIuiv");
glfunc(target_, pname_, params_);
return;
}
void glGetTexParameterfv (GLenum target_ , GLenum pname_ , GLfloat * params_ ){
/* <command>
<proto>void <name>glGetTexParameterfv</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="GetTextureParameter"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLfloat</ptype> *<name>params</name></param>
<glx opcode="136" type="single" />
</command>
*/
static PFNGLGETTEXPARAMETERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXPARAMETERFVPROC ) mygetprocaddr("glGetTexParameterfv");
glfunc(target_, pname_, params_);
return;
}
void glGetTexParameteriv (GLenum target_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetTexParameteriv</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="GetTextureParameter"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="137" type="single" />
</command>
*/
static PFNGLGETTEXPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXPARAMETERIVPROC ) mygetprocaddr("glGetTexParameteriv");
glfunc(target_, pname_, params_);
return;
}
void glGetTextureImage (GLuint texture_ , GLint level_ , GLenum format_ , GLenum type_ , GLsizei bufSize_ , void * pixels_ ){
/* <command>
<proto>void <name>glGetTextureImage</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param>void *<name>pixels</name></param>
</command>
*/
static PFNGLGETTEXTUREIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXTUREIMAGEPROC ) mygetprocaddr("glGetTextureImage");
glfunc(texture_, level_, format_, type_, bufSize_, pixels_);
return;
}
void glGetTextureLevelParameterfv (GLuint texture_ , GLint level_ , GLenum pname_ , GLfloat * params_ ){
/* <command>
<proto>void <name>glGetTextureLevelParameterfv</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLfloat</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETTEXTURELEVELPARAMETERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXTURELEVELPARAMETERFVPROC ) mygetprocaddr("glGetTextureLevelParameterfv");
glfunc(texture_, level_, pname_, params_);
return;
}
void glGetTextureLevelParameteriv (GLuint texture_ , GLint level_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetTextureLevelParameteriv</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETTEXTURELEVELPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXTURELEVELPARAMETERIVPROC ) mygetprocaddr("glGetTextureLevelParameteriv");
glfunc(texture_, level_, pname_, params_);
return;
}
void glGetTextureParameterIiv (GLuint texture_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetTextureParameterIiv</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETTEXTUREPARAMETERIIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXTUREPARAMETERIIVPROC ) mygetprocaddr("glGetTextureParameterIiv");
glfunc(texture_, pname_, params_);
return;
}
void glGetTextureParameterIuiv (GLuint texture_ , GLenum pname_ , GLuint * params_ ){
/* <command>
<proto>void <name>glGetTextureParameterIuiv</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLuint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETTEXTUREPARAMETERIUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXTUREPARAMETERIUIVPROC ) mygetprocaddr("glGetTextureParameterIuiv");
glfunc(texture_, pname_, params_);
return;
}
void glGetTextureParameterfv (GLuint texture_ , GLenum pname_ , GLfloat * params_ ){
/* <command>
<proto>void <name>glGetTextureParameterfv</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLfloat</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETTEXTUREPARAMETERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXTUREPARAMETERFVPROC ) mygetprocaddr("glGetTextureParameterfv");
glfunc(texture_, pname_, params_);
return;
}
void glGetTextureParameteriv (GLuint texture_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetTextureParameteriv</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETTEXTUREPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXTUREPARAMETERIVPROC ) mygetprocaddr("glGetTextureParameteriv");
glfunc(texture_, pname_, params_);
return;
}
void glGetTextureSubImage (GLuint texture_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint zoffset_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ , GLenum format_ , GLenum type_ , GLsizei bufSize_ , void * pixels_ ){
/* <command>
<proto>void <name>glGetTextureSubImage</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLint</ptype> <name>zoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param>void *<name>pixels</name></param>
</command>
*/
static PFNGLGETTEXTURESUBIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTEXTURESUBIMAGEPROC ) mygetprocaddr("glGetTextureSubImage");
glfunc(texture_, level_, xoffset_, yoffset_, zoffset_, width_, height_, depth_, format_, type_, bufSize_, pixels_);
return;
}
void glGetTransformFeedbackVarying (GLuint program_ , GLuint index_ , GLsizei bufSize_ , GLsizei * length_ , GLsizei * size_ , GLenum * type_ , GLchar * name_ ){
/* <command>
<proto>void <name>glGetTransformFeedbackVarying</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>length</name></param>
<param len="1"><ptype>GLsizei</ptype> *<name>size</name></param>
<param len="1"><ptype>GLenum</ptype> *<name>type</name></param>
<param len="bufSize"><ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETTRANSFORMFEEDBACKVARYINGPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTRANSFORMFEEDBACKVARYINGPROC ) mygetprocaddr("glGetTransformFeedbackVarying");
glfunc(program_, index_, bufSize_, length_, size_, type_, name_);
return;
}
void glGetTransformFeedbacki64_v (GLuint xfb_ , GLenum pname_ , GLuint index_ , GLint64 * param_ ){
/* <command>
<proto>void <name>glGetTransformFeedbacki64_v</name></proto>
<param><ptype>GLuint</ptype> <name>xfb</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLint64</ptype> *<name>param</name></param>
</command>
*/
static PFNGLGETTRANSFORMFEEDBACKI64_VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTRANSFORMFEEDBACKI64_VPROC ) mygetprocaddr("glGetTransformFeedbacki64_v");
glfunc(xfb_, pname_, index_, param_);
return;
}
void glGetTransformFeedbacki_v (GLuint xfb_ , GLenum pname_ , GLuint index_ , GLint * param_ ){
/* <command>
<proto>void <name>glGetTransformFeedbacki_v</name></proto>
<param><ptype>GLuint</ptype> <name>xfb</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLint</ptype> *<name>param</name></param>
</command>
*/
static PFNGLGETTRANSFORMFEEDBACKI_VPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTRANSFORMFEEDBACKI_VPROC ) mygetprocaddr("glGetTransformFeedbacki_v");
glfunc(xfb_, pname_, index_, param_);
return;
}
void glGetTransformFeedbackiv (GLuint xfb_ , GLenum pname_ , GLint * param_ ){
/* <command>
<proto>void <name>glGetTransformFeedbackiv</name></proto>
<param><ptype>GLuint</ptype> <name>xfb</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> *<name>param</name></param>
</command>
*/
static PFNGLGETTRANSFORMFEEDBACKIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETTRANSFORMFEEDBACKIVPROC ) mygetprocaddr("glGetTransformFeedbackiv");
glfunc(xfb_, pname_, param_);
return;
}
GLuint glGetUniformBlockIndex (GLuint program_ , const GLchar * uniformBlockName_ ){
/* <command>
<proto><ptype>GLuint</ptype> <name>glGetUniformBlockIndex</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param len="COMPSIZE()">const <ptype>GLchar</ptype> *<name>uniformBlockName</name></param>
</command>
*/
static PFNGLGETUNIFORMBLOCKINDEXPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETUNIFORMBLOCKINDEXPROC ) mygetprocaddr("glGetUniformBlockIndex");
GLuint retval = glfunc(program_, uniformBlockName_);
return retval;
}
void glGetUniformIndices (GLuint program_ , GLsizei uniformCount_ , const GLchar ** uniformNames_ , GLuint * uniformIndices_ ){
/* <command>
<proto>void <name>glGetUniformIndices</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLsizei</ptype> <name>uniformCount</name></param>
<param len="COMPSIZE(uniformCount)">const <ptype>GLchar</ptype> *const*<name>uniformNames</name></param>
<param len="COMPSIZE(uniformCount)"><ptype>GLuint</ptype> *<name>uniformIndices</name></param>
</command>
*/
static PFNGLGETUNIFORMINDICESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETUNIFORMINDICESPROC ) mygetprocaddr("glGetUniformIndices");
glfunc(program_, uniformCount_, uniformNames_, uniformIndices_);
return;
}
GLint glGetUniformLocation (GLuint program_ , const GLchar * name_ ){
/* <command>
<proto><ptype>GLint</ptype> <name>glGetUniformLocation</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param>const <ptype>GLchar</ptype> *<name>name</name></param>
</command>
*/
static PFNGLGETUNIFORMLOCATIONPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETUNIFORMLOCATIONPROC ) mygetprocaddr("glGetUniformLocation");
GLint retval = glfunc(program_, name_);
return retval;
}
void glGetUniformSubroutineuiv (GLenum shadertype_ , GLint location_ , GLuint * params_ ){
/* <command>
<proto>void <name>glGetUniformSubroutineuiv</name></proto>
<param><ptype>GLenum</ptype> <name>shadertype</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param len="1"><ptype>GLuint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETUNIFORMSUBROUTINEUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETUNIFORMSUBROUTINEUIVPROC ) mygetprocaddr("glGetUniformSubroutineuiv");
glfunc(shadertype_, location_, params_);
return;
}
void glGetUniformdv (GLuint program_ , GLint location_ , GLdouble * params_ ){
/* <command>
<proto>void <name>glGetUniformdv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param len="COMPSIZE(program,location)"><ptype>GLdouble</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETUNIFORMDVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETUNIFORMDVPROC ) mygetprocaddr("glGetUniformdv");
glfunc(program_, location_, params_);
return;
}
void glGetUniformfv (GLuint program_ , GLint location_ , GLfloat * params_ ){
/* <command>
<proto>void <name>glGetUniformfv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param len="COMPSIZE(program,location)"><ptype>GLfloat</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETUNIFORMFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETUNIFORMFVPROC ) mygetprocaddr("glGetUniformfv");
glfunc(program_, location_, params_);
return;
}
void glGetUniformiv (GLuint program_ , GLint location_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetUniformiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param len="COMPSIZE(program,location)"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETUNIFORMIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETUNIFORMIVPROC ) mygetprocaddr("glGetUniformiv");
glfunc(program_, location_, params_);
return;
}
void glGetUniformuiv (GLuint program_ , GLint location_ , GLuint * params_ ){
/* <command>
<proto>void <name>glGetUniformuiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param len="COMPSIZE(program,location)"><ptype>GLuint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETUNIFORMUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETUNIFORMUIVPROC ) mygetprocaddr("glGetUniformuiv");
glfunc(program_, location_, params_);
return;
}
void glGetVertexArrayIndexed64iv (GLuint vaobj_ , GLuint index_ , GLenum pname_ , GLint64 * param_ ){
/* <command>
<proto>void <name>glGetVertexArrayIndexed64iv</name></proto>
<param><ptype>GLuint</ptype> <name>vaobj</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint64</ptype> *<name>param</name></param>
</command>
*/
static PFNGLGETVERTEXARRAYINDEXED64IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETVERTEXARRAYINDEXED64IVPROC ) mygetprocaddr("glGetVertexArrayIndexed64iv");
glfunc(vaobj_, index_, pname_, param_);
return;
}
void glGetVertexArrayIndexediv (GLuint vaobj_ , GLuint index_ , GLenum pname_ , GLint * param_ ){
/* <command>
<proto>void <name>glGetVertexArrayIndexediv</name></proto>
<param><ptype>GLuint</ptype> <name>vaobj</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> *<name>param</name></param>
</command>
*/
static PFNGLGETVERTEXARRAYINDEXEDIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETVERTEXARRAYINDEXEDIVPROC ) mygetprocaddr("glGetVertexArrayIndexediv");
glfunc(vaobj_, index_, pname_, param_);
return;
}
void glGetVertexArrayiv (GLuint vaobj_ , GLenum pname_ , GLint * param_ ){
/* <command>
<proto>void <name>glGetVertexArrayiv</name></proto>
<param><ptype>GLuint</ptype> <name>vaobj</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> *<name>param</name></param>
</command>
*/
static PFNGLGETVERTEXARRAYIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETVERTEXARRAYIVPROC ) mygetprocaddr("glGetVertexArrayiv");
glfunc(vaobj_, pname_, param_);
return;
}
void glGetVertexAttribIiv (GLuint index_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetVertexAttribIiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param group="VertexAttribEnum"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="1"><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETVERTEXATTRIBIIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETVERTEXATTRIBIIVPROC ) mygetprocaddr("glGetVertexAttribIiv");
glfunc(index_, pname_, params_);
return;
}
void glGetVertexAttribIuiv (GLuint index_ , GLenum pname_ , GLuint * params_ ){
/* <command>
<proto>void <name>glGetVertexAttribIuiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param group="VertexAttribEnum"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="1"><ptype>GLuint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETVERTEXATTRIBIUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETVERTEXATTRIBIUIVPROC ) mygetprocaddr("glGetVertexAttribIuiv");
glfunc(index_, pname_, params_);
return;
}
void glGetVertexAttribLdv (GLuint index_ , GLenum pname_ , GLdouble * params_ ){
/* <command>
<proto>void <name>glGetVertexAttribLdv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)"><ptype>GLdouble</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETVERTEXATTRIBLDVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETVERTEXATTRIBLDVPROC ) mygetprocaddr("glGetVertexAttribLdv");
glfunc(index_, pname_, params_);
return;
}
void glGetVertexAttribPointerv (GLuint index_ , GLenum pname_ , void ** pointer_ ){
/* <command>
<proto>void <name>glGetVertexAttribPointerv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param group="VertexAttribPointerPropertyARB"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="1">void **<name>pointer</name></param>
<glx opcode="209" type="single" />
</command>
*/
static PFNGLGETVERTEXATTRIBPOINTERVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETVERTEXATTRIBPOINTERVPROC ) mygetprocaddr("glGetVertexAttribPointerv");
glfunc(index_, pname_, pointer_);
return;
}
void glGetVertexAttribdv (GLuint index_ , GLenum pname_ , GLdouble * params_ ){
/* <command>
<proto>void <name>glGetVertexAttribdv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param group="VertexAttribPropertyARB"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="4"><ptype>GLdouble</ptype> *<name>params</name></param>
<glx opcode="1301" type="vendor" />
</command>
*/
static PFNGLGETVERTEXATTRIBDVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETVERTEXATTRIBDVPROC ) mygetprocaddr("glGetVertexAttribdv");
glfunc(index_, pname_, params_);
return;
}
void glGetVertexAttribfv (GLuint index_ , GLenum pname_ , GLfloat * params_ ){
/* <command>
<proto>void <name>glGetVertexAttribfv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param group="VertexAttribPropertyARB"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="4"><ptype>GLfloat</ptype> *<name>params</name></param>
<glx opcode="1302" type="vendor" />
</command>
*/
static PFNGLGETVERTEXATTRIBFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETVERTEXATTRIBFVPROC ) mygetprocaddr("glGetVertexAttribfv");
glfunc(index_, pname_, params_);
return;
}
void glGetVertexAttribiv (GLuint index_ , GLenum pname_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetVertexAttribiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param group="VertexAttribPropertyARB"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="4"><ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="1303" type="vendor" />
</command>
*/
static PFNGLGETVERTEXATTRIBIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETVERTEXATTRIBIVPROC ) mygetprocaddr("glGetVertexAttribiv");
glfunc(index_, pname_, params_);
return;
}
void glGetnCompressedTexImage (GLenum target_ , GLint lod_ , GLsizei bufSize_ , void * pixels_ ){
/* <command>
<proto>void <name>glGetnCompressedTexImage</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLint</ptype> <name>lod</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param>void *<name>pixels</name></param>
</command>
*/
static PFNGLGETNCOMPRESSEDTEXIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNCOMPRESSEDTEXIMAGEPROC ) mygetprocaddr("glGetnCompressedTexImage");
glfunc(target_, lod_, bufSize_, pixels_);
return;
}
void glGetnTexImage (GLenum target_ , GLint level_ , GLenum format_ , GLenum type_ , GLsizei bufSize_ , void * pixels_ ){
/* <command>
<proto>void <name>glGetnTexImage</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param>void *<name>pixels</name></param>
</command>
*/
static PFNGLGETNTEXIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNTEXIMAGEPROC ) mygetprocaddr("glGetnTexImage");
glfunc(target_, level_, format_, type_, bufSize_, pixels_);
return;
}
void glGetnUniformdv (GLuint program_ , GLint location_ , GLsizei bufSize_ , GLdouble * params_ ){
/* <command>
<proto>void <name>glGetnUniformdv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param><ptype>GLdouble</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETNUNIFORMDVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNUNIFORMDVPROC ) mygetprocaddr("glGetnUniformdv");
glfunc(program_, location_, bufSize_, params_);
return;
}
void glGetnUniformfv (GLuint program_ , GLint location_ , GLsizei bufSize_ , GLfloat * params_ ){
/* <command>
<proto>void <name>glGetnUniformfv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param><ptype>GLfloat</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETNUNIFORMFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNUNIFORMFVPROC ) mygetprocaddr("glGetnUniformfv");
glfunc(program_, location_, bufSize_, params_);
return;
}
void glGetnUniformiv (GLuint program_ , GLint location_ , GLsizei bufSize_ , GLint * params_ ){
/* <command>
<proto>void <name>glGetnUniformiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param><ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETNUNIFORMIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNUNIFORMIVPROC ) mygetprocaddr("glGetnUniformiv");
glfunc(program_, location_, bufSize_, params_);
return;
}
void glGetnUniformuiv (GLuint program_ , GLint location_ , GLsizei bufSize_ , GLuint * params_ ){
/* <command>
<proto>void <name>glGetnUniformuiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param><ptype>GLuint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLGETNUNIFORMUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLGETNUNIFORMUIVPROC ) mygetprocaddr("glGetnUniformuiv");
glfunc(program_, location_, bufSize_, params_);
return;
}
void glHint (GLenum target_ , GLenum mode_ ){
/* <command>
<proto>void <name>glHint</name></proto>
<param group="HintTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="HintMode"><ptype>GLenum</ptype> <name>mode</name></param>
<glx opcode="85" type="render" />
</command>
*/
static PFNGLHINTPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLHINTPROC ) mygetprocaddr("glHint");
glfunc(target_, mode_);
return;
}
void glInvalidateBufferData (GLuint buffer_ ){
/* <command>
<proto>void <name>glInvalidateBufferData</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
</command>
*/
static PFNGLINVALIDATEBUFFERDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLINVALIDATEBUFFERDATAPROC ) mygetprocaddr("glInvalidateBufferData");
glfunc(buffer_);
return;
}
void glInvalidateBufferSubData (GLuint buffer_ , GLintptr offset_ , GLsizeiptr length_ ){
/* <command>
<proto>void <name>glInvalidateBufferSubData</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>length</name></param>
</command>
*/
static PFNGLINVALIDATEBUFFERSUBDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLINVALIDATEBUFFERSUBDATAPROC ) mygetprocaddr("glInvalidateBufferSubData");
glfunc(buffer_, offset_, length_);
return;
}
void glInvalidateFramebuffer (GLenum target_ , GLsizei numAttachments_ , const GLenum * attachments_ ){
/* <command>
<proto>void <name>glInvalidateFramebuffer</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLsizei</ptype> <name>numAttachments</name></param>
<param len="numAttachments">const <ptype>GLenum</ptype> *<name>attachments</name></param>
</command>
*/
static PFNGLINVALIDATEFRAMEBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLINVALIDATEFRAMEBUFFERPROC ) mygetprocaddr("glInvalidateFramebuffer");
glfunc(target_, numAttachments_, attachments_);
return;
}
void glInvalidateNamedFramebufferData (GLuint framebuffer_ , GLsizei numAttachments_ , const GLenum * attachments_ ){
/* <command>
<proto>void <name>glInvalidateNamedFramebufferData</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLsizei</ptype> <name>numAttachments</name></param>
<param>const <ptype>GLenum</ptype> *<name>attachments</name></param>
</command>
*/
static PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLINVALIDATENAMEDFRAMEBUFFERDATAPROC ) mygetprocaddr("glInvalidateNamedFramebufferData");
glfunc(framebuffer_, numAttachments_, attachments_);
return;
}
void glInvalidateNamedFramebufferSubData (GLuint framebuffer_ , GLsizei numAttachments_ , const GLenum * attachments_ , GLint x_ , GLint y_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glInvalidateNamedFramebufferSubData</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLsizei</ptype> <name>numAttachments</name></param>
<param>const <ptype>GLenum</ptype> *<name>attachments</name></param>
<param><ptype>GLint</ptype> <name>x</name></param>
<param><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
</command>
*/
static PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLINVALIDATENAMEDFRAMEBUFFERSUBDATAPROC ) mygetprocaddr("glInvalidateNamedFramebufferSubData");
glfunc(framebuffer_, numAttachments_, attachments_, x_, y_, width_, height_);
return;
}
void glInvalidateSubFramebuffer (GLenum target_ , GLsizei numAttachments_ , const GLenum * attachments_ , GLint x_ , GLint y_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glInvalidateSubFramebuffer</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLsizei</ptype> <name>numAttachments</name></param>
<param len="numAttachments">const <ptype>GLenum</ptype> *<name>attachments</name></param>
<param><ptype>GLint</ptype> <name>x</name></param>
<param><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
</command>
*/
static PFNGLINVALIDATESUBFRAMEBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLINVALIDATESUBFRAMEBUFFERPROC ) mygetprocaddr("glInvalidateSubFramebuffer");
glfunc(target_, numAttachments_, attachments_, x_, y_, width_, height_);
return;
}
void glInvalidateTexImage (GLuint texture_ , GLint level_ ){
/* <command>
<proto>void <name>glInvalidateTexImage</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
</command>
*/
static PFNGLINVALIDATETEXIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLINVALIDATETEXIMAGEPROC ) mygetprocaddr("glInvalidateTexImage");
glfunc(texture_, level_);
return;
}
void glInvalidateTexSubImage (GLuint texture_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint zoffset_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ ){
/* <command>
<proto>void <name>glInvalidateTexSubImage</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLint</ptype> <name>zoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
</command>
*/
static PFNGLINVALIDATETEXSUBIMAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLINVALIDATETEXSUBIMAGEPROC ) mygetprocaddr("glInvalidateTexSubImage");
glfunc(texture_, level_, xoffset_, yoffset_, zoffset_, width_, height_, depth_);
return;
}
GLboolean glIsBuffer (GLuint buffer_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsBuffer</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
</command>
*/
static PFNGLISBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISBUFFERPROC ) mygetprocaddr("glIsBuffer");
GLboolean retval = glfunc(buffer_);
return retval;
}
GLboolean glIsEnabled (GLenum cap_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsEnabled</name></proto>
<param group="EnableCap"><ptype>GLenum</ptype> <name>cap</name></param>
<glx opcode="140" type="single" />
</command>
*/
static PFNGLISENABLEDPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISENABLEDPROC ) mygetprocaddr("glIsEnabled");
GLboolean retval = glfunc(cap_);
return retval;
}
GLboolean glIsEnabledi (GLenum target_ , GLuint index_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsEnabledi</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
</command>
*/
static PFNGLISENABLEDIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISENABLEDIPROC ) mygetprocaddr("glIsEnabledi");
GLboolean retval = glfunc(target_, index_);
return retval;
}
GLboolean glIsFramebuffer (GLuint framebuffer_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsFramebuffer</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<glx opcode="1425" type="vendor" />
</command>
*/
static PFNGLISFRAMEBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISFRAMEBUFFERPROC ) mygetprocaddr("glIsFramebuffer");
GLboolean retval = glfunc(framebuffer_);
return retval;
}
GLboolean glIsProgram (GLuint program_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsProgram</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<glx opcode="197" type="single" />
</command>
*/
static PFNGLISPROGRAMPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISPROGRAMPROC ) mygetprocaddr("glIsProgram");
GLboolean retval = glfunc(program_);
return retval;
}
GLboolean glIsProgramPipeline (GLuint pipeline_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsProgramPipeline</name></proto>
<param><ptype>GLuint</ptype> <name>pipeline</name></param>
</command>
*/
static PFNGLISPROGRAMPIPELINEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISPROGRAMPIPELINEPROC ) mygetprocaddr("glIsProgramPipeline");
GLboolean retval = glfunc(pipeline_);
return retval;
}
GLboolean glIsQuery (GLuint id_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsQuery</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
<glx opcode="163" type="single" />
</command>
*/
static PFNGLISQUERYPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISQUERYPROC ) mygetprocaddr("glIsQuery");
GLboolean retval = glfunc(id_);
return retval;
}
GLboolean glIsRenderbuffer (GLuint renderbuffer_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsRenderbuffer</name></proto>
<param><ptype>GLuint</ptype> <name>renderbuffer</name></param>
<glx opcode="1422" type="vendor" />
</command>
*/
static PFNGLISRENDERBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISRENDERBUFFERPROC ) mygetprocaddr("glIsRenderbuffer");
GLboolean retval = glfunc(renderbuffer_);
return retval;
}
GLboolean glIsSampler (GLuint sampler_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsSampler</name></proto>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
</command>
*/
static PFNGLISSAMPLERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISSAMPLERPROC ) mygetprocaddr("glIsSampler");
GLboolean retval = glfunc(sampler_);
return retval;
}
GLboolean glIsShader (GLuint shader_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsShader</name></proto>
<param><ptype>GLuint</ptype> <name>shader</name></param>
<glx opcode="196" type="single" />
</command>
*/
static PFNGLISSHADERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISSHADERPROC ) mygetprocaddr("glIsShader");
GLboolean retval = glfunc(shader_);
return retval;
}
GLboolean glIsSync (GLsync sync_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsSync</name></proto>
<param group="sync"><ptype>GLsync</ptype> <name>sync</name></param>
</command>
*/
static PFNGLISSYNCPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISSYNCPROC ) mygetprocaddr("glIsSync");
GLboolean retval = glfunc(sync_);
return retval;
}
GLboolean glIsTexture (GLuint texture_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsTexture</name></proto>
<param group="Texture"><ptype>GLuint</ptype> <name>texture</name></param>
<glx opcode="146" type="single" />
</command>
*/
static PFNGLISTEXTUREPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISTEXTUREPROC ) mygetprocaddr("glIsTexture");
GLboolean retval = glfunc(texture_);
return retval;
}
GLboolean glIsTransformFeedback (GLuint id_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsTransformFeedback</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
</command>
*/
static PFNGLISTRANSFORMFEEDBACKPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISTRANSFORMFEEDBACKPROC ) mygetprocaddr("glIsTransformFeedback");
GLboolean retval = glfunc(id_);
return retval;
}
GLboolean glIsVertexArray (GLuint array_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glIsVertexArray</name></proto>
<param><ptype>GLuint</ptype> <name>array</name></param>
<glx opcode="207" type="single" />
</command>
*/
static PFNGLISVERTEXARRAYPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLISVERTEXARRAYPROC ) mygetprocaddr("glIsVertexArray");
GLboolean retval = glfunc(array_);
return retval;
}
void glLineWidth (GLfloat width_ ){
/* <command>
<proto>void <name>glLineWidth</name></proto>
<param group="CheckedFloat32"><ptype>GLfloat</ptype> <name>width</name></param>
<glx opcode="95" type="render" />
</command>
*/
static PFNGLLINEWIDTHPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLLINEWIDTHPROC ) mygetprocaddr("glLineWidth");
glfunc(width_);
return;
}
void glLinkProgram (GLuint program_ ){
/* <command>
<proto>void <name>glLinkProgram</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
</command>
*/
static PFNGLLINKPROGRAMPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLLINKPROGRAMPROC ) mygetprocaddr("glLinkProgram");
glfunc(program_);
return;
}
void glLogicOp (GLenum opcode_ ){
/* <command>
<proto>void <name>glLogicOp</name></proto>
<param group="LogicOp"><ptype>GLenum</ptype> <name>opcode</name></param>
<glx opcode="161" type="render" />
</command>
*/
static PFNGLLOGICOPPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLLOGICOPPROC ) mygetprocaddr("glLogicOp");
glfunc(opcode_);
return;
}
void * glMapBuffer (GLenum target_ , GLenum access_ ){
/* <command>
<proto>void *<name>glMapBuffer</name></proto>
<param group="BufferTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
<param group="BufferAccessARB"><ptype>GLenum</ptype> <name>access</name></param>
</command>
*/
static PFNGLMAPBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMAPBUFFERPROC ) mygetprocaddr("glMapBuffer");
void * retval = glfunc(target_, access_);
return retval;
}
void * glMapBufferRange (GLenum target_ , GLintptr offset_ , GLsizeiptr length_ , GLbitfield access_ ){
/* <command>
<proto>void *<name>glMapBufferRange</name></proto>
<param group="BufferTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>length</name></param>
<param group="BufferAccessMask"><ptype>GLbitfield</ptype> <name>access</name></param>
<glx opcode="205" type="single" />
</command>
*/
static PFNGLMAPBUFFERRANGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMAPBUFFERRANGEPROC ) mygetprocaddr("glMapBufferRange");
void * retval = glfunc(target_, offset_, length_, access_);
return retval;
}
void * glMapNamedBuffer (GLuint buffer_ , GLenum access_ ){
/* <command>
<proto>void *<name>glMapNamedBuffer</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLenum</ptype> <name>access</name></param>
</command>
*/
static PFNGLMAPNAMEDBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMAPNAMEDBUFFERPROC ) mygetprocaddr("glMapNamedBuffer");
void * retval = glfunc(buffer_, access_);
return retval;
}
void * glMapNamedBufferRange (GLuint buffer_ , GLintptr offset_ , GLsizeiptr length_ , GLbitfield access_ ){
/* <command>
<proto>void *<name>glMapNamedBufferRange</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>length</name></param>
<param><ptype>GLbitfield</ptype> <name>access</name></param>
</command>
*/
static PFNGLMAPNAMEDBUFFERRANGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMAPNAMEDBUFFERRANGEPROC ) mygetprocaddr("glMapNamedBufferRange");
void * retval = glfunc(buffer_, offset_, length_, access_);
return retval;
}
void glMemoryBarrier (GLbitfield barriers_ ){
/* <command>
<proto>void <name>glMemoryBarrier</name></proto>
<param><ptype>GLbitfield</ptype> <name>barriers</name></param>
</command>
*/
static PFNGLMEMORYBARRIERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMEMORYBARRIERPROC ) mygetprocaddr("glMemoryBarrier");
glfunc(barriers_);
return;
}
void glMemoryBarrierByRegion (GLbitfield barriers_ ){
/* <command>
<proto>void <name>glMemoryBarrierByRegion</name></proto>
<param><ptype>GLbitfield</ptype> <name>barriers</name></param>
</command>
*/
static PFNGLMEMORYBARRIERBYREGIONPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMEMORYBARRIERBYREGIONPROC ) mygetprocaddr("glMemoryBarrierByRegion");
glfunc(barriers_);
return;
}
void glMinSampleShading (GLfloat value_ ){
/* <command>
<proto>void <name>glMinSampleShading</name></proto>
<param group="ColorF"><ptype>GLfloat</ptype> <name>value</name></param>
</command>
*/
static PFNGLMINSAMPLESHADINGPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMINSAMPLESHADINGPROC ) mygetprocaddr("glMinSampleShading");
glfunc(value_);
return;
}
void glMultiDrawArrays (GLenum mode_ , const GLint * first_ , const GLsizei * count_ , GLsizei drawcount_ ){
/* <command>
<proto>void <name>glMultiDrawArrays</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param len="COMPSIZE(count)">const <ptype>GLint</ptype> *<name>first</name></param>
<param len="COMPSIZE(drawcount)">const <ptype>GLsizei</ptype> *<name>count</name></param>
<param><ptype>GLsizei</ptype> <name>drawcount</name></param>
</command>
*/
static PFNGLMULTIDRAWARRAYSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMULTIDRAWARRAYSPROC ) mygetprocaddr("glMultiDrawArrays");
glfunc(mode_, first_, count_, drawcount_);
return;
}
void glMultiDrawArraysIndirect (GLenum mode_ , const void * indirect_ , GLsizei drawcount_ , GLsizei stride_ ){
/* <command>
<proto>void <name>glMultiDrawArraysIndirect</name></proto>
<param><ptype>GLenum</ptype> <name>mode</name></param>
<param len="COMPSIZE(drawcount,stride)">const void *<name>indirect</name></param>
<param><ptype>GLsizei</ptype> <name>drawcount</name></param>
<param><ptype>GLsizei</ptype> <name>stride</name></param>
</command>
*/
static PFNGLMULTIDRAWARRAYSINDIRECTPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMULTIDRAWARRAYSINDIRECTPROC ) mygetprocaddr("glMultiDrawArraysIndirect");
glfunc(mode_, indirect_, drawcount_, stride_);
return;
}
void glMultiDrawElements (GLenum mode_ , const GLsizei * count_ , GLenum type_ , const void ** indices_ , GLsizei drawcount_ ){
/* <command>
<proto>void <name>glMultiDrawElements</name></proto>
<param group="PrimitiveType"><ptype>GLenum</ptype> <name>mode</name></param>
<param len="COMPSIZE(drawcount)">const <ptype>GLsizei</ptype> *<name>count</name></param>
<param group="DrawElementsType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(drawcount)">const void *const*<name>indices</name></param>
<param><ptype>GLsizei</ptype> <name>drawcount</name></param>
</command>
*/
static PFNGLMULTIDRAWELEMENTSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMULTIDRAWELEMENTSPROC ) mygetprocaddr("glMultiDrawElements");
glfunc(mode_, count_, type_, indices_, drawcount_);
return;
}
void glMultiDrawElementsBaseVertex (GLenum mode_ , const GLsizei * count_ , GLenum type_ , const void ** indices_ , GLsizei drawcount_ , const GLint * basevertex_ ){
/* <command>
<proto>void <name>glMultiDrawElementsBaseVertex</name></proto>
<param><ptype>GLenum</ptype> <name>mode</name></param>
<param len="COMPSIZE(drawcount)">const <ptype>GLsizei</ptype> *<name>count</name></param>
<param group="DrawElementsType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(drawcount)">const void *const*<name>indices</name></param>
<param><ptype>GLsizei</ptype> <name>drawcount</name></param>
<param len="COMPSIZE(drawcount)">const <ptype>GLint</ptype> *<name>basevertex</name></param>
</command>
*/
static PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMULTIDRAWELEMENTSBASEVERTEXPROC ) mygetprocaddr("glMultiDrawElementsBaseVertex");
glfunc(mode_, count_, type_, indices_, drawcount_, basevertex_);
return;
}
void glMultiDrawElementsIndirect (GLenum mode_ , GLenum type_ , const void * indirect_ , GLsizei drawcount_ , GLsizei stride_ ){
/* <command>
<proto>void <name>glMultiDrawElementsIndirect</name></proto>
<param><ptype>GLenum</ptype> <name>mode</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(drawcount,stride)">const void *<name>indirect</name></param>
<param><ptype>GLsizei</ptype> <name>drawcount</name></param>
<param><ptype>GLsizei</ptype> <name>stride</name></param>
</command>
*/
static PFNGLMULTIDRAWELEMENTSINDIRECTPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLMULTIDRAWELEMENTSINDIRECTPROC ) mygetprocaddr("glMultiDrawElementsIndirect");
glfunc(mode_, type_, indirect_, drawcount_, stride_);
return;
}
void glNamedBufferData (GLuint buffer_ , GLsizeiptr size_ , const void * data_ , GLenum usage_ ){
/* <command>
<proto>void <name>glNamedBufferData</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
<param>const void *<name>data</name></param>
<param><ptype>GLenum</ptype> <name>usage</name></param>
</command>
*/
static PFNGLNAMEDBUFFERDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDBUFFERDATAPROC ) mygetprocaddr("glNamedBufferData");
glfunc(buffer_, size_, data_, usage_);
return;
}
void glNamedBufferStorage (GLuint buffer_ , GLsizeiptr size_ , const void * data_ , GLbitfield flags_ ){
/* <command>
<proto>void <name>glNamedBufferStorage</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
<param len="size">const void *<name>data</name></param>
<param><ptype>GLbitfield</ptype> <name>flags</name></param>
</command>
*/
static PFNGLNAMEDBUFFERSTORAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDBUFFERSTORAGEPROC ) mygetprocaddr("glNamedBufferStorage");
glfunc(buffer_, size_, data_, flags_);
return;
}
void glNamedBufferSubData (GLuint buffer_ , GLintptr offset_ , GLsizeiptr size_ , const void * data_ ){
/* <command>
<proto>void <name>glNamedBufferSubData</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
<param len="COMPSIZE(size)">const void *<name>data</name></param>
</command>
*/
static PFNGLNAMEDBUFFERSUBDATAPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDBUFFERSUBDATAPROC ) mygetprocaddr("glNamedBufferSubData");
glfunc(buffer_, offset_, size_, data_);
return;
}
void glNamedFramebufferDrawBuffer (GLuint framebuffer_ , GLenum buf_ ){
/* <command>
<proto>void <name>glNamedFramebufferDrawBuffer</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>buf</name></param>
</command>
*/
static PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDFRAMEBUFFERDRAWBUFFERPROC ) mygetprocaddr("glNamedFramebufferDrawBuffer");
glfunc(framebuffer_, buf_);
return;
}
void glNamedFramebufferDrawBuffers (GLuint framebuffer_ , GLsizei n_ , const GLenum * bufs_ ){
/* <command>
<proto>void <name>glNamedFramebufferDrawBuffers</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLsizei</ptype> <name>n</name></param>
<param>const <ptype>GLenum</ptype> *<name>bufs</name></param>
</command>
*/
static PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDFRAMEBUFFERDRAWBUFFERSPROC ) mygetprocaddr("glNamedFramebufferDrawBuffers");
glfunc(framebuffer_, n_, bufs_);
return;
}
void glNamedFramebufferParameteri (GLuint framebuffer_ , GLenum pname_ , GLint param_ ){
/* <command>
<proto>void <name>glNamedFramebufferParameteri</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> <name>param</name></param>
</command>
*/
static PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDFRAMEBUFFERPARAMETERIPROC ) mygetprocaddr("glNamedFramebufferParameteri");
glfunc(framebuffer_, pname_, param_);
return;
}
void glNamedFramebufferReadBuffer (GLuint framebuffer_ , GLenum src_ ){
/* <command>
<proto>void <name>glNamedFramebufferReadBuffer</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>src</name></param>
</command>
*/
static PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDFRAMEBUFFERREADBUFFERPROC ) mygetprocaddr("glNamedFramebufferReadBuffer");
glfunc(framebuffer_, src_);
return;
}
void glNamedFramebufferRenderbuffer (GLuint framebuffer_ , GLenum attachment_ , GLenum renderbuffertarget_ , GLuint renderbuffer_ ){
/* <command>
<proto>void <name>glNamedFramebufferRenderbuffer</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>attachment</name></param>
<param><ptype>GLenum</ptype> <name>renderbuffertarget</name></param>
<param><ptype>GLuint</ptype> <name>renderbuffer</name></param>
</command>
*/
static PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDFRAMEBUFFERRENDERBUFFERPROC ) mygetprocaddr("glNamedFramebufferRenderbuffer");
glfunc(framebuffer_, attachment_, renderbuffertarget_, renderbuffer_);
return;
}
void glNamedFramebufferTexture (GLuint framebuffer_ , GLenum attachment_ , GLuint texture_ , GLint level_ ){
/* <command>
<proto>void <name>glNamedFramebufferTexture</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>attachment</name></param>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
</command>
*/
static PFNGLNAMEDFRAMEBUFFERTEXTUREPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDFRAMEBUFFERTEXTUREPROC ) mygetprocaddr("glNamedFramebufferTexture");
glfunc(framebuffer_, attachment_, texture_, level_);
return;
}
void glNamedFramebufferTextureLayer (GLuint framebuffer_ , GLenum attachment_ , GLuint texture_ , GLint level_ , GLint layer_ ){
/* <command>
<proto>void <name>glNamedFramebufferTextureLayer</name></proto>
<param><ptype>GLuint</ptype> <name>framebuffer</name></param>
<param><ptype>GLenum</ptype> <name>attachment</name></param>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>layer</name></param>
</command>
*/
static PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDFRAMEBUFFERTEXTURELAYERPROC ) mygetprocaddr("glNamedFramebufferTextureLayer");
glfunc(framebuffer_, attachment_, texture_, level_, layer_);
return;
}
void glNamedRenderbufferStorage (GLuint renderbuffer_ , GLenum internalformat_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glNamedRenderbufferStorage</name></proto>
<param><ptype>GLuint</ptype> <name>renderbuffer</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
</command>
*/
static PFNGLNAMEDRENDERBUFFERSTORAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDRENDERBUFFERSTORAGEPROC ) mygetprocaddr("glNamedRenderbufferStorage");
glfunc(renderbuffer_, internalformat_, width_, height_);
return;
}
void glNamedRenderbufferStorageMultisample (GLuint renderbuffer_ , GLsizei samples_ , GLenum internalformat_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glNamedRenderbufferStorageMultisample</name></proto>
<param><ptype>GLuint</ptype> <name>renderbuffer</name></param>
<param><ptype>GLsizei</ptype> <name>samples</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
</command>
*/
static PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLNAMEDRENDERBUFFERSTORAGEMULTISAMPLEPROC ) mygetprocaddr("glNamedRenderbufferStorageMultisample");
glfunc(renderbuffer_, samples_, internalformat_, width_, height_);
return;
}
void glObjectLabel (GLenum identifier_ , GLuint name_ , GLsizei length_ , const GLchar * label_ ){
/* <command>
<proto>void <name>glObjectLabel</name></proto>
<param><ptype>GLenum</ptype> <name>identifier</name></param>
<param><ptype>GLuint</ptype> <name>name</name></param>
<param><ptype>GLsizei</ptype> <name>length</name></param>
<param len="COMPSIZE(label,length)">const <ptype>GLchar</ptype> *<name>label</name></param>
</command>
*/
static PFNGLOBJECTLABELPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLOBJECTLABELPROC ) mygetprocaddr("glObjectLabel");
glfunc(identifier_, name_, length_, label_);
return;
}
void glObjectPtrLabel (const void * ptr_ , GLsizei length_ , const GLchar * label_ ){
/* <command>
<proto>void <name>glObjectPtrLabel</name></proto>
<param>const void *<name>ptr</name></param>
<param><ptype>GLsizei</ptype> <name>length</name></param>
<param len="COMPSIZE(label,length)">const <ptype>GLchar</ptype> *<name>label</name></param>
</command>
*/
static PFNGLOBJECTPTRLABELPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLOBJECTPTRLABELPROC ) mygetprocaddr("glObjectPtrLabel");
glfunc(ptr_, length_, label_);
return;
}
void glPatchParameterfv (GLenum pname_ , const GLfloat * values_ ){
/* <command>
<proto>void <name>glPatchParameterfv</name></proto>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)">const <ptype>GLfloat</ptype> *<name>values</name></param>
</command>
*/
static PFNGLPATCHPARAMETERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPATCHPARAMETERFVPROC ) mygetprocaddr("glPatchParameterfv");
glfunc(pname_, values_);
return;
}
void glPatchParameteri (GLenum pname_ , GLint value_ ){
/* <command>
<proto>void <name>glPatchParameteri</name></proto>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> <name>value</name></param>
</command>
*/
static PFNGLPATCHPARAMETERIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPATCHPARAMETERIPROC ) mygetprocaddr("glPatchParameteri");
glfunc(pname_, value_);
return;
}
void glPauseTransformFeedback (){
/* <command>
<proto>void <name>glPauseTransformFeedback</name></proto>
</command>
*/
static PFNGLPAUSETRANSFORMFEEDBACKPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPAUSETRANSFORMFEEDBACKPROC ) mygetprocaddr("glPauseTransformFeedback");
glfunc();
return;
}
void glPixelStoref (GLenum pname_ , GLfloat param_ ){
/* <command>
<proto>void <name>glPixelStoref</name></proto>
<param group="PixelStoreParameter"><ptype>GLenum</ptype> <name>pname</name></param>
<param group="CheckedFloat32"><ptype>GLfloat</ptype> <name>param</name></param>
<glx opcode="109" type="single" />
</command>
*/
static PFNGLPIXELSTOREFPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPIXELSTOREFPROC ) mygetprocaddr("glPixelStoref");
glfunc(pname_, param_);
return;
}
void glPixelStorei (GLenum pname_ , GLint param_ ){
/* <command>
<proto>void <name>glPixelStorei</name></proto>
<param group="PixelStoreParameter"><ptype>GLenum</ptype> <name>pname</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>param</name></param>
<glx opcode="110" type="single" />
</command>
*/
static PFNGLPIXELSTOREIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPIXELSTOREIPROC ) mygetprocaddr("glPixelStorei");
glfunc(pname_, param_);
return;
}
void glPointParameterf (GLenum pname_ , GLfloat param_ ){
/* <command>
<proto>void <name>glPointParameterf</name></proto>
<param group="PointParameterNameARB"><ptype>GLenum</ptype> <name>pname</name></param>
<param group="CheckedFloat32"><ptype>GLfloat</ptype> <name>param</name></param>
<glx opcode="2065" type="render" />
</command>
*/
static PFNGLPOINTPARAMETERFPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPOINTPARAMETERFPROC ) mygetprocaddr("glPointParameterf");
glfunc(pname_, param_);
return;
}
void glPointParameterfv (GLenum pname_ , const GLfloat * params_ ){
/* <command>
<proto>void <name>glPointParameterfv</name></proto>
<param group="PointParameterNameARB"><ptype>GLenum</ptype> <name>pname</name></param>
<param group="CheckedFloat32" len="COMPSIZE(pname)">const <ptype>GLfloat</ptype> *<name>params</name></param>
<glx opcode="2066" type="render" />
</command>
*/
static PFNGLPOINTPARAMETERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPOINTPARAMETERFVPROC ) mygetprocaddr("glPointParameterfv");
glfunc(pname_, params_);
return;
}
void glPointParameteri (GLenum pname_ , GLint param_ ){
/* <command>
<proto>void <name>glPointParameteri</name></proto>
<param group="PointParameterNameARB"><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> <name>param</name></param>
<glx opcode="4221" type="render" />
</command>
*/
static PFNGLPOINTPARAMETERIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPOINTPARAMETERIPROC ) mygetprocaddr("glPointParameteri");
glfunc(pname_, param_);
return;
}
void glPointParameteriv (GLenum pname_ , const GLint * params_ ){
/* <command>
<proto>void <name>glPointParameteriv</name></proto>
<param group="PointParameterNameARB"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)">const <ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="4222" type="render" />
</command>
*/
static PFNGLPOINTPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPOINTPARAMETERIVPROC ) mygetprocaddr("glPointParameteriv");
glfunc(pname_, params_);
return;
}
void glPointSize (GLfloat size_ ){
/* <command>
<proto>void <name>glPointSize</name></proto>
<param group="CheckedFloat32"><ptype>GLfloat</ptype> <name>size</name></param>
<glx opcode="100" type="render" />
</command>
*/
static PFNGLPOINTSIZEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPOINTSIZEPROC ) mygetprocaddr("glPointSize");
glfunc(size_);
return;
}
void glPolygonMode (GLenum face_ , GLenum mode_ ){
/* <command>
<proto>void <name>glPolygonMode</name></proto>
<param group="MaterialFace"><ptype>GLenum</ptype> <name>face</name></param>
<param group="PolygonMode"><ptype>GLenum</ptype> <name>mode</name></param>
<glx opcode="101" type="render" />
</command>
*/
static PFNGLPOLYGONMODEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPOLYGONMODEPROC ) mygetprocaddr("glPolygonMode");
glfunc(face_, mode_);
return;
}
void glPolygonOffset (GLfloat factor_ , GLfloat units_ ){
/* <command>
<proto>void <name>glPolygonOffset</name></proto>
<param><ptype>GLfloat</ptype> <name>factor</name></param>
<param><ptype>GLfloat</ptype> <name>units</name></param>
<glx opcode="192" type="render" />
</command>
*/
static PFNGLPOLYGONOFFSETPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPOLYGONOFFSETPROC ) mygetprocaddr("glPolygonOffset");
glfunc(factor_, units_);
return;
}
void glPopDebugGroup (){
/* <command>
<proto>void <name>glPopDebugGroup</name></proto>
</command>
*/
static PFNGLPOPDEBUGGROUPPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPOPDEBUGGROUPPROC ) mygetprocaddr("glPopDebugGroup");
glfunc();
return;
}
void glPrimitiveRestartIndex (GLuint index_ ){
/* <command>
<proto>void <name>glPrimitiveRestartIndex</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
</command>
*/
static PFNGLPRIMITIVERESTARTINDEXPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPRIMITIVERESTARTINDEXPROC ) mygetprocaddr("glPrimitiveRestartIndex");
glfunc(index_);
return;
}
void glProgramBinary (GLuint program_ , GLenum binaryFormat_ , const void * binary_ , GLsizei length_ ){
/* <command>
<proto>void <name>glProgramBinary</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLenum</ptype> <name>binaryFormat</name></param>
<param len="length">const void *<name>binary</name></param>
<param><ptype>GLsizei</ptype> <name>length</name></param>
</command>
*/
static PFNGLPROGRAMBINARYPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMBINARYPROC ) mygetprocaddr("glProgramBinary");
glfunc(program_, binaryFormat_, binary_, length_);
return;
}
void glProgramParameteri (GLuint program_ , GLenum pname_ , GLint value_ ){
/* <command>
<proto>void <name>glProgramParameteri</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param group="ProgramParameterPName"><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> <name>value</name></param>
</command>
*/
static PFNGLPROGRAMPARAMETERIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMPARAMETERIPROC ) mygetprocaddr("glProgramParameteri");
glfunc(program_, pname_, value_);
return;
}
void glProgramUniform1d (GLuint program_ , GLint location_ , GLdouble v0_ ){
/* <command>
<proto>void <name>glProgramUniform1d</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLdouble</ptype> <name>v0</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM1DPROC ) mygetprocaddr("glProgramUniform1d");
glfunc(program_, location_, v0_);
return;
}
void glProgramUniform1dv (GLuint program_ , GLint location_ , GLsizei count_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniform1dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="1">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM1DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM1DVPROC ) mygetprocaddr("glProgramUniform1dv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform1f (GLuint program_ , GLint location_ , GLfloat v0_ ){
/* <command>
<proto>void <name>glProgramUniform1f</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLfloat</ptype> <name>v0</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM1FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM1FPROC ) mygetprocaddr("glProgramUniform1f");
glfunc(program_, location_, v0_);
return;
}
void glProgramUniform1fv (GLuint program_ , GLint location_ , GLsizei count_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniform1fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="1">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM1FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM1FVPROC ) mygetprocaddr("glProgramUniform1fv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform1i (GLuint program_ , GLint location_ , GLint v0_ ){
/* <command>
<proto>void <name>glProgramUniform1i</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLint</ptype> <name>v0</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM1IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM1IPROC ) mygetprocaddr("glProgramUniform1i");
glfunc(program_, location_, v0_);
return;
}
void glProgramUniform1iv (GLuint program_ , GLint location_ , GLsizei count_ , const GLint * value_ ){
/* <command>
<proto>void <name>glProgramUniform1iv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="1">const <ptype>GLint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM1IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM1IVPROC ) mygetprocaddr("glProgramUniform1iv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform1ui (GLuint program_ , GLint location_ , GLuint v0_ ){
/* <command>
<proto>void <name>glProgramUniform1ui</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLuint</ptype> <name>v0</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM1UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM1UIPROC ) mygetprocaddr("glProgramUniform1ui");
glfunc(program_, location_, v0_);
return;
}
void glProgramUniform1uiv (GLuint program_ , GLint location_ , GLsizei count_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glProgramUniform1uiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="1">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM1UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM1UIVPROC ) mygetprocaddr("glProgramUniform1uiv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform2d (GLuint program_ , GLint location_ , GLdouble v0_ , GLdouble v1_ ){
/* <command>
<proto>void <name>glProgramUniform2d</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLdouble</ptype> <name>v0</name></param>
<param><ptype>GLdouble</ptype> <name>v1</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM2DPROC ) mygetprocaddr("glProgramUniform2d");
glfunc(program_, location_, v0_, v1_);
return;
}
void glProgramUniform2dv (GLuint program_ , GLint location_ , GLsizei count_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniform2dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="2">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM2DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM2DVPROC ) mygetprocaddr("glProgramUniform2dv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform2f (GLuint program_ , GLint location_ , GLfloat v0_ , GLfloat v1_ ){
/* <command>
<proto>void <name>glProgramUniform2f</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLfloat</ptype> <name>v0</name></param>
<param><ptype>GLfloat</ptype> <name>v1</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM2FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM2FPROC ) mygetprocaddr("glProgramUniform2f");
glfunc(program_, location_, v0_, v1_);
return;
}
void glProgramUniform2fv (GLuint program_ , GLint location_ , GLsizei count_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniform2fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="2">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM2FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM2FVPROC ) mygetprocaddr("glProgramUniform2fv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform2i (GLuint program_ , GLint location_ , GLint v0_ , GLint v1_ ){
/* <command>
<proto>void <name>glProgramUniform2i</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLint</ptype> <name>v0</name></param>
<param><ptype>GLint</ptype> <name>v1</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM2IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM2IPROC ) mygetprocaddr("glProgramUniform2i");
glfunc(program_, location_, v0_, v1_);
return;
}
void glProgramUniform2iv (GLuint program_ , GLint location_ , GLsizei count_ , const GLint * value_ ){
/* <command>
<proto>void <name>glProgramUniform2iv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="2">const <ptype>GLint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM2IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM2IVPROC ) mygetprocaddr("glProgramUniform2iv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform2ui (GLuint program_ , GLint location_ , GLuint v0_ , GLuint v1_ ){
/* <command>
<proto>void <name>glProgramUniform2ui</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLuint</ptype> <name>v0</name></param>
<param><ptype>GLuint</ptype> <name>v1</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM2UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM2UIPROC ) mygetprocaddr("glProgramUniform2ui");
glfunc(program_, location_, v0_, v1_);
return;
}
void glProgramUniform2uiv (GLuint program_ , GLint location_ , GLsizei count_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glProgramUniform2uiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="2">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM2UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM2UIVPROC ) mygetprocaddr("glProgramUniform2uiv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform3d (GLuint program_ , GLint location_ , GLdouble v0_ , GLdouble v1_ , GLdouble v2_ ){
/* <command>
<proto>void <name>glProgramUniform3d</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLdouble</ptype> <name>v0</name></param>
<param><ptype>GLdouble</ptype> <name>v1</name></param>
<param><ptype>GLdouble</ptype> <name>v2</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM3DPROC ) mygetprocaddr("glProgramUniform3d");
glfunc(program_, location_, v0_, v1_, v2_);
return;
}
void glProgramUniform3dv (GLuint program_ , GLint location_ , GLsizei count_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniform3dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="3">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM3DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM3DVPROC ) mygetprocaddr("glProgramUniform3dv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform3f (GLuint program_ , GLint location_ , GLfloat v0_ , GLfloat v1_ , GLfloat v2_ ){
/* <command>
<proto>void <name>glProgramUniform3f</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLfloat</ptype> <name>v0</name></param>
<param><ptype>GLfloat</ptype> <name>v1</name></param>
<param><ptype>GLfloat</ptype> <name>v2</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM3FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM3FPROC ) mygetprocaddr("glProgramUniform3f");
glfunc(program_, location_, v0_, v1_, v2_);
return;
}
void glProgramUniform3fv (GLuint program_ , GLint location_ , GLsizei count_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniform3fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="3">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM3FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM3FVPROC ) mygetprocaddr("glProgramUniform3fv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform3i (GLuint program_ , GLint location_ , GLint v0_ , GLint v1_ , GLint v2_ ){
/* <command>
<proto>void <name>glProgramUniform3i</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLint</ptype> <name>v0</name></param>
<param><ptype>GLint</ptype> <name>v1</name></param>
<param><ptype>GLint</ptype> <name>v2</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM3IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM3IPROC ) mygetprocaddr("glProgramUniform3i");
glfunc(program_, location_, v0_, v1_, v2_);
return;
}
void glProgramUniform3iv (GLuint program_ , GLint location_ , GLsizei count_ , const GLint * value_ ){
/* <command>
<proto>void <name>glProgramUniform3iv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="3">const <ptype>GLint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM3IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM3IVPROC ) mygetprocaddr("glProgramUniform3iv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform3ui (GLuint program_ , GLint location_ , GLuint v0_ , GLuint v1_ , GLuint v2_ ){
/* <command>
<proto>void <name>glProgramUniform3ui</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLuint</ptype> <name>v0</name></param>
<param><ptype>GLuint</ptype> <name>v1</name></param>
<param><ptype>GLuint</ptype> <name>v2</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM3UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM3UIPROC ) mygetprocaddr("glProgramUniform3ui");
glfunc(program_, location_, v0_, v1_, v2_);
return;
}
void glProgramUniform3uiv (GLuint program_ , GLint location_ , GLsizei count_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glProgramUniform3uiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="3">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM3UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM3UIVPROC ) mygetprocaddr("glProgramUniform3uiv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform4d (GLuint program_ , GLint location_ , GLdouble v0_ , GLdouble v1_ , GLdouble v2_ , GLdouble v3_ ){
/* <command>
<proto>void <name>glProgramUniform4d</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLdouble</ptype> <name>v0</name></param>
<param><ptype>GLdouble</ptype> <name>v1</name></param>
<param><ptype>GLdouble</ptype> <name>v2</name></param>
<param><ptype>GLdouble</ptype> <name>v3</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM4DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM4DPROC ) mygetprocaddr("glProgramUniform4d");
glfunc(program_, location_, v0_, v1_, v2_, v3_);
return;
}
void glProgramUniform4dv (GLuint program_ , GLint location_ , GLsizei count_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniform4dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="4">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM4DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM4DVPROC ) mygetprocaddr("glProgramUniform4dv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform4f (GLuint program_ , GLint location_ , GLfloat v0_ , GLfloat v1_ , GLfloat v2_ , GLfloat v3_ ){
/* <command>
<proto>void <name>glProgramUniform4f</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLfloat</ptype> <name>v0</name></param>
<param><ptype>GLfloat</ptype> <name>v1</name></param>
<param><ptype>GLfloat</ptype> <name>v2</name></param>
<param><ptype>GLfloat</ptype> <name>v3</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM4FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM4FPROC ) mygetprocaddr("glProgramUniform4f");
glfunc(program_, location_, v0_, v1_, v2_, v3_);
return;
}
void glProgramUniform4fv (GLuint program_ , GLint location_ , GLsizei count_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniform4fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="4">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM4FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM4FVPROC ) mygetprocaddr("glProgramUniform4fv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform4i (GLuint program_ , GLint location_ , GLint v0_ , GLint v1_ , GLint v2_ , GLint v3_ ){
/* <command>
<proto>void <name>glProgramUniform4i</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLint</ptype> <name>v0</name></param>
<param><ptype>GLint</ptype> <name>v1</name></param>
<param><ptype>GLint</ptype> <name>v2</name></param>
<param><ptype>GLint</ptype> <name>v3</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM4IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM4IPROC ) mygetprocaddr("glProgramUniform4i");
glfunc(program_, location_, v0_, v1_, v2_, v3_);
return;
}
void glProgramUniform4iv (GLuint program_ , GLint location_ , GLsizei count_ , const GLint * value_ ){
/* <command>
<proto>void <name>glProgramUniform4iv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="4">const <ptype>GLint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM4IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM4IVPROC ) mygetprocaddr("glProgramUniform4iv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniform4ui (GLuint program_ , GLint location_ , GLuint v0_ , GLuint v1_ , GLuint v2_ , GLuint v3_ ){
/* <command>
<proto>void <name>glProgramUniform4ui</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLuint</ptype> <name>v0</name></param>
<param><ptype>GLuint</ptype> <name>v1</name></param>
<param><ptype>GLuint</ptype> <name>v2</name></param>
<param><ptype>GLuint</ptype> <name>v3</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM4UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM4UIPROC ) mygetprocaddr("glProgramUniform4ui");
glfunc(program_, location_, v0_, v1_, v2_, v3_);
return;
}
void glProgramUniform4uiv (GLuint program_ , GLint location_ , GLsizei count_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glProgramUniform4uiv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="4">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORM4UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORM4UIVPROC ) mygetprocaddr("glProgramUniform4uiv");
glfunc(program_, location_, count_, value_);
return;
}
void glProgramUniformMatrix2dv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix2dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="2">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX2DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX2DVPROC ) mygetprocaddr("glProgramUniformMatrix2dv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix2fv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix2fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="2">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX2FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX2FVPROC ) mygetprocaddr("glProgramUniformMatrix2fv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix2x3dv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix2x3dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX2X3DVPROC ) mygetprocaddr("glProgramUniformMatrix2x3dv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix2x3fv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix2x3fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX2X3FVPROC ) mygetprocaddr("glProgramUniformMatrix2x3fv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix2x4dv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix2x4dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX2X4DVPROC ) mygetprocaddr("glProgramUniformMatrix2x4dv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix2x4fv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix2x4fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX2X4FVPROC ) mygetprocaddr("glProgramUniformMatrix2x4fv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix3dv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix3dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="3">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX3DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX3DVPROC ) mygetprocaddr("glProgramUniformMatrix3dv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix3fv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix3fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="3">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX3FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX3FVPROC ) mygetprocaddr("glProgramUniformMatrix3fv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix3x2dv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix3x2dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX3X2DVPROC ) mygetprocaddr("glProgramUniformMatrix3x2dv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix3x2fv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix3x2fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX3X2FVPROC ) mygetprocaddr("glProgramUniformMatrix3x2fv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix3x4dv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix3x4dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX3X4DVPROC ) mygetprocaddr("glProgramUniformMatrix3x4dv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix3x4fv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix3x4fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX3X4FVPROC ) mygetprocaddr("glProgramUniformMatrix3x4fv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix4dv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix4dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="4">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX4DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX4DVPROC ) mygetprocaddr("glProgramUniformMatrix4dv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix4fv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix4fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="4">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX4FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX4FVPROC ) mygetprocaddr("glProgramUniformMatrix4fv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix4x2dv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix4x2dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX4X2DVPROC ) mygetprocaddr("glProgramUniformMatrix4x2dv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix4x2fv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix4x2fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX4X2FVPROC ) mygetprocaddr("glProgramUniformMatrix4x2fv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix4x3dv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix4x3dv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX4X3DVPROC ) mygetprocaddr("glProgramUniformMatrix4x3dv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProgramUniformMatrix4x3fv (GLuint program_ , GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glProgramUniformMatrix4x3fv</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROGRAMUNIFORMMATRIX4X3FVPROC ) mygetprocaddr("glProgramUniformMatrix4x3fv");
glfunc(program_, location_, count_, transpose_, value_);
return;
}
void glProvokingVertex (GLenum mode_ ){
/* <command>
<proto>void <name>glProvokingVertex</name></proto>
<param><ptype>GLenum</ptype> <name>mode</name></param>
</command>
*/
static PFNGLPROVOKINGVERTEXPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPROVOKINGVERTEXPROC ) mygetprocaddr("glProvokingVertex");
glfunc(mode_);
return;
}
void glPushDebugGroup (GLenum source_ , GLuint id_ , GLsizei length_ , const GLchar * message_ ){
/* <command>
<proto>void <name>glPushDebugGroup</name></proto>
<param><ptype>GLenum</ptype> <name>source</name></param>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLsizei</ptype> <name>length</name></param>
<param len="COMPSIZE(message,length)">const <ptype>GLchar</ptype> *<name>message</name></param>
</command>
*/
static PFNGLPUSHDEBUGGROUPPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLPUSHDEBUGGROUPPROC ) mygetprocaddr("glPushDebugGroup");
glfunc(source_, id_, length_, message_);
return;
}
void glQueryCounter (GLuint id_ , GLenum target_ ){
/* <command>
<proto>void <name>glQueryCounter</name></proto>
<param><ptype>GLuint</ptype> <name>id</name></param>
<param><ptype>GLenum</ptype> <name>target</name></param>
</command>
*/
static PFNGLQUERYCOUNTERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLQUERYCOUNTERPROC ) mygetprocaddr("glQueryCounter");
glfunc(id_, target_);
return;
}
void glReadBuffer (GLenum src_ ){
/* <command>
<proto>void <name>glReadBuffer</name></proto>
<param group="ReadBufferMode"><ptype>GLenum</ptype> <name>src</name></param>
<glx opcode="171" type="render" />
</command>
*/
static PFNGLREADBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLREADBUFFERPROC ) mygetprocaddr("glReadBuffer");
glfunc(src_);
return;
}
void glReadPixels (GLint x_ , GLint y_ , GLsizei width_ , GLsizei height_ , GLenum format_ , GLenum type_ , void * pixels_ ){
/* <command>
<proto>void <name>glReadPixels</name></proto>
<param group="WinCoord"><ptype>GLint</ptype> <name>x</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param group="PixelType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(format,type,width,height)">void *<name>pixels</name></param>
<glx opcode="111" type="single" />
<glx comment="PBO protocol" name="glReadPixelsPBO" opcode="345" type="render" />
</command>
*/
static PFNGLREADPIXELSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLREADPIXELSPROC ) mygetprocaddr("glReadPixels");
glfunc(x_, y_, width_, height_, format_, type_, pixels_);
return;
}
void glReadnPixels (GLint x_ , GLint y_ , GLsizei width_ , GLsizei height_ , GLenum format_ , GLenum type_ , GLsizei bufSize_ , void * data_ ){
/* <command>
<proto>void <name>glReadnPixels</name></proto>
<param><ptype>GLint</ptype> <name>x</name></param>
<param><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param><ptype>GLsizei</ptype> <name>bufSize</name></param>
<param>void *<name>data</name></param>
</command>
*/
static PFNGLREADNPIXELSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLREADNPIXELSPROC ) mygetprocaddr("glReadnPixels");
glfunc(x_, y_, width_, height_, format_, type_, bufSize_, data_);
return;
}
void glReleaseShaderCompiler (){
/* <command>
<proto>void <name>glReleaseShaderCompiler</name></proto>
</command>
*/
static PFNGLRELEASESHADERCOMPILERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLRELEASESHADERCOMPILERPROC ) mygetprocaddr("glReleaseShaderCompiler");
glfunc();
return;
}
void glRenderbufferStorage (GLenum target_ , GLenum internalformat_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glRenderbufferStorage</name></proto>
<param group="RenderbufferTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<glx opcode="4318" type="render" />
</command>
*/
static PFNGLRENDERBUFFERSTORAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLRENDERBUFFERSTORAGEPROC ) mygetprocaddr("glRenderbufferStorage");
glfunc(target_, internalformat_, width_, height_);
return;
}
void glRenderbufferStorageMultisample (GLenum target_ , GLsizei samples_ , GLenum internalformat_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glRenderbufferStorageMultisample</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLsizei</ptype> <name>samples</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<glx opcode="4331" type="render" />
</command>
*/
static PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLRENDERBUFFERSTORAGEMULTISAMPLEPROC ) mygetprocaddr("glRenderbufferStorageMultisample");
glfunc(target_, samples_, internalformat_, width_, height_);
return;
}
void glResumeTransformFeedback (){
/* <command>
<proto>void <name>glResumeTransformFeedback</name></proto>
</command>
*/
static PFNGLRESUMETRANSFORMFEEDBACKPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLRESUMETRANSFORMFEEDBACKPROC ) mygetprocaddr("glResumeTransformFeedback");
glfunc();
return;
}
void glSampleCoverage (GLfloat value_ , GLboolean invert_ ){
/* <command>
<proto>void <name>glSampleCoverage</name></proto>
<param><ptype>GLfloat</ptype> <name>value</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>invert</name></param>
<glx opcode="229" type="render" />
</command>
*/
static PFNGLSAMPLECOVERAGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSAMPLECOVERAGEPROC ) mygetprocaddr("glSampleCoverage");
glfunc(value_, invert_);
return;
}
void glSampleMaski (GLuint maskNumber_ , GLbitfield mask_ ){
/* <command>
<proto>void <name>glSampleMaski</name></proto>
<param><ptype>GLuint</ptype> <name>maskNumber</name></param>
<param><ptype>GLbitfield</ptype> <name>mask</name></param>
</command>
*/
static PFNGLSAMPLEMASKIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSAMPLEMASKIPROC ) mygetprocaddr("glSampleMaski");
glfunc(maskNumber_, mask_);
return;
}
void glSamplerParameterIiv (GLuint sampler_ , GLenum pname_ , const GLint * param_ ){
/* <command>
<proto>void <name>glSamplerParameterIiv</name></proto>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)">const <ptype>GLint</ptype> *<name>param</name></param>
</command>
*/
static PFNGLSAMPLERPARAMETERIIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSAMPLERPARAMETERIIVPROC ) mygetprocaddr("glSamplerParameterIiv");
glfunc(sampler_, pname_, param_);
return;
}
void glSamplerParameterIuiv (GLuint sampler_ , GLenum pname_ , const GLuint * param_ ){
/* <command>
<proto>void <name>glSamplerParameterIuiv</name></proto>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)">const <ptype>GLuint</ptype> *<name>param</name></param>
</command>
*/
static PFNGLSAMPLERPARAMETERIUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSAMPLERPARAMETERIUIVPROC ) mygetprocaddr("glSamplerParameterIuiv");
glfunc(sampler_, pname_, param_);
return;
}
void glSamplerParameterf (GLuint sampler_ , GLenum pname_ , GLfloat param_ ){
/* <command>
<proto>void <name>glSamplerParameterf</name></proto>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLfloat</ptype> <name>param</name></param>
</command>
*/
static PFNGLSAMPLERPARAMETERFPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSAMPLERPARAMETERFPROC ) mygetprocaddr("glSamplerParameterf");
glfunc(sampler_, pname_, param_);
return;
}
void glSamplerParameterfv (GLuint sampler_ , GLenum pname_ , const GLfloat * param_ ){
/* <command>
<proto>void <name>glSamplerParameterfv</name></proto>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)">const <ptype>GLfloat</ptype> *<name>param</name></param>
</command>
*/
static PFNGLSAMPLERPARAMETERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSAMPLERPARAMETERFVPROC ) mygetprocaddr("glSamplerParameterfv");
glfunc(sampler_, pname_, param_);
return;
}
void glSamplerParameteri (GLuint sampler_ , GLenum pname_ , GLint param_ ){
/* <command>
<proto>void <name>glSamplerParameteri</name></proto>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> <name>param</name></param>
</command>
*/
static PFNGLSAMPLERPARAMETERIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSAMPLERPARAMETERIPROC ) mygetprocaddr("glSamplerParameteri");
glfunc(sampler_, pname_, param_);
return;
}
void glSamplerParameteriv (GLuint sampler_ , GLenum pname_ , const GLint * param_ ){
/* <command>
<proto>void <name>glSamplerParameteriv</name></proto>
<param><ptype>GLuint</ptype> <name>sampler</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)">const <ptype>GLint</ptype> *<name>param</name></param>
</command>
*/
static PFNGLSAMPLERPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSAMPLERPARAMETERIVPROC ) mygetprocaddr("glSamplerParameteriv");
glfunc(sampler_, pname_, param_);
return;
}
void glScissor (GLint x_ , GLint y_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glScissor</name></proto>
<param group="WinCoord"><ptype>GLint</ptype> <name>x</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<glx opcode="103" type="render" />
</command>
*/
static PFNGLSCISSORPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSCISSORPROC ) mygetprocaddr("glScissor");
glfunc(x_, y_, width_, height_);
return;
}
void glScissorArrayv (GLuint first_ , GLsizei count_ , const GLint * v_ ){
/* <command>
<proto>void <name>glScissorArrayv</name></proto>
<param><ptype>GLuint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="COMPSIZE(count)">const <ptype>GLint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLSCISSORARRAYVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSCISSORARRAYVPROC ) mygetprocaddr("glScissorArrayv");
glfunc(first_, count_, v_);
return;
}
void glScissorIndexed (GLuint index_ , GLint left_ , GLint bottom_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glScissorIndexed</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLint</ptype> <name>left</name></param>
<param><ptype>GLint</ptype> <name>bottom</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
</command>
*/
static PFNGLSCISSORINDEXEDPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSCISSORINDEXEDPROC ) mygetprocaddr("glScissorIndexed");
glfunc(index_, left_, bottom_, width_, height_);
return;
}
void glScissorIndexedv (GLuint index_ , const GLint * v_ ){
/* <command>
<proto>void <name>glScissorIndexedv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLSCISSORINDEXEDVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSCISSORINDEXEDVPROC ) mygetprocaddr("glScissorIndexedv");
glfunc(index_, v_);
return;
}
void glShaderBinary (GLsizei count_ , const GLuint * shaders_ , GLenum binaryformat_ , const void * binary_ , GLsizei length_ ){
/* <command>
<proto>void <name>glShaderBinary</name></proto>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLuint</ptype> *<name>shaders</name></param>
<param><ptype>GLenum</ptype> <name>binaryformat</name></param>
<param len="length">const void *<name>binary</name></param>
<param><ptype>GLsizei</ptype> <name>length</name></param>
</command>
*/
static PFNGLSHADERBINARYPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSHADERBINARYPROC ) mygetprocaddr("glShaderBinary");
glfunc(count_, shaders_, binaryformat_, binary_, length_);
return;
}
void glShaderSource (GLuint shader_ , GLsizei count_ , const GLchar ** string_ , const GLint * length_ ){
/* <command>
<proto>void <name>glShaderSource</name></proto>
<param><ptype>GLuint</ptype> <name>shader</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLchar</ptype> *const*<name>string</name></param>
<param len="count">const <ptype>GLint</ptype> *<name>length</name></param>
</command>
*/
static PFNGLSHADERSOURCEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSHADERSOURCEPROC ) mygetprocaddr("glShaderSource");
glfunc(shader_, count_, string_, length_);
return;
}
void glShaderStorageBlockBinding (GLuint program_ , GLuint storageBlockIndex_ , GLuint storageBlockBinding_ ){
/* <command>
<proto>void <name>glShaderStorageBlockBinding</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>storageBlockIndex</name></param>
<param><ptype>GLuint</ptype> <name>storageBlockBinding</name></param>
</command>
*/
static PFNGLSHADERSTORAGEBLOCKBINDINGPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSHADERSTORAGEBLOCKBINDINGPROC ) mygetprocaddr("glShaderStorageBlockBinding");
glfunc(program_, storageBlockIndex_, storageBlockBinding_);
return;
}
void glStencilFunc (GLenum func_ , GLint ref_ , GLuint mask_ ){
/* <command>
<proto>void <name>glStencilFunc</name></proto>
<param group="StencilFunction"><ptype>GLenum</ptype> <name>func</name></param>
<param group="StencilValue"><ptype>GLint</ptype> <name>ref</name></param>
<param group="MaskedStencilValue"><ptype>GLuint</ptype> <name>mask</name></param>
<glx opcode="162" type="render" />
</command>
*/
static PFNGLSTENCILFUNCPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSTENCILFUNCPROC ) mygetprocaddr("glStencilFunc");
glfunc(func_, ref_, mask_);
return;
}
void glStencilFuncSeparate (GLenum face_ , GLenum func_ , GLint ref_ , GLuint mask_ ){
/* <command>
<proto>void <name>glStencilFuncSeparate</name></proto>
<param group="StencilFaceDirection"><ptype>GLenum</ptype> <name>face</name></param>
<param group="StencilFunction"><ptype>GLenum</ptype> <name>func</name></param>
<param group="StencilValue"><ptype>GLint</ptype> <name>ref</name></param>
<param group="MaskedStencilValue"><ptype>GLuint</ptype> <name>mask</name></param>
</command>
*/
static PFNGLSTENCILFUNCSEPARATEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSTENCILFUNCSEPARATEPROC ) mygetprocaddr("glStencilFuncSeparate");
glfunc(face_, func_, ref_, mask_);
return;
}
void glStencilMask (GLuint mask_ ){
/* <command>
<proto>void <name>glStencilMask</name></proto>
<param group="MaskedStencilValue"><ptype>GLuint</ptype> <name>mask</name></param>
<glx opcode="133" type="render" />
</command>
*/
static PFNGLSTENCILMASKPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSTENCILMASKPROC ) mygetprocaddr("glStencilMask");
glfunc(mask_);
return;
}
void glStencilMaskSeparate (GLenum face_ , GLuint mask_ ){
/* <command>
<proto>void <name>glStencilMaskSeparate</name></proto>
<param group="StencilFaceDirection"><ptype>GLenum</ptype> <name>face</name></param>
<param group="MaskedStencilValue"><ptype>GLuint</ptype> <name>mask</name></param>
</command>
*/
static PFNGLSTENCILMASKSEPARATEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSTENCILMASKSEPARATEPROC ) mygetprocaddr("glStencilMaskSeparate");
glfunc(face_, mask_);
return;
}
void glStencilOp (GLenum fail_ , GLenum zfail_ , GLenum zpass_ ){
/* <command>
<proto>void <name>glStencilOp</name></proto>
<param group="StencilOp"><ptype>GLenum</ptype> <name>fail</name></param>
<param group="StencilOp"><ptype>GLenum</ptype> <name>zfail</name></param>
<param group="StencilOp"><ptype>GLenum</ptype> <name>zpass</name></param>
<glx opcode="163" type="render" />
</command>
*/
static PFNGLSTENCILOPPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSTENCILOPPROC ) mygetprocaddr("glStencilOp");
glfunc(fail_, zfail_, zpass_);
return;
}
void glStencilOpSeparate (GLenum face_ , GLenum sfail_ , GLenum dpfail_ , GLenum dppass_ ){
/* <command>
<proto>void <name>glStencilOpSeparate</name></proto>
<param group="StencilFaceDirection"><ptype>GLenum</ptype> <name>face</name></param>
<param group="StencilOp"><ptype>GLenum</ptype> <name>sfail</name></param>
<param group="StencilOp"><ptype>GLenum</ptype> <name>dpfail</name></param>
<param group="StencilOp"><ptype>GLenum</ptype> <name>dppass</name></param>
</command>
*/
static PFNGLSTENCILOPSEPARATEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLSTENCILOPSEPARATEPROC ) mygetprocaddr("glStencilOpSeparate");
glfunc(face_, sfail_, dpfail_, dppass_);
return;
}
void glTexBuffer (GLenum target_ , GLenum internalformat_ , GLuint buffer_ ){
/* <command>
<proto>void <name>glTexBuffer</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
</command>
*/
static PFNGLTEXBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXBUFFERPROC ) mygetprocaddr("glTexBuffer");
glfunc(target_, internalformat_, buffer_);
return;
}
void glTexBufferRange (GLenum target_ , GLenum internalformat_ , GLuint buffer_ , GLintptr offset_ , GLsizeiptr size_ ){
/* <command>
<proto>void <name>glTexBufferRange</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param group="BufferOffset"><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
</command>
*/
static PFNGLTEXBUFFERRANGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXBUFFERRANGEPROC ) mygetprocaddr("glTexBufferRange");
glfunc(target_, internalformat_, buffer_, offset_, size_);
return;
}
void glTexImage1D (GLenum target_ , GLint level_ , GLint internalformat_ , GLsizei width_ , GLint border_ , GLenum format_ , GLenum type_ , const void * pixels_ ){
/* <command>
<proto>void <name>glTexImage1D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="TextureComponentCount"><ptype>GLint</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>border</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param group="PixelType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(format,type,width)">const void *<name>pixels</name></param>
<glx opcode="109" type="render" />
<glx comment="PBO protocol" name="glTexImage1DPBO" opcode="328" type="render" />
</command>
*/
static PFNGLTEXIMAGE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXIMAGE1DPROC ) mygetprocaddr("glTexImage1D");
glfunc(target_, level_, internalformat_, width_, border_, format_, type_, pixels_);
return;
}
void glTexImage2D (GLenum target_ , GLint level_ , GLint internalformat_ , GLsizei width_ , GLsizei height_ , GLint border_ , GLenum format_ , GLenum type_ , const void * pixels_ ){
/* <command>
<proto>void <name>glTexImage2D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="TextureComponentCount"><ptype>GLint</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>border</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param group="PixelType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(format,type,width,height)">const void *<name>pixels</name></param>
<glx opcode="110" type="render" />
<glx comment="PBO protocol" name="glTexImage2DPBO" opcode="329" type="render" />
</command>
*/
static PFNGLTEXIMAGE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXIMAGE2DPROC ) mygetprocaddr("glTexImage2D");
glfunc(target_, level_, internalformat_, width_, height_, border_, format_, type_, pixels_);
return;
}
void glTexImage3D (GLenum target_ , GLint level_ , GLint internalformat_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ , GLint border_ , GLenum format_ , GLenum type_ , const void * pixels_ ){
/* <command>
<proto>void <name>glTexImage3D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="TextureComponentCount"><ptype>GLint</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>border</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param group="PixelType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(format,type,width,height,depth)">const void *<name>pixels</name></param>
<glx opcode="4114" type="render" />
<glx comment="PBO protocol" name="glTexImage3DPBO" opcode="330" type="render" />
</command>
*/
static PFNGLTEXIMAGE3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXIMAGE3DPROC ) mygetprocaddr("glTexImage3D");
glfunc(target_, level_, internalformat_, width_, height_, depth_, border_, format_, type_, pixels_);
return;
}
void glTexParameterIiv (GLenum target_ , GLenum pname_ , const GLint * params_ ){
/* <command>
<proto>void <name>glTexParameterIiv</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="TextureParameterName"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)">const <ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="346" type="render" />
</command>
*/
static PFNGLTEXPARAMETERIIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXPARAMETERIIVPROC ) mygetprocaddr("glTexParameterIiv");
glfunc(target_, pname_, params_);
return;
}
void glTexParameterIuiv (GLenum target_ , GLenum pname_ , const GLuint * params_ ){
/* <command>
<proto>void <name>glTexParameterIuiv</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="TextureParameterName"><ptype>GLenum</ptype> <name>pname</name></param>
<param len="COMPSIZE(pname)">const <ptype>GLuint</ptype> *<name>params</name></param>
<glx opcode="347" type="render" />
</command>
*/
static PFNGLTEXPARAMETERIUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXPARAMETERIUIVPROC ) mygetprocaddr("glTexParameterIuiv");
glfunc(target_, pname_, params_);
return;
}
void glTexParameterf (GLenum target_ , GLenum pname_ , GLfloat param_ ){
/* <command>
<proto>void <name>glTexParameterf</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="TextureParameterName"><ptype>GLenum</ptype> <name>pname</name></param>
<param group="CheckedFloat32"><ptype>GLfloat</ptype> <name>param</name></param>
<glx opcode="105" type="render" />
</command>
*/
static PFNGLTEXPARAMETERFPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXPARAMETERFPROC ) mygetprocaddr("glTexParameterf");
glfunc(target_, pname_, param_);
return;
}
void glTexParameterfv (GLenum target_ , GLenum pname_ , const GLfloat * params_ ){
/* <command>
<proto>void <name>glTexParameterfv</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="TextureParameterName"><ptype>GLenum</ptype> <name>pname</name></param>
<param group="CheckedFloat32" len="COMPSIZE(pname)">const <ptype>GLfloat</ptype> *<name>params</name></param>
<glx opcode="106" type="render" />
</command>
*/
static PFNGLTEXPARAMETERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXPARAMETERFVPROC ) mygetprocaddr("glTexParameterfv");
glfunc(target_, pname_, params_);
return;
}
void glTexParameteri (GLenum target_ , GLenum pname_ , GLint param_ ){
/* <command>
<proto>void <name>glTexParameteri</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="TextureParameterName"><ptype>GLenum</ptype> <name>pname</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>param</name></param>
<glx opcode="107" type="render" />
</command>
*/
static PFNGLTEXPARAMETERIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXPARAMETERIPROC ) mygetprocaddr("glTexParameteri");
glfunc(target_, pname_, param_);
return;
}
void glTexParameteriv (GLenum target_ , GLenum pname_ , const GLint * params_ ){
/* <command>
<proto>void <name>glTexParameteriv</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="TextureParameterName"><ptype>GLenum</ptype> <name>pname</name></param>
<param group="CheckedInt32" len="COMPSIZE(pname)">const <ptype>GLint</ptype> *<name>params</name></param>
<glx opcode="108" type="render" />
</command>
*/
static PFNGLTEXPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXPARAMETERIVPROC ) mygetprocaddr("glTexParameteriv");
glfunc(target_, pname_, params_);
return;
}
void glTexStorage1D (GLenum target_ , GLsizei levels_ , GLenum internalformat_ , GLsizei width_ ){
/* <command>
<proto>void <name>glTexStorage1D</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLsizei</ptype> <name>levels</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
</command>
*/
static PFNGLTEXSTORAGE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXSTORAGE1DPROC ) mygetprocaddr("glTexStorage1D");
glfunc(target_, levels_, internalformat_, width_);
return;
}
void glTexStorage2D (GLenum target_ , GLsizei levels_ , GLenum internalformat_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glTexStorage2D</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLsizei</ptype> <name>levels</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
</command>
*/
static PFNGLTEXSTORAGE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXSTORAGE2DPROC ) mygetprocaddr("glTexStorage2D");
glfunc(target_, levels_, internalformat_, width_, height_);
return;
}
void glTexStorage3D (GLenum target_ , GLsizei levels_ , GLenum internalformat_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ ){
/* <command>
<proto>void <name>glTexStorage3D</name></proto>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLsizei</ptype> <name>levels</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
</command>
*/
static PFNGLTEXSTORAGE3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXSTORAGE3DPROC ) mygetprocaddr("glTexStorage3D");
glfunc(target_, levels_, internalformat_, width_, height_, depth_);
return;
}
void glTexSubImage1D (GLenum target_ , GLint level_ , GLint xoffset_ , GLsizei width_ , GLenum format_ , GLenum type_ , const void * pixels_ ){
/* <command>
<proto>void <name>glTexSubImage1D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param group="PixelType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(format,type,width)">const void *<name>pixels</name></param>
<glx opcode="4099" type="render" />
<glx comment="PBO protocol" name="glTexSubImage1DPBO" opcode="331" type="render" />
</command>
*/
static PFNGLTEXSUBIMAGE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXSUBIMAGE1DPROC ) mygetprocaddr("glTexSubImage1D");
glfunc(target_, level_, xoffset_, width_, format_, type_, pixels_);
return;
}
void glTexSubImage2D (GLenum target_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLsizei width_ , GLsizei height_ , GLenum format_ , GLenum type_ , const void * pixels_ ){
/* <command>
<proto>void <name>glTexSubImage2D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>xoffset</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param group="PixelType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(format,type,width,height)">const void *<name>pixels</name></param>
<glx opcode="4100" type="render" />
<glx comment="PBO protocol" name="glTexSubImage2DPBO" opcode="332" type="render" />
</command>
*/
static PFNGLTEXSUBIMAGE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXSUBIMAGE2DPROC ) mygetprocaddr("glTexSubImage2D");
glfunc(target_, level_, xoffset_, yoffset_, width_, height_, format_, type_, pixels_);
return;
}
void glTexSubImage3D (GLenum target_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint zoffset_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ , GLenum format_ , GLenum type_ , const void * pixels_ ){
/* <command>
<proto>void <name>glTexSubImage3D</name></proto>
<param group="TextureTarget"><ptype>GLenum</ptype> <name>target</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>level</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>xoffset</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>yoffset</name></param>
<param group="CheckedInt32"><ptype>GLint</ptype> <name>zoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
<param group="PixelFormat"><ptype>GLenum</ptype> <name>format</name></param>
<param group="PixelType"><ptype>GLenum</ptype> <name>type</name></param>
<param len="COMPSIZE(format,type,width,height,depth)">const void *<name>pixels</name></param>
<glx opcode="4115" type="render" />
<glx comment="PBO protocol" name="glTexSubImage3DPBO" opcode="333" type="render" />
</command>
*/
static PFNGLTEXSUBIMAGE3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXSUBIMAGE3DPROC ) mygetprocaddr("glTexSubImage3D");
glfunc(target_, level_, xoffset_, yoffset_, zoffset_, width_, height_, depth_, format_, type_, pixels_);
return;
}
void glTextureBarrier (){
/* <command>
<proto>void <name>glTextureBarrier</name></proto>
</command>
*/
static PFNGLTEXTUREBARRIERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTUREBARRIERPROC ) mygetprocaddr("glTextureBarrier");
glfunc();
return;
}
void glTextureBuffer (GLuint texture_ , GLenum internalformat_ , GLuint buffer_ ){
/* <command>
<proto>void <name>glTextureBuffer</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
</command>
*/
static PFNGLTEXTUREBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTUREBUFFERPROC ) mygetprocaddr("glTextureBuffer");
glfunc(texture_, internalformat_, buffer_);
return;
}
void glTextureBufferRange (GLuint texture_ , GLenum internalformat_ , GLuint buffer_ , GLintptr offset_ , GLsizeiptr size_ ){
/* <command>
<proto>void <name>glTextureBufferRange</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
</command>
*/
static PFNGLTEXTUREBUFFERRANGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTUREBUFFERRANGEPROC ) mygetprocaddr("glTextureBufferRange");
glfunc(texture_, internalformat_, buffer_, offset_, size_);
return;
}
void glTextureParameterIiv (GLuint texture_ , GLenum pname_ , const GLint * params_ ){
/* <command>
<proto>void <name>glTextureParameterIiv</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param>const <ptype>GLint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLTEXTUREPARAMETERIIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTUREPARAMETERIIVPROC ) mygetprocaddr("glTextureParameterIiv");
glfunc(texture_, pname_, params_);
return;
}
void glTextureParameterIuiv (GLuint texture_ , GLenum pname_ , const GLuint * params_ ){
/* <command>
<proto>void <name>glTextureParameterIuiv</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param>const <ptype>GLuint</ptype> *<name>params</name></param>
</command>
*/
static PFNGLTEXTUREPARAMETERIUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTUREPARAMETERIUIVPROC ) mygetprocaddr("glTextureParameterIuiv");
glfunc(texture_, pname_, params_);
return;
}
void glTextureParameterf (GLuint texture_ , GLenum pname_ , GLfloat param_ ){
/* <command>
<proto>void <name>glTextureParameterf</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLfloat</ptype> <name>param</name></param>
</command>
*/
static PFNGLTEXTUREPARAMETERFPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTUREPARAMETERFPROC ) mygetprocaddr("glTextureParameterf");
glfunc(texture_, pname_, param_);
return;
}
void glTextureParameterfv (GLuint texture_ , GLenum pname_ , const GLfloat * param_ ){
/* <command>
<proto>void <name>glTextureParameterfv</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param>const <ptype>GLfloat</ptype> *<name>param</name></param>
</command>
*/
static PFNGLTEXTUREPARAMETERFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTUREPARAMETERFVPROC ) mygetprocaddr("glTextureParameterfv");
glfunc(texture_, pname_, param_);
return;
}
void glTextureParameteri (GLuint texture_ , GLenum pname_ , GLint param_ ){
/* <command>
<proto>void <name>glTextureParameteri</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param><ptype>GLint</ptype> <name>param</name></param>
</command>
*/
static PFNGLTEXTUREPARAMETERIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTUREPARAMETERIPROC ) mygetprocaddr("glTextureParameteri");
glfunc(texture_, pname_, param_);
return;
}
void glTextureParameteriv (GLuint texture_ , GLenum pname_ , const GLint * param_ ){
/* <command>
<proto>void <name>glTextureParameteriv</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>pname</name></param>
<param>const <ptype>GLint</ptype> *<name>param</name></param>
</command>
*/
static PFNGLTEXTUREPARAMETERIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTUREPARAMETERIVPROC ) mygetprocaddr("glTextureParameteriv");
glfunc(texture_, pname_, param_);
return;
}
void glTextureStorage1D (GLuint texture_ , GLsizei levels_ , GLenum internalformat_ , GLsizei width_ ){
/* <command>
<proto>void <name>glTextureStorage1D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLsizei</ptype> <name>levels</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
</command>
*/
static PFNGLTEXTURESTORAGE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTURESTORAGE1DPROC ) mygetprocaddr("glTextureStorage1D");
glfunc(texture_, levels_, internalformat_, width_);
return;
}
void glTextureStorage2D (GLuint texture_ , GLsizei levels_ , GLenum internalformat_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glTextureStorage2D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLsizei</ptype> <name>levels</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
</command>
*/
static PFNGLTEXTURESTORAGE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTURESTORAGE2DPROC ) mygetprocaddr("glTextureStorage2D");
glfunc(texture_, levels_, internalformat_, width_, height_);
return;
}
void glTextureStorage3D (GLuint texture_ , GLsizei levels_ , GLenum internalformat_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ ){
/* <command>
<proto>void <name>glTextureStorage3D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLsizei</ptype> <name>levels</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
</command>
*/
static PFNGLTEXTURESTORAGE3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTURESTORAGE3DPROC ) mygetprocaddr("glTextureStorage3D");
glfunc(texture_, levels_, internalformat_, width_, height_, depth_);
return;
}
void glTextureSubImage1D (GLuint texture_ , GLint level_ , GLint xoffset_ , GLsizei width_ , GLenum format_ , GLenum type_ , const void * pixels_ ){
/* <command>
<proto>void <name>glTextureSubImage1D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param>const void *<name>pixels</name></param>
</command>
*/
static PFNGLTEXTURESUBIMAGE1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTURESUBIMAGE1DPROC ) mygetprocaddr("glTextureSubImage1D");
glfunc(texture_, level_, xoffset_, width_, format_, type_, pixels_);
return;
}
void glTextureSubImage2D (GLuint texture_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLsizei width_ , GLsizei height_ , GLenum format_ , GLenum type_ , const void * pixels_ ){
/* <command>
<proto>void <name>glTextureSubImage2D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param>const void *<name>pixels</name></param>
</command>
*/
static PFNGLTEXTURESUBIMAGE2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTURESUBIMAGE2DPROC ) mygetprocaddr("glTextureSubImage2D");
glfunc(texture_, level_, xoffset_, yoffset_, width_, height_, format_, type_, pixels_);
return;
}
void glTextureSubImage3D (GLuint texture_ , GLint level_ , GLint xoffset_ , GLint yoffset_ , GLint zoffset_ , GLsizei width_ , GLsizei height_ , GLsizei depth_ , GLenum format_ , GLenum type_ , const void * pixels_ ){
/* <command>
<proto>void <name>glTextureSubImage3D</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLint</ptype> <name>level</name></param>
<param><ptype>GLint</ptype> <name>xoffset</name></param>
<param><ptype>GLint</ptype> <name>yoffset</name></param>
<param><ptype>GLint</ptype> <name>zoffset</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<param><ptype>GLsizei</ptype> <name>depth</name></param>
<param><ptype>GLenum</ptype> <name>format</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param>const void *<name>pixels</name></param>
</command>
*/
static PFNGLTEXTURESUBIMAGE3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTURESUBIMAGE3DPROC ) mygetprocaddr("glTextureSubImage3D");
glfunc(texture_, level_, xoffset_, yoffset_, zoffset_, width_, height_, depth_, format_, type_, pixels_);
return;
}
void glTextureView (GLuint texture_ , GLenum target_ , GLuint origtexture_ , GLenum internalformat_ , GLuint minlevel_ , GLuint numlevels_ , GLuint minlayer_ , GLuint numlayers_ ){
/* <command>
<proto>void <name>glTextureView</name></proto>
<param><ptype>GLuint</ptype> <name>texture</name></param>
<param><ptype>GLenum</ptype> <name>target</name></param>
<param><ptype>GLuint</ptype> <name>origtexture</name></param>
<param><ptype>GLenum</ptype> <name>internalformat</name></param>
<param><ptype>GLuint</ptype> <name>minlevel</name></param>
<param><ptype>GLuint</ptype> <name>numlevels</name></param>
<param><ptype>GLuint</ptype> <name>minlayer</name></param>
<param><ptype>GLuint</ptype> <name>numlayers</name></param>
</command>
*/
static PFNGLTEXTUREVIEWPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTEXTUREVIEWPROC ) mygetprocaddr("glTextureView");
glfunc(texture_, target_, origtexture_, internalformat_, minlevel_, numlevels_, minlayer_, numlayers_);
return;
}
void glTransformFeedbackBufferBase (GLuint xfb_ , GLuint index_ , GLuint buffer_ ){
/* <command>
<proto>void <name>glTransformFeedbackBufferBase</name></proto>
<param><ptype>GLuint</ptype> <name>xfb</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
</command>
*/
static PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTRANSFORMFEEDBACKBUFFERBASEPROC ) mygetprocaddr("glTransformFeedbackBufferBase");
glfunc(xfb_, index_, buffer_);
return;
}
void glTransformFeedbackBufferRange (GLuint xfb_ , GLuint index_ , GLuint buffer_ , GLintptr offset_ , GLsizeiptr size_ ){
/* <command>
<proto>void <name>glTransformFeedbackBufferRange</name></proto>
<param><ptype>GLuint</ptype> <name>xfb</name></param>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
<param group="BufferSize"><ptype>GLsizeiptr</ptype> <name>size</name></param>
</command>
*/
static PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTRANSFORMFEEDBACKBUFFERRANGEPROC ) mygetprocaddr("glTransformFeedbackBufferRange");
glfunc(xfb_, index_, buffer_, offset_, size_);
return;
}
void glTransformFeedbackVaryings (GLuint program_ , GLsizei count_ , const GLchar ** varyings_ , GLenum bufferMode_ ){
/* <command>
<proto>void <name>glTransformFeedbackVaryings</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLchar</ptype> *const*<name>varyings</name></param>
<param><ptype>GLenum</ptype> <name>bufferMode</name></param>
</command>
*/
static PFNGLTRANSFORMFEEDBACKVARYINGSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLTRANSFORMFEEDBACKVARYINGSPROC ) mygetprocaddr("glTransformFeedbackVaryings");
glfunc(program_, count_, varyings_, bufferMode_);
return;
}
void glUniform1d (GLint location_ , GLdouble x_ ){
/* <command>
<proto>void <name>glUniform1d</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
</command>
*/
static PFNGLUNIFORM1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM1DPROC ) mygetprocaddr("glUniform1d");
glfunc(location_, x_);
return;
}
void glUniform1dv (GLint location_ , GLsizei count_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniform1dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*1">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM1DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM1DVPROC ) mygetprocaddr("glUniform1dv");
glfunc(location_, count_, value_);
return;
}
void glUniform1f (GLint location_ , GLfloat v0_ ){
/* <command>
<proto>void <name>glUniform1f</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLfloat</ptype> <name>v0</name></param>
</command>
*/
static PFNGLUNIFORM1FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM1FPROC ) mygetprocaddr("glUniform1f");
glfunc(location_, v0_);
return;
}
void glUniform1fv (GLint location_ , GLsizei count_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniform1fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*1">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM1FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM1FVPROC ) mygetprocaddr("glUniform1fv");
glfunc(location_, count_, value_);
return;
}
void glUniform1i (GLint location_ , GLint v0_ ){
/* <command>
<proto>void <name>glUniform1i</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLint</ptype> <name>v0</name></param>
</command>
*/
static PFNGLUNIFORM1IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM1IPROC ) mygetprocaddr("glUniform1i");
glfunc(location_, v0_);
return;
}
void glUniform1iv (GLint location_ , GLsizei count_ , const GLint * value_ ){
/* <command>
<proto>void <name>glUniform1iv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*1">const <ptype>GLint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM1IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM1IVPROC ) mygetprocaddr("glUniform1iv");
glfunc(location_, count_, value_);
return;
}
void glUniform1ui (GLint location_ , GLuint v0_ ){
/* <command>
<proto>void <name>glUniform1ui</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLuint</ptype> <name>v0</name></param>
</command>
*/
static PFNGLUNIFORM1UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM1UIPROC ) mygetprocaddr("glUniform1ui");
glfunc(location_, v0_);
return;
}
void glUniform1uiv (GLint location_ , GLsizei count_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glUniform1uiv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*1">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM1UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM1UIVPROC ) mygetprocaddr("glUniform1uiv");
glfunc(location_, count_, value_);
return;
}
void glUniform2d (GLint location_ , GLdouble x_ , GLdouble y_ ){
/* <command>
<proto>void <name>glUniform2d</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
<param><ptype>GLdouble</ptype> <name>y</name></param>
</command>
*/
static PFNGLUNIFORM2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM2DPROC ) mygetprocaddr("glUniform2d");
glfunc(location_, x_, y_);
return;
}
void glUniform2dv (GLint location_ , GLsizei count_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniform2dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*2">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM2DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM2DVPROC ) mygetprocaddr("glUniform2dv");
glfunc(location_, count_, value_);
return;
}
void glUniform2f (GLint location_ , GLfloat v0_ , GLfloat v1_ ){
/* <command>
<proto>void <name>glUniform2f</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLfloat</ptype> <name>v0</name></param>
<param><ptype>GLfloat</ptype> <name>v1</name></param>
</command>
*/
static PFNGLUNIFORM2FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM2FPROC ) mygetprocaddr("glUniform2f");
glfunc(location_, v0_, v1_);
return;
}
void glUniform2fv (GLint location_ , GLsizei count_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniform2fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*2">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM2FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM2FVPROC ) mygetprocaddr("glUniform2fv");
glfunc(location_, count_, value_);
return;
}
void glUniform2i (GLint location_ , GLint v0_ , GLint v1_ ){
/* <command>
<proto>void <name>glUniform2i</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLint</ptype> <name>v0</name></param>
<param><ptype>GLint</ptype> <name>v1</name></param>
</command>
*/
static PFNGLUNIFORM2IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM2IPROC ) mygetprocaddr("glUniform2i");
glfunc(location_, v0_, v1_);
return;
}
void glUniform2iv (GLint location_ , GLsizei count_ , const GLint * value_ ){
/* <command>
<proto>void <name>glUniform2iv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*2">const <ptype>GLint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM2IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM2IVPROC ) mygetprocaddr("glUniform2iv");
glfunc(location_, count_, value_);
return;
}
void glUniform2ui (GLint location_ , GLuint v0_ , GLuint v1_ ){
/* <command>
<proto>void <name>glUniform2ui</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLuint</ptype> <name>v0</name></param>
<param><ptype>GLuint</ptype> <name>v1</name></param>
</command>
*/
static PFNGLUNIFORM2UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM2UIPROC ) mygetprocaddr("glUniform2ui");
glfunc(location_, v0_, v1_);
return;
}
void glUniform2uiv (GLint location_ , GLsizei count_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glUniform2uiv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*2">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM2UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM2UIVPROC ) mygetprocaddr("glUniform2uiv");
glfunc(location_, count_, value_);
return;
}
void glUniform3d (GLint location_ , GLdouble x_ , GLdouble y_ , GLdouble z_ ){
/* <command>
<proto>void <name>glUniform3d</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
<param><ptype>GLdouble</ptype> <name>y</name></param>
<param><ptype>GLdouble</ptype> <name>z</name></param>
</command>
*/
static PFNGLUNIFORM3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM3DPROC ) mygetprocaddr("glUniform3d");
glfunc(location_, x_, y_, z_);
return;
}
void glUniform3dv (GLint location_ , GLsizei count_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniform3dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*3">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM3DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM3DVPROC ) mygetprocaddr("glUniform3dv");
glfunc(location_, count_, value_);
return;
}
void glUniform3f (GLint location_ , GLfloat v0_ , GLfloat v1_ , GLfloat v2_ ){
/* <command>
<proto>void <name>glUniform3f</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLfloat</ptype> <name>v0</name></param>
<param><ptype>GLfloat</ptype> <name>v1</name></param>
<param><ptype>GLfloat</ptype> <name>v2</name></param>
</command>
*/
static PFNGLUNIFORM3FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM3FPROC ) mygetprocaddr("glUniform3f");
glfunc(location_, v0_, v1_, v2_);
return;
}
void glUniform3fv (GLint location_ , GLsizei count_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniform3fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*3">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM3FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM3FVPROC ) mygetprocaddr("glUniform3fv");
glfunc(location_, count_, value_);
return;
}
void glUniform3i (GLint location_ , GLint v0_ , GLint v1_ , GLint v2_ ){
/* <command>
<proto>void <name>glUniform3i</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLint</ptype> <name>v0</name></param>
<param><ptype>GLint</ptype> <name>v1</name></param>
<param><ptype>GLint</ptype> <name>v2</name></param>
</command>
*/
static PFNGLUNIFORM3IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM3IPROC ) mygetprocaddr("glUniform3i");
glfunc(location_, v0_, v1_, v2_);
return;
}
void glUniform3iv (GLint location_ , GLsizei count_ , const GLint * value_ ){
/* <command>
<proto>void <name>glUniform3iv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*3">const <ptype>GLint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM3IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM3IVPROC ) mygetprocaddr("glUniform3iv");
glfunc(location_, count_, value_);
return;
}
void glUniform3ui (GLint location_ , GLuint v0_ , GLuint v1_ , GLuint v2_ ){
/* <command>
<proto>void <name>glUniform3ui</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLuint</ptype> <name>v0</name></param>
<param><ptype>GLuint</ptype> <name>v1</name></param>
<param><ptype>GLuint</ptype> <name>v2</name></param>
</command>
*/
static PFNGLUNIFORM3UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM3UIPROC ) mygetprocaddr("glUniform3ui");
glfunc(location_, v0_, v1_, v2_);
return;
}
void glUniform3uiv (GLint location_ , GLsizei count_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glUniform3uiv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*3">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM3UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM3UIVPROC ) mygetprocaddr("glUniform3uiv");
glfunc(location_, count_, value_);
return;
}
void glUniform4d (GLint location_ , GLdouble x_ , GLdouble y_ , GLdouble z_ , GLdouble w_ ){
/* <command>
<proto>void <name>glUniform4d</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
<param><ptype>GLdouble</ptype> <name>y</name></param>
<param><ptype>GLdouble</ptype> <name>z</name></param>
<param><ptype>GLdouble</ptype> <name>w</name></param>
</command>
*/
static PFNGLUNIFORM4DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM4DPROC ) mygetprocaddr("glUniform4d");
glfunc(location_, x_, y_, z_, w_);
return;
}
void glUniform4dv (GLint location_ , GLsizei count_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniform4dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*4">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM4DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM4DVPROC ) mygetprocaddr("glUniform4dv");
glfunc(location_, count_, value_);
return;
}
void glUniform4f (GLint location_ , GLfloat v0_ , GLfloat v1_ , GLfloat v2_ , GLfloat v3_ ){
/* <command>
<proto>void <name>glUniform4f</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLfloat</ptype> <name>v0</name></param>
<param><ptype>GLfloat</ptype> <name>v1</name></param>
<param><ptype>GLfloat</ptype> <name>v2</name></param>
<param><ptype>GLfloat</ptype> <name>v3</name></param>
</command>
*/
static PFNGLUNIFORM4FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM4FPROC ) mygetprocaddr("glUniform4f");
glfunc(location_, v0_, v1_, v2_, v3_);
return;
}
void glUniform4fv (GLint location_ , GLsizei count_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniform4fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*4">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM4FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM4FVPROC ) mygetprocaddr("glUniform4fv");
glfunc(location_, count_, value_);
return;
}
void glUniform4i (GLint location_ , GLint v0_ , GLint v1_ , GLint v2_ , GLint v3_ ){
/* <command>
<proto>void <name>glUniform4i</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLint</ptype> <name>v0</name></param>
<param><ptype>GLint</ptype> <name>v1</name></param>
<param><ptype>GLint</ptype> <name>v2</name></param>
<param><ptype>GLint</ptype> <name>v3</name></param>
</command>
*/
static PFNGLUNIFORM4IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM4IPROC ) mygetprocaddr("glUniform4i");
glfunc(location_, v0_, v1_, v2_, v3_);
return;
}
void glUniform4iv (GLint location_ , GLsizei count_ , const GLint * value_ ){
/* <command>
<proto>void <name>glUniform4iv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*4">const <ptype>GLint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM4IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM4IVPROC ) mygetprocaddr("glUniform4iv");
glfunc(location_, count_, value_);
return;
}
void glUniform4ui (GLint location_ , GLuint v0_ , GLuint v1_ , GLuint v2_ , GLuint v3_ ){
/* <command>
<proto>void <name>glUniform4ui</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLuint</ptype> <name>v0</name></param>
<param><ptype>GLuint</ptype> <name>v1</name></param>
<param><ptype>GLuint</ptype> <name>v2</name></param>
<param><ptype>GLuint</ptype> <name>v3</name></param>
</command>
*/
static PFNGLUNIFORM4UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM4UIPROC ) mygetprocaddr("glUniform4ui");
glfunc(location_, v0_, v1_, v2_, v3_);
return;
}
void glUniform4uiv (GLint location_ , GLsizei count_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glUniform4uiv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count*4">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORM4UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORM4UIVPROC ) mygetprocaddr("glUniform4uiv");
glfunc(location_, count_, value_);
return;
}
void glUniformBlockBinding (GLuint program_ , GLuint uniformBlockIndex_ , GLuint uniformBlockBinding_ ){
/* <command>
<proto>void <name>glUniformBlockBinding</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
<param><ptype>GLuint</ptype> <name>uniformBlockIndex</name></param>
<param><ptype>GLuint</ptype> <name>uniformBlockBinding</name></param>
</command>
*/
static PFNGLUNIFORMBLOCKBINDINGPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMBLOCKBINDINGPROC ) mygetprocaddr("glUniformBlockBinding");
glfunc(program_, uniformBlockIndex_, uniformBlockBinding_);
return;
}
void glUniformMatrix2dv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniformMatrix2dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*4">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX2DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX2DVPROC ) mygetprocaddr("glUniformMatrix2dv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix2fv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniformMatrix2fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*4">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX2FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX2FVPROC ) mygetprocaddr("glUniformMatrix2fv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix2x3dv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniformMatrix2x3dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*6">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX2X3DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX2X3DVPROC ) mygetprocaddr("glUniformMatrix2x3dv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix2x3fv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniformMatrix2x3fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*6">const <ptype>GLfloat</ptype> *<name>value</name></param>
<glx opcode="305" type="render" />
</command>
*/
static PFNGLUNIFORMMATRIX2X3FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX2X3FVPROC ) mygetprocaddr("glUniformMatrix2x3fv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix2x4dv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniformMatrix2x4dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*8">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX2X4DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX2X4DVPROC ) mygetprocaddr("glUniformMatrix2x4dv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix2x4fv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniformMatrix2x4fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*8">const <ptype>GLfloat</ptype> *<name>value</name></param>
<glx opcode="307" type="render" />
</command>
*/
static PFNGLUNIFORMMATRIX2X4FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX2X4FVPROC ) mygetprocaddr("glUniformMatrix2x4fv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix3dv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniformMatrix3dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*9">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX3DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX3DVPROC ) mygetprocaddr("glUniformMatrix3dv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix3fv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniformMatrix3fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*9">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX3FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX3FVPROC ) mygetprocaddr("glUniformMatrix3fv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix3x2dv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniformMatrix3x2dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*6">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX3X2DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX3X2DVPROC ) mygetprocaddr("glUniformMatrix3x2dv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix3x2fv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniformMatrix3x2fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*6">const <ptype>GLfloat</ptype> *<name>value</name></param>
<glx opcode="306" type="render" />
</command>
*/
static PFNGLUNIFORMMATRIX3X2FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX3X2FVPROC ) mygetprocaddr("glUniformMatrix3x2fv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix3x4dv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniformMatrix3x4dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*12">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX3X4DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX3X4DVPROC ) mygetprocaddr("glUniformMatrix3x4dv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix3x4fv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniformMatrix3x4fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*12">const <ptype>GLfloat</ptype> *<name>value</name></param>
<glx opcode="309" type="render" />
</command>
*/
static PFNGLUNIFORMMATRIX3X4FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX3X4FVPROC ) mygetprocaddr("glUniformMatrix3x4fv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix4dv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniformMatrix4dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*16">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX4DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX4DVPROC ) mygetprocaddr("glUniformMatrix4dv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix4fv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniformMatrix4fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*16">const <ptype>GLfloat</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX4FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX4FVPROC ) mygetprocaddr("glUniformMatrix4fv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix4x2dv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniformMatrix4x2dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*8">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX4X2DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX4X2DVPROC ) mygetprocaddr("glUniformMatrix4x2dv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix4x2fv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniformMatrix4x2fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*8">const <ptype>GLfloat</ptype> *<name>value</name></param>
<glx opcode="308" type="render" />
</command>
*/
static PFNGLUNIFORMMATRIX4X2FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX4X2FVPROC ) mygetprocaddr("glUniformMatrix4x2fv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix4x3dv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLdouble * value_ ){
/* <command>
<proto>void <name>glUniformMatrix4x3dv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*12">const <ptype>GLdouble</ptype> *<name>value</name></param>
</command>
*/
static PFNGLUNIFORMMATRIX4X3DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX4X3DVPROC ) mygetprocaddr("glUniformMatrix4x3dv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformMatrix4x3fv (GLint location_ , GLsizei count_ , GLboolean transpose_ , const GLfloat * value_ ){
/* <command>
<proto>void <name>glUniformMatrix4x3fv</name></proto>
<param><ptype>GLint</ptype> <name>location</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>transpose</name></param>
<param len="count*12">const <ptype>GLfloat</ptype> *<name>value</name></param>
<glx opcode="310" type="render" />
</command>
*/
static PFNGLUNIFORMMATRIX4X3FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMMATRIX4X3FVPROC ) mygetprocaddr("glUniformMatrix4x3fv");
glfunc(location_, count_, transpose_, value_);
return;
}
void glUniformSubroutinesuiv (GLenum shadertype_ , GLsizei count_ , const GLuint * indices_ ){
/* <command>
<proto>void <name>glUniformSubroutinesuiv</name></proto>
<param><ptype>GLenum</ptype> <name>shadertype</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="count">const <ptype>GLuint</ptype> *<name>indices</name></param>
</command>
*/
static PFNGLUNIFORMSUBROUTINESUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNIFORMSUBROUTINESUIVPROC ) mygetprocaddr("glUniformSubroutinesuiv");
glfunc(shadertype_, count_, indices_);
return;
}
GLboolean glUnmapBuffer (GLenum target_ ){
/* <command>
<proto group="Boolean"><ptype>GLboolean</ptype> <name>glUnmapBuffer</name></proto>
<param group="BufferTargetARB"><ptype>GLenum</ptype> <name>target</name></param>
</command>
*/
static PFNGLUNMAPBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNMAPBUFFERPROC ) mygetprocaddr("glUnmapBuffer");
GLboolean retval = glfunc(target_);
return retval;
}
GLboolean glUnmapNamedBuffer (GLuint buffer_ ){
/* <command>
<proto><ptype>GLboolean</ptype> <name>glUnmapNamedBuffer</name></proto>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
</command>
*/
static PFNGLUNMAPNAMEDBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUNMAPNAMEDBUFFERPROC ) mygetprocaddr("glUnmapNamedBuffer");
GLboolean retval = glfunc(buffer_);
return retval;
}
void glUseProgram (GLuint program_ ){
/* <command>
<proto>void <name>glUseProgram</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
</command>
*/
static PFNGLUSEPROGRAMPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUSEPROGRAMPROC ) mygetprocaddr("glUseProgram");
glfunc(program_);
return;
}
void glUseProgramStages (GLuint pipeline_ , GLbitfield stages_ , GLuint program_ ){
/* <command>
<proto>void <name>glUseProgramStages</name></proto>
<param><ptype>GLuint</ptype> <name>pipeline</name></param>
<param><ptype>GLbitfield</ptype> <name>stages</name></param>
<param><ptype>GLuint</ptype> <name>program</name></param>
</command>
*/
static PFNGLUSEPROGRAMSTAGESPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLUSEPROGRAMSTAGESPROC ) mygetprocaddr("glUseProgramStages");
glfunc(pipeline_, stages_, program_);
return;
}
void glValidateProgram (GLuint program_ ){
/* <command>
<proto>void <name>glValidateProgram</name></proto>
<param><ptype>GLuint</ptype> <name>program</name></param>
</command>
*/
static PFNGLVALIDATEPROGRAMPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVALIDATEPROGRAMPROC ) mygetprocaddr("glValidateProgram");
glfunc(program_);
return;
}
void glValidateProgramPipeline (GLuint pipeline_ ){
/* <command>
<proto>void <name>glValidateProgramPipeline</name></proto>
<param><ptype>GLuint</ptype> <name>pipeline</name></param>
</command>
*/
static PFNGLVALIDATEPROGRAMPIPELINEPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVALIDATEPROGRAMPIPELINEPROC ) mygetprocaddr("glValidateProgramPipeline");
glfunc(pipeline_);
return;
}
void glVertexArrayAttribBinding (GLuint vaobj_ , GLuint attribindex_ , GLuint bindingindex_ ){
/* <command>
<proto>void <name>glVertexArrayAttribBinding</name></proto>
<param><ptype>GLuint</ptype> <name>vaobj</name></param>
<param><ptype>GLuint</ptype> <name>attribindex</name></param>
<param><ptype>GLuint</ptype> <name>bindingindex</name></param>
</command>
*/
static PFNGLVERTEXARRAYATTRIBBINDINGPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXARRAYATTRIBBINDINGPROC ) mygetprocaddr("glVertexArrayAttribBinding");
glfunc(vaobj_, attribindex_, bindingindex_);
return;
}
void glVertexArrayAttribFormat (GLuint vaobj_ , GLuint attribindex_ , GLint size_ , GLenum type_ , GLboolean normalized_ , GLuint relativeoffset_ ){
/* <command>
<proto>void <name>glVertexArrayAttribFormat</name></proto>
<param><ptype>GLuint</ptype> <name>vaobj</name></param>
<param><ptype>GLuint</ptype> <name>attribindex</name></param>
<param><ptype>GLint</ptype> <name>size</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param><ptype>GLboolean</ptype> <name>normalized</name></param>
<param><ptype>GLuint</ptype> <name>relativeoffset</name></param>
</command>
*/
static PFNGLVERTEXARRAYATTRIBFORMATPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXARRAYATTRIBFORMATPROC ) mygetprocaddr("glVertexArrayAttribFormat");
glfunc(vaobj_, attribindex_, size_, type_, normalized_, relativeoffset_);
return;
}
void glVertexArrayBindingDivisor (GLuint vaobj_ , GLuint bindingindex_ , GLuint divisor_ ){
/* <command>
<proto>void <name>glVertexArrayBindingDivisor</name></proto>
<param><ptype>GLuint</ptype> <name>vaobj</name></param>
<param><ptype>GLuint</ptype> <name>bindingindex</name></param>
<param><ptype>GLuint</ptype> <name>divisor</name></param>
</command>
*/
static PFNGLVERTEXARRAYBINDINGDIVISORPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXARRAYBINDINGDIVISORPROC ) mygetprocaddr("glVertexArrayBindingDivisor");
glfunc(vaobj_, bindingindex_, divisor_);
return;
}
void glVertexArrayElementBuffer (GLuint vaobj_ , GLuint buffer_ ){
/* <command>
<proto>void <name>glVertexArrayElementBuffer</name></proto>
<param><ptype>GLuint</ptype> <name>vaobj</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
</command>
*/
static PFNGLVERTEXARRAYELEMENTBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXARRAYELEMENTBUFFERPROC ) mygetprocaddr("glVertexArrayElementBuffer");
glfunc(vaobj_, buffer_);
return;
}
void glVertexArrayVertexBuffer (GLuint vaobj_ , GLuint bindingindex_ , GLuint buffer_ , GLintptr offset_ , GLsizei stride_ ){
/* <command>
<proto>void <name>glVertexArrayVertexBuffer</name></proto>
<param><ptype>GLuint</ptype> <name>vaobj</name></param>
<param><ptype>GLuint</ptype> <name>bindingindex</name></param>
<param><ptype>GLuint</ptype> <name>buffer</name></param>
<param><ptype>GLintptr</ptype> <name>offset</name></param>
<param><ptype>GLsizei</ptype> <name>stride</name></param>
</command>
*/
static PFNGLVERTEXARRAYVERTEXBUFFERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXARRAYVERTEXBUFFERPROC ) mygetprocaddr("glVertexArrayVertexBuffer");
glfunc(vaobj_, bindingindex_, buffer_, offset_, stride_);
return;
}
void glVertexArrayVertexBuffers (GLuint vaobj_ , GLuint first_ , GLsizei count_ , const GLuint * buffers_ , const GLintptr * offsets_ , const GLsizei * strides_ ){
/* <command>
<proto>void <name>glVertexArrayVertexBuffers</name></proto>
<param><ptype>GLuint</ptype> <name>vaobj</name></param>
<param><ptype>GLuint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param>const <ptype>GLuint</ptype> *<name>buffers</name></param>
<param>const <ptype>GLintptr</ptype> *<name>offsets</name></param>
<param>const <ptype>GLsizei</ptype> *<name>strides</name></param>
</command>
*/
static PFNGLVERTEXARRAYVERTEXBUFFERSPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXARRAYVERTEXBUFFERSPROC ) mygetprocaddr("glVertexArrayVertexBuffers");
glfunc(vaobj_, first_, count_, buffers_, offsets_, strides_);
return;
}
void glVertexAttrib1d (GLuint index_ , GLdouble x_ ){
/* <command>
<proto>void <name>glVertexAttrib1d</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
<vecequiv name="glVertexAttrib1dv" />
</command>
*/
static PFNGLVERTEXATTRIB1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB1DPROC ) mygetprocaddr("glVertexAttrib1d");
glfunc(index_, x_);
return;
}
void glVertexAttrib1dv (GLuint index_ , const GLdouble * v_ ){
/* <command>
<proto>void <name>glVertexAttrib1dv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="1">const <ptype>GLdouble</ptype> *<name>v</name></param>
<glx opcode="4197" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB1DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB1DVPROC ) mygetprocaddr("glVertexAttrib1dv");
glfunc(index_, v_);
return;
}
void glVertexAttrib1f (GLuint index_ , GLfloat x_ ){
/* <command>
<proto>void <name>glVertexAttrib1f</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLfloat</ptype> <name>x</name></param>
<vecequiv name="glVertexAttrib1fv" />
</command>
*/
static PFNGLVERTEXATTRIB1FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB1FPROC ) mygetprocaddr("glVertexAttrib1f");
glfunc(index_, x_);
return;
}
void glVertexAttrib1fv (GLuint index_ , const GLfloat * v_ ){
/* <command>
<proto>void <name>glVertexAttrib1fv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="1">const <ptype>GLfloat</ptype> *<name>v</name></param>
<glx opcode="4193" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB1FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB1FVPROC ) mygetprocaddr("glVertexAttrib1fv");
glfunc(index_, v_);
return;
}
void glVertexAttrib1s (GLuint index_ , GLshort x_ ){
/* <command>
<proto>void <name>glVertexAttrib1s</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLshort</ptype> <name>x</name></param>
<vecequiv name="glVertexAttrib1sv" />
</command>
*/
static PFNGLVERTEXATTRIB1SPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB1SPROC ) mygetprocaddr("glVertexAttrib1s");
glfunc(index_, x_);
return;
}
void glVertexAttrib1sv (GLuint index_ , const GLshort * v_ ){
/* <command>
<proto>void <name>glVertexAttrib1sv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="1">const <ptype>GLshort</ptype> *<name>v</name></param>
<glx opcode="4189" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB1SVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB1SVPROC ) mygetprocaddr("glVertexAttrib1sv");
glfunc(index_, v_);
return;
}
void glVertexAttrib2d (GLuint index_ , GLdouble x_ , GLdouble y_ ){
/* <command>
<proto>void <name>glVertexAttrib2d</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
<param><ptype>GLdouble</ptype> <name>y</name></param>
<vecequiv name="glVertexAttrib2dv" />
</command>
*/
static PFNGLVERTEXATTRIB2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB2DPROC ) mygetprocaddr("glVertexAttrib2d");
glfunc(index_, x_, y_);
return;
}
void glVertexAttrib2dv (GLuint index_ , const GLdouble * v_ ){
/* <command>
<proto>void <name>glVertexAttrib2dv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="2">const <ptype>GLdouble</ptype> *<name>v</name></param>
<glx opcode="4198" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB2DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB2DVPROC ) mygetprocaddr("glVertexAttrib2dv");
glfunc(index_, v_);
return;
}
void glVertexAttrib2f (GLuint index_ , GLfloat x_ , GLfloat y_ ){
/* <command>
<proto>void <name>glVertexAttrib2f</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLfloat</ptype> <name>x</name></param>
<param><ptype>GLfloat</ptype> <name>y</name></param>
<vecequiv name="glVertexAttrib2fv" />
</command>
*/
static PFNGLVERTEXATTRIB2FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB2FPROC ) mygetprocaddr("glVertexAttrib2f");
glfunc(index_, x_, y_);
return;
}
void glVertexAttrib2fv (GLuint index_ , const GLfloat * v_ ){
/* <command>
<proto>void <name>glVertexAttrib2fv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="2">const <ptype>GLfloat</ptype> *<name>v</name></param>
<glx opcode="4194" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB2FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB2FVPROC ) mygetprocaddr("glVertexAttrib2fv");
glfunc(index_, v_);
return;
}
void glVertexAttrib2s (GLuint index_ , GLshort x_ , GLshort y_ ){
/* <command>
<proto>void <name>glVertexAttrib2s</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLshort</ptype> <name>x</name></param>
<param><ptype>GLshort</ptype> <name>y</name></param>
<vecequiv name="glVertexAttrib2sv" />
</command>
*/
static PFNGLVERTEXATTRIB2SPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB2SPROC ) mygetprocaddr("glVertexAttrib2s");
glfunc(index_, x_, y_);
return;
}
void glVertexAttrib2sv (GLuint index_ , const GLshort * v_ ){
/* <command>
<proto>void <name>glVertexAttrib2sv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="2">const <ptype>GLshort</ptype> *<name>v</name></param>
<glx opcode="4190" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB2SVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB2SVPROC ) mygetprocaddr("glVertexAttrib2sv");
glfunc(index_, v_);
return;
}
void glVertexAttrib3d (GLuint index_ , GLdouble x_ , GLdouble y_ , GLdouble z_ ){
/* <command>
<proto>void <name>glVertexAttrib3d</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
<param><ptype>GLdouble</ptype> <name>y</name></param>
<param><ptype>GLdouble</ptype> <name>z</name></param>
<vecequiv name="glVertexAttrib3dv" />
</command>
*/
static PFNGLVERTEXATTRIB3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB3DPROC ) mygetprocaddr("glVertexAttrib3d");
glfunc(index_, x_, y_, z_);
return;
}
void glVertexAttrib3dv (GLuint index_ , const GLdouble * v_ ){
/* <command>
<proto>void <name>glVertexAttrib3dv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="3">const <ptype>GLdouble</ptype> *<name>v</name></param>
<glx opcode="4199" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB3DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB3DVPROC ) mygetprocaddr("glVertexAttrib3dv");
glfunc(index_, v_);
return;
}
void glVertexAttrib3f (GLuint index_ , GLfloat x_ , GLfloat y_ , GLfloat z_ ){
/* <command>
<proto>void <name>glVertexAttrib3f</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLfloat</ptype> <name>x</name></param>
<param><ptype>GLfloat</ptype> <name>y</name></param>
<param><ptype>GLfloat</ptype> <name>z</name></param>
<vecequiv name="glVertexAttrib3fv" />
</command>
*/
static PFNGLVERTEXATTRIB3FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB3FPROC ) mygetprocaddr("glVertexAttrib3f");
glfunc(index_, x_, y_, z_);
return;
}
void glVertexAttrib3fv (GLuint index_ , const GLfloat * v_ ){
/* <command>
<proto>void <name>glVertexAttrib3fv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="3">const <ptype>GLfloat</ptype> *<name>v</name></param>
<glx opcode="4195" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB3FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB3FVPROC ) mygetprocaddr("glVertexAttrib3fv");
glfunc(index_, v_);
return;
}
void glVertexAttrib3s (GLuint index_ , GLshort x_ , GLshort y_ , GLshort z_ ){
/* <command>
<proto>void <name>glVertexAttrib3s</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLshort</ptype> <name>x</name></param>
<param><ptype>GLshort</ptype> <name>y</name></param>
<param><ptype>GLshort</ptype> <name>z</name></param>
<vecequiv name="glVertexAttrib3sv" />
</command>
*/
static PFNGLVERTEXATTRIB3SPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB3SPROC ) mygetprocaddr("glVertexAttrib3s");
glfunc(index_, x_, y_, z_);
return;
}
void glVertexAttrib3sv (GLuint index_ , const GLshort * v_ ){
/* <command>
<proto>void <name>glVertexAttrib3sv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="3">const <ptype>GLshort</ptype> *<name>v</name></param>
<glx opcode="4191" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB3SVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB3SVPROC ) mygetprocaddr("glVertexAttrib3sv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4Nbv (GLuint index_ , const GLbyte * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4Nbv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLbyte</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIB4NBVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4NBVPROC ) mygetprocaddr("glVertexAttrib4Nbv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4Niv (GLuint index_ , const GLint * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4Niv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIB4NIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4NIVPROC ) mygetprocaddr("glVertexAttrib4Niv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4Nsv (GLuint index_ , const GLshort * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4Nsv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLshort</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIB4NSVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4NSVPROC ) mygetprocaddr("glVertexAttrib4Nsv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4Nub (GLuint index_ , GLubyte x_ , GLubyte y_ , GLubyte z_ , GLubyte w_ ){
/* <command>
<proto>void <name>glVertexAttrib4Nub</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLubyte</ptype> <name>x</name></param>
<param><ptype>GLubyte</ptype> <name>y</name></param>
<param><ptype>GLubyte</ptype> <name>z</name></param>
<param><ptype>GLubyte</ptype> <name>w</name></param>
</command>
*/
static PFNGLVERTEXATTRIB4NUBPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4NUBPROC ) mygetprocaddr("glVertexAttrib4Nub");
glfunc(index_, x_, y_, z_, w_);
return;
}
void glVertexAttrib4Nubv (GLuint index_ , const GLubyte * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4Nubv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLubyte</ptype> *<name>v</name></param>
<glx opcode="4201" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB4NUBVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4NUBVPROC ) mygetprocaddr("glVertexAttrib4Nubv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4Nuiv (GLuint index_ , const GLuint * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4Nuiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLuint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIB4NUIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4NUIVPROC ) mygetprocaddr("glVertexAttrib4Nuiv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4Nusv (GLuint index_ , const GLushort * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4Nusv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLushort</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIB4NUSVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4NUSVPROC ) mygetprocaddr("glVertexAttrib4Nusv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4bv (GLuint index_ , const GLbyte * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4bv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLbyte</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIB4BVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4BVPROC ) mygetprocaddr("glVertexAttrib4bv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4d (GLuint index_ , GLdouble x_ , GLdouble y_ , GLdouble z_ , GLdouble w_ ){
/* <command>
<proto>void <name>glVertexAttrib4d</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
<param><ptype>GLdouble</ptype> <name>y</name></param>
<param><ptype>GLdouble</ptype> <name>z</name></param>
<param><ptype>GLdouble</ptype> <name>w</name></param>
<vecequiv name="glVertexAttrib4dv" />
</command>
*/
static PFNGLVERTEXATTRIB4DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4DPROC ) mygetprocaddr("glVertexAttrib4d");
glfunc(index_, x_, y_, z_, w_);
return;
}
void glVertexAttrib4dv (GLuint index_ , const GLdouble * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4dv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLdouble</ptype> *<name>v</name></param>
<glx opcode="4200" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB4DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4DVPROC ) mygetprocaddr("glVertexAttrib4dv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4f (GLuint index_ , GLfloat x_ , GLfloat y_ , GLfloat z_ , GLfloat w_ ){
/* <command>
<proto>void <name>glVertexAttrib4f</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLfloat</ptype> <name>x</name></param>
<param><ptype>GLfloat</ptype> <name>y</name></param>
<param><ptype>GLfloat</ptype> <name>z</name></param>
<param><ptype>GLfloat</ptype> <name>w</name></param>
<vecequiv name="glVertexAttrib4fv" />
</command>
*/
static PFNGLVERTEXATTRIB4FPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4FPROC ) mygetprocaddr("glVertexAttrib4f");
glfunc(index_, x_, y_, z_, w_);
return;
}
void glVertexAttrib4fv (GLuint index_ , const GLfloat * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4fv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLfloat</ptype> *<name>v</name></param>
<glx opcode="4196" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB4FVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4FVPROC ) mygetprocaddr("glVertexAttrib4fv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4iv (GLuint index_ , const GLint * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4iv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIB4IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4IVPROC ) mygetprocaddr("glVertexAttrib4iv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4s (GLuint index_ , GLshort x_ , GLshort y_ , GLshort z_ , GLshort w_ ){
/* <command>
<proto>void <name>glVertexAttrib4s</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLshort</ptype> <name>x</name></param>
<param><ptype>GLshort</ptype> <name>y</name></param>
<param><ptype>GLshort</ptype> <name>z</name></param>
<param><ptype>GLshort</ptype> <name>w</name></param>
<vecequiv name="glVertexAttrib4sv" />
</command>
*/
static PFNGLVERTEXATTRIB4SPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4SPROC ) mygetprocaddr("glVertexAttrib4s");
glfunc(index_, x_, y_, z_, w_);
return;
}
void glVertexAttrib4sv (GLuint index_ , const GLshort * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4sv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLshort</ptype> *<name>v</name></param>
<glx opcode="4192" type="render" />
</command>
*/
static PFNGLVERTEXATTRIB4SVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4SVPROC ) mygetprocaddr("glVertexAttrib4sv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4ubv (GLuint index_ , const GLubyte * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4ubv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLubyte</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIB4UBVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4UBVPROC ) mygetprocaddr("glVertexAttrib4ubv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4uiv (GLuint index_ , const GLuint * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4uiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLuint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIB4UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4UIVPROC ) mygetprocaddr("glVertexAttrib4uiv");
glfunc(index_, v_);
return;
}
void glVertexAttrib4usv (GLuint index_ , const GLushort * v_ ){
/* <command>
<proto>void <name>glVertexAttrib4usv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLushort</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIB4USVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIB4USVPROC ) mygetprocaddr("glVertexAttrib4usv");
glfunc(index_, v_);
return;
}
void glVertexAttribBinding (GLuint attribindex_ , GLuint bindingindex_ ){
/* <command>
<proto>void <name>glVertexAttribBinding</name></proto>
<param><ptype>GLuint</ptype> <name>attribindex</name></param>
<param><ptype>GLuint</ptype> <name>bindingindex</name></param>
</command>
*/
static PFNGLVERTEXATTRIBBINDINGPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBBINDINGPROC ) mygetprocaddr("glVertexAttribBinding");
glfunc(attribindex_, bindingindex_);
return;
}
void glVertexAttribDivisor (GLuint index_ , GLuint divisor_ ){
/* <command>
<proto>void <name>glVertexAttribDivisor</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLuint</ptype> <name>divisor</name></param>
</command>
*/
static PFNGLVERTEXATTRIBDIVISORPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBDIVISORPROC ) mygetprocaddr("glVertexAttribDivisor");
glfunc(index_, divisor_);
return;
}
void glVertexAttribFormat (GLuint attribindex_ , GLint size_ , GLenum type_ , GLboolean normalized_ , GLuint relativeoffset_ ){
/* <command>
<proto>void <name>glVertexAttribFormat</name></proto>
<param><ptype>GLuint</ptype> <name>attribindex</name></param>
<param><ptype>GLint</ptype> <name>size</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>normalized</name></param>
<param><ptype>GLuint</ptype> <name>relativeoffset</name></param>
</command>
*/
static PFNGLVERTEXATTRIBFORMATPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBFORMATPROC ) mygetprocaddr("glVertexAttribFormat");
glfunc(attribindex_, size_, type_, normalized_, relativeoffset_);
return;
}
void glVertexAttribI1i (GLuint index_ , GLint x_ ){
/* <command>
<proto>void <name>glVertexAttribI1i</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLint</ptype> <name>x</name></param>
<vecequiv name="glVertexAttribI1iv" />
</command>
*/
static PFNGLVERTEXATTRIBI1IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI1IPROC ) mygetprocaddr("glVertexAttribI1i");
glfunc(index_, x_);
return;
}
void glVertexAttribI1iv (GLuint index_ , const GLint * v_ ){
/* <command>
<proto>void <name>glVertexAttribI1iv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="1">const <ptype>GLint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI1IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI1IVPROC ) mygetprocaddr("glVertexAttribI1iv");
glfunc(index_, v_);
return;
}
void glVertexAttribI1ui (GLuint index_ , GLuint x_ ){
/* <command>
<proto>void <name>glVertexAttribI1ui</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLuint</ptype> <name>x</name></param>
<vecequiv name="glVertexAttribI1uiv" />
</command>
*/
static PFNGLVERTEXATTRIBI1UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI1UIPROC ) mygetprocaddr("glVertexAttribI1ui");
glfunc(index_, x_);
return;
}
void glVertexAttribI1uiv (GLuint index_ , const GLuint * v_ ){
/* <command>
<proto>void <name>glVertexAttribI1uiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="1">const <ptype>GLuint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI1UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI1UIVPROC ) mygetprocaddr("glVertexAttribI1uiv");
glfunc(index_, v_);
return;
}
void glVertexAttribI2i (GLuint index_ , GLint x_ , GLint y_ ){
/* <command>
<proto>void <name>glVertexAttribI2i</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLint</ptype> <name>x</name></param>
<param><ptype>GLint</ptype> <name>y</name></param>
<vecequiv name="glVertexAttribI2iv" />
</command>
*/
static PFNGLVERTEXATTRIBI2IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI2IPROC ) mygetprocaddr("glVertexAttribI2i");
glfunc(index_, x_, y_);
return;
}
void glVertexAttribI2iv (GLuint index_ , const GLint * v_ ){
/* <command>
<proto>void <name>glVertexAttribI2iv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="2">const <ptype>GLint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI2IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI2IVPROC ) mygetprocaddr("glVertexAttribI2iv");
glfunc(index_, v_);
return;
}
void glVertexAttribI2ui (GLuint index_ , GLuint x_ , GLuint y_ ){
/* <command>
<proto>void <name>glVertexAttribI2ui</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLuint</ptype> <name>x</name></param>
<param><ptype>GLuint</ptype> <name>y</name></param>
<vecequiv name="glVertexAttribI2uiv" />
</command>
*/
static PFNGLVERTEXATTRIBI2UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI2UIPROC ) mygetprocaddr("glVertexAttribI2ui");
glfunc(index_, x_, y_);
return;
}
void glVertexAttribI2uiv (GLuint index_ , const GLuint * v_ ){
/* <command>
<proto>void <name>glVertexAttribI2uiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="2">const <ptype>GLuint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI2UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI2UIVPROC ) mygetprocaddr("glVertexAttribI2uiv");
glfunc(index_, v_);
return;
}
void glVertexAttribI3i (GLuint index_ , GLint x_ , GLint y_ , GLint z_ ){
/* <command>
<proto>void <name>glVertexAttribI3i</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLint</ptype> <name>x</name></param>
<param><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLint</ptype> <name>z</name></param>
<vecequiv name="glVertexAttribI3iv" />
</command>
*/
static PFNGLVERTEXATTRIBI3IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI3IPROC ) mygetprocaddr("glVertexAttribI3i");
glfunc(index_, x_, y_, z_);
return;
}
void glVertexAttribI3iv (GLuint index_ , const GLint * v_ ){
/* <command>
<proto>void <name>glVertexAttribI3iv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="3">const <ptype>GLint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI3IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI3IVPROC ) mygetprocaddr("glVertexAttribI3iv");
glfunc(index_, v_);
return;
}
void glVertexAttribI3ui (GLuint index_ , GLuint x_ , GLuint y_ , GLuint z_ ){
/* <command>
<proto>void <name>glVertexAttribI3ui</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLuint</ptype> <name>x</name></param>
<param><ptype>GLuint</ptype> <name>y</name></param>
<param><ptype>GLuint</ptype> <name>z</name></param>
<vecequiv name="glVertexAttribI3uiv" />
</command>
*/
static PFNGLVERTEXATTRIBI3UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI3UIPROC ) mygetprocaddr("glVertexAttribI3ui");
glfunc(index_, x_, y_, z_);
return;
}
void glVertexAttribI3uiv (GLuint index_ , const GLuint * v_ ){
/* <command>
<proto>void <name>glVertexAttribI3uiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="3">const <ptype>GLuint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI3UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI3UIVPROC ) mygetprocaddr("glVertexAttribI3uiv");
glfunc(index_, v_);
return;
}
void glVertexAttribI4bv (GLuint index_ , const GLbyte * v_ ){
/* <command>
<proto>void <name>glVertexAttribI4bv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLbyte</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI4BVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI4BVPROC ) mygetprocaddr("glVertexAttribI4bv");
glfunc(index_, v_);
return;
}
void glVertexAttribI4i (GLuint index_ , GLint x_ , GLint y_ , GLint z_ , GLint w_ ){
/* <command>
<proto>void <name>glVertexAttribI4i</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLint</ptype> <name>x</name></param>
<param><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLint</ptype> <name>z</name></param>
<param><ptype>GLint</ptype> <name>w</name></param>
<vecequiv name="glVertexAttribI4iv" />
</command>
*/
static PFNGLVERTEXATTRIBI4IPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI4IPROC ) mygetprocaddr("glVertexAttribI4i");
glfunc(index_, x_, y_, z_, w_);
return;
}
void glVertexAttribI4iv (GLuint index_ , const GLint * v_ ){
/* <command>
<proto>void <name>glVertexAttribI4iv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI4IVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI4IVPROC ) mygetprocaddr("glVertexAttribI4iv");
glfunc(index_, v_);
return;
}
void glVertexAttribI4sv (GLuint index_ , const GLshort * v_ ){
/* <command>
<proto>void <name>glVertexAttribI4sv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLshort</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI4SVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI4SVPROC ) mygetprocaddr("glVertexAttribI4sv");
glfunc(index_, v_);
return;
}
void glVertexAttribI4ubv (GLuint index_ , const GLubyte * v_ ){
/* <command>
<proto>void <name>glVertexAttribI4ubv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLubyte</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI4UBVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI4UBVPROC ) mygetprocaddr("glVertexAttribI4ubv");
glfunc(index_, v_);
return;
}
void glVertexAttribI4ui (GLuint index_ , GLuint x_ , GLuint y_ , GLuint z_ , GLuint w_ ){
/* <command>
<proto>void <name>glVertexAttribI4ui</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLuint</ptype> <name>x</name></param>
<param><ptype>GLuint</ptype> <name>y</name></param>
<param><ptype>GLuint</ptype> <name>z</name></param>
<param><ptype>GLuint</ptype> <name>w</name></param>
<vecequiv name="glVertexAttribI4uiv" />
</command>
*/
static PFNGLVERTEXATTRIBI4UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI4UIPROC ) mygetprocaddr("glVertexAttribI4ui");
glfunc(index_, x_, y_, z_, w_);
return;
}
void glVertexAttribI4uiv (GLuint index_ , const GLuint * v_ ){
/* <command>
<proto>void <name>glVertexAttribI4uiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLuint</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI4UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI4UIVPROC ) mygetprocaddr("glVertexAttribI4uiv");
glfunc(index_, v_);
return;
}
void glVertexAttribI4usv (GLuint index_ , const GLushort * v_ ){
/* <command>
<proto>void <name>glVertexAttribI4usv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLushort</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBI4USVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBI4USVPROC ) mygetprocaddr("glVertexAttribI4usv");
glfunc(index_, v_);
return;
}
void glVertexAttribL1d (GLuint index_ , GLdouble x_ ){
/* <command>
<proto>void <name>glVertexAttribL1d</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
</command>
*/
static PFNGLVERTEXATTRIBL1DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBL1DPROC ) mygetprocaddr("glVertexAttribL1d");
glfunc(index_, x_);
return;
}
void glVertexAttribL1dv (GLuint index_ , const GLdouble * v_ ){
/* <command>
<proto>void <name>glVertexAttribL1dv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="1">const <ptype>GLdouble</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBL1DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBL1DVPROC ) mygetprocaddr("glVertexAttribL1dv");
glfunc(index_, v_);
return;
}
void glVertexAttribL2d (GLuint index_ , GLdouble x_ , GLdouble y_ ){
/* <command>
<proto>void <name>glVertexAttribL2d</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
<param><ptype>GLdouble</ptype> <name>y</name></param>
</command>
*/
static PFNGLVERTEXATTRIBL2DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBL2DPROC ) mygetprocaddr("glVertexAttribL2d");
glfunc(index_, x_, y_);
return;
}
void glVertexAttribL2dv (GLuint index_ , const GLdouble * v_ ){
/* <command>
<proto>void <name>glVertexAttribL2dv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="2">const <ptype>GLdouble</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBL2DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBL2DVPROC ) mygetprocaddr("glVertexAttribL2dv");
glfunc(index_, v_);
return;
}
void glVertexAttribL3d (GLuint index_ , GLdouble x_ , GLdouble y_ , GLdouble z_ ){
/* <command>
<proto>void <name>glVertexAttribL3d</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
<param><ptype>GLdouble</ptype> <name>y</name></param>
<param><ptype>GLdouble</ptype> <name>z</name></param>
</command>
*/
static PFNGLVERTEXATTRIBL3DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBL3DPROC ) mygetprocaddr("glVertexAttribL3d");
glfunc(index_, x_, y_, z_);
return;
}
void glVertexAttribL3dv (GLuint index_ , const GLdouble * v_ ){
/* <command>
<proto>void <name>glVertexAttribL3dv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="3">const <ptype>GLdouble</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBL3DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBL3DVPROC ) mygetprocaddr("glVertexAttribL3dv");
glfunc(index_, v_);
return;
}
void glVertexAttribL4d (GLuint index_ , GLdouble x_ , GLdouble y_ , GLdouble z_ , GLdouble w_ ){
/* <command>
<proto>void <name>glVertexAttribL4d</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLdouble</ptype> <name>x</name></param>
<param><ptype>GLdouble</ptype> <name>y</name></param>
<param><ptype>GLdouble</ptype> <name>z</name></param>
<param><ptype>GLdouble</ptype> <name>w</name></param>
</command>
*/
static PFNGLVERTEXATTRIBL4DPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBL4DPROC ) mygetprocaddr("glVertexAttribL4d");
glfunc(index_, x_, y_, z_, w_);
return;
}
void glVertexAttribL4dv (GLuint index_ , const GLdouble * v_ ){
/* <command>
<proto>void <name>glVertexAttribL4dv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLdouble</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVERTEXATTRIBL4DVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBL4DVPROC ) mygetprocaddr("glVertexAttribL4dv");
glfunc(index_, v_);
return;
}
void glVertexAttribP1ui (GLuint index_ , GLenum type_ , GLboolean normalized_ , GLuint value_ ){
/* <command>
<proto>void <name>glVertexAttribP1ui</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>normalized</name></param>
<param><ptype>GLuint</ptype> <name>value</name></param>
</command>
*/
static PFNGLVERTEXATTRIBP1UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBP1UIPROC ) mygetprocaddr("glVertexAttribP1ui");
glfunc(index_, type_, normalized_, value_);
return;
}
void glVertexAttribP1uiv (GLuint index_ , GLenum type_ , GLboolean normalized_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glVertexAttribP1uiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>normalized</name></param>
<param len="1">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLVERTEXATTRIBP1UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBP1UIVPROC ) mygetprocaddr("glVertexAttribP1uiv");
glfunc(index_, type_, normalized_, value_);
return;
}
void glVertexAttribP2ui (GLuint index_ , GLenum type_ , GLboolean normalized_ , GLuint value_ ){
/* <command>
<proto>void <name>glVertexAttribP2ui</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>normalized</name></param>
<param><ptype>GLuint</ptype> <name>value</name></param>
</command>
*/
static PFNGLVERTEXATTRIBP2UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBP2UIPROC ) mygetprocaddr("glVertexAttribP2ui");
glfunc(index_, type_, normalized_, value_);
return;
}
void glVertexAttribP2uiv (GLuint index_ , GLenum type_ , GLboolean normalized_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glVertexAttribP2uiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>normalized</name></param>
<param len="1">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLVERTEXATTRIBP2UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBP2UIVPROC ) mygetprocaddr("glVertexAttribP2uiv");
glfunc(index_, type_, normalized_, value_);
return;
}
void glVertexAttribP3ui (GLuint index_ , GLenum type_ , GLboolean normalized_ , GLuint value_ ){
/* <command>
<proto>void <name>glVertexAttribP3ui</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>normalized</name></param>
<param><ptype>GLuint</ptype> <name>value</name></param>
</command>
*/
static PFNGLVERTEXATTRIBP3UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBP3UIPROC ) mygetprocaddr("glVertexAttribP3ui");
glfunc(index_, type_, normalized_, value_);
return;
}
void glVertexAttribP3uiv (GLuint index_ , GLenum type_ , GLboolean normalized_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glVertexAttribP3uiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>normalized</name></param>
<param len="1">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLVERTEXATTRIBP3UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBP3UIVPROC ) mygetprocaddr("glVertexAttribP3uiv");
glfunc(index_, type_, normalized_, value_);
return;
}
void glVertexAttribP4ui (GLuint index_ , GLenum type_ , GLboolean normalized_ , GLuint value_ ){
/* <command>
<proto>void <name>glVertexAttribP4ui</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>normalized</name></param>
<param><ptype>GLuint</ptype> <name>value</name></param>
</command>
*/
static PFNGLVERTEXATTRIBP4UIPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBP4UIPROC ) mygetprocaddr("glVertexAttribP4ui");
glfunc(index_, type_, normalized_, value_);
return;
}
void glVertexAttribP4uiv (GLuint index_ , GLenum type_ , GLboolean normalized_ , const GLuint * value_ ){
/* <command>
<proto>void <name>glVertexAttribP4uiv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLenum</ptype> <name>type</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>normalized</name></param>
<param len="1">const <ptype>GLuint</ptype> *<name>value</name></param>
</command>
*/
static PFNGLVERTEXATTRIBP4UIVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBP4UIVPROC ) mygetprocaddr("glVertexAttribP4uiv");
glfunc(index_, type_, normalized_, value_);
return;
}
void glVertexAttribPointer (GLuint index_ , GLint size_ , GLenum type_ , GLboolean normalized_ , GLsizei stride_ , const void * pointer_ ){
/* <command>
<proto>void <name>glVertexAttribPointer</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLint</ptype> <name>size</name></param>
<param group="VertexAttribPointerType"><ptype>GLenum</ptype> <name>type</name></param>
<param group="Boolean"><ptype>GLboolean</ptype> <name>normalized</name></param>
<param><ptype>GLsizei</ptype> <name>stride</name></param>
<param len="COMPSIZE(size,type,stride)">const void *<name>pointer</name></param>
</command>
*/
static PFNGLVERTEXATTRIBPOINTERPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXATTRIBPOINTERPROC ) mygetprocaddr("glVertexAttribPointer");
glfunc(index_, size_, type_, normalized_, stride_, pointer_);
return;
}
void glVertexBindingDivisor (GLuint bindingindex_ , GLuint divisor_ ){
/* <command>
<proto>void <name>glVertexBindingDivisor</name></proto>
<param><ptype>GLuint</ptype> <name>bindingindex</name></param>
<param><ptype>GLuint</ptype> <name>divisor</name></param>
</command>
*/
static PFNGLVERTEXBINDINGDIVISORPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVERTEXBINDINGDIVISORPROC ) mygetprocaddr("glVertexBindingDivisor");
glfunc(bindingindex_, divisor_);
return;
}
void glViewport (GLint x_ , GLint y_ , GLsizei width_ , GLsizei height_ ){
/* <command>
<proto>void <name>glViewport</name></proto>
<param group="WinCoord"><ptype>GLint</ptype> <name>x</name></param>
<param group="WinCoord"><ptype>GLint</ptype> <name>y</name></param>
<param><ptype>GLsizei</ptype> <name>width</name></param>
<param><ptype>GLsizei</ptype> <name>height</name></param>
<glx opcode="191" type="render" />
</command>
*/
static PFNGLVIEWPORTPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVIEWPORTPROC ) mygetprocaddr("glViewport");
glfunc(x_, y_, width_, height_);
return;
}
void glViewportArrayv (GLuint first_ , GLsizei count_ , const GLfloat * v_ ){
/* <command>
<proto>void <name>glViewportArrayv</name></proto>
<param><ptype>GLuint</ptype> <name>first</name></param>
<param><ptype>GLsizei</ptype> <name>count</name></param>
<param len="COMPSIZE(count)">const <ptype>GLfloat</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVIEWPORTARRAYVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVIEWPORTARRAYVPROC ) mygetprocaddr("glViewportArrayv");
glfunc(first_, count_, v_);
return;
}
void glViewportIndexedf (GLuint index_ , GLfloat x_ , GLfloat y_ , GLfloat w_ , GLfloat h_ ){
/* <command>
<proto>void <name>glViewportIndexedf</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param><ptype>GLfloat</ptype> <name>x</name></param>
<param><ptype>GLfloat</ptype> <name>y</name></param>
<param><ptype>GLfloat</ptype> <name>w</name></param>
<param><ptype>GLfloat</ptype> <name>h</name></param>
</command>
*/
static PFNGLVIEWPORTINDEXEDFPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVIEWPORTINDEXEDFPROC ) mygetprocaddr("glViewportIndexedf");
glfunc(index_, x_, y_, w_, h_);
return;
}
void glViewportIndexedfv (GLuint index_ , const GLfloat * v_ ){
/* <command>
<proto>void <name>glViewportIndexedfv</name></proto>
<param><ptype>GLuint</ptype> <name>index</name></param>
<param len="4">const <ptype>GLfloat</ptype> *<name>v</name></param>
</command>
*/
static PFNGLVIEWPORTINDEXEDFVPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLVIEWPORTINDEXEDFVPROC ) mygetprocaddr("glViewportIndexedfv");
glfunc(index_, v_);
return;
}
void glWaitSync (GLsync sync_ , GLbitfield flags_ , GLuint64 timeout_ ){
/* <command>
<proto>void <name>glWaitSync</name></proto>
<param group="sync"><ptype>GLsync</ptype> <name>sync</name></param>
<param><ptype>GLbitfield</ptype> <name>flags</name></param>
<param><ptype>GLuint64</ptype> <name>timeout</name></param>
</command>
*/
static PFNGLWAITSYNCPROC glfunc;
if(!glfunc)
glfunc = ( PFNGLWAITSYNCPROC ) mygetprocaddr("glWaitSync");
glfunc(sync_, flags_, timeout_);
return;
}
| 46.498325 | 282 | 0.635334 | [
"render"
] |
3f2dd4d07c96cc4a2836a50cc065ade553fcaf52 | 13,234 | cpp | C++ | engines/basic/src/engine.cpp | WilliamLewww/vulkan_research_kit | 7f055329c25b16dc52e10ee50e64e5e3a2d6dfdc | [
"Apache-2.0"
] | null | null | null | engines/basic/src/engine.cpp | WilliamLewww/vulkan_research_kit | 7f055329c25b16dc52e10ee50e64e5e3a2d6dfdc | [
"Apache-2.0"
] | 2 | 2021-12-06T01:56:35.000Z | 2022-03-07T06:47:38.000Z | engines/basic/src/engine.cpp | WilliamLewww/vulkan_research_kit | 7f055329c25b16dc52e10ee50e64e5e3a2d6dfdc | [
"Apache-2.0"
] | null | null | null | #include "basic/engine.h"
Engine::Engine(std::string appName, bool enableValidation,
std::vector<std::string> instanceLayerList,
std::vector<std::string> instanceExtensionNameList) {
std::vector<VkValidationFeatureEnableEXT> validationFeatureEnableList;
std::vector<VkValidationFeatureDisableEXT> validationFeatureDisableList;
VkDebugUtilsMessageSeverityFlagBitsEXT debugUtilsMessageSeverityFlagBits;
VkDebugUtilsMessageTypeFlagBitsEXT debugUtilsMessageTypeFlagBits;
if (enableValidation) {
validationFeatureEnableList = {
VK_VALIDATION_FEATURE_ENABLE_BEST_PRACTICES_EXT,
VK_VALIDATION_FEATURE_ENABLE_DEBUG_PRINTF_EXT,
VK_VALIDATION_FEATURE_ENABLE_SYNCHRONIZATION_VALIDATION_EXT};
debugUtilsMessageSeverityFlagBits =
(VkDebugUtilsMessageSeverityFlagBitsEXT)(
// VK_DEBUG_UTILS_MESSAGE_SEVERITY_VERBOSE_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_SEVERITY_INFO_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_SEVERITY_WARNING_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_SEVERITY_ERROR_BIT_EXT);
debugUtilsMessageTypeFlagBits = (VkDebugUtilsMessageTypeFlagBitsEXT)(
// VK_DEBUG_UTILS_MESSAGE_TYPE_GENERAL_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_TYPE_VALIDATION_BIT_EXT |
VK_DEBUG_UTILS_MESSAGE_TYPE_PERFORMANCE_BIT_EXT);
instanceLayerList.push_back("VK_LAYER_KHRONOS_validation");
instanceExtensionNameList.push_back(VK_EXT_DEBUG_UTILS_EXTENSION_NAME);
}
instanceExtensionNameList.push_back(VK_KHR_SURFACE_EXTENSION_NAME);
instanceExtensionNameList.push_back("VK_KHR_xlib_surface");
this->instancePtr = std::unique_ptr<Instance>(new Instance(
validationFeatureEnableList, validationFeatureDisableList,
debugUtilsMessageSeverityFlagBits, debugUtilsMessageTypeFlagBits, appName,
VK_MAKE_VERSION(1, 0, 0), instanceLayerList, instanceExtensionNameList));
this->physicalDeviceHandleList =
Device::getPhysicalDevices(this->instancePtr->getInstanceHandleRef());
}
Engine::~Engine() {}
std::vector<std::string> Engine::getPhysicalDeviceNameList() {
std::vector<std::string> physicalDeviceNameList;
for (VkPhysicalDevice physicalDeviceHandle : this->physicalDeviceHandleList) {
VkPhysicalDeviceProperties physicalDeviceProperties =
Device::getPhysicalDeviceProperties(physicalDeviceHandle);
physicalDeviceNameList.push_back(physicalDeviceProperties.deviceName);
}
return physicalDeviceNameList;
}
void Engine::selectWindow(Display *displayPtr,
std::shared_ptr<Window> windowPtr) {
Surface::XlibSurfaceCreateInfoParam xlibSurfaceCreateInfoParam = {
.displayPtr = displayPtr, .windowPtr = windowPtr};
this->surfacePtr = std::unique_ptr<Surface>(new Surface(
this->instancePtr->getInstanceHandleRef(), Surface::Platform::Xlib,
std::make_shared<Surface::XlibSurfaceCreateInfoParam>(
xlibSurfaceCreateInfoParam)));
}
void Engine::selectPhysicalDevice(
std::string physicalDeviceName,
std::vector<std::string> deviceExtensionNameList) {
for (VkPhysicalDevice physicalDeviceHandle : this->physicalDeviceHandleList) {
VkPhysicalDeviceProperties physicalDeviceProperties =
Device::getPhysicalDeviceProperties(physicalDeviceHandle);
if (physicalDeviceName == physicalDeviceProperties.deviceName) {
this->physicalDeviceHandlePtr =
std::make_unique<VkPhysicalDevice>(physicalDeviceHandle);
}
}
this->queueFamilyPropertiesList = Device::getQueueFamilyPropertiesList(
*this->physicalDeviceHandlePtr.get());
this->queueFamilyIndex = -1;
for (uint32_t x = 0; x < queueFamilyPropertiesList.size(); x++) {
if (queueFamilyPropertiesList[x].queueFlags & VK_QUEUE_GRAPHICS_BIT &&
Surface::checkPhysicalDeviceSurfaceSupport(
*this->physicalDeviceHandlePtr.get(), x,
surfacePtr->getSurfaceHandleRef())) {
this->queueFamilyIndex = x;
break;
}
}
deviceExtensionNameList.push_back(VK_KHR_SWAPCHAIN_EXTENSION_NAME);
VkPhysicalDeviceRobustness2FeaturesEXT physicalDeviceRobustness2Features = {
.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_ROBUSTNESS_2_FEATURES_EXT,
.pNext = NULL,
.robustBufferAccess2 = VK_FALSE,
.robustImageAccess2 = VK_FALSE,
.nullDescriptor = VK_TRUE};
this->devicePtr = std::shared_ptr<Device>(new Device(
*this->physicalDeviceHandlePtr.get(),
{{0, this->queueFamilyIndex, 1, {1.0f}}}, {}, deviceExtensionNameList,
NULL, {&physicalDeviceRobustness2Features}));
this->commandPoolPtr = std::unique_ptr<CommandPool>(new CommandPool(
this->devicePtr->getDeviceHandleRef(),
VK_COMMAND_POOL_CREATE_RESET_COMMAND_BUFFER_BIT, this->queueFamilyIndex));
this->commandBufferGroupPtr =
std::unique_ptr<CommandBufferGroup>(new CommandBufferGroup(
this->devicePtr->getDeviceHandleRef(),
commandPoolPtr->getCommandPoolHandleRef(),
VK_COMMAND_BUFFER_LEVEL_PRIMARY,
queueFamilyPropertiesList[this->queueFamilyIndex].queueCount));
this->secondaryCommandBufferCount = 128;
this->secondaryCommandBufferGroupPtr = std::unique_ptr<CommandBufferGroup>(
new CommandBufferGroup(this->devicePtr->getDeviceHandleRef(),
commandPoolPtr->getCommandPoolHandleRef(),
VK_COMMAND_BUFFER_LEVEL_SECONDARY,
this->secondaryCommandBufferCount));
this->utilityCommandBufferCount = 3;
this->utilityCommandBufferGroupPtr =
std::unique_ptr<CommandBufferGroup>(new CommandBufferGroup(
this->devicePtr->getDeviceHandleRef(),
commandPoolPtr->getCommandPoolHandleRef(),
VK_COMMAND_BUFFER_LEVEL_PRIMARY, this->utilityCommandBufferCount));
this->surfaceCapabilities = surfacePtr->getPhysicalDeviceSurfaceCapabilities(
*this->physicalDeviceHandlePtr.get());
this->surfaceFormatList = surfacePtr->getPhysicalDeviceSurfaceFormatList(
*this->physicalDeviceHandlePtr.get());
this->presentModeList = surfacePtr->getPhysicalDeviceSurfacePresentModeList(
*this->physicalDeviceHandlePtr.get());
this->swapchainPtr = std::unique_ptr<Swapchain>(new Swapchain(
this->devicePtr->getDeviceHandleRef(), 0,
this->surfacePtr->getSurfaceHandleRef(),
this->surfaceCapabilities.minImageCount + 1,
this->surfaceFormatList[0].format, this->surfaceFormatList[0].colorSpace,
this->surfaceCapabilities.currentExtent, 1,
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT, VK_SHARING_MODE_EXCLUSIVE,
{this->queueFamilyIndex}, this->surfaceCapabilities.currentTransform,
VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR, this->presentModeList[0], VK_TRUE,
VK_NULL_HANDLE));
std::vector<VkAttachmentReference> attachmentReferenceList = {
{0, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL},
{1, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}};
this->renderPassPtr = std::unique_ptr<RenderPass>(new RenderPass(
this->devicePtr->getDeviceHandleRef(), (VkRenderPassCreateFlagBits)0,
{{0, this->surfaceFormatList[0].format, VK_SAMPLE_COUNT_1_BIT,
VK_ATTACHMENT_LOAD_OP_CLEAR, VK_ATTACHMENT_STORE_OP_STORE,
VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_PRESENT_SRC_KHR},
{0, VK_FORMAT_D32_SFLOAT, VK_SAMPLE_COUNT_1_BIT,
VK_ATTACHMENT_LOAD_OP_CLEAR, VK_ATTACHMENT_STORE_OP_DONT_CARE,
VK_ATTACHMENT_LOAD_OP_DONT_CARE, VK_ATTACHMENT_STORE_OP_DONT_CARE,
VK_IMAGE_LAYOUT_UNDEFINED,
VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL}},
{{
0,
VK_PIPELINE_BIND_POINT_GRAPHICS,
0,
NULL,
1,
&attachmentReferenceList[0],
NULL,
&attachmentReferenceList[1],
0,
NULL,
}},
{}));
this->swapchainImageHandleList = swapchainPtr->getSwapchainImageHandleList();
for (uint32_t x = 0; x < this->swapchainImageHandleList.size(); x++) {
this->swapchainImageViewPtrList.push_back(
std::unique_ptr<ImageView>(new ImageView(
this->devicePtr->getDeviceHandleRef(),
this->swapchainImageHandleList[x], 0, VK_IMAGE_VIEW_TYPE_2D,
this->surfaceFormatList[0].format,
{VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY},
{VK_IMAGE_ASPECT_COLOR_BIT, 0, 1, 0, 1})));
this->depthImagePtrList.push_back(std::unique_ptr<Image>(new Image(
this->devicePtr->getDeviceHandleRef(),
*this->physicalDeviceHandlePtr.get(), 0, VK_IMAGE_TYPE_2D,
VK_FORMAT_D32_SFLOAT,
{this->surfaceCapabilities.currentExtent.width,
this->surfaceCapabilities.currentExtent.height, 1},
1, 1, VK_SAMPLE_COUNT_1_BIT, VK_IMAGE_TILING_OPTIMAL,
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT, VK_SHARING_MODE_EXCLUSIVE,
{this->queueFamilyIndex}, VK_IMAGE_LAYOUT_UNDEFINED, 0)));
this->depthImageViewPtrList.push_back(
std::unique_ptr<ImageView>(new ImageView(
this->devicePtr->getDeviceHandleRef(),
this->depthImagePtrList[x]->getImageHandleRef(), 0,
VK_IMAGE_VIEW_TYPE_2D, VK_FORMAT_D32_SFLOAT,
{VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY,
VK_COMPONENT_SWIZZLE_IDENTITY, VK_COMPONENT_SWIZZLE_IDENTITY},
{VK_IMAGE_ASPECT_DEPTH_BIT, 0, 1, 0, 1})));
this->framebufferPtrList.push_back(
std::unique_ptr<Framebuffer>(new Framebuffer(
this->devicePtr->getDeviceHandleRef(),
this->renderPassPtr->getRenderPassHandleRef(),
{this->swapchainImageViewPtrList[x]->getImageViewHandleRef(),
this->depthImageViewPtrList[x]->getImageViewHandleRef()},
(VkFramebufferCreateFlags)0,
this->surfaceCapabilities.currentExtent.width,
this->surfaceCapabilities.currentExtent.height, 1)));
this->imageAvailableFencePtrList.push_back(std::unique_ptr<Fence>(new Fence(
this->devicePtr->getDeviceHandleRef(), (VkFenceCreateFlagBits)0)));
this->acquireImageSemaphorePtrList.push_back(std::unique_ptr<Semaphore>(
new Semaphore(this->devicePtr->getDeviceHandleRef(), 0)));
this->writeImageSemaphorePtrList.push_back(std::unique_ptr<Semaphore>(
new Semaphore(this->devicePtr->getDeviceHandleRef(), 0)));
}
for (VkImage &swapchainImageHandle : this->swapchainImageHandleList) {
}
this->currentFrame = 0;
}
std::shared_ptr<Scene> Engine::createScene(std::string sceneName) {
this->scenePtrList.push_back(
std::shared_ptr<Scene>(new Scene(sceneName, shared_from_this())));
return this->scenePtrList[this->scenePtrList.size() - 1];
}
std::shared_ptr<Camera> Engine::createCamera(std::string cameraName) {
this->cameraPtrList.push_back(
std::shared_ptr<Camera>(new Camera(cameraName, shared_from_this())));
return this->cameraPtrList[this->cameraPtrList.size() - 1];
}
uint32_t Engine::render(std::shared_ptr<Scene> scenePtr,
std::shared_ptr<Camera> cameraPtr) {
for (uint32_t x = 0; x < scenePtr->getMaterialPtrList().size(); x++) {
if (cameraPtr->getIsCameraBufferDirty()) {
scenePtr->getMaterialPtrList()[x]->updateCameraDescriptorSet(cameraPtr);
cameraPtr->resetIsCameraBufferDirty();
}
for (uint32_t y = 0; y < scenePtr->getLightPtrList().size(); y++) {
if (scenePtr->getLightPtrList()[x]->getIsLightBufferDirty()) {
scenePtr->getMaterialPtrList()[x]->updateLightDescriptorSet(
scenePtr->getLightPtrList()[y]);
scenePtr->getLightPtrList()[x]->resetIsLightBufferDirty();
}
}
scenePtr->getMaterialPtrList()[x]->updateSceneDescriptorSet(scenePtr);
}
scenePtr->recordCommandBuffer(this->currentFrame);
uint32_t currentImageIndex = this->swapchainPtr->aquireNextImageIndex(
UINT32_MAX,
this->acquireImageSemaphorePtrList[this->currentFrame]
->getSemaphoreHandleRef(),
VK_NULL_HANDLE);
this->commandBufferGroupPtr->submit(
this->devicePtr->getQueueHandleRef(this->queueFamilyIndex, 0),
{{{this->acquireImageSemaphorePtrList[this->currentFrame]
->getSemaphoreHandleRef()},
{VK_PIPELINE_STAGE_COLOR_ATTACHMENT_OUTPUT_BIT},
{currentImageIndex},
{this->writeImageSemaphorePtrList[currentImageIndex]
->getSemaphoreHandleRef()}}},
this->imageAvailableFencePtrList[this->currentFrame]
->getFenceHandleRef());
this->surfacePtr->queuePresentCmd(
this->devicePtr->getQueueHandleRef(this->queueFamilyIndex, 0),
{this->writeImageSemaphorePtrList[currentImageIndex]
->getSemaphoreHandleRef()},
{this->swapchainPtr->getSwapchainHandleRef()}, {currentImageIndex}, NULL);
this->imageAvailableFencePtrList[this->currentFrame]->waitForSignal(
UINT32_MAX);
this->imageAvailableFencePtrList[this->currentFrame]->reset();
this->currentFrame =
(this->currentFrame + 1) % this->framebufferPtrList.size();
return this->currentFrame;
}
| 42.553055 | 80 | 0.728805 | [
"render",
"vector"
] |
3f327a33a255ff4a346684624db40fea8bcef913 | 7,092 | cpp | C++ | feature_detection/matching_perspective.cpp | dustsigns/lecture-demos | 50d5abb252e7e467e9648b61310ce93b85c6c5f0 | [
"BSD-3-Clause"
] | 14 | 2018-03-26T13:43:58.000Z | 2022-03-03T13:04:36.000Z | feature_detection/matching_perspective.cpp | dustsigns/lecture-demos | 50d5abb252e7e467e9648b61310ce93b85c6c5f0 | [
"BSD-3-Clause"
] | null | null | null | feature_detection/matching_perspective.cpp | dustsigns/lecture-demos | 50d5abb252e7e467e9648b61310ce93b85c6c5f0 | [
"BSD-3-Clause"
] | 1 | 2019-08-03T23:12:08.000Z | 2019-08-03T23:12:08.000Z | //Illustration of SIFT matching for finding a perspective transform
// Andreas Unterweger, 2019-2022
//This code is licensed under the 3-Clause BSD License. See LICENSE file for details.
#include <iostream>
#include <vector>
#include <opencv2/core.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/calib3d.hpp>
#include <opencv2/imgproc.hpp>
#include "colors.hpp"
#include "combine.hpp"
static void DetectFeatures(const cv::Mat &image, std::vector<cv::KeyPoint> &keypoints)
{
auto feature_detector = cv::SIFT::create();
feature_detector->detect(image, keypoints);
}
static void ExtractDescriptors(const cv::Mat &image, std::vector<cv::KeyPoint> &keypoints, cv::Mat &descriptors)
{
auto extractor = cv::SIFT::create();
extractor->compute(image, keypoints, descriptors);
}
static void FilterMatches(const std::vector<std::vector<cv::DMatch>> matches, std::vector<cv::DMatch> &filtered_matches)
{
const double second_to_first_match_distance_ratio = 0.8; //From Lowe's 2004 paper
for (const auto &match : matches)
{
assert(match.size() == 2);
if (match[0].distance < second_to_first_match_distance_ratio * match[1].distance) //Only keep "good" matches, i.e., those where the second candidate is significantly worse than the first
filtered_matches.push_back(match[0]);
}
}
static void MatchFeatures(const cv::Mat &first_descriptors, const cv::Mat &second_descriptors, std::vector<cv::DMatch> &filtered_matches)
{
cv::BFMatcher matcher;
std::vector<std::vector<cv::DMatch>> matches;
matcher.knnMatch(first_descriptors, second_descriptors, matches, 2); //Find the two best matches
FilterMatches(matches, filtered_matches);
}
static void GetMatches(const cv::Mat &first_image, std::vector<cv::KeyPoint> &first_keypoints, const cv::Mat &second_image, std::vector<cv::KeyPoint> &second_keypoints, std::vector<cv::DMatch> &matches)
{
cv::Mat first_descriptors, second_descriptors;
ExtractDescriptors(first_image, first_keypoints, first_descriptors);
ExtractDescriptors(second_image, second_keypoints, second_descriptors);
MatchFeatures(first_descriptors, second_descriptors, matches);
}
static void GetMatchingKeyPoints(const std::vector<cv::DMatch> &matches, const std::vector<cv::KeyPoint> &first_keypoints, const std::vector<cv::KeyPoint> &second_keypoints, std::vector<cv::Point2f> &first_image_points, std::vector<cv::Point2f> &second_image_points)
{
for (const auto &match : matches)
{
first_image_points.push_back(first_keypoints[match.queryIdx].pt);
second_image_points.push_back(second_keypoints[match.trainIdx].pt);
}
}
static bool FindHomography(const cv::Mat &first_image, const cv::Mat &second_image, cv::Mat &homography)
{
std::vector<cv::KeyPoint> first_keypoints, second_keypoints;
DetectFeatures(first_image, first_keypoints);
DetectFeatures(second_image, second_keypoints);
std::vector<cv::DMatch> matches;
GetMatches(first_image, first_keypoints, second_image, second_keypoints, matches);
if (matches.size() == 0)
return false;
std::vector<cv::Point2f> first_image_points, second_image_points;
GetMatchingKeyPoints(matches, first_keypoints, second_keypoints, first_image_points, second_image_points);
homography = cv::findHomography(first_image_points, second_image_points, cv::RANSAC);
return !homography.empty();
}
static void TransformImageRectangle(const cv::Size2i original_size, const cv::Mat &homography, std::vector<cv::Point2i> &transformed_corners)
{
const cv::Point2f top_left(0, 0);
const cv::Point2f bottom_left(original_size.width, 0);
const cv::Point2f bottom_right(original_size.width, original_size.height);
const cv::Point2f top_right(0, original_size.height);
const std::vector<cv::Point2f> original_corners { top_left, bottom_left, bottom_right, top_right };
std::vector<cv::Point2f> transformed_corners_float;
perspectiveTransform(original_corners, transformed_corners_float, homography);
assert(transformed_corners.empty());
std::transform(transformed_corners_float.begin(), transformed_corners_float.end(), back_inserter(transformed_corners),
[](const cv::Point2f &p)
{
return cv::Point2i(p);
});
}
static void DrawImageRectangle(cv::Mat image, const std::vector<cv::Point2i> &transformed_corners)
{
constexpr auto line_width = 2;
const auto frame_color = imgutils::Red;
cv::polylines(image, transformed_corners, true, frame_color, line_width); //Closed polylines
}
static void TransformAndDrawImageRectangle(const cv::Mat &first_image, cv::Mat &second_image, const cv::Mat &homography)
{
std::vector<cv::Point2i> transformed_corners;
TransformImageRectangle(first_image.size(), homography, transformed_corners);
DrawImageRectangle(second_image, transformed_corners);
}
static void ShowImages(const cv::Mat &first_image, cv::Mat &second_image)
{
constexpr auto window_name = "Original and found (perspective-transformed) image";
cv::namedWindow(window_name, cv::WINDOW_GUI_NORMAL | cv::WINDOW_AUTOSIZE);
cv::moveWindow(window_name, 0, 0);
cv::Mat homography;
const bool found = FindHomography(first_image, second_image, homography);
if (found)
TransformAndDrawImageRectangle(first_image, second_image, homography);
const cv::Mat combined_image = imgutils::CombineImages({first_image, second_image}, imgutils::CombinationMode::Horizontal);
cv::imshow(window_name, combined_image);
}
static int OpenVideo(const char * const filename, cv::VideoCapture &capture)
{
using namespace std::string_literals;
const bool use_webcam = "-"s == filename; //Interpret - as the default webcam
const bool opened = use_webcam ? capture.open(0) : capture.open(filename);
if (use_webcam) //Minimize buffering for webcams to return up-to-date images
capture.set(cv::CAP_PROP_BUFFERSIZE, 1);
return opened;
}
int main(const int argc, const char * const argv[])
{
if (argc != 3 && argc != 4)
{
std::cout << "Illustrates how to find an image with a perspective transform within another image." << std::endl;
std::cout << "Usage: " << argv[0] << " <first image> <second image or video of second images> [<wait time between second images>]" << std::endl;
return 1;
}
const auto first_image_filename = argv[1];
const cv::Mat first_image = cv::imread(first_image_filename);
if (first_image.empty())
{
std::cerr << "Could not read first image '" << first_image_filename << "'" << std::endl;
return 2;
}
const auto second_image_filename = argv[2];
int wait_time = 0;
if (argc == 4)
{
const auto wait_time_text = argv[3];
wait_time = std::stoi(wait_time_text);
}
cv::VideoCapture capture;
if (!OpenVideo(second_image_filename, capture))
{
std::cerr << "Could not open second image '" << second_image_filename << "'" << std::endl;
return 3;
}
cv::Mat second_image;
while (capture.read(second_image) && !second_image.empty())
{
ShowImages(first_image, second_image);
if (cv::waitKey(wait_time) == 'q') //Interpret Q key press as exit
break;
}
return 0;
}
| 41.717647 | 266 | 0.739284 | [
"vector",
"transform"
] |
3f384f9e1fd77cb863a8073dacfe12b86f0bfa9e | 1,031 | cpp | C++ | leetcode_archived_cpp/LeetCode_232.cpp | Sean10/Algorithm_code | 46ff1cb5b81400cbcc324dabdf4298bf7a55e5eb | [
"BSD-3-Clause"
] | null | null | null | leetcode_archived_cpp/LeetCode_232.cpp | Sean10/Algorithm_code | 46ff1cb5b81400cbcc324dabdf4298bf7a55e5eb | [
"BSD-3-Clause"
] | 7 | 2021-03-19T04:41:21.000Z | 2021-10-19T15:46:36.000Z | leetcode_archived_cpp/LeetCode_232.cpp | Sean10/Algorithm_code | 46ff1cb5b81400cbcc324dabdf4298bf7a55e5eb | [
"BSD-3-Clause"
] | null | null | null | class MyQueue {
public:
/** Initialize your data structure here. */
MyQueue() {
}
/** Push element x to the back of queue. */
void push(int x) {
input.push(x);
}
/** Removes the element from in front of queue and returns that element. */
int pop() {
peek();
int temp = output.top();
output.pop();
return temp;
}
/** Get the front element. */
int peek() {
if (output.empty())
{
while(!input.empty())
{
output.push(input.top());
input.pop();
}
}
return output.top();
}
/** Returns whether the queue is empty. */
bool empty() {
return input.empty() && output.empty();
}
private:
stack<int> input, output;
};
/**
* Your MyQueue object will be instantiated and called as such:
* MyQueue obj = new MyQueue();
* obj.push(x);
* int param_2 = obj.pop();
* int param_3 = obj.peek();
* bool param_4 = obj.empty();
*/
| 20.62 | 79 | 0.506305 | [
"object"
] |
3f38c53004d73b34019a647e06f0a83a5b768662 | 11,944 | cc | C++ | source/device/opencl/oppack4/ocl_conv2d.cc | zhouzy-creator/Tengine | fea5c064da7b8ed0e24212dcc65d30fda3c7477c | [
"Apache-2.0"
] | 4 | 2020-03-25T06:16:15.000Z | 2021-12-28T06:06:48.000Z | source/device/opencl/oppack4/ocl_conv2d.cc | zhouzy-creator/Tengine | fea5c064da7b8ed0e24212dcc65d30fda3c7477c | [
"Apache-2.0"
] | 12 | 2021-05-12T12:28:12.000Z | 2022-03-30T15:15:39.000Z | source/device/opencl/oppack4/ocl_conv2d.cc | zhouzy-creator/Tengine | fea5c064da7b8ed0e24212dcc65d30fda3c7477c | [
"Apache-2.0"
] | 1 | 2022-03-03T03:36:51.000Z | 2022-03-03T03:36: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.
*/
/*
* Copyright (c) 2021, OPEN AI LAB
* Author: hbshi@openailab.com
*/
//#include <libc.h>
#include <stdlib.h>
#include <memory>
#include "ocl_convertor.hpp"
#include "ocl_conv2d.hpp"
#include "ocl_winograd.hpp"
#include "ocl_dwconv.hpp"
void ocl_conv2d::pre_run()
{
struct graph* ir_graph = ir_node->graph;
int ir_tensor_idx_input = ir_node->input_tensors[0];
int ir_tensor_idx_output = ir_node->output_tensors[0];
struct tensor* input_tensor = get_ir_graph_tensor(ir_graph, ir_tensor_idx_input);
struct tensor* output_tensor = get_ir_graph_tensor(ir_graph, ir_tensor_idx_output);
uint64_t handle_input = engine->get_gpu_mem_by_idx(ir_tensor_idx_input);
uint64_t handle_output = engine->get_gpu_mem_by_idx(ir_tensor_idx_output);
// TLOG_ERR("handle_input: %lld handle_output: %lld \n", handle_input, handle_output);
int height = output_tensor->dims[2];
int width = output_tensor->dims[3];
int input_height = input_tensor->dims[2];
int input_width = input_tensor->dims[3];
int input_channel = input_tensor->dims[1];
int input_channel_block = UP_DIV(input_channel, 4);
int output_channel = output_tensor->dims[1];
int output_height = output_tensor->dims[2];
int kernel_width = this->conv2d_param->kernel_w;
int kernel_height = this->conv2d_param->kernel_h;
int global_0 = UP_DIV(width, 4) * UP_DIV(output_channel, 4);
int global_1 = output_height;
int input_image_shape[2] = {input_height, input_width};
int output_image_shape[2] = {height, width};
int kernel_shape[2] = {kernel_height, kernel_width};
int stride_shape[2] = {strides[0], strides[1]};
int padding_shape[2] = {paddings[0], paddings[1]};
int dilation_shape[2] = {dilations[0], dilations[1]};
uint32_t idx = 0;
auto kernel = &conv2d_kernel;
kernel->setArg(idx++, global_0);
kernel->setArg(idx++, global_1);
kernel->setArg(idx++, *(cl::Image*)handle_input);
kernel->setArg(idx++, *gpu_weight);
if (2 < ir_node->input_num)
{
kernel->setArg(idx++, *gpu_bias);
}
kernel->setArg(idx++, *(cl::Image*)handle_output);
kernel->setArg(idx++, sizeof(input_image_shape), input_image_shape);
kernel->setArg(idx++, input_channel_block);
kernel->setArg(idx++, sizeof(output_image_shape), output_image_shape);
kernel->setArg(idx++, sizeof(kernel_shape), kernel_shape);
kernel->setArg(idx++, sizeof(stride_shape), stride_shape);
kernel->setArg(idx++, sizeof(padding_shape), padding_shape);
kernel->setArg(idx++, sizeof(dilation_shape), dilation_shape);
kernel->setArg(idx, UP_DIV(width, 4));
global_work_size = {(uint32_t)global_0, (uint32_t)global_1};
local_work_size = find_local_group_2d(global_work_size, max_work_group_size, engine, conv2d_kernel, ir_node->name);
}
void ocl_conv2d::run(struct subgraph* subgraph)
{
#ifdef OPENCL_PROFILE_TIME
cl::Event event;
run_node_2d(global_work_size, local_work_size, conv2d_kernel, &event);
int cost = (int)engine->get_cost_time(&event);
TLOG_ERR("cost: %d conv2d:%s \n", cost, ir_node->name);
#else
run_node_2d(global_work_size, local_work_size, conv2d_kernel);
#endif
#if 0
// print input
printf("ocl_conv2d::run :input ------------------ \n");
uint32_t input_w = input_width * input_channel_block;
uint32_t input_h = input_height;
std::vector<float> input_debug(input_w * input_h * 4);
engine->get_command_queue().enqueueReadImage(*(cl::Image*)handle_input, CL_TRUE, {0, 0, 0}, {input_w, input_h, 1}, input_w * sizeof(float) * 4, 0, input_debug.data());
int idx_debug_input = 0;
std::vector<float> input_debug_nchw(input_tensor->elem_num);
for (int i = 0; i < input_tensor->dims[1]; ++i)
{
for (int j = 0; j < input_tensor->dims[2]; ++j)
{
for (int k = 0; k < input_tensor->dims[3]; ++k)
{
int index_nchw = i * input_width * input_height + j * input_width + k;
int from_index = j * input_w * 4 + (i / 4) * (input_width * 4) + k * 4 + i % 4;
input_debug_nchw[index_nchw] = input_debug[from_index];
}
}
}
std::string input_name = std::string(ir_node->name) + "input";
print_data_file(input_tensor, input_name, input_debug_nchw.data());
printf("#### %s ocl_conv2d::run :output ------------------ \n", ir_node->name);
uint32_t output_w = width * UP_DIV(output_channel, 4);
uint32_t output_h = height;
std::vector<float> output_debug(output_w * output_h * 4);
engine->get_command_queue().enqueueReadImage(*(cl::Image*)handle_output, CL_TRUE, {0, 0, 0}, {output_w, output_h, 1}, output_w * sizeof(float) * 4, 0, output_debug.data());
std::vector<float> output_debug_nchw(output_tensor->elem_num);
for (int i = 0; i < output_tensor->dims[1]; ++i)
{
for (int j = 0; j < output_tensor->dims[2]; ++j)
{
for (int k = 0; k < output_tensor->dims[3]; ++k)
{
int index_nchw = i * width * height + j * width + k;
int from_index = j * output_w * 4 + (i / 4) * (width * 4) + k * 4 + i % 4;
output_debug_nchw[index_nchw] = output_debug[from_index];
}
}
}
std::string output_name = std::string(ir_node->name) + "output";
print_data_file(output_tensor, output_name, output_debug_nchw.data());
#endif
}
ocl_conv2d::ocl_conv2d(OCLEngine* engine, struct node* ir_node)
: ocl_node(engine, ir_node)
{
struct graph* ir_graph = ir_node->graph;
struct tensor* weight_tensor = get_ir_graph_tensor(ir_graph, ir_node->input_tensors[1]);
struct tensor* bias_tensor;
if (2 < ir_node->input_num)
{
bias_tensor = get_ir_graph_tensor(ir_graph, ir_node->input_tensors[2]);
upload_bias_gpu(bias_tensor);
}
auto* conv_2d_param = (struct conv_param*)ir_node->op.param_mem;
this->conv2d_param = conv_2d_param;
strides = {conv_2d_param->stride_h, conv_2d_param->stride_w};
dilations = {conv_2d_param->dilation_h, conv_2d_param->dilation_w};
paddings = {conv_2d_param->pad_h0, conv_2d_param->pad_w0};
int kernel_width = conv_2d_param->kernel_w;
int kernel_height = conv_2d_param->kernel_h;
int out_channel = conv_2d_param->output_channel;
int input_channel = conv_2d_param->input_channel;
int filter_size = kernel_height * kernel_width * out_channel * input_channel;
int filter_buffer_size = filter_size * sizeof(float);
cl::Buffer filter_buffer(engine->get_context(), CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, filter_buffer_size);
cl_int error;
auto filter_ptr_gpu = engine->get_command_queue().enqueueMapBuffer(filter_buffer, true, CL_MAP_WRITE, 0, filter_buffer_size, nullptr, nullptr, &error);
if (filter_ptr_gpu != nullptr && error == CL_SUCCESS)
{
::memset(filter_ptr_gpu, 0, filter_buffer_size);
::memcpy(filter_ptr_gpu, weight_tensor->data, filter_buffer_size);
}
else
{
TLOG_ERR("error in filter_ptr_gpu");
}
engine->get_command_queue().enqueueUnmapMemObject(filter_buffer, filter_ptr_gpu);
gpu_weight = std::make_shared<cl::Image2D>(engine->get_context(), CL_MEM_READ_WRITE, cl::ImageFormat(CL_RGBA, CL_FLOAT), input_channel, UP_DIV(out_channel, 4) * kernel_width * kernel_height);
engine->get_converter().conv2d_buffer_to_image(conv_2d_param, &filter_buffer, gpu_weight.get());
std::set<std::string> buildOption;
if (2 < ir_node->input_num)
{
buildOption.emplace("-DBIAS");
}
if (conv2d_param->activation == 0)
{
buildOption.emplace("-DRELU");
}
else if (conv_2d_param->activation == 6)
{
buildOption.emplace("-DRELU6");
}
conv2d_kernel = engine->build_kernel("conv_2d_2d", "conv_2d", buildOption);
max_work_group_size = engine->get_max_work_group_size(conv2d_kernel);
#if 0
std::vector<float> debugData;
debugData.resize(3 * 9 * 4);
engine->get_command_queue().enqueueReadImage(*gpu_weight,
CL_TRUE, {0, 0, 0}, {3, 9, 1}, 3 * sizeof(float) * 4,
0, debugData.data());
int debugIndex = 0;
printf("\n");
for (int i = 0; i < 9; ++i)
{
for (int j = 0; j < 3; ++j)
{
for (int k = 0; k < 4; ++k)
{
printf("%.4f,", debugData[debugIndex]);
debugIndex++;
}
printf(" ");
}
printf("\n");
}
#endif
}
void ocl_conv2d::upload_bias_gpu(struct tensor* ir_tensor)
{
int bias_size = ir_tensor->elem_num;
int buffer_size = ROUND_UP(bias_size, 4);
cl::Buffer bias_buffer(engine->get_context(), CL_MEM_READ_WRITE | CL_MEM_ALLOC_HOST_PTR, bias_size * sizeof(float));
cl_int error;
auto* bias_ptr_gpu = (float*)engine->get_command_queue().enqueueMapBuffer(bias_buffer, true, CL_MAP_WRITE, 0, bias_size * sizeof(float), nullptr, nullptr, &error);
if (bias_ptr_gpu != nullptr && error == CL_SUCCESS)
{
::memset(bias_ptr_gpu, 0, bias_size * sizeof(float));
::memcpy(bias_ptr_gpu, ir_tensor->data, bias_size * sizeof(float));
}
engine->get_command_queue().enqueueUnmapMemObject(bias_buffer, bias_ptr_gpu);
gpu_bias = std::make_shared<cl::Image2D>(engine->get_context(), CL_MEM_READ_WRITE, cl::ImageFormat(CL_RGBA, CL_FLOAT), UP_DIV(bias_size, 4), 1);
engine->get_converter().buffer_to_image(&bias_buffer, gpu_bias.get(), UP_DIV(bias_size, 4), 1);
}
class ocl_conv2d_creator : public ocl_node_creator
{
public:
ocl_node* creator(OCLEngine* engine, struct node* ir_node) override
{
auto* conv_2d_param = (struct conv_param*)ir_node->op.param_mem;
struct graph* ir_graph = ir_node->graph;
struct tensor* input_tensor = get_ir_graph_tensor(ir_graph, ir_node->input_tensors[0]);
bool use_wino = false;
bool is_dwconv = false;
if (conv_2d_param->group == input_tensor->dims[1] && conv_2d_param->group != 1)
{
is_dwconv = true;
}
else if (conv_2d_param->kernel_w == 3 && conv_2d_param->kernel_h == 3 && conv_2d_param->dilation_w == 1 && conv_2d_param->dilation_h == 1
&& conv_2d_param->stride_w == 1 && conv_2d_param->stride_h == 1
&& conv_2d_param->input_channel >= 32
&& conv_2d_param->input_channel >= 32)
{
use_wino = true;
}
if (is_dwconv)
{
return new ocl_dwconv(engine, ir_node);
}
else if (use_wino)
{
return new ocl_winograd(engine, ir_node);
}
else
{
return new ocl_conv2d(engine, ir_node);
}
}
};
REGISTER_OCL_OP(OP_CONV, ocl_conv2d_creator); | 41.32872 | 196 | 0.64007 | [
"vector"
] |
2786f6c632bb6f51197a2bfb00598bd230923204 | 6,388 | hpp | C++ | Hatman/vector2.hpp | DmitriBogdanov/hatman-game | f256eff596607e5517d1193db35175e3cd53b9b6 | [
"MIT"
] | null | null | null | Hatman/vector2.hpp | DmitriBogdanov/hatman-game | f256eff596607e5517d1193db35175e3cd53b9b6 | [
"MIT"
] | null | null | null | Hatman/vector2.hpp | DmitriBogdanov/hatman-game | f256eff596607e5517d1193db35175e3cd53b9b6 | [
"MIT"
] | null | null | null | #pragma once
/*
Classes/methods for 2D vector manipulation
*/
#include <cmath> // 'sqrt()', 'sin()', 'cos()', 'acos()', etc
#include <cstddef> // 'std::size_t' type for hash function
#include <functional> // contains 'std::hash()'
#include "ct_math.hpp" // constexpr math functions
// helpers::
// - Related utility functions
namespace helpers {
constexpr double PI = 3.1415926;
constexpr double degree_to_rad(double degrees) {
return degrees * helpers::PI / 180.;
}
constexpr double rad_to_degree(double radians) {
return radians * 180. / helpers::PI;
}
template<typename T>
constexpr int sign(T val) { // standard 'sign()' function (x<0 => -1, x==0 => 0, x>0 => 1)
return (T(0) < val) - (val < T(0));
}
}
// # Vector2 #
// - Represents int 2D vector
class Vector2 {
public:
constexpr Vector2() : x(0), y(0) {}
constexpr Vector2(int X, int Y) : x(X), y(Y) {}
int x, y;
// Operators
constexpr bool operator == (const Vector2 &other) const {
return (this->x == other.x) && (this->y == other.y);
}
constexpr bool operator != (const Vector2 &other) const {
return (this->x != other.x) || (this->y != other.y);
}
constexpr Vector2 operator + (const Vector2 &other) const {
return Vector2(
this->x + other.x,
this->y + other.y);
}
constexpr Vector2 operator - (const Vector2 &other) const {
return Vector2(
this->x - other.x,
this->y - other.y
);
}
constexpr Vector2 operator * (double value) const {
return Vector2(
static_cast<int>(this->x * value),
static_cast<int>(this->y * value)
);
}
constexpr Vector2 operator / (double value) const {
return Vector2(
static_cast<int>(static_cast<double>(this->x) / value),
static_cast<int>(static_cast<double>(this->y) / value)
);
}
constexpr Vector2& operator += (const Vector2 &other) {
this->x += other.x;
this->y += other.y;
return *this;
}
constexpr Vector2& operator -= (const Vector2 &other) {
this->x -= other.x;
this->y -= other.y;
return *this;
}
constexpr Vector2& operator *= (double value) {
this->x = static_cast<int>(this->x * value); // using *= would result in a warning due to double->int implicit conversion
this->y = static_cast<int>(this->y * value);
return *this;
}
constexpr Vector2& operator /= (double value) {
this->x = static_cast<int>(this->x / value); // using *= would result in a warning due to double->int implicit conversion
this->y = static_cast<int>(this->y / value);
return *this;
}
// Methods
constexpr Vector2& set(int x, int y) {
this->x = x;
this->y = y;
return *this;
}
constexpr int length2() const { // square of length
return this->x * this->x + this->y * this->y;
}
double length() const { // slower than length2()
return std::sqrt(this->x * this->x + this->y * this->y);
}
};
// Hash function
struct Vector2_Hash {
// Hash function
std::size_t operator () (const Vector2 &vector) const {
// Hashes both fiels and apply bitwise XOR
std::size_t h1 = std::hash<int>()(vector.x);
std::size_t h2 = std::hash<int>()(vector.y);
return h1 ^ (h2 << 1);
// If we didn't shift the bits and two vectors were the same,
// the XOR would cause them to cancel each other out.
// So hash(A,A,1) would be the same as hash(B,B,1).
// Also order wouldn't matter, so hash(A,B,1) would be the same as hash(B,A,1)
}
};
// # Vector2d #
// - Represents double 2D vector
class Vector2d {
public:
constexpr Vector2d() : x(0.), y(0.) {}
constexpr Vector2d(double X, double Y) : x(X), y(Y) {}
constexpr Vector2d(const Vector2 &vector) : x(vector.x), y(vector.y) {} // Vector2 implicitly converts to a wider tupe
double x, y;
// Operators
constexpr bool operator == (const Vector2d &other) const {
return (this->x == other.x) && (this->y == other.y);
}
constexpr bool operator != (const Vector2d &other) const {
return (this->x != other.x) || (this->y != other.y);
}
constexpr Vector2d operator + (const Vector2d &other) const {
return Vector2d(
this->x + other.x,
this->y + other.y
);
}
constexpr Vector2d operator - (const Vector2d &other) const {
return Vector2d(
this->x - other.x,
this->y - other.y
);
}
constexpr Vector2d operator * (double value) const {
return Vector2d(
this->x * value,
this->y * value
);
}
constexpr Vector2d operator / (double value) const {
return Vector2d(
this->x / value,
this->y / value
);
}
constexpr Vector2d& operator += (const Vector2d &other) {
this->x += other.x;
this->y += other.y;
return *this;
}
constexpr Vector2d& operator -= (const Vector2d &other) {
this->x -= other.x;
this->y -= other.y;
return *this;
}
constexpr Vector2d& operator *= (double value) {
this->x *= value;
this->y *= value;
return *this;
}
constexpr Vector2d& operator /= (double value) {
this->x /= value;
this->y /= value;
return *this;
}
// Methods
constexpr Vector2d& set(double x, double y) {
this->x = x;
this->y = y;
return *this;
}
/// LOOK FOR OPTIMIZATIONS
Vector2d& rotate(double radians) {
const auto x1 = this->x;
const auto y1 = this->y;
this->x = x1 * std::cos(radians) - y1 * std::sin(radians);
this->y = x1 * std::sin(radians) + y1 * std::cos(radians);
return *this;
}
/// LOOK FOR OPTIMIZATIONS
Vector2d& rotateDegrees(double degrees) {
this->rotate(helpers::degree_to_rad(degrees));
return *this;
}
/// LOOK FOR OPTIMIZATIONS
double angleToX() const { // check out CORDIC if better performance is needed
return std::acos(this->x / this->length()) * helpers::sign(this->y);
}
/// LOOK FOR OPTIMIZATIONS
double andgleToY() const {
return std::acos(this->y / this->length()) * helpers::sign(this->x);
}
double length2() const { // square of length
return this->x * this->x + this->y * this->y;
}
/// LOOK FOR OPTIMIZATIONS
double length() const { // slower than length2()
return std::sqrt(this->x * this->x + this->y * this->y);
}
constexpr Vector2d normalized() const {
return (*this / this->length());
}
constexpr Vector2 toVector2() const { // convertion to Vector2 loses precision, only explicit conversion is allowed
return Vector2(
static_cast<int>(this->x),
static_cast<int>(this->y)
);
}
};
/// TRY IMPLEMENTING CONSTEXPR VERSION
inline Vector2d make_rotated_Vector2d(double length, double rotation) {
return Vector2d(length, 0.).rotate(rotation);
} | 24.19697 | 123 | 0.639637 | [
"vector"
] |
2787ef5ede673423ce568ca0fabcca6323cce168 | 10,567 | cpp | C++ | src/misc/Configuration.cpp | hermanndetz/xtalsim | f8bb841e504d0f578334e21391f55dff474ae5d7 | [
"MIT"
] | null | null | null | src/misc/Configuration.cpp | hermanndetz/xtalsim | f8bb841e504d0f578334e21391f55dff474ae5d7 | [
"MIT"
] | null | null | null | src/misc/Configuration.cpp | hermanndetz/xtalsim | f8bb841e504d0f578334e21391f55dff474ae5d7 | [
"MIT"
] | null | null | null | /**
Copyright (C) 2018 Hermann Detz and Juergen Maier
This software may be modified and distributed under the terms
of the MIT license. See the LICENSE file for details.
*/
#include "Configuration.h"
//------------------------------------------------------------------------------
Configuration::Configuration():
materialName(""), materialFile(""), materialSearchName(""),
periodicTableFileName(""), c11(0), c12(0), c44(0),
latticeType(""),
latticeConstant(0), size(0,0,0), growthDimension(4),
neighborRadius(0), neighborLayers(0), latticeTemperature(0),
startIndex(-1), stopIndex(-1), mmcProbability(-1),
mmcRunCount(1), minDisplacement(0), maxDisplacement(-1),
scalingProbability(-1), minScaling(0), maxScaling(-1), runCount(-1),
checkCount(1), energyDropFactor(2), reductionFactor(2), minEnergy(0),
anionPassivationProbability(1.0), requireMatchingCation(false), maxThreadCount(1),
interfaceAtoms(-1), interfacePositions(-1), inputFileName(""), outputFileName(""),
logFileName(""), tersoffFileName(""), outputPreamble(""), extend(false),
calculateEnergy(false), print(false), verbose(false), quiet(false),
renderBonds(false), visualizeBondStrain(false), refLatticeConstant(0.0),
modifiedOnly(false), filterModificationState(), modifiedNegative(false),
modificationIndexMax(0), cameraFocalPoint(0,0,0), cameraDirection(0,0,0),
cameraZoom(1.0), modificationAnimation(false), animationStep(1),
animationFilePrefix(""), screenshotFileName(""), rotationCount(0),
dynamicOptimization(false), staticOptimization(false)
{
//nothing to be done
}
//------------------------------------------------------------------------------
Configuration::Configuration(const Configuration &config) {
this->operator=(config);
}
//------------------------------------------------------------------------------
Configuration::~Configuration() {}
//------------------------------------------------------------------------------
void Configuration::operator=(const Configuration &config) {
materialName = config.materialName;
materialFile = config.materialFile;
materialSearchName = config.materialSearchName;
periodicTableFileName = config.periodicTableFileName;
c11 = config.c11;
c12 = config.c12;
c44 = config.c44;
latticeType = config.latticeType;
latticeConstant = config.latticeConstant;
size = config.size;
growthDimension = config.growthDimension;
neighborRadius = config.neighborRadius;
neighborLayers = config.neighborLayers;
startIndex = config.startIndex;
stopIndex = config.stopIndex;
mmcProbability = config.mmcProbability;
mmcRunCount = config.mmcRunCount;
minDisplacement = config.minDisplacement;
maxDisplacement = config.maxDisplacement;
scalingProbability = config.scalingProbability;
minScaling = config.minScaling;
maxScaling = config.maxScaling;
runCount = config.runCount;
checkCount = config.checkCount;
energyDropFactor = config.energyDropFactor;
reductionFactor = config.reductionFactor;
minEnergy = config.minEnergy;
anionPassivationProbability = config.anionPassivationProbability;
requireMatchingCation = config.requireMatchingCation;
maxThreadCount = config.maxThreadCount;
interfaceAtoms = config.interfaceAtoms;
interfacePositions = config.interfacePositions;
inputFileName = config.inputFileName;
outputFileName = config.outputFileName;
logFileName = config.logFileName;
tersoffFileName = config.tersoffFileName;
outputPreamble = config.outputPreamble;
extend = config.extend;
calculateEnergy = config.calculateEnergy;
print = config.print;
verbose = config.verbose;
quiet = config.quiet;
staticOptimization = config.staticOptimization;
dynamicOptimization = config.dynamicOptimization;
renderBonds = config.renderBonds;
visualizeBondStrain = config.visualizeBondStrain;
refLatticeConstant = config.refLatticeConstant;
modifiedOnly = config.modifiedOnly;
filterModificationState = config.filterModificationState;
modifiedNegative = config.modifiedNegative;
modificationIndexMax = config.modificationIndexMax;
cameraFocalPoint = config.cameraFocalPoint;
cameraDirection = config.cameraDirection;
cameraZoom = config.cameraZoom;
modificationAnimation = config.modificationAnimation;
animationStep = config.animationStep;
animationFilePrefix = config.animationFilePrefix;
screenshotFileName = config.screenshotFileName;
rotationCount = config.rotationCount;
latticeTemperature = config.latticeTemperature;
}
//------------------------------------------------------------------------------
//! Returns filter definition for atom states
std::bitset<AtomState::StateCount> Configuration::getModificationState(void) const {
std::bitset<AtomState::StateCount> result{};
for (auto filter: filterModificationState) {
if (filter == "filter-modified-interface")
result.set(AtomState::ModifiedInterface);
else if (filter == "filter-modified-exchange")
result.set(AtomState::ModifiedExchangeReaction);
}
return result;
}
//------------------------------------------------------------------------------
//! \return Member variables with description as string.
const std::string Configuration::str(void) const
{
std::ostringstream msg;
std::string name;
double share;
msg << "Material Name: '" << materialName << "'" << std::endl;
msg << "Elastic constants: c11=" << c11 << "; c12=" << c12 <<
"; c44=" << c44 << std::endl;
msg << "Lattice type: '" << latticeType << "'" << std::endl;
msg << "Lattice constant: " << latticeConstant << std::endl;
for (auto el: cations){
std::tie (name, share) = el;
msg << "Cation " << name << " with share " << share << std::endl;
}
for (auto el: anions){
std::tie (name, share) = el;
msg << "Anion " << name << " with share " << share << std::endl;
}
msg << "Material File: '" << materialFile << "'" << std::endl;
msg << "Material search name: '" << materialSearchName << "'" << std::endl;
msg << "---------------------------------------" << std::endl;
msg << "Size: " << size.str() << std::endl;
msg << "Growth dimension: " << (int)growthDimension << std::endl;
msg << "---------------------------------------" << std::endl;
msg << "Input file name: '" << inputFileName << "'" << std::endl;
msg << "Output file name: '" << outputFileName << "'" << std::endl;
msg << "Periodic Table file name: '" << periodicTableFileName << "'" <<
std::endl;
msg << "Logging file name: '" << logFileName << "'" << std::endl;
msg << "Tersoff file name: '" << tersoffFileName << "'" << std::endl;
msg << "XYZ file name: '" << xyzFileName << "'" << std::endl;
msg << "Output preamble: '" << outputPreamble << "'" << std::endl;
msg << "Journal preamble: '" << journalPreamble << "'" << std::endl;
msg << "---------------------------------------" << std::endl;
msg << "Neighbor radius: " << neighborRadius << std::endl;
msg << "Neighbor layers: " << neighborLayers << std::endl;
msg << "Start index: " << startIndex << std::endl;
msg << "Stop index: " << stopIndex << std::endl;
msg << "MMC probability: " << mmcProbability << std::endl;
msg << "MMC run count: " << mmcRunCount << std::endl;
msg << "min. displacement: " << minDisplacement << std::endl;
msg << "max. displacement: " << maxDisplacement << std::endl;
msg << "Scaling probability: " << scalingProbability << std::endl;
msg << "min. scaling: " << minScaling << std::endl;
msg << "max. scaling: " << maxScaling << std::endl;
msg << "run count: " << runCount << std::endl;
msg << "check count: " << checkCount << std::endl;
msg << "energy drop factor: " << energyDropFactor << std::endl;
msg << "reduction factor: " << reductionFactor << std::endl;
msg << "minimal energy: " << minEnergy << std::endl;
msg << "anion passivation probability: " << anionPassivationProbability << std::endl;
msg << "require matching cation: " << requireMatchingCation << std::endl;
msg << "maximal parallel threads: " << maxThreadCount << std::endl;
msg << "---------------------------------------" << std::endl;
msg << "interface atoms: " << interfaceAtoms << std::endl;
msg << "interface positions: " << interfacePositions << std::endl;
msg << "---------------------------------------" << std::endl;
msg << "Render bonds: " << renderBonds << std::endl;
msg << "Visualize strain: " << visualizeBondStrain << std::endl;
msg << "Modified only: " << modifiedOnly << std::endl;
msg << "Filter modification state: ";
for (auto state: filterModificationState) {
msg << state;
if (state != filterModificationState.back())
msg << "|";
}
msg << std::endl;
msg << "Modified negative: " << modifiedNegative << std::endl;
msg << "Modification index max: " << modificationIndexMax << std::endl;
msg << "initial camera focal Point: " << cameraFocalPoint << std::endl;
msg << "initial camera direction: " << cameraDirection << std::endl;
msg << "initial camera zoom: " << cameraZoom << std::endl;
msg << "modification animation: " << modificationAnimation << std::endl;
msg << "animation step: " << animationStep << std::endl;
msg << "animation file prefix: " << animationFilePrefix << std::endl;
msg << "screenshot file name: " << screenshotFileName << std::endl;
msg << "rotation count: " << rotationCount << std::endl;
msg << "---------------------------------------" << std::endl;
msg << "Reference lattice constant: " << refLatticeConstant << std::endl;
msg << "Lattice temperature[K]: " << latticeTemperature << std::endl;
msg << "---------------------------------------" << std::endl;
msg << "Extend: " << extend << std::endl;
msg << "Calculate Energy: " << calculateEnergy << std::endl;
msg << "Quiet: " << quiet << std::endl;
msg << "Verbose: " << verbose << std::endl;
msg << "Print statistics: " << print << std::endl;
msg << "static optimization: " << staticOptimization << std::endl;
msg << "dynamic optimization: " << dynamicOptimization << std::endl
<< std::endl;
return msg.str();
}
// Local variables:
// mode: c++
// indent-tabs-mode: nil
// tab-width: 4
// End:
// vim:noexpandtab:sw=4:ts=4:
| 44.586498 | 89 | 0.605754 | [
"render"
] |
278803bd9f85240942fee19480c3201f136a7d43 | 5,134 | cpp | C++ | kohonen_network/main.cpp | Shimmen/NeuralNetworkStuff | f9058a7ce8aa9d1929083e974568795245304159 | [
"MIT"
] | null | null | null | kohonen_network/main.cpp | Shimmen/NeuralNetworkStuff | f9058a7ce8aa9d1929083e974568795245304159 | [
"MIT"
] | null | null | null | kohonen_network/main.cpp | Shimmen/NeuralNetworkStuff | f9058a7ce8aa9d1929083e974568795245304159 | [
"MIT"
] | null | null | null | #include <iostream>
#include <fstream>
#include <random>
#include <matrix.h>
#include "kohonen-network.h"
#define WITHOUT_NUMPY
#include <matplotlib-cpp/matplotlibcpp.h>
namespace plt = matplotlibcpp;
///////////////////////////////////////////////
// Input data
struct InputPoint
{
double x;
double y;
InputPoint(double x, double y) : x(x), y(y) {}
};
std::vector<InputPoint>
generate_input_data(const size_t count, std::default_random_engine& rng)
{
std::vector<InputPoint> points;
points.reserve(count);
std::uniform_real_distribution<double> random_double_zero_to_one(0.0, 1.0);
while (points.size() < count) {
double x1 = random_double_zero_to_one(rng);
double x2 = random_double_zero_to_one(rng);
if (x1 <= 0.5 || x2 >= 0.5) {
points.emplace_back(x1, x2);
}
}
return points;
}
///////////////////////////////////////////////
// Plotting
void
plot_network_and_training_data(const KohonenNetwork& network, const std::vector<InputPoint>& training_data)
{
const Matrix<double>& weights = network.get_weights();
assert(weights.width == 2); // must be able to be plotted in 2D!
// Plot network
std::vector<double> weight_x(weights.height);
std::vector<double> weight_y(weights.height);
for (size_t i = 0; i < weights.height; ++i) {
weight_x[i] = weights.get(i, 0);
weight_y[i] = weights.get(i, 1);
}
plt::named_plot("Weights", weight_x, weight_y, "bo-");
// Plot input data
size_t num_inputs = training_data.size();
std::vector<double> input_x(num_inputs);
std::vector<double> input_y(num_inputs);
for (size_t i = 0; i < num_inputs; ++i) {
auto& point = training_data[i];
input_x[i] = point.x;
input_y[i] = point.y;
}
plt::named_plot("Input data", input_x, input_y, "rx");
plt::grid(true);
plt::legend();
plt::xlabel("x1");
plt::ylabel("x2");
}
///////////////////////////////////////////////
// Test procedure
double
one_dimensional_neighbouring_function(size_t i, size_t i0, double gaussian_width)
{
// Since we have a 1D Kohonen network the neuron position we use is just its index
double dist_squared = (i - i0) * (i - i0);
return std::exp(-dist_squared / (2.0 * gaussian_width * gaussian_width));
}
int
main()
{
clock_t start_time = std::clock();
std::default_random_engine rng;
rng.seed(static_cast<unsigned int>(start_time));
const size_t TRAINING_DATA_SIZE = 1000;
const size_t ORDERING_PHASE_STEPS = 1000;
const size_t CONVERGENCE_PHASE_STEPS = 20000;
const auto& training_data = generate_input_data(TRAINING_DATA_SIZE, rng);
std::uniform_int_distribution<size_t> random_training_data_sample_index(0, TRAINING_DATA_SIZE - 1);
KohonenNetwork network(2, 100, one_dimensional_neighbouring_function);
network.reset_weights(-1.0, 1.0);
int next_plot_index = 1;
int num_plots = 2;
plt::plot();
// Debug plot of initial state
/*
{
num_plots = 3;
plt::subplot(1, num_plots, next_plot_index++);
plot_network_and_training_data(network, training_data);
plt::xlim(-1.1, 1.1);
plt::ylim(-1.1, 1.5);
}
*/
//
// Ordering phase
//
const double LEARNING_RATE_ZERO = 0.1;
const double GAUSSIAN_WIDTH_ZERO = 100.0;
const double TAU_SIGMA = 300.0;
for (size_t step = 0; step < ORDERING_PHASE_STEPS; ++step) {
// Calculate time-dependent parameters
auto t = static_cast<double>(step);
double learning_rate = LEARNING_RATE_ZERO * std::exp(-t / TAU_SIGMA);
double gaussian_width = GAUSSIAN_WIDTH_ZERO * std::exp(-t / TAU_SIGMA);
// Pick random sample to train on
size_t i = random_training_data_sample_index(rng);
auto& point = training_data[i];
network.train({point.x, point.y}, learning_rate, gaussian_width);
}
plt::subplot(1, num_plots, next_plot_index++);
plt::title("Network state after ordering phase");
plot_network_and_training_data(network, training_data);
plt::xlim(-0.1, 1.1);
plt::ylim(-0.1, 1.25);
//
// Convergence phase
//
const double LEARNING_RATE_CONVERGENCE = 0.01;
const double GAUSSIAN_WIDTH_CONVERGENCE = 0.9;
for (size_t step = 0; step < CONVERGENCE_PHASE_STEPS; ++step) {
// Pick random sample to train on
size_t i = random_training_data_sample_index(rng);
auto& point = training_data[i];
network.train({point.x, point.y}, LEARNING_RATE_CONVERGENCE, GAUSSIAN_WIDTH_CONVERGENCE);
}
plt::subplot(1, num_plots, next_plot_index++);
plt::title("Network state after convergence phase");
plot_network_and_training_data(network, training_data);
plt::xlim(-0.1, 1.1);
plt::ylim(-0.1, 1.25);
clock_t end_time = std::clock();
double time_elapsed_s = static_cast<double>(end_time - start_time) / CLOCKS_PER_SEC;
std::cout << "Time elapsed: " << time_elapsed_s << " s" << std::endl;
// Blocks, so perform timing before this call
plt::show();
return 0;
}
| 28.208791 | 107 | 0.637709 | [
"vector"
] |
2789baa06eb4bb36c6257d0f19ad7875ba6de8bb | 883 | cpp | C++ | src/read_crls.cpp | MTG-AG/cpt-native-lib-test | 3aedd6cc680840ecba0abeaf840c5234f8f52fbb | [
"Apache-2.0"
] | null | null | null | src/read_crls.cpp | MTG-AG/cpt-native-lib-test | 3aedd6cc680840ecba0abeaf840c5234f8f52fbb | [
"Apache-2.0"
] | null | null | null | src/read_crls.cpp | MTG-AG/cpt-native-lib-test | 3aedd6cc680840ecba0abeaf840c5234f8f52fbb | [
"Apache-2.0"
] | 1 | 2021-03-31T11:21:52.000Z | 2021-03-31T11:21:52.000Z | #include "read_crls.h"
#include "readdir.h"
#include "util.h"
#include "exceptn.h"
#include <iostream>
#include <string>
using namespace std;
crl_params_t read_crls_from_testcase_dir(std::string const& test_case_dir)
{
vector<string> crl_dir = get_entries_of_dir(test_case_dir, dir_entries_with_path, "crls");
if(crl_dir.size() > 1)
{
throw test_exceptn_t("multiple crl dirs, this should not happen");
}
crl_params_t result;
result.have_crls = (crl_dir.size() != 0);
if(result.have_crls)
{
vector<string> crl_paths = get_entries_of_dir(crl_dir[0], dir_entries_with_path, ".crl", false, ".pem.crl");
result.crl_data = file_contents_from_paths(crl_paths);
vector<string> crl_paths_pem = get_entries_of_dir(crl_dir[0], dir_entries_with_path, ".pem.crl");
result.crl_data_pem = file_contents_from_paths(crl_paths_pem);
}
return result;
}
| 28.483871 | 112 | 0.733862 | [
"vector"
] |
278c84878620687c8e985a0770fac57dcbc41aed | 10,917 | cpp | C++ | damc_server/ChannelStrip/DeviceOutputInstance.cpp | amurzeau/waveplay | e0fc097137138c4a6985998db502468074bf739f | [
"MIT"
] | 5 | 2021-10-02T03:01:56.000Z | 2022-01-24T20:59:19.000Z | damc_server/ChannelStrip/DeviceOutputInstance.cpp | amurzeau/waveplay | e0fc097137138c4a6985998db502468074bf739f | [
"MIT"
] | null | null | null | damc_server/ChannelStrip/DeviceOutputInstance.cpp | amurzeau/waveplay | e0fc097137138c4a6985998db502468074bf739f | [
"MIT"
] | null | null | null | #include "DeviceOutputInstance.h"
#include <spdlog/spdlog.h>
#include <stdio.h>
#ifdef _WIN32
#include <pa_win_wasapi.h>
#endif
DeviceOutputInstance::DeviceOutputInstance(OscContainer* parent)
: OscContainer(parent, "device"),
stream(nullptr),
oscDeviceName(this, "deviceName", "default_out"),
oscClockDrift(this, "clockDrift", 0.0f),
oscBufferSize(this, "bufferSize", 0),
oscActualBufferSize(this, "actualBufferSize", 0),
oscDeviceSampleRate(this, "deviceSampleRate", 48000),
oscExclusiveMode(this, "exclusiveMode", true),
deviceSampleRateMeasure(this, "realSampleRate") {
oscDeviceName.addCheckCallback([this](const std::string&) { return stream == nullptr; });
oscBufferSize.addCheckCallback([this](int newValue) { return stream == nullptr && newValue >= 0; });
oscDeviceSampleRate.addCheckCallback([this](int newValue) { return stream == nullptr && newValue > 0; });
oscDeviceSampleRate.addCheckCallback([this](int) { return stream == nullptr; });
oscExclusiveMode.addCheckCallback([this](int) { return stream == nullptr; });
oscClockDrift.addChangeCallback([this](float newValue) {
for(auto& resamplingFilter : resamplingFilters) {
resamplingFilter.setClockDrift(newValue);
}
});
oscDeviceSampleRate.addChangeCallback([this](float newValue) {
for(auto& resamplingFilter : resamplingFilters) {
resamplingFilter.setTargetSamplingRate(newValue);
}
});
}
DeviceOutputInstance::~DeviceOutputInstance() {
DeviceOutputInstance::stop();
}
std::vector<std::string> DeviceOutputInstance::getDeviceList() {
#ifdef _WIN32
PaWasapi_UpdateDeviceList();
#endif
std::vector<std::string> result;
int numDevices = Pa_GetDeviceCount();
result.push_back("default_in");
result.push_back("default_out");
for(int i = 0; i < numDevices; i++) {
const PaDeviceInfo* deviceInfo = Pa_GetDeviceInfo(i);
std::string name;
if(deviceInfo->name[0] == 0)
continue;
name = std::string(Pa_GetHostApiInfo(deviceInfo->hostApi)->name) + "::" + std::string(deviceInfo->name);
result.push_back(name);
}
if(numDevices > 0)
std::sort(result.begin() + 2, result.end());
return result;
}
int DeviceOutputInstance::getDeviceIndex(const std::string& name) {
int numDevices = Pa_GetDeviceCount();
if(name == "default_out") {
return Pa_GetDefaultOutputDevice();
}
for(int i = 0; i < numDevices; i++) {
const PaDeviceInfo* deviceInfo = Pa_GetDeviceInfo(i);
std::string devName;
devName = std::string(Pa_GetHostApiInfo(deviceInfo->hostApi)->name) + "::" + std::string(deviceInfo->name);
if(devName == name)
return i;
}
return -1;
}
void DeviceOutputInstance::stop() {
if(stream) {
Pa_StopStream(stream);
Pa_CloseStream(stream);
}
stream = nullptr;
}
const char* DeviceOutputInstance::getName() {
return "device";
}
int DeviceOutputInstance::start(int index, size_t numChannel, int sampleRate, int jackBufferSize) {
PaStreamParameters outputParameters;
int outputDeviceIndex;
stream = nullptr;
outputDeviceIndex = getDeviceIndex(oscDeviceName);
if(outputDeviceIndex < 0 || outputDeviceIndex >= Pa_GetDeviceCount()) {
SPDLOG_ERROR("Bad portaudio output device {}", oscDeviceName.get());
return paInvalidDevice;
}
int32_t bufferSize = (oscBufferSize.get() > 0)
? oscBufferSize
: Pa_GetDeviceInfo(outputDeviceIndex)->defaultLowOutputLatency * oscDeviceSampleRate + 0.5;
resampledBuffer.reserve(sampleRate);
resamplingFilters.resize(numChannel);
ringBuffers.clear();
for(size_t i = 0; i < numChannel; i++) {
std::unique_ptr<jack_ringbuffer_t, void (*)(jack_ringbuffer_t*)> buffer(nullptr, &jack_ringbuffer_free);
buffer.reset(jack_ringbuffer_create((jackBufferSize + bufferSize * sampleRate / oscDeviceSampleRate) * 3 *
sizeof(jack_default_audio_sample_t)));
ringBuffers.emplace_back(std::move(buffer));
resamplingFilters[i].reset(sampleRate);
resamplingFilters[i].setTargetSamplingRate(oscDeviceSampleRate);
resamplingFilters[i].setClockDrift(oscClockDrift);
}
outputParameters.device = outputDeviceIndex;
outputParameters.channelCount = numChannel;
outputParameters.sampleFormat = paFloat32 | paNonInterleaved; // 32 bit floating point output
outputParameters.suggestedLatency = 1.0 * bufferSize / oscDeviceSampleRate;
outputParameters.hostApiSpecificStreamInfo = NULL;
#ifdef _WIN32
struct PaWasapiStreamInfo wasapiInfo = {};
if(oscExclusiveMode && Pa_GetHostApiInfo(Pa_GetDeviceInfo(outputDeviceIndex)->hostApi)->type == paWASAPI) {
wasapiInfo.size = sizeof(PaWasapiStreamInfo);
wasapiInfo.hostApiType = paWASAPI;
wasapiInfo.version = 1;
wasapiInfo.flags = paWinWasapiExclusive;
wasapiInfo.channelMask = 0;
wasapiInfo.hostProcessorOutput = nullptr;
wasapiInfo.hostProcessorInput = nullptr;
wasapiInfo.threadPriority = eThreadPriorityNone;
outputParameters.hostApiSpecificStreamInfo = &wasapiInfo;
SPDLOG_INFO("Using exclusive mode\n");
}
#endif
int ret = Pa_OpenStream(&stream,
nullptr,
&outputParameters,
oscDeviceSampleRate,
paFramesPerBufferUnspecified,
paClipOff | paDitherOff,
&renderCallback,
this);
if(ret != paNoError) {
SPDLOG_ERROR("Portaudio open error: {}({}), device: {}::{}",
Pa_GetErrorText(ret),
ret,
Pa_GetHostApiInfo(Pa_GetDeviceInfo(outputDeviceIndex)->hostApi)->name,
Pa_GetDeviceInfo(outputDeviceIndex)->name);
return ret;
}
SPDLOG_INFO("Using output device {} {}, {} with latency {}",
outputDeviceIndex,
Pa_GetHostApiInfo(Pa_GetDeviceInfo(outputDeviceIndex)->hostApi)->name,
Pa_GetDeviceInfo(outputDeviceIndex)->name,
Pa_GetStreamInfo(stream)->outputLatency);
bufferLatencyMeasurePeriodSize = 60 * sampleRate / jackBufferSize;
bufferLatencyNr = 0;
bufferLatencyHistory.clear();
bufferLatencyHistory.reserve(bufferLatencyMeasurePeriodSize);
previousAverageLatency = 0;
clockDriftPpm = 0;
isPaRunning = false;
oscActualBufferSize = Pa_GetStreamInfo(stream)->outputLatency * oscDeviceSampleRate + 0.5;
SPDLOG_INFO("Using buffer size {}, device sample rate: {}", oscActualBufferSize.get(), oscDeviceSampleRate.get());
Pa_StartStream(stream);
return ret;
}
int DeviceOutputInstance::postProcessSamples(float** samples, size_t numChannel, uint32_t nframes) {
if(!stream)
return 0;
for(size_t i = 0; i < numChannel; i++) {
size_t dataSize;
resamplingFilters[i].processSamples(resampledBuffer, samples[i], nframes);
dataSize = resampledBuffer.size() * sizeof(resampledBuffer[0]);
size_t availableData = jack_ringbuffer_write_space(ringBuffers[i].get());
if(dataSize < availableData) {
jack_ringbuffer_write(ringBuffers[i].get(), (const char*) resampledBuffer.data(), dataSize);
} else {
overflowOccured = true;
overflowSize = availableData;
}
}
// jack_nframes_t current_frames;
// jack_time_t current_usecs;
// jack_time_t next_usecs;
// float period_usecs;
// jack_nframes_t call_frames;
// jack_time_t call_time_time;
// getLiveFrameTime(¤t_frames, ¤t_usecs, &next_usecs, &period_usecs, &call_frames, &call_time_time);
// long available = Pa_GetStreamWriteAvailable(stream);
// currentJackTime = (call_time_time - current_usecs) / 1000000.0;
// const PaStreamInfo* streamInfo = Pa_GetStreamInfo(stream);
// currentPaTime =
// currentJackTime + streamInfo->outputLatency - available / 48000.0 / resamplingFilters[0].getClockDrift();
return 0;
}
int DeviceOutputInstance::renderCallback(const void* input,
void* output,
unsigned long frameCount,
const PaStreamCallbackTimeInfo* timeInfo,
PaStreamCallbackFlags statusFlags,
void* userData) {
DeviceOutputInstance* thisInstance = (DeviceOutputInstance*) userData;
jack_default_audio_sample_t** outputBuffers = (jack_default_audio_sample_t**) output;
bool underflowOccured = false;
size_t availableData = 0;
thisInstance->isPaRunning = true;
thisInstance->deviceSampleRateMeasure.notifySampleProcessed(frameCount);
for(size_t i = 0; i < thisInstance->ringBuffers.size(); i++) {
availableData = jack_ringbuffer_read_space(thisInstance->ringBuffers[i].get());
if(availableData >= frameCount * sizeof(outputBuffers[i][0])) {
jack_ringbuffer_read(
thisInstance->ringBuffers[i].get(), (char*) outputBuffers[i], frameCount * sizeof(outputBuffers[i][0]));
} else {
memset(reinterpret_cast<char*>(outputBuffers[i]), 0, frameCount * sizeof(outputBuffers[i][0]));
underflowOccured = true;
thisInstance->underflowSize = availableData;
}
}
if(underflowOccured) {
thisInstance->underflowOccured = true;
thisInstance->bufferLatencyHistory.clear();
} else if(availableData) {
thisInstance->bufferLatencyHistory.push_back(availableData / sizeof(jack_default_audio_sample_t));
if(thisInstance->bufferLatencyHistory.size() == thisInstance->bufferLatencyMeasurePeriodSize) {
double averageLatency = 0;
for(auto value : thisInstance->bufferLatencyHistory) {
averageLatency += value;
}
averageLatency /= thisInstance->bufferLatencyHistory.size();
thisInstance->bufferLatencyHistory.clear();
if(thisInstance->previousAverageLatency != 0) {
double sampleLatencyDiffOver1s = averageLatency - thisInstance->previousAverageLatency;
double sampleMeasureDuration = thisInstance->bufferLatencyMeasurePeriodSize * frameCount;
// Ignore drift of more than 0.1%
// if(sampleLatencyDiffOver1s > (-sampleMeasureDuration / 1000) &&
// sampleLatencyDiffOver1s < (sampleMeasureDuration / 1000)) {
thisInstance->clockDriftPpm = 1000000.0 * sampleLatencyDiffOver1s / sampleMeasureDuration;
// }
}
thisInstance->previousAverageLatency = averageLatency;
}
}
return paContinue;
}
void DeviceOutputInstance::onFastTimer() {
if(overflowOccured) {
SPDLOG_WARN("{}: Overflow: {}, {}", oscDeviceName.get(), bufferLatencyNr, overflowSize);
overflowOccured = false;
}
if(underflowOccured) {
SPDLOG_WARN("{}: underrun: {}, {}", oscDeviceName.get(), bufferLatencyNr, underflowSize);
underflowOccured = false;
}
if(clockDriftPpm) {
SPDLOG_INFO("{}: average latency: {}", oscDeviceName.get(), previousAverageLatency);
SPDLOG_INFO("{}: drift: {}", oscDeviceName.get(), clockDriftPpm);
clockDriftPpm = 0;
}
}
void DeviceOutputInstance::onSlowTimer() {
if(!isPaRunning) {
SPDLOG_WARN("{}: portaudio not running !", oscDeviceName.get());
} else {
isPaRunning = false;
}
deviceSampleRateMeasure.onTimeoutTimer();
}
| 34.547468 | 117 | 0.70862 | [
"vector"
] |
278ca8100c55ecdf108aa9b45ae622a435f811d9 | 2,005 | cpp | C++ | VoiceBridge/VoiceBridge/kaldi-win/scr/steps/scoring/score_kaldi_cer.cpp | sanyaade-teachings/VoiceBridge | 348b0931f2bfaf33b7e0d18c68c50f448ab3de5c | [
"Apache-2.0"
] | 18 | 2018-02-15T03:14:32.000Z | 2021-07-06T08:21:13.000Z | VoiceBridge/VoiceBridge/kaldi-win/scr/steps/scoring/score_kaldi_cer.cpp | sanyaade-teachings/VoiceBridge | 348b0931f2bfaf33b7e0d18c68c50f448ab3de5c | [
"Apache-2.0"
] | 3 | 2020-10-25T16:35:55.000Z | 2020-10-26T04:59:46.000Z | VoiceBridge/VoiceBridge/kaldi-win/scr/steps/scoring/score_kaldi_cer.cpp | sanyaade-teachings/VoiceBridge | 348b0931f2bfaf33b7e0d18c68c50f448ab3de5c | [
"Apache-2.0"
] | 7 | 2018-09-16T20:40:17.000Z | 2021-07-06T08:21:14.000Z | /*
Copyright 2017-present Zoltan Somogyi (AI-TOOLKIT), All Rights Reserved
You may use this file only if you agree to the software license:
AI-TOOLKIT Open Source Software License - Version 2.1 - February 22, 2018:
https://ai-toolkit.blogspot.com/p/ai-toolkit-open-source-software-license.html.
Also included with the source code distribution in AI-TOOLKIT-LICENSE.txt.
Based on : Copyright 2012-2014 Johns Hopkins University (Author: Daniel Povey, Yenda Trmal), Apache 2.0.
*/
#include "kaldi-win/scr/kaldi_scr.h"
#include "kaldi-win/src/kaldi_src.h"
#include <kaldi-win/utility/strvec2arg.h>
/*
Computes the CER (Character Error Rate)
NOTE: when run both WER and CER then call WER first and then CER with stage=2, in this way the
the lattice decoding won't be run twice.
*/
int ScoreKaldiCER(
fs::path data, //data directory <data-dir>
fs::path lang_or_graph, //language or graph directory <lang-dir|graph-dir>
fs::path dir, //decode directory <decode-dir>
UMAPSS wer_ref_filter, //for filtering the text; contains a 'key' which is a regex and the result will be replaced in the input text with the 'value' property in the map
UMAPSS wer_hyp_filter, //for filtering the text; contains a 'key' which is a regex and the result will be replaced in the input text with the 'value' property in the map
int nj, //
int stage, //= 0 //start scoring script from part-way through.
bool decode_mbr, //= false //maximum bayes risk decoding (confusion network).
bool stats, // = true //output statistics
double beam, // = 6 //Pruning beam [applied after acoustic scaling]
std::string word_ins_penalty, // = 0.0, 0.5, 1.0 //word insertion penalty
int min_lmwt, // = 7 //minumum LM-weight for lattice rescoring
int max_lmwt, // = 17 //maximum LM-weight for lattice rescoring
std::string iter // = final //which model to use; default final.mdl
)
{
//TODO:...
return 0;
}
| 45.568182 | 178 | 0.693267 | [
"model"
] |
2792cb962a5aa3ce3bdb937d4ade66b3206c143e | 4,085 | cpp | C++ | foedus_code/tests-core/src/foedus/thread/test_rendezvous.cpp | sam1016yu/cicada-exp-sigmod2017 | 64e582370076b2923d37b279d1c32730babc15f8 | [
"Apache-2.0"
] | null | null | null | foedus_code/tests-core/src/foedus/thread/test_rendezvous.cpp | sam1016yu/cicada-exp-sigmod2017 | 64e582370076b2923d37b279d1c32730babc15f8 | [
"Apache-2.0"
] | null | null | null | foedus_code/tests-core/src/foedus/thread/test_rendezvous.cpp | sam1016yu/cicada-exp-sigmod2017 | 64e582370076b2923d37b279d1c32730babc15f8 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
* 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* HP designates this particular file as subject to the "Classpath" exception
* as provided by HP in the LICENSE.txt file that accompanied this code.
*/
#include <valgrind.h>
#include <gtest/gtest.h>
#include <atomic>
#include <chrono>
#include <thread>
#include <vector>
#include "foedus/test_common.hpp"
#include "foedus/thread/rendezvous_impl.hpp"
/**
* @file test_rendezvous.cpp
* Testcases for foedus::thread::Rendezvous.
*/
namespace foedus {
namespace thread {
DEFINE_TEST_CASE_PACKAGE(RendezvousTest, foedus.thread);
TEST(RendezvousTest, Instantiate) {
Rendezvous rendezvous;
}
TEST(RendezvousTest, Signal) {
Rendezvous rendezvous;
EXPECT_FALSE(rendezvous.is_signaled_weak());
EXPECT_FALSE(rendezvous.is_signaled());
rendezvous.signal();
EXPECT_TRUE(rendezvous.is_signaled());
EXPECT_TRUE(rendezvous.is_signaled_weak());
}
TEST(RendezvousTest, Simple) {
Rendezvous rendezvous;
std::atomic<bool> ends(false);
// I don't like [=] it's a bit handwavy syntax.
std::thread another([](Rendezvous *rendezvous_, std::atomic<bool> *ends_){
rendezvous_->wait();
ends_->store(true);
}, &rendezvous, &ends);
std::this_thread::sleep_for(std::chrono::milliseconds(10));
EXPECT_FALSE(rendezvous.is_signaled_weak());
EXPECT_FALSE(rendezvous.is_signaled());
EXPECT_FALSE(ends.load());
rendezvous.signal();
EXPECT_TRUE(rendezvous.is_signaled());
EXPECT_TRUE(rendezvous.is_signaled_weak());
std::this_thread::sleep_for(std::chrono::milliseconds(10));
EXPECT_TRUE(ends.load());
another.join();
}
const int kRep = 100; // 300; otherwise this test case takes really long time depending on #cores.
const int kClients = 4;
std::vector<Rendezvous*> many_rendezvous;
std::vector< std::atomic<int>* > many_ends;
void many_thread() {
for (int i = 0; i < kRep; ++i) {
many_rendezvous[i]->wait();
EXPECT_TRUE(many_rendezvous[i]->is_signaled());
int added = ++(*many_ends[i]);
if (added == kClients) {
delete many_rendezvous[i];
}
}
}
TEST(RendezvousTest, Many) {
if (RUNNING_ON_VALGRIND) {
std::cout << "This test seems to take too long time on valgrind."
<< " There is nothing interesting in this test to run on valgrind, so"
<< " we simply skip this test." << std::endl;
return;
}
// This tests 1) spurious wake up, 2) lost signal (spurious blocking), 3) and other anomalies.
for (int i = 0; i < kRep; ++i) {
many_rendezvous.push_back(new Rendezvous());
many_ends.push_back(new std::atomic<int>(0));
}
std::vector<std::thread> clients;
for (int i = 0; i < kClients; ++i) {
clients.emplace_back(std::thread(&many_thread));
}
std::this_thread::sleep_for(std::chrono::milliseconds(10));
for (int i = 0; i < kRep; ++i) {
EXPECT_EQ(0, many_ends[i]->load());
}
for (int i = 0; i < kRep; ++i) {
EXPECT_EQ(0, many_ends[i]->load());
many_rendezvous[i]->signal();
if (i % 3 == 0) {
std::this_thread::sleep_for(std::chrono::microseconds(10));
}
}
for (int i = 0; i < kClients; ++i) {
clients[i].join();
}
for (int i = 0; i < kRep; ++i) {
EXPECT_EQ(kClients, many_ends[i]->load());
delete many_ends[i];
}
}
} // namespace thread
} // namespace foedus
TEST_MAIN_CAPTURE_SIGNALS(RendezvousTest, foedus.thread);
| 30.259259 | 100 | 0.687882 | [
"vector"
] |
2796dd01c912a08b52084e90867b0679e0bedfb4 | 5,813 | cpp | C++ | DX11/src/GameEngine/GraphicsEngine/RenderSystem/RenderSystem.cpp | dtrajko/HazelGameEngineSeries | 7210151d6422078ced080be9b8886e9a1ad79d7a | [
"Apache-2.0"
] | null | null | null | DX11/src/GameEngine/GraphicsEngine/RenderSystem/RenderSystem.cpp | dtrajko/HazelGameEngineSeries | 7210151d6422078ced080be9b8886e9a1ad79d7a | [
"Apache-2.0"
] | null | null | null | DX11/src/GameEngine/GraphicsEngine/RenderSystem/RenderSystem.cpp | dtrajko/HazelGameEngineSeries | 7210151d6422078ced080be9b8886e9a1ad79d7a | [
"Apache-2.0"
] | null | null | null | // Copyright (c) 2019 PardCode.
// All rights reserved.
//
// This file is part of CPP-3D-Game-Tutorial-Series Project, accessible from https://github.com/PardCode/CPP-3D-Game-Tutorial-Series
// You can redistribute it and/or modify it under the terms of the GNU
// General Public License
//
// This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
// WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
#include "RenderSystem.h"
#include "../../GraphicsEngine/RenderSystem/SwapChain/SwapChain.h"
#include "../../GraphicsEngine/RenderSystem/DeviceContext/DeviceContext.h"
#include "../../GraphicsEngine/RenderSystem/VertexBuffer/VertexBuffer.h"
#include "../../GraphicsEngine/RenderSystem/IndexBuffer/IndexBuffer.h"
#include "../../GraphicsEngine/RenderSystem/ConstantBuffer/ConstantBuffer.h"
#include "../../GraphicsEngine/RenderSystem/VertexShader/VertexShader.h"
#include "../../GraphicsEngine/RenderSystem/PixelShader/PixelShader.h"
#include <d3d11.h>
#include <d3dcompiler.h>
#include <exception>
#include <iostream>
RenderSystem::RenderSystem()
{
D3D_DRIVER_TYPE driver_types[] =
{
D3D_DRIVER_TYPE_HARDWARE,
D3D_DRIVER_TYPE_WARP,
D3D_DRIVER_TYPE_REFERENCE
};
UINT num_driver_types = ARRAYSIZE(driver_types);
D3D_FEATURE_LEVEL feature_levels[] =
{
D3D_FEATURE_LEVEL_11_0
};
UINT num_feature_levels = ARRAYSIZE(feature_levels);
HRESULT res = 0;
for (UINT driver_type_index = 0; driver_type_index < num_driver_types;)
{
res = D3D11CreateDevice(NULL, driver_types[driver_type_index], NULL, NULL, feature_levels, num_feature_levels,
D3D11_SDK_VERSION, &m_d3d_device, &m_feature_level, &m_imm_context);
if (SUCCEEDED(res))
{
break;
++driver_type_index;
}
}
if (FAILED(res))
{
throw std::exception("RenderSystem: D3D11CreateDevice failed.");
}
m_imm_device_context = new DeviceContext(m_imm_context, this);
m_d3d_device->QueryInterface(__uuidof(IDXGIDevice), (void**)&m_dxgi_device);
m_dxgi_device->GetParent(__uuidof(IDXGIAdapter), (void**)&m_dxgi_adapter);
m_dxgi_adapter->GetParent(__uuidof(IDXGIFactory), (void**)&m_dxgi_factory);
DXGI_ADAPTER_DESC adapterDescription;
m_dxgi_adapter->GetDesc(&adapterDescription);
std::cout << "DirectX 11 Info:" << std::endl;
std::cout << " Vendor: " << adapterDescription.VendorId << std::endl;
std::cout << " Renderer: " << adapterDescription.Description << std::endl;
std::cout << " Version: " << adapterDescription.Revision << std::endl;
}
SwapChain* RenderSystem::createSwapChain(HWND hwnd, UINT width, UINT height)
{
SwapChain* sc = nullptr;
try
{
sc = new SwapChain(hwnd, width, height, this);
}
catch (const std::exception&)
{
throw std::exception("SwapChain initialization failed.");
}
return sc;
}
DeviceContext* RenderSystem::getImmediateDeviceContext()
{
return this->m_imm_device_context;
}
VertexBuffer* RenderSystem::createVertexBuffer(void* list_vertices, UINT size_vertex, UINT size_list, void* shader_byte_code, UINT size_byte_shader)
{
VertexBuffer * vb = nullptr;
try
{
vb = new VertexBuffer(list_vertices, size_vertex, size_list, shader_byte_code, size_byte_shader, this);
}
catch (const std::exception&)
{
throw std::exception("VertexBuffer initialization failed.");
}
return vb;
}
IndexBuffer* RenderSystem::createIndexBuffer(void* list_indices, UINT size_list)
{
IndexBuffer* ib = nullptr;
try
{
ib = new IndexBuffer(list_indices, size_list, this);
}
catch (const std::exception&)
{
throw std::exception("IndexBuffer initialization failed.");
}
return ib;
}
ConstantBuffer* RenderSystem::createConstantBuffer(void* buffer, UINT size_buffer)
{
ConstantBuffer* cb = nullptr;
try
{
cb = new ConstantBuffer(buffer, size_buffer, this);
}
catch (const std::exception&)
{
throw std::exception("ConstantBuffer initialization failed.");
}
return cb;
}
VertexShader* RenderSystem::createVertexShader(const void* shader_byte_code, size_t byte_code_size)
{
VertexShader* vs = nullptr;
try
{
vs = new VertexShader(shader_byte_code, byte_code_size, this);
}
catch (const std::exception&)
{
throw std::exception("VertexShader initialization failed.");
}
return vs;
}
PixelShader* RenderSystem::createPixelShader(const void* shader_byte_code, size_t byte_code_size)
{
PixelShader* ps = nullptr;
try
{
ps = new PixelShader(shader_byte_code, byte_code_size, this);
}
catch (const std::exception&)
{
throw std::exception("PixelShader initialization failed.");
}
return ps;
}
bool RenderSystem::compileVertexShader(const wchar_t* file_name, const char* entry_point_name, void** shader_byte_code, UINT* byte_code_size)
{
ID3DBlob* error_blob = nullptr;
HRESULT hr = D3DCompileFromFile(file_name, nullptr, nullptr, entry_point_name, "vs_5_0", 0, 0, &m_blob, &error_blob);
if (FAILED(hr))
{
if (error_blob) error_blob->Release();
return false;
}
*shader_byte_code = m_blob->GetBufferPointer();
*byte_code_size = (UINT)m_blob->GetBufferSize();
return true;
}
bool RenderSystem::compilePixelShader(const wchar_t* file_name, const char* entry_point_name, void** shader_byte_code, UINT* byte_code_size)
{
ID3DBlob* error_blob = nullptr;
HRESULT hr = D3DCompileFromFile(file_name, nullptr, nullptr, entry_point_name, "ps_5_0", 0, 0, &m_blob, &error_blob);
if (FAILED(hr))
{
if (error_blob) error_blob->Release();
return false;
}
*shader_byte_code = m_blob->GetBufferPointer();
*byte_code_size = (UINT)m_blob->GetBufferSize();
return true;
}
void RenderSystem::releaseCompiledShader()
{
if (m_blob) m_blob->Release();
}
void RenderSystem::release()
{
m_dxgi_device->Release();
m_dxgi_factory->Release();
m_dxgi_adapter->Release();
m_d3d_device->Release();
m_imm_context->Release();
}
RenderSystem::~RenderSystem()
{
delete m_imm_device_context;
}
| 27.037209 | 148 | 0.747291 | [
"3d"
] |
279823e21c319ef593cba9e87052eae83ceadd7f | 13,589 | cc | C++ | L1Trigger/L1TNtuples/src/L1AnalysisPhaseIIStep1.cc | vshang/cmssw | 9f24a9ca36825fe2c1abe5f058c7982e24fe3a69 | [
"Apache-2.0"
] | 1 | 2019-08-01T15:24:15.000Z | 2019-08-01T15:24:15.000Z | L1Trigger/L1TNtuples/src/L1AnalysisPhaseIIStep1.cc | vshang/cmssw | 9f24a9ca36825fe2c1abe5f058c7982e24fe3a69 | [
"Apache-2.0"
] | null | null | null | L1Trigger/L1TNtuples/src/L1AnalysisPhaseIIStep1.cc | vshang/cmssw | 9f24a9ca36825fe2c1abe5f058c7982e24fe3a69 | [
"Apache-2.0"
] | null | null | null | //This code is for filling the step1 menu objects, for full tree go for L1AnalysisPhaseII.c
#include "L1Trigger/L1TNtuples/interface/L1AnalysisPhaseIIStep1.h"
#include "L1Trigger/L1TMuon/interface/MicroGMTConfiguration.h"
L1Analysis::L1AnalysisPhaseIIStep1::L1AnalysisPhaseIIStep1() {}
L1Analysis::L1AnalysisPhaseIIStep1::~L1AnalysisPhaseIIStep1() {}
void L1Analysis::L1AnalysisPhaseIIStep1::SetVertices(
float z0Puppi, const edm::Handle<std::vector<l1t::TkPrimaryVertex> > TkPrimaryVertex) {
l1extra_.z0Puppi = z0Puppi;
for (unsigned int i = 0; i < TkPrimaryVertex->size(); i++) {
l1extra_.z0L1TkPV.push_back(TkPrimaryVertex->at(i).zvertex());
l1extra_.sumL1TkPV.push_back(TkPrimaryVertex->at(i).sum());
l1extra_.nL1TkPVs++;
}
}
void L1Analysis::L1AnalysisPhaseIIStep1::SetCaloTau(const edm::Handle<l1t::TauBxCollection> calotau,
unsigned maxL1Extra) {
for (int ibx = calotau->getFirstBX(); ibx <= calotau->getLastBX(); ++ibx) {
for (l1t::TauBxCollection::const_iterator it = calotau->begin(ibx);
it != calotau->end(ibx) && l1extra_.nCaloTaus < maxL1Extra;
it++) {
if (it->pt() > 0) {
l1extra_.caloTauEt.push_back(it->et());
l1extra_.caloTauEta.push_back(it->eta());
l1extra_.caloTauPhi.push_back(it->phi());
l1extra_.caloTauIEt.push_back(it->hwPt());
l1extra_.caloTauIEta.push_back(it->hwEta());
l1extra_.caloTauIPhi.push_back(it->hwPhi());
l1extra_.caloTauIso.push_back(it->hwIso());
l1extra_.caloTauBx.push_back(ibx);
l1extra_.caloTauTowerIPhi.push_back(it->towerIPhi());
l1extra_.caloTauTowerIEta.push_back(it->towerIEta());
l1extra_.caloTauRawEt.push_back(it->rawEt());
l1extra_.caloTauIsoEt.push_back(it->isoEt());
l1extra_.caloTauNTT.push_back(it->nTT());
l1extra_.caloTauHasEM.push_back(it->hasEM());
l1extra_.caloTauIsMerged.push_back(it->isMerged());
l1extra_.caloTauHwQual.push_back(it->hwQual());
l1extra_.nCaloTaus++;
}
}
}
}
//EG (seeded by Phase 2 Objects )
void L1Analysis::L1AnalysisPhaseIIStep1::SetEG(const edm::Handle<l1t::EGammaBxCollection> EG,
const edm::Handle<l1t::EGammaBxCollection> EGHGC,
unsigned maxL1Extra) {
for (l1t::EGammaBxCollection::const_iterator it = EG->begin(); it != EG->end() && l1extra_.nEG < maxL1Extra; it++) {
if (it->et() > 5) {
l1extra_.EGEt.push_back(it->et());
l1extra_.EGEta.push_back(it->eta());
l1extra_.EGPhi.push_back(it->phi());
l1extra_.EGIso.push_back(it->isoEt());
l1extra_.EGHwQual.push_back(it->hwQual());
l1extra_.EGBx.push_back(0); //it->bx());
l1extra_.EGHGC.push_back(0);
bool quality = ((it->hwQual() >> 1) & 1) > 0;
l1extra_.EGPassesLooseTrackID.push_back(quality);
quality = ((it->hwQual() >> 2) & 1) > 0;
l1extra_.EGPassesPhotonID.push_back(quality);
l1extra_.nEG++;
}
}
for (l1t::EGammaBxCollection::const_iterator it = EGHGC->begin(); it != EGHGC->end() && l1extra_.nEG < maxL1Extra;
it++) {
if (it->et() > 5) {
l1extra_.EGEt.push_back(it->et());
l1extra_.EGEta.push_back(it->eta());
l1extra_.EGPhi.push_back(it->phi());
l1extra_.EGIso.push_back(it->isoEt());
l1extra_.EGHwQual.push_back(it->hwQual());
l1extra_.EGBx.push_back(0); //it->bx());
l1extra_.EGHGC.push_back(1);
bool quality = (it->hwQual() == 5);
l1extra_.EGPassesLooseTrackID.push_back(quality);
l1extra_.EGPassesPhotonID.push_back(quality);
l1extra_.nEG++;
}
}
}
// TrkEG (seeded by Phase 2 Objects)
void L1Analysis::L1AnalysisPhaseIIStep1::SetTkEG(const edm::Handle<l1t::TkElectronCollection> tkElectron,
const edm::Handle<l1t::TkElectronCollection> tkElectronHGC,
unsigned maxL1Extra) {
for (l1t::TkElectronCollection::const_iterator it = tkElectron->begin();
it != tkElectron->end() && l1extra_.nTkElectrons < maxL1Extra;
it++) {
if (it->et() > 5) {
l1extra_.tkElectronEt.push_back(it->et());
l1extra_.tkElectronEta.push_back(it->eta());
l1extra_.tkElectronPhi.push_back(it->phi());
int chargeFromCurvature = (it->trackCurvature() > 0) ? 1 : -1; // ThisIsACheck
l1extra_.tkElectronChg.push_back(chargeFromCurvature);
l1extra_.tkElectronzVtx.push_back(it->trkzVtx());
l1extra_.tkElectronTrkIso.push_back(it->trkIsol());
l1extra_.tkElectronHwQual.push_back(it->EGRef()->hwQual());
l1extra_.tkElectronEGRefPt.push_back(it->EGRef()->et());
l1extra_.tkElectronEGRefEta.push_back(it->EGRef()->eta());
l1extra_.tkElectronEGRefPhi.push_back(it->EGRef()->phi());
l1extra_.tkElectronBx.push_back(0); //it->bx());
l1extra_.tkElectronHGC.push_back(0);
bool quality = ((it->EGRef()->hwQual() >> 1) & 1) > 0; // LooseTrackID should be the second bit
l1extra_.tkElectronPassesLooseTrackID.push_back(quality);
quality = ((it->EGRef()->hwQual() >> 2) & 1) > 0; // LooseTrackID should be the second bit
l1extra_.tkElectronPassesPhotonID.push_back(quality);
l1extra_.nTkElectrons++;
}
}
for (l1t::TkElectronCollection::const_iterator it = tkElectronHGC->begin();
it != tkElectronHGC->end() && l1extra_.nTkElectrons < maxL1Extra;
it++) {
if (it->et() > 5) {
l1extra_.tkElectronEt.push_back(it->et());
l1extra_.tkElectronEta.push_back(it->eta());
l1extra_.tkElectronPhi.push_back(it->phi());
int chargeFromCurvature = (it->trackCurvature() > 0) ? 1 : -1; // ThisIsACheck
l1extra_.tkElectronChg.push_back(chargeFromCurvature);
l1extra_.tkElectronzVtx.push_back(it->trkzVtx());
l1extra_.tkElectronTrkIso.push_back(it->trkIsol());
l1extra_.tkElectronHwQual.push_back(it->EGRef()->hwQual());
l1extra_.tkElectronEGRefPt.push_back(it->EGRef()->et());
l1extra_.tkElectronEGRefEta.push_back(it->EGRef()->eta());
l1extra_.tkElectronEGRefPhi.push_back(it->EGRef()->phi());
l1extra_.tkElectronBx.push_back(0); //it->bx());
l1extra_.tkElectronHGC.push_back(1);
bool quality = (it->EGRef()->hwQual() == 5);
l1extra_.tkElectronPassesLooseTrackID.push_back(quality);
l1extra_.tkElectronPassesPhotonID.push_back(quality);
l1extra_.nTkElectrons++;
}
}
}
void L1Analysis::L1AnalysisPhaseIIStep1::SetTkEM(const edm::Handle<l1t::TkEmCollection> tkPhoton,
const edm::Handle<l1t::TkEmCollection> tkPhotonHGC,
unsigned maxL1Extra) {
for (l1t::TkEmCollection::const_iterator it = tkPhoton->begin();
it != tkPhoton->end() && l1extra_.nTkPhotons < maxL1Extra;
it++) {
if (it->et() > 5) {
l1extra_.tkPhotonEt.push_back(it->et());
l1extra_.tkPhotonEta.push_back(it->eta());
l1extra_.tkPhotonPhi.push_back(it->phi());
l1extra_.tkPhotonTrkIso.push_back(it->trkIsol());
l1extra_.tkPhotonTrkIsoPV.push_back(it->trkIsolPV());
l1extra_.tkPhotonBx.push_back(0); //it->bx());
l1extra_.tkPhotonHwQual.push_back(it->EGRef()->hwQual());
l1extra_.tkPhotonEGRefPt.push_back(it->EGRef()->et());
l1extra_.tkPhotonEGRefEta.push_back(it->EGRef()->eta());
l1extra_.tkPhotonEGRefPhi.push_back(it->EGRef()->phi());
l1extra_.tkPhotonHGC.push_back(0);
bool quality = ((it->EGRef()->hwQual() >> 1) & 1) > 0;
l1extra_.tkPhotonPassesLooseTrackID.push_back(quality);
quality = ((it->EGRef()->hwQual() >> 2) & 1) > 0; // Photon Id should be the third bit
l1extra_.tkPhotonPassesPhotonID.push_back(quality);
l1extra_.nTkPhotons++;
}
}
for (l1t::TkEmCollection::const_iterator it = tkPhotonHGC->begin();
it != tkPhotonHGC->end() && l1extra_.nTkPhotons < maxL1Extra;
it++) {
if (it->et() > 5) {
l1extra_.tkPhotonEt.push_back(it->et());
l1extra_.tkPhotonEta.push_back(it->eta());
l1extra_.tkPhotonPhi.push_back(it->phi());
l1extra_.tkPhotonTrkIso.push_back(it->trkIsol());
l1extra_.tkPhotonTrkIsoPV.push_back(it->trkIsolPV());
l1extra_.tkPhotonBx.push_back(0); //it->bx());
l1extra_.tkPhotonHwQual.push_back(it->EGRef()->hwQual());
l1extra_.tkPhotonEGRefPt.push_back(it->EGRef()->et());
l1extra_.tkPhotonEGRefEta.push_back(it->EGRef()->eta());
l1extra_.tkPhotonEGRefPhi.push_back(it->EGRef()->phi());
l1extra_.tkPhotonHGC.push_back(1);
bool quality = (it->EGRef()->hwQual() == 5);
l1extra_.tkPhotonPassesLooseTrackID.push_back(quality);
l1extra_.tkPhotonPassesPhotonID.push_back(quality);
l1extra_.nTkPhotons++;
}
}
}
void L1Analysis::L1AnalysisPhaseIIStep1::SetTkMuon(const edm::Handle<l1t::TkMuonCollection> muon, unsigned maxL1Extra) {
for (l1t::TkMuonCollection::const_iterator it = muon->begin(); it != muon->end() && l1extra_.nTkMuons < maxL1Extra;
it++) {
l1extra_.tkMuonPt.push_back(it->pt());
l1extra_.tkMuonEta.push_back(it->eta());
l1extra_.tkMuonPhi.push_back(it->phi());
int chargeFromCurvature = (it->trackCurvature() > 0) ? 1 : -1; // ThisIsACheck
l1extra_.tkMuonChg.push_back(chargeFromCurvature);
l1extra_.tkMuonTrkIso.push_back(it->trkIsol());
if (it->muonDetector() != 3) {
l1extra_.tkMuonMuRefPt.push_back(it->muRef()->hwPt() * 0.5);
l1extra_.tkMuonMuRefEta.push_back(it->muRef()->hwEta() * 0.010875);
l1extra_.tkMuonMuRefPhi.push_back(l1t::MicroGMTConfiguration::calcGlobalPhi(it->muRef()->hwPhi(),
it->muRef()->trackFinderType(),
it->muRef()->processor()) *
2 * M_PI / 576);
l1extra_.tkMuonDRMuTrack.push_back(it->dR());
l1extra_.tkMuonNMatchedTracks.push_back(it->nTracksMatched());
l1extra_.tkMuonQual.push_back(it->muRef()->hwQual());
l1extra_.tkMuonMuRefChg.push_back(pow(-1, it->muRef()->hwSign()));
} else {
l1extra_.tkMuonMuRefPt.push_back(-777);
l1extra_.tkMuonMuRefEta.push_back(-777);
l1extra_.tkMuonMuRefPhi.push_back(-777);
l1extra_.tkMuonDRMuTrack.push_back(-777);
l1extra_.tkMuonNMatchedTracks.push_back(0);
l1extra_.tkMuonQual.push_back(999);
l1extra_.tkMuonMuRefChg.push_back(0);
}
l1extra_.tkMuonRegion.push_back(it->muonDetector());
l1extra_.tkMuonzVtx.push_back(it->trkzVtx());
l1extra_.tkMuonBx.push_back(0); //it->bx());
l1extra_.nTkMuons++;
}
}
/*
void L1Analysis::L1AnalysisPhaseIIStep1::SetL1PfPhase1L1TJet(const edm::Handle< std::vector<reco::CaloJet> > l1L1PFPhase1L1Jet, unsigned maxL1Extra){
double mHT30_px=0, mHT30_py=0, HT30=0;
double mHT30_3p5_px=0, mHT30_3p5_py=0, HT30_3p5=0;
for (reco::CaloJetCollection::const_iterator it=l1L1PFPhase1L1Jet->begin(); it!=l1L1PFPhase1L1Jet->end() && l1extra_.nPfPhase1L1Jets<maxL1Extra; it++){
if (it->pt() > 0){
l1extra_.pfPhase1L1JetEt .push_back(it->et());
l1extra_.pfPhase1L1JetEta.push_back(it->eta());
l1extra_.pfPhase1L1JetPhi.push_back(it->phi());
// l1extra_.pfPhase1L1JetBx .push_back(0);
l1extra_.nPfPhase1L1Jets++;
if(it->et()>30 && fabs(it->eta())<2.4) {
HT30+=it->et();
mHT30_px+=it->px();
mHT30_py+=it->py();
}
if(it->et()>30 && fabs(it->eta())<3.5) {
HT30_3p5+=it->et();
mHT30_3p5_px+=it->px();
mHT30_3p5_py+=it->py();
}
}
}
l1extra_.nPfPhase1L1MHT=2;
l1extra_.pfPhase1L1MHTEt.push_back( sqrt(mHT30_px*mHT30_px+mHT30_py*mHT30_py) );
l1extra_.pfPhase1L1MHTPhi.push_back( atan(mHT30_py/mHT30_px) );
l1extra_.pfPhase1L1HT.push_back( HT30 );
l1extra_.pfPhase1L1MHTEt.push_back( sqrt(mHT30_3p5_px*mHT30_3p5_px+mHT30_3p5_py*mHT30_3p5_py) );
l1extra_.pfPhase1L1MHTPhi.push_back( atan(mHT30_3p5_py/mHT30_3p5_px) );
l1extra_.pfPhase1L1HT.push_back( HT30_3p5 );
}
*/
void L1Analysis::L1AnalysisPhaseIIStep1::SetL1METPF(const edm::Handle<std::vector<reco::PFMET> > l1MetPF) {
reco::PFMET met = l1MetPF->at(0);
l1extra_.puppiMETEt = met.et();
l1extra_.puppiMETPhi = met.phi();
}
void L1Analysis::L1AnalysisPhaseIIStep1::SetNNTaus(const edm::Handle<vector<l1t::PFTau> > l1nnTaus,
unsigned maxL1Extra) {
for (unsigned int i = 0; i < l1nnTaus->size() && l1extra_.nNNTaus < maxL1Extra; i++) {
if (l1nnTaus->at(i).pt() < 1)
continue;
l1extra_.nnTauEt.push_back(l1nnTaus->at(i).pt());
l1extra_.nnTauEta.push_back(l1nnTaus->at(i).eta());
l1extra_.nnTauPhi.push_back(l1nnTaus->at(i).phi());
l1extra_.nnTauChg.push_back(l1nnTaus->at(i).charge());
l1extra_.nnTauChargedIso.push_back(l1nnTaus->at(i).chargedIso());
l1extra_.nnTauFullIso.push_back(l1nnTaus->at(i).fullIso());
l1extra_.nnTauID.push_back(l1nnTaus->at(i).id());
l1extra_.nnTauPassLooseNN.push_back(l1nnTaus->at(i).passLooseNN());
l1extra_.nnTauPassLoosePF.push_back(l1nnTaus->at(i).passLoosePF());
l1extra_.nnTauPassTightPF.push_back(l1nnTaus->at(i).passTightPF());
l1extra_.nnTauPassTightNN.push_back(l1nnTaus->at(i).passTightNN());
l1extra_.nNNTaus++;
}
}
| 46.064407 | 158 | 0.64383 | [
"vector"
] |
279aef1924b024d8631be58afecc49da086bfbea | 3,487 | hpp | C++ | routing/cross_mwm_osrm_graph.hpp | marceldallagnol/omim | 774de15a3b8c369acbf412f15a1db61717358262 | [
"Apache-2.0"
] | 2 | 2019-01-24T15:36:20.000Z | 2019-12-26T10:03:48.000Z | routing/cross_mwm_osrm_graph.hpp | marceldallagnol/omim | 774de15a3b8c369acbf412f15a1db61717358262 | [
"Apache-2.0"
] | 1 | 2018-03-07T15:05:23.000Z | 2018-03-07T15:05:23.000Z | routing/cross_mwm_osrm_graph.hpp | marceldallagnol/omim | 774de15a3b8c369acbf412f15a1db61717358262 | [
"Apache-2.0"
] | 1 | 2019-08-09T21:31:29.000Z | 2019-08-09T21:31:29.000Z | #pragma once
#include "routing/num_mwm_id.hpp"
#include "routing/routing_mapping.hpp"
#include "routing/segment.hpp"
#include "routing/transition_points.hpp"
#include "geometry/latlon.hpp"
#include "platform/country_file.hpp"
#include <map>
#include <memory>
#include <vector>
namespace routing
{
struct BorderCross;
class CrossMwmRoadGraph;
using TransitionPoints = buffer_vector<m2::PointD, 1>;
class CrossMwmOsrmGraph final
{
public:
CrossMwmOsrmGraph(std::shared_ptr<NumMwmIds> numMwmIds, RoutingIndexManager & indexManager);
~CrossMwmOsrmGraph();
bool IsTransition(Segment const & s, bool isOutgoing);
void GetEdgeList(Segment const & s, bool isOutgoing, std::vector<SegmentEdge> & edges);
void Clear();
TransitionPoints GetTransitionPoints(Segment const & s, bool isOutgoing);
template <typename Fn>
void ForEachTransition(NumMwmId numMwmId, bool isEnter, Fn && fn)
{
auto const & ts = GetSegmentMaps(numMwmId);
for (auto const & kv : isEnter ? ts.m_ingoing : ts.m_outgoing)
fn(kv.first);
}
private:
struct TransitionSegments
{
std::map<Segment, std::vector<ms::LatLon>> m_ingoing;
std::map<Segment, std::vector<ms::LatLon>> m_outgoing;
};
/// \brief Inserts all ingoing and outgoing transition segments of mwm with |numMwmId|
/// to |m_transitionCache|. It works for OSRM section.
/// \returns Reference to TransitionSegments corresponded to |numMwmId|.
TransitionSegments const & LoadSegmentMaps(NumMwmId numMwmId);
/// \brief Fills |borderCrosses| of mwm with |mapping| according to |s|.
/// \param mapping if |isOutgoing| == true |mapping| is mapping ingoing (from) border cross.
/// If |isOutgoing| == false |mapping| is mapping outgoing (to) border cross.
/// \note |s| and |isOutgoing| params have the same restrictions which described in
/// GetEdgeList() method.
void GetBorderCross(TRoutingMappingPtr const & mapping, Segment const & s, bool isOutgoing,
std::vector<BorderCross> & borderCrosses);
TransitionSegments const & GetSegmentMaps(NumMwmId numMwmId);
std::vector<ms::LatLon> const & GetIngoingTransitionPoints(Segment const & s);
std::vector<ms::LatLon> const & GetOutgoingTransitionPoints(Segment const & s);
template <typename Fn>
void LoadWith(NumMwmId numMwmId, Fn && fn)
{
platform::CountryFile const & countryFile = m_numMwmIds->GetFile(numMwmId);
TRoutingMappingPtr mapping = m_indexManager.GetMappingByName(countryFile.GetName());
CHECK(mapping, ("No routing mapping file for countryFile:", countryFile));
CHECK(mapping->IsValid(), ("Mwm:", countryFile, "was not loaded."));
auto const it = m_mappingGuards.find(numMwmId);
if (it == m_mappingGuards.cend())
{
m_mappingGuards[numMwmId] = make_unique<MappingGuard>(mapping);
mapping->LoadCrossContext();
}
fn(mapping);
}
std::shared_ptr<NumMwmIds> m_numMwmIds;
// OSRM based cross-mwm information.
RoutingIndexManager & m_indexManager;
/// \note According to the constructor CrossMwmRoadGraph is initialized with RoutingIndexManager
/// &.
/// But then it is copied by value to CrossMwmRoadGraph::RoutingIndexManager m_indexManager.
/// It means that there're two copies of RoutingIndexManager in CrossMwmGraph.
std::unique_ptr<CrossMwmRoadGraph> m_crossMwmGraph;
std::map<NumMwmId, TransitionSegments> m_transitionCache;
std::map<NumMwmId, std::unique_ptr<MappingGuard>> m_mappingGuards;
};
} // namespace routing
| 35.581633 | 98 | 0.733295 | [
"geometry",
"vector"
] |
279b45ae92eb2678b8b3648ebcac32ae80f0a3bd | 272 | cpp | C++ | Dataset/Leetcode/train/136/65.cpp | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/136/65.cpp | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | Dataset/Leetcode/train/136/65.cpp | kkcookies99/UAST | fff81885aa07901786141a71e5600a08d7cb4868 | [
"MIT"
] | null | null | null | class Solution {
public:
int singleNumber(vector<int>& nums) {
sort(nums.begin(),nums.end());
for(int i=0;i<nums.size()-2;i++){
if(nums[i]<nums[i+1])return nums[i];
i++;
}
return nums[nums.size()-1];
}
};
| 20.923077 | 48 | 0.477941 | [
"vector"
] |
279cdac28d99cb770cbccf4dba5462d2aa9b38f1 | 1,804 | cpp | C++ | cpp/KalkCpp/UI/AboutShape_Windows/about2drectangular.cpp | ScrappyCocco/Kalk | d5b258d06634f86f051d564d4937994486df62dc | [
"MIT"
] | null | null | null | cpp/KalkCpp/UI/AboutShape_Windows/about2drectangular.cpp | ScrappyCocco/Kalk | d5b258d06634f86f051d564d4937994486df62dc | [
"MIT"
] | null | null | null | cpp/KalkCpp/UI/AboutShape_Windows/about2drectangular.cpp | ScrappyCocco/Kalk | d5b258d06634f86f051d564d4937994486df62dc | [
"MIT"
] | 1 | 2021-01-21T11:58:35.000Z | 2021-01-21T11:58:35.000Z | #include "about2drectangular.h"
About2DRectangular::About2DRectangular(QWidget *parent) : MoreInfoShape(parent, ":shape/2D/rectangular", "Caratteristiche del rettagolo")
{
QLabel* base_label = new QLabel("Base:", this);
base_label->setFont(CalculatorMainInterface::getMainFont());
base_val = new QLabel("0", this);
base_val->setFont(CalculatorMainInterface::getMainFont());
AddWidgetUnder(base_label, 1);
AddWidgetInThisRow(base_val, 2);
QLabel* altezza_label = new QLabel("Altezza:", this);
altezza_label->setFont(CalculatorMainInterface::getMainFont());
height_val = new QLabel("0", this);
height_val->setFont(CalculatorMainInterface::getMainFont());
AddWidgetUnder(altezza_label, 1);
AddWidgetInThisRow(height_val, 2);
QLabel* perim_label = new QLabel("Perimetro:", this);
perim_label->setFont(CalculatorMainInterface::getMainFont());
perim_val = new QLabel("0", this);
perim_val->setFont(CalculatorMainInterface::getMainFont());
AddWidgetUnder(perim_label, 1);
AddWidgetInThisRow(perim_val, 2);
QLabel* area_label = new QLabel("Area:", this);
area_label->setFont(CalculatorMainInterface::getMainFont());
area_val = new QLabel("0", this);
area_val->setFont(CalculatorMainInterface::getMainFont());
AddWidgetUnder(area_label, 1);
AddWidgetInThisRow(area_val, 2);
CreateCancelButton();
SetDefaultCancelAction();
}
void About2DRectangular::setBaseVal(double d)
{
base_val->setText(QString::number(d));
}
void About2DRectangular::setHeightVal(double d)
{
height_val->setText(QString::number(d));
}
void About2DRectangular::setPerimeter(double d)
{
perim_val->setText(QString::number(d));
}
void About2DRectangular::setArea(double d)
{
area_val->setText(QString::number(d));
}
| 32.214286 | 137 | 0.727273 | [
"shape"
] |
27a0c8b8a6b1c3ed29e42a51ee28e3458236d39e | 654 | cpp | C++ | LeetCode/ThousandOne/0728-self_divide_number.cpp | Ginkgo-Biloba/Cpp-Repo1-VS | 231c68a055e6bf69a3f7c224e7c0182b67ce5b67 | [
"Apache-2.0"
] | null | null | null | LeetCode/ThousandOne/0728-self_divide_number.cpp | Ginkgo-Biloba/Cpp-Repo1-VS | 231c68a055e6bf69a3f7c224e7c0182b67ce5b67 | [
"Apache-2.0"
] | null | null | null | LeetCode/ThousandOne/0728-self_divide_number.cpp | Ginkgo-Biloba/Cpp-Repo1-VS | 231c68a055e6bf69a3f7c224e7c0182b67ce5b67 | [
"Apache-2.0"
] | null | null | null | #include "leetcode.hpp"
/* 728. 自除数
自除数 是指可以被它包含的每一位数除尽的数。
例如,128 是一个自除数,因为 128 % 1 == 0,128 % 2 == 0,128 % 8 == 0。
还有,自除数不允许包含 0 。
给定上边界和下边界数字,输出一个列表,列表的元素是边界(含边界)内所有的自除数。
示例 1:
输入:
上边界left = 1, 下边界right = 22
输出: [1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 12, 15, 22]
注意:每个输入参数的边界满足 1 <= left <= right <= 10000。
*/
vector<int> selfDividingNumbers(int left, int right)
{
vector<int> ans;
for (; left <= right; ++left)
{
int n = left;
for (; n; n /= 10)
{
int m = n % 10;
if ((!m) || (left % m))
break;
}
if (!n)
ans.push_back(left);
}
return ans;
}
int main()
{
output(selfDividingNumbers(1, 22), "Self Dividing Numbers");
}
| 14.863636 | 61 | 0.574924 | [
"vector"
] |
27a4ede1ee07a8d5fe744badc7abbf69c23c45c5 | 9,570 | cpp | C++ | Sources/Elastos/Frameworks/Droid/Base/Core/src/elastos/droid/preference/SeekBarPreference.cpp | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 7 | 2017-07-13T10:34:54.000Z | 2021-04-16T05:40:35.000Z | Sources/Elastos/Frameworks/Droid/Base/Core/src/elastos/droid/preference/SeekBarPreference.cpp | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | null | null | null | Sources/Elastos/Frameworks/Droid/Base/Core/src/elastos/droid/preference/SeekBarPreference.cpp | jingcao80/Elastos | d0f39852356bdaf3a1234743b86364493a0441bc | [
"Apache-2.0"
] | 9 | 2017-07-13T12:33:20.000Z | 2021-06-19T02:46:48.000Z | //=========================================================================
// Copyright (C) 2012 The Elastos Open Source Project
//
// 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 "elastos/droid/preference/SeekBarPreference.h"
#include "elastos/droid/preference/CSeekBarPreferenceSavedState.h"
#include "elastos/droid/R.h"
using Elastos::Core::IInteger32;
using Elastos::Core::CInteger32;
using Elastos::Droid::Widget::EIID_ISeekBarOnSeekBarChangeListener;
using Elastos::Droid::Widget::IAbsSeekBar;
using Elastos::Droid::Widget::IProgressBar;
namespace Elastos {
namespace Droid {
namespace Preference {
CAR_INTERFACE_IMPL(SeekBarPreference::InnerListener, Object, ISeekBarOnSeekBarChangeListener)
SeekBarPreference::InnerListener::InnerListener(
/* [in] */ SeekBarPreference* host)
: mHost(host)
{}
ECode SeekBarPreference::InnerListener::OnProgressChanged(
/* [in] */ ISeekBar* seekBar,
/* [in] */ Int32 progress,
/* [in] */ Boolean fromUser)
{
return mHost->OnProgressChanged(seekBar, progress, fromUser);
}
ECode SeekBarPreference::InnerListener::OnStartTrackingTouch(
/* [in] */ ISeekBar* seekBar)
{
return mHost->OnStartTrackingTouch(seekBar);
}
ECode SeekBarPreference::InnerListener::OnStopTrackingTouch(
/* [in] */ ISeekBar* seekBar)
{
return mHost->OnStopTrackingTouch(seekBar);
}
CAR_INTERFACE_IMPL(SeekBarPreference, Preference, ISeekBarPreference)
SeekBarPreference::SeekBarPreference()
: mProgress(0)
, mMax(0)
, mTrackingTouch(FALSE)
{
}
ECode SeekBarPreference::constructor(
/* [in] */ IContext* context,
/* [in] */ IAttributeSet* attrs,
/* [in] */ Int32 defStyleAttr,
/* [in] */ Int32 defStyleRes)
{
FAIL_RETURN(Preference::constructor(context, attrs, defStyleAttr, defStyleRes));
AutoPtr<ArrayOf<Int32> > attrIds = TO_ATTRS_ARRAYOF(R::styleable::ProgressBar);
AutoPtr<ITypedArray> a;
context->ObtainStyledAttributes(attrs, attrIds, defStyleAttr, defStyleRes, (ITypedArray**)&a);
Int32 max;
a->GetInt32(R::styleable::ProgressBar_max, mMax, &max);
SetMax(max);
a->Recycle();
a = NULL;
attrIds = TO_ATTRS_ARRAYOF(R::styleable::SeekBarPreference);
context->ObtainStyledAttributes(attrs, attrIds, defStyleAttr, defStyleRes, (ITypedArray**)&a);
Int32 layoutResId;
a->GetResourceId(
R::styleable::SeekBarPreference_layout,
R::layout::preference_widget_seekbar, &layoutResId);
a->Recycle();
SetLayoutResource(layoutResId);
return NOERROR;
}
ECode SeekBarPreference::constructor(
/* [in] */ IContext* context,
/* [in] */ IAttributeSet* attrs,
/* [in] */ Int32 defStyleAttr)
{
return constructor(context, attrs, defStyleAttr, 0);
}
ECode SeekBarPreference::constructor(
/* [in] */ IContext* context,
/* [in] */ IAttributeSet* attrs)
{
return constructor(context, attrs, R::attr::seekBarPreferenceStyle);
}
ECode SeekBarPreference::constructor(
/* [in] */ IContext* context)
{
return constructor(context, NULL);
}
ECode SeekBarPreference::OnBindView(
/* [in] */ IView* view)
{
FAIL_RETURN(Preference::OnBindView(view))
AutoPtr<IView> tempView;
view->FindViewById(R::id::seekbar, (IView**)&tempView);
ISeekBar* seekBar = ISeekBar::Probe(tempView);
AutoPtr<InnerListener> listener = new InnerListener(this);
seekBar->SetOnSeekBarChangeListener(listener);
IProgressBar* progressBar = IProgressBar::Probe(seekBar);
progressBar->SetMax(mMax);
progressBar->SetProgress(mProgress);
Boolean isEnabled;
IsEnabled(&isEnabled);
tempView->SetEnabled(isEnabled);
return NOERROR;
}
ECode SeekBarPreference::GetSummary(
/* [out] */ ICharSequence** summary)
{
VALIDATE_NOT_NULL(summary)
*summary = NULL;
return NOERROR;
}
ECode SeekBarPreference::OnSetInitialValue(
/* [in] */ Boolean restoreValue,
/* [in] */ IInterface* defaultValue)
{
Int32 progress;
if (restoreValue) {
GetPersistedInt32(mProgress, &progress);
}
else {
IInteger32::Probe(defaultValue)->GetValue(&progress);
}
SetProgress(progress);
return NOERROR;
}
ECode SeekBarPreference::OnGetDefaultValue(
/* [in] */ ITypedArray* a,
/* [in] */ Int32 index,
/* [out] */ IInterface** value)
{
VALIDATE_NOT_NULL(value)
Int32 lvalue;
a->GetInt32(index, 0, &lvalue);
AutoPtr<IInteger32> integer;
CInteger32::New(lvalue, (IInteger32**)&integer);
*value = integer;
REFCOUNT_ADD(*value)
return NOERROR;
}
ECode SeekBarPreference::OnKey(
/* [in] */ IView* v,
/* [in] */ Int32 keyCode,
/* [in] */ IKeyEvent* event,
/* [out] */ Boolean* result)
{
VALIDATE_NOT_NULL(result)
Int32 action, progress;
GetProgress(&progress);
if (event->GetAction(&action), action != IKeyEvent::ACTION_UP) {
if (keyCode == IKeyEvent::KEYCODE_PLUS || keyCode == IKeyEvent::KEYCODE_EQUALS) {
SetProgress(progress + 1);
*result = TRUE;
return NOERROR;
}
if (keyCode == IKeyEvent::KEYCODE_MINUS) {
SetProgress(progress - 1);
*result = TRUE;
return NOERROR;
}
}
*result = FALSE;
return NOERROR;
}
ECode SeekBarPreference::SetMax(
/* [in] */ Int32 max)
{
if (max != mMax) {
mMax = max;
NotifyChanged();
}
return NOERROR;
}
ECode SeekBarPreference::SetProgress(
/* [in] */ Int32 progress)
{
return SetProgress(progress, TRUE);
}
ECode SeekBarPreference::SetProgress(
/* [in] */ Int32 progress,
/* [in] */ Boolean notifyChanged)
{
if (progress > mMax) {
progress = mMax;
}
if (progress < 0) {
progress = 0;
}
if (progress != mProgress) {
mProgress = progress;
Boolean result;
PersistInt32(progress, &result);
if (notifyChanged) {
NotifyChanged();
}
}
return NOERROR;
}
ECode SeekBarPreference::GetProgress(
/* [out] */ Int32* result)
{
VALIDATE_NOT_NULL(result)
*result = mProgress;
return NOERROR;
}
ECode SeekBarPreference::SyncProgress(
/* [in] */ ISeekBar* seekBar)
{
Int32 progress;
IProgressBar::Probe(seekBar)->GetProgress(&progress);
if (progress != mProgress) {
AutoPtr<IInteger32> iprogress;
CInteger32::New(progress, (IInteger32**)&iprogress);
Boolean result;
if (CallChangeListener(iprogress, &result), result) {
SetProgress(progress, FALSE);
}
else {
IProgressBar::Probe(seekBar)->SetProgress(mProgress);
}
}
return NOERROR;
}
ECode SeekBarPreference::OnProgressChanged(
/* [in] */ ISeekBar* seekBar,
/* [in] */ Int32 progress,
/* [in] */ Boolean fromUser)
{
if (fromUser && !mTrackingTouch) {
SyncProgress(seekBar);
}
return NOERROR;
}
ECode SeekBarPreference::OnStartTrackingTouch(
/* [in] */ ISeekBar* seekBar)
{
mTrackingTouch = TRUE;
return NOERROR;
}
ECode SeekBarPreference::OnStopTrackingTouch(
/* [in] */ ISeekBar* seekBar)
{
mTrackingTouch = FALSE;
Int32 progress;
if (IProgressBar::Probe(seekBar)->GetProgress(&progress), progress != mProgress) {
SyncProgress(seekBar);
}
return NOERROR;
}
ECode SeekBarPreference::OnSaveInstanceState(
/* [out] */ IParcelable** state)
{
VALIDATE_NOT_NULL(state)
/*
* Suppose a client uses this preference type without persisting. We
* must save the instance state so it is able to, for example, survive
* orientation changes.
*/
AutoPtr<IParcelable> superState;
Preference::OnSaveInstanceState((IParcelable**)&superState);
Boolean isPersistent;
if (IsPersistent(&isPersistent), isPersistent) {
// No need to save instance state since it's persistent
*state = superState;
REFCOUNT_ADD(*state)
return NOERROR;
}
// Save the instance state
AutoPtr<ISeekBarPreferenceSavedState> myState;
CSeekBarPreferenceSavedState::New(superState, (ISeekBarPreferenceSavedState**)&myState);
myState->SetProgress(mProgress);
myState->SetMax(mMax);
*state = IParcelable::Probe(myState);
REFCOUNT_ADD(*state)
return NOERROR;
}
ECode SeekBarPreference::OnRestoreInstanceState(
/* [in] */ IParcelable* state)
{
if (ISeekBarPreferenceSavedState::Probe(state) == NULL) {
// Didn't save state for us in onSaveInstanceState
return Preference::OnRestoreInstanceState(state);
}
// Restore the instance state
AutoPtr<ISeekBarPreferenceSavedState> myState = ISeekBarPreferenceSavedState::Probe(state);
AutoPtr<IParcelable> superParcel;
IPreferenceBaseSavedState::Probe(myState)->GetSuperState((IParcelable**)&superParcel);
Preference::OnRestoreInstanceState(superParcel);
myState->GetProgress(&mProgress);
myState->GetMax(&mMax);
NotifyChanged();
return NOERROR;
}
}
}
} | 27.579251 | 98 | 0.657889 | [
"object"
] |
27a8e5f846a92d47067414cea6a0c398945f1e91 | 8,150 | cpp | C++ | Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Math/OperatorDivideByNumber.cpp | DongerZone/o3de | 950335e86fc0f59f7da9b219a7578a07cb18d609 | [
"Apache-2.0",
"MIT"
] | 1 | 2021-09-13T00:01:12.000Z | 2021-09-13T00:01:12.000Z | Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Math/OperatorDivideByNumber.cpp | DongerZone/o3de | 950335e86fc0f59f7da9b219a7578a07cb18d609 | [
"Apache-2.0",
"MIT"
] | null | null | null | Gems/ScriptCanvas/Code/Include/ScriptCanvas/Libraries/Operators/Math/OperatorDivideByNumber.cpp | DongerZone/o3de | 950335e86fc0f59f7da9b219a7578a07cb18d609 | [
"Apache-2.0",
"MIT"
] | null | null | null | /*
* Copyright (c) Contributors to the Open 3D Engine Project. For complete copyright and license terms please see the LICENSE at the root of this distribution.
*
* SPDX-License-Identifier: Apache-2.0 OR MIT
*
*/
#include "OperatorDivideByNumber.h"
#include <ScriptCanvas/Libraries/Core/MethodUtility.h>
#include <ScriptCanvas/Core/Contracts/MathOperatorContract.h>
#include <AzCore/Math/MathUtils.h>
#include <ScriptCanvas/Data/NumericData.h>
#include <ScriptCanvas/Utils/SerializationUtils.h>
namespace ScriptCanvas
{
namespace Nodes
{
namespace Operators
{
void OperatorDivideByNumber::CustomizeReplacementNode(Node* replacementNode, AZStd::unordered_map<SlotId, AZStd::vector<SlotId>>& outSlotIdMap) const
{
auto newDataInSlots = replacementNode->GetSlotsByType(ScriptCanvas::CombinedSlotType::DataIn);
auto oldDataInSlots = this->GetSlotsByType(ScriptCanvas::CombinedSlotType::DataIn);
if (newDataInSlots.size() == oldDataInSlots.size())
{
for (size_t index = 0; index < newDataInSlots.size(); index++)
{
outSlotIdMap.emplace(oldDataInSlots[index]->GetId(), AZStd::vector<SlotId>{ newDataInSlots[index]->GetId() });
}
}
auto newDataOutSlots = replacementNode->GetSlotsByType(ScriptCanvas::CombinedSlotType::DataOut);
auto oldDataOutSlots = this->GetSlotsByType(ScriptCanvas::CombinedSlotType::DataOut);
if (newDataOutSlots.size() == oldDataOutSlots.size())
{
for (size_t index = 0; index < newDataOutSlots.size(); index++)
{
outSlotIdMap.emplace(oldDataOutSlots[index]->GetId(), AZStd::vector<SlotId>{ newDataOutSlots[index]->GetId() });
}
}
}
bool OperatorDivideByNumber::OperatorDivideByNumberVersionConverter(AZ::SerializeContext& serializeContext, AZ::SerializeContext::DataElementNode& rootElement)
{
if (rootElement.GetVersion() < Version::RemoveOperatorBase)
{
// Remove ArithmeticOperatorUnary
if (!SerializationUtils::RemoveBaseClass(serializeContext, rootElement))
{
return false;
}
// Remove ArithmeticOperator
if (!SerializationUtils::RemoveBaseClass(serializeContext, rootElement))
{
return false;
}
}
return true;
}
void OperatorDivideByNumber::OnInit()
{
auto groupedSlots = GetSlotsWithDynamicGroup(GetDynamicGroupId());
if (groupedSlots.empty())
{
auto inputDataSlots = GetAllSlotsByDescriptor(SlotDescriptors::DataIn());
auto outputDataSlots = GetAllSlotsByDescriptor(SlotDescriptors::DataOut());
for (const Slot* inputSlot : inputDataSlots)
{
if (inputSlot->IsDynamicSlot() && inputSlot->GetName().compare("Divisor") != 0)
{
if (inputSlot->GetDynamicGroup() != GetDynamicGroupId())
{
SetDynamicGroup(inputSlot->GetId(), GetDynamicGroupId());
}
}
}
if (outputDataSlots.size() == 1)
{
const Slot* resultSlot = outputDataSlots.front();
if (resultSlot->GetDynamicGroup() != GetDynamicGroupId())
{
SetDynamicGroup(resultSlot->GetId(), GetDynamicGroupId());
}
}
groupedSlots = GetSlotsWithDynamicGroup(GetDynamicGroupId());
}
for (const Slot* slot : groupedSlots)
{
if (slot->IsInput())
{
m_operandId = slot->GetId();
}
}
}
void OperatorDivideByNumber::OnInputSignal(const SlotId& slotId)
{
if (slotId != OperatorDivideByNumberProperty::GetInSlotId(this))
{
return;
}
Data::Type type = GetDisplayType(AZ::Crc32("DivideGroup"));
if (!type.IsValid())
{
return;
}
const Datum* operand = FindDatum(m_operandId);
if (operand == nullptr)
{
SCRIPTCANVAS_REPORT_ERROR((*this), "Operand is nullptr");
return;
}
const float divisorValue = aznumeric_cast<float>(OperatorDivideByNumberProperty::GetDivisor(this));
if (AZ::IsClose(divisorValue, 0.f, std::numeric_limits<float>::epsilon()))
{
SCRIPTCANVAS_REPORT_ERROR((*this), "Division by zero");
return;
}
Datum result;
switch (type.GetType())
{
case Data::eType::Number:
{
const Data::NumberType* number = operand->GetAs<Data::NumberType>();
Data::NumberType resultValue = (*number) / divisorValue;
result = Datum(resultValue);
}
break;
case Data::eType::Vector2:
{
const Data::Vector2Type* vector = operand->GetAs<Data::Vector2Type>();
AZ::Vector2 resultValue = (*vector) / divisorValue;
result = Datum(resultValue);
}
break;
case Data::eType::Vector3:
{
const Data::Vector3Type* vector = operand->GetAs<Data::Vector3Type>();
AZ::Vector3 resultValue = (*vector) / divisorValue;
result = Datum(resultValue);
}
break;
case Data::eType::Vector4:
{
const Data::Vector4Type* vector = operand->GetAs<Data::Vector4Type>();
AZ::Vector4 resultValue = (*vector) / divisorValue;
result = Datum(resultValue);
}
break;
case Data::eType::Quaternion:
{
const Data::QuaternionType* quaternion = operand->GetAs<Data::QuaternionType>();
Data::QuaternionType resultValue = (*quaternion) / divisorValue;
result = Datum(resultValue);
}
break;
case Data::eType::Matrix3x3:
{
const Data::Matrix3x3Type* matrix = operand->GetAs<Data::Matrix3x3Type>();
Data::Matrix3x3Type resultValue = (*matrix) / divisorValue;
result = Datum(resultValue);
}
break;
case Data::eType::Color:
{
const Data::ColorType *color = operand->GetAs<Data::ColorType>();
Data::ColorType resultValue = (*color) / divisorValue;
result = Datum(resultValue);
}
break;
default:
result = Datum();
AZ_Error("Script Canvas", false, "Divide by Number does not support the provided data type.");
break;
}
PushOutput(result, (*OperatorDivideByNumberProperty::GetResultSlot(this)));
SignalOutput(OperatorDivideByNumberProperty::GetOutSlotId(this));
}
}
}
}
| 40.346535 | 171 | 0.49227 | [
"vector",
"3d"
] |
27b1522b0b690fb12ad9592bcad5ad7055de5711 | 2,121 | cpp | C++ | sources/enduro2d/high/components/behaviour.cpp | NechukhrinN/enduro2d | 774f120395885a6f0f21418c4de024e7668ee436 | [
"MIT"
] | null | null | null | sources/enduro2d/high/components/behaviour.cpp | NechukhrinN/enduro2d | 774f120395885a6f0f21418c4de024e7668ee436 | [
"MIT"
] | null | null | null | sources/enduro2d/high/components/behaviour.cpp | NechukhrinN/enduro2d | 774f120395885a6f0f21418c4de024e7668ee436 | [
"MIT"
] | null | null | null | /*******************************************************************************
* This file is part of the "Enduro2D"
* For conditions of distribution and use, see copyright notice in LICENSE.md
* Copyright (C) 2018-2020, by Matvey Cherevko (blackmatov@gmail.com)
******************************************************************************/
#include <enduro2d/high/components/behaviour.hpp>
namespace e2d
{
const char* factory_loader<behaviour>::schema_source = R"json({
"type" : "object",
"required" : [],
"additionalProperties" : false,
"properties" : {
"script" : { "$ref": "#/common_definitions/address" }
}
})json";
bool factory_loader<behaviour>::operator()(
behaviour& component,
const fill_context& ctx) const
{
if ( ctx.root.HasMember("script") ) {
auto script = ctx.dependencies.find_asset<script_asset>(
path::combine(ctx.parent_address, ctx.root["script"].GetString()));
if ( !script ) {
the<debug>().error("BEHAVIOUR: Dependency 'script' is not found:\n"
"--> Parent address: %0\n"
"--> Dependency address: %1",
ctx.parent_address,
ctx.root["script"].GetString());
return false;
}
component.script(script);
}
return true;
}
bool factory_loader<behaviour>::operator()(
asset_dependencies& dependencies,
const collect_context& ctx) const
{
if ( ctx.root.HasMember("script") ) {
dependencies.add_dependency<script_asset>(
path::combine(ctx.parent_address, ctx.root["script"].GetString()));
}
return true;
}
}
namespace e2d
{
const char* component_inspector<behaviour>::title = ICON_FA_SCROLL " behaviour";
void component_inspector<behaviour>::operator()(gcomponent<behaviour>& c) const {
E2D_UNUSED(c);
///TODO(BlackMat): add 'meta' inspector
///TODO(BlackMat): add 'script' inspector
}
}
| 32.136364 | 85 | 0.533239 | [
"object"
] |
27bd2e68e2a11891307623c671c6b630bff473a2 | 3,512 | cpp | C++ | src/4991_cleaningRobot.cpp | neweins/algorithm | d68c1dab5a125ec46af319a2a83d70f74422f08e | [
"MIT"
] | null | null | null | src/4991_cleaningRobot.cpp | neweins/algorithm | d68c1dab5a125ec46af319a2a83d70f74422f08e | [
"MIT"
] | null | null | null | src/4991_cleaningRobot.cpp | neweins/algorithm | d68c1dab5a125ec46af319a2a83d70f74422f08e | [
"MIT"
] | null | null | null | // https://www.acmicpc.net/problem/4991
#include <iostream>
#include <vector>
#include <stack> // dfs 완전 탐색
#include <queue> // bfs 최단 경로
#include <algorithm>
using namespace std;
char map[30][30];
/*
. : 깨끗한 칸
* : 더러운 칸
x : 가구
o : 시작 위치
*/
vector<pair<int,int>> Node;
vector<pair<int,int>> dirtNode; // limit : 10
pair<int,int> startNode;
vector<pair<int,int>> adj[30][30];
vector<pair<int,int>> adjdfs[11+3]; // <node value, weight(=distance)>
// 최단 거리
int bfs(pair<int,int> start, pair<int,int> end)
{
int dis=-1;
int visited[30][30] = {0, };
queue<pair<int,int>> q;
q.push(make_pair(start.first,start.second));
visited[start.first][start.second] = 1;
while(!q.empty()){
pair<int,int> v = q.front();
q.pop();
dis++;
if(v == end) return dis;
for(int i=0; i<adj[v.first][v.second].size(); ++i){
if(visited[adj[v.first][v.second][i].first][adj[v.first][v.second][i].second] == 0){
q.push(make_pair(adj[v.first][v.second][i].first, adj[v.first][v.second][i].second));
visited[adj[v.first][v.second][i].first][adj[v.first][v.second][i].second] = 1;
}
}
}
return -1;
}
int dfs()
{
int visited[30]={0,};
stack<pair<int,int>> s;
int finalDis=0;
s.push(1);
while(!s.empty()){
int v = s.top();
s.pop();
if(visited[v] == 0){
visited[v] = 1;
}
for(int i=0; i< adjdfs[v].size(); ++i){
if(visited[adjdfs[v][i].first] == 0){
s.push(adjdfs[v][i].first, adjdfs[v][i].second);
// finalDis +=adjdfs[v][i].second;
}
}
}
return finalDis;
}
int main()
{
int h, w;
scanf("%d %d", &w, &h);
for(int y=1; y<=h; ++y){
for(int x=1; x<=w; ++x){
scanf("%c ",&map[y][x]);
if(map[y][x] == 'o'){
startNode.first = y;
startNode.second = x;
}
if(map[y][x] == '*'){
dirtNode.push_back(make_pair(y,x));
}
}
}
//make adjcent list
for(int y=1; y<=h; ++y){
for(int x=1; x<=w; ++x){
if(map[y][x] != 'x'){
//위
if(y-1 >=1 && map[y-1][x] != 'x'){
adj[y][x].push_back(make_pair(y-1,x));
}
//아래
if(y+1 <=h && map[y+1][x] != 'x'){
adj[y][x].push_back(make_pair(y+1,x));
}
//좌
if(x-1 >=1 && map[y][x-1] != 'x'){
adj[y][x].push_back(make_pair(y, x-1));
}
//우
if(x+1 <=w && map[y][x+1] != 'x'){
adj[y][x].push_back(make_pair(y,x+1));
}
adj[y][x].push_back(make_pair(y,x)); // 노드가 한개인 그래프 포함.
}
}
}
// Node 배열에 모든 node를 copy
Node.push_back(make_pair(startNode.first,startNode.second));
for(int i=0; i < dirtNode.size(); i++){
Node.push_back(make_pair(dirtNode[i].first, dirtNode[i].second));
}
for(int i=0; i<Node.size()-1; ++i){
for(int j=i+1; j<Node.size(); ++j){
int dis=bfs(Node[i], Node[j]);
adjdfs[i].push_back(make_pair(j, dis)); // make_pair(node val, distance)
adjdfs[j].push_back(make_pair(i, dis)); // add both direction graph
}
}
cout << dfs() << endl;
return 0;
}
| 24.388889 | 101 | 0.451025 | [
"vector"
] |
27be9fb1c9afed5231b0cb5976b6425cfab880f3 | 4,306 | cc | C++ | cxx/tests/test_irm_two_relations.cc | probcomp/hierarchical-irm | 042aaea56d66d05c4c54848353696ca60c692581 | [
"Apache-2.0"
] | 8 | 2021-08-18T19:53:17.000Z | 2022-03-28T20:48:51.000Z | cxx/tests/test_irm_two_relations.cc | probcomp/hierarchical-irm | 042aaea56d66d05c4c54848353696ca60c692581 | [
"Apache-2.0"
] | null | null | null | cxx/tests/test_irm_two_relations.cc | probcomp/hierarchical-irm | 042aaea56d66d05c4c54848353696ca60c692581 | [
"Apache-2.0"
] | null | null | null | // Copyright 2021 MIT Probabilistic Computing Project
// Apache License, Version 2.0, refer to LICENSE.txt
#include <cassert>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <map>
#include <random>
#include <set>
#include <string>
#include <vector>
#include "globals.hh"
#include "hirm.hh"
#include "util_io.hh"
#include "util_math.hh"
int main(int argc, char **argv) {
string path_base = "assets/two_relations";
int seed = 1;
int iters = 2;
PRNG prng (seed);
string path_schema = path_base + ".schema";
std::cout << "loading schema from " << path_schema << std::endl;
auto schema = load_schema(path_schema);
for (auto const &[relation, domains] : schema) {
printf("relation: %s, ", relation.c_str());
printf("domains: ");
for (auto const &domain : domains) {
printf("%s ", domain.c_str());
}
printf("\n");
}
string path_obs = path_base + ".obs";
std::cout << "loading observations from " << path_obs << std::endl;
auto observations = load_observations(path_obs);
T_encoding encoding = encode_observations(schema, observations);
IRM irm (schema, &prng);
incorporate_observations(irm, encoding, observations);
printf("running for %d iterations\n", iters);
for (int i = 0; i < iters; i++) {
irm.transition_cluster_assignments_all();
for (auto const &[d, domain] : irm.domains) {
domain->crp.transition_alpha();
}
double x = irm.logp_score();
printf("iter %d, score %f\n", i, x);
}
string path_clusters = path_base + ".irm";
std::cout << "writing clusters to " << path_clusters << std::endl;
to_txt(path_clusters, irm, encoding);
map<int, map<int, double>> expected_p0 {
{0, { {0, 1}, {10, 1}, {100, .5} } },
{10, { {0, 0}, {10, 0}, {100, .5} } },
{100, { {0, .66}, {10, .66}, {100, .5} } },
};
vector<vector<int>> indexes {{0, 10, 100}, {0, 10, 100}};
for (const auto &l : product(indexes)) {
assert(l.size() == 2);
auto x1 = l.at(0);
auto x2 = l.at(1);
auto p0 = irm.relations.at("R1")->logp({x1, x2}, 0);
auto p0_irm = irm.logp({{"R1", {x1, x2}, 0}});
assert(abs(p0 - p0_irm) < 1e-10);
auto p1 = irm.relations.at("R1")->logp({x1, x2}, 1);
auto Z = logsumexp({p0, p1});
assert(abs(Z) < 1e-10);
assert(abs(exp(p0) - expected_p0[x1].at(x2)) < .1);
}
for (const auto &l : vector<vector<int>> {{0, 10, 100}, {110, 10, 100}}) {
auto x1 = l.at(0);
auto x2 = l.at(1);
auto x3 = l.at(2);
auto p00 = irm.logp({{"R1", {x1, x2}, 0}, {"R1", {x1, x3}, 0}});
auto p01 = irm.logp({{"R1", {x1, x2}, 0}, {"R1", {x1, x3}, 1}});
auto p10 = irm.logp({{"R1", {x1, x2}, 1}, {"R1", {x1, x3}, 0}});
auto p11 = irm.logp({{"R1", {x1, x2}, 1}, {"R1", {x1, x3}, 1}});
auto Z = logsumexp({p00, p01, p10, p11});
assert(abs(Z) < 1e-10);
}
IRM irx ({}, &prng);
from_txt(&irx, path_schema, path_obs, path_clusters);
// Check log scores agree.
for (const auto &d : {"D1", "D2"}) {
auto dm = irm.domains.at(d);
auto dx = irx.domains.at(d);
dx->crp.alpha = dm->crp.alpha;
}
assert(abs(irx.logp_score() - irm.logp_score()) < 1e-8);
// Check domains agree.
for (const auto &d : {"D1", "D2"}) {
auto dm = irm.domains.at(d);
auto dx = irx.domains.at(d);
assert(dm->items == dx->items);
assert(dm->crp.assignments == dx->crp.assignments);
assert(dm->crp.tables == dx->crp.tables);
assert(dm->crp.N == dx->crp.N);
assert(dm->crp.alpha == dx->crp.alpha);
}
// Check relations agree.
for (const auto &r : {"R1", "R2"}) {
auto rm = irm.relations.at(r);
auto rx = irx.relations.at(r);
assert(rm->data == rx->data);
assert(rm->data_r == rx->data_r);
assert(rm->clusters.size() == rx->clusters.size());
for (const auto &[z, clusterm] : rm->clusters) {
auto clusterx = rx->clusters.at(z);
assert(clusterm->N == clusterx->N);
}
}
}
| 35.00813 | 78 | 0.524849 | [
"vector"
] |
27ce0fa5967f223b13cd3021b50f029c4150d755 | 3,559 | cpp | C++ | Source/Core/LibJob/Example01-simple/Main.cpp | dzik143/tegenaria | a6c138633ab14232a2229d7498875d9d869d25a9 | [
"MIT"
] | 3 | 2020-12-28T06:18:47.000Z | 2021-08-01T06:18:12.000Z | Source/Core/LibJob/Example01-simple/Main.cpp | dzik143/tegenaria | a6c138633ab14232a2229d7498875d9d869d25a9 | [
"MIT"
] | null | null | null | Source/Core/LibJob/Example01-simple/Main.cpp | dzik143/tegenaria | a6c138633ab14232a2229d7498875d9d869d25a9 | [
"MIT"
] | null | null | null | /******************************************************************************/
/* */
/* Copyright (c) 2010, 2014 Sylwester Wysocki <sw143@wp.pl> */
/* */
/* 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 <cstdio>
#include <Tegenaria/Job.h>
using namespace Tegenaria;
//
// Callback function called when job changed state or progress meter.
//
void JobNotify(int code, Job *job, void *ctx)
{
switch(code)
{
//
// Job changed it's state.
//
case JOB_NOTIFY_STATE_CHANGED:
{
printf("%s : changed state to %s...\n", job -> getTitle(), job -> getStateString());
break;
}
//
// Job changed it's progress meter.
//
case JOB_NOTIFY_PROGRESS:
{
printf("%s : %3.1lf completed...\n", job -> getTitle(), job -> getPercentCompleted());
break;
}
}
}
//
// Function performing our time consuming job.
//
void DoMyJob(Job *job, void *ctx)
{
for (int i = 0; i <= 100; i++)
{
job -> setPercentCompleted(i);
ThreadSleepMs(100);
//
// Check for cancel signal.
//
if (job -> getState() == JOB_STATE_STOPPED)
{
return;
}
}
//
// Mark job as finished.
//
// TIP: Use JOB_STATE_ERROR to mark job finished with error.
//
job -> setState(JOB_STATE_FINISHED);
}
//
// Entry point.
//
int main()
{
//
// Create new job.
//
Job *job = new Job("MyJob", JobNotify, NULL, DoMyJob, NULL);
//
// Wait until job finished.
//
// TIP#1: Use timeout parameter if you have time limit.
// TIP#2: Use job -> cancel() to cancel pending job.
//
job -> wait();
//
// Check is job finished with success or error.
//
if (job -> getState() == JOB_STATE_FINISHED)
{
printf("OK.\n");
}
else
{
printf("Job finished with error no. %d.\n", job -> getErrorCode());
}
//
// Release job object.
//
job -> release();
return 0;
}
| 26.362963 | 92 | 0.513065 | [
"object"
] |
27d743171a426260bce80ef9016c7dd9eca58855 | 2,209 | cpp | C++ | sakura_core/apiwrap/StdApi.cpp | saurabhacellere/sakura | 2545777559bffaedf9c4e481fb8937fab2586bdb | [
"Zlib"
] | 1 | 2020-10-12T08:21:51.000Z | 2020-10-12T08:21:51.000Z | sakura_core/apiwrap/StdApi.cpp | saurabhacellere/sakura | 2545777559bffaedf9c4e481fb8937fab2586bdb | [
"Zlib"
] | 30 | 2016-01-27T16:10:19.000Z | 2018-02-18T16:33:49.000Z | sakura_core/apiwrap/StdApi.cpp | saurabhacellere/sakura | 2545777559bffaedf9c4e481fb8937fab2586bdb | [
"Zlib"
] | 1 | 2021-03-09T06:13:03.000Z | 2021-03-09T06:13:03.000Z | /*! @file */
#include "StdAfx.h"
#include <vector>
#include "StdApi.h"
#include "charset/charcode.h"
using namespace std;
namespace ApiWrap{
/*!
MakeSureDirectoryPathExists の UNICODE 版。
szDirPath で指定されたすべてのディレクトリを作成します。
ディレクトリの記述は、ルートから開始します。
@param DirPath
有効なパス名を指定する、null で終わる文字列へのポインタを指定します。
パスの最後のコンポーネントがファイル名ではなくディレクトリである場合、
文字列の最後に円記号(\)を記述しなければなりません。
@returns
関数が成功すると、TRUE が返ります。
関数が失敗すると、FALSE が返ります。
@note
指定された各ディレクトリがまだ存在しない場合、それらのディレクトリを順に作成します。
一部のディレクトリのみを作成した場合、この関数は FALSE を返します。
@author
kobake
@date
2007.10.15
*/
BOOL MakeSureDirectoryPathExistsW(LPCWSTR szDirPath)
{
const wchar_t* p=szDirPath-1;
for (;;) {
p=wcschr(p+1,L'\\');
if(!p)break; //'\\'を走査し終わったので終了
//先頭からpまでの部分文字列 -> szBuf
wchar_t szBuf[_MAX_PATH];
wcsncpy_s(szBuf,_countof(szBuf),szDirPath,p-szDirPath);
//存在するか
int nAcc = _waccess(szBuf,0);
if(nAcc==0)continue; //存在するなら、次へ
//ディレクトリ作成
int nDir = _wmkdir(szBuf);
if(nDir==-1)return FALSE; //エラーが発生したので、FALSEを返す
}
return TRUE;
}
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
// その他W系API //
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
// 描画API 不具合ラップ //
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
/*
VistaでSetPixelが動かないため、代替関数を用意。
参考:http://forums.microsoft.com/MSDN-JA/ShowPost.aspx?PostID=3228018&SiteID=7
> Vista で Aero を OFF にすると SetPixel がうまく動かないそうです。
> しかも、SP1 でも修正されていないとか。
一旦はvista以降向けの「不具合」対策をそのまま残します。
vista前後でGDIの考え方が変わってるので、デバッグのやり方を考え直すべきと思います。
by berryzplus 2018/10/13記す。
*/
void SetPixelSurely(HDC hdc,int x,int y,COLORREF c)
{
{
//Vista以降:SetPixelエミュレート
static HPEN hPen = NULL;
static COLORREF clrPen = 0;
if(hPen && c!=clrPen){
DeleteObject(hPen);
hPen = NULL;
}
//ペン生成
if(!hPen){
hPen = CreatePen(PS_SOLID,1,clrPen = c);
}
//描画
HPEN hpnOld = (HPEN)SelectObject(hdc,hPen);
::MoveToEx(hdc,x,y,NULL);
::LineTo(hdc,x+1,y+1);
SelectObject(hdc,hpnOld);
}
}
}
| 22.773196 | 78 | 0.572657 | [
"vector"
] |
27db58336e0ba6da1d4cd14d3b5736473805e528 | 731 | cpp | C++ | 409-longest-palindrome/longest-palindrome.cpp | nagestx/MyLeetCode | ef2a98b48485a0cebc442bbbbdb2690ba51484e1 | [
"MIT"
] | 3 | 2018-12-15T14:07:12.000Z | 2020-07-19T23:18:09.000Z | 409-longest-palindrome/longest-palindrome.cpp | yangyangu/MyLeetCode | ef2a98b48485a0cebc442bbbbdb2690ba51484e1 | [
"MIT"
] | null | null | null | 409-longest-palindrome/longest-palindrome.cpp | yangyangu/MyLeetCode | ef2a98b48485a0cebc442bbbbdb2690ba51484e1 | [
"MIT"
] | null | null | null | // Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters.
//
// This is case sensitive, for example "Aa" is not considered a palindrome here.
//
// Note:
// Assume the length of given string will not exceed 1,010.
//
//
// Example:
//
// Input:
// "abccccdd"
//
// Output:
// 7
//
// Explanation:
// One longest palindrome that can be built is "dccaccd", whose length is 7.
//
//
class Solution {
public:
int longestPalindrome(string s) {
vector<int> vt(256);
int odds = 0;
for(char ch : s){
odds += ++vt[ch] & 1 ? 1: -1;
}
return s.size() - odds + (odds > 0);
}
};
| 21.5 | 149 | 0.593707 | [
"vector"
] |
27de6b79bd1fcdb822d05e9837a74fdfcf41856a | 11,360 | cpp | C++ | example/Application.cpp | Godlike/Sleipnir | 8eff3749ba7b0dd104d215f3a5e08b8a2aa9acb0 | [
"MIT"
] | null | null | null | example/Application.cpp | Godlike/Sleipnir | 8eff3749ba7b0dd104d215f3a5e08b8a2aa9acb0 | [
"MIT"
] | 3 | 2017-08-07T22:13:57.000Z | 2019-03-03T06:22:30.000Z | example/Application.cpp | Godlike/Sleipnir | 8eff3749ba7b0dd104d215f3a5e08b8a2aa9acb0 | [
"MIT"
] | null | null | null | #include "Application.hpp"
#include <unicorn/system/CustomValue.hpp>
#include <unicorn/system/input/Action.hpp>
#include <unicorn/system/input/Key.hpp>
#include <unicorn/system/input/Modifier.hpp>
#include <unicorn/video/Color.hpp>
#include <unicorn/video/Graphics.hpp>
#include <unicorn/video/geometry/Primitives.hpp>
#include <functional>
#include <random>
Application::Application(unicorn::Settings& settings, unicorn::UnicornRender* pRender)
: m_pRender(pRender)
, m_timer(true)
, m_pCameraController(nullptr)
, m_pVkRenderer(nullptr)
, m_physicsWorld(m_particles
, m_physicsForceRegistry
, m_physicsContactGenerators
, MAX_OBJECT_COUNT * MAX_OBJECT_COUNT
, 5000)
{
unicorn::video::Graphics* pGraphics = m_pRender->GetGraphics();
pGraphics->SetWindowCreationHint(unicorn::system::WindowHint::Decorated,
unicorn::system::CustomValue::True);
pGraphics->SetWindowCreationHint(unicorn::system::WindowHint::Resizable,
unicorn::system::CustomValue::True);
auto h = pGraphics->GetMonitors().back()->GetActiveVideoMode().height;
auto w = pGraphics->GetMonitors().back()->GetActiveVideoMode().width;
settings.SetApplicationHeight(h);
settings.SetApplicationWidth(w);
unicorn::system::Window* pWindow = pGraphics->SpawnWindow(settings.GetApplicationWidth(),
settings.GetApplicationHeight(),
settings.GetApplicationName(),
nullptr,
nullptr);
pWindow->SetMouseMode(unicorn::system::MouseMode::Captured);
m_pVkRenderer = pGraphics->SpawnRenderer(pWindow);
m_pVkRenderer->SetBackgroundColor(unicorn::video::Color::LightPink());
m_pCameraController = new unicorn::video::CameraFpsController(m_pVkRenderer->GetCamera());
// Binds
{
using namespace std::placeholders;
m_pRender->LogicFrame.connect(this, &Application::OnLogicFrame);
m_pVkRenderer->Destroyed.connect(this, &Application::OnRendererDestroyed);
pWindow->MouseButton.connect(this, &Application::OnMouseButton);
pWindow->MousePosition.connect(this, &Application::OnCursorPositionChanged);
pWindow->Scroll.connect(this, &Application::OnMouseScrolled);
pWindow->Keyboard.connect(this, &Application::OnWindowKeyboard);
}
SceneReset();
}
Application::~Application()
{
delete m_pCameraController;
if (m_pVkRenderer)
{
for (auto& pMeshDescriptor : m_worldObjects)
{
m_pVkRenderer->DeleteMesh(&pMeshDescriptor->GetMesh());
delete pMeshDescriptor;
}
delete m_pVkRenderer;
}
}
void Application::Run()
{
m_pRender->Run();
}
void Application::OnLogicFrame(unicorn::UnicornRender* /*render*/)
{
using unicorn::video::geometry::MeshDescriptor;
float currentFrame = static_cast<float>(m_timer.ElapsedMilliseconds().count()) / 1000;
float newDeltatime = currentFrame - m_lastFrame;
if (newDeltatime <= 0.0)
{
return;
}
m_deltaTime = newDeltatime;
m_physicsWorld.StartFrame();
m_physicsWorld.RunPhysics(0.01);
MeshDescriptor* pMeshDescriptor = nullptr;
for (auto const& body : m_rigidBodies)
{
pegasus::Particle& particle = body.p;
body.s->SetCenterOfMass(particle.GetPosition());
pMeshDescriptor = m_glue[&particle];
if (pMeshDescriptor != m_worldObjects.front())
{
pMeshDescriptor->SetIdentity();
pMeshDescriptor->Translate(particle.GetPosition());
}
}
m_lastFrame = currentFrame;
}
void Application::OnMouseButton(unicorn::system::Window::MouseButtonEvent const& mouseButtonEvent)
{
using unicorn::system::input::MouseButton;
using unicorn::system::input::Action;
using unicorn::video::geometry::MeshDescriptor;
using unicorn::video::geometry::Primitives;
unicorn::system::input::Action const& action = mouseButtonEvent.action;
if (action == Action::Release || action == Action::Repeat)
{
return;
}
unicorn::system::input::MouseButton const& button = mouseButtonEvent.button;
switch (button)
{
case MouseButton::MouseLeft:
{
SpawnCube();
break;
}
case MouseButton::MouseRight:
{
DeleteCube();
break;
}
default:
{
break;
}
}
}
void Application::OnCursorPositionChanged(unicorn::system::Window* pWindow, std::pair<double, double> pos)
{
m_pCameraController->UpdateView(pos.first, pos.second);
}
void Application::OnMouseScrolled(unicorn::system::Window* pWindow, std::pair<double, double> pos)
{
m_pCameraController->Scroll(static_cast<float>(pos.second / 50)); // 50 is zoom coefficient
}
void Application::OnWindowKeyboard(unicorn::system::Window::KeyboardEvent const& keyboardEvent)
{
using unicorn::system::input::Key;
using unicorn::system::input::Modifier;
using unicorn::system::input::Action;
using unicorn::system::MouseMode;
unicorn::system::input::Action const& action = keyboardEvent.action;
if (Action::Release == action)
{
return;
}
float delta = m_deltaTime * 0.1f;
{
unicorn::system::input::Modifier::Mask const& modifiers = keyboardEvent.modifiers;
if (Modifier::Shift & modifiers)
{
delta *= 10;
}
if (Modifier::Alt & modifiers)
{
delta *= 5;
}
}
switch (keyboardEvent.key)
{
case Key::W:
{
m_pCameraController->MoveForward(delta);
break;
}
case Key::S:
{
m_pCameraController->MoveBackward(delta);
break;
}
case Key::A:
{
m_pCameraController->MoveLeft(delta);
break;
}
case Key::D:
{
m_pCameraController->MoveRight(delta);
break;
}
case Key::Q:
{
m_pCameraController->MoveUp(delta);
break;
}
case Key::E:
{
m_pCameraController->MoveDown(delta);
break;
}
case Key::C:
{
keyboardEvent.pWindow->SetMouseMode(MouseMode::Captured);
break;
}
case Key::J:
{
SceneReset();
break;
}
case Key::Escape:
{
keyboardEvent.pWindow->SetMouseMode(MouseMode::Normal);
break;
}
default:
{
break;
}
}
}
void Application::OnRendererDestroyed(unicorn::video::Renderer* pRenderer)
{
if (m_pVkRenderer == pRenderer)
{
m_pVkRenderer = nullptr;
}
}
void Application::SpawnCube()
{
using unicorn::video::geometry::MeshDescriptor;
using unicorn::video::geometry::Primitives;
glm::dvec3 position = {0.0, 0.0, 20.0};
// Render part
MeshDescriptor* pCube = new MeshDescriptor(Primitives::Cube(*(m_pVkRenderer->SpawnMesh())));
pCube->Translate(position);
pCube->SetColor({static_cast<float>(std::rand() % 255) / 255, static_cast<float>(std::rand() % 255) / 255, static_cast<float>(std::rand() % 255) / 255});
m_cubes.push_back(pCube);
// Physics part
static auto randDouble = []()
{
static std::default_random_engine generator;
static std::uniform_real_distribution<double> distribution(-5.0, 5.0);
return distribution(generator);
};
m_particles.emplace_back();
pegasus::Particle& particle = m_particles.back();
particle.SetPosition(position);
particle.SetDamping(1.0f);
particle.SetVelocity(randDouble(), randDouble() - 5, randDouble());
m_rigidBodies.emplace_back(
particle,
std::make_unique<pegasus::geometry::Box>(
position,
glm::dvec3{1.0f, 0, 0},
glm::dvec3{0, 1.0f, 0},
glm::dvec3{0, 0, 1.0f}
)
);
m_physicsForceRegistry.Add(particle, *m_forces.front());
m_physicsContactGenerators.push_back(
std::make_unique<pegasus::ShapeContactGenerator<RigidBodies>>(m_rigidBodies.back()
, m_rigidBodies
, (randDouble() + 5) / 10)
);
// Glue
m_glue[&particle] = pCube;
}
void Application::DeleteCube()
{
if (m_cubes.size())
{
// Get random cube
const uint32_t index = std::rand() % m_cubes.size();
// Render part
{
auto meshIt = m_cubes.begin();
std::advance(meshIt, index);
// Fetch cube's mesh
auto const& mesh = (*meshIt)->GetMesh();
// Erase cube
m_cubes.erase(meshIt);
// Release cube's mesh
m_pVkRenderer->DeleteMesh(&mesh);
}
// Physics part
{
auto particleIt = m_particles.begin();
auto rigidBodyIt = m_rigidBodies.begin();
auto physicsCGIt = m_physicsContactGenerators.begin();
// There is offset in particles and rigid bodies for world objects
std::advance(particleIt, index + m_worldObjects.size());
std::advance(rigidBodyIt, index + m_worldObjects.size());
std::advance(physicsCGIt, index);
m_physicsForceRegistry.Remove(*particleIt);
m_physicsContactGenerators.erase(physicsCGIt);
m_rigidBodies.erase(rigidBodyIt);
m_particles.erase(particleIt);
}
}
}
void Application::SceneReset()
{
// Step 1. Clear
// Glue
m_glue.clear();
// Physics part
m_rigidBodies.clear();
m_forces.clear();
m_particles.clear();
m_physicsContactGenerators.clear();
m_physicsForceRegistry.Clear();
// Render part
if (m_pVkRenderer)
{
for (auto& pMeshDescriptor : m_cubes)
{
m_pVkRenderer->DeleteMesh(&pMeshDescriptor->GetMesh());
delete pMeshDescriptor;
}
for (auto& pMeshDescriptor : m_worldObjects)
{
m_pVkRenderer->DeleteMesh(&pMeshDescriptor->GetMesh());
delete pMeshDescriptor;
}
}
m_worldObjects.clear();
m_cubes.clear();
// Step 2. Setup
// Create forces
m_forces.push_back(std::make_unique<pegasus::ParticleGravity>(glm::dvec3{0, 9.8, 0}));
// Render part
using unicorn::video::geometry::MeshDescriptor;
using unicorn::video::geometry::Primitives;
const glm::dvec3 planePosition = {0.0f, 20.0f, 0.0f};
MeshDescriptor* pPlane = new MeshDescriptor(Primitives::Quad(*(m_pVkRenderer->SpawnMesh())));
pPlane->Translate(planePosition);
pPlane->Rotate(glm::radians(90.0f), {1, 0, 0});
pPlane->Scale({100.00f, 100.0f, 0.0f});
pPlane->SetColor({0.18f, 0.31f, 0.31f});
m_worldObjects.push_back(pPlane);
// Physics part
m_particles.emplace_back();
pegasus::Particle& particle = m_particles.back();
particle.SetPosition(planePosition);
particle.SetInverseMass(0);
m_rigidBodies.emplace_back(
particle,
std::make_unique<pegasus::geometry::Plane>(
particle.GetPosition(), glm::normalize(glm::dvec3{0.0, -1.0, 0.0})
)
);
// Glue
m_glue[&particle] = pPlane;
}
| 26.792453 | 157 | 0.613556 | [
"mesh",
"geometry",
"render"
] |
27e7e07d96e90b56bd6e35ec3e903eee3b8d3030 | 41,949 | cpp | C++ | Code.v05-00/src/Core/FileHandler.cpp | MIT-LAE/APCEMM | 2954bca64ec1c13552830d467d404dbe627ef71a | [
"MIT"
] | 2 | 2022-03-21T20:49:37.000Z | 2022-03-22T17:25:31.000Z | Code.v05-00/src/Core/FileHandler.cpp | MIT-LAE/APCEMM | 2954bca64ec1c13552830d467d404dbe627ef71a | [
"MIT"
] | null | null | null | Code.v05-00/src/Core/FileHandler.cpp | MIT-LAE/APCEMM | 2954bca64ec1c13552830d467d404dbe627ef71a | [
"MIT"
] | 1 | 2022-03-21T20:50:50.000Z | 2022-03-21T20:50:50.000Z | /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
/* */
/* Aircraft Plume Chemistry, Emission and Microphysics Model */
/* (APCEMM) */
/* */
/* FileHandler Program File */
/* */
/* Author : Thibaud M. Fritz */
/* Time : 7/26/2018 */
/* File : FileHandler.cpp */
/* */
/* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
#include "Core/FileHandler.hpp"
FileHandler::FileHandler( )
: fileName( NULL )
, doRead( 0 )
, doWrite( 0 )
, overWrite( 0 )
{
/* Default Constructor */
} /* End of FileHandler::FileHandler */
FileHandler::FileHandler( const char* fileName_, const bool doWrite_, \
const bool doRead_, const bool overWrite_ )
{
/* Constructor */
fileName = fileName_;
doRead = doRead_;
doWrite = doWrite_;
overWrite = overWrite_;
isOpen = 0;
NcError err( NcError::silent_nonfatal );
UpdateMode();
} /* End of FileHandler::FileHandler */
FileHandler::~FileHandler( )
{
/* Destructor */
} /* End of FileHandler::~FileHandler */
void FileHandler::UpdateMode( )
{
switch ( doWrite ) {
case 0:
switch ( doRead ) {
case 0:
/* Neither read nor write */
std::cout << " netCDF fileName: " << fileName << "\n";
std::cout << " -> doRead and doWrite set to 0" << "\n";
case 1:
/* Read only */
mode = NcFile::ReadOnly;
}
case 1:
switch ( overWrite ) {
case 0:
/* Write without overwriting */
mode = NcFile::New;
case 1:
/* Write with overwriting */
mode = NcFile::Replace;
}
}
} /* End of FileHandler::UpdateMode */
FileHandler::FileHandler( const FileHandler &f )
{
/* Copy file name*/
fileName = f.fileName;
/* Copy logicals */
doRead = f.doRead;
doWrite = f.doWrite;
overWrite = f.overWrite;
/* Copy file */
isOpen = f.isOpen;
} /* End of FileHandler::FileHandler */
FileHandler& FileHandler::operator=( const FileHandler &f )
{
if ( &f == this )
return *this;
/* Assign file name*/
fileName = f.fileName;
/* Assign logicals */
doRead = f.doRead;
doWrite = f.doWrite;
overWrite = f.overWrite;
/* Assign file */
isOpen = f.isOpen;
return *this;
} /* End of FileHandler::operator= */
NcFile FileHandler::openFile( )
{
NcFile dataFile( fileName, mode );
isOpen = 1;
if ( !( dataFile.is_valid() ) ) {
std::cout << " In FileHandler::FileHandler: Couldn't open: ";
std::cout << fileName << "\n";
std::cout << " -> doRead : " << doRead << "\n";
std::cout << " -> doWrite : " << doWrite << "\n";
std::cout << " -> overWrite: " << overWrite << "\n";
std::cout << " -> mode: " << mode << "\n";
isOpen = 0;
}
return dataFile;
} /* End of FileHandler::openFile */
void FileHandler::closeFile( NcFile &dataFile )
{
isOpen = 0;
if ( !(dataFile.close()) ) {
std::cout << "In FileHandler::closeFile: Couldn't close ";
std::cout << fileName << "\n";
if ( dataFile.is_valid() ) {
std::cout << "In FileHandler::closeFile: is_valid returns: ";
std::cout << dataFile.is_valid() << "\n";
isOpen = 1;
}
}
} /* End of FileHandler::closeFile */
int FileHandler::getNumDim( NcFile &dataFile ) const
{
return dataFile.num_dims( );
} /* End of FileHandler::getNumDim */
int FileHandler::getNumVar( NcFile &dataFile ) const
{
return dataFile.num_vars( );
} /* End of FileHandler::getNumVar */
int FileHandler::getNumAtt( NcFile &dataFile ) const
{
return dataFile.num_atts( );
} /* End of FileHandler::getNumAtt */
NcDim* FileHandler::addDim( NcFile &dataFile, const char* dimName, \
long size ) const
{
/* If size = 0, dimension is unlimited */
NcDim *varDim;
/* Define the dimensions. netCDF will hand back an NcDim object. */
if ( !(varDim = dataFile.add_dim( dimName, size )) ) {
std::cout << "In FileHandler::addDim: defining dimension failed for ";
std::cout << dimName << "\n";
}
return varDim;
} /* End of FileHandler::addDim */
template <class T>
int FileHandler::addConst( NcFile &dataFile, T *inputVar, const char* varName, \
long size, const char* type, const char* unit, \
const char* varFullName, const bool verbose ) const
{
/* Convert input type to netCDF type */
NcType varType;
if ( strcmp(type, "double") == 0 ) {
varType = ncDouble;
} else if ( strcmp(type, "float") == 0 ) {
varType = ncFloat;
} else if ( strcmp(type, "long") == 0 ) {
varType = ncLong;
} else if ( strcmp(type, "int") == 0 ) {
varType = ncInt;
} else if ( strcmp(type, "short") == 0 ) {
varType = ncShort;
} else if ( strcmp(type, "char") == 0 ) {
varType = ncChar;
} else if ( strcmp(type, "byte") == 0 ) {
varType = ncByte;
} else {
varType = ncNoType;
std::cout << "In FileHandler::addConst: varType takes an undefined value.";
std::cout << " varType: " << varType << " in " << fileName << "\n";
return NC_ERROR;
}
/* Create netCDF variables which hold the actual specified variable */
NcVar *var;
if ( !(var = dataFile.add_var( varName, varType )) ) {
std::cout << "In FileHandler::addConst: defining variable failed for ";
std::cout << varName << " in " << fileName << "\n";
return NC_ERROR;
}
/* Define unit attributes for variables.
* This attaches a text attribute to each of the coordinate variables,
* containing the unit */
if ( !var->add_att("unit", unit) ) {
std::cout << "In FileHandler::addConst: unit definition failed for ";
std::cout << varName << " (unit: [" << unit << "]) in " << fileName << "\n";
return NC_ERROR;
}
/* Define long name attributes for variables.
* This attaches a text attribute to each of the coordinate variables,
* containing the long name */
if ( !var->add_att("long_name", varFullName) ) {
std::cout << "In FileHandler::addConst: full name definition failed for ";
std::cout << varName << " ( full name: [" << varFullName << "]) in ";
std::cout << fileName << "\n";
return NC_ERROR;
}
/* Write the variable data.
* The arrays of data are the same size as the netCDF variables we have defined,
* and below we write it in one step */
if ( !var->put(inputVar, size) ) {
std::cout << "In FileHandler::addConst: writing constant failed for ";
std::cout << varName << " in " << fileName << "\n";
return NC_ERROR;
}
if ( verbose ) {
std::cout << " -> Constant " << varName << " has been written to ";
std::cout << fileName << "!" << "\n";
}
return NC_SUCCESS;
} /* End of FileHandler::addConst */
template <class T>
int FileHandler::addVar( NcFile &dataFile, T *inputVar, \
const char* varName, const NcDim *varDim, \
const char* type, const char* unit, \
const char* varFullName, const bool verbose ) const
{
/* Convert input type to netCDF type */
NcType varType;
if ( strcmp(type, "double") == 0 ) {
varType = ncDouble;
} else if ( strcmp(type, "float") == 0 ) {
varType = ncFloat;
} else if ( strcmp(type, "long") == 0 ) {
varType = ncLong;
} else if ( strcmp(type, "int") == 0 ) {
varType = ncInt;
} else if ( strcmp(type, "short") == 0 ) {
varType = ncShort;
} else if ( strcmp(type, "char") == 0 ) {
varType = ncChar;
} else if ( strcmp(type, "byte") == 0 ) {
varType = ncByte;
} else {
varType = ncNoType;
std::cout << "In FileHandler::addVar: varType takes an undefined value.";
std::cout << " varType: " << varType << " in " << fileName << "\n";
return NC_ERROR;
}
/* Create netCDF variables which hold the actual specified variable */
NcVar *var;
if ( !(var = dataFile.add_var( varName, varType, varDim )) ) {
std::cout << "In FileHandler::addVar: defining variable failed for ";
std::cout << varName << " in " << fileName << "\n";
return NC_ERROR;
}
/* Define unit attributes for variables.
* This attaches a text attribute to each of the coordinate variables,
* containing the unit */
if ( !var->add_att("unit", unit) ) {
std::cout << "In FileHandler::addVar: unit definition failed for ";
std::cout << varName << " ( unit: [" << unit << "]) in ";
std::cout << fileName << "\n";
return NC_ERROR;
}
/* Define long name attributes for variables.
* This attaches a text attribute to each of the coordinate variables,
* containing the long name */
if ( !var->add_att("long_name", varFullName) ) {
std::cout << "In FileHandler::addVar: full name definition failed for ";
std::cout << varName << " ( full name: [" << varFullName << "]) in ";
std::cout << fileName << "\n";
return NC_ERROR;
}
/* Write the variable data.
* The arrays of data are the same size as the netCDF variables we have defined,
* and below we write it in one step */
if ( !var->put( inputVar, varDim->size() ) ) {
std::cout << "In FileHandler::addVar: writing variable failed for ";
std::cout << varName << " in " << fileName << "\n";
return NC_ERROR;
}
if ( verbose ) {
std::cout << " -> Variable " << varName << " has been written to ";
std::cout << fileName << "!" << "\n";
}
return NC_SUCCESS;
} /* End of FileHandler::addVar */
template <class T>
int FileHandler::addVar2D( NcFile &dataFile, T *inputVar, \
const char* varName, const NcDim *varDim1, \
const NcDim *varDim2, const char* type, \
const char* unit, const char* varFullName, \
const bool verbose ) const
{
/* Convert input type to netCDF type */
NcType varType;
if ( strcmp(type, "double") == 0 ) {
varType = ncDouble;
} else if ( strcmp(type, "float") == 0 ) {
varType = ncFloat;
} else if ( strcmp(type, "long") == 0 ) {
varType = ncLong;
} else if ( strcmp(type, "int") == 0 ) {
varType = ncInt;
} else if ( strcmp(type, "short") == 0 ) {
varType = ncShort;
} else if ( strcmp(type, "char") == 0 ) {
varType = ncChar;
} else if ( strcmp(type, "byte") == 0 ) {
varType = ncByte;
} else {
varType = ncNoType;
std::cout << "In FileHandler::addVar2D: varType takes an undefined value.";
std::cout << " varType: " << varType << " in " << fileName << "\n";
return NC_ERROR;
}
/* Create netCDF variables which hold the actual specified variable */
NcVar *var;
if ( !(var = dataFile.add_var( varName, varType, varDim1, varDim2 )) ) {
std::cout << "In FileHandler::addVar2D: defining variable failed for ";
std::cout << varName << " in " << fileName << "\n";
return NC_ERROR;
}
/* Define unit attributes for variables.
* This attaches a text attribute to each of the coordinate variables,
* containing the unit */
if ( !var->add_att("unit", unit) ) {
std::cout << "In FileHandler::addVar2D: unit definition failed for ";
std::cout << varName << " ( unit: [" << unit << "]) in ";
std::cout << fileName << "\n";
return NC_ERROR;
}
/* Define long name attributes for variables.
* This attaches a text attribute to each of the coordinate variables,
* containing the long name */
if ( !var->add_att("long_name", varFullName) ) {
std::cout << "In FileHandler::addVar2D: full name definition failed for ";
std::cout << varName << " ( full name: [" << varFullName << "]) in ";
std::cout << fileName << "\n";
return NC_ERROR;
}
/* Write the variable data.
* The arrays of data are the same size as the netCDF variables we have defined,
* and below we write it in one step */
if ( !var->put( inputVar, varDim1->size(), varDim2->size() ) ) {
std::cout << "In FileHandler::addVar2D: writing variable failed for ";
std::cout << varName << " in " << fileName << "\n";
return NC_ERROR;
}
if ( verbose ) {
std::cout << " -> Variable " << varName << " has been written to ";
std::cout << fileName << "!" << "\n";
}
return NC_SUCCESS;
} /* End of FileHandler::addVar2D */
template <class T>
int FileHandler::addVar3D( NcFile &dataFile, T *inputVar, \
const char* varName, const NcDim *varDim1, \
const NcDim *varDim2, const NcDim *varDim3, \
const char* type, const char* unit, \
const char* varFullName, \
const bool verbose ) const
{
/* Convert input type to netCDF type */
NcType varType;
if ( strcmp(type, "double") == 0 ) {
varType = ncDouble;
} else if ( strcmp(type, "float") == 0 ) {
varType = ncFloat;
} else if ( strcmp(type, "long") == 0 ) {
varType = ncLong;
} else if ( strcmp(type, "int") == 0 ) {
varType = ncInt;
} else if ( strcmp(type, "short") == 0 ) {
varType = ncShort;
} else if ( strcmp(type, "char") == 0 ) {
varType = ncChar;
} else if ( strcmp(type, "byte") == 0 ) {
varType = ncByte;
} else {
varType = ncNoType;
std::cout << "In FileHandler::addVar3D: varType takes an undefined value.";
std::cout << " varType: " << varType << " in " << fileName << "\n";
return NC_ERROR;
}
/* Create netCDF variables which hold the actual specified variable */
NcVar *var;
if ( !(var = dataFile.add_var( varName, varType, varDim1, varDim2, \
varDim3 )) ) {
std::cout << "In FileHandler::addVar3D: defining variable failed for ";
std::cout << varName << " in " << fileName << "\n";
return NC_ERROR;
}
/* Define unit attributes for variables.
* This attaches a text attribute to each of the coordinate variables,
* containing the unit */
if ( !var->add_att("unit", unit) ) {
std::cout << "In FileHandler::addVar3D: unit definition failed for ";
std::cout << varName << " ( unit: [" << unit << "]) in ";
std::cout << fileName << "\n";
return NC_ERROR;
}
/* Define long name attributes for variables.
* This attaches a text attribute to each of the coordinate variables,
* containing the long name */
if ( !var->add_att("long_name", varFullName) ) {
std::cout << "In FileHandler::addVar3D: full name definition failed for ";
std::cout << varName << " ( full name: [" << varFullName << "]) in ";
std::cout << fileName << "\n";
return NC_ERROR;
}
/* Write the variable data.
* The arrays of data are the same size as the netCDF variables we have defined,
* and below we write it in one step */
if ( !var->put( inputVar, varDim1->size(), varDim2->size(), \
varDim3->size() ) ) {
std::cout << "In FileHandler::addVar3D: writing variable failed for ";
std::cout << varName << " in " << fileName << "\n";
return NC_ERROR;
}
if ( verbose ) {
std::cout << " -> Variable " << varName << " has been written to ";
std::cout << fileName << "!" << "\n";
}
return NC_SUCCESS;
} /* End of FileHandler::addVar3D */
template <class T>
int FileHandler::addVar4D( NcFile &dataFile, T *inputVar, \
const char* varName, const NcDim *varDim1, \
const NcDim *varDim2, const NcDim *varDim3, \
const NcDim *varDim4, const char* type, \
const char* unit, const char* varFullName, \
const bool verbose ) const
{
/* Convert input type to netCDF type */
NcType varType;
if ( strcmp(type, "double") == 0 ) {
varType = ncDouble;
} else if ( strcmp(type, "float") == 0 ) {
varType = ncFloat;
} else if ( strcmp(type, "long") == 0 ) {
varType = ncLong;
} else if ( strcmp(type, "int") == 0 ) {
varType = ncInt;
} else if ( strcmp(type, "short") == 0 ) {
varType = ncShort;
} else if ( strcmp(type, "char") == 0 ) {
varType = ncChar;
} else if ( strcmp(type, "byte") == 0 ) {
varType = ncByte;
} else {
varType = ncNoType;
std::cout << "In FileHandler::addVar4D: varType takes an undefined value.";
std::cout << "varType: " << varType << " in " << fileName << "\n";
return NC_ERROR;
}
/* Create netCDF variables which hold the actual specified variable */
NcVar *var;
if ( !(var = dataFile.add_var( varName, varType, varDim1, varDim2, \
varDim3, varDim4 )) ) {
std::cout << "In FileHandler::addVar4D: defining variable failed for ";
std::cout << varName << " in " << fileName << "\n";
return NC_ERROR;
}
/* Define unit attributes for variables.
* This attaches a text attribute to each of the coordinate variables,
* containing the unit */
if ( !var->add_att("unit", unit) ) {
std::cout << "In FileHandler::addVar4D: unit definition failed for ";
std::cout << varName << " ( unit: [" << unit << "]) in ";
std::cout << fileName << "\n";
return NC_ERROR;
}
/* Define long name attributes for variables.
* This attaches a text attribute to each of the coordinate variables,
* containing the long name */
if ( !var->add_att("long_name", varFullName) ) {
std::cout << "In FileHandler::addVar4D: full name definition failed for ";
std::cout << varName << " ( full name: [" << varFullName << "]) in ";
std::cout << fileName << "\n";
return NC_ERROR;
}
/* Write the variable data.
* The arrays of data are the same size as the netCDF variables we have defined,
* and below we write it in one step */
if ( !var->put( inputVar, varDim1->size(), varDim2->size(), \
varDim3->size(), varDim4->size() ) ) {
std::cout << "In FileHandler::addVar4D: writing variable failed for ";
std::cout << varName << " in " << fileName << "\n";
return NC_ERROR;
}
if ( verbose ) {
std::cout << " -> Variable " << varName << " has been written to ";
std::cout << fileName << "!" << "\n";
}
return NC_SUCCESS;
} /* End of FileHandler::addVar4D */
int FileHandler::addAtt( NcFile &dataFile, const char* attName, \
const char* attValue ) const
{
if ( !dataFile.add_att( attName, attValue ) ) {
std::cout << "In FileHandler::addAtt: adding attribute ";
std::cout << attName << " with value " << attValue << "failed! \n";
return NC_ERROR;
}
return NC_SUCCESS;
} /* End of FileHandler::addAtt */
NcVar* FileHandler::getVar( NcFile &dataFile, const char* varName ) const
{
NcVar* var;
/* Give back a pointer to the requested NcVar */
if ( !(var = dataFile.get_var( varName )) ) {
std::cout << "In FileHandler::getVar: getting variable ";
std::cout << varName << " failed for " << fileName << "\n";
}
return var;
} /* End of FileHandler::getVar */
char* FileHandler::getAtt( NcVar* var ) const
{
/* Each of the netCDF variables has a "unit" attribute */
NcAtt *att;
char *unit;
if ( !(att = var->get_att("unit")) ) {
std::cout << "In FileHandler::getAtt: getting atribute 'unit' failed in ";
std::cout << fileName << "\n";
}
unit = att->as_string(0);
delete att;
return unit;
} /* End of FileHandler::getAtt */
const char* FileHandler::getFileName( ) const
{
return fileName;
} /* End of FileHandler::getFileName */
bool FileHandler::isFileOpen( ) const
{
return isOpen;
} /* End of FileHandler::isOpen */
template int FileHandler::addVar<double>( NcFile &dataFile, double *inputVar, \
const char* varName, const NcDim *varDim, \
const char* type, const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar<int>( NcFile &dataFile, int *inputVar, \
const char* varName, const NcDim *varDim, \
const char* type, const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar<float>( NcFile &dataFile, float *inputVar, \
const char* varName, const NcDim *varDim, \
const char* type, const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addConst<double>( NcFile &dataFile, double *inputVar, \
const char* varName, long size, \
const char* type, const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addConst<int>( NcFile &dataFile, int *inputVar, \
const char* varName, long size, \
const char* type, const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addConst<float>( NcFile &dataFile, float *inputVar, \
const char* varName, long size, \
const char* type, const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar2D<double>( NcFile &dataFile, double *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar2D<int>( NcFile &dataFile, int *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar2D<float>( NcFile &dataFile, float *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar3D<double>( NcFile &dataFile, double *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar3D<int>( NcFile &dataFile, int *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar3D<float>( NcFile &dataFile, float *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar4D<double>( NcFile &dataFile, double *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const NcDim *varDim4, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar4D<int>( NcFile &dataFile, int *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const NcDim *varDim4, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar4D<float>( NcFile &dataFile, float *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const NcDim *varDim4, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar<const double>( NcFile &dataFile, \
const double *inputVar, \
const char* varName, \
const NcDim *varDim, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar<const int>( NcFile &dataFile, \
const int *inputVar, \
const char* varName, \
const NcDim *varDim, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar<const float>( NcFile &dataFile, \
const float *inputVar, \
const char* varName, \
const NcDim *varDim, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addConst<const double>( NcFile &dataFile, \
const double *inputVar, \
const char* varName, \
long size, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addConst<const int>( NcFile &dataFile, \
const int *inputVar, \
const char* varName, \
long size, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addConst<const float>( NcFile &dataFile, \
const float *inputVar, \
const char* varName, \
long size, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar2D<const double>( NcFile &dataFile, \
const double *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar2D<const int>( NcFile &dataFile, \
const int *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar2D<const float>( NcFile &dataFile, \
const float *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar3D<const double>( NcFile &dataFile, \
const double *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar3D<const int>( NcFile &dataFile, \
const int *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar3D<const float>( NcFile &dataFile, \
const float *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar4D<const double>( NcFile &dataFile, \
const double *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const NcDim *varDim4, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar4D<const int>( NcFile &dataFile, \
const int *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const NcDim *varDim4, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
template int FileHandler::addVar4D<const float>( NcFile &dataFile, \
const float *inputVar, \
const char* varName, \
const NcDim *varDim1, \
const NcDim *varDim2, \
const NcDim *varDim3, \
const NcDim *varDim4, \
const char* type, \
const char* unit, \
const char* varFullName, \
const bool verbose ) const;
/* End of FileHandler.cpp */
| 44.961415 | 85 | 0.399604 | [
"object",
"model"
] |
27ea1b066c760853dbe609a39c7e8ecafa3662c8 | 78,415 | cpp | C++ | test/shape_tester/ShapeTester.cpp | cxwx/VecGeom | c86c00bd7d4db08f4fc20a625020da329784aaac | [
"ECL-2.0",
"Apache-2.0"
] | 1 | 2020-06-27T18:43:36.000Z | 2020-06-27T18:43:36.000Z | test/shape_tester/ShapeTester.cpp | cxwx/VecGeom | c86c00bd7d4db08f4fc20a625020da329784aaac | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | test/shape_tester/ShapeTester.cpp | cxwx/VecGeom | c86c00bd7d4db08f4fc20a625020da329784aaac | [
"ECL-2.0",
"Apache-2.0"
] | null | null | null | //
// Implementation of the batch solid test
//
#include "VecGeom/base/RNG.h"
#include <iomanip>
#include <sstream>
#include <ctime>
#include <vector>
#include <iostream>
#include <fstream>
#include "ShapeTester.h"
#include "VecGeom/volumes/PlacedVolume.h"
#include "VecGeom/base/Transformation3D.h"
#include "VecGeom/base/Vector3D.h"
#include "VecGeom/volumes/Box.h"
#ifdef VECGEOM_ROOT
#include "TGraph2D.h"
#include "TCanvas.h"
#include "TApplication.h"
#include "TGeoManager.h"
#include "TPolyMarker3D.h"
#include "TRandom3.h"
#include "TColor.h"
#include "TROOT.h"
#include "TAttMarker.h"
#include "TGraph.h"
#include "TLegend.h"
#include "TH1D.h"
#include "TH2F.h"
#include "TF1.h"
#include "TVirtualPad.h"
#include "TView3D.h"
#include "VecGeom/management/RootGeoManager.h"
#endif
using namespace std;
using namespace vecgeom;
/* The definitions of core ShapeTester functions are not modified,
* Only duplicate tests which are now implemented in Convention checker
* are removed. These are basically tests for wrong side points.
*
*/
template <typename ImplT>
ShapeTester<ImplT>::ShapeTester()
{
SetDefaults();
}
template <typename ImplT>
ShapeTester<ImplT>::~ShapeTester()
{
}
template <typename ImplT>
void ShapeTester<ImplT>::SetDefaults()
{
fNumDisp = 2;
fMaxPoints = 10000;
fVerbose = 1;
fInsidePercent = 100.0 / 3;
fOutsidePercent = 100.0 / 3;
fEdgePercent = 0;
fOutsideMaxRadiusMultiple = 10;
fOutsideRandomDirectionPercent = 50;
fIfSaveAllData = false;
fDefinedNormal = false;
fIfException = false;
fMethod = "all";
fVolume = NULL;
fGCapacitySampled = 0;
fGCapacityError = 0;
fGCapacityAnalytical = 0;
fGNumberOfScans = 15;
//
// Zero error list
//
fErrorList = 0;
fVisualize = false;
fSolidTolerance = vecgeom::kTolerance;
fStat = false;
fTestBoundaryErrors = true;
fDebug = false;
}
template <typename ImplT>
void ShapeTester<ImplT>::EnableDebugger(bool val)
{
fVisualize = val;
}
template <typename ImplT>
Vec_t ShapeTester<ImplT>::GetRandomDirection()
{
double phi = 2. * kPi * fRNG.uniform();
double theta = vecgeom::ACos(1. - 2. * fRNG.uniform());
double vx = std::sin(theta) * std::cos(phi);
double vy = std::sin(theta) * std::sin(phi);
double vz = std::cos(theta);
Vec_t vec(vx, vy, vz);
vec.Normalize();
return vec;
}
template <typename ImplT>
Vec_t ShapeTester<ImplT>::GetPointOnOrb(double r)
{
double phi = 2. * kPi * fRNG.uniform();
double theta = vecgeom::ACos(1. - 2. * fRNG.uniform());
double vx = std::sin(theta) * std::cos(phi);
double vy = std::sin(theta) * std::sin(phi);
double vz = std::cos(theta);
Vec_t vec(vx, vy, vz);
vec.Normalize();
vec = vec * r;
return vec;
}
// DONE: all set point Methods are performance equivalent
template <typename ImplT>
int ShapeTester<ImplT>::TestBoundaryPrecision(int mode)
{
// Testing of boundary precision.
// Supported modes:
// 0 - default mode computing a boundary tolerance standard deviation
// averaged on random directions and distances
int nsamples = 1000;
int errCode = 0;
int nError = 0;
constexpr int ndist = 8;
double dtest;
double maxerr;
double ndotvmin = 0.2; // avoid directions parallel to surface
std::cout << "# Testing boundary precision\n";
double x[ndist];
#ifdef VECGEOM_ROOT
double y[ndist];
TCanvas *cerrors = new TCanvas("cerrors", "Boundary precision", 1200, 800);
TLegend *legend = new TLegend(0.12, 0.75, 0.32, 0.87);
legend->SetLineColor(0);
#endif
// Generate several "move away" distances
dtest = 1.e-3;
for (int idist = 0; idist < ndist; ++idist) {
maxerr = 0.;
dtest *= 10.;
x[idist] = dtest;
for (int i = 0; i < fMaxPointsSurface + fMaxPointsEdge; ++i) {
// Initial point on surface.
Vec_t point = fPoints[fOffsetSurface + i];
// Make sure point is on surface
if (fVolume->Inside(point) != vecgeom::EInside::kSurface) {
// Do not report the error here - it is tested in TestSurfacePoint
continue;
}
// Compute normal to surface in this point
Vec_t norm, v;
bool valid = fVolume->Normal(point, norm);
if (!valid) continue;
// Test boundary tolerance when coming from outside from distance = 1.
for (int isample = 0; isample < nsamples; ++isample) {
// Generate a random direction outwards the solid, then
// move the point from boundary outwards with distance = 1, making sure
// that the new point lies outside.
Vec_t pout;
int ntries = 0;
while (1) {
if (ntries == 1000) {
errCode = 1; // do we have a rule coding the error number?
ReportError(&nError, point, norm, 1.,
"TBE: Cannot reach outside from surface when "
"propagating with unit distance after 1000 tries.");
return errCode;
}
ntries++;
// Random direction outwards
v = GetRandomDirection();
if (norm.Dot(v) < ndotvmin) continue;
// Move the point from boundary outwards with distance = dtest.
pout = point + dtest * v;
// Cross-check that the point is actually outside
if (fVolume->Inside(pout) == vecgeom::EInside::kOutside) break;
}
// Compute distance back to boundary.
double dunit = fVolume->DistanceToIn(pout, -v);
// Compute rounded boundary error (along normal)
double error = (dunit - dtest) * norm.Dot(v);
// Ignore large errors which can be due to missing the shape or by
// shooting from inner boundaries
if (Abs(error) < 1.e-1 && Abs(error) > maxerr) maxerr = Abs(error);
}
}
#ifdef VECGEOM_ROOT
y[idist] = maxerr;
#endif
std::cout << "== error[dist = " << x[idist] << "] = " << maxerr << std::endl;
}
#ifdef VECGEOM_ROOT
TGraph *grerrdist = new TGraph(ndist, x, y);
grerrdist->SetTitle("DistanceToIn error on boundary propagation");
grerrdist->GetXaxis()->SetTitle("distance (internal unit)");
grerrdist->GetYaxis()->SetTitle("Max sampled propagation error");
cerrors->SetGridy();
cerrors->SetLogx();
cerrors->SetLogy();
grerrdist->Draw("AL*");
grerrdist->SetMarkerColor(kRed);
grerrdist->SetMarkerSize(2);
grerrdist->SetMarkerStyle(20);
grerrdist->SetLineColor(kRed);
grerrdist->SetLineWidth(2);
// grerrdist->GetYaxis()->SetRangeUser(1.e-16,1.e-1);
// legend->AddEntry(grerrdist, fVolume->GetEntityType().c_str(), "lpe");
legend->Draw();
char name[100];
// sprintf(name, "%s_errors.gif", fVolume->GetEntityType().c_str());
cerrors->SaveAs(name);
// sprintf(name, "%s_errors.root", fVolume->GetEntityType().c_str());
cerrors->SaveAs(name);
#endif
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::TestConsistencySolids()
{
int errCode = 0;
std::cout << "% Performing CONSISTENCY TESTS: ConsistencyTests for Inside, Outside and Surface fPoints " << std::endl;
errCode += TestInsidePoint();
errCode += TestOutsidePoint();
errCode += TestSurfacePoint();
if (fIfSaveAllData) {
Vec_t point;
for (int i = 0; i < fMaxPoints; i++) {
point = fPoints[i];
Inside_t inside = fVolume->Inside(point);
fResultDouble[i] = (double)inside;
}
SaveResultsToFile("Inside");
}
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::ShapeNormal()
{
int errCode = 0;
int nError = 0;
ClearErrors();
int i;
int numTrials = 1000;
#ifdef VECGEOM_ROOT
// Visualisation
TPolyMarker3D *pm2 = 0;
pm2 = new TPolyMarker3D();
pm2->SetMarkerSize(0.02);
pm2->SetMarkerColor(kBlue);
#endif
Vec_t minExtent, maxExtent;
fVolume->Extent(minExtent, maxExtent);
double maxX = std::max(std::fabs(maxExtent.x()), std::fabs(minExtent.x()));
double maxY = std::max(std::fabs(maxExtent.y()), std::fabs(minExtent.y()));
double maxZ = std::max(std::fabs(maxExtent.z()), std::fabs(minExtent.z()));
double maxXYZ = 2 * std::sqrt(maxX * maxX + maxY * maxY + maxZ * maxZ);
double step = maxXYZ * fSolidTolerance;
for (i = 0; i < fMaxPointsInside; i++) {
// Initial point is inside
Vec_t point = fPoints[i + fOffsetInside];
Vec_t dir = fDirections[i + fOffsetInside];
Vec_t norm = false;
bool convex = false;
Inside_t inside;
int count = 0;
double dist = CallDistanceToOut(fVolume, point, dir, norm, convex);
// Propagate on boundary
point = point + dist * dir;
for (int j = 0; j < numTrials; j++) {
Vec_t dir_new;
do {
// Generate a random direction from the point on boundary
dir_new = GetRandomDirection();
// We expect that if we propagate with the shape tolerance
// corrected by the shooting distance, at least on some directions
// the new point will be inside
inside = fVolume->Inside(point + dir_new * step);
count++;
} while ((inside != vecgeom::EInside::kInside) && (count < 1000));
if (count >= 1000) {
ReportError(&nError, point, dir_new, 0,
"SN: Cannot reach inside solid "
"from point on boundary after propagation with tolerance after 1000 trials");
break;
}
count = 0;
// Propagate the point to new location close to boundary, but inside
point += dir_new * step;
// Now shoot along the direction that just crossed the surface and expect
// to find a distance bigger than the tolerance
dist = CallDistanceToOut(fVolume, point, dir_new, norm, convex);
if (dist < kTolerance) {
ReportError(&nError, point, dir_new, dist,
"SN: DistanceToOut has to be bigger than tolerance for point Inside");
}
// Distance to exit should not be infinity
if (dist >= kInfLength) {
ReportError(&nError, point, dir_new, dist, "SN: DistanceToOut has to be finite number");
}
// The normal vector direction at the exit point has to point outwards
double dot = norm.Dot(dir_new);
if (dot < 0.) {
ReportError(&nError, point, dir_new, dot, "SN: Wrong direction of Normal calculated by DistanceToOut");
}
// Propagate the point to the exiting surface and compute normal vector
// using the Normal method
point = point + dist * dir_new;
if (fDefinedNormal) {
Vec_t normal;
bool valid = fVolume->Normal(point, normal);
if (!valid) ReportError(&nError, point, dir_new, 0, "SN: Normal has to be valid for point on the Surface");
dot = normal.Dot(dir_new);
// Normal has to point outwards
if (dot < 0.) {
ReportError(&nError, point, dir_new, dot, "SN: Wrong direction of Normal calculated by Normal");
}
}
#ifdef VECGEOM_ROOT
// visualisation
pm2->SetNextPoint(point.x(), point.y(), point.z());
#endif
// Check if exiting point is actually on surface
if (fVolume->Inside(point) == vecgeom::EInside::kOutside) {
ReportError(&nError, point, dir_new, 0, "SN: DistanceToOut is overshooting, new point must be on the Surface");
break;
}
if (fVolume->Inside(point) == vecgeom::EInside::kInside) {
ReportError(&nError, point, dir_new, 0,
"SN: DistanceToOut is undershooting, new point must be on the Surface");
break;
}
// Compute safety from point on boundary - they should be no more than
// the solid tolerance
double safFromIn = fVolume->SafetyToOut(point);
double safFromOut = fVolume->SafetyToIn(point);
if (safFromIn > fSolidTolerance)
ReportError(&nError, point, dir_new, safFromIn, "SN: SafetyToOut must be less than tolerance on Surface ");
if (safFromOut > fSolidTolerance)
ReportError(&nError, point, dir_new, safFromOut,
"SN: SafetyFromOutside must be less than tolerance on Surface");
}
}
#ifdef VECGEOM_ROOT
// visualisation
if (fStat) {
new TCanvas("shape03", "ShapeNormals", 1000, 800);
pm2->Draw();
}
#endif
std::cout << "% " << std::endl;
std::cout << "% TestShapeNormal reported = " << CountErrors() << " errors" << std::endl;
std::cout << "% " << std::endl;
if (CountErrors()) errCode = 256; // errCode: 0001 0000 0000
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::ShapeDistances()
{
int errCode = 0;
int i;
int nError = 0;
ClearErrors();
double maxDifOut = 0, maxDifIn = 0., delta = 0., tolerance = fSolidTolerance;
bool convex = false, convex2 = false;
bool globalConvex = true;
if (dynamic_cast<VPlacedVolume const *>(fVolume)) {
globalConvex = static_cast<VPlacedVolume const *>(fVolume)->GetUnplacedVolume()->IsConvex();
std::cout << "globalConvex = " << globalConvex << std::endl;
}
Vec_t norm;
Vec_t minExtent, maxExtent;
fVolume->Extent(minExtent, maxExtent);
double maxX = std::max(std::fabs(maxExtent.x()), std::fabs(minExtent.x()));
double maxY = std::max(std::fabs(maxExtent.y()), std::fabs(minExtent.y()));
double maxZ = std::max(std::fabs(maxExtent.z()), std::fabs(minExtent.z()));
double maxXYZ = 2 * std::sqrt(maxX * maxX + maxY * maxY + maxZ * maxZ);
double dmove = maxXYZ;
#ifdef VECGEOM_ROOT
// Histograms
TH1D *hist1 = new TH1D("Residual", "Residual DistancetoIn/Out", 200, -20, 0);
hist1->GetXaxis()->SetTitle("delta[mm] - first bin=overflow");
hist1->GetYaxis()->SetTitle("count");
hist1->SetMarkerStyle(kFullCircle);
TH1D *hist2 = new TH1D("AccuracyIn", "Accuracy distanceToIn for Points near Surface", 200, -20, 0);
hist2->GetXaxis()->SetTitle("delta[mm] - first bin=overflow");
hist2->GetYaxis()->SetTitle("count");
hist2->SetMarkerStyle(kFullCircle);
TH1D *hist3 = new TH1D("AccuracyOut", "Accuracy distanceToOut for Points near Surface", 200, -20, 0);
hist3->GetXaxis()->SetTitle("delta[mm] - first bin=overflow");
hist3->GetYaxis()->SetTitle("count");
hist3->SetMarkerStyle(kFullCircle);
#endif
for (i = 0; i < fMaxPointsInside; i++) {
// Take initial point inside
Vec_t point = fPoints[i + fOffsetInside];
Vec_t dir = fDirections[i + fOffsetInside];
// Compute distance to outside
double DistanceOut2 = CallDistanceToOut(fVolume, point, dir, norm, convex2);
// Compute a new point before boundary
/*
Instead of creating new point like
point + dir * DistanceOut2 * (1. - 10 * tolerance);
better way is to take the point to surface and then move it back by
required distance, otherwise for some of the shapes like Hype and Cone
It will give "DistanceToOut is not precise", or "DistanceToIn is not precise"
error
*/
Vec_t pointSurf = point + dir * DistanceOut2;
Vec_t pointIn = pointSurf - dir * 10 * tolerance;
// Compute distance to outside from pointIn
double DistanceOut = CallDistanceToOut(fVolume, pointIn, dir, norm, convex);
// Compute a new point just after the boundary outside
Vec_t pointOut = pointSurf + dir * 10 * tolerance;
// Now shoot in the opposite direction and compute distance to inside
double DistanceIn = fVolume->DistanceToIn(pointOut, -dir);
// The distances to the boindary from points near boundary should be small
if (DistanceOut > 1000. * tolerance)
ReportError(&nError, pointIn, dir, DistanceOut, "SD: DistanceToOut is not precise");
if (DistanceIn > 1000. * tolerance)
ReportError(&nError, pointOut, dir, DistanceIn, "SD: DistanceToIn is not precise ");
// Calculate distances for convex or non-convex cases, from the point
// propagated on surface
double DistanceToInSurf = fVolume->DistanceToIn(point + dir * DistanceOut2, dir);
if (DistanceToInSurf >= kInfLength) {
// The solid is not crossed again, so it may be convex on this surface
// Aim to move the point outside, but not too far
dmove = maxXYZ;
if (globalConvex && !convex2) {
bool matchConvexity = false;
Vec_t pointSurf = point + dir * DistanceOut2;
// To cross-check convexity, shoot randomly in the attempt to cross
// again the solid. Note that this check may fail even if the solid is
// really non-convex on this surface (sampling to be increased)
for (int k = 0; k < 100; k++) {
Vec_t rndDir = GetRandomDirection();
double distTest = fVolume->DistanceToIn(pointSurf, rndDir);
if ((distTest <= kInfLength) && (distTest > fSolidTolerance)) {
matchConvexity = true;
break;
}
}
// #### Check disabled until the check of convexity from DistanceToOut gets
// activated ####
if (!matchConvexity)
ReportError(&nError, point, dir, DistanceToInSurf, "SD: Error in convexity, must be convex");
}
} else {
// Re-entering solid, it is not convex
if (globalConvex && convex2)
ReportError(&nError, point, dir, DistanceToInSurf, "SD: Error in convexity, must be NOT convex");
// Aim to move the point outside, but not re-enter
dmove = DistanceOut2 + DistanceToInSurf * 0.5;
}
// Shoot back to the solid from point moved outside
double DistanceToIn2 = fVolume->DistanceToIn(point + dir * dmove, -dir);
if (maxDifOut < DistanceOut) {
maxDifOut = DistanceOut;
}
if ((fVolume->Inside(pointOut - dir * DistanceIn) != vecgeom::EInside::kOutside) && (maxDifIn < DistanceIn)) {
maxDifIn = DistanceIn;
}
// dmove should be close to the sum between DistanceOut2 and DistanceIn2
double difDelta = dmove - DistanceOut2 - DistanceToIn2;
if (std::fabs(difDelta) > 10. * tolerance)
ReportError(&nError, point, dir, difDelta, "SD: Distances calculation is not precise");
if (difDelta > delta) delta = std::fabs(difDelta);
#ifdef VECGEOM_ROOT
// Histograms
if (std::fabs(difDelta) < 1E-20) difDelta = 1E-30;
if (std::fabs(DistanceIn) < 1E-20) difDelta = 1E-30;
if (std::fabs(DistanceOut) < 1E-20) difDelta = 1E-30;
hist1->Fill(std::max(0.5 * std::log(std::fabs(difDelta)), -20.));
hist2->Fill(std::max(0.5 * std::log(std::fabs(DistanceIn)), -20.));
hist3->Fill(std::max(0.5 * std::log(std::fabs(DistanceOut)), -20.));
#endif
}
if (fVerbose) {
std::cout << "% TestShapeDistances:: Accuracy max for DistanceToOut=" << maxDifOut
<< " from asked accuracy eps=" << 10 * tolerance << std::endl;
std::cout << "% TestShapeDistances:: Accuracy max for DistanceToIn=" << maxDifIn
<< " from asked accuracy eps=" << 10 * tolerance << std::endl;
std::cout << "% TestShapeDistances:: Accuracy max for Delta=" << delta << std::endl;
}
std::cout << "% " << std::endl;
std::cout << "% TestShapeDistances reported = " << CountErrors() << " errors" << std::endl;
std::cout << "% " << std::endl;
if (CountErrors()) errCode = 32; // errCode: 0000 0010 0000
#ifdef VECGEOM_ROOT
// Histograms
if (fStat) {
TCanvas *c4 = new TCanvas("c4", "Residuals DistancsToIn/Out", 800, 600);
c4->Update();
hist1->Draw();
TCanvas *c5 = new TCanvas("c5", "Residuals DistancsToIn", 800, 600);
c5->Update();
hist2->Draw();
TCanvas *c6 = new TCanvas("c6", "Residuals DistancsToOut", 800, 600);
c6->Update();
hist3->Draw();
}
#endif
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::TestNormalSolids()
{
// This saves the result of Normal method to file
int errCode = 0;
Vec_t point, normal;
for (int i = 0; i < fMaxPoints; i++) {
point = fPoints[i];
// bool valid = fVolume->Normal(point, normal);
if (fIfSaveAllData) {
fResultVector[i].Set(normal.x(), normal.y(), normal.z());
std::cout << " fResultsVU[ " << i << "] = " << fResultVector[i] << "\n";
fResultVector[i] = normal;
std::cout << " fResultsVU[ " << i << "] = " << fResultVector[i] << "\n";
}
}
SaveResultsToFile("Normal");
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::TestSafetyFromOutsideSolids()
{
// This saves the result of SafetyFromOutside method to file
int errCode = 0;
std::cout << "% Performing SAFETYFromOUTSIDE TESTS: ShapeSafetyFromOutside " << std::endl;
errCode += ShapeSafetyFromOutside(1000);
if (fIfSaveAllData) {
Vec_t point;
for (int i = 0; i < fMaxPoints; i++) {
point = fPoints[i];
double res = fVolume->SafetyToIn(point);
fResultDouble[i] = res;
}
SaveResultsToFile("SafetyFromOutside");
}
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::TestSafetyFromInsideSolids()
{
// This saves the result of SafetyFromInside method to file
int errCode = 0;
std::cout << "% Performing SAFETYFromINSIDE TESTS: ShapeSafetyFromInside " << std::endl;
errCode += ShapeSafetyFromInside(1000);
if (fIfSaveAllData) {
Vec_t point;
for (int i = 0; i < fMaxPoints; i++) {
point = fPoints[i];
double res = fVolume->SafetyToOut(point);
fResultDouble[i] = res;
}
SaveResultsToFile("SafetyFromInside");
}
return errCode;
}
template <typename ImplT>
void ShapeTester<ImplT>::PropagatedNormalU(const Vec_t &point, const Vec_t &direction, double distance, Vec_t &normal)
{
// Compute surface point and correspondinf surface normal after computing
// the distance to the solid
normal.Set(0);
if (distance < kInfLength) {
Vec_t shift = distance * direction;
Vec_t surfacePoint = point + shift;
fVolume->Normal(surfacePoint, normal);
}
}
template <typename ImplT>
int ShapeTester<ImplT>::TestDistanceToInSolids()
{
// Combined test for DistanceToIn
int errCode = 0;
std::cout << "% Performing DISTANCEtoIn TESTS: ShapeDistances, TestsAccuracyDistanceToIn and TestFarAwayPoint "
<< std::endl;
errCode += ShapeDistances();
errCode += TestAccuracyDistanceToIn(1000.);
errCode += TestFarAwayPoint();
if (fIfSaveAllData) {
Vec_t point, direction;
for (int i = 0; i < fMaxPoints; i++) {
point = fPoints[i];
direction = fDirections[i];
double res = fVolume->DistanceToIn(point, direction);
fResultDouble[i] = res;
Vec_t normal;
PropagatedNormalU(point, direction, res, normal);
fResultVector[i] = normal;
}
SaveResultsToFile("DistanceToIn");
}
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::TestDistanceToOutSolids()
{
// Combined test for DistanceToOut
int errCode = 0;
std::cout << "% Performing DISTANCEtoOUT TESTS: Shape Normals " << std::endl;
errCode += ShapeNormal();
if (fIfSaveAllData) {
Vec_t point, normal, direction;
bool convex = false;
for (int i = 0; i < fMaxPoints; i++) {
point = fPoints[i];
direction = fDirections[i];
normal.Set(0);
double res = CallDistanceToOut(fVolume, point, direction, normal, convex);
fResultDouble[i] = res;
fResultVector[i] = normal;
}
}
SaveResultsToFile("DistanceToOut");
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::TestFarAwayPoint()
{
int errCode = 0;
Vec_t point, point1, vec, direction, normal, pointSurf;
int icount = 0, icount1 = 0, nError = 0;
double distIn, diff, difMax = 0., maxDistIn = 0.;
double tolerance = fSolidTolerance;
ClearErrors();
// for ( int j=0; j<fMaxPointsSurface+fMaxPointsEdge; j++)
for (int j = 0; j < fMaxPointsInside; j++) {
// point = fPoints[j+fOffsetSurface];
// Initial point inside
point = fPoints[j + fOffsetInside];
vec = GetRandomDirection();
// The test below makes no sense: DistanceToIn from inside point should be
// negative, so the full test would be skipped
// if (fVolume->DistanceToIn(point, vec) < kInfLength)
// continue;
point1 = point;
// Move point far away
for (int i = 0; i < 10000; i++) {
point1 = point1 + vec * 10000;
}
// Shoot back to solid, then compute point on surface
distIn = fVolume->DistanceToIn(point1, -vec);
pointSurf = point1 - distIn * vec;
if ((distIn < kInfLength) && (distIn > maxDistIn)) {
maxDistIn = distIn;
}
// Compute error and check against the solid tolerance
diff = std::fabs((point1 - pointSurf).Mag() - distIn);
if (diff > 100 * tolerance) // Note that moving to 10000 we have cut 4 digits, not just 2
icount++;
// If we do not hit back the solid report an error
if (distIn >= kInfLength) {
icount1++;
Vec_t temp = -vec;
ReportError(&nError, point1, temp, diff, "TFA: Point missed Solid (DistanceToIn = Infinity)");
} else {
if (diff > difMax) difMax = diff;
}
}
if (fVerbose) {
std::cout << "% TestFarAwayPoints:: number of Points with big difference (( DistanceToIn- Dist) ) > tolerance ="
<< icount << std::endl;
std::cout << "% Maxdif = " << difMax << " from MaxDist=" << maxDistIn
<< "\n% Number of fPoints missing Solid (DistanceToIn = Infinity) = " << icount1 << std::endl;
}
std::cout << "% " << std::endl;
std::cout << "% TestFarAwayPoints reported = " << CountErrors() << " errors" << std::endl;
std::cout << "% " << std::endl;
if (CountErrors()) errCode = 128; // errCode: 0000 1000 0000
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::TestSurfacePoint()
{
// Combined tests for surface points
int errCode = 0;
Vec_t point, pointSurf, vec, direction, normal;
bool convex = false;
int icount = 0, icount1 = 0;
double distIn, distOut;
int iIn = 0, iInNoSurf = 0, iOut = 0, iOutNoSurf = 0;
double tolerance = fSolidTolerance;
int nError = 0;
ClearErrors();
#ifdef VECGEOM_ROOT
// Visualisation
TPolyMarker3D *pm5 = 0;
pm5 = new TPolyMarker3D();
pm5->SetMarkerStyle(20);
pm5->SetMarkerSize(1);
pm5->SetMarkerColor(kRed);
#endif
for (int i = 0; i < fMaxPointsSurface + fMaxPointsEdge; i++) { // test SamplePointOnSurface()
// Initial point on surface
point = fPoints[fOffsetSurface + i];
#ifdef VECGEOM_ROOT
// visualisation
pm5->SetNextPoint(point.x(), point.y(), point.z());
#endif
if (fVolume->Inside(point) != vecgeom::EInside::kSurface) {
icount++;
Vec_t v(0, 0, 0);
ReportError(&nError, point, v, 0, "TS: Point on not on the Surface");
}
// test if for point on Surface distIn and distOut are not 0 at the same time
Vec_t v = GetRandomDirection();
distIn = fVolume->DistanceToIn(point, v);
distOut = CallDistanceToOut(fVolume, point, v, normal, convex);
if (distIn == 0. && distOut == 0.) {
icount1++;
ReportError(&nError, point, v, 0, "TS: DistanceToIn=DistanceToOut=0 for point on Surface");
}
// test Accuracy distance for fPoints near Surface
// The point may be slightly outside or inside
// GL: use normal rather than an arbitrary vector v, to ensure new point is 10*tolerance away from surface
pointSurf = point + 10 * tolerance * (i % 2 ? normal : -normal);
Inside_t inside = fVolume->Inside(pointSurf);
if (inside != vecgeom::EInside::kSurface) {
if (inside == vecgeom::EInside::kOutside) {
// Shoot randomly from point slightly outside
for (int j = 0; j < 1000; j++) {
vec = GetRandomDirection();
distIn = fVolume->DistanceToIn(pointSurf, vec);
if (distIn < kInfLength) {
iIn++;
// If we hit, propagate on surface and check kSurface
Inside_t surfaceP = fVolume->Inside(pointSurf + distIn * vec);
if (surfaceP != vecgeom::EInside::kSurface) {
iInNoSurf++;
ReportError(&nError, pointSurf, vec, distIn,
"TS: Wrong DistToIn for point near Surface (final point not reported on surface)");
}
}
}
} else {
// Shoot randomly from point slightly inside
for (int j = 0; j < 1000; j++) {
iOut++;
vec = GetRandomDirection();
distOut = CallDistanceToOut(fVolume, pointSurf, vec, normal, convex);
// If we hit, propagate on surface and check kSurface
Inside_t surfaceP = fVolume->Inside(pointSurf + distOut * vec);
if (surfaceP != vecgeom::EInside::kSurface) {
iOutNoSurf++;
ReportError(&nError, pointSurf, vec, distOut,
"TS: Wrong DistToOut for point near Surface (final point not reported on surface)");
}
}
}
}
}
if (fVerbose) {
std::cout << "% TestSurfacePoints SamplePointOnSurface() for Solid " << fVolume->GetName() << " had " << icount
<< " errors" << std::endl;
std::cout << "% TestSurfacePoints both DistanceToIN and DistanceToOut ==0 for " << fVolume->GetName() << " had "
<< icount1 << " errors" << std::endl;
std::cout << "% TestSurfacePoints new moved point is not on Surface::iInNoSurf = " << iInNoSurf
<< "; iOutNoSurf = " << iOutNoSurf << std::endl;
}
#ifdef VECGEOM_ROOT
// visualisation
if (fStat) {
new TCanvas("shape05", "SamplePointOnSurface", 1000, 800);
pm5->Draw();
}
#endif
std::cout << "% " << std::endl;
std::cout << "% Test Surface Point reported = " << CountErrors() << " errors" << std::endl;
std::cout << "% " << std::endl;
if (CountErrors()) errCode = 4; // errCode: 0000 0000 0100
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::TestInsidePoint()
{
// Combined test for inside points
int errCode = 0;
int i, n = fMaxPointsOutside;
int nError = 0;
ClearErrors();
Vec_t minExtent, maxExtent;
fVolume->Extent(minExtent, maxExtent);
double maxX = std::max(std::fabs(maxExtent.x()), std::fabs(minExtent.x()));
double maxY = std::max(std::fabs(maxExtent.y()), std::fabs(minExtent.y()));
double maxZ = std::max(std::fabs(maxExtent.z()), std::fabs(minExtent.z()));
double maxXYZ = 2 * std::sqrt(maxX * maxX + maxY * maxY + maxZ * maxZ);
for (int j = 0; j < fMaxPointsInside; j++) {
// Check values of Safety
// Initial point inside
Vec_t point = fPoints[j + fOffsetInside];
double safeDistance = fVolume->SafetyToOut(point);
// Safety from inside should be positive
if (safeDistance <= 0.0) {
Vec_t zero(0);
ReportError(&nError, point, zero, safeDistance, "TI: SafetyToOut(p) <= 0");
if (CountErrors()) errCode = 1; // errCode: 0000 0000 0001
return errCode;
}
// Safety from wrong side should be negative
double safeDistanceFromOut = fVolume->SafetyToIn(point);
if (safeDistanceFromOut >= 0.0) {
std::string message("TI: SafetyFromOutside(p) should be Negative value (-1.) for Points Inside");
Vec_t zero(0);
ReportError(&nError, point, zero, safeDistanceFromOut, message.c_str());
continue;
}
// Check values of Extent
// Every point inside should be also within the extent
if (point.x() < minExtent.x() || point.x() > maxExtent.x() || point.y() < minExtent.y() ||
point.y() > maxExtent.y() || point.z() < minExtent.z() || point.z() > maxExtent.z()) {
Vec_t zero(0);
ReportError(&nError, point, zero, safeDistance, "TI: Point is outside Extent");
}
// Check values with fPoints and fDirections to outside fPoints
for (i = 0; i < n; i++) {
Vec_t vr = fPoints[i + fOffsetOutside] - point;
Vec_t v = vr.Unit();
bool valid = false, convex = false;
Vec_t norm;
// Shoot towards outside point and compute distance to out
double dist = CallDistanceToOut(fVolume, point, v, norm, convex);
double NormalDist;
NormalDist = fVolume->SafetyToOut(point);
// Distance to out has to be always smaller than the extent diagonal
if (dist > maxXYZ) {
ReportError(&nError, point, v, dist, "TI: DistanceToOut(p,v) > Solid's Extent dist = ");
continue;
}
// Distance to out has to be positive
if (dist <= 0) {
ReportError(&nError, point, v, NormalDist, "TI: DistanceToOut(p,v) <= 0 Normal Dist = ");
continue;
}
// Distance to out cannot be infinite
if (dist >= kInfLength) {
ReportError(&nError, point, v, safeDistance, "TI: DistanceToOut(p,v) == kInfLength");
continue;
}
// Distance to out from inside point should be bigger than the safety
if (dist < safeDistance - 1E-10) {
ReportError(&nError, point, v, safeDistance, "TI: DistanceToOut(p,v) < DistanceToIn(p)");
continue;
}
if (valid) {
// Check outwards condition
if (norm.Dot(v) < 0) {
ReportError(&nError, point, v, safeDistance, "TI: Outgoing normal incorrect");
continue;
}
}
// DistanceToIn from point on wrong side has to be negative
double distIn = fVolume->DistanceToIn(point, v);
if (distIn >= 0.) {
std::string message("TI: DistanceToIn(p,v) has to be negative (-1) for Inside points.");
ReportError(&nError, point, v, distIn, message.c_str());
continue;
}
// Move to the boundary and check
Vec_t p = point + v * dist;
Inside_t insideOrNot = fVolume->Inside(p);
// Propagated point with DistanceToOut has to be on boundary
if (insideOrNot == vecgeom::EInside::kInside) {
ReportError(&nError, point, v, dist, "TI: DistanceToOut(p,v) undershoots");
continue;
}
if (insideOrNot == vecgeom::EInside::kOutside) {
ReportError(&nError, point, v, dist, "TI: DistanceToOut(p,v) overshoots");
continue;
}
Vec_t norm1;
valid = fVolume->Normal(p, norm1);
// Direction of motion should not be inward
if (norm1.Dot(v) < 0) {
if (fVolume->DistanceToIn(p, v) != 0) {
ReportError(&nError, p, v, safeDistance, "TI: SurfaceNormal is incorrect");
}
} // End Check fPoints and fDirections
}
}
std::cout << "% " << std::endl;
std::cout << "% TestInsidePoint reported = " << CountErrors() << " errors" << std::endl;
std::cout << "% " << std::endl;
if (CountErrors()) errCode = 1; // errCode: 0000 0000 0001
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::TestOutsidePoint()
{
// Combined test for outside points
int errCode = 0;
int i, n = fMaxPointsInside;
int nError = 0;
ClearErrors();
for (int j = 0; j < fMaxPointsOutside; j++) {
// std::cout<<"ConsistencyOutside check"<<j<<std::endl;
// Initial point outside
Vec_t point = fPoints[j + fOffsetOutside];
double safeDistance = fVolume->SafetyToIn(point);
// Safety has to be positive
if (safeDistance <= 0.0) {
Vec_t zero(0);
ReportError(&nError, point, zero, safeDistance, "TO: SafetyFromOutside(p) <= 0");
if (CountErrors()) errCode = 2; // errCode: 0000 0000 0010
return errCode;
}
double safeDistanceFromInside = fVolume->SafetyToOut(point);
// Safety from wrong side point has to be negative
if (safeDistanceFromInside >= 0.0) {
std::string msg("TO: SafetyToOut(p) should be Negative value (-1.) for points Outside (VecGeom conv)");
Vec_t zero(0);
// disable this message as it is part of ConventionChecker
ReportError(&nError, point, zero, safeDistanceFromInside, msg.c_str());
}
for (i = 0; i < n; i++) {
// Connecting point inside
Vec_t vr = fPoints[i + fOffsetInside] - point;
Vec_t v = vr.Unit();
double dist = fVolume->DistanceToIn(point, v);
// Distance to inside has to be positive
if (dist <= 0) {
ReportError(&nError, point, v, safeDistance, "TO: DistanceToIn(p,v) <= 0");
continue;
}
// Make sure we hit the solid
if (dist >= kInfLength) {
ReportError(&nError, point, v, safeDistance, "TO: DistanceToIn(p,v) == kInfLength");
continue;
}
// Make sure the distance is bigger than the safety
if (dist < safeDistance - 1E-10) {
ReportError(&nError, point, v, safeDistance, "TO: DistanceToIn(p,v) < DistanceToIn(p)");
continue;
}
// Moving the point to the Surface
Vec_t p = point + dist * v;
Inside_t insideOrNot = fVolume->Inside(p);
// Propagated point has to be on surface
if (insideOrNot == vecgeom::EInside::kOutside) {
ReportError(&nError, point, v, dist, "TO: DistanceToIn(p,v) undershoots");
continue;
}
if (insideOrNot == vecgeom::EInside::kInside) {
ReportError(&nError, point, v, dist, "TO: DistanceToIn(p,v) overshoots");
continue;
}
safeDistance = fVolume->SafetyToIn(p);
// The safety from a boundary should not be bigger than the tolerance
if (safeDistance > fSolidTolerance) {
ReportError(&nError, p, v, safeDistance, "TO2: SafetyToIn(p) should be zero");
continue;
}
safeDistance = fVolume->SafetyToOut(p);
if (safeDistance > fSolidTolerance) {
ReportError(&nError, p, v, safeDistance, "TO2: SafetyToOut(p) should be zero");
continue;
}
dist = fVolume->DistanceToIn(p, v);
safeDistance = fVolume->SafetyToIn(p);
//
// Beware! We might expect dist to be precisely zero, but this may not
// be true at corners due to roundoff of the calculation of p = point + dist*v.
// It should, however, *not* be infinity.
//
if (dist >= kInfLength) {
ReportError(&nError, p, v, dist, "TO2: DistanceToIn(p,v) == kInfLength");
continue;
}
bool valid = false, convex = false;
Vec_t norm;
dist = CallDistanceToOut(fVolume, p, v, norm, convex);
// But distance can be infinity if it is a corner point. Needs to handled carefully.
// For the time being considering that those situation does not happens.
if (dist >= kInfLength) {
ReportError(&nError, p, v, dist, "TO2: DistanceToOut(p,v) == kInfLength");
continue;
} else if (dist < 0) {
ReportError(&nError, p, v, dist, "TO2: DistanceToOut(p,v) < 0");
continue;
}
// Check the exiting normal when going outwards
if (valid) {
if (norm.Dot(v) < 0) {
ReportError(&nError, p, v, dist, "TO2: Outgoing normal incorrect");
continue;
}
}
Vec_t norm1;
valid = fVolume->Normal(p, norm1);
// Check the entering normal when going inwards
if (norm1.Dot(v) > 0) {
ReportError(&nError, p, v, dist, "TO2: Ingoing surfaceNormal is incorrect");
}
Vec_t p2 = p + v * dist;
insideOrNot = fVolume->Inside(p2);
// Propagated point has to be on surface
if (insideOrNot == vecgeom::EInside::kInside) {
ReportError(&nError, p, v, dist, "TO2: DistanceToOut(p,v) undershoots");
continue;
}
if (insideOrNot == vecgeom::EInside::kOutside) {
ReportError(&nError, p, v, dist, "TO2: DistanceToOut(p,v) overshoots");
continue;
}
Vec_t norm2, norm3;
valid = fVolume->Normal(p2, norm2);
// Normal in exit point
if (norm2.Dot(v) < 0) {
if (fVolume->DistanceToIn(p2, v) != 0)
ReportError(&nError, p2, v, dist, "TO2: Outgoing surfaceNormal is incorrect");
}
// Check sign agreement on normals given by Normal and DistanceToOut
if (convex) {
if (norm.Dot(norm2) < 0.0) {
ReportError(&nError, p2, v, dist, "TO2: SurfaceNormal and DistanceToOut disagree on normal");
}
}
if (convex) {
dist = fVolume->DistanceToIn(p2, v);
if (dist == 0) {
//
// We may have grazed a corner, which is a problem of design.
// Check distance out
//
bool convex1 = false;
dist = CallDistanceToOut(fVolume, p2, v, norm3, convex1);
if (dist != 0) {
ReportError(&nError, p, v, dist,
"TO2: DistanceToOut incorrectly returns validNorm==true (line of sight)(c)");
if (nError <= 3) std::cout << "Point on opposite surface: p2=" << p2 << "\n";
continue;
}
} else if (dist != kInfLength) {
// ReportError( &nError, p, v, safeDistance, "TO2: DistanceToOut incorrectly returns validNorm==true (line of
// sight)" );
continue;
}
int k;
for (k = 0; k < n; k++) {
// for (k = 0; k < 10; k++) {
Vec_t p2top = fPoints[k + fOffsetInside] - p2;
if (p2top.Dot(norm) > 0) {
ReportError(&nError, p, v, safeDistance,
"TO2: DistanceToOut incorrectly returns validNorm==true (horizon)");
continue;
}
}
} // if valid normal
} // Loop over inside fPoints
n = fMaxPointsOutside;
// ### The test below seems to be a duplicate - check this ####
for (int l = 0; l < n; l++) {
Vec_t vr = fPoints[l + fOffsetOutside] - point;
if (vr.Mag2() < DBL_MIN) continue;
Vec_t v = vr.Unit();
double dist = fVolume->DistanceToIn(point, v);
if (dist <= 0) {
ReportError(&nError, point, v, dist, "TO3: DistanceToIn(p,v) <= 0");
continue;
}
if (dist >= kInfLength) {
// G4cout << "dist == kInfLength" << G4endl ;
continue;
}
if (dist < safeDistance - 1E-10) {
ReportError(&nError, point, v, safeDistance, "TO3: DistanceToIn(p,v) < DistanceToIn(p)");
continue;
}
Vec_t p = point + dist * v;
Inside_t insideOrNot = fVolume->Inside(p);
if (insideOrNot == vecgeom::EInside::kOutside) {
ReportError(&nError, point, v, dist, "TO3: DistanceToIn(p,v) undershoots");
continue;
}
if (insideOrNot == vecgeom::EInside::kInside) {
ReportError(&nError, point, v, dist, "TO3: DistanceToIn(p,v) overshoots");
continue;
}
} // Loop over outside fPoints
}
std::cout << "% " << std::endl;
std::cout << "% TestOutsidePoint reported = " << CountErrors() << " errors" << std::endl;
std::cout << "% " << std::endl;
if (CountErrors()) errCode = 2; // errCode: 0000 0000 0010
return errCode;
}
//
// Surface Checker
//
template <typename ImplT>
int ShapeTester<ImplT>::TestAccuracyDistanceToIn(double dist)
{
// Test accuracy of DistanceToIn method against required one
int errCode = 0;
Vec_t point, pointSurf, pointIn, v, direction, normal;
bool convex = false;
double distIn, distOut;
double maxDistIn = 0, diff = 0, difMax = 0;
int nError = 0;
ClearErrors();
int iIn = 0, iInNoSurf = 0, iOut = 0, iOutNoSurf = 0;
int iInInf = 0, iInZero = 0;
double tolerance = kTolerance;
#ifdef VECGEOM_ROOT
// Histograms
TH1D *hist10 = new TH1D("AccuracySurf", "Accuracy DistancetoIn", 200, -20, 0);
hist10->GetXaxis()->SetTitle("delta[mm] - first bin=overflow");
hist10->GetYaxis()->SetTitle("count");
hist10->SetMarkerStyle(kFullCircle);
#endif
// test Accuracy distance
for (int i = 0; i < fMaxPointsSurface + fMaxPointsEdge; i++) {
// test SamplePointOnSurface
pointSurf = fPoints[i + fOffsetSurface];
Vec_t vec = GetRandomDirection();
point = pointSurf + vec * dist;
Inside_t inside = fVolume->Inside(point);
if (inside != vecgeom::EInside::kSurface) {
if (inside == vecgeom::EInside::kOutside) {
distIn = fVolume->DistanceToIn(pointSurf, vec);
if (distIn >= kInfLength) {
// Accuracy Test for convex part
distIn = fVolume->DistanceToIn(point, -vec);
if (maxDistIn < distIn) maxDistIn = distIn;
diff = ((pointSurf - point).Mag() - distIn);
if (diff > difMax) difMax = diff;
if (std::fabs(diff) < 1E-20) diff = 1E-30;
#ifdef VECGEOM_ROOT
hist10->Fill(std::max(0.5 * std::log(std::fabs(diff)), -20.));
#endif
}
// Test for consistency for fPoints situated Outside
for (int j = 0; j < 1000; j++) {
vec = GetRandomDirection();
distIn = fVolume->DistanceToIn(point, vec);
distOut = CallDistanceToOut(fVolume, point, vec, normal, convex);
// Test for consistency for fPoints situated Inside
pointIn = pointSurf + vec * 1000. * kTolerance;
if (fVolume->Inside(pointIn) == vecgeom::EInside::kInside) {
double distOut1 = CallDistanceToOut(fVolume, pointIn, vec, normal, convex);
Inside_t surfaceP = fVolume->Inside(pointIn + distOut1 * vec);
if (distOut1 >= kInfLength) {
iInInf++;
ReportError(&nError, pointIn, vec, distOut1, "TAD1: Distance ToOut is Infinity for point Inside");
}
if (std::fabs(distOut1) < tolerance) {
iInZero++;
ReportError(&nError, pointIn, vec, distOut1, "TAD1: Distance ToOut < tolerance for point Inside");
}
iIn++;
if (surfaceP != vecgeom::EInside::kSurface) {
iOutNoSurf++;
ReportError(&nError, pointIn, vec, distOut1, "TAD: Moved to Surface point is not on Surface");
}
}
// Test for consistency for fPoints situated on Surface
if (distIn < kInfLength) {
iIn++;
// Surface Test
Inside_t surfaceP = fVolume->Inside(point + distIn * vec);
if (surfaceP != vecgeom::EInside::kSurface) {
iInNoSurf++;
ReportError(&nError, point, vec, distIn, "TAD: Moved to Solid point is not on Surface");
}
}
}
} else // here for point Inside
{
for (int j = 0; j < 1000; j++) {
iOut++;
vec = GetRandomDirection();
distOut = CallDistanceToOut(fVolume, point, vec, normal, convex);
Inside_t surfaceP = fVolume->Inside(point + distOut * vec);
distIn = fVolume->DistanceToIn(point, vec);
// iWrongSideIn++;
if (distOut >= kInfLength) {
iInInf++;
ReportError(&nError, point, vec, distOut, "TAD2: Distance ToOut is Infinity for point Inside");
}
if (std::fabs(distOut) < tolerance) {
iInZero++;
ReportError(&nError, point, vec, distOut, "TAD2: Distance ToOut < tolerance for point Inside");
}
if (surfaceP != vecgeom::EInside::kSurface) {
iOutNoSurf++;
ReportError(&nError, point, vec, distOut, "TAD2: Moved to Surface point is not on Surface");
}
}
}
}
}
if (fVerbose) {
// Surface
std::cout << "TestAccuracyDistanceToIn::Errors for moved point is not on Surface ::iInNoSurf = " << iInNoSurf
<< "; iOutNoSurf = " << iOutNoSurf << std::endl;
std::cout << "TestAccuracyDistanceToIn::Errors Solid ::From total number of Points = " << iIn << std::endl;
}
#ifdef VECGEOM_ROOT
if (fStat) {
TCanvas *c7 = new TCanvas("c7", "Accuracy DistancsToIn", 800, 600);
c7->Update();
hist10->Draw();
}
#endif
std::cout << "% " << std::endl;
std::cout << "% TestAccuracyDistanceToIn reported = " << CountErrors() << " errors" << std::endl;
std::cout << "% " << std::endl;
if (CountErrors()) errCode = 64; // errCode: 0000 0100 0000
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::ShapeSafetyFromInside(int max)
{
int errCode = 0;
Vec_t point, dir, pointSphere, norm;
bool convex = false;
int count = 0, count1 = 0;
int nError = 0;
ClearErrors();
#ifdef VECGEOM_ROOT
// visualisation
TPolyMarker3D *pm3 = 0;
pm3 = new TPolyMarker3D();
pm3->SetMarkerSize(0.2);
pm3->SetMarkerColor(kBlue);
#endif
if (max > fMaxPointsInside) max = fMaxPointsInside;
for (int i = 0; i < max; i++) {
point = fPoints[i];
double res = fVolume->SafetyToOut(point);
for (int j = 0; j < 1000; j++) {
dir = GetRandomDirection();
pointSphere = point + res * dir;
#ifdef VECGEOM_ROOT
// visualisation
pm3->SetNextPoint(pointSphere.x(), pointSphere.y(), pointSphere.z());
#endif
double distOut = CallDistanceToOut(fVolume, point, dir, norm, convex);
if (distOut < res) {
count1++;
ReportError(&nError, pointSphere, dir, distOut, "SSFI: DistanceToOut is underestimated, less that Safety");
}
if (fVolume->Inside(pointSphere) == vecgeom::EInside::kOutside) {
ReportError(&nError, pointSphere, dir, res, "SSFI: Safety is not safe, point on the SafetySphere is Outside");
double error = fVolume->DistanceToIn(pointSphere, -dir);
if (error > 100 * kTolerance) {
count++;
}
}
}
}
if (fVerbose) {
std::cout << "% " << std::endl;
std::cout << "% ShapeSafetyFromInside :: number of Points Outside Safety=" << count
<< " number of Points with distance smaller that safety=" << count1 << std::endl;
std::cout << "% " << std::endl;
}
#ifdef VECGEOM_ROOT
// visualisation
if (fStat) {
new TCanvas("shape", "ShapeSafetyFromInside", 1000, 800);
pm3->Draw();
}
#endif
std::cout << "% " << std::endl;
std::cout << "% TestShapeSafetyFromInside reported = " << CountErrors() << " errors" << std::endl;
std::cout << "% " << std::endl;
if (CountErrors()) errCode = 8; // errCode: 0000 0000 1000
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::ShapeSafetyFromOutside(int max)
{
int errCode = 0;
Vec_t point, temp, dir, pointSphere, normal;
double res, error;
int count = 0, count1 = 0;
int nError;
ClearErrors();
#ifdef VECGEOM_ROOT
// visualisation
TPolyMarker3D *pm4 = 0;
pm4 = new TPolyMarker3D();
pm4->SetMarkerSize(0.2);
pm4->SetMarkerColor(kBlue);
#endif
Vec_t minExtent, maxExtent;
fVolume->Extent(minExtent, maxExtent);
if (max > fMaxPointsOutside) max = fMaxPointsOutside;
for (int i = 0; i < max; i++) {
point = fPoints[i + fOffsetOutside];
res = fVolume->SafetyToIn(point);
if (res > 0) { // Safety Sphere test
bool convex = false;
int numTrials = 1000;
for (int j = 0; j < numTrials; j++) {
dir = GetRandomDirection();
double distIn = fVolume->DistanceToIn(point, dir);
if (distIn < res) {
count1++;
ReportError(&nError, point, dir, distIn, "SSFO: DistanceToIn is underestimated, less that Safety");
}
pointSphere = point + res * dir;
// std::cout<<"SFO "<<pointSphere<<std::endl;
#ifdef VECGEOM_ROOT
// visualisation
pm4->SetNextPoint(pointSphere.x(), pointSphere.y(), pointSphere.z());
#endif
if (fVolume->Inside(pointSphere) == vecgeom::EInside::kInside) {
ReportError(&nError, pointSphere, dir, res, "SSFO: Safety is not safe, point on the SafetySphere is Inside");
error = CallDistanceToOut(fVolume, pointSphere, -dir, normal, convex);
if (error > 100 * kTolerance) {
count++;
}
}
}
}
}
if (fVerbose) {
std::cout << "% " << std::endl;
std::cout << "% TestShapeSafetyFromOutside:: number of Points Inside Safety Sphere =" << count
<< " number of fPoints with Distance smaller that Safety=" << count1 << std::endl;
std::cout << "% " << std::endl;
}
#ifdef VECGEOM_ROOT
// visualisation
if (fStat) {
new TCanvas("shapeTest", "ShapeSafetyFromOutside", 1000, 800);
pm4->Draw();
}
#endif
std::cout << "% " << std::endl;
std::cout << "% TestShapeSafetyFromOutside reported = " << CountErrors() << " errors" << std::endl;
std::cout << "% " << std::endl;
if (CountErrors()) errCode = 16; // errCode: 0000 0001 0000
return errCode;
}
/////////////////////////////////////////////////////////////////////////////
template <typename ImplT>
int ShapeTester<ImplT>::TestXRayProfile()
{
int errCode = 0;
std::cout << "% Performing XRayPROFILE number of scans =" << fGNumberOfScans << std::endl;
std::cout << "% \n" << std::endl;
if (fGNumberOfScans == 1) {
errCode += Integration(0, 45, 200, true);
} // 1-theta,2-phi
else {
errCode += XRayProfile(0, fGNumberOfScans, 1000);
}
return errCode;
}
/////////////////////////////////////////////////////////////////////////////
template <typename ImplT>
int ShapeTester<ImplT>::XRayProfile(double theta, int nphi, int ngrid, bool useeps)
{
int errCode = 0;
#ifdef VECGEOM_ROOT
int nError = 0;
ClearErrors();
std::string volname(fVolume->GetName());
TH1F *hxprofile = new TH1F(
"xprof", Form("X-ray capacity profile of shape %s for theta=%g degrees", volname.c_str(), theta), nphi, 0, 360);
if (fStat) {
new TCanvas("c8", "X-ray capacity profile");
}
double dphi = 360. / nphi;
double phi = 0;
double phi0 = 5;
double maxerr = 0;
for (int i = 0; i < nphi; i++) {
phi = phi0 + (i + 0.5) * dphi;
// graphic option
if (nphi == 1) {
Integration(theta, phi, ngrid, useeps);
} else {
Integration(theta, phi, ngrid, useeps, 1, false);
}
hxprofile->SetBinContent(i + 1, fGCapacitySampled);
hxprofile->SetBinError(i + 1, fGCapacityError);
if (fGCapacityError > maxerr) maxerr = fGCapacityError;
if ((fGCapacitySampled - fGCapacityAnalytical) > 10 * fGCapacityError) {
nError++;
std::cout << "capacity analytical: " << fGCapacityAnalytical << " sampled: " << fGCapacitySampled << "+/- "
<< fGCapacityError << std::endl;
}
}
double minval = hxprofile->GetBinContent(hxprofile->GetMinimumBin()) - 2 * maxerr;
double maxval = hxprofile->GetBinContent(hxprofile->GetMaximumBin()) + 2 * maxerr;
hxprofile->GetXaxis()->SetTitle("phi [deg]");
hxprofile->GetYaxis()->SetTitle("Sampled capacity");
hxprofile->GetYaxis()->SetRangeUser(minval, maxval);
hxprofile->SetMarkerStyle(4);
hxprofile->SetStats(kFALSE);
if (fStat) {
hxprofile->Draw();
}
TF1 *lin = new TF1("linear", Form("%f", fGCapacityAnalytical), 0, 360);
lin->SetLineColor(kRed);
lin->SetLineStyle(kDotted);
lin->Draw("SAME");
std::cout << "% " << std::endl;
std::cout << "% TestShapeRayProfile reported = " << nError << " errors" << std::endl;
std::cout << "% " << std::endl;
if (nError) errCode = 1024; // errCode: 0100 0000 0000
#endif
return errCode;
}
/////////////////////////////////////////////////////////////////////////////
template <typename ImplT>
int ShapeTester<ImplT>::Integration(double theta, double phi, int ngrid, bool useeps, int npercell, bool graphics)
{
// integrate shape capacity by sampling rays
int errCode = 0;
int nError = 0;
Vec_t minExtent, maxExtent;
fVolume->Extent(minExtent, maxExtent);
double maxX = 2 * std::max(std::fabs(maxExtent.x()), std::fabs(minExtent.x()));
double maxY = 2 * std::max(std::fabs(maxExtent.y()), std::fabs(minExtent.y()));
double maxZ = 2 * std::max(std::fabs(maxExtent.z()), std::fabs(minExtent.z()));
double extent = std::sqrt(maxX * maxX + maxY * maxY + maxZ * maxZ);
double cell = 2 * extent / ngrid;
std::vector<Vec_t> grid_fPoints; // new double[3*ngrid*ngrid*npercell];
grid_fPoints.resize(ngrid * ngrid * npercell);
Vec_t point;
Vec_t dir;
double xmin, ymin;
dir.x() = std::sin(theta * kDegToRad) * std::cos(phi * kDegToRad);
dir.y() = std::sin(theta * kDegToRad) * std::sin(phi * kDegToRad);
dir.z() = std::cos(theta * kDegToRad);
#ifdef VECGEOM_ROOT
int nfPoints = ngrid * ngrid * npercell;
TPolyMarker3D *pmx = 0;
TH2F *xprof = 0;
if (graphics) {
pmx = new TPolyMarker3D(nfPoints);
pmx->SetMarkerColor(kRed);
pmx->SetMarkerStyle(4);
pmx->SetMarkerSize(0.2);
std::string volname(fVolume->GetName());
xprof = new TH2F("x-ray", Form("X-ray profile from theta=%g phi=%g of shape %s", theta, phi, volname.c_str()),
ngrid, -extent, extent, ngrid, -extent, extent);
}
#endif
Transformation3D *matrix = new Transformation3D(0, 0, 0, phi, theta, 0.);
Vec_t origin = Vec_t(extent * dir.x(), extent * dir.y(), extent * dir.z());
dir = -dir;
if ((fVerbose) && (graphics)) printf("=> x-ray direction:( %f, %f, %f)\n", dir.x(), dir.y(), dir.z());
// loop cells
int ip = 0;
for (int i = 0; i < ngrid; i++) {
for (int j = 0; j < ngrid; j++) {
xmin = -extent + i * cell;
ymin = -extent + j * cell;
if (npercell == 1) {
point.x() = xmin + 0.5 * cell;
point.y() = ymin + 0.5 * cell;
point.z() = 0;
grid_fPoints[ip] = matrix->InverseTransform(point) + origin;
#ifdef VECGEOM_ROOT
if (graphics) pmx->SetNextPoint(grid_fPoints[ip].x(), grid_fPoints[ip].y(), grid_fPoints[ip].z());
#endif
ip++;
} else {
for (int k = 0; k < npercell; k++) {
point.x() = xmin + cell * vecgeom::RNG::Instance().uniform();
point.y() = ymin + cell * vecgeom::RNG::Instance().uniform();
point.z() = 0;
grid_fPoints[ip] = matrix->InverseTransform(point) + origin;
#ifdef VECGEOM_ROOT
if (graphics) pmx->SetNextPoint(grid_fPoints[ip].x(), grid_fPoints[ip].y(), grid_fPoints[ip].z());
#endif
ip++;
}
}
}
}
double sum = 0;
double sumerr = 0;
double dist, lastdist;
int nhit = 0;
int ntransitions = 0;
bool last = false;
for (int i = 0; i < ip; i++) {
dist = CrossedLength(grid_fPoints[i], dir, useeps);
sum += dist;
if (dist > 0) {
lastdist = dist;
nhit++;
if (!last) {
ntransitions++;
sumerr += lastdist;
}
last = true;
point = matrix->Transform(grid_fPoints[i]) + origin;
#ifdef VECGEOM_ROOT
if (graphics) {
xprof->Fill(point.x(), point.y(), dist);
}
#endif
} else {
if (last) {
ntransitions++;
sumerr += lastdist;
}
last = false;
}
}
fGCapacitySampled = sum * cell * cell / npercell;
fGCapacityError = sumerr * cell * cell / npercell;
fGCapacityAnalytical = const_cast<ImplT *>(fVolume)->Capacity();
if ((fVerbose) && (graphics)) {
printf("th=%g phi=%g: analytical: %f -------- sampled: %f +/- %f\n", theta, phi, fGCapacityAnalytical,
fGCapacitySampled, fGCapacityError);
printf("Hit ratio: %f\n", double(nhit) / ip);
if (nhit > 0) printf("Average crossed length: %f\n", sum / nhit);
}
if ((fGCapacitySampled - fGCapacityAnalytical) > 10 * fGCapacityError) nError++;
#ifdef VECGEOM_ROOT
if (graphics) {
if (fStat) {
new TCanvas("c11", "X-ray scan");
xprof->DrawCopy("LEGO1");
}
}
#endif
if (nError) errCode = 512; // errCode: 0010 0000 0000
return errCode;
}
//////////////////////////////////////////////////////////////////////////////
template <typename ImplT>
double ShapeTester<ImplT>::CrossedLength(const Vec_t &point, const Vec_t &dir, bool useeps)
{
// Return crossed length of the shape for the given ray, taking into account possible multiple crossings
double eps = 0;
if (useeps) eps = 1.E-9;
double len = 0;
double dist = fVolume->DistanceToIn(point, dir);
if (dist > 1E10) return len;
// Propagate from starting point with the found distance (on the numerical boundary)
Vec_t pt(point), norm;
bool convex = false;
while (dist < 1E10) {
pt = pt + (dist + eps) * dir; // ray entering
// Compute distance from inside
dist = CallDistanceToOut(fVolume, pt, dir, norm, convex);
len += dist;
pt = pt + (dist + eps) * dir; // ray exiting
dist = fVolume->DistanceToIn(pt, dir);
}
return len;
}
////////////////////////////////////////////////////////////////////////////
template <typename ImplT>
void ShapeTester<ImplT>::FlushSS(stringstream &ss)
{
string s = ss.str();
cout << s;
*fLog << s;
ss.str("");
}
template <typename ImplT>
void ShapeTester<ImplT>::Flush(const string &s)
{
cout << s;
*fLog << s;
}
template <typename ImplT>
void ShapeTester<ImplT>::CreatePointsAndDirectionsSurface()
{
Vec_t norm, point;
for (int i = 0; i < fMaxPointsSurface; i++) {
Vec_t pointU;
#if 0
int retry = 100;
do
{ bool surfaceExist=true;
if(surfaceExist) {
pointU = fVolume->GetUnplacedVolume()->SamplePointOnSurface();
}
else {
Vec_t dir = GetRandomDirection(), norm;
bool convex=false;
double random = fRNG.uniform();
int index = (int)fMaxPointsInside*random;
double dist = CallDistanceToOut(fVolume, fPoints[index],dir,norm,convex);
pointU = fPoints[index]+dir*dist ;
}
if (retry-- == 0) break;
}
while (fVolume->Inside(pointU) != vecgeom::EInside::kSurface);
#endif
int retry = 100;
do {
pointU = fVolume->GetUnplacedVolume()->SamplePointOnSurface();
Vec_t vec = GetRandomDirection();
fDirections[i + fOffsetSurface] = vec;
point.Set(pointU.x(), pointU.y(), pointU.z());
fPoints[i + fOffsetSurface] = point;
if (retry-- == 0) {
std::cout << "Couldn't find point on surface in 100 trials, so skipping this point." << std::endl;
break;
}
} while (fVolume->Inside(pointU) != vecgeom::EInside::kSurface);
}
}
/*
template <typename ImplT>
void ShapeTester<ImplT>::CreatePointsAndDirectionsEdge()
{
Vec_t norm, point;
for (int i = 0; i < fMaxPointsEdge; i++) {
Vec_t pointU;
int retry = 100;
do {
fVolume->SamplePointsOnEdge(1, &pointU);
if (retry-- == 0) break;
} while (fVolume->Inside(pointU) != vecgeom::EInside::kSurface);
Vec_t vec = GetRandomDirection();
fDirections[i] = vec;
point.Set(pointU.x(), pointU.y(), pointU.z());
fPoints[i + fOffsetEdge] = point;
}
}
*/
template <typename ImplT>
void ShapeTester<ImplT>::CreatePointsAndDirectionsOutside()
{
Vec_t minExtent, maxExtent;
fVolume->Extent(minExtent, maxExtent);
double maxX = std::max(std::fabs(maxExtent.x()), std::fabs(minExtent.x()));
double maxY = std::max(std::fabs(maxExtent.y()), std::fabs(minExtent.y()));
double maxZ = std::max(std::fabs(maxExtent.z()), std::fabs(minExtent.z()));
double rOut = std::sqrt(maxX * maxX + maxY * maxY + maxZ * maxZ);
for (int i = 0; i < fMaxPointsOutside; i++) {
Vec_t vec, point;
do {
point.x() = -1 + 2 * fRNG.uniform();
point.y() = -1 + 2 * fRNG.uniform();
point.z() = -1 + 2 * fRNG.uniform();
point *= rOut * fOutsideMaxRadiusMultiple;
} while (fVolume->Inside(point) != vecgeom::EInside::kOutside);
double random = fRNG.uniform();
if (random <= fOutsideRandomDirectionPercent / 100.) {
vec = GetRandomDirection();
} else {
Vec_t pointSurface = fVolume->GetUnplacedVolume()->SamplePointOnSurface();
vec = pointSurface - point;
vec.Normalize();
}
fPoints[i + fOffsetOutside] = point;
fDirections[i + fOffsetOutside] = vec;
}
}
// DONE: inside fPoints generation uses random fPoints inside bounding box
template <typename ImplT>
void ShapeTester<ImplT>::CreatePointsAndDirectionsInside()
{
Vec_t minExtent, maxExtent;
fVolume->Extent(minExtent, maxExtent);
int i = 0;
while (i < fMaxPointsInside) {
double x = RandomRange(minExtent.x(), maxExtent.x());
double y = RandomRange(minExtent.y(), maxExtent.y());
if (minExtent.y() == maxExtent.y()) y = RandomRange(-1000, +1000);
double z = RandomRange(minExtent.z(), maxExtent.z());
Vec_t point0(x, y, z);
if (fVolume->Inside(point0) == vecgeom::EInside::kInside) {
Vec_t point(x, y, z);
Vec_t vec = GetRandomDirection();
fPoints[i + fOffsetInside] = point;
fDirections[i + fOffsetInside] = vec;
i++;
}
}
}
template <typename ImplT>
void ShapeTester<ImplT>::CreatePointsAndDirections()
{
if (fMethod != "XRayProfile") {
fMaxPointsInside = (int)(fMaxPoints * (fInsidePercent / 100));
fMaxPointsOutside = (int)(fMaxPoints * (fOutsidePercent / 100));
fMaxPointsEdge = (int)(fMaxPoints * (fEdgePercent / 100));
fMaxPointsSurface = fMaxPoints - fMaxPointsInside - fMaxPointsOutside - fMaxPointsEdge;
fOffsetInside = 0;
fOffsetSurface = fMaxPointsInside;
fOffsetEdge = fOffsetSurface + fMaxPointsSurface;
fOffsetOutside = fOffsetEdge + fMaxPointsEdge;
fPoints.resize(fMaxPoints);
fDirections.resize(fMaxPoints);
fResultDouble.resize(fMaxPoints);
fResultVector.resize(fMaxPoints);
CreatePointsAndDirectionsOutside();
CreatePointsAndDirectionsInside();
CreatePointsAndDirectionsSurface();
}
}
#include <sys/types.h> // For stat().
#include <sys/stat.h> // For stat().
int directoryExists(string s)
{
{
struct stat status;
stat(s.c_str(), &status);
return (status.st_mode & S_IFDIR);
}
return false;
}
template <typename ImplT>
void ShapeTester<ImplT>::PrintCoordinates(stringstream &ss, const Vec_t &vec, const string &delimiter, int precision)
{
ss.precision(precision);
ss << "(" << vec.x() << delimiter << vec.y() << delimiter << vec.z() << ")";
}
template <typename ImplT>
string ShapeTester<ImplT>::PrintCoordinates(const Vec_t &vec, const string &delimiter, int precision)
{
static stringstream ss;
PrintCoordinates(ss, vec, delimiter, precision);
string res(ss.str());
ss.str("");
return res;
}
template <typename ImplT>
string ShapeTester<ImplT>::PrintCoordinates(const Vec_t &vec, const char *delimiter, int precision)
{
string d(delimiter);
return PrintCoordinates(vec, d, precision);
}
template <typename ImplT>
void ShapeTester<ImplT>::PrintCoordinates(stringstream &ss, const Vec_t &vec, const char *delimiter, int precision)
{
string d(delimiter);
return PrintCoordinates(ss, vec, d, precision);
}
// NEW: output values precision setprecision (16)
// NEW: for each fMethod, one file
// NEW: print also different point coordinates
template <typename ImplT>
void ShapeTester<ImplT>::VectorToDouble(const vector<Vec_t> &vectorUVector, vector<double> &vectorDouble)
{
Vec_t vec;
int size = vectorUVector.size();
for (int i = 0; i < size; i++) {
vec = vectorUVector[i];
double mag = vec.Mag();
if (mag > 1.1) mag = 1;
vectorDouble[i] = mag;
}
}
template <typename ImplT>
void ShapeTester<ImplT>::BoolToDouble(const std::vector<bool> &vectorBool, std::vector<double> &vectorDouble)
{
int size = vectorBool.size();
for (int i = 0; i < size; i++)
vectorDouble[i] = (double)vectorBool[i];
}
template <typename ImplT>
int ShapeTester<ImplT>::SaveResultsToFile(const string &fMethod1)
{
string name = fVolume->GetName();
string fFilename1(fFolder + name + "_" + fMethod1 + ".dat");
std::cout << "Saving all results to " << fFilename1 << std::endl;
ofstream file(fFilename1.c_str());
bool saveVectors = (fMethod1 == "Normal");
int prec = 16;
if (file.is_open()) {
file.precision(prec);
file << fVolumeString << "\n";
string spacer("; ");
for (int i = 0; i < fMaxPoints; i++) {
file << "p=" << PrintCoordinates(fPoints[i], spacer, prec)
<< "\t v=" << PrintCoordinates(fDirections[i], spacer, prec) << "\t";
if (saveVectors)
file << "Norm=" << PrintCoordinates(fResultVector[i], spacer, prec) << "\n";
else
file << fResultDouble[i] << "\n";
}
return 0;
}
std::cout << "Unable to create file " << fFilename1 << std::endl;
return 1;
}
template <typename ImplT>
int ShapeTester<ImplT>::TestMethod(int (ShapeTester::*funcPtr)())
{
int errCode = 0;
std::cout << "========================================================= " << std::endl;
if (fMethod != "XRayProfile") {
std::cout << "% Creating " << fMaxPoints << " Points and Directions for Method =" << fMethod << std::endl;
CreatePointsAndDirections();
cout.precision(20);
std::cout << "% Statistics: Points=" << fMaxPoints << ",\n";
std::cout << "% ";
std::cout << "surface=" << fMaxPointsSurface << ", inside=" << fMaxPointsInside << ", outside=" << fMaxPointsOutside
<< "\n";
}
std::cout << "% " << std::endl;
errCode += (*this.*funcPtr)();
std::cout << "========================================================= " << std::endl;
return errCode;
}
// will run all tests. in this case, one file stream will be used
template <typename ImplT>
int ShapeTester<ImplT>::TestMethodAll()
{
int errCode = 0;
if (fTestBoundaryErrors) {
fMethod = "BoundaryPrecision";
TestBoundaryPrecision(0);
}
fMethod = "Consistency";
errCode += TestMethod(&ShapeTester::TestConsistencySolids);
if (fDefinedNormal) TestMethod(&ShapeTester::TestNormalSolids);
fMethod = "SafetyFromInside";
errCode += TestMethod(&ShapeTester::TestSafetyFromInsideSolids);
fMethod = "SafetyFromOutside";
errCode += TestMethod(&ShapeTester::TestSafetyFromOutsideSolids);
fMethod = "DistanceToIn";
errCode += TestMethod(&ShapeTester::TestDistanceToInSolids);
fMethod = "DistanceToOut";
errCode += TestMethod(&ShapeTester::TestDistanceToOutSolids);
fMethod = "XRayProfile";
errCode += TestMethod(&ShapeTester::TestXRayProfile);
fMethod = "all";
return errCode;
}
template <typename ImplT>
void ShapeTester<ImplT>::SetFolder(const string &newFolder)
{
cout << "Checking for existance of " << newFolder << endl;
if (!directoryExists(newFolder)) {
string command;
#ifdef WIN32
_mkdir(newFolder.c_str());
#else
std::cout << "try to create dir for " << std::endl;
mkdir(newFolder.c_str(), 0777);
#endif
if (!directoryExists(newFolder)) {
cout << "Directory " + newFolder + " does not exist, it must be created first\n";
exit(1);
}
}
fFolder = newFolder + "/";
}
template <typename ImplT>
void ShapeTester<ImplT>::Run(ImplT const *testVolume, const char *type)
{
if (strcmp(type, "stat") == 0) {
this->setStat(true);
}
if (strcmp(type, "debug") == 0) {
this->setDebug(true);
}
this->Run(testVolume);
#ifdef VECGEOM_ROOT
if (fStat) fVisualizer.GetTApp()->Run();
#endif
}
template <typename ImplT>
int ShapeTester<ImplT>::Run(ImplT const *testVolume)
{
// debug mode requires VecGeom shapes
if (fDebug) {
const vecgeom::VPlacedVolume *vgvol = dynamic_cast<vecgeom::VPlacedVolume const *>(testVolume);
if (!vgvol) {
assert(false);
std::cout << "\n\n==========================================================\n";
std::cout << "***** ShapeTester WARNING: debug mode does not work with a non-VecGeom shape!!\n";
std::cout << " Try to use shapeDebug binary to visualize this shape.\n";
std::cout << "***** Resetting fDebug to false...\n";
std::cout << "==========================================================\n\n\n";
this->setDebug(false);
}
}
if (testVolume) fVolume = testVolume;
// Running Convention first before running any ShapeTester tests
RunConventionChecker(testVolume);
fNumDisp = 5;
int errCode = 0;
stringstream ss;
int (ShapeTester::*funcPtr)() = NULL;
std::ofstream fLogger("/Log/box");
fLog = &fLogger;
SetFolder("Log");
#ifdef VECGEOM_ROOT
// serialize the ROOT solid for later debugging
// check if this is a VecGeom class
if (VPlacedVolume const *p = dynamic_cast<VPlacedVolume const *>(fVolume)) {
// propagate label to logical volume (to be addressable in CompareDistance tool)
const_cast<LogicalVolume *>(p->GetLogicalVolume())->SetLabel(p->GetName());
RootGeoManager::Instance().ExportToROOTGeometry(p, "Log/ShapeTesterGeom.root");
}
#endif
if (fMethod == "") fMethod = "all";
string name = testVolume->GetName();
std::cout << "\n\n";
std::cout << "===============================================================================\n";
std::cout << "Invoking test for Method " << fMethod << " on " << name << " ..."
<< "\nFolder is " << fFolder << std::endl;
std::cout << "===============================================================================\n";
std::cout << "\n";
if (fMethod == "Consistency") funcPtr = &ShapeTester::TestConsistencySolids;
if (fMethod == "Normal") funcPtr = &ShapeTester::TestNormalSolids;
if (fMethod == "SafetyFromInside") funcPtr = &ShapeTester::TestSafetyFromInsideSolids;
if (fMethod == "SafetyFromOutside") funcPtr = &ShapeTester::TestSafetyFromOutsideSolids;
if (fMethod == "DistanceToIn") funcPtr = &ShapeTester::TestDistanceToInSolids;
if (fMethod == "DistanceToOut") funcPtr = &ShapeTester::TestDistanceToOutSolids;
if (fMethod == "XRayProfile") funcPtr = &ShapeTester::TestXRayProfile;
if (fMethod == "all")
errCode += TestMethodAll();
else if (funcPtr)
errCode += TestMethod(funcPtr);
else
std::cout << "Method " << fMethod << " is not supported" << std::endl;
ClearErrors();
fMethod = "all";
errCode += fScore;
if (errCode) {
std::cout << "--------------------------------------------------------------------------------------" << std::endl;
std::cout << "--- Either Shape Conventions not followed or some of the ShapeTester's test failed ---" << std::endl;
std::cout << "--------------------------------------------------------------------------------------" << std::endl;
std::cout << "----------------- Generated Overall Error Code : " << errCode << " -------------------" << std::endl;
std::cout << "--------------------------------------------------------------------------------------" << std::endl;
}
return errCode;
}
template <typename ImplT>
int ShapeTester<ImplT>::RunMethod(ImplT const *testVolume, std::string fMethod1)
{
int errCode = 0;
stringstream ss;
int (ShapeTester::*funcPtr)() = NULL;
fVolume = testVolume;
std::ofstream fLogger("/Log/box");
fLog = &fLogger;
SetFolder("Log");
fMethod = fMethod1;
if (fMethod == "") fMethod = "all";
string name = testVolume->GetName();
std::cout << "\n\n";
std::cout << "===============================================================================\n";
std::cout << "Invoking test for Method " << fMethod << " on " << name << " ..."
<< "\nFolder is " << fFolder << std::endl;
std::cout << "===============================================================================\n";
std::cout << "\n";
if (fMethod == "Consistency") funcPtr = &ShapeTester::TestConsistencySolids;
if (fMethod == "Normal") funcPtr = &ShapeTester::TestNormalSolids;
if (fMethod == "SafetyFromInside") funcPtr = &ShapeTester::TestSafetyFromInsideSolids;
if (fMethod == "SafetyFromOutside") funcPtr = &ShapeTester::TestSafetyFromOutsideSolids;
if (fMethod == "DistanceToIn") funcPtr = &ShapeTester::TestDistanceToInSolids;
if (fMethod == "DistanceToOut") funcPtr = &ShapeTester::TestDistanceToOutSolids;
if (fMethod == "XRayProfile") funcPtr = &ShapeTester::TestXRayProfile;
if (fMethod == "all")
errCode += TestMethodAll();
else if (funcPtr)
errCode += TestMethod(funcPtr);
else
std::cout << "Method " << fMethod << " is not supported" << std::endl;
ClearErrors();
fMethod = "all";
return errCode;
}
//
// ReportError
//
// Report the specified error fMessage, but only if it has not been reported a zillion
// times already.
//
template <typename ImplT>
void ShapeTester<ImplT>::ReportError(int *nError, Vec_t &p, Vec_t &v, double distance,
std::string comment) //, std::ostream &fLogger )
{
ShapeTesterErrorList *last = 0, *errors = fErrorList;
while (errors) {
if (errors->fMessage == comment) {
if (++errors->fNUsed > fNumDisp) return;
break;
}
last = errors;
errors = errors->fNext;
}
if (errors == 0) {
//
// New error: add it the end of our list
//
errors = new ShapeTesterErrorList;
errors->fMessage = comment;
errors->fNUsed = 1;
errors->fNext = 0;
if (fErrorList)
last->fNext = errors;
else
fErrorList = errors;
}
//
// Output the fMessage
//
std::cout << "% " << comment;
if (errors->fNUsed == fNumDisp) std::cout << " (any further such errors suppressed)";
std::cout << " Distance = " << distance;
std::cout << std::endl;
std::cout << std::setprecision(25) << ++(*nError) << " : [point] : [direction] :: " << p << " : " << v << std::endl;
#ifdef VECGEOM_ROOT
if (fDebug) {
fVisualizer.AddVolume(*dynamic_cast<vecgeom::VPlacedVolume const *>(fVolume));
fVisualizer.AddPoint(p);
fVisualizer.AddLine(p, (p + 10000. * v));
fVisualizer.Show();
}
#endif
//
// if debugging mode we have to exit now
//
if (fIfException) {
std::ostringstream text;
text << "Aborting due to Debugging mode in solid: " << fVolume->GetName();
throw std::runtime_error("***EEE*** ShapeTester[UFatalErrorInArguments]: " + text.str());
}
}
//
// ClearErrors
// Reset list of errors (and clear memory)
//
template <typename ImplT>
void ShapeTester<ImplT>::ClearErrors()
{
ShapeTesterErrorList *here, *sNext;
here = fErrorList;
while (here) {
sNext = here->fNext;
delete here;
here = sNext;
}
fErrorList = 0;
}
//
// CountErrors
//
template <typename ImplT>
int ShapeTester<ImplT>::CountErrors() const
{
ShapeTesterErrorList *here;
int answer = 0;
here = fErrorList;
while (here) {
answer += here->fNUsed;
here = here->fNext;
}
return answer;
}
template <>
double ShapeTester<VPlacedVolume>::CallDistanceToOut(const VPlacedVolume *vol, const Vec_t &point, const Vec_t &dir,
Vec_t &normal, bool convex) const
{
double dist = vol->DistanceToOut(point, dir);
Vector3D<double> hitpoint = point + dist * dir;
vol->Normal(hitpoint, normal);
convex = vol->GetUnplacedVolume()->IsConvex();
return dist;
}
////// force template instantiation before vecgeom library is built
#include "ConventionChecker.cpp"
#include "VecGeom/volumes/PlacedVolume.h"
template class ShapeTester<VPlacedVolume>;
| 34.034288 | 120 | 0.60806 | [
"shape",
"vector",
"transform",
"solid"
] |
27ebaa81b51a0a53e06185b8188b84165a9c08b6 | 3,268 | hpp | C++ | include/dldist.hpp | namreeb/string_algorithms | a91ac5752538bd06d02c390a96e831d4b084bf7d | [
"MIT"
] | null | null | null | include/dldist.hpp | namreeb/string_algorithms | a91ac5752538bd06d02c390a96e831d4b084bf7d | [
"MIT"
] | null | null | null | include/dldist.hpp | namreeb/string_algorithms | a91ac5752538bd06d02c390a96e831d4b084bf7d | [
"MIT"
] | null | null | null | /*
* MIT License
*
* Copyright (c) 2019 namreeb (legal@namreeb.org) http://github.com/namreeb/string_algorithms
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*
*/
#ifndef __DLDIST_HPP_
#define __DLDIST_HPP_
#include <string>
#include <algorithm>
#include <vector>
namespace nam
{
namespace
{
constexpr int get_index(size_t columns, int x, int y)
{
return static_cast<int>(x * columns + y);
}
template <typename T>
constexpr T min3(const T &a, const T &b, const T &c)
{
return std::min(a, std::min(b, c));
}
}
int damerau_levenshtein_distance(const std::string &string1, const std::string &string2)
{
auto const string1_length = string1.length();
auto const string2_length = string2.length();
auto const max_dist = string1_length + string2_length;
auto const rows = string1_length + 1;
auto const columns = string2_length + 1;
std::vector<int> dist(rows*columns);
for (auto i = 0; i <= string1_length; ++i)
{
auto const volatile idx = get_index(columns, i, 0);
dist[get_index(columns, i, 0)] = i;
}
for (auto i = 0; i <= string2_length; ++i)
{
auto const volatile idx = get_index(columns, 0, i);
dist[get_index(columns, 0, i)] = i;
}
for (auto i = 1; i <= string1_length; ++i)
for (auto j = 1; j <= string2_length; j++)
{
auto const cost = string1[i - 1] == string2[j - 1] ? 0 : 1;
dist[get_index(columns, i, j)] = min3(
dist[get_index(columns, i - 1, j - 0)] + 1, // delete
dist[get_index(columns, i - 0, j - 1)] + 1, // insert
dist[get_index(columns, i - 1, j - 1)] + cost); // substitution
if (i > 1 && j > 1 &&
string1[i - 1] == string2[j - 2] &&
string1[i - 2] == string2[j - 1]
)
{
dist[get_index(columns, i, j)] = std::min(
dist[get_index(columns, i, j)],
dist[get_index(columns, i - 2, j - 2)] + cost // transposition
);
}
}
return dist[get_index(columns, static_cast<int>(string1_length), static_cast<int>(string2_length))];
}
}
#endif /* !__DLDIST_HPP_ */ | 33.346939 | 104 | 0.626071 | [
"vector"
] |
27ec30cc8690e7b2f923ebea65c0a88d1a9946e8 | 11,235 | cpp | C++ | coopplot/src/net/create_data.cpp | wolfjagger/coopnet | 8ba81ee8ca45d6476d4733f315c909020ef55585 | [
"MIT"
] | null | null | null | coopplot/src/net/create_data.cpp | wolfjagger/coopnet | 8ba81ee8ca45d6476d4733f315c909020ef55585 | [
"MIT"
] | null | null | null | coopplot/src/net/create_data.cpp | wolfjagger/coopnet | 8ba81ee8ca45d6476d4733f315c909020ef55585 | [
"MIT"
] | null | null | null | #include "create_data.h"
#include <numeric>
#include "alphali/util/timer.h"
#include "coopnet/sat/problem/problem.h"
#include "coopnet/sat/problem/creation/problem_factory.h"
#include "coopnet/sat/solving/dpll/dpll_solver.h"
#include "coopnet/sat/solving/walk/walk_solver.h"
using namespace coopnet;
namespace {
constexpr bool PRINTSubTiming = false;
}
namespace coopplot {
namespace {
std::array<double, 2> create_x_domain(
double startRatio, double endRatio, int numRatios) {
auto diff_ratio
= (endRatio - startRatio) / (numRatios - 1);
return std::array<double, 2>{
startRatio, diff_ratio };
}
std::vector<std::array<double, 3>> frac_satisfiable(
std::vector<std::unique_ptr<Solver>>& solvers,
int numNodes, int numClauses, int numAvg) {
auto size = solvers.size();
auto numSat = std::vector<int>(size);
auto setTimes = std::vector<std::vector<double>>(size);
for(auto& times : setTimes) times.reserve(numAvg);
auto timer = alphali::timer();
for (auto j = 0; j < numAvg; ++j) {
auto problem
= problem_factory::random_3sat_problem(numNodes, numClauses);
for(unsigned solverIdx = 0; solverIdx < size; ++solverIdx) {
timer.start();
auto& solver = *solvers[solverIdx];
solver.set_problem(problem);
auto solutionPair = solver.solve();
if (solutionPair.status == SolutionStatus::Satisfied)
++numSat[solverIdx];
timer.stop();
setTimes[solverIdx].push_back(timer.secs_elapsed());
if (PRINTSubTiming) {
timer.output("Generate/solve");
}
}
}
auto retVec = std::vector<std::array<double, 3>>();
retVec.reserve(size);
for(unsigned solverIdx = 0; solverIdx < size; ++solverIdx) {
auto fracSat = double(numSat[solverIdx]) / numAvg;
auto timeAvg = std::accumulate(
setTimes[solverIdx].begin(), setTimes[solverIdx].end(), 0.0);
timeAvg /= numAvg;
auto timeErr = 0.0;
for (auto time : setTimes[solverIdx]) {
timeErr += (time - timeAvg) * (time - timeAvg);
}
timeErr = std::sqrt(timeErr / numAvg);
retVec.push_back({ fracSat, timeAvg, timeErr });
}
return retVec;
}
std::vector<std::array<double, 3>> frac_satisfiable(
std::unique_ptr<Solver>& solver,
int numNodes, int numClauses, int numAvg) {
auto solvers = std::vector<std::unique_ptr<Solver>>();
solvers.push_back(std::move(solver));
auto retVec = frac_satisfiable(solvers, numNodes, numClauses, numAvg);
solver = std::move(solvers[0]);
solvers.pop_back();
return retVec;
}
}
SatReturn create_sat_data(
int numNodes,
double startRatioClauseNode, double endRatioClauseNode,
int numRatios, int numAvg,
DPLLNodeChoiceMode nodeChoiceMode) {
auto xDomain = create_x_domain(
startRatioClauseNode, endRatioClauseNode, numRatios);
auto solver = std::make_unique<DPLLSolver>();
solver->set_chooser(
DPLLNodeChooser::create(nodeChoiceMode));
std::unique_ptr<Solver> castSolver = std::move(solver);
auto vecY = std::vector<double>();
vecY.reserve(numRatios);
auto vecT = std::vector<std::array<double, 2>>();
vecT.reserve(numRatios);
for (auto i = 0; i < numRatios; ++i) {
auto ratio = startRatioClauseNode + i*xDomain[1];
auto numClauses = int(std::ceil(numNodes * ratio));
std::cout << "Ratio: " << ratio << std::endl;
auto satData = frac_satisfiable(
castSolver, numNodes, numClauses, numAvg);
auto& dpllData = satData[0];
std::cout << "Set of num_node/num_clause ";
std::cout << dpllData[1] << std::endl;
vecY.push_back(dpllData[0]);
vecT.push_back({ dpllData[1], dpllData[2] });
}
return {
XYData<double, double>(std::make_pair(xDomain, vecY)),
XYData<double, double>(std::make_pair(xDomain, vecT))
};
}
SatReturn create_sat_data_comparison(
int numNodes,
double startRatioClauseNode, double endRatioClauseNode,
int numRatios, int numAvg,
DPLLNodeChoiceMode dpllNodeChoiceMode, WalkNodeChoiceMode walkNodeChoiceMode) {
auto xDomain = create_x_domain(
startRatioClauseNode, endRatioClauseNode, numRatios);
auto solvers = std::vector<std::unique_ptr<Solver>>();
auto dpllSolver = std::make_unique<DPLLSolver>();
dpllSolver->set_chooser(
DPLLNodeChooser::create(dpllNodeChoiceMode));
solvers.push_back(std::move(dpllSolver));
auto walkSolver = std::make_unique<WalkSolver>(5, 1000);
walkSolver->set_chooser(
WalkNodeChooser::create(walkNodeChoiceMode));
solvers.push_back(std::move(walkSolver));
auto vecYs = std::vector<std::vector<double>>();
vecYs.reserve(numRatios);
auto vecTs = std::vector<std::vector<std::array<double, 2>>>();
vecTs.reserve(numRatios);
for (auto i = 0; i < numRatios; ++i) {
auto ratio = startRatioClauseNode + i*xDomain[1];
auto numClauses = unsigned int(std::ceil(numNodes * ratio));
std::cout << "Ratio: " << ratio << std::endl;
auto satData = frac_satisfiable(
solvers, numNodes, numClauses, numAvg);
auto& dpllData = satData[0];
auto& walkData = satData[1];
std::cout << "Set of num_node/num_clause ";
std::cout << dpllData[1] << " dpll avg and ";
std::cout << walkData[1] << " walk avg" << std::endl;
auto vecY = std::vector<double>();
vecY.push_back(dpllData[0]);
vecY.push_back(walkData[0]);
vecYs.push_back(std::move(vecY));
auto vecT = std::vector<std::array<double, 2>>();
vecT.push_back({ dpllData[1], dpllData[2] });
vecT.push_back({ walkData[1], walkData[2] });
vecTs.push_back(std::move(vecT));
}
return{
XYData<double, double>(std::make_pair(xDomain, vecYs)),
XYData<double, double>(std::make_pair(xDomain, vecTs))
};
}
SatReturn create_multiple_sat_data(
int startNumNodes, int endNumNodes, int numPlots,
double startRatioClauseNode, double endRatioClauseNode,
int numRatios, int numAvg,
DPLLNodeChoiceMode nodeChoiceMode) {
auto xDomain = create_x_domain(
startRatioClauseNode, endRatioClauseNode, numRatios);
auto diff_numNodes = (endNumNodes - startNumNodes) / (numPlots-1);
auto solver = std::make_unique<DPLLSolver>();
solver->set_chooser(
DPLLNodeChooser::create(nodeChoiceMode));
std::unique_ptr<Solver> castSolver = std::move(solver);
auto vecYs = std::vector<std::vector<double>>();
vecYs.reserve(numRatios);
auto vecTs = std::vector<std::vector<std::array<double, 2>>>();
vecTs.reserve(numRatios);
for (auto i = 0; i < numRatios; ++i) {
auto ratio = startRatioClauseNode + i*xDomain[1];
std::cout << "Ratio: " << ratio << std::endl;
auto vecY = std::vector<double>();
vecY.reserve(numPlots);
auto vecT = std::vector<std::array<double, 2>>();
vecT.reserve(numRatios);
for(auto j=0; j < numPlots; ++j) {
auto numNodes = startNumNodes + j*diff_numNodes;
auto numClauses = int(std::ceil(numNodes * ratio));
std::cout << "Num nodes: " << numNodes
<< " Num clauses: " << numClauses << std::endl;
auto satData = frac_satisfiable(
castSolver, numNodes, numClauses, numAvg);
auto& dpllData = satData[0];
std::cout << "Set of num_node/num_clause ";
std::cout << dpllData[1] << std::endl;
vecY.push_back(dpllData[0]);
vecT.push_back({ dpllData[1], dpllData[2] });
}
vecYs.push_back(std::move(vecY));
vecTs.push_back(std::move(vecT));
}
return {
XYData<double, double>(std::make_pair(xDomain, vecYs)),
XYData<double, double>(std::make_pair(xDomain, vecTs))
};
}
SatReturn create_multiple_sat_data_comparison(
int startNumNodes, int endNumNodes, int numPlots,
double startRatioClauseNode, double endRatioClauseNode,
int numRatios, int numAvg,
DPLLNodeChoiceMode dpllNodeChoiceMode, WalkNodeChoiceMode walkNodeChoiceMode) {
auto xDomain = create_x_domain(
startRatioClauseNode, endRatioClauseNode, numRatios);
auto diff_numNodes = (endNumNodes - startNumNodes) / (numPlots - 1);
auto solvers = std::vector<std::unique_ptr<Solver>>();
auto dpllSolver = std::make_unique<DPLLSolver>();
dpllSolver->set_chooser(
DPLLNodeChooser::create(dpllNodeChoiceMode));
solvers.push_back(std::move(dpllSolver));
auto walkSolver = std::make_unique<WalkSolver>(5, 1000);
walkSolver->set_chooser(
WalkNodeChooser::create(walkNodeChoiceMode));
solvers.push_back(std::move(walkSolver));
auto vecYs = std::vector<std::vector<double>>();
vecYs.reserve(numRatios);
auto vecTs = std::vector<std::vector<std::array<double, 2>>>();
vecTs.reserve(numRatios);
for (auto i = 0; i < numRatios; ++i) {
auto ratio = startRatioClauseNode + i*xDomain[1];
std::cout << "Ratio: " << ratio << std::endl;
auto vecY = std::vector<double>();
vecY.reserve(numPlots);
auto vecT = std::vector<std::array<double, 2>>();
vecT.reserve(numRatios);
for (auto j = 0; j < numPlots; ++j) {
auto numNodes = startNumNodes + j*diff_numNodes;
auto numClauses = unsigned int(std::ceil(numNodes * ratio));
std::cout << "Num nodes: " << numNodes
<< " Num clauses: " << numClauses << std::endl;
auto satData = frac_satisfiable(
solvers, numNodes, numClauses, numAvg);
auto& dpllData = satData[0];
auto& walkData = satData[1];
std::cout << "Set of num_node/num_clause ";
std::cout << dpllData[1] << " dpll avg and ";
std::cout << walkData[1] << " walk avg" << std::endl;
vecY.push_back(dpllData[0]);
vecY.push_back(walkData[0]);
vecT.push_back({ dpllData[1], dpllData[2] });
vecT.push_back({ walkData[1], walkData[2] });
}
vecYs.push_back(std::move(vecY));
vecTs.push_back(std::move(vecT));
}
return{
XYData<double, double>(std::make_pair(xDomain, vecYs)),
XYData<double, double>(std::make_pair(xDomain, vecTs))
};
}
SatReturn create_walk_prob_data(
int numNodes, int numClauses,
int numAvg, int numProbs) {
auto deltaX = 1.f / (numProbs-1);
auto xDomain = create_x_domain(0, 1, numProbs);
std::cout << "Get frac satisfiable using DPLL\n";
auto dpllSolver = std::make_unique<DPLLSolver>();
std::unique_ptr<DPLLNodeChooser> dpllChooser
= std::make_unique<MaxTotClauseNodeChooser>();
dpllSolver->set_chooser(std::move(dpllChooser));
std::unique_ptr<Solver> castDPLLSolver = std::move(dpllSolver);
auto dpllData = frac_satisfiable(
castDPLLSolver, numNodes, numClauses, numAvg);
std::unique_ptr<Solver> solver = std::make_unique<WalkSolver>(5, 10000);
auto vecY = std::vector<std::vector<double>>();
vecY.reserve(numProbs);
auto vecT = std::vector<std::array<double, 2>>();
vecT.reserve(numProbs);
for (auto i = 0; i < numProbs; ++i) {
auto prob = i*xDomain[1];
std::cout << "Greedy probability: " << prob << std::endl;
auto& walkSolver = static_cast<WalkSolver&>(*solver);
walkSolver.create_chooser<UnsatClauseMCNodeChooser>(prob);
auto satData = frac_satisfiable(
solver, numNodes, numClauses, numAvg);
auto& walkData = satData[0];
std::cout << "Average of " << walkData[1] << " secs." << std::endl;
vecY.push_back({ dpllData[0][0], walkData[0] });
vecT.push_back({ walkData[1], walkData[2] });
}
return{
XYData<double, double>(std::make_pair(xDomain, vecY)),
XYData<double, double>(std::make_pair(xDomain, vecT))
};
}
}
| 26.87799 | 81 | 0.673965 | [
"vector"
] |
27faa2a6389ca9f112156fbdc2478242ce14ed8f | 1,173 | cpp | C++ | libvast/test/detail/set_operations.cpp | lava/vast | 0bc9e3c12eb31ec50dd0270626d55e84b2255899 | [
"BSD-3-Clause"
] | 249 | 2019-08-26T01:44:45.000Z | 2022-03-26T14:12:32.000Z | libvast/test/detail/set_operations.cpp | 5l1v3r1/vast | a2cb4be879a13cef855da2c1d73083204aed4dff | [
"BSD-3-Clause"
] | 586 | 2019-08-06T13:10:36.000Z | 2022-03-31T08:31:00.000Z | libvast/test/detail/set_operations.cpp | satta/vast | 6c7587effd4265c4a5de23252bc7c7af3ef78bee | [
"BSD-3-Clause"
] | 37 | 2019-08-16T02:01:14.000Z | 2022-02-21T16:13:59.000Z | // _ _____ __________
// | | / / _ | / __/_ __/ Visibility
// | |/ / __ |_\ \ / / Across
// |___/_/ |_/___/ /_/ Space and Time
//
// SPDX-FileCopyrightText: (c) 2018 The VAST Contributors
// SPDX-License-Identifier: BSD-3-Clause
#define SUITE set_operations
#include "vast/detail/set_operations.hpp"
#include "vast/test/test.hpp"
using namespace vast::detail;
namespace {
struct fixture {
fixture() {
xs = {1, 2, 3, 6, 8, 9};
ys = {2, 4, 6, 7};
intersection = {2, 6};
unification = {1, 2, 3, 4, 6, 7, 8, 9};
}
std::vector<int> xs;
std::vector<int> ys;
std::vector<int> intersection;
std::vector<int> unification;
};
} // namespace
FIXTURE_SCOPE(set_operations_tests, fixture)
TEST(intersect) {
auto result = intersect(xs, ys);
CHECK_EQUAL(result, intersection);
}
TEST(inplace_intersect) {
auto result = xs;
inplace_intersect(result, ys);
CHECK_EQUAL(result, intersection);
}
TEST(unify) {
auto result = unify(xs, ys);
CHECK_EQUAL(result, unification);
}
TEST(inplace_unify) {
auto result = xs;
inplace_unify(result, ys);
CHECK_EQUAL(result, unification);
}
FIXTURE_SCOPE_END()
| 19.881356 | 57 | 0.635976 | [
"vector"
] |
27fe2f49eba8c28d380e509f4cda62aa295cae60 | 5,102 | hpp | C++ | tpm_module/libhis_changesrksecret.hpp | iadgovuser26/HIRS | 4b461ebbabac5cd8ef54e562f597d65346c3c863 | [
"Apache-2.0"
] | 127 | 2018-09-07T15:45:45.000Z | 2022-02-10T11:13:51.000Z | tpm_module/libhis_changesrksecret.hpp | iadgovuser26/HIRS | 4b461ebbabac5cd8ef54e562f597d65346c3c863 | [
"Apache-2.0"
] | 260 | 2018-09-07T19:08:25.000Z | 2022-03-31T15:28:24.000Z | tpm_module/libhis_changesrksecret.hpp | iadgovuser26/HIRS | 4b461ebbabac5cd8ef54e562f597d65346c3c863 | [
"Apache-2.0"
] | 48 | 2018-09-23T09:13:20.000Z | 2022-03-06T20:17:09.000Z | #ifndef libhis_changesrksecret_hpp
#define libhis_changesrksecret_hpp
#ifdef WINDOWS
#include "tspi.h"
#include "tss_error.h"
#include "tss_defines.h"
#endif
#ifdef LINUX
#include <tss/tspi.h>
#include <tss/tss_error.h>
#include <tss/tss_defines.h>
#endif
#include "libhis_exception.hpp"
class libhis_changesrksecret
{
public:
libhis_changesrksecret()
{
//create a context object
result = Tspi_Context_Create(&hcontext);
if(result != TSS_SUCCESS) throw libhis_exception("Create Conntext", result);
//create an SRK object
result = Tspi_Context_CreateObject(hcontext, TSS_OBJECT_TYPE_RSAKEY, TSS_KEY_TSP_SRK, &hkey_srk);
if(result != TSS_SUCCESS) throw libhis_exception("Create SRK", result);
//Create TPM policy
result = Tspi_Context_CreateObject(hcontext, TSS_OBJECT_TYPE_POLICY, TSS_POLICY_USAGE, &hpolicy_tpm);
if(result != TSS_SUCCESS) throw libhis_exception("Create TPM Policy", result);
//Create SRK policy
result = Tspi_Context_CreateObject(hcontext, TSS_OBJECT_TYPE_POLICY, TSS_POLICY_USAGE, &hpolicy_srk);
if(result != TSS_SUCCESS) throw libhis_exception("Create SRK Policy", result);
//Create new policy
result = Tspi_Context_CreateObject(hcontext, TSS_OBJECT_TYPE_POLICY, TSS_POLICY_USAGE, &hpolicy_new);
if(result != TSS_SUCCESS) throw libhis_exception("Create New Policy", result);
}
void changesrksecret(unsigned char *auth_tpm_value,
unsigned long auth_tpm_size,
bool auth_tpm_sha1,
unsigned char *auth_srk_value,
unsigned long auth_srk_size,
bool auth_srk_sha1,
unsigned char *auth_new_value,
unsigned long auth_new_size,
bool auth_new_sha1)
{
//establish a session
result = Tspi_Context_Connect(hcontext, 0);
if(result != TSS_SUCCESS) throw libhis_exception("Connect Context", result);
//get the TPM object
result = Tspi_Context_GetTpmObject(hcontext, &htpm);
if(result != TSS_SUCCESS) throw libhis_exception("Get TPM Object", result);
//set up TPM auth
if(auth_tpm_sha1)
{
result = Tspi_Policy_SetSecret(hpolicy_tpm, TSS_SECRET_MODE_SHA1, auth_tpm_size, auth_tpm_value);
if(result != TSS_SUCCESS) throw libhis_exception("Set TPM Secret SHA1", result);
}
else
{
result = Tspi_Policy_SetSecret(hpolicy_tpm, TSS_SECRET_MODE_PLAIN, auth_tpm_size, auth_tpm_value);
if(result != TSS_SUCCESS) throw libhis_exception("Set TPM Secret Plain", result);
}
//assign the TPM auth
result = Tspi_Policy_AssignToObject(hpolicy_tpm, htpm);
if(result != TSS_SUCCESS) throw libhis_exception("Assign TPM Secret", result);
//load the SRK
TSS_UUID uuid_srk = TSS_UUID_SRK;
result = Tspi_Context_LoadKeyByUUID(hcontext, TSS_PS_TYPE_SYSTEM, uuid_srk, &hkey_srk);
if(result != TSS_SUCCESS) throw libhis_exception("Load SRK", result);
//set up SRK auth
if(auth_srk_sha1)
{
result = Tspi_Policy_SetSecret(hpolicy_srk, TSS_SECRET_MODE_SHA1, auth_srk_size, auth_srk_value);
if(result != TSS_SUCCESS) throw libhis_exception("Set SRK Secret SHA1", result);
}
else
{
result = Tspi_Policy_SetSecret(hpolicy_srk, TSS_SECRET_MODE_PLAIN, auth_srk_size, auth_srk_value);
if(result != TSS_SUCCESS) throw libhis_exception("Set SRK Secret Plain", result);
}
//assign the SRK auth
result = Tspi_Policy_AssignToObject(hpolicy_srk, hkey_srk);
if(result != TSS_SUCCESS) throw libhis_exception("Assign SRK Secret", result);
//set up new auth
if(auth_new_sha1)
{
result = Tspi_Policy_SetSecret(hpolicy_new, TSS_SECRET_MODE_SHA1, auth_new_size, auth_new_value);
if(result != TSS_SUCCESS) throw libhis_exception("Set New Secret SHA1", result);
}
else
{
result = Tspi_Policy_SetSecret(hpolicy_new, TSS_SECRET_MODE_PLAIN, auth_new_size, auth_new_value);
if(result != TSS_SUCCESS) throw libhis_exception("Set New Secret Plain", result);
}
//change the SRK secret
result = Tspi_ChangeAuth(hkey_srk, htpm, hpolicy_new);
if(result != TSS_SUCCESS) throw libhis_exception("Change SRK Secret", result);
return;
}
~libhis_changesrksecret()
{
//clean up new policy
result = Tspi_Context_CloseObject(hcontext, hpolicy_new);
if(result != TSS_SUCCESS) throw libhis_exception("Close New Policy", result);
//clean up SRK policy
result = Tspi_Context_CloseObject(hcontext, hpolicy_srk);
if(result != TSS_SUCCESS) throw libhis_exception("Close SRK Policy", result);
//clean up TPM policy
result = Tspi_Context_CloseObject(hcontext, hpolicy_tpm);
if(result != TSS_SUCCESS) throw libhis_exception("Close TPM Policy", result);
//clean up SRK object
result = Tspi_Context_CloseObject(hcontext, hkey_srk);
if(result != TSS_SUCCESS) throw libhis_exception("Close SRK", result);
//close context
result = Tspi_Context_Close(hcontext);
if(result != TSS_SUCCESS) throw libhis_exception("Close Context", result);
}
private:
TSS_RESULT result;
TSS_HCONTEXT hcontext;
TSS_HTPM htpm;
TSS_HKEY hkey_srk;
TSS_HPOLICY hpolicy_tpm,
hpolicy_srk,
hpolicy_new;
};
#endif
| 33.788079 | 104 | 0.736182 | [
"object"
] |
27fe4b2e4c8cae6e0be5d9029cc8ccc20b33c8e3 | 3,530 | cpp | C++ | src/svg_reader.cpp | phonxvzf/svg2scad | eb458df6cee6a65fbabbe5a5600f50551532adb4 | [
"MIT"
] | null | null | null | src/svg_reader.cpp | phonxvzf/svg2scad | eb458df6cee6a65fbabbe5a5600f50551532adb4 | [
"MIT"
] | null | null | null | src/svg_reader.cpp | phonxvzf/svg2scad | eb458df6cee6a65fbabbe5a5600f50551532adb4 | [
"MIT"
] | null | null | null | #include <iostream>
#include "svg_reader.hpp"
namespace svg {
reader::context::~context() {
}
const std::vector<std::shared_ptr<action::base>>& reader::context::actions() const {
return m_actions;
}
void reader::context::path_move_to(float x, float y, svgpp::tag::coordinate::absolute) {
m_actions.push_back(std::make_shared<action::move_to>(action::move_to(vector2f(x, y))));
}
void reader::context::path_line_to(float x, float y, svgpp::tag::coordinate::absolute) {
m_actions.push_back(std::make_shared<action::line_to>(action::line_to(vector2f(x, y))));
}
void reader::context::path_quadratic_bezier_to(
float x1, float y1,
float x, float y,
svgpp::tag::coordinate::absolute)
{
m_actions.push_back(
std::make_shared<action::quadratic_bezier_to>(
action::quadratic_bezier_to({ x1, y1 }, { x, y })
)
);
}
void reader::context::path_cubic_bezier_to(
float x1, float y1,
float x2, float y2,
float x, float y,
svgpp::tag::coordinate::absolute)
{
m_actions.push_back(
std::make_shared<action::cubic_bezier_to>(
action::cubic_bezier_to(
{ x1, y1 },
{ x2, y2 },
{ x, y }
)
)
);
}
void reader::context::path_elliptical_arc_to(
float rx, float ry, float x_axis_rotation,
bool large_arc_flag, bool sweep_flag,
float x, float y,
svgpp::tag::coordinate::absolute)
{
m_actions.push_back(
std::make_shared<action::elliptic_arc_to>(
action::elliptic_arc_to(
{ rx, ry },
x_axis_rotation,
{ x, y },
large_arc_flag,
sweep_flag
)
)
);
}
void reader::context::path_close_subpath() {
}
void reader::context::path_exit() {
}
void reader::context::on_enter_element(svgpp::tag::element::any) {
}
void reader::context::on_exit_element() {
}
reader::reader() {
}
reader::reader(const std::string& fpath) {
this->load_file(fpath);
}
reader::~reader() {
}
const std::vector<std::shared_ptr<action::base>>& reader::load_file(const std::string& fpath) {
rapidxml_ns::file<> svg_file(fpath.c_str());
rapidxml_ns::xml_document<> svg_document;
svg_document.parse<0>(svg_file.data());
rapidxml_ns::xml_node<>* svg_element = svg_document.first_node("svg");
rapidxml_ns::xml_attribute<>* attr_width = svg_element->first_attribute("width");
rapidxml_ns::xml_attribute<>* attr_height = svg_element->first_attribute("height");
if (attr_width) m_width = std::atof(attr_width->value());
else std::cerr << "warning: could not determine base width" << std::endl;
if (attr_height) m_height = std::atof(attr_height->value());
else std::cerr << "warning: could not determine base height" << std::endl;
if (svg_element) {
svgpp::document_traversal<
svgpp::processed_elements<processed_element_t>,
svgpp::processed_attributes<svgpp::traits::shapes_attributes_by_element>
>::load_document(svg_element, m_context);
} else {
throw std::runtime_error("svg tag not found (is this an SVG file?)");
}
return this->actions();
}
const std::vector<std::shared_ptr<action::base>>& reader::actions() const {
return m_context.actions();
}
float reader::width() const {
return m_width;
}
float reader::height() const {
return m_height;
}
} /* namespace svg */
| 27.153846 | 97 | 0.626062 | [
"vector"
] |
27ff2e00a3e3c5bd9a0899c3ea6e0e9ea611aa55 | 135,099 | cpp | C++ | SampleProject/Builds/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs57.cpp | frenchmajorcsminor/MapsSDK-Unity | 0b3c0713d63279bd9fa62837fa7559d7f3cbd439 | [
"MIT"
] | null | null | null | SampleProject/Builds/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs57.cpp | frenchmajorcsminor/MapsSDK-Unity | 0b3c0713d63279bd9fa62837fa7559d7f3cbd439 | [
"MIT"
] | null | null | null | SampleProject/Builds/Il2CppOutputProject/Source/il2cppOutput/Il2CppCCWs57.cpp | frenchmajorcsminor/MapsSDK-Unity | 0b3c0713d63279bd9fa62837fa7559d7f3cbd439 | [
"MIT"
] | null | null | null | #include "pch-cpp.hpp"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include <limits>
#include "vm/CachedCCWBase.h"
#include "utils/New.h"
// System.Collections.Generic.Dictionary`2<=aaB6=,System.Int32>[]
struct Dictionary_2U5BU5D_tA3398E9236105F4A0966BD833EB80C43D1FA988F;
// System.Collections.Generic.Dictionary`2<System.Type,Microsoft.MixedReality.Toolkit.UI.ThemeDefinition>[]
struct Dictionary_2U5BU5D_t7524578208620F8132D0B130D07EE42B0F80BCBB;
// System.Func`3<Microsoft.MixedReality.Toolkit.Physics.ComparableRaycastResult,Microsoft.MixedReality.Toolkit.Physics.ComparableRaycastResult,System.Int32>[]
struct Func_3U5BU5D_t8AE04025405E7424BD6A23CDA8D95B17606FBB7B;
// System.Collections.Generic.IEnumerable`1<System.Security.Claims.Claim>[]
struct IEnumerable_1U5BU5D_t931A47ED399F89F5DF7009A8025FE22D84B5CE54;
// System.Collections.Generic.KeyValuePair`2<=aba=,Microsoft.Maps.Unity.MapLabel>[]
struct KeyValuePair_2U5BU5D_tD648AFDF8AC051DBD13180882B6FE4C8B451147B;
// System.Collections.Generic.KeyValuePair`2<System.DateTime,System.TimeType>[]
struct KeyValuePair_2U5BU5D_tE65123098CDFD610BACE75A21156C2FB230E5CB0;
// System.Collections.Generic.KeyValuePair`2<Microsoft.MixedReality.Toolkit.IMixedRealityService,Microsoft.MixedReality.Toolkit.IMixedRealityServiceRegistrar>[]
struct KeyValuePair_2U5BU5D_tA6C7388803240E17E6E08B72D82C1C782E7B19E0;
// System.Collections.Generic.KeyValuePair`2<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>[]
struct KeyValuePair_2U5BU5D_tD9BBFE2A4C3E0269F23A278D66D1D62160E7CD64;
// System.Collections.Generic.KeyValuePair`2<System.Int32,UnityEngine.Vector3>[]
struct KeyValuePair_2U5BU5D_t3407F4118AFF6185E122FBA58AF46EA1BADD305C;
// System.Collections.Generic.KeyValuePair`2<System.String,=a8B=>[]
struct KeyValuePair_2U5BU5D_t609D8E2310DE99AD465B7D8C66167D9223466915;
struct IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8;
struct IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB;
struct IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA;
struct IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4;
struct IIterator_1_t6A46A7244E5AAD0AE4F2A07AF43DA5052D55F4A4;
struct IIterator_1_tB1AB5AB497E87D6A397AA084D3D3D6B8D211022C;
struct IIterator_1_tD5C5DE60C4A835F60D32B19C44430B59B26BFA67;
IL2CPP_EXTERN_C_BEGIN
IL2CPP_EXTERN_C_END
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// Windows.Foundation.Collections.IIterable`1<System.Collections.Generic.IEnumerable`1<System.Object>>
struct NOVTABLE IIterable_1_tB7611E3565ADF2561FF7521E03A1E3B93F7BD113 : Il2CppIInspectable
{
static const Il2CppGuid IID;
virtual il2cpp_hresult_t STDCALL IIterable_1_First_m1E9A9F6DA2EC9A3A751A6E85F67C9BB40798A879(IIterator_1_tD5C5DE60C4A835F60D32B19C44430B59B26BFA67** comReturnValue) = 0;
};
// Windows.Foundation.Collections.IIterable`1<System.Collections.IEnumerable>
struct NOVTABLE IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824 : Il2CppIInspectable
{
static const Il2CppGuid IID;
virtual il2cpp_hresult_t STDCALL IIterable_1_First_m512126C71D7E9D1C31B56F64455F33E9FEEC89F8(IIterator_1_t6A46A7244E5AAD0AE4F2A07AF43DA5052D55F4A4** comReturnValue) = 0;
};
// Windows.Foundation.Collections.IIterable`1<System.Object>
struct NOVTABLE IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4 : Il2CppIInspectable
{
static const Il2CppGuid IID;
virtual il2cpp_hresult_t STDCALL IIterable_1_First_m54AC7E778E98ED35C6B7AD98C35C325B8A3DF619(IIterator_1_tB1AB5AB497E87D6A397AA084D3D3D6B8D211022C** comReturnValue) = 0;
};
// Windows.Foundation.Collections.IVectorView`1<System.Collections.Generic.IEnumerable`1<System.Object>>
struct NOVTABLE IVectorView_1_tDF19789741DDFC543BE092FE627C4F581626F001 : Il2CppIInspectable
{
static const Il2CppGuid IID;
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetAt_m81C572FE9591C741899BB1DBFCBA0D16F83AFA2B(uint32_t ___index0, IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4** comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IVectorView_1_get_Size_m17D793E25CDC73C302DC09F9F44E3E945DB6D51B(uint32_t* comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IVectorView_1_IndexOf_mDE5247D2CA481566F3163DD73813D5197E9A8C9F(IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4* ___value0, uint32_t* ___index1, bool* comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetMany_m8C2CC34D9034DFED1C049E407D18F960E9D41D65(uint32_t ___startIndex0, uint32_t ___items1ArraySize, IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4** ___items1, uint32_t* comReturnValue) = 0;
};
// Windows.Foundation.Collections.IVectorView`1<System.Collections.IEnumerable>
struct NOVTABLE IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A : Il2CppIInspectable
{
static const Il2CppGuid IID;
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetAt_m72849F526862E096635BA971A074D9B06ABFEE1E(uint32_t ___index0, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8** comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IVectorView_1_get_Size_mB93C08E36F2225BE1862007FAF30C9F2DEE8DAD9(uint32_t* comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IVectorView_1_IndexOf_m3D87181F28EC65303ECB5017476C3B38D0944E17(IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8* ___value0, uint32_t* ___index1, bool* comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetMany_mE432D0460C5D84FEC9104DF80F5809975EAE32F8(uint32_t ___startIndex0, uint32_t ___items1ArraySize, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8** ___items1, uint32_t* comReturnValue) = 0;
};
// Windows.Foundation.Collections.IVectorView`1<System.Object>
struct NOVTABLE IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A : Il2CppIInspectable
{
static const Il2CppGuid IID;
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetAt_m38CCDDE1E25317AEF5170D9818FC01816AF34260(uint32_t ___index0, Il2CppIInspectable** comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IVectorView_1_get_Size_m33BC340C458F20A80A8B07FF4764CEF1F5513F8B(uint32_t* comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IVectorView_1_IndexOf_mFAE432DA0C1902EEF54AB68CFFD3E2182C443F67(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetMany_m6AA46969FB50015EB7107EBCC29E48B7AD4BB6B1(uint32_t ___startIndex0, uint32_t ___items1ArraySize, Il2CppIInspectable** ___items1, uint32_t* comReturnValue) = 0;
};
// Windows.UI.Xaml.Interop.IBindableIterable
struct NOVTABLE IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8 : Il2CppIInspectable
{
static const Il2CppGuid IID;
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) = 0;
};
// Windows.UI.Xaml.Interop.IBindableVector
struct NOVTABLE IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC : Il2CppIInspectable
{
static const Il2CppGuid IID;
virtual il2cpp_hresult_t STDCALL IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED(uint32_t ___index0, Il2CppIInspectable** comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9(uint32_t* comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38(IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) = 0;
virtual il2cpp_hresult_t STDCALL IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213(uint32_t ___index0, Il2CppIInspectable* ___value1) = 0;
virtual il2cpp_hresult_t STDCALL IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5(uint32_t ___index0, Il2CppIInspectable* ___value1) = 0;
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0(uint32_t ___index0) = 0;
virtual il2cpp_hresult_t STDCALL IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F(Il2CppIInspectable* ___value0) = 0;
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3() = 0;
virtual il2cpp_hresult_t STDCALL IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF() = 0;
};
// System.Object
// System.Collections.Generic.List`1<System.Collections.Generic.Dictionary`2<=aaB6=,System.Int32>>
struct List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
Dictionary_2U5BU5D_tA3398E9236105F4A0966BD833EB80C43D1FA988F* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1, ____items_1)); }
inline Dictionary_2U5BU5D_tA3398E9236105F4A0966BD833EB80C43D1FA988F* get__items_1() const { return ____items_1; }
inline Dictionary_2U5BU5D_tA3398E9236105F4A0966BD833EB80C43D1FA988F** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(Dictionary_2U5BU5D_tA3398E9236105F4A0966BD833EB80C43D1FA988F* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____items_1), (void*)value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_4), (void*)value);
}
};
struct List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
Dictionary_2U5BU5D_tA3398E9236105F4A0966BD833EB80C43D1FA988F* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1_StaticFields, ____emptyArray_5)); }
inline Dictionary_2U5BU5D_tA3398E9236105F4A0966BD833EB80C43D1FA988F* get__emptyArray_5() const { return ____emptyArray_5; }
inline Dictionary_2U5BU5D_tA3398E9236105F4A0966BD833EB80C43D1FA988F** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(Dictionary_2U5BU5D_tA3398E9236105F4A0966BD833EB80C43D1FA988F* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____emptyArray_5), (void*)value);
}
};
// System.Collections.Generic.List`1<System.Collections.Generic.Dictionary`2<System.Type,Microsoft.MixedReality.Toolkit.UI.ThemeDefinition>>
struct List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
Dictionary_2U5BU5D_t7524578208620F8132D0B130D07EE42B0F80BCBB* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82, ____items_1)); }
inline Dictionary_2U5BU5D_t7524578208620F8132D0B130D07EE42B0F80BCBB* get__items_1() const { return ____items_1; }
inline Dictionary_2U5BU5D_t7524578208620F8132D0B130D07EE42B0F80BCBB** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(Dictionary_2U5BU5D_t7524578208620F8132D0B130D07EE42B0F80BCBB* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____items_1), (void*)value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_4), (void*)value);
}
};
struct List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
Dictionary_2U5BU5D_t7524578208620F8132D0B130D07EE42B0F80BCBB* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82_StaticFields, ____emptyArray_5)); }
inline Dictionary_2U5BU5D_t7524578208620F8132D0B130D07EE42B0F80BCBB* get__emptyArray_5() const { return ____emptyArray_5; }
inline Dictionary_2U5BU5D_t7524578208620F8132D0B130D07EE42B0F80BCBB** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(Dictionary_2U5BU5D_t7524578208620F8132D0B130D07EE42B0F80BCBB* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____emptyArray_5), (void*)value);
}
};
// System.Collections.Generic.List`1<System.Func`3<Microsoft.MixedReality.Toolkit.Physics.ComparableRaycastResult,Microsoft.MixedReality.Toolkit.Physics.ComparableRaycastResult,System.Int32>>
struct List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
Func_3U5BU5D_t8AE04025405E7424BD6A23CDA8D95B17606FBB7B* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D, ____items_1)); }
inline Func_3U5BU5D_t8AE04025405E7424BD6A23CDA8D95B17606FBB7B* get__items_1() const { return ____items_1; }
inline Func_3U5BU5D_t8AE04025405E7424BD6A23CDA8D95B17606FBB7B** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(Func_3U5BU5D_t8AE04025405E7424BD6A23CDA8D95B17606FBB7B* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____items_1), (void*)value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_4), (void*)value);
}
};
struct List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
Func_3U5BU5D_t8AE04025405E7424BD6A23CDA8D95B17606FBB7B* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D_StaticFields, ____emptyArray_5)); }
inline Func_3U5BU5D_t8AE04025405E7424BD6A23CDA8D95B17606FBB7B* get__emptyArray_5() const { return ____emptyArray_5; }
inline Func_3U5BU5D_t8AE04025405E7424BD6A23CDA8D95B17606FBB7B** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(Func_3U5BU5D_t8AE04025405E7424BD6A23CDA8D95B17606FBB7B* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____emptyArray_5), (void*)value);
}
};
// System.Collections.Generic.List`1<System.Collections.Generic.IEnumerable`1<System.Security.Claims.Claim>>
struct List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
IEnumerable_1U5BU5D_t931A47ED399F89F5DF7009A8025FE22D84B5CE54* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0, ____items_1)); }
inline IEnumerable_1U5BU5D_t931A47ED399F89F5DF7009A8025FE22D84B5CE54* get__items_1() const { return ____items_1; }
inline IEnumerable_1U5BU5D_t931A47ED399F89F5DF7009A8025FE22D84B5CE54** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(IEnumerable_1U5BU5D_t931A47ED399F89F5DF7009A8025FE22D84B5CE54* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____items_1), (void*)value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_4), (void*)value);
}
};
struct List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
IEnumerable_1U5BU5D_t931A47ED399F89F5DF7009A8025FE22D84B5CE54* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0_StaticFields, ____emptyArray_5)); }
inline IEnumerable_1U5BU5D_t931A47ED399F89F5DF7009A8025FE22D84B5CE54* get__emptyArray_5() const { return ____emptyArray_5; }
inline IEnumerable_1U5BU5D_t931A47ED399F89F5DF7009A8025FE22D84B5CE54** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(IEnumerable_1U5BU5D_t931A47ED399F89F5DF7009A8025FE22D84B5CE54* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____emptyArray_5), (void*)value);
}
};
// System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<=aba=,Microsoft.Maps.Unity.MapLabel>>
struct List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
KeyValuePair_2U5BU5D_tD648AFDF8AC051DBD13180882B6FE4C8B451147B* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4, ____items_1)); }
inline KeyValuePair_2U5BU5D_tD648AFDF8AC051DBD13180882B6FE4C8B451147B* get__items_1() const { return ____items_1; }
inline KeyValuePair_2U5BU5D_tD648AFDF8AC051DBD13180882B6FE4C8B451147B** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(KeyValuePair_2U5BU5D_tD648AFDF8AC051DBD13180882B6FE4C8B451147B* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____items_1), (void*)value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_4), (void*)value);
}
};
struct List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
KeyValuePair_2U5BU5D_tD648AFDF8AC051DBD13180882B6FE4C8B451147B* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4_StaticFields, ____emptyArray_5)); }
inline KeyValuePair_2U5BU5D_tD648AFDF8AC051DBD13180882B6FE4C8B451147B* get__emptyArray_5() const { return ____emptyArray_5; }
inline KeyValuePair_2U5BU5D_tD648AFDF8AC051DBD13180882B6FE4C8B451147B** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(KeyValuePair_2U5BU5D_tD648AFDF8AC051DBD13180882B6FE4C8B451147B* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____emptyArray_5), (void*)value);
}
};
// System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<System.DateTime,System.TimeType>>
struct List_1_t960AA958F641EF26613957B203B645E693F9430D : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
KeyValuePair_2U5BU5D_tE65123098CDFD610BACE75A21156C2FB230E5CB0* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t960AA958F641EF26613957B203B645E693F9430D, ____items_1)); }
inline KeyValuePair_2U5BU5D_tE65123098CDFD610BACE75A21156C2FB230E5CB0* get__items_1() const { return ____items_1; }
inline KeyValuePair_2U5BU5D_tE65123098CDFD610BACE75A21156C2FB230E5CB0** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(KeyValuePair_2U5BU5D_tE65123098CDFD610BACE75A21156C2FB230E5CB0* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____items_1), (void*)value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t960AA958F641EF26613957B203B645E693F9430D, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t960AA958F641EF26613957B203B645E693F9430D, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_t960AA958F641EF26613957B203B645E693F9430D, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_4), (void*)value);
}
};
struct List_1_t960AA958F641EF26613957B203B645E693F9430D_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
KeyValuePair_2U5BU5D_tE65123098CDFD610BACE75A21156C2FB230E5CB0* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_t960AA958F641EF26613957B203B645E693F9430D_StaticFields, ____emptyArray_5)); }
inline KeyValuePair_2U5BU5D_tE65123098CDFD610BACE75A21156C2FB230E5CB0* get__emptyArray_5() const { return ____emptyArray_5; }
inline KeyValuePair_2U5BU5D_tE65123098CDFD610BACE75A21156C2FB230E5CB0** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(KeyValuePair_2U5BU5D_tE65123098CDFD610BACE75A21156C2FB230E5CB0* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____emptyArray_5), (void*)value);
}
};
// System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<Microsoft.MixedReality.Toolkit.IMixedRealityService,Microsoft.MixedReality.Toolkit.IMixedRealityServiceRegistrar>>
struct List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
KeyValuePair_2U5BU5D_tA6C7388803240E17E6E08B72D82C1C782E7B19E0* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8, ____items_1)); }
inline KeyValuePair_2U5BU5D_tA6C7388803240E17E6E08B72D82C1C782E7B19E0* get__items_1() const { return ____items_1; }
inline KeyValuePair_2U5BU5D_tA6C7388803240E17E6E08B72D82C1C782E7B19E0** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(KeyValuePair_2U5BU5D_tA6C7388803240E17E6E08B72D82C1C782E7B19E0* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____items_1), (void*)value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_4), (void*)value);
}
};
struct List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
KeyValuePair_2U5BU5D_tA6C7388803240E17E6E08B72D82C1C782E7B19E0* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8_StaticFields, ____emptyArray_5)); }
inline KeyValuePair_2U5BU5D_tA6C7388803240E17E6E08B72D82C1C782E7B19E0* get__emptyArray_5() const { return ____emptyArray_5; }
inline KeyValuePair_2U5BU5D_tA6C7388803240E17E6E08B72D82C1C782E7B19E0** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(KeyValuePair_2U5BU5D_tA6C7388803240E17E6E08B72D82C1C782E7B19E0* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____emptyArray_5), (void*)value);
}
};
// System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>>
struct List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
KeyValuePair_2U5BU5D_tD9BBFE2A4C3E0269F23A278D66D1D62160E7CD64* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9, ____items_1)); }
inline KeyValuePair_2U5BU5D_tD9BBFE2A4C3E0269F23A278D66D1D62160E7CD64* get__items_1() const { return ____items_1; }
inline KeyValuePair_2U5BU5D_tD9BBFE2A4C3E0269F23A278D66D1D62160E7CD64** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(KeyValuePair_2U5BU5D_tD9BBFE2A4C3E0269F23A278D66D1D62160E7CD64* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____items_1), (void*)value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_4), (void*)value);
}
};
struct List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
KeyValuePair_2U5BU5D_tD9BBFE2A4C3E0269F23A278D66D1D62160E7CD64* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9_StaticFields, ____emptyArray_5)); }
inline KeyValuePair_2U5BU5D_tD9BBFE2A4C3E0269F23A278D66D1D62160E7CD64* get__emptyArray_5() const { return ____emptyArray_5; }
inline KeyValuePair_2U5BU5D_tD9BBFE2A4C3E0269F23A278D66D1D62160E7CD64** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(KeyValuePair_2U5BU5D_tD9BBFE2A4C3E0269F23A278D66D1D62160E7CD64* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____emptyArray_5), (void*)value);
}
};
// System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<System.Int32,UnityEngine.Vector3>>
struct List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
KeyValuePair_2U5BU5D_t3407F4118AFF6185E122FBA58AF46EA1BADD305C* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF, ____items_1)); }
inline KeyValuePair_2U5BU5D_t3407F4118AFF6185E122FBA58AF46EA1BADD305C* get__items_1() const { return ____items_1; }
inline KeyValuePair_2U5BU5D_t3407F4118AFF6185E122FBA58AF46EA1BADD305C** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(KeyValuePair_2U5BU5D_t3407F4118AFF6185E122FBA58AF46EA1BADD305C* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____items_1), (void*)value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_4), (void*)value);
}
};
struct List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
KeyValuePair_2U5BU5D_t3407F4118AFF6185E122FBA58AF46EA1BADD305C* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF_StaticFields, ____emptyArray_5)); }
inline KeyValuePair_2U5BU5D_t3407F4118AFF6185E122FBA58AF46EA1BADD305C* get__emptyArray_5() const { return ____emptyArray_5; }
inline KeyValuePair_2U5BU5D_t3407F4118AFF6185E122FBA58AF46EA1BADD305C** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(KeyValuePair_2U5BU5D_t3407F4118AFF6185E122FBA58AF46EA1BADD305C* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____emptyArray_5), (void*)value);
}
};
// System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<System.String,=a8B=>>
struct List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562 : public RuntimeObject
{
public:
// T[] System.Collections.Generic.List`1::_items
KeyValuePair_2U5BU5D_t609D8E2310DE99AD465B7D8C66167D9223466915* ____items_1;
// System.Int32 System.Collections.Generic.List`1::_size
int32_t ____size_2;
// System.Int32 System.Collections.Generic.List`1::_version
int32_t ____version_3;
// System.Object System.Collections.Generic.List`1::_syncRoot
RuntimeObject * ____syncRoot_4;
public:
inline static int32_t get_offset_of__items_1() { return static_cast<int32_t>(offsetof(List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562, ____items_1)); }
inline KeyValuePair_2U5BU5D_t609D8E2310DE99AD465B7D8C66167D9223466915* get__items_1() const { return ____items_1; }
inline KeyValuePair_2U5BU5D_t609D8E2310DE99AD465B7D8C66167D9223466915** get_address_of__items_1() { return &____items_1; }
inline void set__items_1(KeyValuePair_2U5BU5D_t609D8E2310DE99AD465B7D8C66167D9223466915* value)
{
____items_1 = value;
Il2CppCodeGenWriteBarrier((void**)(&____items_1), (void*)value);
}
inline static int32_t get_offset_of__size_2() { return static_cast<int32_t>(offsetof(List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562, ____size_2)); }
inline int32_t get__size_2() const { return ____size_2; }
inline int32_t* get_address_of__size_2() { return &____size_2; }
inline void set__size_2(int32_t value)
{
____size_2 = value;
}
inline static int32_t get_offset_of__version_3() { return static_cast<int32_t>(offsetof(List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562, ____version_3)); }
inline int32_t get__version_3() const { return ____version_3; }
inline int32_t* get_address_of__version_3() { return &____version_3; }
inline void set__version_3(int32_t value)
{
____version_3 = value;
}
inline static int32_t get_offset_of__syncRoot_4() { return static_cast<int32_t>(offsetof(List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562, ____syncRoot_4)); }
inline RuntimeObject * get__syncRoot_4() const { return ____syncRoot_4; }
inline RuntimeObject ** get_address_of__syncRoot_4() { return &____syncRoot_4; }
inline void set__syncRoot_4(RuntimeObject * value)
{
____syncRoot_4 = value;
Il2CppCodeGenWriteBarrier((void**)(&____syncRoot_4), (void*)value);
}
};
struct List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562_StaticFields
{
public:
// T[] System.Collections.Generic.List`1::_emptyArray
KeyValuePair_2U5BU5D_t609D8E2310DE99AD465B7D8C66167D9223466915* ____emptyArray_5;
public:
inline static int32_t get_offset_of__emptyArray_5() { return static_cast<int32_t>(offsetof(List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562_StaticFields, ____emptyArray_5)); }
inline KeyValuePair_2U5BU5D_t609D8E2310DE99AD465B7D8C66167D9223466915* get__emptyArray_5() const { return ____emptyArray_5; }
inline KeyValuePair_2U5BU5D_t609D8E2310DE99AD465B7D8C66167D9223466915** get_address_of__emptyArray_5() { return &____emptyArray_5; }
inline void set__emptyArray_5(KeyValuePair_2U5BU5D_t609D8E2310DE99AD465B7D8C66167D9223466915* value)
{
____emptyArray_5 = value;
Il2CppCodeGenWriteBarrier((void**)(&____emptyArray_5), (void*)value);
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
il2cpp_hresult_t IIterable_1_First_m54AC7E778E98ED35C6B7AD98C35C325B8A3DF619_ComCallableWrapperProjectedMethod(RuntimeObject* __this, IIterator_1_tB1AB5AB497E87D6A397AA084D3D3D6B8D211022C** comReturnValue);
il2cpp_hresult_t IIterable_1_First_m512126C71D7E9D1C31B56F64455F33E9FEEC89F8_ComCallableWrapperProjectedMethod(RuntimeObject* __this, IIterator_1_t6A46A7244E5AAD0AE4F2A07AF43DA5052D55F4A4** comReturnValue);
il2cpp_hresult_t IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(RuntimeObject* __this, IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue);
il2cpp_hresult_t IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t ___index0, Il2CppIInspectable** comReturnValue);
il2cpp_hresult_t IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t* comReturnValue);
il2cpp_hresult_t IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38_ComCallableWrapperProjectedMethod(RuntimeObject* __this, IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue);
il2cpp_hresult_t IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4_ComCallableWrapperProjectedMethod(RuntimeObject* __this, Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue);
il2cpp_hresult_t IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t ___index0, Il2CppIInspectable* ___value1);
il2cpp_hresult_t IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t ___index0, Il2CppIInspectable* ___value1);
il2cpp_hresult_t IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t ___index0);
il2cpp_hresult_t IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F_ComCallableWrapperProjectedMethod(RuntimeObject* __this, Il2CppIInspectable* ___value0);
il2cpp_hresult_t IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3_ComCallableWrapperProjectedMethod(RuntimeObject* __this);
il2cpp_hresult_t IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF_ComCallableWrapperProjectedMethod(RuntimeObject* __this);
il2cpp_hresult_t IVectorView_1_GetAt_m38CCDDE1E25317AEF5170D9818FC01816AF34260_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t ___index0, Il2CppIInspectable** comReturnValue);
il2cpp_hresult_t IVectorView_1_get_Size_m33BC340C458F20A80A8B07FF4764CEF1F5513F8B_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t* comReturnValue);
il2cpp_hresult_t IVectorView_1_IndexOf_mFAE432DA0C1902EEF54AB68CFFD3E2182C443F67_ComCallableWrapperProjectedMethod(RuntimeObject* __this, Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue);
il2cpp_hresult_t IVectorView_1_GetMany_m6AA46969FB50015EB7107EBCC29E48B7AD4BB6B1_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t ___startIndex0, uint32_t ___items1ArraySize, Il2CppIInspectable** ___items1, uint32_t* comReturnValue);
il2cpp_hresult_t IVectorView_1_GetAt_m72849F526862E096635BA971A074D9B06ABFEE1E_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t ___index0, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8** comReturnValue);
il2cpp_hresult_t IVectorView_1_get_Size_mB93C08E36F2225BE1862007FAF30C9F2DEE8DAD9_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t* comReturnValue);
il2cpp_hresult_t IVectorView_1_IndexOf_m3D87181F28EC65303ECB5017476C3B38D0944E17_ComCallableWrapperProjectedMethod(RuntimeObject* __this, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8* ___value0, uint32_t* ___index1, bool* comReturnValue);
il2cpp_hresult_t IVectorView_1_GetMany_mE432D0460C5D84FEC9104DF80F5809975EAE32F8_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t ___startIndex0, uint32_t ___items1ArraySize, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8** ___items1, uint32_t* comReturnValue);
il2cpp_hresult_t IIterable_1_First_m1E9A9F6DA2EC9A3A751A6E85F67C9BB40798A879_ComCallableWrapperProjectedMethod(RuntimeObject* __this, IIterator_1_tD5C5DE60C4A835F60D32B19C44430B59B26BFA67** comReturnValue);
il2cpp_hresult_t IVectorView_1_GetAt_m81C572FE9591C741899BB1DBFCBA0D16F83AFA2B_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t ___index0, IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4** comReturnValue);
il2cpp_hresult_t IVectorView_1_get_Size_m17D793E25CDC73C302DC09F9F44E3E945DB6D51B_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t* comReturnValue);
il2cpp_hresult_t IVectorView_1_IndexOf_mDE5247D2CA481566F3163DD73813D5197E9A8C9F_ComCallableWrapperProjectedMethod(RuntimeObject* __this, IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4* ___value0, uint32_t* ___index1, bool* comReturnValue);
il2cpp_hresult_t IVectorView_1_GetMany_m8C2CC34D9034DFED1C049E407D18F960E9D41D65_ComCallableWrapperProjectedMethod(RuntimeObject* __this, uint32_t ___startIndex0, uint32_t ___items1ArraySize, IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4** ___items1, uint32_t* comReturnValue);
// COM Callable Wrapper for System.Collections.Generic.List`1<System.Collections.Generic.Dictionary`2<=aaB6=,System.Int32>>
struct List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1_ComCallableWrapper>, IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4, IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8, IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC, IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A, IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A
{
inline List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(6);
interfaceIds[0] = IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4::IID;
interfaceIds[1] = IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824::IID;
interfaceIds[2] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
interfaceIds[3] = IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID;
interfaceIds[4] = IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A::IID;
interfaceIds[5] = IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A::IID;
*iidCount = 6;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IIterable_1_First_m54AC7E778E98ED35C6B7AD98C35C325B8A3DF619(IIterator_1_tB1AB5AB497E87D6A397AA084D3D3D6B8D211022C** comReturnValue) IL2CPP_OVERRIDE
{
return IIterable_1_First_m54AC7E778E98ED35C6B7AD98C35C325B8A3DF619_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IIterable_1_First_m512126C71D7E9D1C31B56F64455F33E9FEEC89F8(IIterator_1_t6A46A7244E5AAD0AE4F2A07AF43DA5052D55F4A4** comReturnValue) IL2CPP_OVERRIDE
{
return IIterable_1_First_m512126C71D7E9D1C31B56F64455F33E9FEEC89F8_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38(IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0(uint32_t ___index0) IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F(Il2CppIInspectable* ___value0) IL2CPP_OVERRIDE
{
return IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3() IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF() IL2CPP_OVERRIDE
{
return IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetAt_m38CCDDE1E25317AEF5170D9818FC01816AF34260(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetAt_m38CCDDE1E25317AEF5170D9818FC01816AF34260_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_get_Size_m33BC340C458F20A80A8B07FF4764CEF1F5513F8B(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_get_Size_m33BC340C458F20A80A8B07FF4764CEF1F5513F8B_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_IndexOf_mFAE432DA0C1902EEF54AB68CFFD3E2182C443F67(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_IndexOf_mFAE432DA0C1902EEF54AB68CFFD3E2182C443F67_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetMany_m6AA46969FB50015EB7107EBCC29E48B7AD4BB6B1(uint32_t ___startIndex0, uint32_t ___items1ArraySize, Il2CppIInspectable** ___items1, uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetMany_m6AA46969FB50015EB7107EBCC29E48B7AD4BB6B1_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___startIndex0, ___items1ArraySize, ___items1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetAt_m72849F526862E096635BA971A074D9B06ABFEE1E(uint32_t ___index0, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8** comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetAt_m72849F526862E096635BA971A074D9B06ABFEE1E_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_get_Size_mB93C08E36F2225BE1862007FAF30C9F2DEE8DAD9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_get_Size_mB93C08E36F2225BE1862007FAF30C9F2DEE8DAD9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_IndexOf_m3D87181F28EC65303ECB5017476C3B38D0944E17(IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_IndexOf_m3D87181F28EC65303ECB5017476C3B38D0944E17_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetMany_mE432D0460C5D84FEC9104DF80F5809975EAE32F8(uint32_t ___startIndex0, uint32_t ___items1ArraySize, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8** ___items1, uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetMany_mE432D0460C5D84FEC9104DF80F5809975EAE32F8_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___startIndex0, ___items1ArraySize, ___items1, comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) List_1_t21C6637FEF0E557259FA7D2FA67E963B6C291EE1_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.List`1<System.Collections.Generic.Dictionary`2<System.Type,Microsoft.MixedReality.Toolkit.UI.ThemeDefinition>>
struct List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82_ComCallableWrapper>, IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4, IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8, IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC, IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A, IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A
{
inline List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(6);
interfaceIds[0] = IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4::IID;
interfaceIds[1] = IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824::IID;
interfaceIds[2] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
interfaceIds[3] = IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID;
interfaceIds[4] = IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A::IID;
interfaceIds[5] = IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A::IID;
*iidCount = 6;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IIterable_1_First_m54AC7E778E98ED35C6B7AD98C35C325B8A3DF619(IIterator_1_tB1AB5AB497E87D6A397AA084D3D3D6B8D211022C** comReturnValue) IL2CPP_OVERRIDE
{
return IIterable_1_First_m54AC7E778E98ED35C6B7AD98C35C325B8A3DF619_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IIterable_1_First_m512126C71D7E9D1C31B56F64455F33E9FEEC89F8(IIterator_1_t6A46A7244E5AAD0AE4F2A07AF43DA5052D55F4A4** comReturnValue) IL2CPP_OVERRIDE
{
return IIterable_1_First_m512126C71D7E9D1C31B56F64455F33E9FEEC89F8_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38(IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0(uint32_t ___index0) IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F(Il2CppIInspectable* ___value0) IL2CPP_OVERRIDE
{
return IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3() IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF() IL2CPP_OVERRIDE
{
return IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetAt_m38CCDDE1E25317AEF5170D9818FC01816AF34260(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetAt_m38CCDDE1E25317AEF5170D9818FC01816AF34260_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_get_Size_m33BC340C458F20A80A8B07FF4764CEF1F5513F8B(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_get_Size_m33BC340C458F20A80A8B07FF4764CEF1F5513F8B_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_IndexOf_mFAE432DA0C1902EEF54AB68CFFD3E2182C443F67(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_IndexOf_mFAE432DA0C1902EEF54AB68CFFD3E2182C443F67_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetMany_m6AA46969FB50015EB7107EBCC29E48B7AD4BB6B1(uint32_t ___startIndex0, uint32_t ___items1ArraySize, Il2CppIInspectable** ___items1, uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetMany_m6AA46969FB50015EB7107EBCC29E48B7AD4BB6B1_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___startIndex0, ___items1ArraySize, ___items1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetAt_m72849F526862E096635BA971A074D9B06ABFEE1E(uint32_t ___index0, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8** comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetAt_m72849F526862E096635BA971A074D9B06ABFEE1E_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_get_Size_mB93C08E36F2225BE1862007FAF30C9F2DEE8DAD9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_get_Size_mB93C08E36F2225BE1862007FAF30C9F2DEE8DAD9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_IndexOf_m3D87181F28EC65303ECB5017476C3B38D0944E17(IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_IndexOf_m3D87181F28EC65303ECB5017476C3B38D0944E17_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetMany_mE432D0460C5D84FEC9104DF80F5809975EAE32F8(uint32_t ___startIndex0, uint32_t ___items1ArraySize, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8** ___items1, uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetMany_mE432D0460C5D84FEC9104DF80F5809975EAE32F8_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___startIndex0, ___items1ArraySize, ___items1, comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) List_1_t9DCFFE685380EFF66A036EF5F96A681DB5B94E82_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.List`1<System.Func`3<Microsoft.MixedReality.Toolkit.Physics.ComparableRaycastResult,Microsoft.MixedReality.Toolkit.Physics.ComparableRaycastResult,System.Int32>>
struct List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D_ComCallableWrapper>, IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8, IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC, IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A
{
inline List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(4);
interfaceIds[0] = IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4::IID;
interfaceIds[1] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
interfaceIds[2] = IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID;
interfaceIds[3] = IVectorView_1_t9D427951F2D09C2E6F846759B5273E993F185D4A::IID;
*iidCount = 4;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IIterable_1_First_m54AC7E778E98ED35C6B7AD98C35C325B8A3DF619(IIterator_1_tB1AB5AB497E87D6A397AA084D3D3D6B8D211022C** comReturnValue) IL2CPP_OVERRIDE
{
return IIterable_1_First_m54AC7E778E98ED35C6B7AD98C35C325B8A3DF619_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38(IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0(uint32_t ___index0) IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F(Il2CppIInspectable* ___value0) IL2CPP_OVERRIDE
{
return IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3() IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF() IL2CPP_OVERRIDE
{
return IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetAt_m38CCDDE1E25317AEF5170D9818FC01816AF34260(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetAt_m38CCDDE1E25317AEF5170D9818FC01816AF34260_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_get_Size_m33BC340C458F20A80A8B07FF4764CEF1F5513F8B(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_get_Size_m33BC340C458F20A80A8B07FF4764CEF1F5513F8B_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_IndexOf_mFAE432DA0C1902EEF54AB68CFFD3E2182C443F67(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_IndexOf_mFAE432DA0C1902EEF54AB68CFFD3E2182C443F67_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetMany_m6AA46969FB50015EB7107EBCC29E48B7AD4BB6B1(uint32_t ___startIndex0, uint32_t ___items1ArraySize, Il2CppIInspectable** ___items1, uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetMany_m6AA46969FB50015EB7107EBCC29E48B7AD4BB6B1_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___startIndex0, ___items1ArraySize, ___items1, comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) List_1_tE5CBC99D21B114DB0058FF09A59CADD7449EBC8D_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.List`1<System.Collections.Generic.IEnumerable`1<System.Security.Claims.Claim>>
struct List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0_ComCallableWrapper>, IIterable_1_tB7611E3565ADF2561FF7521E03A1E3B93F7BD113, IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8, IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC, IVectorView_1_tDF19789741DDFC543BE092FE627C4F581626F001, IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A
{
inline List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IIterable_1_tB7611E3565ADF2561FF7521E03A1E3B93F7BD113::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IIterable_1_tB7611E3565ADF2561FF7521E03A1E3B93F7BD113*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IVectorView_1_tDF19789741DDFC543BE092FE627C4F581626F001::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IVectorView_1_tDF19789741DDFC543BE092FE627C4F581626F001*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(6);
interfaceIds[0] = IIterable_1_tB7611E3565ADF2561FF7521E03A1E3B93F7BD113::IID;
interfaceIds[1] = IIterable_1_t6359E278A71A51A15FA83695BA7C54F9B3E04824::IID;
interfaceIds[2] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
interfaceIds[3] = IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID;
interfaceIds[4] = IVectorView_1_tDF19789741DDFC543BE092FE627C4F581626F001::IID;
interfaceIds[5] = IVectorView_1_t7215C7C44306F73B6AC4A835AEABA3B0222EA80A::IID;
*iidCount = 6;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IIterable_1_First_m1E9A9F6DA2EC9A3A751A6E85F67C9BB40798A879(IIterator_1_tD5C5DE60C4A835F60D32B19C44430B59B26BFA67** comReturnValue) IL2CPP_OVERRIDE
{
return IIterable_1_First_m1E9A9F6DA2EC9A3A751A6E85F67C9BB40798A879_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IIterable_1_First_m512126C71D7E9D1C31B56F64455F33E9FEEC89F8(IIterator_1_t6A46A7244E5AAD0AE4F2A07AF43DA5052D55F4A4** comReturnValue) IL2CPP_OVERRIDE
{
return IIterable_1_First_m512126C71D7E9D1C31B56F64455F33E9FEEC89F8_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38(IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0(uint32_t ___index0) IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F(Il2CppIInspectable* ___value0) IL2CPP_OVERRIDE
{
return IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3() IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF() IL2CPP_OVERRIDE
{
return IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetAt_m81C572FE9591C741899BB1DBFCBA0D16F83AFA2B(uint32_t ___index0, IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4** comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetAt_m81C572FE9591C741899BB1DBFCBA0D16F83AFA2B_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_get_Size_m17D793E25CDC73C302DC09F9F44E3E945DB6D51B(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_get_Size_m17D793E25CDC73C302DC09F9F44E3E945DB6D51B_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_IndexOf_mDE5247D2CA481566F3163DD73813D5197E9A8C9F(IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_IndexOf_mDE5247D2CA481566F3163DD73813D5197E9A8C9F_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetMany_m8C2CC34D9034DFED1C049E407D18F960E9D41D65(uint32_t ___startIndex0, uint32_t ___items1ArraySize, IIterable_1_t64693143CE4E5082C6101BC54B0427C21F3C01C4** ___items1, uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetMany_m8C2CC34D9034DFED1C049E407D18F960E9D41D65_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___startIndex0, ___items1ArraySize, ___items1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetAt_m72849F526862E096635BA971A074D9B06ABFEE1E(uint32_t ___index0, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8** comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetAt_m72849F526862E096635BA971A074D9B06ABFEE1E_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_get_Size_mB93C08E36F2225BE1862007FAF30C9F2DEE8DAD9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_get_Size_mB93C08E36F2225BE1862007FAF30C9F2DEE8DAD9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_IndexOf_m3D87181F28EC65303ECB5017476C3B38D0944E17(IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_IndexOf_m3D87181F28EC65303ECB5017476C3B38D0944E17_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IVectorView_1_GetMany_mE432D0460C5D84FEC9104DF80F5809975EAE32F8(uint32_t ___startIndex0, uint32_t ___items1ArraySize, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8** ___items1, uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IVectorView_1_GetMany_mE432D0460C5D84FEC9104DF80F5809975EAE32F8_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___startIndex0, ___items1ArraySize, ___items1, comReturnValue);
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) List_1_t9F9EA9C0A48C57B894433ED765DB0B5C1C1E89D0_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<=aba=,Microsoft.Maps.Unity.MapLabel>>
struct List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8, IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC
{
inline List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(2);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
interfaceIds[1] = IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID;
*iidCount = 2;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38(IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0(uint32_t ___index0) IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F(Il2CppIInspectable* ___value0) IL2CPP_OVERRIDE
{
return IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3() IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF() IL2CPP_OVERRIDE
{
return IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) List_1_tA3DE714A1EA1E963BFCD876AAF2D98AB182B15E4_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<System.DateTime,System.TimeType>>
struct List_1_t960AA958F641EF26613957B203B645E693F9430D_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<List_1_t960AA958F641EF26613957B203B645E693F9430D_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8, IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC
{
inline List_1_t960AA958F641EF26613957B203B645E693F9430D_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<List_1_t960AA958F641EF26613957B203B645E693F9430D_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(2);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
interfaceIds[1] = IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID;
*iidCount = 2;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38(IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0(uint32_t ___index0) IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F(Il2CppIInspectable* ___value0) IL2CPP_OVERRIDE
{
return IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3() IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF() IL2CPP_OVERRIDE
{
return IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_List_1_t960AA958F641EF26613957B203B645E693F9430D(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(List_1_t960AA958F641EF26613957B203B645E693F9430D_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) List_1_t960AA958F641EF26613957B203B645E693F9430D_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<Microsoft.MixedReality.Toolkit.IMixedRealityService,Microsoft.MixedReality.Toolkit.IMixedRealityServiceRegistrar>>
struct List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8, IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC
{
inline List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(2);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
interfaceIds[1] = IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID;
*iidCount = 2;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38(IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0(uint32_t ___index0) IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F(Il2CppIInspectable* ___value0) IL2CPP_OVERRIDE
{
return IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3() IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF() IL2CPP_OVERRIDE
{
return IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) List_1_tF5D68ABE9D7311307D9F69DDC4F3F105126BC2A8_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<System.Int32,System.Collections.Generic.HashSet`1<System.Int32>>>
struct List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8, IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC
{
inline List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(2);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
interfaceIds[1] = IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID;
*iidCount = 2;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38(IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0(uint32_t ___index0) IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F(Il2CppIInspectable* ___value0) IL2CPP_OVERRIDE
{
return IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3() IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF() IL2CPP_OVERRIDE
{
return IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) List_1_tF369DE22A8D9E61DDAF76E8E6A20394A444302D9_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<System.Int32,UnityEngine.Vector3>>
struct List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8, IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC
{
inline List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(2);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
interfaceIds[1] = IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID;
*iidCount = 2;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38(IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0(uint32_t ___index0) IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F(Il2CppIInspectable* ___value0) IL2CPP_OVERRIDE
{
return IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3() IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF() IL2CPP_OVERRIDE
{
return IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) List_1_t2B0E097B69E21EE57E2F2BE84618C81325998FEF_ComCallableWrapper(obj));
}
// COM Callable Wrapper for System.Collections.Generic.List`1<System.Collections.Generic.KeyValuePair`2<System.String,=a8B=>>
struct List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562_ComCallableWrapper IL2CPP_FINAL : il2cpp::vm::CachedCCWBase<List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562_ComCallableWrapper>, IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8, IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC
{
inline List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562_ComCallableWrapper(RuntimeObject* obj) : il2cpp::vm::CachedCCWBase<List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562_ComCallableWrapper>(obj) {}
virtual il2cpp_hresult_t STDCALL QueryInterface(const Il2CppGuid& iid, void** object) IL2CPP_OVERRIDE
{
if (::memcmp(&iid, &Il2CppIUnknown::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIInspectable::IID, sizeof(Il2CppGuid)) == 0
|| ::memcmp(&iid, &Il2CppIAgileObject::IID, sizeof(Il2CppGuid)) == 0)
{
*object = GetIdentity();
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIManagedObjectHolder::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIManagedObjectHolder*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIMarshal::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIMarshal*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
if (::memcmp(&iid, &Il2CppIWeakReferenceSource::IID, sizeof(Il2CppGuid)) == 0)
{
*object = static_cast<Il2CppIWeakReferenceSource*>(this);
AddRefImpl();
return IL2CPP_S_OK;
}
*object = NULL;
return IL2CPP_E_NOINTERFACE;
}
virtual uint32_t STDCALL AddRef() IL2CPP_OVERRIDE
{
return AddRefImpl();
}
virtual uint32_t STDCALL Release() IL2CPP_OVERRIDE
{
return ReleaseImpl();
}
virtual il2cpp_hresult_t STDCALL GetIids(uint32_t* iidCount, Il2CppGuid** iids) IL2CPP_OVERRIDE
{
Il2CppGuid* interfaceIds = il2cpp_codegen_marshal_allocate_array<Il2CppGuid>(2);
interfaceIds[0] = IBindableIterable_tF6BD0C070562CD9C91E3C1B1A5F4667E9C3C74A8::IID;
interfaceIds[1] = IBindableVector_tC070A96258CD93818901E9B7808E1A8EFB64B7EC::IID;
*iidCount = 2;
*iids = interfaceIds;
return IL2CPP_S_OK;
}
virtual il2cpp_hresult_t STDCALL GetRuntimeClassName(Il2CppHString* className) IL2CPP_OVERRIDE
{
return GetRuntimeClassNameImpl(className);
}
virtual il2cpp_hresult_t STDCALL GetTrustLevel(int32_t* trustLevel) IL2CPP_OVERRIDE
{
return ComObjectBase::GetTrustLevel(trustLevel);
}
virtual il2cpp_hresult_t STDCALL IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7(IBindableIterator_tD7550F1144CFBE58090050457A2BE92B1CAEABBB** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableIterable_First_m91EC6ED0173145266318FDB7F9074798CD766BD7_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED(uint32_t ___index0, Il2CppIInspectable** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetAt_m33D2170810828C01473D9BDC22745A0354FA4FED_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9(uint32_t* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_get_Size_m45347BCD42A1FE180ED2B377BB9C88C7B50CD7D9_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38(IBindableVectorView_tD80A01049DD2609FEA5FACD5E77BF95A875534FA** comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_GetView_m9736FE93BC8979E0CBF8ED26090D1FE54C2E1A38_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4(Il2CppIInspectable* ___value0, uint32_t* ___index1, bool* comReturnValue) IL2CPP_OVERRIDE
{
return IBindableVector_IndexOf_m2F1A64750D19C5A03E9B65880F4A04275E6AABF4_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0, ___index1, comReturnValue);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_SetAt_mD4C84EC02EAD7F636873B77E6D48E7132055A213_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5(uint32_t ___index0, Il2CppIInspectable* ___value1) IL2CPP_OVERRIDE
{
return IBindableVector_InsertAt_m19A0C885F7C7A7FFA257A46218D7232317E022B5_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0, ___value1);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0(uint32_t ___index0) IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAt_m1AC6E54165809374E91F456B9922A9B24F8652B0_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___index0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F(Il2CppIInspectable* ___value0) IL2CPP_OVERRIDE
{
return IBindableVector_Append_mCA138F8E4026725AC867B607FA63709B6752BB7F_ComCallableWrapperProjectedMethod(GetManagedObjectInline(), ___value0);
}
virtual il2cpp_hresult_t STDCALL IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3() IL2CPP_OVERRIDE
{
return IBindableVector_RemoveAtEnd_mB3178911995D4CC7BAC0EA43720C1280267E54E3_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
virtual il2cpp_hresult_t STDCALL IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF() IL2CPP_OVERRIDE
{
return IBindableVector_Clear_mEF05B40EFF6D42CBB5A5E336B0946FECE7A4A6EF_ComCallableWrapperProjectedMethod(GetManagedObjectInline());
}
};
IL2CPP_EXTERN_C Il2CppIUnknown* CreateComCallableWrapperFor_List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562(RuntimeObject* obj)
{
void* memory = il2cpp::utils::Memory::Malloc(sizeof(List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562_ComCallableWrapper));
if (memory == NULL)
{
il2cpp_codegen_raise_out_of_memory_exception();
}
return static_cast<Il2CppIManagedObjectHolder*>(new(memory) List_1_tBA45D580BE3704A3AE24604C6F866C8EFD179562_ComCallableWrapper(obj));
}
| 51.115778 | 528 | 0.851154 | [
"object"
] |
27ff74f247b980f84f3c43f54333d5aa98177902 | 5,824 | cpp | C++ | Main.cpp | RMPowser/ConsoleFPS | 8dde91295f81aaaf31aac3b19fccf9df8090de98 | [
"MIT"
] | null | null | null | Main.cpp | RMPowser/ConsoleFPS | 8dde91295f81aaaf31aac3b19fccf9df8090de98 | [
"MIT"
] | null | null | null | Main.cpp | RMPowser/ConsoleFPS | 8dde91295f81aaaf31aac3b19fccf9df8090de98 | [
"MIT"
] | null | null | null | #include <iostream>
#include <chrono>
#define UNICODE
#include <Windows.h>
#include <math.h>
#include <vector>
#include <algorithm>
using namespace std;
int screenWidth = 120;
int screenHeight = 40;
float playerX = 8.f;
float playerY = 8.f;
float playerAngle = 0.f;
int mapHeight = 16;
int mapWidth = 16;
float fov = 3.14159 / 4;
float depth = 16.0f;
int main() {
wchar_t* screen = new wchar_t[screenWidth * screenHeight];
HANDLE hConsole = CreateConsoleScreenBuffer(GENERIC_READ | GENERIC_WRITE, 0, NULL, CONSOLE_TEXTMODE_BUFFER, NULL);
SetConsoleActiveScreenBuffer(hConsole);
DWORD dwBytesWritten = 0;
wstring map;
map += L"################";
map += L"#..............#";
map += L"#..............#";
map += L"#..............#";
map += L"#..........#...#";
map += L"#..........#...#";
map += L"#..............#";
map += L"#..............#";
map += L"#..............#";
map += L"#..............#";
map += L"#..............#";
map += L"#..............#";
map += L"#.......########";
map += L"#..............#";
map += L"#..............#";
map += L"################";
auto timePoint1 = chrono::system_clock::now();
auto timePoint2 = chrono::system_clock::now();
while (true) {
timePoint2 = chrono::system_clock::now();
chrono::duration<float> elapsedTimeDuration = timePoint2 - timePoint1;
timePoint1 = timePoint2;
float elapsedTime = elapsedTimeDuration.count();
// controls
if (GetAsyncKeyState((unsigned short)'A') & 0x8000) {
playerAngle -= (1.0f) * elapsedTime;
}
if (GetAsyncKeyState((unsigned short)'D') & 0x8000) {
playerAngle += (1.0f) * elapsedTime;
}
if (GetAsyncKeyState((unsigned short)'W') & 0x8000) {
playerX += sinf(playerAngle) * 5.0f * elapsedTime;
playerY += cosf(playerAngle) * 5.0f * elapsedTime;
if (map[(int)playerY * mapWidth + (int)playerX] == '#') {
playerX -= sinf(playerAngle) * 5.0f * elapsedTime;
playerY -= cosf(playerAngle) * 5.0f * elapsedTime;
}
}
if (GetAsyncKeyState((unsigned short)'S') & 0x8000) {
playerX -= sinf(playerAngle) * 5.0f * elapsedTime;
playerY -= cosf(playerAngle) * 5.0f * elapsedTime;
if (map[(int)playerY * mapWidth + (int)playerX] == '#') {
playerX += sinf(playerAngle) * 5.0f * elapsedTime;
playerY += cosf(playerAngle) * 5.0f * elapsedTime;
}
}
for (int x = 0; x < screenWidth; x++) {
float rayAngle = (playerAngle - fov / 2.0f) + ((float)x / (float)screenWidth) * fov;
float distanceToWall = 0;
bool hitWall = false;
bool boundary = false;
float eyeX = sinf(rayAngle); // unit vector for ray in player space
float eyeY = cosf(rayAngle);
while (!hitWall && distanceToWall < depth) {
distanceToWall += 0.1f;
int testX = (int)(playerX + eyeX * distanceToWall);
int testY = (int)(playerY + eyeY * distanceToWall);
// is ray out of bounds?
if (testX < 0 || testX >= mapWidth || testY < 0 || testY >= mapHeight) {
hitWall = true;
distanceToWall = depth;
}
else {
// ray is in bounds so see if the ray cell is a wall
if (map[testY * mapWidth + testX] == '#') {
hitWall = true;
vector<pair<float, float>> p; // distance, dot
for (int tx = 0; tx < 2; tx++) {
for (int ty = 0; ty < 2; ty++) {
float vx = (float)testX + tx - playerX;
float vy = (float)testY + ty - playerY;
float d = sqrt(vx * vx + vy * vy);
float dot = (eyeX * vx / d) + (eyeY * vy / d);
p.push_back(make_pair(d, dot));
}
}
// sort pairs from closest to farthest
sort(p.begin(), p.end(), [](const pair<float, float>& left, const pair<float, float>& right) {return left.first < right.first; });
float bound = 0.01;
if (acos(p.at(0).second) < bound) {
boundary = true;
}
if (acos(p.at(1).second) < bound) {
boundary = true;
}
if (acos(p.at(2).second) < bound) {
boundary = true;
}
}
}
}
// find distance to ceiling and floor
int ceiling = (float)(screenHeight / 2.0) - screenHeight / ((float)distanceToWall);
int floor = screenHeight - ceiling;
short shade = ' ';
if (distanceToWall <= depth / 4.0f) {
shade = 0x2588; // very close
}
else if (distanceToWall < depth / 3.0f) {
shade = 0x2593;
}
else if (distanceToWall < depth / 2.0f) {
shade = 0x2592;
}
else if (distanceToWall < depth) {
shade = 0x2591;
}
else {
shade = ' '; // far away
}
if (boundary) {
shade = ' ';
}
for (int y = 0; y < screenHeight; y++) {
if (y < ceiling) {
screen[y * screenWidth + x] = ' ';
}
else if (y > ceiling && y <= floor) {
screen[y * screenWidth + x] = shade;
}
else {
short floorShade = ' ';
float b = 1.0f - (((float)y - screenHeight / 2.0f) / ((float)screenHeight / 2.0f));
if (b < 0.25f) {
floorShade = '#'; // very close
}
else if (b < 0.5f) {
floorShade = 'x';
}
else if (b < 0.75f) {
floorShade = '.';
}
else if (b < 0.9f) {
floorShade = '-';
}
else {
floorShade = ' '; // far away
}
screen[y * screenWidth + x] = floorShade;
}
}
}
// display stats
swprintf(screen, 40, L"X=%3.2f, Y=%3.2f, A=%3.2f, FPS=%3.2f ", playerX, playerY, playerAngle, 1.0f / elapsedTime);
// display map
for (int nx = 0; nx < mapWidth; nx++) {
for (int ny = 0; ny < mapWidth; ny++) {
screen[(ny + 1) * screenWidth + nx] = map[ny * mapWidth + nx];
}
}
screen[((int)playerY + 1) * screenWidth + (int)playerX] = 'P';
screen[screenWidth * screenHeight - 1] = '\0';
WriteConsoleOutputCharacter(hConsole, screen, screenWidth * screenHeight, { 0,0 }, &dwBytesWritten);
}
return 0;
} | 26.962963 | 136 | 0.541724 | [
"vector"
] |
7e02d2d8226ff9b7720470882b8668561089451a | 890 | cpp | C++ | AtCoder/ABC195/d.cpp | Takumi1122/data-structure-algorithm | 6b9f26e4dbba981f034518a972ecfc698b86d837 | [
"MIT"
] | null | null | null | AtCoder/ABC195/d.cpp | Takumi1122/data-structure-algorithm | 6b9f26e4dbba981f034518a972ecfc698b86d837 | [
"MIT"
] | null | null | null | AtCoder/ABC195/d.cpp | Takumi1122/data-structure-algorithm | 6b9f26e4dbba981f034518a972ecfc698b86d837 | [
"MIT"
] | null | null | null | #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); ++i)
using namespace std;
using ll = long long;
using P = pair<int, int>;
using Graph = vector<vector<int>>;
int main() {
int n, m, q;
cin >> n >> m >> q;
vector<int> w(n), v(n);
rep(i, n) cin >> w[i] >> v[i];
vector<int> x(m);
rep(i, m) cin >> x[i];
rep(i, q) {
int l, r;
cin >> l >> r;
vector<int> a;
rep(i, l - 1) a.push_back(x[i]);
for (int i = r; i < m; i++) a.push_back(x[i]);
sort(a.begin(), a.end());
vector<P> b(n);
rep(i, n) b[i] = P(v[i], w[i]);
sort(b.begin(), b.end(), greater<P>());
int ans = 0;
rep(i, n) {
int v = b[i].first;
int w = b[i].second;
rep(j, a.size()) {
if (a[j] >= w) {
ans += v;
a.erase(a.begin() + j);
break;
}
}
}
cout << ans << endl;
}
return 0;
} | 21.707317 | 50 | 0.435955 | [
"vector"
] |
7e0bd8e5c446d6697cbca177c4bdb9a28d48cd89 | 31,173 | cpp | C++ | STARLIGHT/starlight/src/photonNucleusCrossSection.cpp | zwound40/AliRoot | 2eeb196e31e59937df6705c3b7fca0e6da4a8cb2 | [
"BSD-3-Clause"
] | 52 | 2016-12-11T13:04:01.000Z | 2022-03-11T11:49:35.000Z | STARLIGHT/starlight/src/photonNucleusCrossSection.cpp | zwound40/AliRoot | 2eeb196e31e59937df6705c3b7fca0e6da4a8cb2 | [
"BSD-3-Clause"
] | 1,388 | 2016-11-01T10:27:36.000Z | 2022-03-30T15:26:09.000Z | STARLIGHT/starlight/src/photonNucleusCrossSection.cpp | zwound40/AliRoot | 2eeb196e31e59937df6705c3b7fca0e6da4a8cb2 | [
"BSD-3-Clause"
] | 275 | 2016-06-21T20:24:05.000Z | 2022-03-31T13:06:19.000Z | ///////////////////////////////////////////////////////////////////////////
//
// Copyright 2010
//
// This file is part of starlight.
//
// starlight 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.
//
// starlight 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 starlight. If not, see <http://www.gnu.org/licenses/>.
//
///////////////////////////////////////////////////////////////////////////
//
// File and Version Information:
// $Rev:: 293 $: revision of last commit
// $Author:: butter $: author of last commit
// $Date:: 2017-11-11 15:46:05 +0100 #$: date of last commit
//
// Description:
//
//
///////////////////////////////////////////////////////////////////////////
#include <iostream>
#include <fstream>
#include <cmath>
#include "reportingUtils.h"
#include "starlightconstants.h"
#include "bessel.h"
#include "photonNucleusCrossSection.h"
using namespace std;
using namespace starlightConstants;
//______________________________________________________________________________
photonNucleusCrossSection::photonNucleusCrossSection(const inputParameters& inputParametersInstance, const beamBeamSystem& bbsystem)
: _ip(&inputParametersInstance),
_nWbins (inputParametersInstance.nmbWBins() ),
_nYbins (inputParametersInstance.nmbRapidityBins() ),
_wMin (inputParametersInstance.minW() ),
_wMax (inputParametersInstance.maxW() ),
_yMax (inputParametersInstance.maxRapidity() ),
_beamLorentzGamma (inputParametersInstance.beamLorentzGamma() ),
_bbs (bbsystem ),
_protonEnergy (inputParametersInstance.protonEnergy() ),
_particleType (inputParametersInstance.prodParticleType() ),
_beamBreakupMode (inputParametersInstance.beamBreakupMode() ),
_productionMode (inputParametersInstance.productionMode() ),
_sigmaNucleus (_bbs.beam2().A() )
{
// new options - impulse aproximation (per Joakim) and Quantum Glauber (per SK) SKQG
_impulseSelected = inputParametersInstance.impulseVM();
_quantumGlauber = inputParametersInstance.quantumGlauber();
switch(_particleType) {
case RHO:
_slopeParameter = 11.0; // [(GeV/c)^{-2}]
_vmPhotonCoupling = 2.02;
_ANORM = -2.75;
_BNORM = 0.0;
_defaultC = 1.0;
_channelMass = _ip->rho0Mass();
_width = _ip->rho0Width();
break;
case RHOZEUS:
_slopeParameter =11.0;
_vmPhotonCoupling=2.02;
_ANORM=-2.75;
_BNORM=1.84;
_defaultC=1.0;
_channelMass = _ip->rho0Mass();
_width = _ip->rho0Width();
break;
case FOURPRONG:
_slopeParameter = 11.0;
_vmPhotonCoupling = 2.02;
_ANORM = -2.75;
_BNORM = 0;
_defaultC = 11.0;
_channelMass = _ip->rho0PrimeMass();
_width = _ip->rho0PrimeWidth();
break;
case OMEGA:
_slopeParameter=10.0;
_vmPhotonCoupling=23.13;
_ANORM=-2.75;
_BNORM=0.0;
_defaultC=1.0;
_channelMass = _ip->OmegaMass();
_width = _ip->OmegaWidth();
break;
case PHI:
_slopeParameter=7.0;
_vmPhotonCoupling=13.71;
_ANORM=-2.75;
_BNORM=0.0;
_defaultC=1.0;
_channelMass = _ip->PhiMass();
_width = _ip->PhiWidth();
break;
case JPSI:
case JPSI_ee:
case JPSI_mumu:
case JPSI_ppbar:
_slopeParameter=4.0;
_vmPhotonCoupling=10.45;
_ANORM=-2.75;
_BNORM=0.0;
_defaultC=1.0;
_channelMass = _ip->JpsiMass();
_width = _ip->JpsiWidth();
break;
case JPSI2S:
case JPSI2S_ee:
case JPSI2S_mumu:
_slopeParameter=4.3;
_vmPhotonCoupling=26.39;
_ANORM=-2.75;
_BNORM=0.0;
_defaultC=1.0;
_channelMass = _ip->Psi2SMass();
_width = _ip->Psi2SWidth();
break;
case UPSILON:
case UPSILON_ee:
case UPSILON_mumu:
_slopeParameter=4.0;
_vmPhotonCoupling=125.37;
_ANORM=-2.75;
_BNORM=0.0;
_defaultC=1.0;
_channelMass = _ip->Upsilon1SMass();
_width = _ip->Upsilon1SWidth();
break;
case UPSILON2S:
case UPSILON2S_ee:
case UPSILON2S_mumu:
_slopeParameter=4.0;
_vmPhotonCoupling=290.84;
_ANORM=-2.75;
_BNORM=0.0;
_defaultC=1.0;
_channelMass = _ip->Upsilon2SMass();
_width = _ip->Upsilon2SWidth();
break;
case UPSILON3S:
case UPSILON3S_ee:
case UPSILON3S_mumu:
_slopeParameter=4.0;
_vmPhotonCoupling=415.10;
_ANORM=-2.75;
_BNORM=0.0;
_defaultC=1.0;
_channelMass = _ip->Upsilon3SMass();
_width = _ip->Upsilon3SWidth();
break;
default:
cout <<"No sigma constants parameterized for pid: "<<_particleType
<<" GammaAcrosssection"<<endl;
}
_maxPhotonEnergy = 12. * _beamLorentzGamma * hbarc/(_bbs.beam1().nuclearRadius()+_bbs.beam2().nuclearRadius());
}
//______________________________________________________________________________
photonNucleusCrossSection::~photonNucleusCrossSection()
{ }
//______________________________________________________________________________
void
photonNucleusCrossSection::crossSectionCalculation(const double)
{
cout << "Neither narrow/wide resonance cross-section calculation.--Derived" << endl;
}
//______________________________________________________________________________
double
photonNucleusCrossSection::getcsgA(const double Egamma,
const double W,
const int beam)
{
//This function returns the cross-section for photon-nucleus interaction
//producing vectormesons
double Av,Wgp,cs,cvma;
double t,tmin,tmax;
double csgA,ax,bx;
int NGAUSS;
// DATA FOR GAUSS INTEGRATION
double xg[6] = {0, 0.1488743390, 0.4333953941, 0.6794095683, 0.8650633667, 0.9739065285};
double ag[6] = {0, 0.2955242247, 0.2692667193, 0.2190863625, 0.1494513492, 0.0666713443};
NGAUSS = 6;
// Find gamma-proton CM energy
Wgp = sqrt(2. * Egamma * (_protonEnergy
+ sqrt(_protonEnergy * _protonEnergy - _ip->protonMass() * _ip->protonMass()))
+ _ip->protonMass() * _ip->protonMass());
//Used for A-A
tmin = (W * W / (4. * Egamma * _beamLorentzGamma)) * (W * W / (4. * Egamma * _beamLorentzGamma));
if ((_bbs.beam1().A() == 1) && (_bbs.beam2().A() == 1)){
// proton-proton, no scaling needed
csgA = sigmagp(Wgp);
} else {
// coherent AA interactions
int A_1 = _bbs.beam1().A();
int A_2 = _bbs.beam2().A();
// Calculate V.M.+proton cross section
// cs = sqrt(16. * pi * _vmPhotonCoupling * _slopeParameter * hbarc * hbarc * sigmagp(Wgp) / alpha);
cs = sigma_N(Wgp); //Use member function instead
// Calculate V.M.+nucleus cross section
cvma = sigma_A(cs,beam);
// Do impulse approximation here
if( _impulseSelected == 1){
if( beam == 1 ){
cvma = A_1*cs;
} else if ( beam == 2 ){
cvma = A_2*cs;
}
}
// Calculate Av = dsigma/dt(t=0) Note Units: fm**s/Gev**2
Av = (alpha * cvma * cvma) / (16. * pi * _vmPhotonCoupling * hbarc * hbarc);
tmax = tmin + 0.25;
ax = 0.5 * (tmax - tmin);
bx = 0.5 * (tmax + tmin);
csgA = 0.;
for (int k = 1; k < NGAUSS; ++k) {
t = ax * xg[k] + bx;
if( A_1 == 1 && A_2 != 1){
csgA = csgA + ag[k] * _bbs.beam2().formFactor(t) * _bbs.beam2().formFactor(t);
}else if(A_2 ==1 && A_1 != 1){
csgA = csgA + ag[k] * _bbs.beam1().formFactor(t) * _bbs.beam1().formFactor(t);
}else{
if( beam==1 ){
csgA = csgA + ag[k] * _bbs.beam1().formFactor(t) * _bbs.beam1().formFactor(t);
}else if(beam==2){
csgA = csgA + ag[k] * _bbs.beam2().formFactor(t) * _bbs.beam2().formFactor(t);
}else{
cout<<"Something went wrong here, beam= "<<beam<<endl;
}
}
t = ax * (-xg[k]) + bx;
if( A_1 == 1 && A_2 != 1){
csgA = csgA + ag[k] * _bbs.beam2().formFactor(t) * _bbs.beam2().formFactor(t);
}else if(A_2 ==1 && A_1 != 1){
csgA = csgA + ag[k] * _bbs.beam1().formFactor(t) * _bbs.beam1().formFactor(t);
}else{
if( beam==1 ){
csgA = csgA + ag[k] * _bbs.beam1().formFactor(t) * _bbs.beam1().formFactor(t);
}else if(beam==2){
csgA = csgA + ag[k] * _bbs.beam2().formFactor(t) * _bbs.beam2().formFactor(t);
}else{
cout<<"Something went wrong here, beam= "<<beam<<endl;
}
}
}
csgA = 0.5 * (tmax - tmin) * csgA;
csgA = Av * csgA;
}
return csgA;
}
//______________________________________________________________________________
double
photonNucleusCrossSection::photonFlux(const double Egamma, const int beam)
{
// This routine gives the photon flux as a function of energy Egamma
// It works for arbitrary nuclei and gamma; the first time it is
// called, it calculates a lookup table which is used on
// subsequent calls.
// It returns dN_gamma/dE (dimensions 1/E), not dI/dE
// energies are in GeV, in the lab frame
// rewritten 4/25/2001 by SRK
// NOTE: beam (=1,2) defines the photon TARGET
double lEgamma,Emin,Emax;
static double lnEmax, lnEmin, dlnE;
double stepmult,energy,rZ;
int nbstep,nrstep,nphistep,nstep;
double bmin,bmax,bmult,biter,bold,integratedflux;
double fluxelement,deltar,riter;
double deltaphi,phiiter,dist;
static double dide[401];
double lnElt;
double flux_r;
double Xvar;
int Ilt;
double RNuc=0.,RSum=0.;
RSum=_bbs.beam1().nuclearRadius()+_bbs.beam2().nuclearRadius();
if( beam == 1){
rZ=double(_bbs.beam2().Z());
RNuc = _bbs.beam1().nuclearRadius();
} else {
rZ=double(_bbs.beam1().Z());
RNuc = _bbs.beam2().nuclearRadius();
}
static int Icheck = 0;
static int Ibeam = 0;
//Check first to see if pp
if( _bbs.beam1().A()==1 && _bbs.beam2().A()==1 ){
int nbsteps = 400;
double bmin = 0.5;
double bmax = 5.0 + (5.0*_beamLorentzGamma*hbarc/Egamma);
double dlnb = (log(bmax)-log(bmin))/(1.*nbsteps);
double local_sum=0.0;
// Impact parameter loop
for (int i = 0; i<=nbsteps;i++){
double bnn0 = bmin*exp(i*dlnb);
double bnn1 = bmin*exp((i+1)*dlnb);
double db = bnn1-bnn0;
double ppslope = 19.0;
double GammaProfile = exp(-bnn0*bnn0/(2.*hbarc*hbarc*ppslope));
double PofB0 = 1. - (1. - GammaProfile)*(1. - GammaProfile);
GammaProfile = exp(-bnn1*bnn1/(2.*hbarc*hbarc*ppslope));
double PofB1 = 1. - (1. - GammaProfile)*(1. - GammaProfile);
double loc_nofe0 = _bbs.beam1().photonDensity(bnn0,Egamma);
double loc_nofe1 = _bbs.beam2().photonDensity(bnn1,Egamma);
local_sum += 0.5*loc_nofe0*(1. - PofB0)*2.*starlightConstants::pi*bnn0*db;
local_sum += 0.5*loc_nofe1*(1. - PofB1)*2.*starlightConstants::pi*bnn1*db;
}
// End Impact parameter loop
return local_sum;
}
// first call or new beam? - initialize - calculate photon flux
Icheck=Icheck+1;
// Do the numerical integration only once for symmetric systems.
if( Icheck > 1 && _bbs.beam1().A() == _bbs.beam2().A() && _bbs.beam1().Z() == _bbs.beam2().Z() ) goto L1000f;
// For asymmetric systems check if we have another beam
if( Icheck > 1 && beam == Ibeam ) goto L1000f;
Ibeam = beam;
// Nuclear breakup is done by PofB
// collect number of integration steps here, in one place
nbstep=1200;
nrstep=60;
nphistep=40;
// this last one is the number of energy steps
nstep=100;
// following previous choices, take Emin=10 keV at LHC, Emin = 1 MeV at RHIC
Emin=1.E-5;
if (_beamLorentzGamma < 500)
Emin=1.E-3;
Emax=_maxPhotonEnergy;
// Emax=12.*hbarc*_beamLorentzGamma/RSum;
// >> lnEmin <-> ln(Egamma) for the 0th bin
// >> lnEmax <-> ln(Egamma) for the last bin
lnEmin=log(Emin);
lnEmax=log(Emax);
dlnE=(lnEmax-lnEmin)/nstep;
printf("Calculating photon flux from Emin = %e GeV to Emax = %e GeV (CM frame) for source with Z = %3.0f \n", Emin, Emax, rZ);
stepmult= exp(log(Emax/Emin)/double(nstep));
energy=Emin;
for (int j = 1; j<=nstep;j++){
energy=energy*stepmult;
// integrate flux over 2R_A < b < 2R_A+ 6* gamma hbar/energy
// use exponential steps
bmin=0.8*RSum; //Start slightly below 2*Radius
bmax=bmin + 6.*hbarc*_beamLorentzGamma/energy;
bmult=exp(log(bmax/bmin)/double(nbstep));
biter=bmin;
integratedflux=0.;
if( (_bbs.beam1().A() == 1 && _bbs.beam2().A() != 1) || (_bbs.beam2().A() == 1 && _bbs.beam1().A() != 1) ){
// This is pA
if( _productionMode == PHOTONPOMERONINCOHERENT ){
// This pA incoherent, proton is the target
int nbsteps = 400;
double bmin = 0.7*RSum;
double bmax = 2.0*RSum + (8.0*_beamLorentzGamma*hbarc/energy);
double dlnb = (log(bmax)-log(bmin))/(1.*nbsteps);
double local_sum=0.0;
// Impact parameter loop
for (int i = 0; i<=nbsteps; i++){
double bnn0 = bmin*exp(i*dlnb);
double bnn1 = bmin*exp((i+1)*dlnb);
double db = bnn1-bnn0;
double PofB0 = _bbs.probabilityOfBreakup(bnn0);
double PofB1 = _bbs.probabilityOfBreakup(bnn1);
double loc_nofe0 = 0.0;
double loc_nofe1 = 0.0;
if( _bbs.beam1().A() == 1 ){
loc_nofe0 = _bbs.beam2().photonDensity(bnn0,energy);
loc_nofe1 = _bbs.beam2().photonDensity(bnn1,energy);
}
else if( _bbs.beam2().A() == 1 ){
loc_nofe0 = _bbs.beam1().photonDensity(bnn0,energy);
loc_nofe1 = _bbs.beam1().photonDensity(bnn1,energy);
}
// cout<<" i: "<<i<<" bnn0: "<<bnn0<<" PofB0: "<<PofB0<<" loc_nofe0: "<<loc_nofe0<<endl;
local_sum += 0.5*loc_nofe0*PofB0*2.*starlightConstants::pi*bnn0*db;
local_sum += 0.5*loc_nofe1*PofB1*2.*starlightConstants::pi*bnn1*db;
} // End Impact parameter loop
integratedflux = local_sum;
} else if ( _productionMode == PHOTONPOMERONNARROW || _productionMode == PHOTONPOMERONWIDE ){
// This is pA coherent, nucleus is the target
double localbmin = 0.0;
if( _bbs.beam1().A() == 1 ){
localbmin = _bbs.beam2().nuclearRadius() + 0.7;
}
if( _bbs.beam2().A() == 1 ){
localbmin = _bbs.beam1().nuclearRadius() + 0.7;
}
integratedflux = nepoint(energy,localbmin);
}
}else{
// This is AA
for (int jb = 1; jb<=nbstep;jb++){
bold=biter;
biter=biter*bmult;
// When we get to b>20R_A change methods - just take the photon flux
// at the center of the nucleus.
if (biter > (10.*RNuc)){
// if there is no nuclear breakup or only hadronic breakup, which only
// occurs at smaller b, we can analytically integrate the flux from b~20R_A
// to infinity, following Jackson (2nd edition), Eq. 15.54
Xvar=energy*biter/(hbarc*_beamLorentzGamma);
// Here, there is nuclear breakup. So, we can't use the integrated flux
// However, we can do a single flux calculation, at the center of the nucleus
// Eq. 41 of Vidovic, Greiner and Soff, Phys.Rev.C47,2308(1993), among other places
// this is the flux per unit area
fluxelement = (rZ*rZ*alpha*energy)*
(bessel::dbesk1(Xvar))*(bessel::dbesk1(Xvar))/
((pi*_beamLorentzGamma*hbarc)*
(pi*_beamLorentzGamma*hbarc));
} else {
// integrate over nuclear surface. n.b. this assumes total shadowing -
// treat photons hitting the nucleus the same no matter where they strike
fluxelement=0.;
deltar=RNuc/double(nrstep);
riter=-deltar/2.;
for (int jr =1; jr<=nrstep;jr++){
riter=riter+deltar;
// use symmetry; only integrate from 0 to pi (half circle)
deltaphi=pi/double(nphistep);
phiiter=0.;
for( int jphi=1;jphi<= nphistep;jphi++){
phiiter=(double(jphi)-0.5)*deltaphi;
// dist is the distance from the center of the emitting nucleus
// to the point in question
dist=sqrt((biter+riter*cos(phiiter))*(biter+riter*
cos(phiiter))+(riter*sin(phiiter))*(riter*sin(phiiter)));
Xvar=energy*dist/(hbarc*_beamLorentzGamma);
flux_r = (rZ*rZ*alpha*energy)*
(bessel::dbesk1(Xvar)*bessel::dbesk1(Xvar))/
((pi*_beamLorentzGamma*hbarc)*
(pi*_beamLorentzGamma*hbarc));
// The surface element is 2.* delta phi* r * delta r
// The '2' is because the phi integral only goes from 0 to pi
fluxelement=fluxelement+flux_r*2.*deltaphi*riter*deltar;
// end phi and r integrations
}//for(jphi)
}//for(jr)
// average fluxelement over the nuclear surface
fluxelement=fluxelement/(pi*RNuc*RNuc);
}//else
// multiply by volume element to get total flux in the volume element
fluxelement=fluxelement*2.*pi*biter*(biter-bold);
// modulate by the probability of nuclear breakup as f(biter)
// cout<<" jb: "<<jb<<" biter: "<<biter<<" fluxelement: "<<fluxelement<<endl;
if (_beamBreakupMode > 1){
fluxelement=fluxelement*_bbs.probabilityOfBreakup(biter);
}
// cout<<" jb: "<<jb<<" biter: "<<biter<<" fluxelement: "<<fluxelement<<endl;
integratedflux=integratedflux+fluxelement;
} //end loop over impact parameter
} //end of else (pp, pA, AA)
// In lookup table, store k*dN/dk because it changes less
// so the interpolation should be better
dide[j]=integratedflux*energy;
}//end loop over photon energy
// for 2nd and subsequent calls, use lookup table immediately
L1000f:
lEgamma=log(Egamma);
if (lEgamma < (lnEmin+dlnE) || lEgamma > lnEmax){
flux_r=0.0;
// cout<<" WARNING: Egamma outside defined range. Egamma= "<<Egamma
// <<" "<<lnEmax<<" "<<(lnEmin+dlnE)<<endl;
}
else{
// >> Egamma between Ilt and Ilt+1
Ilt = int((lEgamma-lnEmin)/dlnE);
// >> ln(Egamma) for first point
lnElt = lnEmin + Ilt*dlnE;
// >> Interpolate
flux_r = dide[Ilt] + ((lEgamma-lnElt)/dlnE)*(dide[Ilt+1]- dide[Ilt]);
flux_r = flux_r/Egamma;
}
return flux_r;
}
//______________________________________________________________________________
double
photonNucleusCrossSection::nepoint(const double Egamma,
const double bmin)
{
// Function for the spectrum of virtual photons,
// dn/dEgamma, for a point charge q=Ze sweeping
// past the origin with velocity gamma
// (=1/SQRT(1-(V/c)**2)) integrated over impact
// parameter from bmin to infinity
// See Jackson eq15.54 Classical Electrodynamics
// Declare Local Variables
double beta,X,C1,bracket,nepoint_r;
beta = sqrt(1.-(1./(_beamLorentzGamma*_beamLorentzGamma)));
X = (bmin*Egamma)/(beta*_beamLorentzGamma*hbarc);
bracket = -0.5*beta*beta*X*X*(bessel::dbesk1(X)*bessel::dbesk1(X)
-bessel::dbesk0(X)*bessel::dbesk0(X));
bracket = bracket+X*bessel::dbesk0(X)*bessel::dbesk1(X);
// Note: NO Z*Z!!
C1=(2.*alpha)/pi;
nepoint_r = C1*(1./beta)*(1./beta)*(1./Egamma)*bracket;
return nepoint_r;
}
//______________________________________________________________________________
double
photonNucleusCrossSection::sigmagp(const double Wgp)
{
// Function for the gamma-proton --> VectorMeson
// cross section. Wgp is the gamma-proton CM energy.
// Unit for cross section: fm**2
double sigmagp_r=0.;
switch(_particleType)
{
case RHO:
case RHOZEUS:
case FOURPRONG:
sigmagp_r=1.E-4*(5.0*exp(0.22*log(Wgp))+26.0*exp(-1.23*log(Wgp)));
break;
case OMEGA:
sigmagp_r=1.E-4*(0.55*exp(0.22*log(Wgp))+18.0*exp(-1.92*log(Wgp)));
break;
case PHI:
sigmagp_r=1.E-4*0.34*exp(0.22*log(Wgp));
break;
case JPSI:
case JPSI_ee:
case JPSI_mumu:
case JPSI_ppbar:
sigmagp_r=(1.0-((_channelMass+_ip->protonMass())*(_channelMass+_ip->protonMass()))/(Wgp*Wgp));
sigmagp_r*=sigmagp_r;
sigmagp_r*=1.E-4*0.00406*exp(0.65*log(Wgp));
// sigmagp_r=1.E-4*0.0015*exp(0.80*log(Wgp));
break;
case JPSI2S:
case JPSI2S_ee:
case JPSI2S_mumu:
sigmagp_r=(1.0-((_channelMass+_ip->protonMass())*(_channelMass+_ip->protonMass()))/(Wgp*Wgp));
sigmagp_r*=sigmagp_r;
sigmagp_r*=1.E-4*0.00406*exp(0.65*log(Wgp));
sigmagp_r*=0.166;
// sigmagp_r=0.166*(1.E-4*0.0015*exp(0.80*log(Wgp)));
break;
case UPSILON:
case UPSILON_ee:
case UPSILON_mumu:
// >> This is W**1.7 dependence from QCD calculations
// sigmagp_r=1.E-10*(0.060)*exp(1.70*log(Wgp));
sigmagp_r=(1.0-((_channelMass+_ip->protonMass())*(_channelMass+_ip->protonMass()))/(Wgp*Wgp));
sigmagp_r*=sigmagp_r;
sigmagp_r*=1.E-10*6.4*exp(0.74*log(Wgp));
break;
case UPSILON2S:
case UPSILON2S_ee:
case UPSILON2S_mumu:
// sigmagp_r=1.E-10*(0.0259)*exp(1.70*log(Wgp));
sigmagp_r=(1.0-((_channelMass+_ip->protonMass())*(_channelMass+_ip->protonMass()))/(Wgp*Wgp));
sigmagp_r*=sigmagp_r;
sigmagp_r*=1.E-10*2.9*exp(0.74*log(Wgp));
break;
case UPSILON3S:
case UPSILON3S_ee:
case UPSILON3S_mumu:
// sigmagp_r=1.E-10*(0.0181)*exp(1.70*log(Wgp));
sigmagp_r=(1.0-((_channelMass+_ip->protonMass())*(_channelMass+_ip->protonMass()))/(Wgp*Wgp));
sigmagp_r*=sigmagp_r;
sigmagp_r*=1.E-10*2.1*exp(0.74*log(Wgp));
break;
default: cout<< "!!! ERROR: Unidentified Vector Meson: "<< _particleType <<endl;
}
return sigmagp_r;
}
//______________________________________________________________________________
double
photonNucleusCrossSection::sigma_A(const double sig_N, const int beam)
{
// Nuclear Cross Section
// sig_N,sigma_A in (fm**2)
double sum;
double b,bmax,Pint,arg,sigma_A_r;
int NGAUSS;
double xg[17]=
{.0,
.0483076656877383162,.144471961582796493,
.239287362252137075, .331868602282127650,
.421351276130635345, .506899908932229390,
.587715757240762329, .663044266930215201,
.732182118740289680, .794483795967942407,
.849367613732569970, .896321155766052124,
.934906075937739689, .964762255587506430,
.985611511545268335, .997263861849481564
};
double ag[17]=
{.0,
.0965400885147278006, .0956387200792748594,
.0938443990808045654, .0911738786957638847,
.0876520930044038111, .0833119242269467552,
.0781938957870703065, .0723457941088485062,
.0658222227763618468, .0586840934785355471,
.0509980592623761762, .0428358980222266807,
.0342738629130214331, .0253920653092620595,
.0162743947309056706, .00701861000947009660
};
NGAUSS=16;
// Check if one or both beams are nuclei
int A_1 = _bbs.beam1().A();
int A_2 = _bbs.beam2().A();
if( A_1 == 1 && A_2 == 1)cout<<" This is pp, you should not be here..."<<endl;
// CALCULATE P(int) FOR b=0.0 - bmax (fm)
bmax = 25.0;
sum = 0.;
for(int IB=1;IB<=NGAUSS;IB++){
b = 0.5*bmax*xg[IB]+0.5*bmax;
if( A_1 == 1 && A_2 != 1){
arg=-sig_N*_bbs.beam2().rho0()*_bbs.beam2().thickness(b);
}else if(A_2 == 1 && A_1 != 1){
arg=-sig_N*_bbs.beam1().rho0()*_bbs.beam1().thickness(b);
}else{
// Check which beam is target
if( beam == 1 ){
arg=-sig_N*_bbs.beam1().rho0()*_bbs.beam1().thickness(b);
}else if( beam==2 ){
arg=-sig_N*_bbs.beam2().rho0()*_bbs.beam2().thickness(b);
}else{
cout<<" Something went wrong here, beam= "<<beam<<endl;
}
}
Pint=1.0-exp(arg);
// If this is a quantum Glauber calculation, use the quantum Glauber formula
if (_quantumGlauber == 1){Pint=2.0*(1.0-exp(arg/2.0));}
sum=sum+2.*pi*b*Pint*ag[IB];
b = 0.5*bmax*(-xg[IB])+0.5*bmax;
if( A_1 == 1 && A_2 != 1){
arg=-sig_N*_bbs.beam2().rho0()*_bbs.beam2().thickness(b);
}else if(A_2 == 1 && A_1 != 1){
arg=-sig_N*_bbs.beam1().rho0()*_bbs.beam1().thickness(b);
}else{
// Check which beam is target
if( beam == 1 ){
arg=-sig_N*_bbs.beam1().rho0()*_bbs.beam1().thickness(b);
}else if(beam==2){
arg=-sig_N*_bbs.beam2().rho0()*_bbs.beam2().thickness(b);
}else{
cout<<" Something went wrong here, beam= "<<beam<<endl;
}
}
Pint=1.0-exp(arg);
// If this is a quantum Glauber calculation, use the quantum Glauber formula
if (_quantumGlauber == 1){Pint=2.0*(1.0-exp(arg/2.0));}
sum=sum+2.*pi*b*Pint*ag[IB];
}
sum=0.5*bmax*sum;
sigma_A_r=sum;
return sigma_A_r;
}
//______________________________________________________________________________
double
photonNucleusCrossSection::sigma_N(const double Wgp)
{
// Nucleon Cross Section in (fm**2)
double cs = sqrt(16. * pi * _vmPhotonCoupling * _slopeParameter * hbarc * hbarc * sigmagp(Wgp) / alpha);
return cs;
}
//______________________________________________________________________________
double
photonNucleusCrossSection::breitWigner(const double W,
const double C)
{
// use simple fixed-width s-wave Breit-Wigner without coherent backgorund for rho'
// (PDG '08 eq. 38.56)
if(_particleType==FOURPRONG) {
if (W < 4.01 * _ip->pionChargedMass())
return 0;
const double termA = _channelMass * _width;
const double termA2 = termA * termA;
const double termB = W * W - _channelMass * _channelMass;
return C * _ANORM * _ANORM * termA2 / (termB * termB + termA2);
}
// Relativistic Breit-Wigner according to J.D. Jackson,
// Nuovo Cimento 34, 6692 (1964), with nonresonant term. A is the strength
// of the resonant term and b the strength of the non-resonant
// term. C is an overall normalization.
double ppi=0.,ppi0=0.,GammaPrim,rat;
double aa,bb,cc;
double nrbw_r;
// width depends on energy - Jackson Eq. A.2
// if below threshold, then return 0. Added 5/3/2001 SRK
// 0.5% extra added for safety margin
// omega added here 10/26/2014 SRK
if( _particleType==RHO ||_particleType==RHOZEUS || _particleType==OMEGA){
if (W < 2.01*_ip->pionChargedMass()){
nrbw_r=0.;
return nrbw_r;
}
ppi=sqrt( ((W/2.)*(W/2.)) - _ip->pionChargedMass() * _ip->pionChargedMass());
ppi0=0.358;
}
// handle phi-->K+K- properly
if (_particleType == PHI){
if (W < 2.*_ip->kaonChargedMass()){
nrbw_r=0.;
return nrbw_r;
}
ppi=sqrt( ((W/2.)*(W/2.))- _ip->kaonChargedMass()*_ip->kaonChargedMass());
ppi0=sqrt( ((_channelMass/2.)*(_channelMass/2.))-_ip->kaonChargedMass()*_ip->kaonChargedMass());
}
//handle J/Psi-->e+e- properly
if (_particleType==JPSI || _particleType==JPSI2S){
if(W<2.*_ip->mel()){
nrbw_r=0.;
return nrbw_r;
}
ppi=sqrt(((W/2.)*(W/2.))-_ip->mel()*_ip->mel());
ppi0=sqrt(((_channelMass/2.)*(_channelMass/2.))-_ip->mel()*_ip->mel());
}
if (_particleType==JPSI_ee){
if(W<2.*_ip->mel()){
nrbw_r=0.;
return nrbw_r;
}
ppi=sqrt(((W/2.)*(W/2.))-_ip->mel()*_ip->mel());
ppi0=sqrt(((_channelMass/2.)*(_channelMass/2.))-_ip->mel()*_ip->mel());
}
if (_particleType==JPSI_mumu){
if(W<2.*_ip->muonMass()){
nrbw_r=0.;
return nrbw_r;
}
ppi=sqrt(((W/2.)*(W/2.))-_ip->muonMass()*_ip->muonMass());
ppi0=sqrt(((_channelMass/2.)*(_channelMass/2.))-_ip->muonMass()*_ip->muonMass());
}
if (_particleType==JPSI_ppbar){
if(W<2.*_ip->protonMass()){
nrbw_r=0.;
return nrbw_r;
}
ppi=sqrt(((W/2.)*(W/2.))-_ip->protonMass()*_ip->protonMass());
ppi0=sqrt(((_channelMass/2.)*(_channelMass/2.))-_ip->protonMass()*_ip->protonMass());
}
if (_particleType==JPSI2S_ee){
if(W<2.*_ip->mel()){
nrbw_r=0.;
return nrbw_r;
}
ppi=sqrt(((W/2.)*(W/2.))-_ip->mel()*_ip->mel());
ppi0=sqrt(((_channelMass/2.)*(_channelMass/2.))-_ip->mel()*_ip->mel());
}
if (_particleType==JPSI2S_mumu){
if(W<2.*_ip->muonMass()){
nrbw_r=0.;
return nrbw_r;
}
ppi=sqrt(((W/2.)*(W/2.))-_ip->muonMass()*_ip->muonMass());
ppi0=sqrt(((_channelMass/2.)*(_channelMass/2.))-_ip->muonMass()*_ip->muonMass());
}
if(_particleType==UPSILON || _particleType==UPSILON2S ||_particleType==UPSILON3S ){
if (W<2.*_ip->muonMass()){
nrbw_r=0.;
return nrbw_r;
}
ppi=sqrt(((W/2.)*(W/2.))-_ip->muonMass()*_ip->muonMass());
ppi0=sqrt(((_channelMass/2.)*(_channelMass/2.))-_ip->muonMass()*_ip->muonMass());
}
if(_particleType==UPSILON_mumu || _particleType==UPSILON2S_mumu ||_particleType==UPSILON3S_mumu ){
if (W<2.*_ip->muonMass()){
nrbw_r=0.;
return nrbw_r;
}
ppi=sqrt(((W/2.)*(W/2.))-_ip->muonMass()*_ip->muonMass());
ppi0=sqrt(((_channelMass/2.)*(_channelMass/2.))-_ip->muonMass()*_ip->muonMass());
}
if(_particleType==UPSILON_ee || _particleType==UPSILON2S_ee ||_particleType==UPSILON3S_ee ){
if (W<2.*_ip->mel()){
nrbw_r=0.;
return nrbw_r;
}
ppi=sqrt(((W/2.)*(W/2.))-_ip->mel()*_ip->mel());
ppi0=sqrt(((_channelMass/2.)*(_channelMass/2.))-_ip->mel()*_ip->mel());
}
if(ppi==0.&&ppi0==0.)
cout<<"Improper Gammaacrosssection::breitwigner, ppi&ppi0=0."<<endl;
rat=ppi/ppi0;
GammaPrim=_width*(_channelMass/W)*rat*rat*rat;
aa=_ANORM*sqrt(GammaPrim*_channelMass*W);
bb=W*W-_channelMass*_channelMass;
cc=_channelMass*GammaPrim;
// First real part squared
nrbw_r = (( (aa*bb)/(bb*bb+cc*cc) + _BNORM)*( (aa*bb)/(bb*bb+cc*cc) + _BNORM));
// Then imaginary part squared
nrbw_r = nrbw_r + (( (aa*cc)/(bb*bb+cc*cc) )*( (aa*cc)/(bb*bb+cc*cc) ));
// Alternative, a simple, no-background BW, following J. Breitweg et al.
// Eq. 15 of Eur. Phys. J. C2, 247 (1998). SRK 11/10/2000
// nrbw_r = (_ANORM*_mass*GammaPrim/(bb*bb+cc*cc))**2
nrbw_r = C*nrbw_r;
return nrbw_r;
}
| 33.664147 | 134 | 0.600969 | [
"vector"
] |
7e0ce3878e9fffcf7013d1c585fe3178be972e1b | 20,403 | cc | C++ | pcraster/pcraster-4.2.0/pcraster-4.2.0/source/pcraster_model_engine/calc_opimpl.cc | quanpands/wflow | b454a55e4a63556eaac3fbabd97f8a0b80901e5a | [
"MIT"
] | null | null | null | pcraster/pcraster-4.2.0/pcraster-4.2.0/source/pcraster_model_engine/calc_opimpl.cc | quanpands/wflow | b454a55e4a63556eaac3fbabd97f8a0b80901e5a | [
"MIT"
] | null | null | null | pcraster/pcraster-4.2.0/pcraster-4.2.0/source/pcraster_model_engine/calc_opimpl.cc | quanpands/wflow | b454a55e4a63556eaac3fbabd97f8a0b80901e5a | [
"MIT"
] | null | null | null | #ifndef INCLUDED_STDDEFX
#include "stddefx.h"
#define INCLUDED_STDDEFX
#endif
#ifndef INCLUDED_CALC_OPIMPL
#include "calc_opimpl.h"
#define INCLUDED_CALC_OPIMPL
#endif
// Library headers.
#ifndef INCLUDED_BOOST_SCOPED_PTR
#include <boost/scoped_ptr.hpp>
#define INCLUDED_BOOST_SCOPED_PTR
#endif
// PCRaster library headers.
// Module headers.
#ifndef INCLUDED_CALC_CR
#include "calc_cr.h"
#define INCLUDED_CALC_CR
#endif
#ifndef INCLUDED_CALC_FIELD
#include "calc_field.h"
#define INCLUDED_CALC_FIELD
#endif
#ifndef INCLUDED_CALC_RUNTIMEENV
#include "calc_runtimeenv.h"
#define INCLUDED_CALC_RUNTIMEENV
#endif
#ifndef INCLUDED_CALC_FINDSYMBOL
#include "calc_findsymbol.h"
#define INCLUDED_CALC_FINDSYMBOL
#endif
#ifndef INCLUDED_CALC_VSPATIAL
#include "calc_vspatial.h"
#define INCLUDED_CALC_VSPATIAL
#endif
#ifndef INCLUDED_CALC_AREAOPERATIONS
#include "calc_areaoperations.h"
#define INCLUDED_CALC_AREAOPERATIONS
#endif
#ifndef INCLUDED_CALC_ORDEROPERATIONS
#include "calc_orderoperations.h"
#define INCLUDED_CALC_ORDEROPERATIONS
#endif
#ifndef INCLUDED_CALC_ARGORDER
#include "calc_argorder.h"
#define INCLUDED_CALC_ARGORDER
#endif
/*!
\file
This file contains the implementation of the IOpImpl class.
*/
#ifndef INCLUDED_CALC_SPATIAL
#include "calc_spatial.h"
#define INCLUDED_CALC_SPATIAL
#endif
#ifndef INCLUDED_CALC_OPERATOR
#include "calc_operator.h"
#define INCLUDED_CALC_OPERATOR
#endif
#ifndef INCLUDED_CALC_EXECARGUMENTS
#include "calc_execarguments.h"
#define INCLUDED_CALC_EXECARGUMENTS
#endif
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// DEFINITION OF STATIC IOPIMPL MEMBERS
//------------------------------------------------------------------------------
namespace calc {
AreaTotal builtIn_areatotal;
AreaAverage builtIn_areaaverage;
AreaMinimum builtIn_areaminimum;
AreaMaximum builtIn_areamaximum;
Order builtIn_order;
AreaOrder builtIn_areaorder;
ArgOrder builtIn_argorder;
ArgOrderWithId builtIn_argorderwithid;
ArgOrderAreaLimited builtIn_argorderarealimited;
ArgOrderWithIdAreaLimited builtIn_argorderwithidarealimited;
ArgOrderAddAreaLimited builtIn_argorderaddarealimited;
ArgOrderWithIdAddAreaLimited builtIn_argorderwithidaddarealimited;
template<class V, class I>
static void initOp(V& fArray, const I *f) {
if (f)
fArray[f->cri()]=f;
}
struct BinArg {
typedef enum LR { Left=0, Right=1} LR;
typedef enum T { SS_NN=0, NS=1, SN=2 } T;
T t;
size_t n; // max array size
BinArg(const ExecArguments& a,size_t left=Left,size_t right=Right)
{
n=std::max<>(a[left].nrValues(),a[right].nrValues());
t=SS_NN;
if (a[left].isSpatial() != a[right].isSpatial()) {
t = a[left].isSpatial() ? SN : NS;
}
}
};
}
//------------------------------------------------------------------------------
// DEFINITION OF IOPIMPL MEMBERS
//------------------------------------------------------------------------------
calc::SameUn::SameUn(const ISameUn* fieldOp):
d_fieldOp(fieldOp)
{}
calc::SameUn::~SameUn()
{}
void calc::SameUn::exec(RunTimeEnv* rte,const Operator& op, size_t nrArgs) const
{
PRECOND(nrArgs==1);
ExecArguments a(op,rte,nrArgs);
d_fieldOp->f(a.srcDest(0),a[0].nrValues());
a.pushResults();
}
void calc::SameUn::genPointCode (PointCodeGenerator* /*g*/) const
{}
calc::SameBin::SameBin( const ISameBin* op1,
const ISameBin* op2,
const ISameBin* op3):
d_fieldOp(3)
{
initOp(d_fieldOp,op1);
initOp(d_fieldOp,op2);
initOp(d_fieldOp,op3);
}
calc::SameBin::~SameBin()
{}
void calc::SameBin::exec (RunTimeEnv* rte,const Operator& op,size_t DEBUG_ARG(nrArgs)) const
{
PRECOND(nrArgs==2);
typedef BinArg B;
ExecArguments a(op,rte,2);
B b(a);
POSTCOND(a[B::Left].cri() == a[B::Right].cri()); // same binary operands
CRIndex i = a[B::Left].cri();
POSTCOND(d_fieldOp[i]);
switch(b.t) {
case B::SS_NN: {
size_t left =B::Left;
size_t right=B::Right;
// optimize a redundant field copy
if (op.commutative() && a[left].readOnlyReference())
std::swap(left,right);
d_fieldOp[i]->ss(a.srcDest(left),a[right].src(),b.n);break;
}
case B::SN:
// if (op.opCode() == OP_POW) // TODO optimize 0.5,1,2,3,4,etc.
// std::cout << "pow exp " << *a[B::Right].src_f() << std::endl;
d_fieldOp[i]->sn(a.srcDest(B::Left),a[B::Right].src(),b.n);
break;
case B::NS:
d_fieldOp[i]->ns(a[B::Left].src(),a.srcDest(B::Right),b.n);
break;
}
a.pushResults();
}
void calc::SameBin::genPointCode (PointCodeGenerator* /*g*/) const
{}
void calc::DiffBin::exec(RunTimeEnv* rte,const Operator& op,size_t DEBUG_ARG(nrArgs)) const
{
PRECOND(nrArgs==2);
typedef BinArg B;
ExecArguments a(op,rte,2);
B b(a);
UINT1 *r = static_cast<UINT1 *>(a.dest());
CRIndex i = a[1].cri(); // selection on 2nd/right operand in case of IfThenArray
POSTCOND(d_fieldOp[i]);
switch(b.t) {
case B::SS_NN:
d_fieldOp[i]->ss(r,a[0].src(),a[1].src(),b.n);break;
case B::SN:
d_fieldOp[i]->sn(r,a[0].src(),a[1].src(),b.n);break;
case B::NS:
d_fieldOp[i]->ns(r,a[0].src(),a[1].src(),b.n); break;
}
a.pushResults();
}
calc::DiffBin::DiffBin(const IDiffBin* op1,
const IDiffBin* op2,
const IDiffBin* op3):
d_fieldOp(3)
{
initOp(d_fieldOp,op1);
initOp(d_fieldOp,op2);
initOp(d_fieldOp,op3);
}
calc::DiffBin::~DiffBin()
{}
void calc::DiffBin::genPointCode (PointCodeGenerator* /*g*/) const
{}
void calc::IfThenElse::exec(RunTimeEnv* rte,const Operator& op,size_t DEBUG_ARG(nrArgs) ) const
{
PRECOND(nrArgs==3);
typedef BinArg B;
ExecArguments a(op,rte,3);
B b(a,1,2);
if (a[0].isSpatial()) {
// compute field
CRIndex i = a[1].cri(); // selection on true branch of IfThenElseArray
// always spatial
size_t n = std::max<>(a[0].nrValues(),b.n);
POSTCOND(d_fieldOp[i]);
switch(b.t) {
case B::SS_NN:
if (a[1].isSpatial())
d_fieldOp[i]->ss(a.dest(),a[0].src_1(),a[1].src(),a[2].src(),n);
else
d_fieldOp[i]->nn(a.dest(),a[0].src_1(),a[1].src(),a[2].src(),n);
break;
case B::SN:
d_fieldOp[i]->sn(a.dest(),a[0].src_1(),a[1].src(),a[2].src(),n);
break;
case B::NS:
d_fieldOp[i]->ns(a.dest(),a[0].src_1(),a[1].src(),a[2].src(),n);
break;
}
a.pushResults();
} else {
// condition is nonspatial: select an entire branch field as result
PRECOND(!a[0].isMV());
bool cond=a[0].src_1()[0]==1;
size_t resultBranch=cond ? 1 : 2;
size_t otherBranch=3-resultBranch;
// set result to this argument
(void)a.srcDest(resultBranch);
bool cast=!a.result().isSpatial() && a[otherBranch].isSpatial();
a.pushResults();
if (cast)
major2op(OP_SPATIAL)->exec(rte,1);
}
}
calc::IfThenElse::IfThenElse(const IIfThenElse* op1,
const IIfThenElse* op2,
const IIfThenElse* op3):
d_fieldOp(3)
{
initOp(d_fieldOp,op1);
initOp(d_fieldOp,op2);
initOp(d_fieldOp,op3);
}
calc::IfThenElse::~IfThenElse()
{}
void calc::IfThenElse::genPointCode (PointCodeGenerator* /*g*/) const
{}
calc::DiffUn::DiffUn(const IDiffUn* op1,
const IDiffUn* op2,
const IDiffUn* op3):
d_fieldOp(3)
{
initOp(d_fieldOp,op1);
initOp(d_fieldOp,op2);
initOp(d_fieldOp,op3);
}
calc::DiffUn::~DiffUn()
{}
void calc::DiffUn::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
PRECOND(nrArgs==1);
ExecArguments a(op,rte,nrArgs);
Field& r(a.createResult());
size_t n=std::max(r.nrValues(),a[0].nrValues());
CRIndex i = a[0].cri();
POSTCOND(d_fieldOp[i]);
d_fieldOp[i]->f(r.dest(),a[0].src(),n);
a.pushResults();
}
void calc::DiffUn::genPointCode (PointCodeGenerator* /*g*/) const
{}
calc::SpatialImpl::SpatialImpl(const IDiffUn* op1,
const IDiffUn* op2,
const IDiffUn* op3):
DiffUn(op1,op2,op3)
{
}
calc::SpatialImpl::~SpatialImpl()
{}
void calc::SpatialImpl::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
Field *in=rte->popField();
bool nop=in->isSpatial();
rte->pushField(in);
if (!nop)
DiffUn::exec(rte,op,nrArgs);
}
#ifndef INCLUDED_CALC_GENERATEFIELD
#include "calc_generatefield.h"
#define INCLUDED_CALC_GENERATEFIELD
#endif
calc::GenNonSpatial::GenNonSpatial()
{}
calc::GenNonSpatial::~GenNonSpatial()
{}
void calc::GenNonSpatial::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
PRECOND(nrArgs==0);
ExecArguments a(op,rte,nrArgs);
Field& r(a.createResult());
GenerateNonSpatial gsf(rte->rasterSpace());
switch(op.opCode()) {
case OP_CELLLENGTH:
gsf.celllength(r.dest_f()); break;
case OP_CELLAREA:
gsf.cellarea(r.dest_f()); break;
case OP_MAPUNIFORM:
gsf.mapuniform(r.dest_f()); break;
case OP_MAPNORMAL:
gsf.mapnormal(r.dest_f()); break;
case OP_TIME:
*(r.dest_f())=rte->timer().currentInt(); break;
case OP_TIMESLICE:
*(r.dest_f())=1; break;
default: PRECOND(FALSE);
}
a.pushResults();
}
calc::GenSpatial::GenSpatial()
{}
calc::GenSpatial::~GenSpatial()
{}
/*!
* \bug the Operator::exec d_impl->setOp() fix makes it possible to
* have a single GenSpatial and NonSpatial class, if that is fixed
* this is not possible
*/
void calc::GenSpatial::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
PRECOND(nrArgs==1);
ExecArguments a(op,rte,nrArgs);
Field& r(a.createResult());
GenerateSpatial gsf(a[0],rte->spatialPacking(),rte->rasterSpace());
switch(op.opCode()) {
case OP_UNIQUEID:
gsf.uniqueid(r.dest_f()); break;
case OP_XCOORDINATE:
gsf.xcoordinate(r.dest_f()); break;
case OP_YCOORDINATE:
gsf.ycoordinate(r.dest_f()); break;
case OP_NORMAL:
gsf.normal(r.dest_f()); break;
case OP_UNIFORM:
gsf.uniform(r.dest_f()); break;
default: PRECOND(FALSE);
}
a.pushResults();
}
void calc::GenSpatial::genPointCode(PointCodeGenerator* /*g*/) const
{
}
void calc::GenNonSpatial::genPointCode(PointCodeGenerator* /*g*/) const
{
}
calc::Conversion::Conversion()
{}
calc::Conversion::~Conversion()
{}
#ifndef INCLUDED_MISC
#include "misc.h" // BITSET
#define INCLUDED_MISC
#endif
void calc::Conversion::exec (RunTimeEnv* rte,const Operator& op,size_t DEBUG_ARG(nrArgs)) const
{
PRECOND(nrArgs==1);
/*!return the proper value scale conversion based
* on internal conversion matrix
*/
struct ConvTable {
MAJOR_CODE operator()(VS from, VS to)
{
const MAJOR_CODE convTable[6][6] = {
// indexed by 2log valuescale
// from: | to:
// | VS_B 1 VS_N 4 VS_O 4 VS_S s VS_D s VS_L 1
/* VS_B 1 */ {OP_NOP , OP_C_1_2_N, OP_C_1_2_O, OP_C_1_2_S, OP_C_1_2_D ,OP_ILL },
/* VS_N 4 */ {OP_C_4_2_B, OP_NOP , OP_NOP , OP_C_4_2_S, OP_C_4_2_D ,OP_C_4_2_L },
/* VS_O 4 */ {OP_C_4_2_B, OP_NOP , OP_NOP , OP_C_4_2_S, OP_C_4_2_D ,OP_C_4_2_L },
/* VS_S s */ {OP_C_S_2_B, OP_C_S_2_N, OP_C_S_2_O, OP_NOP , OP_C_S_2_D ,OP_C_S_2_L },
/* VS_D s */ {OP_C_S_2_B, OP_C_D_2_N, OP_C_D_2_O, OP_C_D_2_S, OP_NOP ,OP_C_D_2_L },
/* VS_L 1 */ {OP_C_1_2_B, OP_C_1_2_N, OP_C_1_2_O, OP_C_1_2_S, OP_C_L_2_D ,OP_NOP }};
from = biggestVs(from);
PRECOND(NRBITSET_TYPE(from,VS) == 1);
PRECOND(NRBITSET_TYPE(to ,VS) == 1);
PRECOND(FIRSTBITSET_TYPE(from,VS) < 6);
PRECOND(FIRSTBITSET_TYPE(to ,VS) < 6);
return convTable[FIRSTBITSET_TYPE(from,VS)][FIRSTBITSET_TYPE(to ,VS)];
}
};
Field *in=rte->popField();
MAJOR_CODE doOp=ConvTable()(in->vs(),op.vs());
POSTCOND(doOp!=OP_ILL);
if (doOp != OP_NOP) {
rte->pushField(in);
major2op(doOp)->exec(rte,1);
} else {
// e.g VS_SD -> VS_S
// VS_N <-> VS_O
if (in->vs() != op.vs()) {
// in == out for OP_NOP
in->resetVs(op.vs());
}
rte->pushField(in);
}
}
void calc::Conversion::genPointCode(PointCodeGenerator* /*g*/) const
{
}
calc::Trig::Trig(const ISameUn* fieldOp):
d_fieldOp(fieldOp)
{}
calc::Trig::~Trig()
{}
void calc::Trig::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
// need conversion?
Field *in=rte->popField();
if (in->vs() != VS_D) { // VS_S or VS_SD
rte->pushField(in);
major2op(OP_C_S_2_D)->exec(rte,1);
} else
rte->pushField(in);
PRECOND(nrArgs==1);
ExecArguments a(op,rte,nrArgs);
PRECOND(a[0].vs()==VS_D);
d_fieldOp->f(a.srcDest(0),a[0].nrValues());
a.pushResults();
}
void calc::Trig::genPointCode (PointCodeGenerator* /*g*/) const
{
// select on base of VS_S or VS_D
}
namespace calc {
template <typename AreaStatisticalOperation>
void areaStatisticalOperation(RunTimeEnv* rte,const Operator& op,size_t nrArgs)
{
ExecArguments args(op, rte, nrArgs);
AreaStatisticalOperation ao;
PRECOND(args[0].nrValues()==args[1].nrValues());
REAL4 *r = (REAL4 *)args.srcDest(0);
switch(args[1].cri()) {
case CRI_1:
ao.apply(r,args[1].src_1(),args[1].nrValues()); break;
case CRI_4:
ao.apply(r,args[1].src_4(),args[1].nrValues()); break;
default : POSTCOND(false);
}
args.pushResults();
}
}
void calc::AreaTotal::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
areaStatisticalOperation<AreaTotalOperation>(rte, op, nrArgs);
}
void calc::AreaAverage::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
areaStatisticalOperation<AreaAverageOperation>(rte, op, nrArgs);
}
void calc::AreaMinimum::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
areaStatisticalOperation<AreaMinimumOperation>(rte, op, nrArgs);
}
void calc::AreaMaximum::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
areaStatisticalOperation<AreaMaximumOperation>(rte, op, nrArgs);
}
void calc::Order::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
ExecArguments args(op, rte, nrArgs);
REAL4 *r = (REAL4 *)args.dest();
boost::scoped_ptr< IVSpatial<double> > expr(0);
switch(args[0].cri()) {
case CRI_4:
expr.reset(new VSpatial<double,INT4>(args[0].src_4()));
break;
case CRI_f:
expr.reset(new VSpatial<double,REAL4>(args[0].src_f()));
break;
default : POSTCOND(false);
}
orderOperation(r,*expr, args[0].nrValues());
args.pushResults();
}
void calc::AreaOrder::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
ExecArguments args(op, rte, nrArgs);
REAL4 *r = (REAL4 *)args.dest();
boost::scoped_ptr< IVSpatial<double> > expr(0);
boost::scoped_ptr< IVSpatial<INT4> > areaClass(0);
switch(args[0].cri()) {
case CRI_4:
expr.reset(new VSpatial<double,INT4>(args[0].src_4()));
break;
case CRI_f:
expr.reset(new VSpatial<double,REAL4>(args[0].src_f()));
break;
default : POSTCOND(false);
}
switch(args[1].cri()) {
case CRI_1:
areaClass.reset(new VSpatial<INT4,UINT1>(args[1].src_1()));
break;
case CRI_4:
areaClass.reset(new VSpatial<INT4,INT4>(args[1].src_4()));
break;
default : POSTCOND(false);
}
areaOrderOperation(r,*expr, *areaClass, args[0].nrValues());
args.pushResults();
}
void calc::ArgOrderWithIdAddAreaLimited::exec (
RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
ExecArguments args(op, rte, nrArgs);
PRECOND(args.size()%3 == 1);
std::vector<ArgOrderIdInfo> argOrderArgs;
for(size_t i=1; i < args.size(); i+=3) {
PRECOND(args[i].isSpatial());
const REAL4* chances=args[i].src_f();
PRECOND(!args[i+1].isSpatial());
INT4 id=args[i+1].src_4()[0];
PRECOND(!args[i+2].isSpatial());
double areaLimit=args[i+2].src_f()[0];
argOrderArgs.push_back(ArgOrderIdInfo(chances,id,areaLimit));
}
INT4 *r = (INT4 *)args.dest();
PRECOND(args[0].isSpatial());
ArgOrderAndAddArea::argOrderAddAreaLimited(
argOrderArgs,
args[0].src_4(),
r,args[0].nrValues());
args.pushResults();
}
void calc::ArgOrderAddAreaLimited::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
ExecArguments args(op, rte, nrArgs);
PRECOND(args.size()%2 == 1);
std::vector<ArgOrderIdInfo> argOrderArgs;
for(size_t i=1; i < args.size(); i+=2) {
PRECOND(args[i].isSpatial());
const REAL4* chances=args[i].src_f();
INT4 id=argOrderArgs.size()+1;
PRECOND(!args[i+1].isSpatial());
double areaLimit=args[i+1].src_f()[0];
argOrderArgs.push_back(ArgOrderIdInfo(chances,id,areaLimit));
}
INT4 *r = (INT4 *)args.dest();
PRECOND(args[0].isSpatial());
ArgOrderAndAddArea::argOrderAddAreaLimited(
argOrderArgs,
args[0].src_4(),
r,args[0].nrValues());
args.pushResults();
}
void calc::ArgOrderWithIdAreaLimited::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
ExecArguments args(op, rte, nrArgs);
PRECOND(args.size()%3 == 0);
std::vector<ArgOrderIdInfo> argOrderArgs;
for(size_t i=0; i < args.size(); i+=3) {
PRECOND(args[i].isSpatial());
const REAL4* chances=args[i].src_f();
PRECOND(!args[i+1].isSpatial());
INT4 id=args[i+1].src_4()[0];
PRECOND(!args[i+2].isSpatial());
double areaLimit=args[i+2].src_f()[0];
argOrderArgs.push_back(ArgOrderIdInfo(chances,id,areaLimit));
}
INT4 *r = (INT4 *)args.dest();
ArgOrderAndAddArea::argOrderAreaLimited(argOrderArgs,r,args[0].nrValues());
args.pushResults();
}
void calc::ArgOrderAreaLimited::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
ExecArguments args(op, rte, nrArgs);
PRECOND(args.size()%2 == 0);
std::vector<ArgOrderIdInfo> argOrderArgs;
for(size_t i=0; i < args.size(); i+=2) {
PRECOND(args[i].isSpatial());
const REAL4* chances=args[i].src_f();
INT4 id=argOrderArgs.size()+1;
PRECOND(!args[i+1].isSpatial());
double areaLimit=args[i+1].src_f()[0];
argOrderArgs.push_back(ArgOrderIdInfo(chances,id,areaLimit));
}
INT4 *r = (INT4 *)args.dest();
ArgOrderAndAddArea::argOrderAreaLimited(argOrderArgs,r,args[0].nrValues());
args.pushResults();
}
void calc::ArgOrderWithId::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
ExecArguments args(op, rte, nrArgs);
PRECOND(args.size()%2 == 0);
std::vector<ArgOrderIdInfo> argOrderArgs;
for(size_t i=0; i < args.size(); i+=2) {
PRECOND(args[i].isSpatial());
const REAL4* chances=args[i].src_f();
PRECOND(!args[i+1].isSpatial());
INT4 id=args[i+1].src_4()[0];
argOrderArgs.push_back(ArgOrderIdInfo(chances,id));
}
INT4 *r = (INT4 *)args.dest();
ArgOrderAndAddArea::argOrder(argOrderArgs,r,args[0].nrValues());
args.pushResults();
}
void calc::ArgOrder::exec (RunTimeEnv* rte,const Operator& op,size_t nrArgs) const
{
ExecArguments args(op, rte, nrArgs);
std::vector<ArgOrderIdInfo> argOrderArgs;
for(size_t i=0; i < args.size(); ++i) {
PRECOND(args[i].isSpatial());
const REAL4* chances=args[i].src_f();
INT4 id=argOrderArgs.size()+1;
argOrderArgs.push_back(ArgOrderIdInfo(chances,id));
}
INT4 *r = (INT4 *)args.dest();
ArgOrderAndAddArea::argOrder(argOrderArgs,r,args[0].nrValues());
args.pushResults();
}
//------------------------------------------------------------------------------
// DEFINITION OF FREE OPERATORS
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
// DEFINITION OF FREE FUNCTIONS
//------------------------------------------------------------------------------
| 27.423387 | 105 | 0.616282 | [
"vector"
] |
7e0cf9829851a40926837ac89544b55cd590c23d | 3,062 | cpp | C++ | Acm contests/Asia regional - Daejon/f.cpp | SuperPuperMegaUltraEpicGoldenHacker/Competetive-Programming | ab1ca0d0d2187b561750d547e155e768951d29a0 | [
"MIT"
] | null | null | null | Acm contests/Asia regional - Daejon/f.cpp | SuperPuperMegaUltraEpicGoldenHacker/Competetive-Programming | ab1ca0d0d2187b561750d547e155e768951d29a0 | [
"MIT"
] | null | null | null | Acm contests/Asia regional - Daejon/f.cpp | SuperPuperMegaUltraEpicGoldenHacker/Competetive-Programming | ab1ca0d0d2187b561750d547e155e768951d29a0 | [
"MIT"
] | null | null | null | # include <bits/stdc++.h>
# define x first
# define y second
# define mp make_pair
// everything goes according to my plan
# define pb push_back
# define sz(a) (int)(a.size())
# define vec vector
// shimkenttin kyzdary, dzyn, dzyn, dzyn...
# define y1 Y_U_NO_y1
# define left Y_U_NO_left
# define right Y_U_NO_right
# ifdef Local
# define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__)
# else
# define debug(...) (__VA_ARGS__)
# define cerr if(0)cout
# endif
using namespace std;
typedef pair <int, int> pii;
typedef long long ll;
typedef long double ld;
const int Mod = (int)1e9 + 7;
const int MX = 1073741822;
const ll MXLL = 4e18;
const int Sz = 1110111;
// a pinch of soul
inline void Read_rap () {
ios_base :: sync_with_stdio(0);
cin.tie(0); cout.tie(0);
}
inline void randomizer3000 () {
unsigned int seed;
asm ("rdtsc" : "=A"(seed));
srand (seed);
}
void files (string problem) {
if (fopen ((problem + ".in").c_str(),"r")) {
freopen ((problem + ".in").c_str(),"r",stdin);
freopen ((problem + ".out").c_str(),"w",stdout);
}
}
void localInput(const char in[] = "s") {
if (fopen (in, "r")) {
freopen (in, "r", stdin);
}
else
cerr << "Warning: Input file not found" << endl;
}
int x, y;
int op[4];
void f (int n, int m, int r) {
assert (m <= n*n);
if (n == 1) {
x = 1;
y = 1;
return;
}
int p = 0;
for (; p <= 3; p++) {
int sq = (n/2) * (n/2);
if (m <= sq) {
break;
}
m -= sq;
}
f (n / 2, m, p);
if (p == 1 || p == 2)
y += n/2;
if (p == 2 || p == 3)
x += n/2;
if (r == 0) {
swap (x, y);
if (op[0])
x = n-x+1;
if (op[1])
y = n-y+1;
}
if (r == 3) {
swap (x, y);
if (op[2])
x = n-x+1;
if (op[3])
y = n-y+1;
}
}
void rotate (int n) {
int a[n][n];
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
a[i][j] = (i-1)*n + j;
int b[n][n];
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
b[j][i] = a[i][j];
for (int i = 1; i <= n; i++, cout << endl)
for (int j = 1; j <= n; j++)
cout << i << ' ' << j << ' ' << ": " << (b[i][j] - 1) / n + 1 << ' ' << (b[i][j] - 1) % n + 1 << endl;
}
bool check_slow (int n, int m) {
int a[n+1][n+1];
memset (a, 0, (n + 1) * (n + 1) * 4);
for (int i = 1; i <= n*n; i++) {
f(n, i, 1);
a[x][y] = i;
}
set<int> s;
for (int i = 1; i <= n; i++)
for (int j = 1; j <= n; j++)
s.insert (a[i][j]);
for (int j = n; j >= 1; j--, cout << endl)
for (int i = 1; i <= n; i++)
cout << a[i][j] << ' ';
return (sz(s) == n*n);
}
int n, m;
void rec (int p) {
if (p == 4) {
if (check_slow(n, m)) {
for (int i = 0; i < 4; i++)
cout << op[i] << ' ';
cout << endl << endl;
}
return;
}
op[p] = 0;
rec(p+1);
op[p] = 1;
rec(p + 1);
}
void solve() {
op[2] = op[3] = 1;
f (n, m, 1);
cout << x << ' ' << y;
}
int main()
{
# ifdef Local
//localInput();
# endif
Read_rap();
cin >> n >> m;
solve();
return 0;
}
// Coded by Z.. | 18.011765 | 108 | 0.46081 | [
"vector"
] |
7e11c9ac78ba55136aa3b9b2a8f9bf01cb991c60 | 3,985 | cpp | C++ | src/game/entity/bullet.cpp | lili2012/BarbersAndRebarbs | 8a3c10cebded55dabaf6f8673735c6f3606cb4af | [
"MIT"
] | 4 | 2016-04-26T20:25:07.000Z | 2021-12-15T06:58:57.000Z | src/game/entity/bullet.cpp | lili2012/BarbersAndRebarbs | 8a3c10cebded55dabaf6f8673735c6f3606cb4af | [
"MIT"
] | 2 | 2016-07-29T22:52:12.000Z | 2016-09-22T08:30:29.000Z | src/game/entity/bullet.cpp | lili2012/BarbersAndRebarbs | 8a3c10cebded55dabaf6f8673735c6f3606cb4af | [
"MIT"
] | 1 | 2020-10-31T10:20:32.000Z | 2020-10-31T10:20:32.000Z | // The MIT License (MIT)
// Copyright (c) 2016 nabijaczleweli
// 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 "bullet.hpp"
#include "../../reference/container.hpp"
#include "../../reference/joystick_info.hpp"
#include "../../util/vector.hpp"
#include "../world.hpp"
#include <SFML/Window.hpp>
#include <cmath>
#include <seed11/seed11.hpp>
std::unique_ptr<bullet> bullet::create(game_world & world, size_t id, sf::Vector2f aim, unsigned int x, unsigned int y, const bullet_properties & props) {
auto bull = std::make_unique<bullet>(std::ref(world), id, x, y, std::cref(props));
aim = normalised(aim);
bull->start_movement(aim.x, aim.y);
return bull;
}
std::unique_ptr<bullet> bullet::create(game_world & world, size_t id, sf::Vector2f aim, unsigned int x, unsigned int y, float spread_min, float spread_max,
const bullet_properties & props) {
static const auto pi = std::acos(-1.l);
static auto rand = seed11::make_seeded<std::mt19937>();
static std::bernoulli_distribution dev_way_dist;
aim = normalised(aim);
double aim_angle = std::atan2(aim.x, aim.y) * 180. / pi;
auto ang_dev = std::uniform_real_distribution<double>{spread_min, spread_max}(rand);
if(dev_way_dist(rand))
aim_angle += ang_dev;
else
aim_angle -= ang_dev;
auto aim_angle_rad = aim_angle * pi / 180.;
aim.x = std::sin(aim_angle_rad);
aim.y = std::cos(aim_angle_rad);
return create(world, id, aim, x, y, props);
}
void bullet::draw(sf::RenderTarget & target, sf::RenderStates states) const {
static const auto constexpr k = 2.5f;
const sf::Vertex vertices[]{{{x, y}, sf::Color::White}, //
{{x + motion_x * k, y + motion_y * k}, sf::Color::White}};
target.draw(vertices, sizeof vertices / sizeof *vertices, sf::PrimitiveType::Lines, states);
}
bullet::bullet(game_world & world_r, size_t id_a, unsigned int px, unsigned int py, const bullet_properties & pprops) : entity(world_r, id_a), props(pprops) {
x = px;
y = py;
}
void bullet::read_from_json(const json::object & from) {
entity::read_from_json(from);
auto itr = from.end();
if((itr = from.find("bullet")) != from.end()) {
const auto bullet = itr->second.as<json::object>();
props = {bullet.at("speed").as<float>(), bullet.at("speed_loss").as<float>()};
}
}
json::object bullet::write_to_json() const {
auto written = entity::write_to_json();
written.emplace("bullet", json::object({{"speed", props.speed}, {"speed_loss", props.speed_loss}}));
written.emplace("kind", "bullet");
return written;
}
void bullet::tick(float max_x, float max_y) {
entity::tick(max_x, max_y);
const auto min_speed = props.speed / 20;
const auto speed = std::sqrt(motion_x * motion_x + motion_y * motion_y);
if(speed < min_speed)
world.despawn(id);
}
float bullet::speed() const {
return props.speed;
}
float bullet::speed_loss() const {
return props.speed_loss;
}
| 37.59434 | 158 | 0.694354 | [
"object",
"vector"
] |
7e127cafdc6eda2c4cdb5a97c790cfbd9330b726 | 4,756 | cc | C++ | ZKLockGuard.cc | hthao/ZKDLock | 57da008c6de192ad3c9b4a142146686eb34064e8 | [
"MIT"
] | 3 | 2017-04-24T10:22:20.000Z | 2020-10-26T18:09:45.000Z | ZKLockGuard.cc | hthao/ZKDLock | 57da008c6de192ad3c9b4a142146686eb34064e8 | [
"MIT"
] | null | null | null | ZKLockGuard.cc | hthao/ZKDLock | 57da008c6de192ad3c9b4a142146686eb34064e8 | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <vector>
#include "./ZKLockGuard.h"
namespace sandsea {
ZKLock::ZKLock(zhandle_t *zh)
{
zh_ = zh;
}
ZKLock::~ZKLock()
{
}
void ZKLock::defaultWatcher(zhandle_t *zh, int type, int state, const char *path, void *watcherCtx)
{
}
void ZKLock::lockWatcher(zhandle_t *zh, int type, int state, const char *path, void *watcherCtx)
{
ZKLockWrapper * wrp = static_cast<ZKLockWrapper*>(watcherCtx);
if (!wrp) return;
std::shared_ptr<ZKLock> zklock = wrp->getZKLock();
delete wrp;
if (zklock.get()) {
zklock->notifyAll();
} else {
printf("ZKLock is expired, path:%s\n", path);
}
}
void ZKLock::notifyAll()
{
cond_.notify_all();
}
bool ZKLock::init(const char *zkHost) {
int count = 0;
do {
count++;
zh_ = zookeeper_init(zkHost, &ZKLock::defaultWatcher, 10000, 0, NULL, 0);
} while (!zh_ && count < 3);
if (!zh_) {
printf("zookeeper_init failed!!!\n");
return false;
} else {
printf("zookeeper_init successfully.\n");
}
return true;
}
void ZKLock::copyResult(struct String_vector *vec, std::vector<std::string> *copy)
{
if (!vec || !vec->data) return;
for (int i = 0; i < vec->count; i++) {
const char *path = *(vec->data + i);
if (path) {
copy->push_back(path);
}
}
deallocate_String_vector(vec);
}
bool ZKLock::isGotLock(const char *lockPath, std::vector<std::string> *childrens)
{
std::vector<std::string> pathSeq;
for (auto& path:(*childrens)) {
size_t ln = path.find_last_of("_");
std::string seq = path.substr(ln + 1, path.size());
pathSeq.push_back(seq);
printf("path:%s, seq: %s.\n", path.c_str(), seq.c_str());
}
std::sort(pathSeq.begin(), pathSeq.end());
size_t ln = myPath_.find_last_of("_");
std::string mySeq = myPath_.substr(ln + 1, myPath_.size());
if (mySeq.compare(pathSeq.front()) == 0) {
return true;
}
return false;
}
bool ZKLock::isLockAlreadyCreated(const char *lockPath, const char *uniqueString, std::string *createdPath)
{
struct String_vector vec;
std::vector<std::string> childrens;
int rc = zoo_get_children(zh_, lockPath, 0, &vec);
if (rc != ZOK) {
printf("zoo_get_children failed with return code:%d, path:%s, uniqueString:%s!!!\n", rc, lockPath, uniqueString);
return false;
}
copyResult(&vec, &childrens);
for (auto& path : childrens) {
size_t fn = path.find_first_of("_");
size_t ln = path.find_last_of("_");
std::string unique = path.substr(fn + 1, ln - fn - 1);
printf("path:%s, unique: %s.\n", path.c_str(), unique.c_str());
if (unique.compare(uniqueString) == 0) {
*createdPath = std::string(lockPath) + "/" + path;
printf("already created, path:%s, full path: %s.\n", path.c_str(), createdPath->c_str());
return true;
}
}
return false;
}
bool ZKLock::lock(const char *lockPath, const char *uniqueString)
{
if (!isLockAlreadyCreated(lockPath, uniqueString, &myPath_)) {
char buf[256];
std::string lockSeq(lockPath);
lockSeq.append("/lock_");
lockSeq.append(uniqueString);
lockSeq.append("_");
int rc = zoo_create(zh_, lockSeq.c_str(), NULL, -1, &ZOO_OPEN_ACL_UNSAFE, ZOO_EPHEMERAL|ZOO_SEQUENCE, buf, 256);
if (rc != ZOK) {
printf("zoo_create failed with return code:%d!!!\n", rc);
return false;
}
myPath_.assign(buf);
}
std::unique_lock<std::mutex> mtxLock(mtx_);
while (true) {
struct String_vector vec;
std::vector<std::string> childrens;
ZKLockWrapper *wrp = new ZKLockWrapper(getPtr());
int rc = zoo_wget_children(zh_, lockPath, &ZKLock::lockWatcher, wrp, &vec);
if (rc != ZOK) {
printf("zoo_wget_children2 failed with return code:%d!!!\n", rc);
return false;
}
copyResult(&vec, &childrens);
if (isGotLock(lockPath, &childrens)) {
printf("got the lock.\n");
break;
} else {
printf("didn't got the lock, wait watcher event.\n");
cond_.wait(mtxLock);
}
}
return true;
}
void ZKLock::unLock()
{
int rc = zoo_delete(zh_, myPath_.c_str(), -1);
if (rc != ZOK) {
printf("zoo_delete failed with return code:%d!!!\n", rc);
}
}
ZKLockGuard::ZKLockGuard(zhandle_t *zh, const char *lockPath, const char *uniqueString)
{
zkLock_ = std::make_shared<ZKLock>(zh);
zkLock_->lock(lockPath, uniqueString);
}
ZKLockGuard::~ZKLockGuard()
{
if (zkLock_.get()) {
zkLock_->unLock();
}
}
}
| 27.177143 | 121 | 0.585997 | [
"vector"
] |
7e1633e54cb7689a235dfa4a86b08d96e627d58f | 4,210 | hpp | C++ | ThirdParty-mod/java2cpp/java/util/zip/CheckedOutputStream.hpp | kakashidinho/HQEngine | 8125b290afa7c62db6cc6eac14e964d8138c7fd0 | [
"MIT"
] | 1 | 2019-04-03T01:53:28.000Z | 2019-04-03T01:53:28.000Z | ThirdParty-mod/java2cpp/java/util/zip/CheckedOutputStream.hpp | kakashidinho/HQEngine | 8125b290afa7c62db6cc6eac14e964d8138c7fd0 | [
"MIT"
] | null | null | null | ThirdParty-mod/java2cpp/java/util/zip/CheckedOutputStream.hpp | kakashidinho/HQEngine | 8125b290afa7c62db6cc6eac14e964d8138c7fd0 | [
"MIT"
] | null | null | null | /*================================================================================
code generated by: java2cpp
author: Zoran Angelov, mailto://baldzar@gmail.com
class: java.util.zip.CheckedOutputStream
================================================================================*/
#ifndef J2CPP_INCLUDE_IMPLEMENTATION
#ifndef J2CPP_JAVA_UTIL_ZIP_CHECKEDOUTPUTSTREAM_HPP_DECL
#define J2CPP_JAVA_UTIL_ZIP_CHECKEDOUTPUTSTREAM_HPP_DECL
namespace j2cpp { namespace java { namespace io { class FilterOutputStream; } } }
namespace j2cpp { namespace java { namespace io { class OutputStream; } } }
namespace j2cpp { namespace java { namespace util { namespace zip { class Checksum; } } } }
#include <java/io/FilterOutputStream.hpp>
#include <java/io/OutputStream.hpp>
#include <java/util/zip/Checksum.hpp>
namespace j2cpp {
namespace java { namespace util { namespace zip {
class CheckedOutputStream;
class CheckedOutputStream
: public object<CheckedOutputStream>
{
public:
J2CPP_DECLARE_CLASS
J2CPP_DECLARE_METHOD(0)
J2CPP_DECLARE_METHOD(1)
J2CPP_DECLARE_METHOD(2)
J2CPP_DECLARE_METHOD(3)
explicit CheckedOutputStream(jobject jobj)
: object<CheckedOutputStream>(jobj)
{
}
operator local_ref<java::io::FilterOutputStream>() const;
CheckedOutputStream(local_ref< java::io::OutputStream > const&, local_ref< java::util::zip::Checksum > const&);
local_ref< java::util::zip::Checksum > getChecksum();
void write(jint);
void write(local_ref< array<jbyte,1> > const&, jint, jint);
}; //class CheckedOutputStream
} //namespace zip
} //namespace util
} //namespace java
} //namespace j2cpp
#endif //J2CPP_JAVA_UTIL_ZIP_CHECKEDOUTPUTSTREAM_HPP_DECL
#else //J2CPP_INCLUDE_IMPLEMENTATION
#ifndef J2CPP_JAVA_UTIL_ZIP_CHECKEDOUTPUTSTREAM_HPP_IMPL
#define J2CPP_JAVA_UTIL_ZIP_CHECKEDOUTPUTSTREAM_HPP_IMPL
namespace j2cpp {
java::util::zip::CheckedOutputStream::operator local_ref<java::io::FilterOutputStream>() const
{
return local_ref<java::io::FilterOutputStream>(get_jobject());
}
java::util::zip::CheckedOutputStream::CheckedOutputStream(local_ref< java::io::OutputStream > const &a0, local_ref< java::util::zip::Checksum > const &a1)
: object<java::util::zip::CheckedOutputStream>(
call_new_object<
java::util::zip::CheckedOutputStream::J2CPP_CLASS_NAME,
java::util::zip::CheckedOutputStream::J2CPP_METHOD_NAME(0),
java::util::zip::CheckedOutputStream::J2CPP_METHOD_SIGNATURE(0)
>(a0, a1)
)
{
}
local_ref< java::util::zip::Checksum > java::util::zip::CheckedOutputStream::getChecksum()
{
return call_method<
java::util::zip::CheckedOutputStream::J2CPP_CLASS_NAME,
java::util::zip::CheckedOutputStream::J2CPP_METHOD_NAME(1),
java::util::zip::CheckedOutputStream::J2CPP_METHOD_SIGNATURE(1),
local_ref< java::util::zip::Checksum >
>(get_jobject());
}
void java::util::zip::CheckedOutputStream::write(jint a0)
{
return call_method<
java::util::zip::CheckedOutputStream::J2CPP_CLASS_NAME,
java::util::zip::CheckedOutputStream::J2CPP_METHOD_NAME(2),
java::util::zip::CheckedOutputStream::J2CPP_METHOD_SIGNATURE(2),
void
>(get_jobject(), a0);
}
void java::util::zip::CheckedOutputStream::write(local_ref< array<jbyte,1> > const &a0, jint a1, jint a2)
{
return call_method<
java::util::zip::CheckedOutputStream::J2CPP_CLASS_NAME,
java::util::zip::CheckedOutputStream::J2CPP_METHOD_NAME(3),
java::util::zip::CheckedOutputStream::J2CPP_METHOD_SIGNATURE(3),
void
>(get_jobject(), a0, a1, a2);
}
J2CPP_DEFINE_CLASS(java::util::zip::CheckedOutputStream,"java/util/zip/CheckedOutputStream")
J2CPP_DEFINE_METHOD(java::util::zip::CheckedOutputStream,0,"<init>","(Ljava/io/OutputStream;Ljava/util/zip/Checksum;)V")
J2CPP_DEFINE_METHOD(java::util::zip::CheckedOutputStream,1,"getChecksum","()Ljava/util/zip/Checksum;")
J2CPP_DEFINE_METHOD(java::util::zip::CheckedOutputStream,2,"write","(I)V")
J2CPP_DEFINE_METHOD(java::util::zip::CheckedOutputStream,3,"write","([BII)V")
} //namespace j2cpp
#endif //J2CPP_JAVA_UTIL_ZIP_CHECKEDOUTPUTSTREAM_HPP_IMPL
#endif //J2CPP_INCLUDE_IMPLEMENTATION
| 31.893939 | 155 | 0.712827 | [
"object"
] |
7e1a03e10ef965137d8146d1dc1de0ca21236041 | 689 | cpp | C++ | btest.cpp | jmscreation/Multiplayer-Console-Game | f99e9da6aa36ba6a501a68a967d15a9f7ac8e9a8 | [
"Apache-2.0"
] | null | null | null | btest.cpp | jmscreation/Multiplayer-Console-Game | f99e9da6aa36ba6a501a68a967d15a9f7ac8e9a8 | [
"Apache-2.0"
] | null | null | null | btest.cpp | jmscreation/Multiplayer-Console-Game | f99e9da6aa36ba6a501a68a967d15a9f7ac8e9a8 | [
"Apache-2.0"
] | null | null | null | /**
This application is used for strictly low-level debugging purpose only
*/
#include "console_library.h"
#include "multiplayer.h"
#include "windows.h"
#include <iostream>
using namespace std;
int main(){
cout << "Testing..." << endl;
Input input;
Multiplayer mplay;
do {
mplay.update();
mplay.readData([](short index, short cmd, unsigned short argc, const vector<short>& argv){
cout << "index: " << index << " cmd: " << cmd << " argc: " << argc << " argv: \n";
for(size_t i=0; i<argc; ++i) cout << argv[i] << ", ";
cout << endl;
});
Sleep(100);
} while(!input.anyKey());
return 0;
}
| 21.53125 | 98 | 0.545718 | [
"vector"
] |
7e1ae55c9ce448d472f022c3bc20356a8ef88c2d | 3,351 | cc | C++ | backend/storage/in_memory_iterator_test.cc | sgorse12/cloud-spanner-emulator | 13ebb6d42867bfbc80224b4a74a896b683ae4555 | [
"Apache-2.0"
] | 179 | 2020-03-30T20:30:49.000Z | 2022-03-31T04:47:55.000Z | backend/storage/in_memory_iterator_test.cc | sgorse12/cloud-spanner-emulator | 13ebb6d42867bfbc80224b4a74a896b683ae4555 | [
"Apache-2.0"
] | 53 | 2020-08-31T15:14:30.000Z | 2022-03-30T21:28:36.000Z | backend/storage/in_memory_iterator_test.cc | sgorse12/cloud-spanner-emulator | 13ebb6d42867bfbc80224b4a74a896b683ae4555 | [
"Apache-2.0"
] | 26 | 2020-04-02T04:05:58.000Z | 2022-02-22T12:05:55.000Z | //
// Copyright 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 "backend/storage/in_memory_iterator.h"
#include "zetasql/public/value.h"
#include "gmock/gmock.h"
#include "gtest/gtest.h"
#include "zetasql/base/testing/status_matchers.h"
#include "tests/common/proto_matchers.h"
#include "backend/datamodel/key.h"
namespace google {
namespace spanner {
namespace emulator {
namespace backend {
namespace {
using zetasql::Value;
using zetasql::values::Int64;
TEST(FixedRowStorageIterator, CreateIterator) {
std::vector<std::pair<Key, std::vector<Value>>> row_values = {
{Key({Int64(2)}), {Int64(20)}}};
FixedRowStorageIterator itr(std::move(row_values));
while (itr.Next()) {
EXPECT_EQ(Key({Int64(2)}), itr.Key());
EXPECT_EQ(1, itr.NumColumns());
for (int i = 0; i < itr.NumColumns(); ++i) {
EXPECT_EQ(Int64(20), itr.ColumnValue(i));
}
}
EXPECT_FALSE(itr.Next());
}
TEST(FixedRowStorageIterator, CreateIteratorWithNoRows) {
std::vector<std::pair<Key, std::vector<Value>>> row_values = {};
FixedRowStorageIterator itr(std::move(row_values));
EXPECT_FALSE(itr.Next());
}
TEST(FixedRowStorageIterator, CreateIteratorWithCompositeKeys) {
std::vector<std::pair<Key, std::vector<Value>>> row_values = {
{Key({Int64(1), Int64(2)}), {Int64(20)}}};
FixedRowStorageIterator itr(std::move(row_values));
while (itr.Next()) {
EXPECT_EQ(Key({Int64(1), Int64(2)}), itr.Key());
EXPECT_EQ(1, itr.NumColumns());
EXPECT_EQ(Int64(20), itr.ColumnValue(0));
}
}
TEST(FixedRowStorageIterator, CreateIteratorWithManyRows) {
std::vector<std::pair<Key, std::vector<Value>>> row_values = {
{Key({Int64(0)}), {Int64(20)}},
{Key({Int64(1)}), {Int64(20)}},
{Key({Int64(2)}), {Int64(20)}}};
FixedRowStorageIterator itr(std::move(row_values));
int i = 0;
while (itr.Next()) {
EXPECT_EQ(Key({Int64(i)}), itr.Key());
EXPECT_EQ(1, itr.NumColumns());
EXPECT_EQ(Int64(20), itr.ColumnValue(0));
++i;
}
}
TEST(FixedRowStorageIterator, CreateIteratorWithEmptyColumns) {
std::vector<std::pair<Key, std::vector<Value>>> row_values = {
{Key({Int64(2)}), {}}};
FixedRowStorageIterator itr(std::move(row_values));
while (itr.Next()) {
EXPECT_EQ(Key({Int64(2)}), itr.Key());
EXPECT_EQ(0, itr.NumColumns());
}
}
TEST(FixedRowStorageIterator, CreateIteratorWithInvalidColumnValues) {
std::vector<std::pair<Key, std::vector<Value>>> row_values = {
{Key({Int64(2)}), {Value()}}};
FixedRowStorageIterator itr(std::move(row_values));
while (itr.Next()) {
EXPECT_EQ(Key({Int64(2)}), itr.Key());
EXPECT_EQ(1, itr.NumColumns());
EXPECT_FALSE(itr.ColumnValue(0).is_valid());
}
}
} // namespace
} // namespace backend
} // namespace emulator
} // namespace spanner
} // namespace google
| 29.654867 | 75 | 0.678007 | [
"vector"
] |
7e1d5ad3bab4223209e981aaa76b14d054d1a76d | 65,415 | cpp | C++ | Linux_build/SharedMultiSpec/SClusterSinglePass.cpp | cas-nctu/multispec | 0bc840bdb073b5feaeec650c2da762cfa34ee37d | [
"Apache-2.0"
] | 11 | 2020-03-10T02:06:00.000Z | 2022-02-17T19:59:50.000Z | Linux_build/SharedMultiSpec/SClusterSinglePass.cpp | cas-nctu/multispec | 0bc840bdb073b5feaeec650c2da762cfa34ee37d | [
"Apache-2.0"
] | null | null | null | Linux_build/SharedMultiSpec/SClusterSinglePass.cpp | cas-nctu/multispec | 0bc840bdb073b5feaeec650c2da762cfa34ee37d | [
"Apache-2.0"
] | 5 | 2020-05-30T00:59:22.000Z | 2021-12-06T01:37:05.000Z | // MultiSpec
//
// Copyright 1988-2020 Purdue Research Foundation
//
// 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: https://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.
//
// MultiSpec is curated by the Laboratory for Applications of Remote Sensing at
// Purdue University in West Lafayette, IN and licensed by Larry Biehl.
//
// File: SClusterSinglePass.cpp
//
// Authors: Eric E. Demaree, Larry L. Biehl
//
// Revision date: 05/12/2020
//
// Language: C
//
// System: Linux, Macintosh and Windows Operating Systems
//
// Brief description: This file contains routines that will cluster image data
// with one pass. The routines in the file were written
// by Eric E. Demaree for an EE577 class project during
// the spring semester of 1989 under the direction of
// Professor Phil Swain.
//
// Diagram of MultiSpec routine calls for the routines in the file.
//
// OnePassClusterDialog
// ProcessorDialogFilter (in MDialogUtilities.c)
//
//
// ClusterOnePassControl
// InitializeClusterMemory (in SCluster.cpp)
//
// OnePassCluster
// OnePassClusterAreas
//
// UpdateClusterStdDeviations (in SCluster.cpp)
//
// ListClusterStatistics (in SCluster.cpp)
//
// SetUpClassToFinalClassPtr (in SCluster.cpp)
//
// ClusterClassification (in SCluster.cpp)
//
// SaveClusterStatistics (in SCluster.cpp)
//
//
// GetOnePassClusterCenters
//
// Include files: "MultiSpecHeaders"
// "multiSpec.h"
//
//------------------------------------------------------------------------------------
#include "SMultiSpec.h"
#if defined multispec_wx
#include "xClusterSinglePassDialog.h"
#include "xImageView.h"
#endif // defined multispec_wx
#if defined multispec_mac || defined multispec_mac_swift
#define IDC_ClusterTrainingAreas 12
#define IDC_LineStart 19
#define IDC_LineEnd 20
#define IDC_ColumnStart 22
#define IDC_ColumnEnd 23
#define IDC_ClassPrompt 27
#define IDC_ClassCombo 28
#endif // defined multispec_mac || defined multispec_mac_swift
#if defined multispec_win
#include "WImageView.h"
#include "WClusterSinglePassDialog.h"
#endif // defined multispec_win
//------------------------------------------------------------------------------------
//
// M a c r o s
//
//------------------------------------------------------------------------------------
#define AddNewCluster(pix, gClusterHead) \
{ \
short int channelTemp; \
ClusterType* newCluster; \
HCTypePtr pixPtr1; \
HDoublePtr clusterSumSquarePtr; \
\
\
newCluster = (ClusterType*)MNewPointer ((SInt32)sizeof (ClusterType) + \
sizeof (CMeanType)*gClusterSpecsPtr->numberChannels + \
sizeof (double)*gSizeOfDoubleVector); \
if (newCluster == NULL) return (FALSE); \
newCluster->next = gClusterHead; \
gClusterHead = newCluster; \
gClusterHead->numPixInCluster = 0; \
gClusterHead->numPixels = 1; \
gClusterHead->sumPtr = NULL; \
gClusterHead->meanPtr = (HCMeanTypePtr)&newCluster[1]; \
gClusterHead->sumPtr = (HDoublePtr)&gClusterHead->meanPtr[ \
gClusterSpecsPtr->numberChannels]; \
gClusterHead->variancePtr = &gClusterHead->sumPtr[numberChannels]; \
clusterSumSquarePtr = gClusterHead->sumSquarePtr1 = \
&gClusterHead->variancePtr[numberChannels]; \
gClusterHead->sumSquarePtr2 = NULL; \
pixPtr1 = pix; \
for (channelTemp = 0; channelTemp < numberChannels; channelTemp++) \
{ \
*(gClusterHead->meanPtr + channelTemp) = *pixPtr1; \
*(gClusterHead->sumPtr + channelTemp) = *pixPtr1; \
*clusterSumSquarePtr = (double)*pixPtr1 * *pixPtr1; \
pixPtr1++; \
clusterSumSquarePtr++; \
} \
gClusterHead->varianceComputed = FALSE; \
\
gTotalNumberOfClusters++; \
gClusterHead->clusterNumber = gTotalNumberOfClusters; \
gClusterHead->projectStatClassNumber = -1; \
\
}
//------------------------------------------------------------------------------------
#define Distance(cluster, pix, distance) \
{ \
short int channelTemp; \
CMeanType2 normDistanceTemp; \
HCTypePtr pixPtr; \
HCMeanTypePtr clusterMeanPtr; \
\
pixPtr = pix; \
clusterMeanPtr = cluster->meanPtr; \
distance = 0; \
for (channelTemp = 0; channelTemp < numberChannels; channelTemp++) \
{ \
normDistanceTemp = (CMeanType2)*pixPtr - \
(CMeanType2)*clusterMeanPtr; \
distance += (double)normDistanceTemp * normDistanceTemp; \
pixPtr++; \
clusterMeanPtr++; \
} \
}
//------------------------------------------------------------------------------------
#define UpdateClusterMean(pix, cluster) \
{ \
HDoublePtr clusterSumPtr; \
HDoublePtr clusterSumSquarePtr; \
short int channelTemp; \
SInt32 numPixTemp; \
HCTypePtr pixPtr1; \
HCMeanTypePtr clusterMeanPtr; \
\
clusterMeanPtr = cluster->meanPtr; \
clusterSumPtr = cluster->sumPtr; \
clusterSumSquarePtr = cluster->sumSquarePtr1; \
(cluster->numPixels)++; \
numPixTemp = cluster->numPixels; \
pixPtr1 = pix; \
for (channelTemp = 0; channelTemp < numberChannels; channelTemp++) \
{ \
*clusterSumPtr += *pixPtr1; \
\
*clusterMeanPtr = *clusterSumPtr/(double)numPixTemp; \
\
/* *clusterMeanPtr = \
(CMeanType)((*clusterSumPtr/(double)numPixTemp) + 0.5); */ \
\
clusterMeanPtr++; \
clusterSumPtr++; \
\
*clusterSumSquarePtr += (double)*pixPtr1 * *pixPtr1; \
clusterSumSquarePtr++; \
pixPtr1++; \
} \
cluster->varianceComputed = FALSE; \
}
//------------------------------------------------------------------------------------
// Prototypes for file routines that are only called from other
// routines in this file.
SInt16 OnePassCluster (
FileIOInstructionsPtr fileIOInstructionsPtr);
Boolean OnePassClusterAreas (
FileIOInstructionsPtr fileIOInstructionsPtr,
LCToWindowUnitsVariables* lcToWindowUnitsVariablesPtr,
HUInt16Ptr* dataClassPtrPtr,
SInt16 firstLineCode);
// Global variables for this file.
SInt16 gTotalNumberOfClusters;
UInt32 gSizeOfDoubleVector;
ClusterType* gClusterHead; // ptr to head of cluster list.
//------------------------------------------------------------------------------------
// Copyright 1988-2020 Purdue Research Foundation
//
// Function name: void ClusterOnePassControl
//
// Software purpose: The purpose of this routine is to control the user
// requests for cluster operations on an image file.
//
// Parameters in: Pointer to image file information structure
//
// Parameters out: None
//
// Value Returned: True if everything worked okay
// False if a problem came up such as shortage of memory
//
// Called By: ClusterControl in SCluster.cpp
//
// Coded By: Eric E. Demaree Date: Spring 1989
// Revised By: Larry L. Biehl Date: 02/23/2012
Boolean ClusterOnePassControl (
FileInfoPtr fileInfoPtr)
{
ClusterType *currentCluster,
*lastCluster;
CMFileStream* resultsFileStreamPtr;
FileIOInstructionsPtr fileIOInstructionsPtr;
HUCharPtr classifyBufferPtr;
SInt32 numberSumSquares;
SInt16 numClusters;
Boolean continueFlag;
// Initialize variables.
continueFlag = TRUE;
gTotalNumberOfClusters = 0;
fileIOInstructionsPtr = NULL;
numberSumSquares = (SInt32)gClusterSpecsPtr->numberChannels;
gSizeOfDoubleVector = 2 * gClusterSpecsPtr->numberChannels + numberSumSquares;
gClusterHead = NULL;
resultsFileStreamPtr = GetResultsFileStreamPtr (0);
// Get memory and initialize some variables to be used by single
// pass clustering.
continueFlag = InitializeClusterMemory (&fileIOInstructionsPtr);
if (continueFlag)
{
// Initialize some global variables to allow the user to pause
// or cancel the classification.
InitializeGlobalAlertVariables (kContinueStopAlertID,
kAlertStrID,
IDS_Alert123);
numClusters = OnePassCluster (fileIOInstructionsPtr);
continueFlag = (numClusters > 0);
// Reset the cancel operation globals.
ClearGlobalAlertVariables ();
} // end "if (continueFlag)"
// Set up the cluster class to final class vector if needed.
if (continueFlag)
continueFlag = SetUpClassToFinalClassPtr ();
// Create a cluster classification map if requested.
if (gClusterSpecsPtr->classificationArea != 0 && continueFlag)
{
// Get the memory for the classification buffer.
classifyBufferPtr = (HUCharPtr)MNewPointerClear (
gImageWindowInfoPtr->maxNumberColumns +
gNumberOfEndOfLineCharacters + 1);
continueFlag = (classifyBufferPtr != NULL);
if (continueFlag)
continueFlag = ClusterClassification (
fileIOInstructionsPtr,
gClusterSpecsPtr->numberFinalClusters,
classifyBufferPtr);
// Release memory for the classification buffer.
classifyBufferPtr = CheckAndDisposePtr (classifyBufferPtr);
} // end "if (gClusterSpecsPtr->classificationArea != 0 && "
// Create a cluster mask file if requested.
if (continueFlag && (gClusterSpecsPtr->outputStorageType & kClusterMaskCode))
continueFlag = CreateClusterMaskFile ();
// Save the statistics if requested.
if (continueFlag)
continueFlag = SaveClusterStatistics (
fileIOInstructionsPtr, gClusterSpecsPtr->numberFinalClusters);
// Release memory for the pixel cluster class assignments.
gClusterSpecsPtr->dataClassPtr = CheckAndDisposePtr (
gClusterSpecsPtr->dataClassPtr);
// Free memory that the clusters used.
currentCluster = gClusterSpecsPtr->clusterHead;
while (currentCluster != NULL)
{
lastCluster = currentCluster;
currentCluster = currentCluster->next;
CheckAndDisposePtr ((char*)lastCluster);
} // end "while (currentCluster != NULL)"
gClusterSpecsPtr->clusterHead = NULL;
// Dispose of the IO buffer.
DisposeIOBufferPointers (fileIOInstructionsPtr,
&gInputBufferPtr,
&gOutputBufferPtr);
gClusterSpecsPtr->clusterClassToFinalClassPtr = CheckAndDisposePtr (
gClusterSpecsPtr->clusterClassToFinalClassPtr);
return (TRUE);
} // end Function "ClusterOnePassControl"
//------------------------------------------------------------------------------------
// Copyright 1988-2020 Purdue Research Foundation
//
// Function name: Boolean GetOnePassClusterCenters
//
// Software purpose: The purpose of this routine is to determine the
// clusters for ISODATA clustering using the one-pass
// cluster algorithm technique.
//
// Parameters in: Pointer to image file information structure
//
// Parameters out: None
//
// Value Returned: True if everything worked okay
// False if a problem came up such as shortage of memory
//
// Called By: InitializeClusterCenters in SClusterIsodata.cpp
//
// Coded By: Larry L. Biehl Date: 01/14/1991
// Revised By: Larry L. Biehl Date: 04/19/2019
Boolean GetOnePassClusterCenters (
FileIOInstructionsPtr fileIOInstructionsPtr)
{
ClusterType* currentCluster;
HDoublePtr doubleVectorPtr;
SInt32 endIndexCount,
index,
numberSumSquares;
SInt16 numberChannels;
Boolean continueFlag;
gTotalNumberOfClusters = 0;
numberChannels = gClusterSpecsPtr->numberChannels;
numberSumSquares = (SInt32)numberChannels;
//numberSumSquares = (SInt32)numberChannels * (numberChannels+1)/2;
gSizeOfDoubleVector = 2 * numberChannels + numberSumSquares;
gClusterHead = NULL;
// "Determining Initial Clusters (One-Pass)"
LoadDItemStringNumber (kClusterStrID,
IDS_Cluster23,
gStatusDialogPtr,
IDC_Status11,
(Str255*)gTextString);
// Create new clusters from first line of data in each cluster area.
continueFlag = OnePassClusterAreas (fileIOInstructionsPtr,
NULL,
NULL,
1);
// Continue clustering using only part
if (continueFlag)
continueFlag = OnePassClusterAreas (fileIOInstructionsPtr,
NULL,
NULL,
2);
// Store values in cluster specifications structure.
gClusterSpecsPtr->clusterHead = gClusterHead;
gClusterSpecsPtr->numberClusters = gTotalNumberOfClusters;
// Clear the cluster statistics to be ready for the ISODATA step
// of clustering.
if (continueFlag)
{
endIndexCount = numberChannels;
currentCluster = gClusterHead;
while (currentCluster != NULL)
{
currentCluster->numPixels = 0;
doubleVectorPtr = (double*)currentCluster->sumPtr;
for (index=0; index<numberChannels; index++)
{
*doubleVectorPtr = 0;
doubleVectorPtr++;
} // end "for (index=0; index<numberChannels; index++)"
doubleVectorPtr = (double*)currentCluster->sumSquarePtr1;
for (index=0; index<endIndexCount; index++)
{
*doubleVectorPtr = 0;
doubleVectorPtr++;
} // end "for (index=0; index<numberChannels; index++)"
currentCluster = currentCluster->next;
} // end "while (currentCluster != NULL)"
} // end "if (continueFlag)"
return (continueFlag);
} // end "GetOnePassClusterCenters"
//------------------------------------------------------------------------------------
// Copyright 1988-2020 Purdue Research Foundation
//
// Function name: SInt16 OnePassCluster
//
// Software purpose: The purpose of this routine is to perform the
// one pass cluster on the requested set of data.
//
// Parameters in: Pointer to image file information structure
//
// Parameters out: None
//
// Value Returned: -1 if user cancels the operation or a problem
// occurred.
// The number of clusters found.
//
// Called By: ClusterOnePassControl in SClusterSinglePass.cpp
//
// Coded By: Eric E. Demaree Date: Spring 1989
// Revised By: Larry L. Biehl Date: 04/19/2019
SInt16 OnePassCluster (
FileIOInstructionsPtr fileIOInstructionsPtr)
{
// Define local structures and variables.
LCToWindowUnitsVariables lcToWindowUnitsVariables;
CMFileStream* clResultsFileStreamPtr;
HUInt16Ptr dataClassPtr;
Handle activeImageWindowInfoHandle;
SInt16 minimumClusterSize,
numberChannels;
Boolean continueFlag;
// Initialize local variables.
continueFlag = TRUE;
numberChannels = gClusterSpecsPtr->numberChannels;
minimumClusterSize = gClusterSpecsPtr->minClusterSize;
clResultsFileStreamPtr = GetResultsFileStreamPtr (0);
activeImageWindowInfoHandle = FindProjectBaseImageWindowInfoHandle ();
// Set some variables for use when drawing image overlays.
SetLCToWindowUnitVariables (activeImageWindowInfoHandle,
kToImageWindow,
FALSE,
&lcToWindowUnitsVariables);
// Create new clusters from first line of data in each cluster area.
// "Clustering First Line(s)."
LoadDItemStringNumber (kClusterStrID,
IDS_Cluster20,
gStatusDialogPtr,
IDC_Status11,
(Str255*)gTextString);
dataClassPtr = gClusterSpecsPtr->dataClassPtr;
if (!OnePassClusterAreas (fileIOInstructionsPtr,
&lcToWindowUnitsVariables,
&dataClassPtr,
1))
return (-1);
// Continue clustering using only part
// (gClusterSpecsPtr->clusterColumnInterval) of image.
LoadDItemStringNumber (kClusterStrID,
IDS_Cluster21, // "Clustering Rest of Lines."
gStatusDialogPtr,
IDC_Status11,
(Str255*)gTextString);
if (!OnePassClusterAreas (fileIOInstructionsPtr,
&lcToWindowUnitsVariables,
&dataClassPtr,
2))
return (-1);
// Delete those clusters with too few pixels.
// Find first cluster class that is large enough.
// "Checking Cluster Sizes."
LoadDItemStringNumber (kClusterStrID,
IDS_Cluster22,
gStatusDialogPtr,
IDC_Status11,
(Str255*)gTextString);
gClusterSpecsPtr->numberClusters = gTotalNumberOfClusters;
gClusterSpecsPtr->clusterHead = gClusterHead;
gClusterSpecsPtr->numberFinalClusters =
DeleteSpecifiedClusters (gClusterSpecsPtr->numberClusters,
minimumClusterSize);
// Store cluster head in cluster specifications structure.
if (gClusterSpecsPtr->numberFinalClusters == 0)
gClusterSpecsPtr->clusterHead = NULL;
gClusterHead = gClusterSpecsPtr->clusterHead;
// List message if all cluster classes are too small.
if (gClusterHead == NULL)
{
// "All clusters too small (try increasing critical distance).\r"
if (ListSpecifiedStringNumber (kClusterStrID,
IDS_Cluster26,
(unsigned char*)gTextString,
clResultsFileStreamPtr,
gOutputForce1Code,
continueFlag))
return (0);
else // !ListSpecifiedStringNumber (...
return (-1);
} // end "if (gClusterHead == NULL)"
// List number of clusters found and final number of clusters used.
if (!ListSpecifiedStringNumber (kClusterStrID,
IDS_Cluster37,
clResultsFileStreamPtr,
gOutputForce1Code,
(SInt32)gTotalNumberOfClusters,
(SInt32)gClusterSpecsPtr->numberFinalClusters,
continueFlag))
return (gClusterSpecsPtr->numberFinalClusters);
if ((gClusterSpecsPtr->numberFinalClusters > kMaxNumberStatClasses - 1) &&
(gClusterSpecsPtr->saveStatisticsCode > 0 ||
gClusterSpecsPtr->classificationArea != 0))
{
// Only keep the the 'maxNumberClusters' that have the largest number
// of pixels.
KeepLargestClusters (kMaxNumberStatClasses - 1);
// Make sure that we have the current cluster head.
gClusterHead = gClusterSpecsPtr->clusterHead;
// "Only the largest %ld classes will be used.\r"
if (!ListSpecifiedStringNumber (kClusterStrID,
IDS_Cluster5,
clResultsFileStreamPtr,
gOutputForce1Code,
(SInt32)(kMaxNumberStatClasses - 1),
continueFlag))
return (gClusterSpecsPtr->numberFinalClusters);
} // end "if (clusterCount >(kMaxNumberStatClasses-1) && ..."
// Get the cluster standard deviations.
if (!UpdateClusterStdDeviations (gClusterSpecsPtr->clusterHead))
return (-1);
// List final cluster statistics.
if (!ListClusterStatistics (clResultsFileStreamPtr, &gOutputForce1Code, TRUE))
return (gClusterSpecsPtr->numberFinalClusters);
// Return number of clusters found.
return (gClusterSpecsPtr->numberFinalClusters);
} // end Function "OnePassCluster"
//------------------------------------------------------------------------------------
// Copyright 1988-2020 Purdue Research Foundation
//
// Function name: Boolean OnePassClusterAreas
//
// Software purpose: The purpose of this routine is to determine the
// clusters in the specified lines of data in each
// of the cluster areas. If first line code is =1,
// then only the first line is clustered (all columns)
// using critical distance 1. If first line code =2,
// then the rest of the lines are clustered.
//
// Note that the data values are multiplied by 10 so that
// all calculations for cluster means are done to one
// decimal place accuracy and still use integer multiplication
// and division.
//
// Note that code is included so that the distance
// measure can include the standard deviation of the
// cluster class. So far this option has not worked
// well. The code is still included but has been
// commented out.
//
// Parameters in: Pointer to image file information structure
// Pointer to vector which identifies which cluster
// class each pixel belongs to.
// First line code; if =1 then cluster only the
// first line, all columns; if =2 then cluster
// all lines with the specified column and line
// interval.
//
// Parameters out: None
//
// Value Returned: True if everything worked okay
// False if a problem came up such as shortage of memory
//
// Called By: OnePassCluster in SClusterSinglePass.cpp
// GetOnePassClusterCenters in SClusterSinglePass.cpp
//
// Coded By: Eric E. Demaree Date: Spring 1989
// Revised By: Larry L. Biehl Date: 05/12/2020
Boolean OnePassClusterAreas (
FileIOInstructionsPtr fileIOInstructionsPtr,
LCToWindowUnitsVariables* lcToWindowUnitsVariablesPtr,
HUInt16Ptr* dataClassPtrPtr,
SInt16 firstLineCode)
{
// Define local structures and variables.
ldiv_t lDivideStruct;
Point point;
double criticalDistance,
currentDistance, // Distance from pix to current cluster.
closestDistance, // Distance from pix to closest cluster.
minutesLeft;
ClusterType *closestCluster, // cluster closest to current pixel.
*currentCluster; // Cluster currently working on.
LongRect sourceRect;
HCMeanTypePtr closestMeanPtr; // Vector holds mean of closest cluster.
HCTypePtr currentPixel, // Vector pointer for current pixel.
outputBufferPtr; // ptr to all pixels.
HUInt16Ptr localDataClassPtr,
savedDataClassPtr;
HPtr offScreenBufferPtr;
ImageOverlayInfoPtr imageOverlayInfoPtr;
Ptr stringPtr;
UInt16* channelsPtr;
WindowInfoPtr imageWindowInfoPtr;
WindowPtr windowPtr;
Handle activeImageWindowInfoHandle;
int nextStatusAtLeastLine,
nextStatusAtLeastLineIncrement;
//CMeanType2 closestDistance, // Distance from pix to closest cluster.
// currentDistance; // Distance from pix to current cluster.
RgnHandle rgnHandle;
SInt32 displayBottomMax,
line,
lineCount,
linesDone,
lineEnd,
lineInterval,
linesLeft,
lineStart,
numberColumns,
startTick;
//UInt32 criticalDistance1Squared; // Used for standard deviations only.
UInt32 column,
columnEnd,
columnInterval,
columnStart,
columnWidth,
firstColumn,
numberSamples,
sample,
skipCount,
startSample;
SInt16 areaNumber,
channel, // Counting variable for channels
distanceType = 1,
errCode,
fieldNumber,
lastClassIndex,
lastFieldIndex,
numberChannels,
pointType,
totalNumberAreas;
//UInt16 maskRequestValue;
Boolean createImageOverlayFlag,
polygonFieldFlag,
returnFlag = TRUE;
// Initialize local variables.
numberChannels = gClusterSpecsPtr->numberChannels;
totalNumberAreas = gClusterSpecsPtr->totalNumberAreas;
columnInterval = gClusterSpecsPtr->clusterColumnInterval;
lineInterval = gClusterSpecsPtr->clusterLineInterval;
channelsPtr = (UInt16*)GetHandlePointer (gClusterSpecsPtr->channelsHandle);
outputBufferPtr = (CType*)gOutputBufferPtr;
criticalDistance = gClusterSpecsPtr->criticalDistance1;
windowPtr = FindProjectBaseImageWindowPtr ();
activeImageWindowInfoHandle = FindProjectBaseImageWindowInfoHandle ();
imageWindowInfoPtr = (WindowInfoPtr)GetHandlePointer (
activeImageWindowInfoHandle);
imageOverlayInfoPtr = GetImageOverlayInfoPtr (gClusterSpecsPtr->imageOverlayIndex,
kLock,
NULL);
if (gClusterSpecsPtr->clustersFrom == kTrainingType)
LoadDItemValue (gStatusDialogPtr,
IDC_Status5,
(SInt32)gClusterSpecsPtr->totalNumberAreas);
if (firstLineCode != 1)
{
criticalDistance = gClusterSpecsPtr->criticalDistance2;
ShowStatusDialogItemSet (kStatusField);
ShowStatusDialogItemSet (kStatusCluster);
if (gClusterSpecsPtr->clustersFrom == kTrainingType)
HideStatusDialogItemSet (kStatusMinutes);
if (gClusterSpecsPtr->clustersFrom == kAreaType)
ShowStatusDialogItemSet (kStatusMinutes);
} // end "if (firstLineCode != 1)"
if (distanceType == 2)
criticalDistance *= criticalDistance;
// Used for standard deviation type only.
//
//criticalDistance1Squared = gClusterSpecsPtr->criticalDistance1 *
// gClusterSpecsPtr->criticalDistance1;
//criticalDistance1Squared *= criticalDistance;
createImageOverlayFlag = FALSE;
localDataClassPtr = NULL;
if (dataClassPtrPtr != NULL)
{
localDataClassPtr = *dataClassPtrPtr;
if (localDataClassPtr != NULL)
createImageOverlayFlag = (gOutputCode & kCreateImageOverlayCode);
} // end "if (dataClassPtrPtr != NULL)"
fieldNumber = 0;
lastClassIndex = -1;
lastFieldIndex = -1;
// Intialize the nextTime variable to indicate when the next check
// should occur for a command-.
gNextTime = TickCount ();
if (firstLineCode == 1 && gOutputCode & kCreateImageOverlayCode)
{
// Set the draw base image flag depending on whether the overlay
// will cover the entire base image.
imageWindowInfoPtr->drawBaseImageFlag = FALSE;
if (imageOverlayInfoPtr->drawBaseImageCode != 15)
{
imageWindowInfoPtr->drawBaseImageFlag = TRUE;
InvalidateWindow (windowPtr, kImageFrameArea, FALSE);
} // end "if (imageOverlayInfoPtr->drawBaseImageCode != 15)"
} // if (firstPassFlag && ...
// Save the pointer to the cluster class assignments in case it is needed
// for the offscreen buffer assignments.
savedDataClassPtr = localDataClassPtr;
offScreenBufferPtr = GetImageOverlayOffscreenPointer (imageOverlayInfoPtr);
nextStatusAtLeastLineIncrement = 10;
if (createImageOverlayFlag)
{
// These variables are to make sure the display window is not being updated
// after a very few lines are loaded in. It will override the time interval
// which is currently every 1 second.
double magnification = lcToWindowUnitsVariablesPtr->magnification;
nextStatusAtLeastLineIncrement = (int)((10 * lineInterval) / magnification);
nextStatusAtLeastLineIncrement = MAX (nextStatusAtLeastLineIncrement, 10);
} // end "if (createImageOverlayFlag)"
// Loop by number of cluster areas.
for (areaNumber=1; areaNumber<=totalNumberAreas; areaNumber++)
{
// Initialize status variables.
lineCount = 0;
linesDone = 0;
// The purpose of skipCount is to only allow updates in drawing the
// image overlay every 2 cycles of gNextTime.
skipCount = 0;
// Get information for next cluster area.
if (!GetNextClusterArea (gProjectInfoPtr,
channelsPtr,
numberChannels,
areaNumber,
&gNextMinutesLeftTime,
&lastClassIndex,
&lastFieldIndex,
&linesLeft))
return (FALSE);
// Initialize local image area variables.
lineStart = gAreaDescription.lineStart;
lineEnd = gAreaDescription.lineEnd;
columnStart = gAreaDescription.columnStart;
columnEnd = gAreaDescription.columnEnd;
columnWidth = columnEnd - columnStart + 1;
polygonFieldFlag = gAreaDescription.polygonFieldFlag;
rgnHandle = gAreaDescription.rgnHandle;
pointType = gAreaDescription.pointType;
// Set up source rect. This will indicate the lines and columns to
// be updated when one does a copy to the image window.
sourceRect.left = columnStart - 1;
sourceRect.right = columnEnd;
sourceRect.top = lineStart - 1;
sourceRect.bottom = lineEnd;
displayBottomMax = sourceRect.bottom;
if (firstLineCode == 1)
{
// Initialization for first line of single pass cluster.
lineEnd = lineStart;
columnInterval = 1;
} // end "if (firstLineCode == 1)"
if (firstLineCode == 2)
{
// Initialization for rest of lines for single pass cluster.
lineCount = 1;
gAreaDescription.lineStart += lineInterval;
lineStart = gAreaDescription.lineStart;
linesLeft--;
// Remember to update the mask buffer start so that it represents the
// same area as that for the the image area.
if (pointType == kMaskType)
gAreaDescription.maskLineStart += lineInterval;
} // end "if (firstLineCode == 2)"
// Get first sample.
firstColumn = columnStart;
// Check if first column will change from line to line.
numberColumns = (columnEnd - columnStart + columnInterval) / columnInterval;
// Set up status and check time variables.
gNextStatusTime = TickCount ();
startTick = TickCount ();
gNextMinutesLeftTime = startTick + 3 * gNextStatusTimeOffset;
// Load some of the File IO Instructions structure that pertain
// to the specific area being used.
errCode = SetUpFileIOInstructions (fileIOInstructionsPtr,
&gAreaDescription,
numberChannels,
channelsPtr,
kDetermineSpecialBILFlag);
// If lineEnd is 0, then this implies that there are no requested mask
// values in the area being used. Force looping through the lines to be
// skipped.
if (lineEnd == 0)
lineStart = 1;
nextStatusAtLeastLine = nextStatusAtLeastLineIncrement;
// Loop by rest of lines for cluster area.
for (line=lineStart; line<=lineEnd; line+=lineInterval)
{
// Update dialog status information if needed.
lineCount++;
if (TickCount () >= gNextStatusTime)
{
LoadDItemValue (gStatusDialogPtr,
IDC_Status8,
(SInt32)lineCount);
LoadDItemValue (gStatusDialogPtr,
IDC_Status16,
(SInt32)gTotalNumberOfClusters);
gNextStatusTime = TickCount () + gNextStatusTimeOffset;
} // end "if (TickCount () >= gNextStatusTime)"
// Exit routine if user has "command period" down
if (TickCount () >= gNextTime)
{
skipCount++;
if (createImageOverlayFlag &&
line > lineStart &&
lineCount >= nextStatusAtLeastLine &&
skipCount >= 2)
{
sourceRect.bottom = line;
InvalidateImageSegment (imageWindowInfoPtr,
lcToWindowUnitsVariablesPtr,
&sourceRect,
displayBottomMax);
#if defined multispec_win
windowPtr->UpdateWindow ();
#endif // defined multispec_win
nextStatusAtLeastLine = lineCount + nextStatusAtLeastLineIncrement;
nextStatusAtLeastLine = MIN (nextStatusAtLeastLine, lineEnd);
skipCount = 0;
} // end "if (gOutputCode & kCreateImageOverlayCode && ..."
if (!CheckSomeEvents (osMask + keyDownMask + updateMask + mDownMask + mUpMask))
{
returnFlag = FALSE;
break;
} // end "if (!CheckSomeEvents (..."
// Make sure the base image is not drawn for the rest of the processing.
if (gOutputCode & kCreateImageOverlayCode)
imageWindowInfoPtr->drawBaseImageFlag = FALSE;
} // end "if (TickCount () >= nextTime)"
// Set vertical (line) point in case it is needed for polygonal areas.
point.v = (SInt16)line;
// Get all requested channels for first line of image data.
// Return if there is a file IO error.
errCode = GetLineOfData (fileIOInstructionsPtr,
line,
firstColumn,
columnEnd,
columnInterval,
gInputBufferPtr,
(HUCharPtr)outputBufferPtr);
if (errCode < noErr)
{
returnFlag = FALSE;
break;
} // end "if (errCode < noErr)"
if (errCode != kSkipLine)
{
currentPixel = outputBufferPtr;
startSample = 1;
if (pointType == kMaskType)
numberSamples = fileIOInstructionsPtr->numberOutputBufferSamples;
else // pointType != kMaskType
numberSamples =
(columnEnd - firstColumn + columnInterval) / columnInterval;
column = firstColumn;
// Make certain that we have a valid clusterhead alocated.
while (gClusterHead == NULL)
{
point.h = (SInt16)column;
if (!polygonFieldFlag || PtInRgn (point, rgnHandle))
{
AddNewCluster (currentPixel, gClusterHead);
if (localDataClassPtr != NULL)
{
*localDataClassPtr = gClusterHead->clusterNumber;
localDataClassPtr++;
} // end "if (localDataClassPtr != NULL)"
} // end "if (includePixelFlag)"
currentPixel += numberChannels;
column += columnInterval;
startSample++;
if (startSample > numberSamples)
break;
} // end "while (gClusterHead == NULL)"
for (sample=startSample; sample<=numberSamples; sample++)
{
point.h = (SInt16)column;
if (!polygonFieldFlag || PtInRgn (point, rgnHandle))
{
closestCluster = gClusterHead;
currentCluster = gClusterHead->next;
Distance (closestCluster, currentPixel, closestDistance);
// Find closest cluster in absolute sense (Euclidean
// distance).
while (currentCluster != NULL)
{
Distance (currentCluster, currentPixel, currentDistance);
if (currentDistance < closestDistance)
{
closestCluster = currentCluster;
closestDistance = currentDistance;
} // end "if (currentDistance < closestDistance)"
currentCluster = currentCluster->next;
} // end " while (currentCluster != NULL)"
// Make sure pixel is within critical distance from the
// chosen cluster.
// Two different distance measures are supported here.
// distance1 is just linear distance.
// !distance1 is the number of standard deviations.
//if (distanceType == 1)
// {
closestMeanPtr = closestCluster->meanPtr;
for (channel = 0; channel < numberChannels; channel++)
{
//if (labs (*(closestMeanPtr+channel) -
// 10 * (SInt32)*(currentPixel+channel)) >
// criticalDistance)
if (fabs (*(closestMeanPtr + channel) -
*(currentPixel + channel)) > criticalDistance)
{
closestCluster = NULL;
break;
} // end "if (labs (*(closestMean+channel) - ..."
} // end "for (channel=0; channel<...)"
//} // end "if (distanceType == 1)"
//else // distanceType != 1
/*
{
// First make sure that the variances for the closest
// cluster are up-to-date.
if (!closestCluster->varianceComputed)
{
closestVariancePtr = closestCluster->variancePtr;
// This will handle the case when there is only
// one pixel in the class. We will revert back
// to the distance1 measure used for the first
// line of pixels.
if (closestCluster->numPixels <= 1)
for (channel=0; channel<numberChannels; channel++)
{
*closestVariancePtr = criticalDistance1Squared;
closestVariancePtr++;
} // end "for (channel = 0; ..."
else // closestCluster->numPixels > 1
{
closestSumPtr = closestCluster->sumPtr;
closestSumSquarePtr = closestCluster->sumSquarePtr1;
numberPixels = closestCluster->numPixels;
numberPixelsLessOne = numberPixels - 1;
for (channel=0; channel<numberChannels; channel++)
{
*closestVariancePtr = (*closestSumSquarePtr -
*closestSumPtr * *closestSumPtr/numberPixels)/
numberPixelsLessOne;
*closestVariancePtr *= criticalDistance;
if (*closestVariancePtr == 0)
*closestVariancePtr = criticalDistance1Squared;
closestVariancePtr++;
closestSumSquarePtr++;
closestSumPtr++;
} // end "for (channel = 0; channel < ..."
closestCluster->varianceComputed = TRUE;
} // end "else closestCluster->numPixels > 1"
} // end "if (!closestCluster->varianceComputed)"
closestMeanPtr = closestCluster->meanPtr;
closestVariancePtr = closestCluster->variancePtr;
for (channel = 0; channel < numberChannels; channel++)
{
distance =
*closestMeanPtr - 10 * *(currentPixel+channel);
if (distance * distance > 100 * *closestVariancePtr)
{
closestCluster = NULL;
break;
} // end "if (distance * distance > ..."
closestMeanPtr++;
closestVariancePtr++;
} // end "for (channel=0; channel<...)"
} // end "else distanceType != 1"
*/
if (closestCluster == NULL)
{
AddNewCluster (currentPixel, gClusterHead);
closestCluster = gClusterHead;
} // end "if (closestCluster == NULL)"
else // closestCluster != NULL
{
UpdateClusterMean (currentPixel, closestCluster);
} // end "else closestCluster != NULL"
if (localDataClassPtr)
{
*localDataClassPtr = closestCluster->clusterNumber;
localDataClassPtr++;
} // end "if (localDataClassPtr)"
} // end "if (includePixelFlag)"
currentPixel += numberChannels;
column += columnInterval;
} // end "for (sample=startSample; sample<=numberSamples; sample++)"
if (createImageOverlayFlag)
{
CopyToOffscreenBuffer (fileIOInstructionsPtr,
imageOverlayInfoPtr,
gClusterSpecsPtr->imageOverlayIndex,
activeImageWindowInfoHandle,
line,
firstColumn,
columnInterval,
numberSamples,
lineStart,
rgnHandle,
(HUCharPtr)savedDataClassPtr,
offScreenBufferPtr,
1,
TRUE);
savedDataClassPtr = localDataClassPtr;
} // end "if (createImageOverlayFlag)"
if (pointType != kMaskType)
{
// Update firstColumn so that columnInterval samples are
// skipped from the end of one line to the beginning of the
// next line. This will allow the user to use samples from
// all columns if a column interval other than one is used.
firstColumn = columnStart + column - columnEnd - 1;
if (firstColumn > columnEnd)
{
lDivideStruct = ldiv (firstColumn - columnStart, columnWidth);
firstColumn = columnStart + lDivideStruct.rem;
} // end "if (firstColumn > columnEnd)"
} // end "if (pointType != kMaskType)"
} // end "if (errCode != kSkipLine)"
linesDone++;
linesLeft--;
if (TickCount () >= gNextMinutesLeftTime)
{
minutesLeft = (linesLeft * (TickCount () - startTick)) /
(double)(lineCount * kTicksPerMinute);
sprintf ((char*)gTextString, " %.1f", minutesLeft);
stringPtr = (char*)CtoPstring (gTextString, gTextString);
LoadDItemString (gStatusDialogPtr, IDC_Status14, (Str255*)gTextString);
gNextMinutesLeftTime = TickCount () + gNextMinutesLeftTimeOffset;
} // end "if (TickCount () >= gNextMinutesLeftTime)"
if (pointType == kMaskType)
fileIOInstructionsPtr->maskBufferPtr +=
fileIOInstructionsPtr->numberMaskColumnsPerLine;
} // end "for (line=lineStart; line<=lineEnd; ...)"
// Force overlay to be drawn if it has not been already.
if (createImageOverlayFlag && firstLineCode != 1)
{
sourceRect.bottom = displayBottomMax;
InvalidateImageSegment (imageWindowInfoPtr,
//displaySpecsPtr,
lcToWindowUnitsVariablesPtr,
&sourceRect,
displayBottomMax);
#if defined multispec_win
windowPtr->UpdateWindow ();
#endif // defined multispec_win
if (!CheckSomeEvents (
osMask + keyDownMask + updateMask + mDownMask + mUpMask))
{
returnFlag = FALSE;
break;
} // end "if (!CheckSomeEvents (..."
// Make sure the base image is not drawn for the rest of the processing.
if (gOutputCode & kCreateImageOverlayCode)
imageWindowInfoPtr->drawBaseImageFlag = FALSE;
} // end "if (createImageOverlayFlag && firstLineCode != 1)"
if (returnFlag)
{
LoadDItemValue (gStatusDialogPtr, IDC_Status8, lineCount);
LoadDItemValue (gStatusDialogPtr,
IDC_Status16,
(SInt32)gTotalNumberOfClusters);
} // end "if (returnFlag)"
// Close up any File IO Instructions structure that pertain to the
// specific area used for the list data.
CloseUpFileIOInstructions (fileIOInstructionsPtr, &gAreaDescription);
// Dispose of the region if it exists.
CloseUpAreaDescription (&gAreaDescription);
if (!returnFlag)
break;
} // end "for (areaNumber=1; areaNumber<=totolNumberAreas; ...)"
UnlockImageOverlayOffscreenBuffer (imageOverlayInfoPtr);
if (dataClassPtrPtr != NULL)
*dataClassPtrPtr = localDataClassPtr;
return (returnFlag);
} // end "OnePassClusterAreas"
//------------------------------------------------------------------------------------
// Copyright 1988-2020 Purdue Research Foundation
//
// Function name: Boolean OnePassClusterDialog
//
// Software purpose: The purpose of this routine is to handle the
// modal dialog for selecting the one pass cluster
// specifications.
//
// Parameters in: Pointer to image file information structure
//
// Parameters out: None
//
// Value Returned: True if user selected OK in dialog box.
// False if user selected cancel or memory was short.
//
// Called By: ClusterDialog in SCluster.cpp
//
// Coded By: Larry L. Biehl Date: 09/15/1989
// Revised By: Larry L. Biehl Date: 12/16/2016
Boolean OnePassClusterDialog (
FileInfoPtr fileInfoPtr,
DialogPtr parentDialogPtr)
{
Boolean returnFlag;
#if defined multispec_mac
DialogSelectArea dialogSelectArea;
DialogPtr dialogPtr;
double criticalDistance1,
criticalDistance2;
UInt16* localClassAreaPtr = NULL;
Handle okHandle,
theHandle;
Rect theBox;
SInt32 minClusterSize,
theNum;
UInt32 localNumberClassAreas;
SInt16 clustersFrom,
itemHit,
theType;
UInt16 distanceDecimalDigits;
Boolean modalDone;
// Initialize local variables.
dialogPtr = NULL;
returnFlag = GetDialogLocalVectors (NULL,
NULL,
NULL,
&localClassAreaPtr,
NULL,
NULL,
NULL,
NULL);
// Get the modal dialog for the one pass cluster specification.
if (returnFlag)
dialogPtr = LoadRequestedDialog (
kOnePassClusterSpecificationID, kCopyScrap, 1, 2);
if (dialogPtr == NULL)
{
ReleaseDialogLocalVectors (NULL,
NULL,
NULL,
localClassAreaPtr,
NULL,
NULL,
NULL,
NULL);
return (FALSE);
} // end "if (dialogPtr == NULL)"
// Set Procedure pointers for those dialog items that need them.
SetDialogItemDrawRoutine (dialogPtr, 26, gHiliteOKButtonPtr);
SetDialogItemDrawRoutine (dialogPtr, 28, gDrawDialogClassPopUpPtr);
OnePassClusterDialogInitialize (dialogPtr,
localClassAreaPtr,
&minClusterSize,
&criticalDistance1,
&criticalDistance2,
&distanceDecimalDigits,
&clustersFrom,
&gClassSelection,
&localNumberClassAreas,
&dialogSelectArea);
// Save handle for the OK button for use later.
GetDialogItem (dialogPtr, 1, &theType, &okHandle, &theBox);
// Load default Minimum Cluster Size.
LoadDItemValue (dialogPtr, 6, minClusterSize);
// Load default Critical Distance 1.
LoadDItemRealValue (dialogPtr, 8, criticalDistance1, distanceDecimalDigits);
// Load default Critical Distance 2.
LoadDItemRealValue (dialogPtr, 10, criticalDistance2, distanceDecimalDigits);
// Training areas.
SetDLogControl (dialogPtr, 12, clustersFrom == kTrainingType);
// Selected Image area.
SetDLogControl (dialogPtr, 13, clustersFrom == kAreaType);
// Center the dialog and then show it.
ShowDialogWindow (
dialogPtr, kOnePassClusterSpecificationID, kSetUpDFilterTable);
gDialogItemDescriptorPtr[8] = kDItemReal;
gDialogItemDescriptorPtr[10] = kDItemReal;
// Set default text selection to first edit text item
SelectDialogItemText (dialogPtr, 6, 0, INT16_MAX);
modalDone = FALSE;
itemHit = 0;
do {
ModalDialog (gProcessorDialogFilterPtr, &itemHit);
if (itemHit > 2)
{
// If itemHit was a number item, check for bad values. If
// itemHit was a radio button make appropriate control
// settings to indicate to the user the present selection.
// Get the handle to the itemHit. For number value items, get
// the string and convert it to a number.
GetDialogItem (dialogPtr, itemHit, &theType, &theHandle, &theBox);
if (theType == 16)
{
GetDialogItemText (theHandle, gTextString);
StringToNum (gTextString, &theNum);
} // end "if (theType == 16)"
switch (itemHit)
{
case 6: // Minimum cluster size
//if (theNum == 0 || theNum > LONG_MAX)
// NumberErrorAlert ((SInt32)gClusterSpecsPtr->minClusterSize,
// dialogPtr,
// itemHit);
break;
case 8: // Critical distance 1
//if (theNum == 0 || theNum > LONG_MAX)
// NumberErrorAlert (gClusterSpecsPtr->criticalDistance1,
// dialogPtr,
// itemHit);
break;
case 10: // Critical distance 2
//if (theNum == 0 || theNum > LONG_MAX)
// NumberErrorAlert (gClusterSpecsPtr->criticalDistance2,
// dialogPtr,
// itemHit);
break;
case 12: // Clusters from training fields
clustersFrom = kTrainingType;
SetControlValue ((ControlHandle)theHandle, 1);
SetDLogControl (dialogPtr, 13, 0);
OnePassClusterDialogOnTrainingAreas (dialogPtr);
break;
case 13: // Clusters from selected image area.
clustersFrom = kAreaType;
SetControlValue ((ControlHandle)theHandle, 1);
SetDLogControl (dialogPtr, 12, 0);
OnePassClusterDialogOnImageArea (dialogPtr);
break;
case 19: // cluster from lineStart
case 20: // cluster from lineEnd
case 21: // cluster from lineInterval
case 22: // cluster from columnStart
case 23: // cluster from columnEnd
case 24: // cluster from columnInterval
case 25: // Entire area to selected area switch.
case 26: // Entire area to selected area switch.
DialogLineColumnHits (&dialogSelectArea,
dialogPtr,
itemHit,
theHandle,
theNum);
break;
case 28: // Classes
itemHit = StandardPopUpMenu (dialogPtr,
27,
28,
gPopUpAllSubsetMenu,
gClassSelection,
kPopUpAllSubsetMenuID);
if (itemHit == kSubsetMenuItem)
{
// Subset of classes to be used.
itemHit = ClassDialog (
&localNumberClassAreas,
(SInt16*)localClassAreaPtr,
1,
gProjectInfoPtr->numberStatisticsClasses,
gClassSelection,
okHandle);
} // end "if (itemHit == kSubsetMenuItem)"
if (itemHit != 0)
gClassSelection = itemHit;
// Make certain that the correct label is drawn in the
// class pop up box.
InvalWindowRect (GetDialogWindow (dialogPtr), &theBox);
break;
} // end "switch (itemHit)"
} // end "if (itemHit > 2)"
else if (itemHit > 0) // and itemHit <= 2
{
// Check minimum cluster size
if (itemHit == 1)
itemHit = CheckMaxValue (dialogPtr,
6,
1,
LONG_MAX,
kDisplayRangeAlert);
// Check critical distance 1
if (itemHit == 1)
itemHit = CheckMaxRealValue (dialogPtr,
8,
ULONG_MAX,
kZeroNotAllowed,
kDisplayRangeAlert);
// Check critical distance 2
if (itemHit == 1)
itemHit = CheckMaxRealValue (dialogPtr,
10,
ULONG_MAX,
kZeroNotAllowed,
kDisplayRangeAlert);
// If item hit is 1, check if cluster from area line-column
// values make sense. If they don't, sound an alert and make
// item hit equal to 0 to allow user to make changes.
if (itemHit == 1 && clustersFrom == kAreaType)
itemHit = CheckLineColValues (
&dialogSelectArea,
gClusterSpecsPtr->clusterLineStart,
gClusterSpecsPtr->clusterColumnStart,
dialogPtr);
if (itemHit == 1) // User selected OK for information
{
modalDone = TRUE;
returnFlag = TRUE;
OnePassClusterDialogOK (GetDItemValue (dialogPtr, 6),
GetDItemRealValue (dialogPtr, 8),
GetDItemRealValue (dialogPtr, 10),
clustersFrom,
gClassSelection,
localClassAreaPtr,
localNumberClassAreas,
&dialogSelectArea);
} // end "if (itemHit == 1)"
if (itemHit == 2) // User selected Cancel for information
{
modalDone = TRUE;
returnFlag = FALSE;
}
} // end "else if (itemHit > 0) and itemHit <= 2"
} while (!modalDone);
ReleaseDialogLocalVectors (NULL,
NULL,
NULL,
localClassAreaPtr,
NULL,
NULL,
NULL,
NULL);
CloseRequestedDialog (dialogPtr, kSetUpDFilterTable);
#endif // defined multispec_mac
#if defined multispec_win
CMSinglePassClusterDialog* dialogPtr = NULL;
TRY
{
dialogPtr = new CMSinglePassClusterDialog ();
returnFlag = dialogPtr->DoDialog ();
delete dialogPtr;
}
CATCH_ALL (e)
{
MemoryMessage (0, kObjectMessage);
returnFlag = FALSE;
}
END_CATCH_ALL
#endif // defined multispec_win
#if defined multispec_wx
CMSinglePassClusterDialog* dialogPtr = NULL;
//dialogPtr = new CMSinglePassClusterDialog (wxTheApp->GetTopWindow ());
dialogPtr = new CMSinglePassClusterDialog (parentDialogPtr);
returnFlag = dialogPtr->DoDialog ();
delete dialogPtr;
#endif // defined multispec_wx
return (returnFlag);
} // end "OnePassClusterDialog"
//------------------------------------------------------------------------------------
// Copyright 1988-2020 Purdue Research Foundation
//
// Function name: void OnePassClusterDialogInitialize
//
// Software purpose: The purpose of this routine is to handle the initialization ot
// parameters for the ISODATA dialog box.
//
// Parameters in: None
//
// Parameters out: None
//
// Value Returned: None
//
// Called By: ClusterDialog in SCluster.cpp
//
// Coded By: Larry L. Biehl Date: 03/23/1999
// Revised By: Larry L. Biehl Date: 09/05/2017
void OnePassClusterDialogInitialize (
DialogPtr dialogPtr,
UInt16* localClassAreaPtr,
SInt32* minClusterSizePtr,
double* criticalDistance1Ptr,
double* criticalDistance2Ptr,
UInt16* distanceDecimalDigitsPtr,
SInt16* clustersFromPtr,
SInt16* classAreaSelectionPtr,
UInt32* numberClassAreasPtr,
DialogSelectArea* dialogSelectAreaPtr)
{
SInt16 fieldsExistCode;
// Load the dialog local vectors
LoadDialogLocalVectors (NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
localClassAreaPtr,
gClusterSpecsPtr->clusterClassHandle,
gClusterSpecsPtr->numberClusterClasses,
NULL,
NULL,
NULL,
NULL,
NULL,
0,
NULL);
// Load default Minimum Cluster Size.
*minClusterSizePtr = gClusterSpecsPtr->minClusterSize;
// Load default Critical Distances 1 & 2.
*criticalDistance1Ptr = gClusterSpecsPtr->criticalDistance1;
*criticalDistance2Ptr = gClusterSpecsPtr->criticalDistance2;
// Get the number of decimal digits to use for the distance measure.
*distanceDecimalDigitsPtr = 1;
if (MIN (GetNumberWholeDigits (gClusterSpecsPtr->criticalDistance1),
GetNumberWholeDigits (gClusterSpecsPtr->criticalDistance2)) == 0)
*distanceDecimalDigitsPtr = MAX (
GetNumberLeadingDecimalZeros (gClusterSpecsPtr->criticalDistance1),
GetNumberLeadingDecimalZeros (gClusterSpecsPtr->criticalDistance2));
// Training areas.
*clustersFromPtr = gClusterSpecsPtr->clustersFrom;
SInt16 lastField = -1;
fieldsExistCode = GetNextFieldArea (gProjectInfoPtr,
NULL,
gProjectInfoPtr->numberStatisticsClasses,
&lastField,
-1,
kTrainingType,
kDontIncludeClusterFields);
if (fieldsExistCode == -1)
{
SetDLogControlHilite (dialogPtr, IDC_ClusterTrainingAreas, 255);
if (gClusterSpecsPtr->clustersFrom == kTrainingType)
*clustersFromPtr = kAreaType;
} // end "if (fieldsExistCode == -1)"
// Classes to use.
// Set routine to draw the class popup box.
// Make all classes the default
if (fieldsExistCode >= 0)
{
*classAreaSelectionPtr = gClusterSpecsPtr->clusterClassSet;
*numberClassAreasPtr = gClusterSpecsPtr->numberClusterClasses;
} // end "if (fieldsExistCode >= 0)"
// Initialize selected area structure.
SInt16 entireIconItem = 25;
if (gAppearanceManagerFlag)
entireIconItem = 26;
InitializeDialogSelectArea (dialogSelectAreaPtr,
gImageWindowInfoPtr,
gProjectSelectionWindow,
gClusterSpecsPtr->clusterColumnStart,
gClusterSpecsPtr->clusterColumnEnd,
gClusterSpecsPtr->clusterColumnInterval,
gClusterSpecsPtr->clusterLineStart,
gClusterSpecsPtr->clusterLineEnd,
gClusterSpecsPtr->clusterLineInterval,
19,
entireIconItem,
kAdjustToBaseImage);
// To entire image icon.
// Cluster selected area
#if defined multispec_mac
LoadLineColumnItems (dialogSelectAreaPtr,
dialogPtr,
kInitializeLineColumnValues,
kIntervalEditBoxesExist,
1);
if (gAppearanceManagerFlag)
HideDialogItem (dialogPtr, 25);
else // !gAppearanceManagerFlag
HideDialogItem (dialogPtr, 26);
#endif // defined multispec_mac
#if defined multispec_win
LoadLineColumnItems (dialogSelectAreaPtr,
dialogPtr,
kDoNotInitializeLineColumnValues,
kIntervalEditBoxesExist,
1);
#endif // defined multispec_win
// Hide/Show dialog items relative to training areas or selected area.
if (*clustersFromPtr == kTrainingType)
{
// If clusters from training areas, then only allow line and
// column intervals to show for definition.
OnePassClusterDialogOnTrainingAreas (dialogPtr);
} // end "if (*clustersFromPtr == ..."
else // *clustersFromPtr != kTrainingType
{
// If clusters from selection area, then only allow line and
// column start, end and intervals to show for definition.
OnePassClusterDialogOnImageArea (dialogPtr);
} // end "else *clustersFromPtr != ..."
} // end "OnePassClusterDialogInitialize"
//------------------------------------------------------------------------------------
// Copyright 1988-2020 Purdue Research Foundation
//
// Function name: void OnePassClusterDialogOK
//
// Software purpose: The purpose of this routine is to handle the initialization ot
// parameters for the ISODATA dialog box.
//
// Parameters in:
//
// Parameters out: None
//
// Value Returned: None
//
// Called By: OnePassClusterDialog in SCluster.cpp
//
// Coded By: Larry L. Biehl Date: 03/25/1999
// Revised By: Larry L. Biehl Date: 12/22/2005
void OnePassClusterDialogOK (
SInt16 minClusterSize,
double criticalDistance1,
double criticalDistance2,
SInt16 clustersFrom,
SInt16 classAreaSelection,
UInt16* localClassAreaPtr,
UInt32 localNumberClassAreas,
DialogSelectArea* dialogSelectAreaPtr)
{
SInt16* classAreaPtr;
UInt32 index;
// Minimum cluster size.
gClusterSpecsPtr->minClusterSize = minClusterSize;
// Items 8; Minimum cluster size.
gClusterSpecsPtr->criticalDistance1 = criticalDistance1;
// Items 10; Minimum cluster size.
gClusterSpecsPtr->criticalDistance2 = criticalDistance2;
// Clusters from definitions.
gClusterSpecsPtr->clustersFrom = clustersFrom;
// Cluster class areas.
gClusterSpecsPtr->clusterClassSet = classAreaSelection;
if (gClusterSpecsPtr->clustersFrom == kTrainingType)
{
classAreaPtr = (SInt16*)GetHandlePointer (
gClusterSpecsPtr->clusterClassHandle);
if (classAreaSelection == kAllMenuItem) // All classes
LoadClassAreaVector (&gClusterSpecsPtr->numberClusterClasses,
classAreaPtr);
else // classAreaSelection == kSubsetMenuItem
{
gClusterSpecsPtr->numberClusterClasses = localNumberClassAreas;
for (index=0; index<localNumberClassAreas; index++)
classAreaPtr[index] = (SInt16)localClassAreaPtr[index];
} // end "else classAreaSelection == kSubsetMenuItem"
} // end "if (gClusterSpecsPtr->clustersFrom == kTrainingType)"
// Cluster selected area.
gClusterSpecsPtr->clusterLineStart = dialogSelectAreaPtr->lineStart;
gClusterSpecsPtr->clusterLineEnd = dialogSelectAreaPtr->lineEnd;
gClusterSpecsPtr->clusterLineInterval = dialogSelectAreaPtr->lineInterval;
gClusterSpecsPtr->clusterColumnStart = dialogSelectAreaPtr->columnStart;
gClusterSpecsPtr->clusterColumnEnd = dialogSelectAreaPtr->columnEnd;
gClusterSpecsPtr->clusterColumnInterval = dialogSelectAreaPtr->columnInterval;
} // end "OnePassClusterDialogOK"
//------------------------------------------------------------------------------------
// Copyright 1988-2020 Purdue Research Foundation
//
// Function name: void OnePassClusterDialogOnImageArea
//
// Software purpose: The purpose of this routine is to handle the changes in
// the dialog box due to a click in the cluster area radio
// button.
//
// Parameters in: None
//
// Parameters out: None
//
// Value Returned: None
//
// Called By: ClusterDialog in SCluster.cpp
//
// Coded By: Larry L. Biehl Date: 03/25/1999
// Revised By: Larry L. Biehl Date: 03/25/1999
void OnePassClusterDialogOnImageArea (
DialogPtr dialogPtr)
{
HideDialogItem (dialogPtr, IDC_ClassPrompt);
HideDialogItem (dialogPtr, IDC_ClassCombo);
ShowDialogItem (dialogPtr, IDC_LineStart);
ShowDialogItem (dialogPtr, IDC_LineEnd);
ShowDialogItem (dialogPtr, IDC_ColumnStart);
ShowDialogItem (dialogPtr, IDC_ColumnEnd);
#if defined multispec_mac
ShowDialogItem (dialogPtr, 14);
ShowDialogItem (dialogPtr, 15);
if (gAppearanceManagerFlag)
ShowDialogItem (dialogPtr, 26);
else // !gAppearanceManagerFlag
ShowDialogItem (dialogPtr, 25);
#endif // defined multispec_mac
} // end "OnePassClusterDialogOnImageArea"
//------------------------------------------------------------------------------------
// Copyright 1988-2020 Purdue Research Foundation
//
// Function name: void OnePassClusterDialogOnTrainingAreas
//
// Software purpose: The purpose of this routine is to handle the changes in
// the dialog box due to a click in the cluster training
// areas radio button.
//
// Parameters in: None
//
// Parameters out: None
//
// Value Returned: None
//
// Called By: ClusterDialog in SCluster.cpp
//
// Coded By: Larry L. Biehl Date: 03/25/1999
// Revised By: Larry L. Biehl Date: 03/25/1999
void OnePassClusterDialogOnTrainingAreas (
DialogPtr dialogPtr)
{
ShowDialogItem (dialogPtr, IDC_ClassPrompt);
ShowDialogItem (dialogPtr, IDC_ClassCombo);
HideDialogItem (dialogPtr, IDC_LineStart);
HideDialogItem (dialogPtr, IDC_LineEnd);
HideDialogItem (dialogPtr, IDC_ColumnStart);
HideDialogItem (dialogPtr, IDC_ColumnEnd);
#if defined multispec_mac
HideDialogItem (dialogPtr, 14);
HideDialogItem (dialogPtr, 15);
HideDialogItem (dialogPtr, 25);
HideDialogItem (dialogPtr, 26);
#endif // defined multispec_mac
#if defined multispec_win
HideDialogItem (dialogPtr, IDEntireImage);
HideDialogItem (dialogPtr, IDSelectedImage);
#endif // defined multispec_win
} // end "OnePassClusterDialogOnTrainingAreas"
| 30.841584 | 86 | 0.604066 | [
"vector"
] |
7e1e1142948d4a72cc450224590e32d248befdcc | 1,554 | cpp | C++ | tests/OxSignCalculator_NoneTest.cpp | MRKonrad/OxShmolli2 | abe020f4aa08c1037f04fe80e68f0651d03cccd1 | [
"MIT"
] | 7 | 2018-12-10T10:11:03.000Z | 2021-03-11T14:40:40.000Z | tests/OxSignCalculator_NoneTest.cpp | MRKonrad/OxShmolli2 | abe020f4aa08c1037f04fe80e68f0651d03cccd1 | [
"MIT"
] | 10 | 2019-03-10T11:42:55.000Z | 2021-12-10T15:39:41.000Z | tests/OxSignCalculator_NoneTest.cpp | MRKonrad/OxShmolli2 | abe020f4aa08c1037f04fe80e68f0651d03cccd1 | [
"MIT"
] | 3 | 2019-12-04T14:05:54.000Z | 2022-02-26T00:24:38.000Z | /*!
* \file OxSignCalculatorNone_test.cpp
* \author Konrad Werys
* \date 2019/11/13
*/
#include "CmakeConfigForTomato.h"
#include "gtest/gtest.h"
#ifdef USE_YAML
#include "OxTestData.h"
#include "CmakeConfigForTomato.h"
#include "OxModelT1ThreeParam.h"
#include "OxFitterLevenbergMarquardtVnl.h"
#include "OxStartPointCalculatorBasic.h"
#include "OxCalculatorT1WithSignCheck.h"
#ifdef USE_VNL
TEST(OxSignCalculator, None) {
typedef double TYPE;
char filePath [] = "testData/T1_blood.yaml";
Ox::TestData<TYPE> testData(filePath);
int nSamples = testData.getNSamples();
// init the necessary objects
Ox::ModelT1ThreeParam<TYPE> model;
Ox::FitterLevenbergMarquardtVnl<TYPE> fitter;
Ox::StartPointCalculatorBasic<TYPE> startPointCalculator;
Ox::CalculatorT1WithSignCheck<TYPE> calculatorT1Molli;
// configure
calculatorT1Molli.setModel(&model);
calculatorT1Molli.setFitter(&fitter);
calculatorT1Molli.setStartPointCalculator(&startPointCalculator);
// set the data
calculatorT1Molli.setNSamples(nSamples);
calculatorT1Molli.setInvTimes(testData.getInvTimesPtr());
calculatorT1Molli.setSigMag(testData.getSignalPtr());
calculatorT1Molli.calculate();
EXPECT_NEAR(calculatorT1Molli.getResults()["A"], testData.getResultsMolli()[0], 1e-2);
EXPECT_NEAR(calculatorT1Molli.getResults()["B"], testData.getResultsMolli()[1], 1e-2);
EXPECT_NEAR(calculatorT1Molli.getResults()["T1star"], testData.getResultsMolli()[2], 1e-2);
}
#endif // USE_VNL
#endif // USE_YAML
| 27.263158 | 95 | 0.747104 | [
"model"
] |
7e21c87c0172595ec730c0a5184723b114f58804 | 1,485 | cpp | C++ | STL/Functional/ArithmeticOperators.cpp | emilianocanedo/CppExamples | 8de7fa61f0327a6f0ed6a0ee1663235e55277cca | [
"MIT"
] | 1 | 2020-07-05T00:55:31.000Z | 2020-07-05T00:55:31.000Z | STL/Functional/ArithmeticOperators.cpp | NibiruCpp/CppCert | 8de7fa61f0327a6f0ed6a0ee1663235e55277cca | [
"MIT"
] | null | null | null | STL/Functional/ArithmeticOperators.cpp | NibiruCpp/CppCert | 8de7fa61f0327a6f0ed6a0ee1663235e55277cca | [
"MIT"
] | null | null | null | #include <iostream>
#include <list>
#include <algorithm>
#include <iterator>
#include <functional>
using namespace std;
template <class T>
void print(T start, T end)
{
for (;start != end; ++start) {
cout << *start << " ";
}
}
int main()
{
int t1[] = {1, 2, 3, 4, 5};
list<int> l1(t1, t1+5);
list<int> l2(l1.begin(), l1.end());
list<int> l3(l1.size());
cout << "Source collections:" << endl;
cout << "l1: ";
print(l1.begin(), l1.end());
cout << endl;
cout << "l2: ";
print(l2.begin(), l2.end());
cout << endl;
transform(l1.begin(), l1.end(), l2.begin(), l3.begin(), plus<int>());
cout << "l1+l2: ";
print(l3.begin(), l3.end());
cout << endl;
transform(l1.begin(), l1.end(), l2.begin(), l3.begin(), minus<int>());
cout << "l1-l2: ";
print(l3.begin(), l3.end());
cout << endl;
transform(l1.begin(), l1.end(), l2.begin(), l3.begin(), multiplies<int>());
cout << "l1*l2: ";
print(l3.begin(), l3.end());
cout << endl;
transform(l1.begin(), l1.end(), l2.begin(), l3.begin(), modulus<int>());
cout << "l1%l2: ";
print(l3.begin(), l3.end());
cout << endl;
transform(l1.begin(), l1.end(), l2.begin(), l3.begin(), divides<int>());
cout << "l1/l2: ";
print(l3.begin(), l3.end());
cout << endl;
transform(l3.begin(), l3.end(), l3.begin(), negate<int>());
cout << "!l3: ";
print(l3.begin(), l3.end());
cout << endl;
return 0;
}
| 23.203125 | 79 | 0.515825 | [
"transform"
] |
cce02e79eb55d104e3edb0b78248992976eb427e | 14,599 | cpp | C++ | src/hera.cpp | xueying4402/hera | 30d0354918e7265833ab78de33caafb4adbb27ea | [
"Apache-2.0"
] | 4 | 2018-09-22T19:09:18.000Z | 2019-08-04T04:34:32.000Z | src/hera.cpp | xueying4402/hera | 30d0354918e7265833ab78de33caafb4adbb27ea | [
"Apache-2.0"
] | null | null | null | src/hera.cpp | xueying4402/hera | 30d0354918e7265833ab78de33caafb4adbb27ea | [
"Apache-2.0"
] | 2 | 2021-12-27T08:46:22.000Z | 2022-02-14T05:27:01.000Z | /*
* Copyright 2016-2018 Alex Beregszaszi et al.
*
* 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 <hera/hera.h>
#include <vector>
#include <stdexcept>
#include <cstdlib>
#include <unistd.h>
#include <string.h>
#include <fstream>
#include <evmc/evmc.h>
#include <evm2wasm.h>
#include "binaryen.h"
#include "debugging.h"
#include "eei.h"
#include "exceptions.h"
#include <hera/buildinfo.h>
using namespace std;
using namespace hera;
enum class hera_wasm_engine {
binaryen,
wavm,
wabt
};
enum class hera_evm_mode {
reject,
fallback,
evm2wasm_contract,
evm2wasm_cpp,
evm2wasm_cpp_tracing,
evm2wasm_js,
evm2wasm_js_tracing
};
struct hera_instance : evmc_instance {
hera_wasm_engine wasm_engine = hera_wasm_engine::binaryen;
hera_evm_mode evm_mode = hera_evm_mode::reject;
bool metering = false;
hera_instance() noexcept : evmc_instance({EVMC_ABI_VERSION, "hera", hera_get_buildinfo()->project_version, nullptr, nullptr, nullptr, nullptr}) {}
};
namespace {
const evmc_address sentinelAddress = { .bytes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xa } };
const evmc_address evm2wasmAddress = { .bytes = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xb } };
bool hasWasmPreamble(vector<uint8_t> const& _input) {
return
_input.size() >= 8 &&
_input[0] == 0 &&
_input[1] == 'a' &&
_input[2] == 's' &&
_input[3] == 'm' &&
_input[4] == 1 &&
_input[5] == 0 &&
_input[6] == 0 &&
_input[7] == 0;
}
// Calls a system contract at @address with input data @input.
// It is a "staticcall" with sender 000...000 and no value.
// @returns output data from the contract and update the @gas variable with the gas left.
vector<uint8_t> callSystemContract(
evmc_context* context,
evmc_address const& address,
int64_t & gas,
vector<uint8_t> const& input
) {
evmc_message message = {
.destination = address,
.sender = {},
.value = {},
.input_data = input.data(),
.input_size = input.size(),
.code_hash = {},
.create2_salt = {},
.gas = gas,
.depth = 0,
.kind = EVMC_CALL,
.flags = EVMC_STATIC
};
evmc_result result;
context->fn_table->call(&result, context, &message);
vector<uint8_t> ret;
if (result.status_code == EVMC_SUCCESS && result.output_data)
ret.assign(result.output_data, result.output_data + result.output_size);
gas = result.gas_left;
if (result.release)
result.release(&result);
return ret;
}
// Calls the Sentinel contract with input data @input.
// @returns the validated and metered output or empty output otherwise.
vector<uint8_t> sentinel(evmc_context* context, vector<uint8_t> const& input)
{
#if HERA_DEBUGGING
HERA_DEBUG << "Metering (input " << input.size() << " bytes)..." << endl;
#endif
int64_t startgas = numeric_limits<int64_t>::max(); // do not charge for metering yet (give unlimited gas)
int64_t gas = startgas;
vector<uint8_t> ret = callSystemContract(
context,
sentinelAddress,
gas,
input
);
#if HERA_DEBUGGING
HERA_DEBUG << "Metering done (output " << ret.size() << " bytes, used " << (startgas - gas) << " gas)" << endl;
#endif
return ret;
}
// NOTE: assumes that pattern doesn't contain any formatting characters (e.g. %)
string mktemp_string(string pattern) {
const unsigned long len = pattern.size();
char tmp[len + 1];
strcpy(tmp, pattern.data());
if (!mktemp(tmp) || (tmp[0] == 0))
return string();
return string(tmp, strlen(tmp));
}
// Calls evm2wasm (as a Javascript CLI) with input data @input.
// @returns the compiled output or empty output otherwise.
vector<uint8_t> evm2wasm_js(vector<uint8_t> const& input, bool evmTrace) {
#if HERA_DEBUGGING
HERA_DEBUG << "Calling evm2wasm.js (input " << input.size() << " bytes)..." << endl;
#endif
string fileEVM = mktemp_string("/tmp/hera.evm2wasm.evm.XXXXXX");
string fileWASM = mktemp_string("/tmp/hera.evm2wasm.wasm.XXXXXX");
if (fileEVM.size() == 0 || fileWASM.size() == 0)
return vector<uint8_t>();
ofstream os;
os.open(fileEVM);
// print as a hex sting
os << hex;
for (uint8_t byte: input)
os << setfill('0') << setw(2) << static_cast<int>(byte);
os.close();
string cmd = string("evm2wasm.js ") + "-e " + fileEVM + " -o " + fileWASM + " --charge-per-op";
if (evmTrace)
cmd += " --trace";
#if HERA_DEBUGGING
HERA_DEBUG << "(Calling evm2wasm.js with command: " << cmd << ")" << endl;
#endif
int ret = system(cmd.data());
unlink(fileEVM.data());
if (ret != 0) {
#if HERA_DEBUGGING
HERA_DEBUG << "evm2wasm.js failed" << endl;
#endif
unlink(fileWASM.data());
return vector<uint8_t>();
}
ifstream is(fileWASM);
string str((istreambuf_iterator<char>(is)),
istreambuf_iterator<char>());
unlink(fileWASM.data());
#if HERA_DEBUGGING
HERA_DEBUG << "evm2wasm.js done (output " << str.length() << " bytes)" << endl;
#endif
return vector<uint8_t>(str.begin(), str.end());
}
// Calls evm2wasm (through the built-in C++ interface) with input data @input.
// @returns the compiled output or empty output otherwise.
vector<uint8_t> evm2wasm_cpp(vector<uint8_t> const& input, bool evmTrace) {
#if HERA_DEBUGGING
HERA_DEBUG << "Calling evm2wasm.cpp (input " << input.size() << " bytes)..." << endl;
#endif
string str = evm2wasm::evm2wasm(input, evmTrace);
#if HERA_DEBUGGING
HERA_DEBUG << "evm2wasm.cpp done (output " << str.length() << " bytes)" << endl;
#endif
return vector<uint8_t>(str.begin(), str.end());
}
// Calls the evm2wasm contract with input data @input.
// @returns the compiled output or empty output otherwise.
vector<uint8_t> evm2wasm(evmc_context* context, vector<uint8_t> const& input) {
#if HERA_DEBUGGING
HERA_DEBUG << "Calling evm2wasm (input " << input.size() << " bytes)..." << endl;
#endif
int64_t startgas = numeric_limits<int64_t>::max(); // do not charge for metering yet (give unlimited gas)
int64_t gas = startgas;
vector<uint8_t> ret = callSystemContract(
context,
evm2wasmAddress,
gas,
input
);
#if HERA_DEBUGGING
HERA_DEBUG << "evm2wasm done (output " << ret.size() << " bytes, used " << (startgas - gas) << " gas)" << endl;
#endif
return ret;
}
void hera_destroy_result(evmc_result const* result) noexcept
{
delete[] result->output_data;
}
evmc_result hera_execute(
evmc_instance *instance,
evmc_context *context,
enum evmc_revision rev,
const evmc_message *msg,
const uint8_t *code,
size_t code_size
) noexcept {
hera_instance* hera = static_cast<hera_instance*>(instance);
HERA_DEBUG << "Executing message in Hera\n";
evmc_result ret;
memset(&ret, 0, sizeof(evmc_result));
try {
heraAssert(rev == EVMC_BYZANTIUM, "Only Byzantium supported.");
heraAssert(msg->gas >= 0, "EVMC supplied negative startgas");
bool meterInterfaceGas = true;
// the bytecode residing in the state - this will be used by interface methods (i.e. codecopy)
vector<uint8_t> state_code(code, code + code_size);
// the actual executable code - this can be modified (metered or evm2wasm compiled)
vector<uint8_t> run_code(code, code + code_size);
// ensure we can only handle WebAssembly version 1
if (!hasWasmPreamble(run_code)) {
switch (hera->evm_mode) {
case hera_evm_mode::evm2wasm_contract:
run_code = evm2wasm(context, run_code);
ensureCondition(run_code.size() > 5, ContractValidationFailure, "Transcompiling via evm2wasm failed");
// TODO: enable this once evm2wasm does metering of interfaces
// meterInterfaceGas = false;
break;
case hera_evm_mode::evm2wasm_cpp:
case hera_evm_mode::evm2wasm_cpp_tracing:
run_code = evm2wasm_cpp(run_code, hera->evm_mode == hera_evm_mode::evm2wasm_cpp_tracing);
ensureCondition(run_code.size() > 5, ContractValidationFailure, "Transcompiling via evm2wasm.cpp failed");
// TODO: enable this once evm2wasm does metering of interfaces
// meterInterfaceGas = false;
break;
case hera_evm_mode::evm2wasm_js:
case hera_evm_mode::evm2wasm_js_tracing:
run_code = evm2wasm_js(run_code, hera->evm_mode == hera_evm_mode::evm2wasm_js_tracing);
ensureCondition(run_code.size() > 5, ContractValidationFailure, "Transcompiling via evm2wasm.js failed");
// TODO: enable this once evm2wasm does metering of interfaces
// meterInterfaceGas = false;
break;
case hera_evm_mode::fallback:
HERA_DEBUG << "Non-WebAssembly input, but fallback mode enabled, asking client to deal with it.\n";
ret.status_code = EVMC_REJECTED;
return ret;
case hera_evm_mode::reject:
HERA_DEBUG << "Non-WebAssembly input, failure.n\n";
ret.status_code = EVMC_FAILURE;
return ret;
default:
heraAssert(false, "");
}
} else if (msg->kind == EVMC_CREATE) {
// Meter the deployment (constructor) code if it is WebAssembly
if (hera->metering)
run_code = sentinel(context, run_code);
ensureCondition(run_code.size() > 5, ContractValidationFailure, "Invalid contract or metering failed.");
}
heraAssert(hera->wasm_engine == hera_wasm_engine::binaryen, "Unsupported wasm engine.");
BinaryenEngine engine = BinaryenEngine{};
ExecutionResult result = engine.execute(context, run_code, state_code, *msg, meterInterfaceGas);
heraAssert(result.gasLeft >= 0, "Negative gas left after execution.");
// copy call result
if (result.returnValue.size() > 0) {
vector<uint8_t> returnValue;
if (msg->kind == EVMC_CREATE && !result.isRevert && hasWasmPreamble(result.returnValue)) {
// Meter the deployed code if it is WebAssembly
returnValue = hera->metering ? sentinel(context, result.returnValue) : move(result.returnValue);
ensureCondition(returnValue.size() > 5, ContractValidationFailure, "Invalid contract or metering failed.");
} else {
returnValue = move(result.returnValue);
}
uint8_t* output_data = new uint8_t[returnValue.size()];
copy(returnValue.begin(), returnValue.end(), output_data);
ret.output_size = returnValue.size();
ret.output_data = output_data;
ret.release = hera_destroy_result;
}
ret.status_code = result.isRevert ? EVMC_REVERT : EVMC_SUCCESS;
ret.gas_left = result.gasLeft;
} catch (EndExecution const&) {
ret.status_code = EVMC_INTERNAL_ERROR;
#if HERA_DEBUGGING
HERA_DEBUG << "EndExecution exception has leaked through." << endl;
#endif
} catch (VMTrap const& e) {
// TODO: use specific error code? EVMC_INVALID_INSTRUCTION or EVMC_TRAP_INSTRUCTION?
ret.status_code = EVMC_FAILURE;
#if HERA_DEBUGGING
HERA_DEBUG << e.what() << endl;
#endif
} catch (ArgumentOutOfRange const& e) {
// TODO: use specific error code? EVMC_ARGUMENT_OUT_OF_RANGE?
ret.status_code = EVMC_FAILURE;
#if HERA_DEBUGGING
HERA_DEBUG << e.what() << endl;
#endif
} catch (OutOfGas const& e) {
ret.status_code = EVMC_OUT_OF_GAS;
#if HERA_DEBUGGING
HERA_DEBUG << e.what() << endl;
#endif
} catch (ContractValidationFailure const& e) {
ret.status_code = EVMC_CONTRACT_VALIDATION_FAILURE;
#if HERA_DEBUGGING
HERA_DEBUG << e.what() << endl;
#endif
} catch (InvalidMemoryAccess const& e) {
ret.status_code = EVMC_INVALID_MEMORY_ACCESS;
#if HERA_DEBUGGING
HERA_DEBUG << e.what() << endl;
#endif
} catch (StaticModeViolation const& e) {
ret.status_code = EVMC_STATIC_MODE_VIOLATION;
#if HERA_DEBUGGING
HERA_DEBUG << e.what() << endl;
#endif
} catch (InternalErrorException const& e) {
ret.status_code = EVMC_INTERNAL_ERROR;
#if HERA_DEBUGGING
HERA_DEBUG << "InternalError: " << e.what() << endl;
#endif
} catch (exception const& e) {
ret.status_code = EVMC_INTERNAL_ERROR;
#if HERA_DEBUGGING
HERA_DEBUG << "Unknown exception: " << e.what() << endl;
#endif
} catch (...) {
ret.status_code = EVMC_INTERNAL_ERROR;
#if HERA_DEBUGGING
HERA_DEBUG << "Totally unknown exception" << endl;
#endif
}
return ret;
}
int hera_set_option(
evmc_instance *instance,
char const *name,
char const *value
) noexcept {
hera_instance* hera = static_cast<hera_instance*>(instance);
if (strcmp(name, "fallback") == 0) {
if (strcmp(value, "true") == 0)
hera->evm_mode = hera_evm_mode::fallback;
return 1;
}
if (strcmp(name, "evm2wasm") == 0) {
if (strcmp(value, "true") == 0)
hera->evm_mode = hera_evm_mode::evm2wasm_contract;
return 1;
}
if (strcmp(name, "evm2wasm.cpp") == 0) {
if (strcmp(value, "true") == 0)
hera->evm_mode = hera_evm_mode::evm2wasm_cpp;
return 1;
}
if (strcmp(name, "evm2wasm.cpp-trace") == 0) {
if (strcmp(value, "true") == 0)
hera->evm_mode = hera_evm_mode::evm2wasm_cpp_tracing;
return 1;
}
if (strcmp(name, "evm2wasm.js") == 0) {
if (strcmp(value, "true") == 0)
hera->evm_mode = hera_evm_mode::evm2wasm_js;
return 1;
}
if (strcmp(name, "evm2wasm.js-trace") == 0) {
if (strcmp(value, "true") == 0)
hera->evm_mode = hera_evm_mode::evm2wasm_js_tracing;
return 1;
}
if (strcmp(name, "metering") == 0) {
hera->metering = strcmp(value, "true") == 0;
return 1;
}
if (strcmp(name, "engine") == 0) {
if (strcmp(value, "binaryen") == 0)
hera->wasm_engine = hera_wasm_engine::binaryen;
#if HAVE_WABT
if (strcmp(value, "wabt") == 0)
hera->wasm_engine = hera_wasm_engine::wabt;
#endif
#if HAVE_WAVM
if (strcmp(value, "wavm") == 0)
hera->wasm_engine = hera_wasm_engine::wavm;
#endif
return 1;
}
return 0;
}
void hera_destroy(evmc_instance* instance) noexcept
{
hera_instance* hera = static_cast<hera_instance*>(instance);
delete hera;
}
} // anonymous namespace
extern "C" {
evmc_instance* evmc_create_hera() noexcept
{
hera_instance* instance = new hera_instance;
instance->destroy = hera_destroy;
instance->execute = hera_execute;
instance->set_option = hera_set_option;
return instance;
}
}
| 29.915984 | 148 | 0.672375 | [
"vector"
] |
cceace17d1b315723481bb94a30ef8c94c4d6e7f | 46,012 | cpp | C++ | src/AddOns/Data Structures/Dico.cpp | clasqm/Squirrel99 | 09fb4cf9c26433b5bc1915dee1b31178222d9e81 | [
"MIT"
] | 2 | 2019-01-26T14:35:33.000Z | 2020-03-31T10:39:39.000Z | src/AddOns/Data Structures/Dico.cpp | clasqm/Squirrel99 | 09fb4cf9c26433b5bc1915dee1b31178222d9e81 | [
"MIT"
] | 1 | 2018-12-12T17:04:17.000Z | 2018-12-12T17:04:17.000Z | src/AddOns/Data Structures/Dico.cpp | clasqm/Squirrel99 | 09fb4cf9c26433b5bc1915dee1b31178222d9e81 | [
"MIT"
] | 1 | 2020-10-26T08:56:12.000Z | 2020-10-26T08:56:12.000Z | /*
* Squirrel project
*
* file ? Dico.cpp
* what ? Dico object
* who ? jlv
* when ? 11/08/99
* last ? 03/21/00
*
*
* (c) Kirilla 1999-2001
*/
#include "SQI-AddOn.h"
#include "Dico.h"
#include <algorithm>
//DicoMemberDico DicoObjectMember;
MethodTable *DicoMethods = NULL; // methods hash table
/*
* function : DicoObject
* purpose : Constructor
* input : none
* output : none
* side effect : none
*/
DicoObject::DicoObject(SQI_Squirrel *squirrel)
:SQI_ThePointer(squirrel,SQI_DICO)
{
SetClass(CLASS_DSTRUCTURE);
Dico = new map<string,SQI_Object *,less<string> >;
if(!DicoMethods)
InitDicoObject();
//Members = &DicoObjectMember;
Methods = DicoMethods;
}
/*
* function : DicoObject
* purpose : Constructor
* input : none
* output : none
* side effect : none
*/
DicoObject::DicoObject(SQI_Heap *target)
:SQI_ThePointer(target,SQI_DICO)
{
SetClass(CLASS_DSTRUCTURE);
Dico = new map<string,SQI_Object *,less<string> >;
//Members = &DicoObjectMember;
if(!DicoMethods)
InitDicoObject();
Methods = DicoMethods;
}
/*
* function : DicoObject
* purpose : Destructor
* input : none
* output : none
* side effect : none
*/
DicoObject::~DicoObject()
{
delete Dico;
}
/*
* function : Export
* purpose : The object is aked to export himself to another heap
* input :
*
* SQI_Heap *nheap, the target heap
* char force, force the export even if the object is eternal
*
*
* output : bool, true if the object had commit suicide
* side effect : the object may be deleted
*/
void DicoObject::Export(SQI_Heap *nheap,char force = SQI_ETERNAL)
{
if(status || force)
{
//Locker.Lock();
nheap->Import(this);
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
(i->second)->Export(nheap,force);
//Locker.Unlock();
}
}
/*
* function : Member
* purpose : Execute a member method on the object
* input : none
*
* string *member, method name
* deque<SQI_Object *> *inputs, arguments
*
* output : SQI_Object *, the object created
* side effect : none
*/
SQI_Object *DicoObject::Member(string *member,SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(Methods)
{
OMeth MemberHook = NULL;
MemberHook = Methods->Seek(member->c_str());
if(MemberHook)
return (this->*MemberHook)(squirrel,inputs);
else
throw(new SQI_Exception(SQI_EX_INVALIDE,"DICO~","unknow member"));
}
else
throw(new SQI_Exception(SQI_EX_INVALIDE,"DICO~","unsupported by the object"));
/*
if(Members)
{
SQI_Object *(DicoObject::*MemberHook)(SQI_Squirrel *squirrel,SQI_Args *inputs);
MemberHook = (*Members)[*member];
if(MemberHook)
return (this->*MemberHook)(squirrel,inputs);
else
{
Members->erase(*member);
throw(new SQI_Exception(SQI_EX_INVALIDE,"member call","unknow member"));
}
}
else
throw(new SQI_Exception(SQI_EX_INVALIDE,"member call","unsupported by the object"));
*/
}
/*
* function : Set
* purpose : Set a value
* input :
*
* long index, index of the value
* SQI_Oject *value, value to store
*
* output : none
* side effect : none
*/
SQI_Object *DicoObject::Set(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
SQI_Object *old=NULL;
if(inputs->Length()==2)
{
SQI_Object *index = (*inputs)[0];
SQI_Object *value = (*inputs)[1];
//Locker.Lock();
string *key = index->Print();
old = (*Dico)[*key];
if(old)
{
old->Alone();
old->RemRef();
}
(*Dico)[*key] = value;
value->AddRef(); // we add a reference
value->Contained(); // the object is contained
if(value->heap!=heap)
value->Export(heap);
//Locker.Unlock();
delete key;
return NULL;
}
else
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~set","need two arguments"));
}
/*
* function : Get
* purpose : Get a value
* input :
*
* SQI_Squirrel *squirrel, squirrel
* long index, index of the value
*
* output : none
* side effect : none
*/
SQI_Object *DicoObject::Get(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(inputs->Length()==1)
{
SQI_Object *index = (*inputs)[0];
SQI_Object *value = NULL;
string *key = index->Print();
//Locker.Lock();
value = (*Dico)[*key];
//Locker.Unlock();
if(value)
{
delete key;
return value;
}
else
{
Dico->erase(*key);
throw(new SQI_Exception(SQI_EX_OUTOFRANGE,key->c_str()));
}
}
else
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~get","need one argument"));
}
/*
* function : Erase
* purpose : Erase the value as an specified index
* input :
*
* SQI_Squirrel *squirrel, squirrel
* long index, index of the value
*
* output : none
* side effect : none
*/
SQI_Object *DicoObject::Erase(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(inputs->Length()==1)
{
string *key = (*inputs)[0]->Print();
SQI_Object *value = NULL;
ObjDico::const_iterator i;
//Locker.Lock();
value = (*Dico)[*key];
if(value)
{
value->Alone();
value->RemRef();
Dico->erase(*key);
}
else
{
Dico->erase(*key);
throw(new SQI_Exception(SQI_EX_OUTOFRANGE,key->c_str()));
}
//Locker.Unlock();
delete key;
return NULL;
}
else
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~erase","need one argument"));
}
/*
* function : Empty
* purpose : Empty the dico
* input :
*
* SQI_Squirrel *squirrel, squirrel
* long index, index of the value
*
* output : none
* side effect : none
*/
SQI_Object *DicoObject::Empty(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
EmptyIt();
return NULL;
}
/*
* function : Keys
* purpose : Return a list of all the keys in the Dicotionary
* input :
*
* SQI_Squirrel *squirrel, squirrel
* long index, index of the value
*
* output : none
* side effect : none
*/
SQI_Object *DicoObject::Keys(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
ObjDico::const_iterator i;
SQI_List *keys = new SQI_List(squirrel->LocalHeap);
//Locker.Lock();
for(i=Dico->begin();i!=Dico->end();i++)
keys->Add2End(new SQI_String(squirrel->LocalHeap,i->first));
//Locker.Unlock();
return keys;
}
/*
* function : Empty
* purpose : Erase all the value
* input : none
* output : none
* side effect : none
*/
void DicoObject::EmptyIt()
{
ObjDico::iterator i;
//Locker.Lock();
if(Dico->size()!=0)
{
for(i=Dico->begin();i!=Dico->end();i++)
{
(i->second)->Alone();
(i->second)->RemRef();
}
Dico->clear();
}
//Locker.Unlock();
}
/*
* function : Min
* purpose : Return the minimum value in the array
* input : none
* output : SQI_Object *, the min
* side effect : none
*/
SQI_Object *DicoObject::Min(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
SQI_Object *min = NULL;
ObjDico::iterator i;
if(Dico->size())
{
//Locker.Lock();
i=Dico->begin();
min = i->second;
for(i++;i!=Dico->end();i++)
if(*min > i->second)
min = i->second;
//Locker.Unlock();
}
if(!min)
min = new SQI_Number(squirrel->LocalHeap,0);
return min;
}
/*
* function : Max
* purpose : Return the maximum value in the array
* input : none
* output : SQI_Object *, the max
* side effect : none
*/
SQI_Object *DicoObject::Max(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
SQI_Object *max = NULL;
ObjDico::iterator i;
if(Dico->size())
{
//Locker.Lock();
i=Dico->begin();
max = i->second;
for(i++;i!=Dico->end();i++)
if(*max < i->second)
max = i->second;
//Locker.Unlock();
}
if(!max)
max = new SQI_Number(squirrel->LocalHeap,0);
return max;
}
/*
* function : Avg
* purpose : Return the average value in the array
* input : none
* output : SQI_Object *, the max
* side effect : none
*/
SQI_Object *DicoObject::Avg(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
SQI_Object *avg = new SQI_Number(squirrel->LocalHeap,0);
ObjDico::iterator i;
//Locker.Lock();
for(i=Dico->begin();i!=Dico->end();i++)
*avg += i->second;
//Locker.Unlock();
*avg /= (long)Dico->size();
return avg;
}
/*
* function : Exist
* purpose : Check if a key exist in the dictionary
* input :
*
* SQI_Squirrel *squirrel, squirrel executing
* SQI_Args *inputs, inputs of the methods
*
* output : SQI_Object *, an array wich contain the result of the function on all the element of the array
* side effect : none
*/
SQI_Object *DicoObject::Exist(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(inputs->Length()==1)
{
SQI_Object *index = (*inputs)[0];
SQI_Object *value = NULL;
string *key = index->Print();
value = (*Dico)[*key];
if(value)
{
delete key;
return squirrel->interpreter->True;
}
else
{
Dico->erase(*key);
return squirrel->interpreter->False;
}
}
else
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~exists","need one argument"));
}
/*
* function : Size
* purpose : Return the number of element in the vector
* input :
*
* SQI_Squirrel *squirrel, squirrel executing
*
* output : SQI_Object *, the size
* side effect : none
*/
SQI_Object *DicoObject::Size(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
return new SQI_Number(squirrel->LocalHeap,(long)Dico->size());
}
/*
* function : IterateWithIndex
* purpose : Execute a function on all the element of the array (give the index in the array as first inputs
* of the function
* input :
*
* SQI_Squirrel *squirrel, squirrel executing
* SQI_Args *inputs, inputs of the methods
*
* output : SQI_Object *, an array wich contain the result of the function on all the element of the array
* side effect : none
*/
SQI_Object *DicoObject::IterateWithIndex(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(inputs->Length()<1)
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~iterate.i","need at least one argument"));
else
{
SQI_Keyword *name = IsKeyword((*inputs)[0]);
if(name)
{
SQI_Object *obj;
SQI_Object *ret = NULL;
SQI_Node *call = NULL;
SQI_Object *empty = new SQI_Number(squirrel->LocalHeap,0);
DicoObject *rarray = new DicoObject(squirrel);
list<SQI_Object *> *args = new list<SQI_Object *>;
rarray->AddRef();
empty->AddRef();
// we put all the other inputs in the inputs list now
for(int i=1;i<inputs->Length();i++)
{
obj = (*inputs)[i];
obj->AddRef();
args->push_back(obj);
}
call = dynamic_cast<SQI_Node *>(squirrel->interpreter->FindCall(name->Data()->c_str()));
squirrel->LocalHeap->Import(call);
call->AddRef();
call->SetArgs(args);
try
{
if(Dico->size())
{
ObjDico::iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
// each iteration, we change the 2 first elements of args
obj = new SQI_String(squirrel->LocalHeap,i->first);
obj->AddRef();
args->push_front(i->second);
args->push_front(obj);
ret = squirrel->HopOnLeave(squirrel->interpreter,call);
if(ret)
{
(*(rarray->Dico))[i->first] = ret;
ret->AddRef();
ret->Contained();
}
args->pop_front();
args->pop_front();
obj->RemRef();
}
}
} catch (SQI_Exception *ex) {
call->SetArgs(NULL);
call->RemRef();
empty->RemRef();
rarray->REF--;
throw(ex);
}
call->SetArgs(NULL);
call->RemRef();
empty->RemRef();
rarray->REF--;
return rarray;
}
else
throw(new SQI_Exception(SQI_EX_BADARGTYPE,"DICTIONARY~iterate.i","first input must be a word"));
}
}
/*
* function : Iterate
* purpose : Execute a function on all the element of the array
* input :
*
* SQI_Squirrel *squirrel, squirrel executing
* SQI_Args *inputs, inputs of the methods
*
* output : SQI_Object *, an array wich contain the result of the function on all the element of the array
* side effect : none
*/
SQI_Object *DicoObject::Iterate(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(inputs->Length()<1)
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~iterate","need at least one argument"));
else
{
SQI_Keyword *name = IsKeyword((*inputs)[0]);
if(name)
{
SQI_Object *obj;
SQI_Object *ret = NULL;
SQI_Node *call = NULL;
SQI_Object *empty = new SQI_Number(squirrel->LocalHeap,0);
DicoObject *rarray = new DicoObject(squirrel);
list<SQI_Object *> *args = new list<SQI_Object *>;
rarray->AddRef();
empty->AddRef();
// we put all the other inputs in the inputs list now
for(int i=1;i<inputs->Length();i++)
{
obj = (*inputs)[i];
obj->AddRef();
args->push_back(obj);
}
call = dynamic_cast<SQI_Node *>(squirrel->interpreter->FindCall(name->Data()->c_str()));
squirrel->LocalHeap->Import(call);
call->AddRef();
call->SetArgs(args);
try
{
if(Dico->size())
{
ObjDico::iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
// each iteration, we change the 2 first elements of args
args->push_front(i->second);
ret = squirrel->HopOnLeave(squirrel->interpreter,call);
if(ret)
{
(*(rarray->Dico))[i->first] = ret;
ret->AddRef();
ret->Contained();
}
args->pop_front();
}
}
} catch (SQI_Exception *ex) {
call->SetArgs(NULL);
call->RemRef();
empty->RemRef();
rarray->REF--;
throw(ex);
}
call->SetArgs(NULL);
call->RemRef();
empty->RemRef();
rarray->REF--;
return rarray;
}
else
throw(new SQI_Exception(SQI_EX_BADARGTYPE,"DICTIONARY~iterate","first input must be a word"));
}
}
/*
* function : Find
* purpose : Find an element in the vector
* input :
*
* SQI_Squirrel *squirrel, squirrel executing
* SQI_Args *inputs, inputs of the methods
*
* output : SQI_Object *, an array wich contain the result of the function on all the element of the array
* side effect : none
*/
SQI_Object *DicoObject::Find(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(inputs->Length()!=1)
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~find","need one argument"));
else
{
SQI_Object *obj = (*inputs)[0];
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
if(*(i->second) == obj)
break;
}
if(i==Dico->end())
return squirrel->interpreter->False;
else
return new SQI_String(squirrel->LocalHeap,i->first);
}
}
/*
* function : FindAll
* purpose : Find all the occurence of an element in the vector
* input :
*
* SQI_Squirrel *squirrel, squirrel executing
* SQI_Args *inputs, inputs of the methods
*
* output : SQI_Object *, an array wich contain the result of the function on all the element of the array
* side effect : none
*/
SQI_Object *DicoObject::FindAll(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(inputs->Length()!=1)
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~find.all","need one argument"));
else
{
SQI_Object *obj = (*inputs)[0];
ObjDico::const_iterator i;
SQI_List *oc = new SQI_List(squirrel->LocalHeap);
oc->AddRef();
for(i=Dico->begin();i!=Dico->end();i++)
if(*(i->second)==obj)
oc->Add2End(new SQI_String(squirrel->LocalHeap,i->first));
oc->REF--;
return oc;
}
}
/*
* function : FindLast
* purpose : Find the last occurence of an element in the vector
* input :
*
* SQI_Squirrel *squirrel, squirrel executing
* SQI_Args *inputs, inputs of the methods
*
* output : SQI_Object *, an array wich contain the result of the function on all the element of the array
* side effect : none
*/
SQI_Object *DicoObject::FindLast(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(inputs->Length()!=1)
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~find.last","need one argument"));
else
{
SQI_Object *obj = (*inputs)[0];
ObjDico::const_iterator i=Dico->end();
long j=Dico->size();
if(!j)
return squirrel->interpreter->False;
for(i--;i!=Dico->begin();i--,j--)
if(*(i->second)==obj)
break;
if(!j)
return squirrel->interpreter->False;
else
return new SQI_String(squirrel->LocalHeap,i->first);
}
}
/*
* function : FindIf
* purpose : Find an element in the vector by executing a function
* input :
*
* SQI_Squirrel *squirrel, squirrel executing
* SQI_Args *inputs, inputs of the methods
*
* output : SQI_Object *, an array wich contain the result of the function on all the element of the array
* side effect : none
*/
SQI_Object *DicoObject::FindIf(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(inputs->Length()<1)
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~find.if","need at least 1 arguments"));
else
{
SQI_Keyword *name = IsKeyword((*inputs)[0]);
if(name)
{
ObjDico::const_iterator i;
SQI_Object *ret,*obj;
SQI_Node *call = NULL;
list<SQI_Object *> *args = new list<SQI_Object *>;
// we put all the other inputs in the inputs list now
for(int i=1;i<inputs->Length();i++)
{
obj = (*inputs)[i];
obj->AddRef();
args->push_back(obj);
}
call = dynamic_cast<SQI_Node *>(squirrel->interpreter->FindCall(name->Data()->c_str()));
squirrel->LocalHeap->Import(call);
call->AddRef();
call->SetArgs(args);
for(i=Dico->begin();i!=Dico->end();i++)
{
args->push_front(i->second);
ret = squirrel->HopOnLeave(squirrel->interpreter,call);
if(ret)
{
SQI_Number *n = IsNumber(ret);
if(n->IsTrue())
break;
}
args->pop_front();
}
if(i==Dico->end())
return squirrel->interpreter->False;
else
return new SQI_String(squirrel->LocalHeap,i->first);
}
else
throw(new SQI_Exception(SQI_EX_BADARGTYPE,"DICTIONARY~find.if","second input must be a word"));
}
}
/*
* function : FindIfAll
* purpose : Find an element in the vector by executing a function
* input :
*
* SQI_Squirrel *squirrel, squirrel executing
* SQI_Args *inputs, inputs of the methods
*
* output : SQI_Object *, an array wich contain the result of the function on all the element of the array
* side effect : none
*/
SQI_Object *DicoObject::FindIfAll(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(inputs->Length()<1)
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~find.if.all","need at least 2 arguments"));
else
{
SQI_Keyword *name = IsKeyword((*inputs)[0]);
if(name)
{
ObjDico::const_iterator i;
SQI_Object *ret,*obj;
SQI_Node *call = NULL;
SQI_List *ocu = new SQI_List(squirrel->LocalHeap);
list<SQI_Object *> *args = new list<SQI_Object *>;
// we put all the other inputs in the inputs list now
for(int i=1;i<inputs->Length();i++)
{
obj = (*inputs)[i];
obj->AddRef();
args->push_back(obj);
}
call = dynamic_cast<SQI_Node *>(squirrel->interpreter->FindCall(name->Data()->c_str()));
squirrel->LocalHeap->Import(call);
call->AddRef();
call->SetArgs(args);
for(i=Dico->begin();i!=Dico->end();i++)
{
args->push_front(i->second);
ret = squirrel->HopOnLeave(squirrel->interpreter,call);
if(ret)
{
SQI_Number *n = IsNumber(ret);
if(n->IsTrue())
ocu->Add2End(new SQI_String(squirrel->LocalHeap,i->first));
}
args->pop_front();
}
return ocu;
}
else
throw(new SQI_Exception(SQI_EX_BADARGTYPE,"DICTIONARY~find.if.all","second input must be a word"));
}
}
/*
* function : FindIfLast
* purpose : Find the last occurence of an element in the vector by executing a function
* input :
*
* SQI_Squirrel *squirrel, squirrel executing
* SQI_Args *inputs, inputs of the methods
*
* output : SQI_Object *, an array wich contain the result of the function on all the element of the array
* side effect : none
*/
SQI_Object *DicoObject::FindIfLast(SQI_Squirrel *squirrel,SQI_Args *inputs)
{
if(inputs->Length()<1)
throw(new SQI_Exception(SQI_EX_BADARGSNUM,"DICTIONARY~find.if.last","need at least 1 arguments"));
else
{
SQI_Keyword *name = IsKeyword((*inputs)[0]);
if(name)
{
ObjDico::const_iterator i=Dico->end();
long j=Dico->size();
SQI_Object *ret,*obj;
SQI_Node *call = NULL;
list<SQI_Object *> *args = new list<SQI_Object *>;
if(!j)
{
delete args;
return squirrel->interpreter->False;
}
// we put all the other inputs in the inputs list now
for(int i=1;i<inputs->Length();i++)
{
obj = (*inputs)[i];
obj->AddRef();
args->push_back(obj);
}
call = dynamic_cast<SQI_Node *>(squirrel->interpreter->FindCall(name->Data()->c_str()));
squirrel->LocalHeap->Import(call);
call->AddRef();
call->SetArgs(args);
for(i--;i!=Dico->begin();i--,j--)
{
args->push_front(i->second);
ret = squirrel->HopOnLeave(squirrel->interpreter,call);
if(ret)
{
SQI_Number *n = IsNumber(ret);
if(n->IsTrue())
break;
}
args->pop_front();
}
if(!j)
return squirrel->interpreter->False;
else
return new SQI_String(squirrel->LocalHeap,i->first);
}
else
throw(new SQI_Exception(SQI_EX_BADARGTYPE,"DICTIONARY~find.if.last","second input must be a word"));
}
}
// Legacy member functions
/*
* function : Suicidal
* purpose : The object will commit suicide if no reference to it and not eternal
* input : none
* output : bool, true if the object had commit suicide
* side effect : the object may be deleted
*/
bool DicoObject::Suicidal(bool force=false)
{
if(status || force)
if(!REF)
{
//cout << "DICO suicide from " << heap << "\n";
EmptyIt();
delete this;
return true;
}
return false;
}
/*
* function : Print
* purpose : Create a string from the value of the object
* input : none
* output : string *, a string
* side effect : none
*/
string *DicoObject::Print(int prec = 3)
{
ObjDico::const_iterator i;
ostrstream out;
string *str;
//Locker.Lock();
for(i=Dico->begin();i!=Dico->end();i++)
{
str = (i->second)->Print(prec);
out << i->first << ":" << *str << "\n";
delete str;
}
//Locker.Unlock();
out << '\0';
string *ret = new string(out.str());
out.freeze(false);
return ret;
}
/*
* function : Show
* purpose : Create a string from the value of the object
* input : none
* output : string *, a string
* side effect : none
*/
string *DicoObject::Show(int prec = 3)
{
return Print(prec);
}
/*
* function : Clone
* purpose : clone the object in another heap or the same heap
* input : none
*
* SQI_Heap *target, heap target where to create the object clone
*
* output : BG_Object *, the object created
* side effect : none
*/
SQI_Object *DicoObject::Clone(SQI_Heap *target = NULL)
{
SQI_Heap *hp = target;
if(!hp)
hp = heap;
ObjDico::const_iterator i;
DicoObject *clone = new DicoObject(hp);
for(i=Dico->begin();i!=Dico->end();i++)
{
(*(clone->Dico))[i->first] = i->second;
(i->second)->AddRef();
(i->second)->Contained();
}
return clone;
}
/*
* function : DeepClone
* purpose : deep clone the object in another heap or the same heap
* input : none
*
* SQI_Heap *target, heap target where to create the object clone
*
* output : BG_Object *, the object created
* side effect : none
*/
SQI_Object *DicoObject::DeepClone(SQI_Heap *target = NULL)
{
SQI_Heap *hp = target;
if(!hp)
hp = heap;
SQI_Object *obj;
ObjDico::const_iterator i;
DicoObject *clone = new DicoObject(hp);
for(i=Dico->begin();i!=Dico->end();i++)
{
obj = (i->second)->DeepClone(hp);
(*(clone->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
return clone;
}
/*
* function : Dump
* purpose : Create a string with info/value of the object
* input : none
* output : string *, a string
* side effect : none
*/
string *DicoObject::Dump()
{
//string *value = this->Print();
ostrstream out;
out << "DICTIONARY[" << ID << "][" << REF << "][" << status << "]" << '\0'; // - " << *value << '\0';
//delete value;
string *ret = new string(out.str());
out.freeze(false);
return ret;
}
/*
* function : Neg
* purpose : Return a new object which is the negative value of the array
* input : none
* output : none
* side effect : none
*/
SQI_Object *DicoObject::Neg()
{
ObjDico::const_iterator i;
DicoObject *neg = new DicoObject(heap);
SQI_Object *obj;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj = (i->second)->Neg();
(*(neg->Dico))[i->first] = obj;
obj->Export(heap,SQI_NORMAL);
obj->AddRef();
obj->Contained();
}
return neg;
}
/*
* function : Inv
* purpose : Return a new object which is the inverse value of the array
* input : none
* output : none
* side effect : none
*/
SQI_Object *DicoObject::Inv()
{
ObjDico::const_iterator i;
DicoObject *neg = new DicoObject(heap);
SQI_Object *obj;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj = (i->second)->Inv();
(*(neg->Dico))[i->first] = obj;
obj->Export(heap,SQI_NORMAL);
obj->AddRef();
obj->Contained();
}
return neg;
}
/*
* function : operator==
* purpose : test if the object == something
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Integer
* side effect : none
*/
bool DicoObject::operator==(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
ObjDico::const_iterator i;
SQI_Object *obj1,*obj2=NULL;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
if(obj1!=obj2)
{
if(obj1 && obj2)
{
if(*obj1!=obj2)
return false;
}
else
return false;
}
}
return true;
}
else
return false;
}
else
return false;
}
/*
* function : operator>
* purpose : test if the object > something
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Integer
* side effect : none
*/
bool DicoObject::operator>(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
ObjDico::const_iterator i;
SQI_Object *obj1,*obj2 = NULL;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
if(obj1!=obj2)
{
if(obj1 && obj2)
{
if(*obj1<=obj2)
return false;
}
else
return false;
}
}
return true;
}
else
return false;
}
else
return false;
}
/*
* function : operator>=
* purpose : test if the object >= something
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Integer
* side effect : none
*/
bool DicoObject::operator>=(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
ObjDico::const_iterator i;
SQI_Object *obj1,*obj2 = NULL;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
if(obj1!=obj2)
{
if(obj1 && obj2)
{
if(*obj1<obj2)
return false;
}
else
return false;
}
}
return true;
}
else
return false;
}
else
return false;
}
/*
* function : operator<
* purpose : test if the object < something
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Integer
* side effect : none
*/
bool DicoObject::operator<(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
ObjDico::const_iterator i;
SQI_Object *obj1,*obj2 = NULL;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
if(obj1!=obj2)
{
if(obj1 && obj2)
{
if(*obj1>=obj2)
return false;
}
else
return false;
}
}
return true;
}
else
return false;
}
else
return false;
}
/*
* function : operator<=
* purpose : test if the object <= something
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Integer
* side effect : none
*/
bool DicoObject::operator<=(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
ObjDico::const_iterator i;
SQI_Object *obj1,*obj2 = NULL;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
if(obj1!=obj2)
{
if(obj1 && obj2)
{
if(*obj1>obj2)
return false;
}
else
return false;
}
}
return true;
}
else
return false;
}
else
return false;
}
/*
* function : operator!=
* purpose : test if the object != something
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Integer
* side effect : none
*/
bool DicoObject::operator!=(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
ObjDico::const_iterator i;
SQI_Object *obj1,*obj2 = NULL;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
if(obj1!=obj2)
{
if(obj1 && obj2)
{
if(*obj1!=obj2)
return true;
}
else
return true;
}
}
return false;
}
else
return true;
}
else
return true;
}
/*
* function : operator+
* purpose : Add an object to the array
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Object *, the result
* side effect : none
*/
SQI_Object *DicoObject::operator+(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj1,*obj2,*obj;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
else
{
obj = *obj1 + obj2;
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
else
throw (new SQI_Exception(SQI_EX_INVALIDE,"dictionary + object","unsupported by the array"));
}
else
{
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj = *(i->second) + op2;
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
}
/*
* function : operator-
* purpose : Sub an object to the array
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Object *, the result
* side effect : none
*/
SQI_Object *DicoObject::operator-(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj,*obj1,*obj2 = NULL;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
else
{
obj = *obj1 - obj2;
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
else
throw (new SQI_Exception(SQI_EX_INVALIDE,"dictionary - object","unsupported by the array"));
}
else
{
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj = *(i->second) - op2;
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
}
/*
* function : operator*
* purpose : Mult an object to the array
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Object *, the result
* side effect : none
*/
SQI_Object *DicoObject::operator*(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj,*obj1,*obj2=NULL;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
else
{
obj = *obj1 * obj2;
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
else
throw (new SQI_Exception(SQI_EX_INVALIDE,"dictionary * object","unsupported by the dictionary"));
}
else
{
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj = *(i->second) * op2;
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
}
/*
* function : operator/
* purpose : Divide an object to the array
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Object *, the result
* side effect : none
*/
SQI_Object *DicoObject::operator/(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj,*obj1,*obj2 = NULL;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
else
{
obj = *obj1 / obj2;
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
else
throw (new SQI_Exception(SQI_EX_INVALIDE,"dictionary / object","unsupported by the dictionary"));
}
else
{
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj = *(i->second) / op2;
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
}
/*
* function : Div
* purpose : Divide (integer division) an object to the array
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Object *, the result
* side effect : none
*/
SQI_Object *DicoObject::Div(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj,*obj1,*obj2 = NULL;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
else
{
obj = obj1->Div(obj2);
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
else
throw (new SQI_Exception(SQI_EX_INVALIDE,"dictionary // object","unsupported by the dictionary"));
}
else
{
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj = (i->second)->Div(op2);
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
}
/*
* function : InvDiv
* purpose : Divide (integer division) the array value by the object
* input : none
*
* SQI_Object op2, the object to use
*
* output : SQI_Object *, the result
* side effect : none
*/
SQI_Object *DicoObject::InvDiv(SQI_Object *op2)
{
SQI_ThePointer *right = IsThePointer(op2);
if(right)
{
if(right->IsA()==SQI_DICO)
{
DicoObject *a = dynamic_cast<DicoObject *>(right);
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj,*obj1,*obj2 = NULL;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj1 = i->second;
obj2 = (*(a->Dico))[i->first];
if(!obj2)
{
a->Dico->erase(i->first);
continue;
}
else
{
obj = obj1->InvDiv(obj2);
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
else
throw (new SQI_Exception(SQI_EX_INVALIDE,"object // dictionary","unsupported by the dictionary"));
}
else
{
DicoObject *result = new DicoObject(heap);
try
{
SQI_Object *obj;
ObjDico::const_iterator i;
for(i=Dico->begin();i!=Dico->end();i++)
{
obj = op2->InvDiv(i->second);
(*(result->Dico))[i->first] = obj;
obj->AddRef();
obj->Contained();
}
} catch (SQI_Exception *ex) {
result->Suicidal();
throw(ex);
}
return result;
}
}
/*
* function : Archive
* purpose : Store the list in an message
* input :
*
* BMessage *archive
*
* output : B_OK, if no error, B_ERROR else
* side effect : none
*/
status_t DicoObject::Archive(BMessage *archive)
{
ObjDico::const_iterator i;
// first we set the type if the object
archive->AddInt8("SQI_Object",SQI_DICO);
// we iterate on each element and store the archive of each element in the archive of the list
for(i=Dico->begin();i!=Dico->end();i++)
{
BMessage element;
(i->second)->Archive(&element);
archive->AddString("index",i->first.c_str());
archive->AddMessage("element",&element);
}
// that's all
return B_OK;
}
/*
* function : Instantiate
* purpose : Fill the list with the element in the archive message
* input :
*
* BMessage *archive
*
* output : B_OK, if no error, B_ERROR else
* side effect : none
*/
status_t DicoObject::Instantiate(SQI_Heap *target,BMessage *archive)
{
type_code type;
int32 count;
SQI_Object *elem;
const char *index;
archive->GetInfo("element",&type,&count);
for(int32 i=0;i<count;i++)
{
BMessage message;
archive->FindMessage("element",i,&message);
elem = InstantiateAnObject(target,&message);
if(elem)
{
index = archive->FindString("index",i);
elem->AddRef();
elem->Contained();
(*Dico)[string(index)] = elem;
}
}
return B_OK;
}
// creation functions and init function
SQI_ThePointer *NewDicoObject(SQI_Squirrel *squirrel)
{
return new DicoObject(squirrel);
//return new SQI_ThePointer(squirrel,SQI_DICO);
}
// Fill up the member map
void InitDicoObject()
{
AddArchive(SQI_DICO,InstantiateADico);
DicoMethods = new MethodTable();
DicoMethods->Add("get",(OMeth)(&DicoObject::Get));
DicoMethods->Add("set",(OMeth)(&DicoObject::Set));
DicoMethods->Add("size",(OMeth)(&DicoObject::Size));
DicoMethods->Add("min",(OMeth)(&DicoObject::Min));
DicoMethods->Add("max",(OMeth)(&DicoObject::Max));
DicoMethods->Add("av",(OMeth)(&DicoObject::Avg));
DicoMethods->Add("exists",(OMeth)(&DicoObject::Exist));
DicoMethods->Add("iterate",(OMeth)(&DicoObject::Iterate));
DicoMethods->Add("iterate.i",(OMeth)(&DicoObject::IterateWithIndex));
DicoMethods->Add("find",(OMeth)(&DicoObject::Find));
DicoMethods->Add("find.all",(OMeth)(&DicoObject::FindAll));
DicoMethods->Add("find.last",(OMeth)(&DicoObject::FindLast));
DicoMethods->Add("find.if",(OMeth)(&DicoObject::FindIf));
DicoMethods->Add("find.if.all",(OMeth)(&DicoObject::FindIfAll));
DicoMethods->Add("find.if.last",(OMeth)(&DicoObject::FindIfLast));
DicoMethods->Add("erase",(OMeth)(&DicoObject::Erase));
DicoMethods->Add("empty",(OMeth)(&DicoObject::Empty));
DicoMethods->Add("keys",(OMeth)(&DicoObject::Keys));
/*
DicoObjectMember[string("get")] = &DicoObject::Get;
DicoObjectMember[string("set")] = &DicoObject::Set;
DicoObjectMember[string("size")] = &DicoObject::Size;
DicoObjectMember[string("min")] = &DicoObject::Min;
DicoObjectMember[string("max")] = &DicoObject::Max;
DicoObjectMember[string("av")] = &DicoObject::Avg;
DicoObjectMember[string("exists")] = &DicoObject::Exist;
DicoObjectMember[string("iterate")] = &DicoObject::Iterate;
DicoObjectMember[string("iterate.i")] = &DicoObject::IterateWithIndex;
DicoObjectMember[string("find")] = &DicoObject::Find;
DicoObjectMember[string("find.all")] = &DicoObject::FindAll;
DicoObjectMember[string("find.last")] = &DicoObject::FindLast;
DicoObjectMember[string("find.if")] = &DicoObject::FindIf;
DicoObjectMember[string("find.if.all")] = &DicoObject::FindIfAll;
DicoObjectMember[string("find.if.last")] = &DicoObject::FindIfLast;
DicoObjectMember[string("erase")] = &DicoObject::Erase;
DicoObjectMember[string("empty")] = &DicoObject::Empty;
DicoObjectMember[string("keys")] = &DicoObject::Keys;
*/
}
void UninitDicoObject()
{
if(DicoMethods)
delete DicoMethods;
}
/*
* function : InstantiateADico
* purpose : Instantiate a dico from a message archive
* input :
*
* SQI_Heap *target, the heap where the object must be created
* BMessage *archive, the archived list
*
*
* output : SQI_Object *, the create list
* side effect : none
*/
SQI_Object *InstantiateADico(SQI_Heap *target,BMessage *archive)
{
DicoObject *vector = new DicoObject(target);
if(vector->Instantiate(target,archive)==B_OK)
return vector;
else
{
vector->Suicidal(true);
return NULL;
}
}
| 21.744802 | 112 | 0.574915 | [
"object",
"vector"
] |
ccf2712d822efc298d174fc764678a40e34242a5 | 7,490 | cpp | C++ | Frame/Effect04.cpp | CrossProd/Aardbei_SouthsideExploration | cead610de95fb87b5aab60b4ec834a8c814a3c12 | [
"MIT"
] | 1 | 2018-11-20T03:50:35.000Z | 2018-11-20T03:50:35.000Z | Frame/Effect04.cpp | rbruinier/Aardbei_SouthsideExploration | cead610de95fb87b5aab60b4ec834a8c814a3c12 | [
"MIT"
] | null | null | null | Frame/Effect04.cpp | rbruinier/Aardbei_SouthsideExploration | cead610de95fb87b5aab60b4ec834a8c814a3c12 | [
"MIT"
] | null | null | null | /*
Southside Variations - Effect04
Description:
Retro lijnen, dus gebend, maar dan 3 of 4 om een centrale heen gebonden.
*/
#include "Main.h"
#include "Effect04.h"
#define SPERM_COUNT 40
Vector spermLocation[SPERM_COUNT];
#define TUBE_SEGMENTX 20
#define TUBE_SEGMENTY 100
#define TUBE_RADIUS 0.25f
#define TUBE_COUNT 5
Vector middleList[TUBE_SEGMENTY + 1];
Vector rotationList[TUBE_SEGMENTY + 1];
float GetRed(DWORD color)
{
return ((color & 0xff0000) >> 16) / 255.f;
}
float GetGreen(DWORD color)
{
return ((color & 0x00ff00) >> 8) / 255.f;
}
float GetBlue(DWORD color)
{
return ((color & 0x0000ff)) / 255.f;
}
void Effect04::MoveTubes(float timer)
{
Vector centerPoint(0, 0, 0);
Vector direction(0, 0.7f, 0);
Vector rotation(0, 0, 0);
Vector centerPointDif[] =
{
Vector(0, 0, 0),
Vector(0.5f, 0, 0),
Vector(-0.5f, 0, 0),
Vector(0, 0, 0.5f),
Vector(0, 0, -0.5f)
};
Vector centerPointRot[TUBE_COUNT];
int index = 0;
float tubeRot = timer / -400.f;
for (int j = 0; j < TUBE_SEGMENTY + 1; j++)
{
middleList[j] = centerPoint;
rotationList[j] = rotation;
Matrix matRotation = Matrix::RotateZ(rotation.z) * Matrix::RotateY(rotation.y) *
Matrix::RotateX(rotation.x);
Matrix matTubeRot = Matrix::RotateY(tubeRot + (sin((j * 0.1f) + (timer / 500.f)) * 0.7f));
tubeRot += 0.5f;
float scale = 1.2f + sin((j * 0.2f) + (timer / 250.f)) * 0.2f;
for (int k = 0; k < TUBE_COUNT; k++)
{
centerPointRot[k] = centerPointDif[k];// * matTubeRot;
}
Matrix matFinal = matTubeRot * matRotation;
for (int i = 0; i < TUBE_SEGMENTX + 1; i++)
{
for (int k = 0; k < TUBE_COUNT; k++)
{
float x = (sin((float)i * _2PI / TUBE_SEGMENTX) * TUBE_RADIUS * scale) + (centerPointRot[k].x * scale);
float y = centerPointRot[k].y * scale;
float z = (cos((float)i * _2PI / TUBE_SEGMENTX) * TUBE_RADIUS * scale) + (centerPointRot[k].z * scale);
Vector vertex(x, y, z);
vertex = (vertex * matFinal) + centerPoint;
*(Vector*)&scene->object[k]->vertex[index] = vertex;
}
index++;
}
centerPoint += direction * matRotation;
rotation.x = sin((j * 0.13f) + (timer / 10000000000.f)) * (sin(j * 0.13f) * 1.2f);
rotation.y = cos(j * 0.11f) * 0.4f;
rotation.z = cos((j * 0.11f) + (timer / 10000000000.f)) * 1.1f;
}
}
void Effect04::Init()
{
scene = new Scene();
scene->AddLight(new Light());
Object* tube1 = Primitives::Tube(TUBE_SEGMENTX, TUBE_SEGMENTY, 1.f, 10.f);
Object* tube2 = Primitives::Tube(TUBE_SEGMENTX, TUBE_SEGMENTY, 1.f, 10.f);
Object* tube3 = Primitives::Tube(TUBE_SEGMENTX, TUBE_SEGMENTY, 1.f, 10.f);
Object* tube4 = Primitives::Tube(TUBE_SEGMENTX, TUBE_SEGMENTY, 1.f, 10.f);
Object* tube5 = Primitives::Tube(TUBE_SEGMENTX, TUBE_SEGMENTY, 1.f, 10.f);
scene->AddObject(tube1);
scene->AddObject(tube2);
scene->AddObject(tube3);
scene->AddObject(tube4);
scene->AddObject(tube5);
DWORD color1 = 0x759D60;
DWORD color2 = 0x54A96C;
DWORD color3 = 0x67BC9F;
DWORD color4 = 0x72D0CF;
tube1->SetAmbient(1, 1, 1);
tube2->SetAmbient(GetRed(color1), GetGreen(color1), GetBlue(color1));
tube3->SetAmbient(GetRed(color2), GetGreen(color2), GetBlue(color2));
tube4->SetAmbient(GetRed(color3), GetGreen(color3), GetBlue(color3));
tube5->SetAmbient(GetRed(color4), GetGreen(color4), GetBlue(color4));
tube2->SetDiffuse(GetRed(color1), GetGreen(color1), GetBlue(color1));
tube3->SetDiffuse(GetRed(color2), GetGreen(color2), GetBlue(color2));
tube4->SetDiffuse(GetRed(color3), GetGreen(color3), GetBlue(color3));
tube5->SetDiffuse(GetRed(color4), GetGreen(color4), GetBlue(color4));
for (int i = 0; i < 5; i++)
{
scene->object[i]->SetTexture(textureLoader->GetTexture("tube2"));
scene->object[i]->ScaleUV(1, 20);
}
scene->object[0]->SetTexture(textureLoader->GetTexture("tube1"));
tube1->Finish(true);
tube2->Finish(true);
tube3->Finish(true);
tube4->Finish(true);
tube5->Finish(true);
const int nrSprites = 40;
for (int j = 0; j < SPERM_COUNT; j++)
{
SpriteList* sp = new SpriteList(nrSprites, 0.3f, textureLoader->GetTexture("sperm"), BLEND_ADD);
for (int i = 1; i < nrSprites; i++)
{
sp->sprite[i].diffuse = MixColor(0.75f + ((i / 4.f) / (float)nrSprites), 0xffffff, 0x000000);
}
sp->Finish(true);
scene->AddSpriteList(sp);
float t = rand() % 1000;
spermLocation[j].x = sin((t / 500.f) * _PI) * 1.8f;
spermLocation[j].y = 0.0f;
spermLocation[j].z = cos((t / 500.f) * _PI) * 1.8f;
}
}
void MoveSpermCell(SpriteList* sp, float timer, Vector pos)
{
timer += 2000;
const float speed = 0.5f;
const int nrSprites = 40;
const float keyLength = 400 * speed;
//Vector pos(2, 0, 0);
float timer3 = timer;
for (int i = 0; i < nrSprites; i++)
{
int key1 = timer / keyLength;
if (key1 < 0) key1 = 0;
if (key1 > TUBE_SEGMENTY) key1 = TUBE_SEGMENTY;
int key2 = key1 + 1;
key1 = ((TUBE_SEGMENTY + 1) - key1) % (TUBE_SEGMENTY + 1);
key2 = (key1 - 1) % (TUBE_SEGMENTY + 1);
float timer2 = (int)timer % (int)keyLength;
Vector loc, rot;
rot.x = rotationList[key1].x + ((rotationList[key2].x - rotationList[key1].x) / keyLength) * timer2;
rot.y = rotationList[key1].y + ((rotationList[key2].y - rotationList[key1].y) / keyLength) * timer2;
rot.z = rotationList[key1].z + ((rotationList[key2].z - rotationList[key1].z) / keyLength) * timer2;
Matrix matRotation = Matrix::RotateZ(rot.z) * Matrix::RotateY(rot.y) * Matrix::RotateX(rot.x);
if (i > 0)
{
Matrix matY = Matrix::RotateY(sin((i * 0.3f) - (timer3 * 0.02f)) * 0.05f);
matRotation = matY * matRotation;
}
loc = pos * matRotation;
loc.x += middleList[key1].x + ((middleList[key2].x - middleList[key1].x) / keyLength) * timer2;
loc.y += middleList[key1].y + ((middleList[key2].y - middleList[key1].y) / keyLength) * timer2;
loc.z += middleList[key1].z + ((middleList[key2].z - middleList[key1].z) / keyLength) * timer2;
sp->sprite[i].x = loc.x;
sp->sprite[i].y = loc.y;
sp->sprite[i].z = loc.z;
timer -= 40.f * speed;
}
//for (int i = 1; i < nrSprites; i++)
//{
// sp->sprite[i].x = i * 0.07f;
// sp->sprite[i].y = 0 + sin((i * 0.3f) - (timer * 0.01f)) * 0.1f;
// sp->sprite[i].z = 0;
// sp->sprite[i].diffuse = MixColor(0.75f + ((i / 4.f) / (float)nrSprites), 0xffffff, 0x000000);
//}
}
void Effect04::Do(float timer, int pos, int row)
{
//timer += 10000;
pyramid->SetAmbientLight(0x202020);
pyramid->SetFogNone();
MoveTubes(timer);
for (int i = 0; i < SPERM_COUNT; i++)
{
MoveSpermCell(scene->spriteList[i], timer - (i * 400), spermLocation[i]);
}
scene->camera->SetLocation(1, 15, 2);
scene->camera->SetTarget(1.1f, 14.0, 18);
scene->camera->SetRoll(-90);
pyramid->SetRenderTarget(renderChain->GetOriginal());
pyramid->ClearBuffers(CLEAR_SCREEN | CLEAR_ZBUFFER, 0x0);
scene->Render();
pyramid->ResetRenderTarget();
postProcessor->psBrightPass->SetLuminance(0.017f);
postProcessor->psBloom->SetBloomScale(1.15f);
postProcessor->chainGlow01->Render();
pyramid->SetTexture(renderChain->GetSource(), 0);
drawer2D->BeginScene(BLEND_ADD);
drawer2D->DrawFullscreen();
drawer2D->EndScene();
}
void Effect04::Destroy()
{
// clean up
scene->Destroy();
delete scene;
} | 25.56314 | 108 | 0.62243 | [
"render",
"object",
"vector"
] |
ccf65a58b5e77562dd4b9c73d1cb6cad6b224d1e | 3,102 | hpp | C++ | fault-monitor/operational-status-monitor.hpp | lkammath/phosphor-led-manager-1 | 23d5408ba8050e12ec31cba66f3f111d6200d70c | [
"Apache-2.0"
] | 4 | 2017-12-01T19:36:29.000Z | 2020-04-22T17:21:09.000Z | fault-monitor/operational-status-monitor.hpp | lkammath/phosphor-led-manager-1 | 23d5408ba8050e12ec31cba66f3f111d6200d70c | [
"Apache-2.0"
] | 10 | 2016-11-09T09:16:13.000Z | 2021-06-30T03:31:02.000Z | fault-monitor/operational-status-monitor.hpp | lkammath/phosphor-led-manager-1 | 23d5408ba8050e12ec31cba66f3f111d6200d70c | [
"Apache-2.0"
] | 12 | 2016-12-16T17:18:07.000Z | 2021-12-06T05:26:45.000Z | #pragma once
#include "../utils.hpp"
#include <sdbusplus/bus.hpp>
#include <sdbusplus/server.hpp>
namespace phosphor
{
namespace led
{
namespace Operational
{
namespace status
{
namespace monitor
{
using namespace phosphor::led::utils;
/** @class Monitor
* @brief Implementation of LED handling during the change of the Functional
* property of the OperationalStatus interface
*
* @details This implements methods for watching OperationalStatus interface of
* Inventory D-Bus object and then assert corresponding LED Group
* D-Bus objects.
*/
class Monitor
{
public:
Monitor() = delete;
~Monitor() = default;
Monitor(const Monitor&) = delete;
Monitor& operator=(const Monitor&) = delete;
Monitor(Monitor&&) = default;
Monitor& operator=(Monitor&&) = default;
/** @brief Add a watch for OperationalStatus.
*
* @param[in] bus - D-Bus object
*/
Monitor(sdbusplus::bus::bus& bus) :
bus(bus),
matchSignal(bus,
"type='signal',member='PropertiesChanged', "
"interface='org.freedesktop.DBus.Properties', "
"sender='xyz.openbmc_project.Inventory.Manager', "
"arg0namespace='xyz.openbmc_project.State.Decorator."
"OperationalStatus'",
std::bind(std::mem_fn(&Monitor::matchHandler), this,
std::placeholders::_1))
{}
private:
/** @brief sdbusplus D-Bus connection. */
sdbusplus::bus::bus& bus;
/** @brief sdbusplus signal matches for Monitor */
sdbusplus::bus::match_t matchSignal;
/** DBusHandler class handles the D-Bus operations */
DBusHandler dBusHandler;
/**
* @brief Callback handler that gets invoked when the PropertiesChanged
* signal is caught by this app. Message is scanned for Inventory
* D-Bus object path and if OperationalStatus::Functional is changed,
* then corresponding LED Group D-Bus object is called to assert.
*
* @param[in] msg - The D-Bus message contents
*/
void matchHandler(sdbusplus::message::message& msg);
/**
* @brief From the Inventory D-Bus object, obtains the associated LED group
* D-Bus object, where the association name is "fault_led_group"
*
* @param[in] inventoryPath - Inventory D-Bus object path
*
* @return std::vector<std::string> - Vector of LED Group D-Bus object paths
*/
const std::vector<std::string>
getLedGroupPaths(const std::string& inventoryPath) const;
/**
* @brief Update the Asserted property of the LED Group Manager.
*
* @param[in] ledGroupPaths - LED Group D-Bus object Paths
* @param[in] value - The Asserted property value, True / False
*/
void updateAssertedProperty(const std::vector<std::string>& ledGroupPaths,
bool value);
};
} // namespace monitor
} // namespace status
} // namespace Operational
} // namespace led
} // namespace phosphor
| 31.02 | 80 | 0.627015 | [
"object",
"vector"
] |
ccfc6c63360fe35e884c9b5a9d78166d32039403 | 1,995 | hpp | C++ | bftengine/src/bftengine/ViewChangeSafetyLogic.hpp | beerriot/concord-bft | e1282c148bcf9eb28534e571cf7f6ff9a53808db | [
"Apache-2.0"
] | null | null | null | bftengine/src/bftengine/ViewChangeSafetyLogic.hpp | beerriot/concord-bft | e1282c148bcf9eb28534e571cf7f6ff9a53808db | [
"Apache-2.0"
] | null | null | null | bftengine/src/bftengine/ViewChangeSafetyLogic.hpp | beerriot/concord-bft | e1282c148bcf9eb28534e571cf7f6ff9a53808db | [
"Apache-2.0"
] | 1 | 2021-05-18T02:12:33.000Z | 2021-05-18T02:12:33.000Z | //Concord
//
//Copyright (c) 2018 VMware, Inc. All Rights Reserved.
//
//This product is licensed to you under the Apache 2.0 license (the "License"). You may not use this product except in compliance with the Apache 2.0 License.
//
//This product may include a number of subcomponents with separate copyright notices and license terms. Your use of these subcomponents is subject to the terms and conditions of the subcomponent's license, as noted in the LICENSE file.
#pragma once
#include "ViewChangeMsg.hpp"
#include <vector>
using std::vector;
class IThresholdVerifier;
namespace bftEngine
{
namespace impl
{
class ViewChangeSafetyLogic
{
public:
ViewChangeSafetyLogic(const uint16_t n, const uint16_t f, const uint16_t c, IThresholdVerifier* const preparedCertificateVerifier, const Digest& digestOfNull);
struct Restriction
{
bool isNull;
Digest digest;
};
SeqNum calcLBStableForView(ViewChangeMsg** const viewChangeMsgsOfPendingView) const;
void computeRestrictions(ViewChangeMsg** const inViewChangeMsgsOfCurrentView,
const SeqNum inLBStableForView,
SeqNum& outMinRestrictedSeqNum,
SeqNum& outMaxRestrictedSeqNum,
Restriction* outSafetyRestrictionsArray
) const;
// Notes about outSafetyRestrictionsArray:
// - It should have kWorkWindowSize elements.
// - If at the end of this method outMaxRestrictedSeqNum==0, then outSafetyRestrictionsArray is 'empty'
// - Otherwise, its first (outMaxRestrictedSeqNum-outMinRestrictedSeqNum+1) elements are valid : they represents the restrictions between outMinRestrictedSeqNum and outMaxRestrictedSeqNum
protected:
bool computeRestrictionsForSeqNum(SeqNum s, vector<ViewChangeMsg::ElementsIterator*>& VCIterators, const SeqNum upperBound, Digest& outRestrictedDigest) const;
const uint16_t N; // number of replicas
const uint16_t F;
const uint16_t C;
IThresholdVerifier* const preparedCertVerifier;
const Digest nullDigest;
};
}
}
| 30.692308 | 235 | 0.769424 | [
"vector"
] |
6910ced89370d0b117d8e639cf659911444a147c | 464 | hpp | C++ | diu/Engine/codes/CodeModule.hpp | dicarne/diu | 23589581ec5bc6a3ed1b8322e24d33977852ca1c | [
"MIT"
] | null | null | null | diu/Engine/codes/CodeModule.hpp | dicarne/diu | 23589581ec5bc6a3ed1b8322e24d33977852ca1c | [
"MIT"
] | null | null | null | diu/Engine/codes/CodeModule.hpp | dicarne/diu | 23589581ec5bc6a3ed1b8322e24d33977852ca1c | [
"MIT"
] | null | null | null | #ifndef CODE_MODULE_H_
#define CODE_MODULE_H_
#include "CodeCodePage.hpp"
#include <unordered_map>
#include <memory>
#include <string>
#include <vector>
using std::unordered_map;
using std::shared_ptr;
using std::string;
using std::vector;
class CodeModule
{
private:
/* data */
public:
unordered_map<string, shared_ptr<CodeNode>> node_to_code_page;
vector<shared_ptr<CodeCodePage>> pages;
CodeModule(/* args */) {}
~CodeModule() {}
};
#endif | 19.333333 | 66 | 0.724138 | [
"vector"
] |
6910f935a03b5d5d177ab7d8ae181865263aca40 | 755 | cpp | C++ | LeetCode/cpp/122.cpp | ZintrulCre/LeetCode_Archiver | de23e16ead29336b5ee7aa1898a392a5d6463d27 | [
"MIT"
] | 279 | 2019-02-19T16:00:32.000Z | 2022-03-23T12:16:30.000Z | LeetCode/cpp/122.cpp | ZintrulCre/LeetCode_Archiver | de23e16ead29336b5ee7aa1898a392a5d6463d27 | [
"MIT"
] | 2 | 2019-03-31T08:03:06.000Z | 2021-03-07T04:54:32.000Z | LeetCode/cpp/122.cpp | ZintrulCre/LeetCode_Crawler | de23e16ead29336b5ee7aa1898a392a5d6463d27 | [
"MIT"
] | 12 | 2019-01-29T11:45:32.000Z | 2019-02-04T16:31:46.000Z | class Solution {
public:
int maxProfit(vector<int> &prices) {
bool bought = false;
auto size = prices.size();
int profit = 0, price = 0;
int i = 0;
while (i < size) {
if (!bought) {
if (prices[i] < prices[i + 1] && i + 1 < size) {
price = prices[i];
bought = true;
}
} else {
if (prices[i] > prices[i + 1] && i + 1 < size) {
profit += (prices[i] - price);
price = 0;
bought = false;
}
}
++i;
}
if (bought)
profit += prices[i - 1] - price;
return profit;
}
};
| 26.964286 | 64 | 0.350993 | [
"vector"
] |
691e6b047285126ef540426828e454606eae9d2e | 6,687 | cpp | C++ | src/Layout.cpp | Milerius/Qaterial | 2c1a9bfc5e44eb6f447f345f2a3cda61661b55e9 | [
"MIT"
] | null | null | null | src/Layout.cpp | Milerius/Qaterial | 2c1a9bfc5e44eb6f447f345f2a3cda61661b55e9 | [
"MIT"
] | null | null | null | src/Layout.cpp | Milerius/Qaterial | 2c1a9bfc5e44eb6f447f345f2a3cda61661b55e9 | [
"MIT"
] | null | null | null | // ──── INCLUDE ────
// Library Headers
#include <Qaterial/Layout.hpp>
// Dependencies Headers
// Qt Headers
// Stl Headers
#include <cmath>
// ──── DECLARATION ────
using namespace qaterial;
// ──── FUNCTIONS ────
LayoutAttached::LayoutAttached(QObject* object) :
_extraLarge(Layout::defaultPreferredFill(Layout::ExtraLarge)),
_large(Layout::defaultPreferredFill(Layout::Large)),
_medium(Layout::defaultPreferredFill(Layout::Medium)),
_small(Layout::defaultPreferredFill(Layout::Small)),
_extraSmall(Layout::defaultPreferredFill(Layout::ExtraSmall))
{
}
Layout::Layout(QObject* parent) : QObject(parent)
{
// Reevaluate no matter if horizontal or vertical layout
connect(this, &Layout::itemsChanged, this, &Layout::computeChildItemsSize, Qt::QueuedConnection);
connect(this, &Layout::spacingChanged, this, &Layout::computeChildItemsSize);
connect(this, &Layout::layoutDirectionChanged, this, &Layout::computeChildItemsSize);
connect(this,
&Layout::flowChanged,
this,
[this]()
{
_flowChanged = true;
computeChildItemsSize();
});
// Reevaluate only horizontal
connect(this, &Layout::widthChanged, this, &Layout::triggerHorizontalReevaluate);
connect(this, &Layout::leftPaddingChanged, this, &Layout::triggerHorizontalReevaluate);
connect(this, &Layout::rightPaddingChanged, this, &Layout::triggerHorizontalReevaluate);
// Reevaluate only vertical
connect(this, &Layout::heightChanged, this, &Layout::triggerVerticalReevaluate);
connect(this, &Layout::topPaddingChanged, this, &Layout::triggerVerticalReevaluate);
connect(this, &Layout::bottomPaddingChanged, this, &Layout::triggerVerticalReevaluate);
}
void Layout::setItems(QQmlListReference value)
{
resetItemsWidth();
resetItemsHeight();
_itemListRef = value;
_items.clear();
// Recreate std::vector<QQuickItem*> from the QQmlListReference to cast only here.
if(value.canAt() && value.canCount())
{
const auto itemCount = value.count();
for(int i = 0; i < itemCount; ++i)
{
if(const auto item = qobject_cast<QQuickItem*>(value.at(i)))
{
_items.push_back(item);
}
}
}
Q_EMIT itemsChanged();
}
bool Layout::setColumns(int value)
{
if(value <= 0)
return false;
if(_columns == value)
return false;
_columns = value;
Q_EMIT columnsChanged();
return true;
}
void Layout::setUserColumns(int value)
{
if(setColumns(value))
_userSetColumns = true;
}
void Layout::resetUserColumns()
{
_userSetColumns = false;
computeColumnsFromType();
}
void Layout::forceUpdate() { computeChildItemsSize(); }
void Layout::triggerHorizontalReevaluate()
{
if(flowIsLeftToRight())
computeChildItemsSize();
}
void Layout::triggerVerticalReevaluate()
{
if(flowIsTopToBottom())
computeChildItemsSize();
}
void Layout::computeChildItemsSize()
{
// Optionally reset item width or height if the flow direction changed
resetItemsSize();
// Compute layout type based on width/height depending on flow
evaluateType();
// Should be called after type evaluation, since it depends on it
computeColumnsFromType();
// Resize every item, in 'layoutDirection' order
doForeachItem(
[this](QQuickItem* item)
{
const auto size = getPreferredSize(item);
if(flowIsLeftToRight())
item->setWidth(size);
else
item->setHeight(size);
});
// Keep track if width or height have been set, for later reset if flow direction change
if(flowIsLeftToRight() && !_widthForcedOnce)
_widthForcedOnce = true;
if(flowIsTopToBottom() && !_heightForcedOnce)
_heightForcedOnce = true;
}
void Layout::resetItemsWidth()
{
if(!_widthForcedOnce)
return;
for(const auto item: _items) { item->resetWidth(); }
_widthForcedOnce = false;
}
void Layout::resetItemsHeight()
{
if(!_heightForcedOnce)
return;
for(const auto item: _items) { item->resetHeight(); }
_heightForcedOnce = false;
}
void Layout::resetItemsSize()
{
if(!_flowChanged)
return;
resetItemsWidth();
resetItemsHeight();
_flowChanged = false;
}
void Layout::evaluateType()
{
if(flowIsLeftToRight())
setType(sizeToType(width()));
else if(flowIsTopToBottom())
setType(sizeToType(height()));
}
void Layout::doForeachItem(const std::function<void(QQuickItem*)>& callback)
{
if(!callback)
return;
if(_items.empty())
return;
if(layoutDirection() == Qt::LeftToRight)
{
for(auto it = _items.begin(); it != _items.end(); ++it) { callback(*it); }
}
else
{
for(auto it = _items.rbegin(); it != _items.rend(); ++it) { callback(*it); }
}
}
Layout::LayoutFill Layout::getPreferredFill(QQuickItem* item) const
{
const auto attached = qobject_cast<LayoutAttached*>(qmlAttachedPropertiesObject<Layout>(item, false));
if(!attached)
return defaultPreferredFill();
switch(LayoutBreakpoint(type()))
{
case ExtraLarge: return LayoutFill(attached->extraLarge());
case Large: return LayoutFill(attached->large());
case Medium: return LayoutFill(attached->medium());
case Small: return LayoutFill(attached->small());
case ExtraSmall: return LayoutFill(attached->extraSmall());
default: return FillParent;
}
}
Layout::LayoutFill Layout::defaultPreferredFill() const { return defaultPreferredFill(type()); }
int Layout::fillToRealBlockCount(LayoutFill fill) const
{
const auto ratio = qreal(fill) / 12.f;
return std::ceil(qreal(columns()) * ratio);
}
qreal Layout::getPreferredSize(QQuickItem* item) const
{
const auto consumedSpace = fillToRealBlockCount(getPreferredFill(item));
if(consumedSpace <= 0)
return 0;
Q_ASSERT(columns() > 0);
const auto allSpacingSize = qreal(columns() - 1) * spacing();
const auto oneBlockSize = std::floor(paddingLessSize() - allSpacingSize) / qreal(columns());
const auto blockSize = oneBlockSize * consumedSpace;
const auto overlappedSpacingSize = (consumedSpace - 1) * spacing();
return std::floor(blockSize + overlappedSpacingSize);
}
void Layout::computeColumnsFromType()
{
if(_userSetColumns)
return;
switch(LayoutBreakpoint(type()))
{
case ExtraLarge:
case Large: setColumns(12); break;
case Medium: setColumns(8); break;
case Small:
case ExtraSmall: setColumns(4); break;
default: setColumns(12);
}
}
| 26.121094 | 106 | 0.664274 | [
"object",
"vector"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.